Martin Renvoize [Wed, 13 Apr 2022 12:55:04 +0000 (13:55 +0100)]
Bug 30524: Core CSRF checking code
Split out from bug 22990 as requested.
Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle M Hall [Wed, 26 Jul 2023 15:57:24 +0000 (11:57 -0400)]
Bug 28966: (QA follow-up) Fix failing unit tests
Test Plan:
1) prove t/db_dependent/TestBuilder.t
2) Note tests fail
3) Apply this patch
4) Run updatedatabase.pl
5) Update the schema files ( alias 'dbic' can be used in
koha-testing-docker )
6) prove t/db_dependent/TestBuilder.t
7) Tests now pass!
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Andreas Roussos [Thu, 13 Jul 2023 16:02:02 +0000 (16:02 +0000)]
Bug 34258: update SIP-related unit test
Test plan:
1) Run the updated SIP-related unit test *without* having applied
the other patch from this bug report -- it should fail:
$ prove t/db_dependent/SIP/ILS.t
2) Apply the patch that fixes C4/SIP/ILS/Transaction/Renew.pm
3) Re-run the unit test -- it should pass.
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Andreas Roussos [Thu, 13 Jul 2023 16:01:47 +0000 (16:01 +0000)]
Bug 34258: pass an unblessed hash to AddIssue()
In Koha 23.05, we lost the ability to renew an item via SIP2.
The relevant commit is ddc2906b77 from Bug 31735, where the
file C4/SIP/ILS/Transaction/Renew.pm was modified to no longer
pass an unblessed $patron hash to C4::Circulation::AddIssue()
This patch fixes that.
Test plan:
1) Using the SIP emulator, check out an item to a patron, then
try to renew it. Example commands for a KTD instance:
$ misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m checkout --patron koha --item 3999900000001
$ misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m renew --patron koha --item 3999900000001
Notice that the second command will fail!
2) Apply this patch.
3) Repeat the 2nd command -- this time the renewal should work.
4) Run the SIP-related unit tests, they should all pass:
$ prove t/db_dependent/SIP/
t/db_dependent/SIP/ILS.t .......... ok
t/db_dependent/SIP/Message.t ...... ok
t/db_dependent/SIP/Patron.t ....... ok
t/db_dependent/SIP/SIPServer.t .... ok
t/db_dependent/SIP/Transaction.t .. ok
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle Hall [Wed, 9 Nov 2022 18:11:32 +0000 (13:11 -0500)]
Bug 28966: Prefetch patron data for holds queue viewer
Test Plan:
1) Generate the holds queue
2) Load the holds queue viewer page
3) Apply this patch
4) Restart all the things!
5) Reload the page
6) Note nothing has changed
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle Hall [Wed, 9 Nov 2022 17:09:34 +0000 (12:09 -0500)]
Bug 28966: Add Koha::Object(s) for tmp_holdsqueue
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 32739: Allow other patron identifier on pwd validation
This patch takes a step forward on the password validation endpoint, by
adding the `identifier` parameter and making it be allowed
to be the patron's `cardnumber` or the `userid`.
The current `userid` only validation option is kept as-is.
The implementation relies on `C4::Auth::checkpw` to query for the
patron.
To test:
1. Apply this patches
2. Run:
$ ktd --shell
k$ prove t/db_dependent/api/v1/password_validation.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Wed, 4 Jan 2023 10:13:54 +0000 (11:13 +0100)]
Bug 34226: Add tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Mon, 24 Jul 2023 10:14:31 +0000 (11:14 +0100)]
Bug 34226: Use 'type' at the datatable config level
Lets use 'type' definitions at the datatables settings level instead
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Fri, 7 Jul 2023 13:11:44 +0000 (15:11 +0200)]
Bug 34226: DT wrapper - pre-processed date term when filtering
If we have filters on top of column on a table that is using the DT REST API wrapper,
we cannot filter on date using formatted dates.
This was done for "date of birth" for bug 32505.
Here we want to provide a generic approach.
Note that we cannot use what has been done on bug 22440 in some cases
(when we don't write the thead DOM directly but rely on DataTables
constructor, for instance bug 33568). The data- attributes are not
passed by DT.
Test plan:
On top of 33568, filter date columns using the full version of the
formatted date
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Katrin Fischer [Mon, 17 Jul 2023 16:01:25 +0000 (16:01 +0000)]
Bug 34169: Add decimal class to all relevant input fields in the acquisitions module
This is a first step towards more consistency and possibly supporting
multiple input formats as well in the future. It marks all input fields
for monetary values, such as prices, replacement prices etc. with a class
that is linked to a check for number format with the jQuery Validator plugin.
To test:
For any input field to test, try adding various false entries, like "abc" or "1,00".
It should only accept inputs with decimal dot, like: "1.00"
0) Apply patch, restart_all
1) Suggestion
* Add a new suggestion in the staff interface
* Test: price input field at the bottom of the form.
* Accept the suggestion
2) Order form
* Create a new basket
* Create an order line from an existing record
* Test: list price, replacement price, and actual price.
* Check the checkbox for uncertain price before you save
3) Uncertain prices
* Go to the uncertain prices page for this vendor
* Test: price field
Note: this form does its own validation, but the change should not change behaviour for now
* Resolve the uncertain price
* Close order
4) Receive shipment
* Test: Shipping cost
5) Receive the order
* Test: replacement price, actual price
* Check checkbox for price in foreign currency
* Test: price in foreign currency
* Receive order line
6) Invoice summary
* Finish receiving
* Test: shipping cost
* Test: invoice adjustments: amount in the form for the first entry, amount in the table after adding it
7) Merging invoices
* Receive another shipment and create and invoice
* Go to invoices and search all
* Check the 2 entries for merging
* Test: shipping cost
8) Adding orders from a staged/new file
* Export some records using the cart or list
* Create a new basket
* Order from new file
* Import your file, ignore item records
* Test: price and replacement price
+ Bonus: also test with items, test plan and file from bug 22802 are really helpful here
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Katrin Fischer [Fri, 14 Jul 2023 15:42:46 +0000 (15:42 +0000)]
Bug 34169: Use jQuery validator plugin to validate amounts
This is a first step towards more consistency and possibly supporting
multiple input formats as well in the future. It allows us to mark all
input fields for monetary values, such as prices, replacement prices,
fees etc. with a class that is linked to a check for the 'number' format
in the jQuery Validator plugin.
This is the base patch that does nothing by itself, please see
test plan in second patch.
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 33964: (QA follow-up) Handle absence of smtp server
Resolve:
Use of uninitialized value in hash element at /usr/share/koha/C4/Letters.pm line 1472.
Use of uninitialized value in hash element at /usr/share/koha/C4/Letters.pm line 1473.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle M Hall [Thu, 8 Jun 2023 15:57:47 +0000 (11:57 -0400)]
Bug 33964: Use Email::Sender::Transport::SMTP::Persistent for sending email
As described in bug 30013, some outgoing SMTP services ( such as Gmail ) do not like Koha's current behavior of initiating a new connection for each email sent. If we switch from Email::Sender::Transport::SMTP to Email::Sender::Transport::SMTP::Persistent and store the object for the duration of the message queue processing, this should solve that issue.
Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Hammat Wele [Wed, 14 Jun 2023 17:20:00 +0000 (17:20 +0000)]
Bug 33978: Adding authority from automatic linker closes imported record
If you import a record, then create an authority record using the automatic linker, it closes the biblio record. The problem occures when a record is edited in a new tab.
To recreate:
1. Import the example records
1.1. Download the example records
1.2. Go to Cataloging > Stage records for import
1.3. Choose the downloaded file
1.4. Click Upload file
1.5. Click Stage for import
1.6. Click View batch
1.7. Click Import this batch into the catalog
1.8. Click View detail of the enqueued job
1.9. Click Manage imported batch
Correct behaviour:
2. In another tab, search for one of the records (for example, Fafounet)
3. Click Edit > Edit record
4. Go to field 100
5. Click Link authorities automatically
--> It should say 100 - No matching authority found.
6. Click the plus sign next to 100
7. Fill out the mandatory fields by clinking in the text fields (000, 003, 005, 008, 040), field 100 should already be filled
8. Click 'Save'
--> Authority number is added in 100 and you get to stay in the record for more edits if needed
Incorrect behaviour:
9. Go back to the imported batch tab
10. Click Edit next to the second title (the one by Paventi, Eza)
11. Redo steps 4 to 8
--> Record is closedclear :(
The behaviour should be the same, stay in the bibliographic record until it is saved.
12. Apply the patch
13. Redo step 9, 10, 4
14. Edit field 100, Type 'Paventi Test 2'
15. Redo step 5 to 8
--> Authority number is added in 100 and you get to stay in the record for more edits if needed
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Matt Blenkinsop [Fri, 14 Jul 2023 14:11:28 +0000 (14:11 +0000)]
Bug 34280: Fix warning in logs when saving patron details
If a patron has no valid email address then a warning message appears in the logs when saving:
"Use of uninitialized value $email in string ne at /kohadevbox/koha/Koha/Patron.pm line 1445."
This patch fixes that error by removing an unnescessary string ne
Test plan:
1) Create/choose a patron with no email addresses
2) On the patron record in the page section for Contact information, click edit
3) Now click save
4) The warning above should appear in the logs
5) Apply patch
6) Repeat steps 2 and 3
7) The warning should no longer appear
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Katrin Fischer [Sun, 16 Jul 2023 14:11:19 +0000 (14:11 +0000)]
Bug 34181: Fix jQuery selector to make delete checkboxes reappear
Bug 32257 changed the page structure slightly to fix a display
issue with the labels. This resulted in a broken selector in the
function for displaying the checkboxes for deleting/emptying a
certain patron field.
To test:
* Go to Tools > Batch patron modifications
* Enter some cardnumbers or borrowernumbers
* On the batch patron edit form, verify that the checkboxes
behind each input field are missing
* Apply patch
* Verify the checkboxes reappeared
* Verify that for mandatory fields the checkbox is locked
* Make some batch edits and verify the checkboxes work as
intended
Signed-off-by: Lisette Scheer <lisette.scheer@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Tue, 7 Mar 2023 12:21:12 +0000 (12:21 +0000)]
Bug 32711: Fix biblio embeds
We need to drop the embed part of the args we pass to biblioitem else we end
up with some very strange behaviours on the acquisitions endpoint.
Signed-off-by: Silvia Meakins <smeakins@eso.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Tue, 24 Jan 2023 15:00:03 +0000 (15:00 +0000)]
Bug 32711: Add 'public_read_list' appropriately
We're exposing biblio (and thus biblioitem) to the public API now and as
such we need to explisitely list which fields to include in the response
when called on the public api.
Signed-off-by: Silvia Meakins <smeakins@eso.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Tue, 24 Jan 2023 12:22:34 +0000 (12:22 +0000)]
Bug 32711: Add biblio details to modal
This patch adds biblio details to the self-checkout modal. As part of
this we add 'biblio' to the x-koha-embed option on the public items
endpoint, clone the js-biblio-format include from the staff client
adapting it slightly for OPAC use along the way and also import
escape_str and escapeHtml from staff to opac too.
Signed-off-by: Silvia Meakins <smeakins@eso.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Owen Leonard [Fri, 21 Jul 2023 10:17:39 +0000 (10:17 +0000)]
Bug 34334: Item(s) in MARCdetail untranslatable
This patch adds a <span> around the text "Item(s)" in the template for
the MARC detail page in the staff interface. Without the span the
translation tool can't detect the string.
To test, apply the patch and update a translation, e.g. fr-FR:
> cd misc/translator
> perl translate update fr-FR
- Open the corresponding .po file, in this case
misc/translator/po/fr-FR-staff-prog.po
- Confirm that the string is now in the .po file for translation. You
should find these lines:
I found that the translation was already populated. Install the updated
po file:
> perl translate install fr-FR
Test the MARC detail page in your translated language to confirm that
the string is correct.
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Thu, 20 Jul 2023 15:57:37 +0000 (16:57 +0100)]
Bug 33286: Update 'catalog' to 'bibliographic' in preferences
Correct the terminology to make it clear catalog concerns only concerns
bibliographic records at the moment, not authority records too.
Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Owen Leonard [Thu, 20 Jul 2023 10:55:14 +0000 (10:55 +0000)]
Bug 34320: Hold reordering arrows look broken after Font Awesome upgrade
This patch makes minor CSS corrections to the arrows on the place hold
page in the staff interface. The corrections are necessary because of
changes in the display of icons in Font Awesome 6.
To test, apply the patch and locate a bibliographic record in the staff
interface to place a hold on.
- Place at least one hold on that title.
- After placing the hold, you should see a table of all the existing
holds on that record.
- The arrow control links should look correct, with the "move to top"
and "move to bottom" arrows having an extra border to differentiate
them from the others.
Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Talking to the OpenAPI plugin maintainer, he mentioned the use of $c->validation->output should be avoided as the plugin is not designed to have a stable behavior there, and he even thought of just removing the method.
That method returns an internal data structure the plugin uses to validate things, and then updates the request itself.
Take the following example:
GET /patrons/123
x-koha-embed: checkouts,library
without the OpenAPI plugin, requesting the header like this:
$c->req->headers->header('x-koha-embed')
would return a scalar, the string 'checkouts,library'.
When using the plugin, and with `x-koha-embed` being defined as collectionFormat: csv, that header is entirely replaced by an arrayref.
That's how the plugin works and how it is expected to be used. So we need to replace the uses of $c->validation format, with normal Mojo usage to avoid future headaches.
To test:
1. Run:
$ ktd --shell
k$ prove t/db_dependent/api/v1/*.t
=> SUCCESS: Tests pass!
2. Apply this patches
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 33556: Path parameters are handled explicitly in the controllers
In the case of $c->objects->search_rs, the variable is just not used.
In the case of /acq/orders, it's a leftover from when we removed in the
helper. Check there are tests with path params everywhere (including
orders) and it has no effect.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Marcel de Rooy [Tue, 27 Jun 2023 14:25:44 +0000 (14:25 +0000)]
Bug 33379: Remove virtualshelfcontents.flags
This field is unused. A historic leftover from 2000-2010.
Test plan:
Run dbrev.
Run prove t/db_dependent/Koha/Virtualshel*
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Tue, 11 Apr 2023 20:38:45 +0000 (22:38 +0200)]
Bug 33105: DBIC specific
Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Wed, 12 Apr 2023 08:45:33 +0000 (10:45 +0200)]
Bug 33105: Add tests
Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Tue, 11 Apr 2023 21:12:18 +0000 (23:12 +0200)]
Bug 33105: REST API specs
Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Tue, 11 Apr 2023 21:01:53 +0000 (23:01 +0200)]
Bug 33105: Add vendor issues
This patch is the main patch of this patch set, it contains the
controller acqui/vendor_issues.pl, its corresponding template, and some
links to this script.
It adds:
* A new DB table aqbookseller_issues linked with the aqbooksellers table
* A new subpermission acquisition.issue_manage
* A new authorised value category VENDOR_ISSUE_TYPE and two examples
MAINTENANCE and OUTAGE
* A new controller couple acqui/vendor_issues.[pl,tt]
Test plan:
0. Apply the patches, run updatedatabase and restart_all
1. Go to the acquisition module, create a new vendor or use an existing
one
2. Create a couple of issues for this vendor
3. Edit/Delete and search for those issues
This is the basics for tracking issues with vendors.
Suggestions welcome, on follow-up bug reports.
Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Tue, 11 Apr 2023 21:01:02 +0000 (23:01 +0200)]
Bug 33105: Add Koha object classes
Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Jonathan Druart [Tue, 11 Apr 2023 13:17:24 +0000 (15:17 +0200)]
Bug 33105: DB changes
Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Nick Clemens [Fri, 30 Jun 2023 19:32:36 +0000 (19:32 +0000)]
Bug 34178: Adjust tests
We need to clear the cache when changing rules/statuses
To test:
1 - prove -v t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t
Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Nick Clemens [Fri, 30 Jun 2023 19:26:40 +0000 (19:26 +0000)]
Bug 34178: Cache ItemsAnyAvailableAndNotRestricted in memory and don't precalculate
There are several places in the code where we precalculate ItemsAnyAvailableAndNotRestricted to avoid
looping on this routine when calling IsAvailableForItemLevelRequest on a list of items form a biblio
The value of ItemsAnyAvailableAndNotRestricted is only used when there is a circulation rule for
'onshelfholds' with a value of '2' (If all unavailable)
Rather than calculate a value that may never be used, let's cache this value per request when we do
calculate it - and reuse the cached value
To test:
1 - Apply patch
2 - Set circulation rule 'On shelf holds allowed' as 'If all unavailable'
make sure the rule applies to all of the items/patrons you test with
3 - Find a record with two items that are available
4 - Try to place a hold for a patron - not allowed
5 - Check out one item to another patron
6 - Attempt hold - still not allowed
7 - Check out second item to another patron
8 - Attempt hold - allowed!
9 - Apply patch
10 - Cancel and replace hold - it is allowed!
11 - Check in one item, and cancel hold
12 - Place hold - not allowed!
13 - Check in second item
14 - Place hold - not allowed!
15 - prove -v t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t
Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Mason James [Wed, 21 Sep 2022 11:38:59 +0000 (23:38 +1200)]
Bug 28493: Make koha-passwd display the username
to test...
1/ run command
$ sudo koha-passwd dev1
Password for dev1: CraZyPa$$WoRD!!
Press enter to clear the screen...
^C
2/ apply patch
3/ run command again, note 'username' section
$ sudo koha-passwd dev1
Username for dev1: koha_dev1 <<<<<<<<<<<<
Password for dev1: CraZyPa$$WoRD!!
Press enter to clear the screen...
^C
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle M Hall [Fri, 14 Jul 2023 11:36:47 +0000 (07:36 -0400)]
Bug 34279: Don't enforce overduefinescap unless it is greater than 0
When creating a circ rule, we can set overduefinescap to blank or 0 and no cap is enforced. If we edit that rule, the blank/0 is converted to "0.00" which perl considers true, thus zero-ing out any calculated fine.
Considering we've always ignored an overdue fines cap of 0, we should also ignore 0.00. However, perl is evaluating it as a string which makes it true instead of false as 0 is.
Test Plan:
1) Apply the first patch ( unit tests )
2) prove t/db_dependent/Circulation/CalcFine.t
3) Note the test fails
4) Apply the second patch as well
5) prove t/db_dependent/Circulation/CalcFine.t
6) Note the test passes
Test Plan 2:
1) Create an all/all/all rule with an overduefinescap of 0.00, with a
daily fine. Enable CalculateFinesOnReturn
2) Backdate a checkout so it is overdue
3) Return this item, note the lack of a fine
4) Apply this patch set
5) Backdate a checkout and return it again
6) Note the fine is generated!
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle M Hall [Fri, 14 Jul 2023 11:32:11 +0000 (07:32 -0400)]
Bug 34279: Unit tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Wed, 19 Jul 2023 11:31:14 +0000 (12:31 +0100)]
Bug 32271: (QA follow-up) Correction to 'can_be_blank' logic
The logic introducing the can_be_blank check into the monetary decimal
format check was flawed and meant we were no longer checking decimal
formatting in the majority of cases. This patch updates that so we pass
the unit tests and correctly check any value passed that's not an empty
string.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle M Hall [Fri, 14 Jul 2023 13:08:51 +0000 (09:08 -0400)]
Bug 32271: (QA follow-up) Convert all positive numbers to monetary float and convert all 0 equivilents to blank value
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Géraud Frappier [Mon, 5 Dec 2022 17:30:40 +0000 (12:30 -0500)]
Bug 32271: Fix overdue fines cap (amount) set to 0.00 when editing rule.
Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Nick Clemens [Fri, 7 Apr 2023 14:54:36 +0000 (14:54 +0000)]
Bug 33444: Update AddRenewal to take a hashref of params
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Removed skip_record_index => 1 from automatic_renewals.pl. See BZ. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pedro Amorim [Tue, 27 Jun 2023 15:00:00 +0000 (15:00 +0000)]
Bug 34133: Set default sort on first column (ID) desc
Test plan:
Before applying patch:
* Open incognito at /cgi-bin/koha/ill/ill-requests.pl,
* Verify order is by ASC (lowest ID first)
* Close incognito
Apply patch, then:
* Open incognito at /cgi-bin/koha/ill/ill-requests.pl,
* Verify order is by DESC (highest ID first)
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Followed the test plan from Bugzilla, and added it above.
Works as advertised. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Aleisha Amohia [Tue, 13 Jun 2023 05:29:22 +0000 (17:29 +1200)]
Bug 33992: Only consider the date when auto-expiring problematic recalls
This patch carries this fix into the misc/cronjobs/recalls/expire_recalls.pl cronjob so that recalls are automatically expired when they have been waiting a problematic number of days, not considering hours, as expected.
To test, follow the test plan from the first patch. This will set you up with a waiting problematic recall.
Run the cronjob manually
perl misc/cronjobs/recalls/expire_recalls.pl
Refresh your 'Recalls awaiting pickup' page. Your problematic recall should be gone/expired.
Expiration dates will apply when expiring any 'unfulfilled' recall i.e. newly requested, overdue to be returned, and awaiting pickup.
Sponsored-by: Auckland University of Technology Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 33028: (follow-up) Lower the two digits requirement
This patch makes the code not require two decimal digits, as the main
intention here is to forbid (locale) formatted strings to reach the DB.
The number of digits we support needs to be discussed on its own bug,
and a centralized check implemented.
This patch fixes tests:
prove t/db_dependent/Circulation.t
t/db_dependent/Circulation.t .. 1/67 Exception 'Koha::Exceptions::CirculationRule::NotDecimal' thrown 'The circulation rule expected a decimal value' with name => fine, value => 0.1
t/db_dependent/Circulation.t .. Dubious, test returned 11 (wstat 2816, 0xb00)
Failed 53/67 subtests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
While testing this bug I found Circulation.t was failing, but the
exception doesn't actually display anything useful in terms of helping
debug what's going on.
This patch makes it add the rule_name and rule_value to the message.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Tue, 27 Jun 2023 15:54:02 +0000 (16:54 +0100)]
Bug 33028: (follow-up) Apply unformat_price to decimal fields
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Tue, 27 Jun 2023 15:22:36 +0000 (16:22 +0100)]
Bug 33028: (follow-up) Add unformat_price js function
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Katrin Fischer [Fri, 16 Jun 2023 17:01:52 +0000 (17:01 +0000)]
Bug 33028: (follow-up) Rewrite database update
This rewrite the database update with some things in mind:
* We now use a positive value list of allowed characters to check
This makes sure that all of those are recognized:
1,00
1.00€
abc
* Instead of dying after finding one wrong value, we loop through
all values first, building up an error string
* When we have errors... we die and print the full list of things
that need fixing.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Katrin Fischer [Fri, 16 Jun 2023 16:59:22 +0000 (16:59 +0000)]
Bug 33028: Add TT filters for Price and pattern checks to input fields
With this patch, all monetary values in the table will be displayed
formatted.
Also, the input will be checked against our agreed pattern to make
sure no false values can be entered.
Missing: When editing a rule, we need to unformat the value, so that
instead of the display format we have the input format available
for editing.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Katrin Fischer [Fri, 16 Jun 2023 16:57:51 +0000 (16:57 +0000)]
Bug 33028: Add is_monetary to recall_overdue_fine and article_request_fee
This patch marks the 2 missing monetary values for recal over due fines
and article request fees as monetary.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Fri, 3 Mar 2023 11:33:46 +0000 (11:33 +0000)]
Bug 33028: (follow-up) Fix trailing 0 decimals
We want to recognise the truthyness of a number vs string so we drop
trailing decimals if they're just 0.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Martin Renvoize [Fri, 3 Mar 2023 11:28:20 +0000 (11:28 +0000)]
Bug 33028: (follow-up) Move monetary definition into hash
This patch moves the defintion of monetary rule type into the rule kinds
hash.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Thibaud Guillot [Tue, 21 Feb 2023 16:05:45 +0000 (17:05 +0100)]
Bug 33028: Fix calculations around cronjob fines.pl
When currency format is set on FR commas are decimals separators
but when cron like fines.pl try to calculate fines it's fails due to
this format.
I changed this behavior by targetted 'fine' and 'overduefinescap' in
circulation_rules.rule_name to unformat them when we save them.
This also fix the display in smart_rules table (before with commas price
was not good displayed - without decimals)
Test Plan :
1) Set your currency format on 'FR' and 'fine' OR/AND 'overduefinescap'
with commas
2) Be sure to have some patron overdues
3) Run ~/misc/cronjobs/fines.pl with args to find overdues
4) See an error like 'isn't numeric in substraction[..] or gt > [...]'
5) Run updatedatabase script (it will replace commas in your rules
changed in step 1) )
6) Repeat step 3 and see that everything was going "fine" (:tada:)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 33671: (follow-up) Disable FK check for column change
See also BZ report. As suggested by Tomas.
NOTE: The dbrev is extended too for removing records with a failing guarantor_id
foreign key (theoretically not present obviously).
Test plan:
1) cp installer/data/mysql/db_revs/220600048.pl installer/data/mysql/atomicupdate/
2) Run updatedatabase.pl
3) Remove copied file
Bonus:
Manually remove FK constraint before running updatedatabase.
Insert a record with bad guarantor_id into relationships manually.
Run the update again.
You should not see the message that the constraint is removed.
Is the bad record count reported and record removed?
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Simplified. No longer removes the FK. Just disables during ALTER. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle Hall [Wed, 22 Feb 2023 18:23:09 +0000 (13:23 -0500)]
Bug 33046: Use process_tt in C4::Reports::Guided::EmailReport
Bug 33030 implements a new helper subroutine to standardize processing of Template Toolkit syntax outside slips and notices. We should use this subroutine in EmailReport.
Test Plan:
1) Apply this patch
2) prove t/db_dependent/Reports/Guided.t
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Kyle Hall [Wed, 22 Feb 2023 16:47:12 +0000 (11:47 -0500)]
Bug 33041: Use process_tt in C4::Serial::NewIssue
Bug 33030 implements a new helper subroutine to standardize processing of Template Toolkit syntax outside slips and notices. We should use this subroutine in C4::Serial::NewIssue
Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Items.t
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>