koha.git
4 years agoBug 24396: Fix Suggestions.t with MySQL 8
Jonathan Druart [Fri, 10 Jan 2020 10:29:15 +0000 (11:29 +0100)]
Bug 24396: Fix Suggestions.t with MySQL 8

 #   Failed test 'DelSuggestion deletes the correct suggestion'
 #   at t/db_dependent/Suggestions.t line 413.
 #          got: 'my title 3'
 #     expected: 'my deleted title'
 t/db_dependent/Suggestions.t .. 112/113 # Looks like you failed 1 test of 113.

Suggestions were returned in the reverse order. Adding an ORDER BY clause fixes the problem.

Test plan:
 % prove t/db_dependent/Suggestions.t
must return green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24337: Checkout note cannot be marked seen if more than 20 exist
Owen Leonard [Fri, 3 Jan 2020 20:02:26 +0000 (20:02 +0000)]
Bug 24337: Checkout note cannot be marked seen if more than 20 exist

This patch modifies the event handler on the individual "Mark seen" /
"Mark unseen" buttons in the table of checkout notes. For an event to be
successfully attached to a hidden element it must be given a context.

To test you should have multiple checkout notes to work with, both seen
and unseen. Apply the patch and go to "Checkout notes pending" from the
staff client home page.

 - Navigate to the second "page" of data in the DataTable.
 - Test the functionality of the "Mark seen" and "Mark unseen" buttons.
   They should work correctly.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24335: Cannot mark checkout notes seen/not seen in bulk
Owen Leonard [Fri, 3 Jan 2020 18:43:15 +0000 (18:43 +0000)]
Bug 24335: Cannot mark checkout notes seen/not seen in bulk

This patch changes the way checkbox events are handled on the checkout
notes page so that checking a checkbox enables the batch operation
controls.

Note: The addition of a "markseen" class is a preventative measure to
avoid future problems where using the "btn-small" class might not be
specific enough.

To test you should have multiple checkout notes to work with, both seen
and unseen. Apply the patch and go to "Checkout notes pending" from the
staff client home page.

 - Check any checkbox. The "Mark seen" and "Mark not seen" should go
   from disabled to enabled.
   - Test that the buttons work correctly.
 - Click the "Select all" and "Clear all" controls and confirm that the
   buttons are enabled and disabled correctly.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23274: Mock simple_search_compat to cover both search engines
Nick Clemens [Tue, 26 Nov 2019 12:57:17 +0000 (12:57 +0000)]
Bug 23274: Mock simple_search_compat to cover both search engines

Signed-off-by: Michal Denar <black23@gmail.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 24323: Advanced editor - Display an error message if the record did not save
Cori Lynn Arnold [Tue, 31 Dec 2019 17:10:14 +0000 (17:10 +0000)]
Bug 24323: Advanced editor - Display an error message if the record did not save

Invalid 008 with helper silently fails to save.

This patch adds a "else if" to fall through if the error message isn't
one of the previously defined ones ("syntax" and "invalid") and presents
the human with a generic message that "Something went wrong, cannot
save."

Prior to testing:
a/Verify that Advanced Editor is enabled
b/Download the errorrecord.mrc from bug

To test:
1/Apply patch
2/Go to Cataloging->Advanced Editor
3/Click "Import Record" button and navigate to the record saved from
step b/
4/Add an 003 field (as required by the default cataloging config)
5/Hit "Save to catalog"
6/Verify that a message is passed to the user that the file was unable
to be saved

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 24371: Fix "Show all items" avaibility link (use $raw filter) - intra
Jonathan Druart [Fri, 10 Jan 2020 08:56:12 +0000 (09:56 +0100)]
Bug 24371: Fix "Show all items" avaibility link (use $raw filter) - intra

Same fix for the intranet side

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24371: Fix "Show all items" avaibility link (use $raw filter) - opac
Lucas Gass [Tue, 7 Jan 2020 18:54:49 +0000 (18:54 +0000)]
Bug 24371: Fix "Show all items" avaibility link (use $raw filter) - opac

TO TEST:
1. Make an OPAC search with plenty of results.
2. Use the search facets to limit the search in some way, item type, author, etc.
3. Click on 'Limit to currently available items', everything is still fine.
4. Attempt to return to 'Show all items', there will be no search results.
5. Apply patch
6. Ateempt steps 1-4 again.
7. Should work this time.

Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24373: Correct basic cataloging editor CSS
Owen Leonard [Tue, 7 Jan 2020 19:52:25 +0000 (19:52 +0000)]
Bug 24373: Correct basic cataloging editor CSS

This patch makes minor corrections to the basic MARC editor CSS, fixing
an error caused by Bug 23259.

To test, apply the patch and clear your browser cache if necessary.

Open the basic MARC editor and check the numbered tabs. There should be
no stripe of green background showing below the tabs.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Guillaume Paquet <guillaume@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 14759: Add test
Jonathan Druart [Thu, 9 Jan 2020 15:17:12 +0000 (16:17 +0100)]
Bug 14759: Add test

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 14759: Replace Text::Unaccent with Unicode::Normalize
Martin Renvoize [Wed, 8 Jan 2020 09:13:18 +0000 (09:13 +0000)]
Bug 14759: Replace Text::Unaccent with Unicode::Normalize

As shown in the comments on the bug, it appears that Unicode::Normalize
is the most reliable way to strip accents from strings for this use
case.

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 24394: Typo when adding a new cash register
Caroline Cyr La Rose [Thu, 9 Jan 2020 19:52:24 +0000 (14:52 -0500)]
Bug 24394: Typo when adding a new cash register

This patch corrects a typo in the cash register template.

To test:
1) Go to Administration > Global system preferences
2) Search for UseCashRegisters
3) Enable UseCashRegisters and save
4) Go to Administration > Cash registers
5) Click on 'New cash register'
6) Notice the title says 'Add new cash_register'
7) Apply patch
8) Refresh and notice it now says 'Add new cash register'

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>
4 years agoBug 23442: DBRev 19.12.00.007
Martin Renvoize [Fri, 10 Jan 2020 08:43:30 +0000 (08:43 +0000)]
Bug 23442: DBRev 19.12.00.007

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23442: Prevent payouts from being reduced
Martin Renvoize [Thu, 9 Jan 2020 11:59:43 +0000 (11:59 +0000)]
Bug 23442: Prevent payouts from being reduced

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 html filter to a couple lines in template
John Doe [Wed, 8 Jan 2020 15:51:45 +0000 (15:51 +0000)]
Bug 23442: Add html filter to a couple lines in template

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 option to patron account page
Martin Renvoize [Thu, 21 Nov 2019 13:09:47 +0000 (13:09 +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 (15:04 +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 (12:10 +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 (15:20 +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 (17:08 +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 (12:09 +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 (11:28 +0100)]
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 (10:36 -0500)]
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 (14:55 +0100)]
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 (15:24 +0100)]
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 (09:22 +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 (09:00 +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 (17:09 +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 (16:44 +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 (13:37 +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 (17:44 +0100)]
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 (17:13 +0100)]
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 (16:23 +0100)]
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 (15:18 +0100)]
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 (16:52 +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 (15:58 +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 (10:37 +0100)]
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 (16:24 +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 (15:43 -0300)]
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 (13:00 -0300)]
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 (15:36 -0300)]
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 (16:44 -0300)]
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 (11:37 -0300)]
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 (15:34 -0300)]
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 (10:26 -0300)]
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 (12:03 -0300)]
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 (15:50 -0300)]
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 (14:03 +0100)]
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 (11:30 +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 (11:04 -0300)]
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 (12:53 -0300)]
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 (12:35 -0300)]
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 (12:31 -0300)]
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 (12:26 -0300)]
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 (11:50 -0300)]
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 (11:07 -0300)]
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 (10:50 -0300)]
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 (10:42 -0300)]
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 (10:35 -0300)]
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 (10:23 -0300)]
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 (09:48 -0300)]
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 (09:16 -0300)]
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 (15:21 -0300)]
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 (17:03 +0100)]
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 (12:15 -0300)]
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 (15:21 +0100)]
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 (10:00 -0300)]
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 (09:59 -0300)]
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 (16:07 -0300)]
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 (15:03 -0300)]
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 (15:03 -0300)]
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 (16:14 +0200)]
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 (15:20 +0200)]
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 (09:43 +0100)]
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 (17:12 +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 (16:19 +0100)]
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 (10:55 -0300)]
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 (14:21 +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 (10:11 -0300)]
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 (14:04 +0100)]
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 (14:08 +0100)]
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 (14:04 +0100)]
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 (11:38 +0100)]
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 (11:26 +0100)]
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 (07:40 -0300)]
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 (16:48 +0100)]
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 (11:09 +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 (23:08 +0100)]
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 (13:03 +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 (12:56 +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 (10: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 (22:10 +0100)]
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 (16:06 +0100)]
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 (13:30 +0100)]
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 (12:10 +0100)]
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 (16:02 +0100)]
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 (13:12 +0100)]
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 (03:36 +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 (10:09 -0300)]
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 (15:47 +0100)]
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 (12:26 +0100)]
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>