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>
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>
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>
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>
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>
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>
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>
It turns out that ea6467724c also caused the same issue in these locales
Also e0b0e908f7 (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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>