]> git.koha-community.org Git - koha.git/log
koha.git
3 years agoBug 26734: (follow-up) Replace db update with backup and default
Martin Renvoize [Wed, 3 Feb 2021 14:49:04 +0000 (14:49 +0000)]
Bug 26734: (follow-up) Replace db update with backup and default

The inline update of variable for the notice template was proving
troublesome.. this patch replaces it was a backup of the existing notice
followed by replacing the notice with the default.

Test plan
1/ Run the database update
2/ Check that the templates have been replaced by the defaults (for all
languages enabled)
3/ Check that a backup of the original notices was made by naviagating
to view the action log (/tools/viewlog.pl) and selecting 'all modules' +
'all actions'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26734: Update existing notices to new syntax
Martin Renvoize [Mon, 19 Oct 2020 13:11:11 +0000 (14:11 +0100)]
Bug 26734: Update existing notices to new syntax

This patch adds a database update to replace existing notice variable
used in ACCOUNT_CREDIT and ACCOUNT_DEBIT notices with the modern
equivilents.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26734: Update sample notices to use standardised syntax
Martin Renvoize [Mon, 19 Oct 2020 12:54:58 +0000 (13:54 +0100)]
Bug 26734: Update sample notices to use standardised syntax

This patch updates the default notices shiped with Koha to use the new
syntax.

Test plan
1/ Install Koha afresh
2/ Check the notices print as expected
3/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26734: Convert printfeercpt/printinvoice to use GetPreparedLetter
Martin Renvoize [Wed, 14 Oct 2020 10:58:26 +0000 (11:58 +0100)]
Bug 26734: Convert printfeercpt/printinvoice to use GetPreparedLetter

This patch updates C4::Letters to allow use of existing koha template
includes from notices, then updates the printfeercpt and printinvoice
slip print option to use GetPreparedLetter rather than calling getletter
directly.

As part of this work, we also add credits and debits handling to the
_parseletter_sth and _get_tt_params routines in C4::Letters to allow for
recognisable variable names in the notice template.

Test plan
1/ Update the ACCOUNT_CREDIT and ACCOUNT_DEBIT notices to use
'accounts.inc' include for account descriptions
1a/ Add `[% PROCESS 'accounts.inc' %]` to the top of the notice
1b/ Replace manual account descriptions with `[% PROCESS
account_type_description account=credit %]`
2/ Print one of each slip and check that descriptions are properly
substituted
3/ Clone the notice to another language
4/ Print the in the other language and note the translated descriptions
are properly substituted.
5/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26734: Ratify account slip printing
Martin Renvoize [Thu, 16 Jul 2020 08:42:20 +0000 (09:42 +0100)]
Bug 26734: Ratify account slip printing

This patch simplifies the members/print*.pl controller scripts to only
pass around the minimum required data for the templates.

Test plan
Slips should continue to print as they did prior to the patch
1/ Add a manual invoice and manual debit to a patrons account
2/ Print a slip for the manual invoice, compare to a printed slip prior
to the patch.
3/ Print a slip for the manual debit, compare to a printed slip prior to
the patch.
4/ Signoff.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27455: (follow-up) Add automatic focus to library name when editing
Owen Leonard [Mon, 15 Mar 2021 14:49:09 +0000 (14:49 +0000)]
Bug 27455: (follow-up) Add automatic focus to library name when editing

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27455: (follow-up) Switch form JavaScript to focus class
Katrin Fischer [Thu, 4 Mar 2021 09:35:37 +0000 (09:35 +0000)]
Bug 27455: (follow-up) Switch form JavaScript to focus class

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27455: Add focus to branch code when a new library is added
ava li [Tue, 19 Jan 2021 01:36:27 +0000 (01:36 +0000)]
Bug 27455: Add focus to branch code when a new library is added

TEST PLAN:
From the koha home, go to administration, go to Libraries which is under
Basic parameters. Click +New library the focus should go to the first
field of the form (library/branch code) the patch has worked.

https://bugs.koha-community.org/show_bug.cgi?id=27455

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15563: (follow-up) Combine methods, add count, obey confirm
Nick Clemens [Fri, 23 Apr 2021 12:36:54 +0000 (12:36 +0000)]
Bug 15563: (follow-up) Combine methods, add count, obey confirm

This patch moves the SQL to a subroutine and uses the Label delete method to
remove the batches

We now return a count and do not delete if --confirm flag is not passed

Repeate previous test plan, confirm works as expected

JD amended patch: perltidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15563: add label and card creator batch deletion to cleanup_database
Andrew Fuerste-Henry [Mon, 20 Jul 2020 15:09:30 +0000 (15:09 +0000)]
Bug 15563: add label and card creator batch deletion to cleanup_database

To test:
For item label batches:
1- Create 3 item label batches of at least 2 items each
2- Perform the following updates via the database
3- In Batch 1, set all items' timestamps to 10+ days prior to today
4- In Batch 2, set 1 item's timestamp to 10+ days prior to today
5- In Batch 3, do not update any timestamps
6- Run cron with --labels 9
7- Confirm batch 1 is deleted, batches 2 and 3 are not

Repeat with card creator batches
8- Create 3 card creator batches of at least 2 items each
9- Perform the following updates via the database
10- In Batch 1, set all cards' timestamps to 10+ days prior to today
11- In Batch 2, set 1 card's timestamp to 10+ days prior to today
12- In Batch 3, do not update any timestamps
13- Run cron with --cards 9
14- Confirm batch 1 is deleted, batches 2 and 3 are noti

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Deb Stephenson <dstephen@dubuque.lib.ia.us>
Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26405: Prevent Circulation.t failing on 'AddRenewal left both fines'
Emmi Takkinen [Thu, 3 Dec 2020 08:41:47 +0000 (10:41 +0200)]
Bug 26405: Prevent Circulation.t failing on 'AddRenewal left both fines'

Bug 23051 added option to skip calculating fines even when
"CalculateFinesOnReturn" is enabled. Due this Circulation.t
fails on  test  "AddRenewal left both fines" if
"CalculateFinesOnReturn"  is disabled on ones system.
Mocking syspref while testing fixes failig tests.

To test:
1. Disable "CalculateFinesOnReturn".
2. Run prove t/db_dependent/Circulation.t
=> Tests fail
3. Apply patch.
4. Run prove t/db_dependent/Circulation.t again
=> Tests are succesful

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28223: Add data elements to negative budgets
Nick Clemens [Mon, 26 Apr 2021 12:40:48 +0000 (12:40 +0000)]
Bug 28223: Add data elements to negative budgets

To test:
1 - Have a parent fund and a child fund
2 - Order an amount from the child fund that is greater than the amount available
3 - Browse to acquisitions
4 - Confirm the totals look right
5 - Click on the over spent fund to go to 'Funds for main budget'
6 - Note the totals are incorrect
7 - Apply patch
8 - Reload
9 - Totals are now correct

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28144: Add a regression test
Jonathan Druart [Tue, 27 Apr 2021 13:04:35 +0000 (15:04 +0200)]
Bug 28144: Add a regression test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28144: Check if issue_id defined
Nick Clemens [Tue, 13 Apr 2021 15:14:11 +0000 (15:14 +0000)]
Bug 28144: Check if issue_id defined

Historical OVERDUE fines may not have an issue_id - this causes
flooding of the logs when calling update fine

Trivial change, reading the code should be enough, but test plan below

To test:
1 - Create some fines without an issue_id
  - Either checkout an old version of Koha and add manually or
  - Checkout some items (backdated) to a patron, run fines.pl then
    UPDATE accountlines SET issue_id = NULL;
2 - Checkout a backdated item with fines in the circ rule to the same patron
3 - Run fines.pl
4 - Note the errors
5 - Apply patch
6 - Repeat and note no errors

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28221: Script process_message_queue.pl uses Try::Tiny but doesn't 'use' it
Kyle M Hall [Mon, 26 Apr 2021 10:30:17 +0000 (06:30 -0400)]
Bug 28221: Script process_message_queue.pl uses Try::Tiny but doesn't 'use' it

The message queue processor has a try/catch block, but does not have a 'use Try::Tiny' line. Because of this the following error ocurrs if an instance has any plugins installed that use the before_send_messages hook:

Can't locate object method "catch" via package "1" (perhaps you forgot to load "1"?) at /usr/share/koha/bin/cronjobs/process_message_queue.pl line 86.

Test Plan:
1) Install a plugin that uses the before_send_messages hook
2) Run the message queue processor
3) Note the error message
4) Apply this patch
5) Run the message queue processor again
6) No error!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28178: Display the correct image in the image viewer
Jonathan Druart [Mon, 19 Apr 2021 10:11:36 +0000 (12:11 +0200)]
Bug 28178: Display the correct image in the image viewer

When there are several images attached to a bibliographic record, one can click
an image and see it in the image viewer. But the first image is always displayed.

Test plan:
0. Turn on LocalCoverImages and AllowMultipleCovers
1. Attach at least two images to a bibliographic record
2. Go to the detail page, click the "Images" tab and click the second
image.
=> With this patch applied you should see the image you selected

Sponsored-by: Gerhard Sondermann Dialog e.K. (presseplus.de, presseshop.at, presseshop.ch)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21818: Replace AutoCommit flag with DBIx transaction in stage-marc-import.pl
Fridolin Somers [Thu, 11 Mar 2021 10:46:46 +0000 (11:46 +0100)]
Bug 21818: Replace AutoCommit flag with DBIx transaction in stage-marc-import.pl

Like it was done in Bug 18806.

Test plan :
Use stage-marc-import.pl with and without patch, with a matcher to find
duplicates

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28193: (follow-up) Correct OpacLoginInstructions in login modal
Owen Leonard [Fri, 23 Apr 2021 00:21:30 +0000 (00:21 +0000)]
Bug 28193: (follow-up) Correct OpacLoginInstructions in login modal

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28193: OpacLoginInstructions news block broken by Bug 20168
Owen Leonard [Thu, 22 Apr 2021 14:33:25 +0000 (14:33 +0000)]
Bug 28193: OpacLoginInstructions news block broken by Bug 20168

This patch fixes a regression which was introduced by Bug 20168, causing
the OpacLoginInstructions template code to revert back to the old system
preference behavior. This patch returns the correct markup.

To test, apply the patch and view the OPAC login page
(/cgi-bin/koha/opac-user.pl)

 - With no news entry for OpacLoginInstructions you should see the
   default: A block of text with two headings, "Don't have a password
   yet?" and "Don't have a library card?"
 - Go to Tools -> News and create an entry for OpacLoginInstructions.
 - Return to the OPAC and confirm that your custom text appears.
 - Try updating/installing another translation and adding a different
   news entry for that language. Confirm that the correct entry appears.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28198: Correct sample HOLD_REMINDER notice for it,nb,pl,ru
Victor Grousset/tuxayo [Tue, 27 Apr 2021 01:08:59 +0000 (03:08 +0200)]
Bug 28198: Correct sample HOLD_REMINDER notice for it,nb,pl,ru

It turns out that ea6467724cf8e6fac2224e1dcb6c6ddee73736af also caused the same issue in these locales
Also e0b0e908f767e510c5538d8e5cfb25f994579441 (a follow up) caused the issue in it-IT

== Test plan ==
Paste all this :D
```
 # doesn't work without this patch applied
echo "DELETE FROM letter;" | sudo koha-mysql kohadev
cat installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql | sudo koha-mysql kohadev
echo "DELETE FROM letter;" | sudo koha-mysql kohadev
cat installer/data/mysql/pl-PL/mandatory/sample_notices.sql | sudo koha-mysql kohadev
echo "DELETE FROM letter;" | sudo koha-mysql kohadev
cat installer/data/mysql/ru-RU/mandatory/sample_notices.sql | sudo koha-mysql kohadev
echo "DELETE FROM letter;" | sudo koha-mysql kohadev
cat installer/data/mysql/it-IT/necessari/notices.sql | sudo koha-mysql kohadev

 # test all the rest
 ## fixed by previous patch, double checking
echo "DELETE FROM letter;" | sudo koha-mysql kohadev
cat installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql | sudo koha-mysql kohadev
 ## was already working, just double checking
echo "DELETE FROM letter;" | sudo koha-mysql kohadev
cat installer/data/mysql/fr-CA/obligatoire/sample_notices.sql | sudo koha-mysql kohadev
echo "DELETE FROM letter;" | sudo koha-mysql kohadev
cat installer/data/mysql/uk-UA/mandatory/sample_notices.sql | sudo koha-mysql kohadev
```

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28198: Correct sample HOLD_REMINDER notice for French
Nick Clemens [Mon, 26 Apr 2021 18:20:27 +0000 (18:20 +0000)]
Bug 28198: Correct sample HOLD_REMINDER notice for French

To test:
1 - sudo koha-mysql kohadev
2 - DELETE FROM letter
3 - cat installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql | sudo koha-mysql kohadev
4 - Error!
5 - Apply patch
6 - Repeat 1-3
7 - Success!

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15986: Remove \r from HOLD_REMINDER in the yml
Jonathan Druart [Tue, 27 Apr 2021 13:28:34 +0000 (15:28 +0200)]
Bug 15986: Remove \r from HOLD_REMINDER in the yml

To prevent the following errors on `gulp po:update`

misc/translator/Koha-installer.pot:952: warning: internationalized messages should not contain the '\r' escape sequence

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28210: Pass skip_record_index through LostItem
Martin Renvoize [Fri, 23 Apr 2021 15:48:52 +0000 (16:48 +0100)]
Bug 28210: Pass skip_record_index through LostItem

This patch restores the skip_record_index optional parameter for
LostItem and passes it through to MarkIssueReturned as required.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28210: Add issue, replacementprice, and set onloan so check-in tests work
Nick Clemens [Mon, 26 Apr 2021 15:57:09 +0000 (15:57 +0000)]
Bug 28210: Add issue, replacementprice, and set onloan so check-in tests work

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28210: Unit test
Martin Renvoize [Fri, 23 Apr 2021 15:52:59 +0000 (16:52 +0100)]
Bug 28210: Unit test

Add a unit test to check that skip_record_index is adhered to when
passed to LostItem with the force_mark_returned option enabled.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27281: (QA follow-up) Fix Indexer Test
Martin Renvoize [Fri, 23 Apr 2021 13:37:28 +0000 (14:37 +0100)]
Bug 27281: (QA follow-up) Fix Indexer Test

With bug 27281 we removed a call to reset an items holdingbranch back to
the 'frombranch' of the transfer.  This is correct, as with bug 23129
(and friends) we ensure that the holdingbranch was not changed at
transfer request time and instead would only be updated at the reciept
of transfer. As such, it's safe to remove the update here as it would be
just setting the same branch as is already present.

However, when removing this ModItem call, I neglected to realise that
also remoes the requirement for passing around the defered indexing bit
as we no longer need to trigger a re-index as there's not any change to
the item.

This patch therefore cleans up the POD for LostItem, removes the no
longer references 'params' parameter and drops the corresponding index
test.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24446: (follow-up) Fix tests
Nick Clemens [Fri, 23 Apr 2021 15:22:44 +0000 (15:22 +0000)]
Bug 24446: (follow-up) Fix tests

The tests were failing because we weren't actually changing the item, so store was doing nothing.

We need to transfer 'from' a new branch so that the holdingbranch is changed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23271: (follow-up) Fix typo 'limlits'
Nick Clemens [Fri, 23 Apr 2021 11:19:21 +0000 (11:19 +0000)]
Bug 23271: (follow-up) Fix typo 'limlits'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: Fix UsageStats.t
Jonathan Druart [Fri, 23 Apr 2021 10:45:27 +0000 (12:45 +0200)]
Bug 23971: Fix UsageStats.t

Hum, what's the point of these tests?

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27971: DBRev 20.12.00.040
Jonathan Druart [Fri, 23 Apr 2021 09:40:10 +0000 (09:40 +0000)]
Bug 27971: DBRev 20.12.00.040

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27971: Enhance unit tests
Martin Renvoize [Wed, 17 Mar 2021 16:23:56 +0000 (16:23 +0000)]
Bug 27971: Enhance unit tests

This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27971: Update void method to use double entry accounting
Martin Renvoize [Wed, 17 Mar 2021 09:10:17 +0000 (09:10 +0000)]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24300: (QA follow-up) Enhance test and catch failures
Martin Renvoize [Thu, 18 Mar 2021 14:00:43 +0000 (14:00 +0000)]
Bug 24300: (QA follow-up) Enhance test and catch failures

The tests did not include testing for offset lines. This patch adds such
tests and updates the function to pass them

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24300: (QA follow-up) Update payout_amount to use internal methods
Martin Renvoize [Wed, 17 Mar 2021 14:12:37 +0000 (14:12 +0000)]
Bug 24300: (QA follow-up) Update payout_amount to use internal methods

Tomas pointed out that we could, and probably should, use the internal
'add_debit' method within this function.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24300: (follow-up) Set minimum for amount input
Martin Renvoize [Tue, 16 Mar 2021 16:06:36 +0000 (16:06 +0000)]
Bug 24300: (follow-up) Set minimum for amount input

Add a 'min' attribute for validation of the amount field in the payout
modal so that negative amounts cannot be submitted.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24300: (QA follow-up) Add Unit Tests
Martin Renvoize [Wed, 17 Mar 2021 14:17:29 +0000 (14:17 +0000)]
Bug 24300: (QA follow-up) Add Unit Tests

Doh! I forgot the unit tests first time around!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24300: Add payout amount to boraccount page
Martin Renvoize [Fri, 5 Feb 2021 15:11:37 +0000 (15:11 +0000)]
Bug 24300: Add payout amount to boraccount page

Test plan
1/ Add some debts and credits to a patrons account, resulting in an
overall credit
2/ Note the appearance of a 'Payout amount' button next to the total due
line.
3/ Try paying out an amount with the button
4/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24300: Add payout_amount method to Koha::Account
Martin Renvoize [Fri, 5 Feb 2021 14:28:32 +0000 (14:28 +0000)]
Bug 24300: Add payout_amount method to Koha::Account

This patch adds a 'payout_amount' method to the Koha::Account class to
allow payout of an amount against a list of credits (or any outstanding
credits, oldest to newest).

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12362: DBIC schema changes
Jonathan Druart [Fri, 23 Apr 2021 09:52:36 +0000 (11:52 +0200)]
Bug 12362: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12362: DBRev 20.12.00.039
Jonathan Druart [Fri, 23 Apr 2021 09:40:10 +0000 (09:40 +0000)]
Bug 12362: DBRev 20.12.00.039

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12362: (QA follow-up) Fix ModItemTransfer cancellation handling
Martin Renvoize [Tue, 20 Apr 2021 09:28:40 +0000 (10:28 +0100)]
Bug 12362: (QA follow-up) Fix ModItemTransfer cancellation handling

ModItemTransfer is still used, sparingly. It force cancels transfers
regardles of whether they are already marked as in_transit. We do not,
however, want to enqueue a return transfer in this case as
ModItemTransfer is itself an enqueue function.  This patch updates the
internal logic of ModItemTransfer to enqueue the passed transfer prior
to cancelling the pre-existing one.. in this way the result is one
cancelled transfer and one new transfer and not three transfers.

Test plan
1/ Run t/db_dependant/Items.t and verify it fails prior to applying this
patch
2/ Apply patch and run the test again, verifying it now passes.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12362: Cancel transfer with hold cancelation
Martin Renvoize [Mon, 22 Mar 2021 14:57:06 +0000 (14:57 +0000)]
Bug 12362: Cancel transfer with hold cancelation

This patch adds a transfer cancellation when a hold is cancelled.

Test plan
1/ Check an item out from it's homebranch
2/ Place a hold on that item for another user at a different branch
3/ Check the item in at it's homebranch and accept the transfer
4/ Cancel the hold
5/ Change to the second branch and check the item in
6/ Note that a transfer is triggered with the reason 'Transfer was
cancelled whilst in transit'

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
JD amended patch: remove trailing whitespace

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12362: Reverse transfer upon cancellation
Martin Renvoize [Mon, 22 Mar 2021 14:36:42 +0000 (14:36 +0000)]
Bug 12362: Reverse transfer upon cancellation

This patch adds a reverse transfer if a transfer is cancelled whilst it
is in transit.  This makes sure the item returns to it's original
location.

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12362: Add 'TransferCancellation' as a transfer reason
Martin Renvoize [Mon, 22 Mar 2021 14:43:42 +0000 (14:43 +0000)]
Bug 12362: Add 'TransferCancellation' as a transfer reason

This patch adds the database update to add 'TransferCancellation' as a
reason for transfer.

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27896: Remove DeleteTransfer
Martin Renvoize [Mon, 8 Mar 2021 15:30:09 +0000 (15:30 +0000)]
Bug 27896: Remove DeleteTransfer

This patch removes the last mentions of DeleteTransfer

Test plan
1/ Grep the codebase for DeleteTransfer
2/ It should no longer exist

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 27896: (QA follow-up) Fix number of unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27896: Remove DeleteTransfer from circ/return.pl
Martin Renvoize [Mon, 8 Mar 2021 15:24:14 +0000 (15:24 +0000)]
Bug 27896: Remove DeleteTransfer from circ/return.pl

This patch replaces the DeleteTransfer call in circ/returns.pl with a
call to Koha::Item::Transfer->cancel.

Test plan
1/ Check an item out
2/ Add a transfer request for the item to a second library
3/ Attempt to check the item in at the first library
4/ Note that you should be given a 'WrongTransfer' modal and have to
option to cancel.
5/ Cancel the transfer
6/ Check in the database that the transfer now has 'datecancelled' set.
7/ Add a transfer for the item again
8/ From the transferstoreceive page cancel the transfer
9/ Click cancel and again check that datecancelled is set in the
database for your transfer

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 27896: (follow-up) Fix Typo

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27281: DBRev 20.12.00.038
Jonathan Druart [Fri, 23 Apr 2021 09:40:10 +0000 (09:40 +0000)]
Bug 27281: DBRev 20.12.00.038

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27281: (QA follow-up) Restore test for holdingbranch
Martin Renvoize [Thu, 22 Apr 2021 08:35:11 +0000 (09:35 +0100)]
Bug 27281: (QA follow-up) Restore test for holdingbranch

I inadvertantly removed the test that varified that the items
holdingbranch is unaffected by the call to LostItem. This restores such
a test and adds a few comments to clarify the test transfers.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27281: (QA follow-up) Fix typo
Kyle M Hall [Fri, 16 Apr 2021 15:22:50 +0000 (11:22 -0400)]
Bug 27281: (QA follow-up) Fix typo

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27281: (follow-up) Clean up LostItem test
Martin Renvoize [Mon, 8 Mar 2021 14:59:06 +0000 (14:59 +0000)]
Bug 27281: (follow-up) Clean up LostItem test

The LostItem test was rather messy, and wasn't actually testing much in
reality. This patch cleans it up and adds testing for transfer queue
handling of ListItem cancellations.

Test plan
1/ Confirm t/db_dependent/Circulation.t still passes
2/ Read the tests before and after and confirm that they test what is
required.
3/ Signoff

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27281: Add unit test for Koha::Item->get_transfers
Martin Renvoize [Mon, 8 Mar 2021 14:14:20 +0000 (14:14 +0000)]
Bug 27281: Add unit test for Koha::Item->get_transfers

In the previous patch we introduced the new get_transfers method to the
Koha::Item object. This patch adds proper unit tests for that addition.

Test plan
1/ Apply patches and confirm t/db_dependent/Koha/Item.t passes.
2/ Signoff

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
JD amended patch: fix spelling reqeusted ==> requested

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27281: Update LostItem to use Koha::Item[::Transfer] methods
Martin Renvoize [Mon, 8 Mar 2021 13:43:11 +0000 (13:43 +0000)]
Bug 27281: Update LostItem to use Koha::Item[::Transfer] methods

This patch updates C4::Circulation::LostItem to use the Koha::Item and
Koha::Item::Transfer methods to cancel transfers when an item is marked
as lost.

Test plan
1/ Confirm t/db_dependant/Circulation.t passes prior to applying the
patches
2/ Apply the patch and run updatedatabase.pl
3/ Confirm that t/db_dependant/Circulation.t still passes
4/ Signoff

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: DBRev 20.12.00.037
Jonathan Druart [Fri, 23 Apr 2021 09:40:10 +0000 (09:40 +0000)]
Bug 23971: DBRev 20.12.00.037

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: Do not always flag AcquisitionLog as 'not enabled'
Jonathan Druart [Wed, 21 Apr 2021 12:39:16 +0000 (14:39 +0200)]
Bug 23971: Do not always flag AcquisitionLog as 'not enabled'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: Rename pref with AcquisitionLog
Jonathan Druart [Wed, 21 Apr 2021 12:26:19 +0000 (14:26 +0200)]
Bug 23971: Rename pref with AcquisitionLog

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Remove stale param
Andrew Isherwood [Tue, 5 Jan 2021 11:34:28 +0000 (11:34 +0000)]
Bug 23971: (follow-up) Remove stale param

As highlighted by Jonathan in comment #90, we were passing
borrowernumber to ModBasket. This was a hangover from when we explicitly
logged the borrower, which was later discovered to be unnecessary
duplication, and was removed in commit "Remove data duplication".

This commit removes this unnecessary parameter.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Log entire objects
Andrew Isherwood [Tue, 10 Nov 2020 11:31:30 +0000 (11:31 +0000)]
Bug 23971: (follow-up) Log entire objects

As requested by Tomás and Jonathan, we now log the entire basket object
when logging an action.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Make changes for 26582
Andrew Isherwood [Fri, 23 Oct 2020 14:44:32 +0000 (15:44 +0100)]
Bug 23971: (follow-up) Make changes for 26582

This commit makes changes necessary to allow this bug to be dependent on
Bug 23562:

- Move basket closure logging from C4::Acquisision::CloseBasket to Koha::Acquisition::Basket::close
- Move basket closure unit test from t/db_dependent/Acquisition.t to
t/db_dependent/Koha/Acquisition/Basket.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Fix tests
Andrew Isherwood [Fri, 23 Oct 2020 14:14:28 +0000 (15:14 +0100)]
Bug 23971: (follow-up) Fix tests

Following a discussion with Tomás on Slack, this commit implements the
following suggestions:

- Switch from ->find to ->search in tests. ->find is only ever going to return 0
or 1 rows, which doesn't help us if there is breakage which results in
more than 1 row being returned, the test would fail due to ->find not
expecting more than 1 row, but we should be testing for it. So switching
to ->search returns all matching rows.
- Moved tests into their own subtest, they had the potential to pollute
surrounding tests
- Remove all action logs before each test, this ensures we're only
testing the result of the current test

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Respond to feedback
Andrew Isherwood [Mon, 19 Oct 2020 09:48:57 +0000 (10:48 +0100)]
Bug 23971: (follow-up) Respond to feedback

As requested by Jonathan in commit #28:

- We now no longer pass a flag to CloseBasket indicating if the closure
was due to an EDI basket approval, we log the closure and approval as
separate events.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Add unit tests
Andrew Isherwood [Tue, 6 Oct 2020 12:40:41 +0000 (13:40 +0100)]
Bug 23971: (follow-up) Add unit tests

This commit adds unit tests for the logging done in Acquisitions.pm

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (QA follow-up) Fix punctuation, doubled up return and syspref order
Katrin Fischer [Sat, 22 Aug 2020 14:05:01 +0000 (14:05 +0000)]
Bug 23971: (QA follow-up) Fix punctuation, doubled up return and syspref order

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Add additional basket logging
Andrew Isherwood [Fri, 6 Dec 2019 11:35:00 +0000 (11:35 +0000)]
Bug 23971: (follow-up) Add additional basket logging

This patch adds additional basket logging as discussed in comment #14

- Basket reopening
- Basket users (manager) modification
- Basket header modification

Signed-off-by: Holly <hc@interleaf.ie>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: (follow-up) Remove data duplication
Andrew Isherwood [Fri, 6 Dec 2019 10:30:20 +0000 (10:30 +0000)]
Bug 23971: (follow-up) Remove data duplication

In response to Séverine observations in comment #10, this patch removes
the duplicate logging of the borrowernumber

https://bugs.koha-community.org/show_bug.cgi?id=23971
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23971: Add logging for basket related actions
Andrew Isherwood [Fri, 29 Nov 2019 15:40:58 +0000 (15:40 +0000)]
Bug 23971: Add logging for basket related actions

This patch adds logging for the following Acq actions:

- Basket creation
- Basket editing
- Basket approval (via EDI)
- Basket closure

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 23971: (QA follow-up) New DBrev syntax

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27924: Display number of holds awaiting pickup on check out screens
Owen Leonard [Wed, 21 Apr 2021 16:25:48 +0000 (16:25 +0000)]
Bug 27924: Display number of holds awaiting pickup on check out screens

This patch modifies the checkout page so that waiting holds are
displayed separately depending on whether they are waiting at the
current branch or not. A count of each number of waiting holds is
displayed too.

Unrelated change: A missing </li> has been added for markup validity.

To test, apply the patch and view the checkout screen in these
situations:

 - A patron with no waiting holds.
 - A patron with one or more holds waiting at the current library.
 - A patron with one or more holds waiting at another library.
 - A patron with holds waiting at both the current library and at other
   libraries.

In each case, the display of waiting hold information should be correct,
including the count of holds of each kind.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27814: Compiled CSS
Jonathan Druart [Fri, 23 Apr 2021 08:31:32 +0000 (10:31 +0200)]
Bug 27814: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27814: (follow-up) Adjust container padding, button flow
Owen Leonard [Fri, 5 Mar 2021 13:40:13 +0000 (13:40 +0000)]
Bug 27814: (follow-up) Adjust container padding, button flow

This patch makes minor changes to the SCSS so that the user summary
page's DataTables button flow better at very narrow widths.

Also, the main container should have less padding at narrow widths.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27814: Improve responsive behavior of the user page in the OPAC
Owen Leonard [Fri, 26 Feb 2021 19:12:53 +0000 (19:12 +0000)]
Bug 27814: Improve responsive behavior of the user page in the OPAC

This patch makes minor changes to OPAC CSS in order to improve the way
the logged-in user's "your account" page works at narrower browser
widths.

To test, apply the patch and rebuild the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

 - Log in to the OPAC as a user who has multiple checkouts.
 - Test the page at various browser widths, from > 1200 pixels wide to <
   300 pixels wide. Your browser's built-in responsive design mode,
   found in developer tools, can make these measurements easier.
 - At "phone-size" width the tabs ("Checked out," "Overdue," etc) should
   start displaying full-width.
 - The DataTable controls at the top of the checkouts table should
    adapt well as the browser width changes.
 - At narrower widths the tables on this page should display much better
   than they did before the patch: They should expand to fit the width
   of the page.

Edit: Tweaked the display property of the table search field at narrower
browser widths; Converted iCal download link to button to match other
elements in the toolbar.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27566: Compiled CSS
Jonathan Druart [Fri, 23 Apr 2021 08:29:54 +0000 (10:29 +0200)]
Bug 27566: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27566: (follow-up) Add generic font family to prevent unstyled select tags
Owen Leonard [Wed, 7 Apr 2021 13:43:40 +0000 (13:43 +0000)]
Bug 27566: (follow-up) Add generic font family to prevent unstyled select tags

This correction fixes the previous patch which was dumb and stupid.

This patch adds a default font family "sans-serif" to the OPAC CSS as a
workaround for this Firefox bug:

font-family isn't honored in `<option>` element within `<select>`
dropdown
https://bugzilla.mozilla.org/show_bug.cgi?id=1536148

To test, apply the patch and rebuild the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

 - Open the OPAC main page in Firefox.
 - Click the search type dropdown. The options should be styled using
   your system's default sans-serif font rather than a serif font.
 - Check that other areas of the OPAC are still styled with the correct
   "NotoSans" font. An error with this patch should be obvious when
   looking at a logged-in user's checkouts.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28168: leave the field empty if amount variable is empty
Petro Vashchuk [Wed, 21 Apr 2021 11:45:14 +0000 (14:45 +0300)]
Bug 28168: leave the field empty if amount variable is empty

Add "if" check to the template so that it uses the value of
"debit_type.default_amount" only if it's true, i.e. not null or 0.

The reason for this patch is there's requirement from librarians -
to have this field completely empty if it's 0, so they could paste the
amount (as they usually do) without the need to clear the field first.
And anyway if you try to save the form with 0.00 value,
it won't accept it saying "Debit amount passed is not positive" so
in my opinion there's no point to preset it with zeroes to begin with.

To reproduce:
    1) head to /cgi-bin/koha/members/maninvoice.pl?borrowernumber=XXXX
    and check that field "Amount" is prefilled with 0.00;
    2) apply patch;
    3) refresh page and ensure that field "Amount" is empty now;
    4) go to /cgi-bin/koha/admin/debit_types.pl and change default
    amount to some decimal amount;
    5) refresh manual invoice page again and ensure that "Amount"
    field is prefilled with that exact decimal number;

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27968: Fix framework import if isurl has an incorrect value
Jonathan Druart [Wed, 17 Mar 2021 08:18:48 +0000 (09:18 +0100)]
Bug 27968: Fix framework import if isurl has an incorrect value

If isurl is set to undef in the DB, it will be exported as an empty
string, which is an invalid value for isurl (int)

Incorrect integer value: '' for column 'isurl'

Test plan:
Export framework structure in CSV and ODS, then reimport it and check that
all the subfields are important correctly

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16787: (follow-up) Add and adjust ILSDI tests
Nick Clemens [Thu, 22 Apr 2021 15:22:49 +0000 (15:22 +0000)]
Bug 16787: (follow-up) Add and adjust ILSDI tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28064: (QA follow-up) Remove value from button
Martin Renvoize [Thu, 22 Apr 2021 10:45:01 +0000 (11:45 +0100)]
Bug 28064: (QA follow-up) Remove value from button

To clarify that the value is not used on buttons that are not submit
type we remove the value entirely.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28064: Add dotransfer field to slip print submission
Martin Renvoize [Wed, 31 Mar 2021 12:06:49 +0000 (13:06 +0100)]
Bug 28064: Add dotransfer field to slip print submission

By changing the code to only do a javascript triggered submission from
the from button we lose the original buttons name and value elements
upon submission.

This patch checks for those fields in the JS capture and triggers the
addition of a new hidden form field to contain the dotransfer data.

Test plan
1/ Set AutomaticItemReturn system preference is set to "Don't"
2/ Check in an item that belongs to another library, a dialog will ask
   you if you want to transfer.
3/ Click 'Yes, print slip'
4/ Look at the item record and note the status is 'Available'.
5/ Apply patch
6/ Follow steps 2 - 4
7/ Note the status is now 'In transit to...'
8/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28002: Unit tests
Tomas Cohen Arazi [Wed, 31 Mar 2021 13:07:32 +0000 (10:07 -0300)]
Bug 28002: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28002: Add extended_attributes support to POST /patrons
Tomas Cohen Arazi [Wed, 31 Mar 2021 11:04:12 +0000 (08:04 -0300)]
Bug 28002: Add extended_attributes support to POST /patrons

This patch adds support for the 'extended_attributes' parameter in the
route for adding a patron. It relies on
Koha::Patron->extended_attributes for the tests. Exceptions are catch
and the whole operation is rolled back.

I chose to handle each exception on its own if branch, with bug 28020 in
mind.

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCES: Tests pass!
3. Check they cover all the exception situations!
=> SUCCESS: They do!
4. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28157: Add handling for the x-koha-library header
Tomas Cohen Arazi [Tue, 20 Apr 2021 17:23:36 +0000 (14:23 -0300)]
Bug 28157: Add handling for the x-koha-library header

This patch introduces a new header handling. The key idea is that on
Koha's base classes there's broad usage of C4::Context->userenv to
determine the current library and make decisions based on that.

API requests, on the other hand, might not be tied to sessions
(stateless) which is the way current library is retrieved. So we need a
way to properly specify what library the request is trying to act as
coming from.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28157: Regression tests
Tomas Cohen Arazi [Tue, 20 Apr 2021 17:23:30 +0000 (14:23 -0300)]
Bug 28157: Regression tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28157: Add Koha::Patron->can_log_into
Tomas Cohen Arazi [Tue, 20 Apr 2021 17:21:04 +0000 (14:21 -0300)]
Bug 28157: Add Koha::Patron->can_log_into

This patch adds a new method that tells if the patron is allowed to be
logged into certain library.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23666: (follow-up) Adjust to new exceptions
Tomas Cohen Arazi [Wed, 31 Mar 2021 11:59:10 +0000 (08:59 -0300)]
Bug 23666: (follow-up) Adjust to new exceptions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23666: Add PATCH /patron/:patron_id/extended_attributes/:extended_attribute_id
Tomas Cohen Arazi [Thu, 25 Mar 2021 13:25:41 +0000 (10:25 -0300)]
Bug 23666: Add PATCH /patron/:patron_id/extended_attributes/:extended_attribute_id

This patch adds the described route. It is designed to use the
underlying libraries' methods to update an existing attribute.

The tests cover the use cases.

Note: I added handling for two exceptions that can only occur on bad
data (i.e. not by using our codebase). This are:
- Koha::Exceptions::Patron::Attribute::InvalidType
- Koha::Exceptions::Patron::Attribute::NonRepeatable

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_extended_attributes.t
=> SUCCESS: Tests pass!
3. PLay with the route
=> SUCCESS: Expected behavior!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23666: (QA follow-up) Fix wrong required permissions
Tomas Cohen Arazi [Fri, 19 Mar 2021 15:05:24 +0000 (12:05 -0300)]
Bug 23666: (QA follow-up) Fix wrong required permissions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23666: Add extended attributes routes
Tomas Cohen Arazi [Thu, 18 Mar 2021 18:15:13 +0000 (15:15 -0300)]
Bug 23666: Add extended attributes routes

This patch adds routes to handle patron's extended attributes:

GET    /patrons/:patron_id/extended_attributes
POST   /patrons/:patron_id/extended_attributes
PUT    /patrons/:patron_id/extended_attributes <- to overwrite them all
DELETE /patrons/:patron_id/extended_attributes/:extended_attribute_id

Controllers rely on the Koha::Patron methods for retrieving/adding
extended attributes. Exceptions are correctly catch and handled in the
responses. This is all covered by tests as well.

Note: I decidedto override the default sorting on the PUT response,
    because the overloaded search sorting it felt a bit wrong on the API.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_extended_attributes.t
=> SUCCESS: Tests pass!
3. Play with your favourite tool and this routes
=> SUCCESS: They work well!
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23666: Add spec
Tomas Cohen Arazi [Thu, 18 Mar 2021 18:14:26 +0000 (15:14 -0300)]
Bug 23666: Add spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23666: Unit tests
Tomas Cohen Arazi [Fri, 19 Mar 2021 11:01:31 +0000 (08:01 -0300)]
Bug 23666: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27240: Basket export cleanup.
Didier Gautheron [Tue, 15 Dec 2020 13:41:11 +0000 (14:41 +0100)]
Bug 27240: Basket export cleanup.

Remove spaces and irrelevant links.

Test plan:
1 - Create a basket
2 - Export it in excel
3 - There's a lot of spaces in Order column and irrelevant 'Add internal note'
4 - Apply patch
5 - Export file
6 - It's tidier, fewer spaces and no useless Add/edit note links

https://bugs.koha-community.org/show_bug.cgi?id=27240
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23195: (follow-up) One text invoice should be open
Nick Clemens [Wed, 21 Apr 2021 11:16:18 +0000 (11:16 +0000)]
Bug 23195: (follow-up) One text invoice should be open

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23195: Always count shipping costs as 'spent'
Nick Clemens [Mon, 12 Apr 2021 18:13:47 +0000 (18:13 +0000)]
Bug 23195: Always count shipping costs as 'spent'

As shipping costs are created when an invoice is created, and creation
of an invoice implies that items have been received, the shipment costs
are always assumed to be 'spent'

This logic is true in GetBudgetSpent/GetBudgetOrdered, however, GetBudgetHierarchy
treats open invoices shipping costs as 'ordered' and closed invoice shipping costs
as 'spent'

This leads to inconsistencies in acqui-home vs spent.pl and ordered.pl

To test:
 1 - Find a vendor
 2 - Click 'Receive shipments'
 3 - Create a new invoice with a shipping cost on budget A
 4 - Repeate and create a new invoice with a shipping cost on budget B
 5 - Close the second invoice
 6 - View acquisitions ome
 7 - Note budget A includes the shipping under ordered
 8 - Note budget B includes the shipping under spent
 9 - Click the 'ordered' column on budget A - no shipping is listed on ordered page
10 - Click the spent column on budget A - the shipping is listed here
11 - Apply patch
12 - Both budgets list the shipping as 'spent'
13 - Both 'spent' pages include the shipping
14 - Neither 'ordered' page includes shipping

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23195: Unit tests
Nick Clemens [Mon, 12 Apr 2021 18:13:21 +0000 (18:13 +0000)]
Bug 23195: Unit tests

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16787: DBRev 20.12.00.036
Jonathan Druart [Thu, 22 Apr 2021 09:09:13 +0000 (09:09 +0000)]
Bug 16787: DBRev 20.12.00.036

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16787: (follow-up) Add noReservesAllowed to ERROR_MAP
Nick Clemens [Wed, 21 Apr 2021 11:27:46 +0000 (11:27 +0000)]
Bug 16787: (follow-up) Add noReservesAllowed to ERROR_MAP

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16787: (follow-up) Fix check to ensure reasons are passed to template
Nick Clemens [Thu, 15 Apr 2021 12:20:08 +0000 (12:20 +0000)]
Bug 16787: (follow-up) Fix check to ensure reasons are passed to template

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16787: DBIC schema changes
Nick Clemens [Tue, 4 Aug 2020 18:43:37 +0000 (18:43 +0000)]
Bug 16787: DBIC schema changes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16787: Add noReservesAllowed to club holds
Nick Clemens [Mon, 2 Mar 2020 16:49:16 +0000 (16:49 +0000)]
Bug 16787: Add noReservesAllowed to club holds

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16787: 'Too many holds' message appears inappropriately and is missing data
Nick Clemens [Tue, 21 Jun 2016 13:52:47 +0000 (09:52 -0400)]
Bug 16787: 'Too many holds' message appears inappropriately and is missing data

This patch alters C4/Reserves.pm to pass back 'noReservesAllowed' when
allowedreserves=0. This allows passing to the user an appropriate
message about the availability of items for holds

This patch also fixes a FIXME about using effective_itemtype to fetch item rules

To test:
1 - Set one itemtype to allow no holds
2 - Set 'Holds per record' to 0 for another itemtype/patron combination
3 - Create or find 2 records, each with items only of the itemtypes above
3 - Attempt to place a hold for a patron on each record above
4 - The message will be 'Too many holds'
5 - Apply patch and repeat
6 - Message should be "Cannot place hold: no item are available to be placed on hold"
7 - Try placing a multihold with either record above and a holdable record,
  message should end "Cannot place hold on some items'
8 - prove -v t/db_dependent/Holds.t

Rebase - Fix test expectation

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27120: (follow-up) also send biblionumber
Fridolin Somers [Thu, 11 Mar 2021 08:14:38 +0000 (09:14 +0100)]
Bug 27120: (follow-up) also send biblionumber

Like in after_biblio_action hook

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27120: Send biblio to Koha plugins hook 'intranet_catalog_biblio_tab'
Fridolin Somers [Tue, 1 Dec 2020 08:27:01 +0000 (09:27 +0100)]
Bug 27120: Send biblio to Koha plugins hook 'intranet_catalog_biblio_tab'

Koha plugins hook 'intranet_catalog_biblio_tab' should have the datas of the current biblio record.
Koha::Biblio is aleady in template, send it with hooks call.

This will be very usefull to be able to fetch external datas
(wikipedia, youtube, ...) depending on current biblio record.

Test plan :
1) Enable Koha plugins
2) Install plugin attached to this bug
3) Go to staff interface on a biblio record details page
4) Check you see tab 1 containing 'Tab for record {title}'
5) Check you see tab 2 containing 'Tab for record {isbn}'

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27114: (QA follow-up) Add missing POD
Martin Renvoize [Tue, 9 Mar 2021 16:47:35 +0000 (16:47 +0000)]
Bug 27114: (QA follow-up) Add missing POD

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>