koha.git
4 years agoBug 23442: Add refund option to patron account page
Martin Renvoize [Thu, 21 Nov 2019 13:09:47 +0000]
Bug 23442: Add refund option to patron account page

This enhancement adds a refined workflow to allow librarians
to refund payments to patrons and record these refunds on the
patrons account.

The use case is that a patron has paid for something before
then performing an action that may require some level of refund
to be actioned.  Perhaps they are returning a lost and paid for
book.

Test plan:
1) Undertake a series of transactions that result in a debit
   accountline being partially or fully paid off.
2) Note that a new 'Issue refund' button appears next to a
   debit (but only if your user has the refund permission or
   is a superlibrarian)
3) Click the 'Issue refund' button and a modal should appear
   pre-populated with the amount - amountoutstanding.
4) You should be able to edit the amount you wish to refund,
   record the refund or cancel.
5) Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23442: Add refund permission
Martin Renvoize [Thu, 21 Nov 2019 15:04:56 +0000]
Bug 23442: Add refund permission

Add a new subpermission called 'refund' to the 'updatecharges'
permission group which will allow/prevent refund actions to be
performed by staff.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23442: Add 'reduce' method to Koha::Account::Line
Martin Renvoize [Thu, 21 Nov 2019 12:10:41 +0000]
Bug 23442: Add 'reduce' method to Koha::Account::Line

This enhancement adds a 'reduce' method to Koha::Account::Line which can
be used to reduce a charge/debit by adding a credit to offset against
the amount outstanding.

It may be used to apply a discount whilst retaining the original debit
amounts or to apply a full or partial refund for example when a lost
item is found and returned.

The created credit will be immediately applied against the debit unless
the debit has already been paid, in which case a 'zero' offset will be
added to maintain a link to the debit but the outstanding credit will be
left so it may be applied to other debts.

Test Plan:
1) Run the included tests and verify they pass.
2) Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23442: Add account credit types
Martin Renvoize [Thu, 21 Nov 2019 15:20:45 +0000]
Bug 23442: Add account credit types

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 10352: Get add operations too
Nick Clemens [Fri, 13 Dec 2019 17:08:58 +0000]
Bug 10352: Get add operations too

When an add for biblio or item is recorded there is no space in the info field

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 10352: (follow-up) Show the biblionumber for items in modification logs
Nick Clemens [Mon, 25 Nov 2019 12:09:45 +0000]
Bug 10352: (follow-up) Show the biblionumber for items in modification logs

This patch adds a link to the the biblio that shows the biblionumber of the item. It makes things a little more obvious

To test:
1 - Find a biblio with an item where an itemnumber on another biblio is equal to that biblionumber
   i.e. In the sample data:
        biblionumber 59 with item with itemnumber 127
        item with itemnumber  59 on biblionumber 23
2 - Edit both items however you wish
3 - On biblionumber 59 click the modification log
4 - You should see "Item 127"
5 - Click "Submit" on the form - this searches as itemnumber
6 - You should see "Item 59"
7 - Apply patch
8 - On biblionumber 59 click the modification log
9 - You should see "Item 127 from Biblio 59"
10 - Click "Submit" on the form - this searches as itemnumber
11 - You should see "Item 59 from Biblio 23"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 10352: Use a new object_type parameter instead of the module's name
Jonathan Druart [Mon, 25 Nov 2019 10:28:40 +0000]
Bug 10352: Use a new object_type parameter instead of the module's name

To dissociate a search on biblio and item, we pass a new "object_type"
parameter to viewlog.pl. If equals 'biblio' we will assume that "object"
contains a biblionumber

Signed-off-by: Nick Clemens <nick@bywatersolutions.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 10352: Display the correct modification logs for bibliographic records
Jonathan Druart [Mon, 13 May 2019 15:36:14 +0000]
Bug 10352: Display the correct modification logs for bibliographic records

The 'Modification log" link in the cataloguing module returns confusing
results. The 'object' parameter is the biblionumber, but the all log
from itemnumber=biblionumber will be displayed as well.
Since bug 11473 we have the action_logs.info column that is prefixed by
'item ' or 'biblio ' to disociated an item modification from a biblio
modif.
This patch suggests a quick and dirty approach, use this column to make
sure we are searching for the correct logs.
/!\ As bug 11473 did not update the existing rows, we will no longer display
the logs created prior to this change.

Test plan:
Make sure you have at least 2 bibliographic records with some items
Make sure you have the biblionumbers of those records that match
existing itemnumbers
Edit them (no matter what you change)
Go to the bibliographic detail page (staff) and click "Modification log"
You should see the correct changes.

Signed-off-by: hc <hc@interleaf.ie>
Signed-off-by: Nick Clemens <nick@bywatersolutions.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 24313: Always display XSLT errors in logs
Jonathan Druart [Fri, 27 Dec 2019 13:55:36 +0000]
Bug 24313: Always display XSLT errors in logs

From
  commit 295ae33800a322facfdf56795f4c02b2fd53432b
  Bug 20272: Replace error numbers by codes in XSLT_Handler

"""
    Make XSLT_Handler a little bit less noisy by defaulting print_warns to
    false unless $ENV{DEBUG} is set. (See also bug 19018).
"""

I think we should warn the errors in the logs. They are not debug messages here, we should not rely on DEBUG.
If too noisy we should fix the original issues, not hide all the errors (which make the XSLT debugging super hard)

Test plan:
Break a XSLT, reload the page and confirm that there are useful errors in the Koha log file

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24123: Fix import of UTF-8 encoded MARC21 MARCXML using bulkmarcimport (elastic...
Jonathan Druart [Tue, 10 Dec 2019 14:24:36 +0000]
Bug 24123: Fix import of UTF-8 encoded MARC21 MARCXML using bulkmarcimport (elastic only)

If elastic is used as search engine, the bulkmarcimport.pl will not
handle correctly UTF-8 encoded MARCXML

Koha::SearchEngine::Search->new uses a require statement to load the correct Search module.
This is done l.257 of bulkmarcimport.pl:
  257 my $searcher = Koha::SearchEngine::Search->new

Koha::SearchEngine::Elasticsearch::Search will `use MARC::File::XML`, and so resets the arguments set before:
  216     $MARC::File::XML::_load_args{BinaryEncoding} = 'utf-8';

  220     $MARC::File::XML::_load_args{RecordFormat} = $recordformat;

An easy (but dirty) fix could be to move the declaration of my $searcher before in the script.
The tricky (but correct) fix would be to remove the long standing "ugly hack follows" comment.

This patch is the easy, and dirty, fix

Test plan:
Use the command line tool to import MARXCML records that contains unicode characters into Koha

Something like `misc/migration_tools/bulkmarcimport.pl -biblios -file record.marcxml -m=MARCXML`

Without this patch you will notice that unicode characters will not be displayed correctly

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Add test descriptions
Martin Renvoize [Mon, 2 Dec 2019 09:22:31 +0000]
Bug 23974: Add test descriptions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Add tests for issue on closed day
Martin Renvoize [Mon, 2 Dec 2019 09:00:18 +0000]
Bug 23974: Add tests for issue on closed day

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Test Notes
Martin Renvoize [Fri, 29 Nov 2019 17:09:06 +0000]
Bug 23974: Test Notes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Add POD for hours_between
Martin Renvoize [Fri, 29 Nov 2019 16:44:45 +0000]
Bug 23974: Add POD for hours_between

Add a bit of missing POD whilst we're working in here

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: (follow-up) Add same day loan tests
Martin Renvoize [Fri, 8 Nov 2019 13:37:17 +0000]
Bug 23974: (follow-up) Add same day loan tests

Hourly loans can be short enough to not cross a day boundary and as such
we should test for that scenario in the hour_between tests too.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Both methods should have the same logic/construction
Jonathan Druart [Tue, 5 Nov 2019 16:44:36 +0000]
Bug 23974: Both methods should have the same logic/construction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Add tests for days_between
Jonathan Druart [Tue, 5 Nov 2019 16:13:53 +0000]
Bug 23974: Add tests for days_between

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Add new tests for hours_between
Jonathan Druart [Tue, 5 Nov 2019 15:23:00 +0000]
Bug 23974: Add new tests for hours_between

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23974: Improve readability
Jonathan Druart [Tue, 5 Nov 2019 14:18:38 +0000]
Bug 23974: Improve readability

This patch does not change anything, just a bit of cleaning

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21959: Add sponsor details
Martin Renvoize [Thu, 9 Jan 2020 16:52:23 +0000]
Bug 21959: Add sponsor details

Sponsored-by: City of Nîmes
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24255: Add summation methods to Koha::Account::Lines
Martin Renvoize [Tue, 17 Dec 2019 15:58:21 +0000]
Bug 24255: Add summation methods to Koha::Account::Lines

This patch adds a number of summation methods to Koha::Account::Lines
giving quick access to overall total, total credits and total debits.

Test plan
1) Run the included tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24257: Fix close of modal on 'Yes, print slip'
Jonathan Druart [Wed, 18 Dec 2019 09:37:00 +0000]
Bug 24257: Fix close of modal on 'Yes, print slip'

When a item-transfer-modal is prompted by returns.tt and the option
"Yes, print slip" is selected the transfer is not initiated and the
modal does not disappear.

The print_slip hidden input must be in the same form as the
submit/button .print, otherwise the browser logs
  this.form.print_slip is undefined

Test plan:
1. set AutomaticItemReturn to "don't"
2. Check out an item and attempt to check it in at a branch it doesn't
belong to.
3. When the popup modal appears select 'Yes, print slip'.
=> Observe that the transfer does initiate and the modal closes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 18731: (QA follow-up) Spelling and POD corrections
Martin Renvoize [Thu, 9 Jan 2020 16:24:13 +0000]
Bug 18731: (QA follow-up) Spelling and POD corrections

Just a coulpe of very minor tweaks to keep the QA scripts happy

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 18731: OpenAPI definitions
Tomas Cohen Arazi [Wed, 4 Oct 2017 18:43:03 +0000]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It matches the voted RFC.

Sponsored-by: Camden County
Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 18731: Use the stashed koha.embed in objects.search
Tomas Cohen Arazi [Mon, 6 Jan 2020 16:00:26 +0000]
Bug 18731: Use the stashed koha.embed in objects.search

This patch makes the objects.search helper use the koha.embed structure
that is embedded in the authenticate_api_request step.

This way, any controller using it will benefit from automatic embed
handling.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 18731: Add API mappings to K::A::{Basket,Invoice}
Tomas Cohen Arazi [Mon, 30 Dec 2019 18:36:57 +0000]
Bug 18731: Add API mappings to K::A::{Basket,Invoice}

This patch adds to_api_mapping definitions to the following classes:

- Koha::Acquisition::Basket
- Koha::Acquisition::Invoice

They are implemented following the proposed RFCs:
https://wiki.koha-community.org/wiki/Acquisitions_baskets_endpoint_RFC
https://wiki.koha-community.org/wiki/Acquisitions_invoices_endpoint_RFC

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 18731: /acquisitions/orders endpoint
Tomas Cohen Arazi [Tue, 5 Sep 2017 19:44:43 +0000]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.

The attribute names are consistent with the voted RFC

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> SUCCESS: Tests pass!
3. Test the API with your favourite tool (Postman?)
=> SUCCESS: It works as expected!
4 Sign off :-D

Sponsored-by: Camden County
Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 18731: Unit tests
Tomas Cohen Arazi [Tue, 5 Nov 2019 14:37:57 +0000]
Bug 18731: Unit tests

This patch implements unit tests for the orders endpoint.

Sponsored-by: Camden County
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 18731: Make authenticate_api_request stash the embed structure
Tomas Cohen Arazi [Mon, 30 Dec 2019 18:34:43 +0000]
Bug 18731: Make authenticate_api_request stash the embed structure

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24302: Add a way to specify nested objects to embed in OpenAPI
Tomas Cohen Arazi [Mon, 23 Dec 2019 13:26:04 +0000]
Bug 24302: Add a way to specify nested objects to embed in OpenAPI

This patch introduces a helper for handling x-koha-embed headers on API
requests. It reads the embed definitions and adds them to the stash for
later use (either manually on the controllers, or in the objects.search
helper.

x-koha-embed needs to be defined as a list on the OpenAPI spec.

It throws an exception when invalid combinations are found.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24228: Make ->to_api params a hashref
Tomas Cohen Arazi [Mon, 23 Dec 2019 15:03:12 +0000]
Bug 24228: Make ->to_api params a hashref

This patch makes the parameters for Koha::Object(s)->to_api a hashref
preparing the ground for new parameters. The proposed syntax is:

$object->to_api(
    {
        embed => {
            'items' => {
                'children' => {
                    'homebranch' => {}
                }
            }
        }
    }
);

Tests are added for the Koha::Objects implementation and tests for
Koha::Object are adjusted to the new syntax, and a test for the single
result accessor is added as well.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24228: Add parameters to Koha::Object(s)->to_api to automatically embed objects
Agustin Moyano [Thu, 19 Dec 2019 18:50:49 +0000]
Bug 24228: Add parameters to Koha::Object(s)->to_api to automatically embed objects

This patch makes Koha::Object(s)->to_api have an 'embeds' parameter that
using dot notation (e.g. resource.related_resource.another_one) allows
embedding objects recursively.

To test:
1. Apply this patch
2. prove t/db_dependent/Koha/Object.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24252: Add relations to Koha::Account::Line
Martin Renvoize [Fri, 13 Sep 2019 13:03:11 +0000]
Bug 24252: Add relations to Koha::Account::Line

This patch adds two new relationships to the Koha::Account::Line object.

* credit_offsets - returns all credit type Koha::Account::Offsets
  related to this Koha::Account::Line.
* debit_offsets - returns all debit type Koha::Account::Offsets related
  to this Koha::Account::Line.
* credits - returns all credits related to this Koha::Account::Line.
* debits - returns all debits related to this Koha::Account::Line.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: (follow-up) Fix number of tests in t/db_dependent/Koha/Objects.t
Josef Moravec [Tue, 7 Jan 2020 11:30:53 +0000]
Bug 24321: (follow-up) Fix number of tests in t/db_dependent/Koha/Objects.t

Test plan:
prove t/db_dependent/Koha/Objects.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /patrons
Tomas Cohen Arazi [Thu, 2 Jan 2020 14:04:10 +0000]
Bug 24321: Clean /patrons

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /holds
Tomas Cohen Arazi [Tue, 31 Dec 2019 15:53:26 +0000]
Bug 24321: Clean /holds

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /patrons/{patron_id}/account
Tomas Cohen Arazi [Tue, 31 Dec 2019 15:35:43 +0000]
Bug 24321: Clean /patrons/{patron_id}/account

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /items
Tomas Cohen Arazi [Tue, 31 Dec 2019 15:31:24 +0000]
Bug 24321: Clean /items

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /biblios
Tomas Cohen Arazi [Tue, 31 Dec 2019 15:26:46 +0000]
Bug 24321: Clean /biblios

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /checkouts
Tomas Cohen Arazi [Tue, 31 Dec 2019 14:50:36 +0000]
Bug 24321: Clean /checkouts

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /libraries
Tomas Cohen Arazi [Tue, 31 Dec 2019 14:07:37 +0000]
Bug 24321: Clean /libraries

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /acquisitions/vendors
Tomas Cohen Arazi [Tue, 31 Dec 2019 13:50:15 +0000]
Bug 24321: Clean /acquisitions/vendors

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /acquisitions/funds
Tomas Cohen Arazi [Tue, 31 Dec 2019 13:42:38 +0000]
Bug 24321: Clean /acquisitions/funds

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Clean /cities
Tomas Cohen Arazi [Tue, 31 Dec 2019 13:35:15 +0000]
Bug 24321: Clean /cities

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Make objects.search use mappings from Koha::Object(s)
Tomas Cohen Arazi [Tue, 31 Dec 2019 13:23:44 +0000]
Bug 24321: Make objects.search use mappings from Koha::Object(s)

This patch simplifies the objects.search helper so it relies entirely on
the result set object for the attribute mappings.

The result is no more to_api or to_model mappings are passed. The
controllers need to be cleaned up after this patch.

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

Note: the original version of this helpers accepted arbitrary mappings
and are now constrianed to real mappings on the Koha::Object level. As
such, the number of tests got reduced.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Make dbic_merge_sorting accept a result set as parameter
Tomas Cohen Arazi [Tue, 31 Dec 2019 12:48:54 +0000]
Bug 24321: Make dbic_merge_sorting accept a result set as parameter

This patch makes dbic_merge_sorting accept a result set as parameter and
solves a FIXME in _build_order_atom.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24321: Add Koha::Objects->attributes_from_api
Tomas Cohen Arazi [Tue, 31 Dec 2019 12:16:17 +0000]
Bug 24321: Add Koha::Objects->attributes_from_api

This patch makes the 'attributes_from_api' method from the singular
class available from the result set class.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Objects.t
=> SUCCESS: Tests pass!
4. Sign off :-D
5. Yeah, I skipped 3 :-P

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: Catch dt_from_string exceptions
Tomas Cohen Arazi [Fri, 27 Dec 2019 18:21:30 +0000]
Bug 23893: Catch dt_from_string exceptions

This patch adds exception handling to the attributes_from_api() method.
This can happen with invalid date/datetimes, for example.

Tests are added:

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: Remove Overloaded method from Koha::Patron
Jonathan Druart [Fri, 27 Dec 2019 16:03:16 +0000]
Bug 23893: Remove Overloaded method from Koha::Patron

That way we are dealing with any date fields for any Koha::Object

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: (QA follow-up) Explicit date format
Tomas Cohen Arazi [Fri, 27 Dec 2019 15:15:39 +0000]
Bug 23893: (QA follow-up) Explicit date format

This patch makes the input date format explicit. It also adds a missing
POD.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: No special care for booleans
Jonathan Druart [Fri, 27 Dec 2019 14:21:27 +0000]
Bug 23893: No special care for booleans

Tests pass without that changes. If we need them they should be at
Koha::Object anyway.

About the date, I also think that that should be moved to Koha::Object
(we can guess it, like we do in Koha::Object->store, retrieve the
datatype and adjust). Also we can send a DT object to DBIC, no need for
an sql formatted date

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: Use in /patrons
Tomas Cohen Arazi [Tue, 12 Nov 2019 13:00:14 +0000]
Bug 23893: Use in /patrons

This patch makes the patrons endpoint use the new methods from
Koha::Object.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: Use in /cities
Tomas Cohen Arazi [Tue, 12 Nov 2019 12:59:53 +0000]
Bug 23893: Use in /cities

This patch makes the cities controller use the new methods from
Koha::Object.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: Add new_from_api and set_from_api to Koha::Object
Tomas Cohen Arazi [Mon, 11 Nov 2019 19:07:03 +0000]
Bug 23893: Add new_from_api and set_from_api to Koha::Object

This patch introduces the following methods to the Koha::Object class:
- set_from_api
- new_from_api

This methods are going to be used when writing API controllers that map
to the attributes to the DB schema ones.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: Implement Koha::Object->from_api_mapping
Tomas Cohen Arazi [Mon, 11 Nov 2019 18:03:28 +0000]
Bug 23893: Implement Koha::Object->from_api_mapping

This patch implements the from_api_mapping method, that calculates (and
caches) the reserve mapping from the to_api_mapping method.

A generic to_api_mapping is added to simplify things a bit in the generic
to_api method and so the mappings are reusable in the way they are in
from_api_mapping.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23893: Unit tests
Tomas Cohen Arazi [Mon, 11 Nov 2019 18:03:29 +0000]
Bug 23893: Unit tests

This patch introduces tests for the implemented methods.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21959: allow only i and g regex modifiers
Alex Arnaud [Tue, 2 Apr 2019 14:14:39 +0000]
Bug 21959: allow only i and g regex modifiers

Signed-off-by: Mathilde Formery <mathilde.formery@ville-nimes.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21959: use a link instead of a checkbox
Alex Arnaud [Tue, 2 Apr 2019 13:20:34 +0000]
Bug 21959: use a link instead of a checkbox

Signed-off-by: Mathilde Formery <mathilde.formery@ville-nimes.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21959: Batch item modification - ability to apply regular expression on text...
Alex Arnaud [Thu, 6 Dec 2018 08:43:42 +0000]
Bug 21959: Batch item modification - ability to apply regular expression on text fields

Test plan:
  - go to Tools > Batch item modification,
  - select items to modify,
  - for one or some text fields, check the second checkbox (Use regular
    expression) and type your regex,
  - check the regex has been applied.

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Mathilde Formery <mathilde.formery@ville-nimes.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24308: Suggestions table on suggestions.pl should have separate columns for dates
Lucas Gass [Thu, 26 Dec 2019 17:12:25 +0000]
Bug 24308: Suggestions table on suggestions.pl should have separate columns for dates

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 24277: Fix date received editing when receiving an order
Jonathan Druart [Mon, 23 Dec 2019 15:19:47 +0000]
Bug 24277: Fix date received editing when receiving an order

Bug 8417 added the ability to edit the date received, but a merge
conflict was wrongly resolved during a rebase of
  commit 20d9ed618fbe3cdcb9c04444a1f8a584b0364069
  Bug 13321: Rename variables

Test plan:
Create an order
Receive it
Set a date (different from today)
=> The date you picked should have been set in DB for the order

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24277: Regression tests
Tomas Cohen Arazi [Wed, 8 Jan 2020 13:55:40 +0000]
Bug 24277: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24263: DBRev 19.12.00.006
Martin Renvoize [Wed, 8 Jan 2020 14:21:23 +0000]
Bug 24263: DBRev 19.12.00.006

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24263: (QA follow-up) Atomic update fixes
Tomas Cohen Arazi [Wed, 8 Jan 2020 13:11:07 +0000]
Bug 24263: (QA follow-up) Atomic update fixes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24263: Replace borrowers.relationship with NULL when was empty string
Jonathan Druart [Wed, 18 Dec 2019 13:04:58 +0000]
Bug 24263: Replace borrowers.relationship with NULL when was empty string

When you create a new patron, its relationship field is populated with
an empty string when we are expecting NULL.

Otherwise the about page will display a warning about a missing/wrong
relationship in data (that is not in the syspref)

Test plan:
0/ Do not apply the patches from this bug report
1/ Create a new patron (child)
2/ Notice that relationship column in DB is set to an empty string
3/ Go to the about page, notice the invalid warning about relationship
values not in the syspref
4/ Apply DB changes and tests
5/ Execute the update DB entry
=> The value in DB is now NULL when was ""
6/ Execute the tests
=> It fails
7/ Apply the last patch
8/ Add and edit a patron (child)
=> relationship is set to NULL in DB
9/ Execute the tests
=> They pass!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24263: DB changes
Jonathan Druart [Wed, 18 Dec 2019 13:08:34 +0000]
Bug 24263: DB changes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24263: Add tests
Jonathan Druart [Wed, 18 Dec 2019 13:04:35 +0000]
Bug 24263: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24327: Redirect to the login form if AnonSuggestion misconfigured
Jonathan Druart [Thu, 2 Jan 2020 10:38:18 +0000]
Bug 24327: Redirect to the login form if AnonSuggestion misconfigured

Test plan:
Turn on AnonSuggestion but set AnonymousPatron to an invalid value
Go to /cgi-bin/koha/opac-suggestions.pl?op=add
=> You see the login form

Signed-off-by: hc <hc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24327: Add warning to the about page is AnonSugggestions but AnonymousPatron
Jonathan Druart [Thu, 2 Jan 2020 10:26:49 +0000]
Bug 24327: Add warning to the about page is AnonSugggestions but AnonymousPatron

This patch adds a warning to the about page if AnonSuggestions is set
but AnonymousPatron.

Test plan:
Turn on AnonSuggestions and set AnonymousPatron to 0
=> You see a warning on the about page
Turn on AnonSuggestions and set AnonymousPatron to an invalid value
=> You see a warning on the about page
Turn off AnonSuggestions
=> No warning
Turn on AnonSuggestions and set AnonymousPatron to a valid value
=> No warning

Signed-off-by: hc <hc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24054: Typo in ClaimReturnedWarningThreshold system preference
Bernardo Gonzalez Kriegel [Sun, 29 Dec 2019 10:40:37 +0000]
Bug 24054: Typo in ClaimReturnedWarningThreshold system preference

Fixed type: cliams -> claims

To test:
1) Apply the patch
2) Go to System preferences > Circulation preferences > ClaimReturnedWarningThreshold
3) Check the text is fixed.

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

4 years agoBug 24104: Item search - Prevent "Edit" dropdown button to overflow
Jonathan Druart [Mon, 25 Nov 2019 15:48:15 +0000]
Bug 24104: Item search - Prevent "Edit" dropdown button to overflow

Making it displays on the left fixes the problem.

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

4 years agoBug 24329: DBRev 19.12.00.005
Martin Renvoize [Wed, 8 Jan 2020 11:09:54 +0000]
Bug 24329: DBRev 19.12.00.005

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24329: Add a test
Jonathan Druart [Sun, 5 Jan 2020 22:08:28 +0000]
Bug 24329: Add a test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24329: Prevent update of timestamp on action_logs updates
Martin Renvoize [Thu, 2 Jan 2020 13:03:07 +0000]
Bug 24329: Prevent update of timestamp on action_logs updates

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24329: Correction to updatedatabase
Martin Renvoize [Thu, 2 Jan 2020 12:56:19 +0000]
Bug 24329: Correction to updatedatabase

Ensure timestamp is not overwriteen during upgrade when applying updates
for bug 3820

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24361: (RM follow-up) Restore 0 handling in CalcFine
Martin Renvoize [Wed, 8 Jan 2020 10:02:02 +0000]
Bug 24361: (RM follow-up) Restore 0 handling in CalcFine

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24350: Fix Branches.pickup_locations
Jonathan Druart [Mon, 6 Jan 2020 21:10:16 +0000]
Bug 24350: Fix Branches.pickup_locations

This will fix the following error:
Template process failed: undef error - Not a HASH reference at
/home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 96.
 at /home/vagrant/kohaclone/C4/Templates.pm line 122

Koha::Libraries->pickup_locations does not always return an array, but
arrayref if $biblio is not a Koha::Biblio object.

I do not think it's the correct fix, the pattern in
Koha::Libraries->pickup_locations is wrong: we should not expect 2
different types for a given parameter, biblio should always be a
Koha::Biblio (idem for item btw).
That could be fixed easily if the template had the Koha::Biblio object
sent.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21684: Fix Hold.t
Jonathan Druart [Tue, 7 Jan 2020 15:06:38 +0000]
Bug 21684: Fix Hold.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21684: Koha::Object->delete must return a Koha::Object
Jonathan Druart [Tue, 7 Jan 2020 12:30:32 +0000]
Bug 21684: Koha::Object->delete must return a Koha::Object

Not a DBIx::Class object.

Tests have been added, add Bookseller.t fixed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21684: Fix UploadedFile[s]->delete
Jonathan Druart [Tue, 7 Jan 2020 11:10:05 +0000]
Bug 21684: Fix UploadedFile[s]->delete

Tests were failing with:
 #   Failed test 'Test delete via UploadedFile as well as UploadedFiles'
 #   at t/db_dependent/Upload.t line 193.
 DBIx::Class::Row::delete(): Not in database at /kohadevbox/koha/Koha/Object.pm line 219

I am not sure this patch is perfect, a set of uploaded files should be
deleted in a transaction, which would be rollback if something is wrong.
But it will be tricky to restore the files after they have been deleted.
It seems that we should deal with that with a more complicated process
and should be part of a separate bug.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24150: Prevent random failure comparing updated_on
Jonathan Druart [Tue, 7 Jan 2020 15:02:36 +0000]
Bug 24150: Prevent random failure comparing updated_on

Jenkins is currently failing (slow server, datetime comparison, etc.)

koha_1       |     #   Failed test at t/db_dependent/Koha/Old.t line 48.
koha_1       |     #     Structures begin differing at:
koha_1       |     #          $got->{updated_on} = '2020-01-07 14:15:22'
koha_1       |     #     $expected->{updated_on} = '2020-01-07 14:15:21'
koha_1       |     # Looks like you failed 1 test of 1.
koha_1       |
koha_1       | #   Failed test 'Koha::Old::Patrons'
koha_1       | #   at t/db_dependent/Koha/Old.t line 49.
koha_1       | # Looks like you failed 1 test of 2.
koha_1       | [14:15:22] t/db_dependent/Koha/Old.t ...............................................

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24328: Fix bibliographic frameworks install (linkid)
Jonathan Druart [Thu, 2 Jan 2020 12:12:58 +0000]
Bug 24328: Fix bibliographic frameworks install (linkid)

With strict mode enabled (tested with MariaDB 10.4.11)

ERROR 1366 (22007) at line 8029: Incorrect integer value: '' for column
`koha_kohadev`.`auth_subfield_structure`.`linkid` at row 769

Test plan:
Insert the .sql files from this patch and confirm that you can now
insert them correctly

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24314: Update de-DE MARC21 frameworks for updates 28+29 (May and November 2019)
Katrin Fischer [Sun, 29 Dec 2019 03:36:35 +0000]
Bug 24314: Update de-DE MARC21 frameworks for updates 28+29 (May and November 2019)

This updates the MARC framework files in the de-DE (German) installer
to the latest MARC standard. The files also include some translation
changes and fixes.

Files have been generated using the po files on translate.koha-community.org.

To test:
- Run the de-DE installer on a fresh database
- Verify that all files are installed without errors
- Verify that the frameworks are correctly in place

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
MARC21 files load without problems, no qa errors.
Loaded into 'en' install (delete fw then load) all frameworks look good.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24312: Update MARC21 frameworks to Updates 28+29 (May and November 2019)
Bernardo Gonzalez Kriegel [Fri, 27 Dec 2019 13:09:22 +0000]
Bug 24312: Update MARC21 frameworks to Updates 28+29 (May and November 2019)

MARC21 format changes

Bibliographic
-------------
Update 28 (May 2019)

New subfield f in 540
New subfield g in 506,540
New subfield q in 506,540
New subfield 2 in 540
New subfield 2 in 100,110,111,130,240,
                  700,710,711,730,758
                  800,810,811,830
New subfield 7 in 856
New code b in 007/01 Sound Recording

Update 29 (November 2019)

New field 688
New subfield i in 041
New subfield t in 041
New subfield g in 751
Renamed subfield g in 041

Authority
---------
Update 28 (May 2019)

New subfield 0 and 1 in 024
Renamed subfield 2 in 024
New subfield 7 in 856

Update 29 (November 2019)
No changes

To test:
1) Remove all your frameworks
2) Check mandatory bibliographic and authority files load without problem
3) Check new fields/subfields

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24365: (bug 24217 follow-up) Fix encoding issue for translator script
Jonathan Druart [Tue, 7 Jan 2020 14:47:14 +0000]
Bug 24365: (bug 24217 follow-up) Fix encoding issue for translator script

I am not sure what happened here, but adding strict for TmplTokenizer.pm
breaks a test for translation.

It has been caught by a failing test:
 % prove xt/author/translatable-templates.t
will display lines "invalid multibyte sequence"

I did a diff between the generated files and found:
< msgid "àrbok"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24361: (bug 24217 follow-up) Fix several warnings in C4 modules
Jonathan Druart [Tue, 7 Jan 2020 11:26:01 +0000]
Bug 24361: (bug 24217 follow-up) Fix several warnings in C4 modules

With bug 24217 pushed, lot of warnings appears during the tests are run.
Most of them are "Use of uninitialized value in "

Test plan:
Take a look at the output of run 1049
https://jenkins.koha-community.org/job/Koha_Master_D9/1049/consoleFull

Most of the warnings from this run will be removed by this patch

At least 2 are not fixed:
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/C4/Reserves.pm line 791.
t/db_dependent/Items_DelItemCheck.t => see 23463

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24361: Fix warning in C4::Record line 435
Jonathan Druart [Tue, 7 Jan 2020 11:26:01 +0000]
Bug 24361: Fix warning in C4::Record line 435

Use of uninitialized value in concatenation (.) or string at /kohadevbox/koha/C4/Record.pm line 435

Caught by a failing test:
    #   Failed test 'Export csv with wrong marcxml should raise a warning'
    #   at t/db_dependent/Exporter/Record.t line 113.
    # found warning:  problem with :721 : :1: parser error : Start tag expected, '<' not found
    # found warning: Use of uninitialized value in concatenation (.) or string at /kohadevbox/koha/C4/Record.pm line 435.
    # expected to find warning: (?^u:.*Start tag expected.*)

Test plan:
Make sure the tests pass now

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24150: Add missing koha_object[s]_class methods and skip for deletedborrowers
Jonathan Druart [Mon, 6 Jan 2020 22:49:37 +0000]
Bug 24150: Add missing koha_object[s]_class methods and skip for deletedborrowers

deletedborrowers does not have a PK, and adding it is out of the scope
of this patchset. Indeed we will have to handle possible duplication of
borrowernumber values, which does not seem trivial.
Having bug 20271 in mind, we will have to deal with this problematic
anyway later.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24080: DBRev 19.12.00.004
Martin Renvoize [Fri, 3 Jan 2020 16:46:23 +0000]
Bug 24080: DBRev 19.12.00.004

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24080: (QA follow-up) Remove processing for removed field
Martin Renvoize [Mon, 23 Dec 2019 14:58:48 +0000]
Bug 24080: (QA follow-up) Remove processing for removed field

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24080: Adjust text in modal
Kelly McElligott [Mon, 23 Dec 2019 13:03:00 +0000]
Bug 24080: Adjust text in modal

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24080: Add payout option to patron account page
Martin Renvoize [Thu, 21 Nov 2019 13:59:43 +0000]
Bug 24080: Add payout option to patron account page

This enhancement adds a refined workflow to allow librarians to pay out
money to patrons and record these payouts on the patrons account.

The use case is that a patron has somehow accrued credit, through a
refund perhaps, and the library wants to be able to physically hand over
some money to balance the patrons account.

Test plan:
1) Undertake a series of transactions that result in some outstanding
   credit on a patrons account.
2) Note that a new 'Issue payout' button appears next to a credit with
   an outstanding balance (but only if your user has the payout
   permission or is a superlibrarian)
3) Click the 'Issue payout' button and a modal should appear
   pre-populated with the amountoutstanding.
4) You should be able to edit the amount you wish to payout, make
   payment or cancel.
5) Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24080: Add updatecharge payout permission
Martin Renvoize [Thu, 21 Nov 2019 14:28:03 +0000]
Bug 24080: Add updatecharge payout permission

Add a new subpermission called 'payout' to the 'updatecharges'
permission group which will allow/prevent payout actions to be performed
by staff.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24080: Add 'payout' method to Koha::Account::Line
Martin Renvoize [Thu, 21 Nov 2019 13:22:39 +0000]
Bug 24080: Add 'payout' method to Koha::Account::Line

This enhancement adds a 'payout' method to Koha::Account::Line which can
be used to 'pay out' a credit to a patron.

When such a credit is 'paid out' this method will create a corresponding
account debit line with an amount equal to the amountoutstanding on the
original credit and the two acocuntlines will be immediately applied against
each other.

Test Plan:
1) Run the included tests and verify they pass.
2) Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24080: Payout account debit type
Martin Renvoize [Thu, 21 Nov 2019 14:50:12 +0000]
Bug 24080: Payout account debit type

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 10469: Display more when editing subfields in frameworks
Owen Leonard [Fri, 13 Dec 2019 23:42:28 +0000]
Bug 10469: Display more when editing subfields in frameworks

This patch removes the accordion feature from the MARC subfields
structure editor. The form is not long, and I think in this case the
accordion makes the process more difficult to navigate.

To test, apply the patch and go to Administration -> MARC frameworks ->
Framework structure -> Subfield structure -> Edit. Choose a tag with
multiple subfields to best test the changes.

The whole form should apppear, and tabs functionality should work
correctly. Test that making changes under multiple tabs works correctly.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 7882: (follow-up) Only show sortable icon for sortable tags
Owen Leonard [Tue, 17 Dec 2019 15:19:56 +0000]
Bug 7882: (follow-up) Only show sortable icon for sortable tags

Only tags which can be repeated can be sorted, so the "bars" icon should
not display by these tags.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.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 7882: (follow-up) Update sorting interaction
Owen Leonard [Mon, 16 Dec 2019 19:06:57 +0000]
Bug 7882: (follow-up) Update sorting interaction

This follow-up modifies the CSS for the sortable fields so that a
different icon is used. Elsewhere in Koha (stock rotation stage sorting)
we use the "bars" icon to indicate a sortable element. I think it would
be good to continue to use this. The cursor is now styled as a "Move"
cursor.

The configuration of the sortable function in the script has been
updated in two ways: 1. The movement of the element is constrained along
the y-axis, and 2. The movement of the element is contstrained to the
container within which it can be moved (for the tag, the tab, and for
the subfield, the tag).

To test, apply the patch and edit a MARC record in the basic cataloging
editor.

Confirm that the new icon is used, and that the "Move" cursor shows when
you hover over the icon.

Confirm that a tag can be dragged up and down within the constraints of
the visible section. A subfield should be only movable within its parent
tag.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.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 7882: Add ability to move and reorder fields in MARC editor
Maryse Simard [Wed, 23 Oct 2019 19:34:39 +0000]
Bug 7882: Add ability to move and reorder fields in MARC editor

Use jQueryUI sortable to make fields and subfields moveable in the
MARC editor for both records and authorities.

This patch convert items from div's to ul's and consequently alter css
and js to match. It also replace the up arrow with a more adapted icon
(from font awesome).

Primary authorship by Elliott Davis.

To Test:

1. Add or edit a record in cataloguing module.
2. You should be able to move the fields and subfields around.
    - You can click on any part of the element to drag it, the move
    icon to the left of the item is a good place to do it.
    => You can only change the order of fields of the same tag.
3. Make sure all of the javascript driven fonctionnality still work :
    - Duplicate fields/subfields
    - Remove fields/subfields
    - Using the tag editor for control fields or to link authorities
    - etc
4. Reorder some fields/subfields and save the record.
5. Edit the record again.
6. The order in the editor should match the changes which were saved.
    - Empty subfields should appear after the ones with content.
7. Repeat steps 1-6 with the authority editor.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24173: Advanced Editor: Show subtitle & published date on the search page
Cori Lynn Arnold [Wed, 18 Dec 2019 18:18:59 +0000]
Bug 24173: Advanced Editor: Show subtitle & published date on the search page

To test:

Prior to patch:
1/Verify that EnableAdvancedCatalogingEditor syspref is set to "enable"
2/Go to Cataloging
3/Click on "Advanced Editor" button
4/In left hand box put "specious" under Keywords and hit "enter"
5/verify that "Library of Congress" (or some other server) Z39.50 is checked
6/Verify that there are no headings for "Subtitle" and "Published"

Apply Patch
1/Go to Administration->Koha to MARC mapping
2/Add or verify that there are entries for "biblio.subtitle" and
"biblio.copyrightdate"
3/Go to Cataloging
4/Click on "Advanced Editor" button
5/In left hand box put "specious" under Keywords and hit "enter"
6/verify that "Library of Congress" (or some other server) Z39.50 is checked
7/Verify that there are headings for "Subtitle" and "Published" and the
data matches with the fields from Koha to MARC mapping when you click on
"View MARC" link for that record.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>