koha.git
9 months agoBug 34589: Only update users if permission is added
Nick Clemens [Tue, 22 Aug 2023 15:09:17 +0000 (15:09 +0000)]
Bug 34589: Only update users if permission is added

To test:
1 - Assign a user 'edit_items' permission
2 - Manually run the update
    perl -e 'use C4::Installer; warn Data::Dumper::Dumper(C4::Installer::run_db_rev("installer/data/mysql/db_revs/221200003.pl"));'
3 - Edit patron permissions
4 - Note they now have edit_any_item permission
5 - Remove that permission
6 - Run the update again
7 - Edit patron permissions
8 - They have edit_any_item again - remove it
9 - Apply patch
10 - Run the update
11 - Edit patron permissions
12 - No new permissions added!
13 - sudo koha-mysql kohadev
     DELETE FROM permissions WHERE code = 'edit_any_item'
14 - Run the update again
15 - Edit patron permissions
16 - They do have edit_any_item

Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 14156: Add id tags to each MARC note in the display
Owen Leonard [Tue, 15 Aug 2023 07:36:43 +0000 (07:36 +0000)]
Bug 14156: Add id tags to each MARC note in the display

This patch adds tag number to the data which is returned by
$biblio->get_marc_notes(). The bibliographic detail page in the staff
client is modified to use the tag number in both a class (for consistent
styling across the same tag number) and id (for unique styling for each
repeated tag).

To test, apply the patch and restart services.

- As a quick test for custom CSS, go to Administration -> System
  preferences and locate the IntranetUserCSS preference.
  - Add this testing CSS:

   .marcnote { font-size:140%; font-family: serif; }
   .marcnote-500 { background-color: #66FFCC; }
   .marcnote-511 { background-color: #99FFFF; }
   .marcnote-520 { background-color: #CCFF00; }
   .marcnote-521 { background-color: #CCFFFF; }
   .marcnote-538 { background-color: #FFCCCC; }
   .marcnote-546 { background-color: #FFFFCC; }

- Locate a record with multiple notes fields. In the sample data, record
  46, "Viridiana" is a good example which works well with the above CSS.
- On the bibliographic detail page for the record, click the
  "Descriptions" tab.
  - Each MARC note should be colored according to the tag it comes from.
  - Inspect the HTML to confirm that each paragraph also has its own
    unique ID.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34787: Fix typo gorup
Marcel de Rooy [Thu, 14 Sep 2023 09:31:00 +0000 (09:31 +0000)]
Bug 34787: Fix typo gorup

No test plan (fixing comment).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34716: Fix typo
Matt Blenkinsop [Tue, 5 Sep 2023 13:40:07 +0000 (13:40 +0000)]
Bug 34716: Fix typo

Fixes a typo where "it's" should be "its"

Test plan:
1) Check the commit and observe that the change has been made correctly

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>
9 months agoBug 33818: Descriptive title added to opac-ISBDdetail.tt
Matt Blenkinsop [Wed, 24 May 2023 14:51:04 +0000 (14:51 +0000)]
Bug 33818: Descriptive title added to opac-ISBDdetail.tt

This patch adds the biblio.title to the breadcrumb for the ISBD viewer.
This now matches the normal and MARC views and is much clearer for
screen readers.

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>
9 months agoBug 33045: Fix shebang of marcrecord2csv.t
Marcel de Rooy [Fri, 15 Sep 2023 09:26:31 +0000 (09:26 +0000)]
Bug 33045: Fix shebang of marcrecord2csv.t

Resolves:
bash: t/db_dependent/Record/marcrecord2csv.t: /usr/bin/perl;: bad interpreter: No such file or directory

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33045: Use process_tt in C4::Record::marcrecord2csv
Kyle Hall [Wed, 22 Feb 2023 18:16:35 +0000 (13:16 -0500)]
Bug 33045: Use process_tt in C4::Record::marcrecord2csv

Bug 33030 implements a new helper subroutine to standardize processing of Template Toolkit syntax outside slips and notices. We should use this subroutine in marcrecord2csv.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Record/marcrecord2csv.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>
9 months agoBug 34443: Spelling: Patron search pop-up Sort1: should be Sort 1
Owen Leonard [Fri, 8 Sep 2023 15:44:33 +0000 (15:44 +0000)]
Bug 34443: Spelling: Patron search pop-up Sort1: should be Sort 1

This patch instances of "Sort1" and "Sort2" being used
as labels in the interface, replacing the strings with "Sort 1" and
"Sort 2"

To test, apply the patch and test this page:

With the borrowerRelationship system preference populated, edit a
child record and click the "Add guarantor" button. There are two
fields in the form with the updated labels.

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34743: Fix POD description
Matt Blenkinsop [Fri, 8 Sep 2023 11:04:56 +0000 (11:04 +0000)]
Bug 34743: Fix POD description

Currently --expiration-from-today has the same definition as --update-expiration. The description has now been updated to reflect the fact that it will set the date from today, and not the patron's enrollment date

Test plan:
Look at the patch file and confirm that the POD now mentions today's date rather than the patron's enrollment date

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34228: Add translation context to "Managed by"
Caroline Cyr La Rose [Mon, 10 Jul 2023 14:52:35 +0000 (10:52 -0400)]
Bug 34228: Add translation context to "Managed by"

This patch adds context for translators to the Managed by string when it
applies to acquisitions baskets (as opposed to purchase suggestions).

To test:
0. If you don't already have acquisitions set up, create a budget and a vendor

1. Apply patch

2. Create a basket
   2.1. Go to Acquisitions
   2.2. Search for a vendor
   2.3. Click New > Basket
   2.4. Fill out the form
   2.5. Click Save

3. View the basket details page
   --> The page works (no errors)
   --> 'Managed by:' is displayed on the right, no spelling errors

4. Click Add to basket > From a new (empty) record
   --> The page works (no errors)
   --> 'Managed by:' is displayed under Basket details, no spelling errors

5. Click Cancel

6. Update the po files

gulp po:update --lang xx-XX

for example, gulp po:update --lang fr-CA

7. Check the xx-XX-messages.po file (e.g. misc/translator/po/fr-CA-messages.po)
   --> There should be an entry for 'Managed by:' with a line msgctxt that gives the 'Acquisitions basket managed by user' context

8. Update the file with a random phrase for the 'Managed by:' translation

for example, I translated 'Managed by:' by 'AAAAAAA:', just to see the difference

\#: koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt:308
\#: koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt:281
msgctxt "Acquisitions basket managed by user"
msgid "Managed by:"
msgstr "AAAAAAA:"

9. Install a new language
   9.1. Run the following commands in the terminal, replacing xx-XX with the language code (e.g. fr-CA)

   ./misc/translator/translate install xx-XX

   9.2. In the Koha staff interface, go to Administration > System preferences
   9.3. Search for language
   9.4. Check the box next to the new language
   9.5. Save

10. Switch the language of the interface

11. Redo steps 3 and 4
   --> The pages still work (no errors)
   --> The 'Managed by:' string should be replaced by whatever you put in step 8

Optional test
12. In the staff interface in English, view one or more of these pages, the 'Managed by' string should be unchanged
- Acquisitions > Suggestions (Managed by column heading)
- Acquisitions > Suggestions (Organize by: Managed by sorting option)
- Acquisitions > Suggestions (Filter by: Suggestion information: Managed by filter option)
- Acquisitions > Suggestions > Click on a suggestion (Managed by table row under Suggestion management)
- Patrons > Patron account > Purchase suggestions (Managed by column heading)

13. View these same pages in the other language, the Managed by string should NOT be changed to whatever you put in step 8

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34656: (QA follow-up) perltidy
Emily Lamancusa [Thu, 31 Aug 2023 14:52:52 +0000 (10:52 -0400)]
Bug 34656: (QA follow-up) perltidy

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34656: Do not update real Time Holds Queue when moving from cart to shelf
Nick Clemens [Wed, 30 Aug 2023 13:46:52 +0000 (13:46 +0000)]
Bug 34656: Do not update real Time Holds Queue when moving from cart to shelf

To test:
1 - Enable RealTimeHoldsQueue system preference
2 - Set UpdateItemLocationOnCheckin to _ALL_: CART
3 - Check in an item
4 - Check the background jobs - the RTHQ is updated
5 - perl -e 'use C4::Items; C4::Items::CartToShelf(##);' -- substitute the itemnumber from above
6 - Check the background jobs - no new update to RTHQ
7 - Confirm item was set back to correct permanent_location

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34656: Unit test
Nick Clemens [Wed, 30 Aug 2023 13:46:17 +0000 (13:46 +0000)]
Bug 34656: Unit test

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34767: Pass fee_ack into ::Transaction::Renew(All)
Martin Renvoize [Tue, 12 Sep 2023 15:24:19 +0000 (16:24 +0100)]
Bug 34767: Pass fee_ack into ::Transaction::Renew(All)

This patch copies the $fee_ack field into the generated
::Transaction::Renew|All objects such that the fee acknowldegement flag
is respected for renewals.

Test plan
To test:
1) Add a rental charge to an itemtype
2) Checkout an item of that itemtype to a user
3) Attempt a renewal of that item via SIP2 and note that it fails
   sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m renew
4) Pass the fee_acknowledgement bit in renewal and note the renewal
   still fails.
   sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m renew
5) Apply patch and note the above now succeeds
   sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m renew

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>
9 months agoBug 34768: Remove checkbox column from relatives fines on OPAC
Nick Clemens [Tue, 12 Sep 2023 15:28:34 +0000 (15:28 +0000)]
Bug 34768: Remove checkbox column from relatives fines on OPAC

When a patron has a guarantee and can see their fines on the opac and
an opac payment plugin is enabled there is an error on the 'Charges'
tab.

The table uses a 'COLSPAN' variable which is set to 5 or 6 depending on
if OPAC payments are enabled. The guarantees table has one less column
than the patron's however, so it is going out of range and causing a JS
error. Additionally, we are adding a column to the child's table which
is not used as their fines cannot be selected for payment at this time.

This patch removes the checkbox column and sets the colspan directly to
4

I also fix an issue where the table is not being set as we need to
reference the patron object in the guarantor info to obtain the id.

To test:
1 - Set system preference: AllowStaffToSetFinesVisibilityForGuarantor to
    allow
2 - Find a patron
3 - Add some fines to their account
4 - Install and enable an opac payment plugin
    (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution
    for example)
5 - Sign in to OPAC as borrower
6 - Go to 'Charges' tab
7 - Select a fee
8 - Confirm 'Make payment' button enabled and 'amount to pay' is
    updated
9 - Add a guarantee to patron in staff interface
10 - Set 'Show charges to guarantors' to 'Yes'
11 - Add and pay a fine for the child
12 - View guarantor account on the OPAC
13 - Confirm you now see child's charges
14 - Confirm selecting your own fees does not enable the button or
     update amount to pay
15 - Note JS error in console
16 - Apply patch
17 - Reload patrons page
18 - Confirm the table loads correctly (no JS error)
19 - Confirm selecting a fine updates the total and enables button
20 - Disable the payment plugin
21 - Confirm the display is still correct, no errors

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>
9 months agoBug 34764: Set fee_acknowledged to expect a string
Martin Renvoize [Tue, 12 Sep 2023 13:18:37 +0000 (14:18 +0100)]
Bug 34764: Set fee_acknowledged to expect a string

For consistency with other options I opted to have the fee acknowledged
parameter to expect a string and as it's an optional parameter I've
dropped the default value of 'N' too.

Test plan
1) Prior to this patch
1a) Attempt a checkout without passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will be '|BON', the default
1b) Attempt a checkout passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will still be '|BON', failure
1c) Attempt a checkout passing a string for fee_acknoewledeged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will still be '|BON', failure
2) Apply the patch
2a) Attempt a checkout without passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m checkout`
    The optional `|BO` element should not be present
2b) Attempt a checkout passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged N --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will now be '|BON', success
2c) Attempt a checkout passing a string for fee_acknoewledeged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will now be '|BOY', success

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34736: Don't trigger quantity change on loading order
Nick Clemens [Thu, 7 Sep 2023 19:02:08 +0000 (19:02 +0000)]
Bug 34736: Don't trigger quantity change on loading order

We have a change event to automatically check or uncheck the first items on a list when
the value is changed directly.

The code is calling this when setting the quantity when loading an order, but this is causing a problem
in that we are setting the quantity to load.switch orders and triggering the checkboxes wrongly

To test:
 1 - Create a new basket, create items on placing the order
 2 - Create an order line with 4 items
 3 - Create another order line with 2 items
 4 - Close the basket
 5 - Receive shipment and create an invoice
 6 - Select both orders via the checkboxes got multi-receive
 7 - Click "receive selected"
 8 - Edit first order line, quantity received = 1 (1 out of 4)
 9 - Verify that one item is also selected in the table
10 - Switch to "next order"
11 - Quantity received is 0, no items checked in the second order
12 - Switch to "Previous order"
13 - ERROR: Item checkbox was lost, quantity received still correct
14 - Switch to next order
15 - ERROR: item is now checked, quantity received 0
16 - Note: We see a mix up of the information entered, one has the checkbox now, the other the quantity.
17 - Save changes
18 - Click confirm
19 - Continue (complaint about the second order left unchanged)
20 - You are back on the summary:
     * pending order: quantity changed from 4 to 3 - correct
     * received order: quantity shows 1 - correct
21 - Click on receive for your updated order line (with 3 items)
     * 4 items show to be received (should be 3)
22 - Apply patch
23 - Cancel receipt of items
24 - Repeat 1-12
25 - Items are loaded correctly
26 - Try with various checkboxes and switch back and forth
27 - Confirm that manually adjusting quantity received checks the first n boxes
28 - Confirm setting quantity to 0 unchecks the boxes

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34532: Silence warns in Patroncard.pm
Lucas Gass [Mon, 14 Aug 2023 21:11:52 +0000 (21:11 +0000)]
Bug 34532: Silence warns in Patroncard.pm

To test:

1. Go to patron card creator and make a patron card batch, card layout, and card template.
2. In the card layout leave some values blank for Lower left X coordinate and Lower left Y coordinate.
3. Now go create a card batch while tailing the plack-intranet-error log/
4. Notice in the logs:

[2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 109.
[2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 248.
[2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 249.

5. Apply patch, restart_all
6. Try again and notice the WARNS should be gone from the logs now.
7. Make sure you can still create patron cards and the PDF's the generate look right.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34414: Remove DBD::Mock
Marcel de Rooy [Wed, 26 Jul 2023 06:56:03 +0000 (06:56 +0000)]
Bug 34414: Remove DBD::Mock

We never actually used it. See BZ report.

Test plan:
Run git grep DBD::Mock. Only finding old release notes.
Run git grep mock_add_resultset. Nothing.
Bonus: Find a few other DBD::Mock properties/attributes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33940: (QA follow-up) Remove obsolete length of 20
Marcel de Rooy [Fri, 21 Jul 2023 09:44:18 +0000 (09:44 +0000)]
Bug 33940: (QA follow-up) Remove obsolete length of 20

Currently 32. Could be 43 tomorrow :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33940: Consider NULL as valid
Jonathan Druart [Fri, 21 Jul 2023 08:46:41 +0000 (10:46 +0200)]
Bug 33940: Consider NULL as valid

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33940: Move C4::Members cardnumber sub to Koha::Policy::Patrons::Cardnumber
Jonathan Druart [Wed, 7 Jun 2023 13:37:55 +0000 (15:37 +0200)]
Bug 33940: Move C4::Members cardnumber sub to Koha::Policy::Patrons::Cardnumber

Test plan:
The idea here is to confirm this patch does not introduce regression.
For that you will play with the CardnumberLength syspref and create a
new user, modify an existing one, and check that the UI does not let you
modify an invalid cardnumber.
The onboarding process and the patron import tool will also have to be tested

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 33940: Fix selfreg

please squash with first patch

Bug 33940: Fix messages we sent to templates

please squash with the first patch

Bug 33940: Fix what we send to memberentry

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 17499: (QA follow-up) Fix permissions
Tomas Cohen Arazi [Tue, 12 Sep 2023 19:21:40 +0000 (16:21 -0300)]
Bug 17499: (QA follow-up) Fix permissions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34721: (QA follow-up) update the other labels
Pedro Amorim [Thu, 7 Sep 2023 13:47:21 +0000 (13:47 +0000)]
Bug 34721: (QA follow-up) update the other labels

Showing only available items -> Showing only records with available items
Show all items -> Show all records

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34721: Change facet availability text in staff interface and OPAC
Lucas Gass [Tue, 5 Sep 2023 21:34:36 +0000 (21:34 +0000)]
Bug 34721: Change facet availability text in staff interface and OPAC

To test:
1. Apply patch
2. Do a catalog search in the staff interface. Make sure the 'Availability' button reads 'Limit to records with available items'.
3. Do a catalog search in the OPAC. Make sure the 'Availability' button reads 'Limit to records with available items'.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 17499: Replace Koha::MessageAttribute(s) with Koha::Patron::MessagePreference...
Lari Taskula [Fri, 10 Feb 2023 10:48:19 +0000 (10:48 +0000)]
Bug 17499: Replace Koha::MessageAttribute(s) with Koha::Patron::MessagePreference::Attribute(s)

To test:
1. prove t/db_dependent/Illrequests.t
2. grep -rn 'Koha::MessageAttribute', observe no results in Koha code

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>
9 months agoBug 17499: (follow-up) Add $patron->messaging_preferences accessor
Lari Taskula [Thu, 18 Mar 2021 03:16:11 +0000 (03:16 +0000)]
Bug 17499: (follow-up) Add $patron->messaging_preferences accessor

To test:
1. prove t/db_dependent/Koha/Patron.t

Sponsored-by: The National Library of Finland
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: (follow-up) Rename to Koha::Patron::MessagePreference
Lari Taskula [Thu, 18 Mar 2021 02:13:50 +0000 (02:13 +0000)]
Bug 17499: (follow-up) Rename to Koha::Patron::MessagePreference

Koha::Patron::Message refers to "messages" table that is used for circulation
messages. MessagePreference now refers to a messaging preference that is used
for enqueued notifications.

To test:
1. prove t/db_dependent/Koha/Patron/MessagePreference/Attributes.t
2. prove t/db_dependent/Koha/Patron/MessagePreference/Transport/Preferences.t
3. prove t/db_dependent/Koha/Patron/MessagePreference/Transport/Types.t
4. prove t/db_dependent/Koha/Patron/MessagePreference/Transports.t
5. prove t/db_dependent/Koha/Patron/MessagePreferences.t

Sponsored-by: The National Library of Finland
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: (follow-up) Contact information vs. mtt validation
Lari Taskula [Wed, 18 Nov 2020 02:15:23 +0000 (02:15 +0000)]
Bug 17499: (follow-up) Contact information vs. mtt validation

This patch adds a subroutine that handles message transport type validation by
first checking related patron contact information.

As an example, if there is no email address, we shouldn't let email be selected
as a messaging transport type.

The reason to isolate logic into a separate subroutine is that C4/Reserves.pm
_koha_notify_reserve() also uses the same logic and we should not duplicate it.
C4::Reserves::_koha_notify_reserve() will be adjusted to use this new sub in
Bug 18595.

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t

Sponsored-by: The National Library of Finland
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: (follow-up) Validate phone and itiva transport types
Lari Taskula [Wed, 18 Nov 2020 04:10:48 +0000 (04:10 +0000)]
Bug 17499: (follow-up) Validate phone and itiva transport types

Message transport types 'phone' and 'itiva' were not validated unlike
'email' and 'sms'. This patch adds equivalent checks to the missing mtts.

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t

Sponsored-by: The National Library of Finland
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: (follow-up) Fix warning
Lari Taskula [Thu, 5 Nov 2020 18:26:42 +0000 (18:26 +0000)]
Bug 17499: (follow-up) Fix warning

Fix warning

DBIx::Class::Storage::DBI::select_single(): Query returned more than one row.
SQL that returns multiple rows is DEPRECATED for ->find and ->single.

Sponsored-by: The National Library of Finland
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: (follow-up) More explicit exceptions
Lari Taskula [Wed, 4 Nov 2020 15:19:22 +0000 (15:19 +0000)]
Bug 17499: (follow-up) More explicit exceptions

Adds and throws more detailed exceptions.

This is useful for APIs and generating translatable errors in GUI.

In short, replaces Koha::Exceptions::BadParameter with:

Koha::Exceptions::Patron::NotFound
Koha::Exceptions::Patron::Category
Koha::Exceptions::Patron::Category::NotFound
Koha::Exceptions::Patron::Message::Preference
Koha::Exceptions::Patron::Message::Preference::AttributeNotFound
Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceOutOfRange
Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceNotAvailable
Koha::Exceptions::Patron::Message::Preference::DigestNotAvailable
Koha::Exceptions::Patron::Message::Preference::DigestRequired
Koha::Exceptions::Patron::Message::Preference::EmailAddressRequired
Koha::Exceptions::Patron::Message::Preference::NoTransportType
Koha::Exceptions::Patron::Message::Preference::SMSNumberRequired

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t

Sponsored-by: The National Library of Finland
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: (QA follow-up) Fix POD errors
Martin Renvoize [Wed, 8 Jul 2020 12:32:17 +0000 (13:32 +0100)]
Bug 17499: (QA follow-up) Fix POD errors

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: (QA follow-up) Fix Licence Statements
Martin Renvoize [Wed, 8 Jul 2020 12:20:35 +0000 (13:20 +0100)]
Bug 17499: (QA follow-up) Fix Licence Statements

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: Replace test subroutines with build_object
Emmi Takkinen [Wed, 26 Feb 2020 10:04:08 +0000 (12:04 +0200)]
Bug 17499: Replace test subroutines with build_object

This patch replaces subroutines used to build test
objects with call to $builder->build_object.

To test prove that tests are still running with:
prove t/db_dependent/Koha/Patron/Message/*

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: Define koha_object(s)_class where needed
Emmi Takkinen [Thu, 20 Feb 2020 10:45:27 +0000 (12:45 +0200)]
Bug 17499: Define koha_object(s)_class where needed

This patch adds koha_object(s)_class for needed modules
to fix issues with tests.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 17499: Add Koha-objects for messaging preferences
Lari Taskula [Fri, 21 Oct 2016 14:26:24 +0000 (17:26 +0300)]
Bug 17499: Add Koha-objects for messaging preferences

This patch adds Koha-objects for messaging preferences.

Adds simple validation for messaging preferences.

The validation includes
- throw exception if both borrowernumber or categorycode is given for a new pref
- throw exception if patron for the given borrowernumber is not found
- throw exception if category for the given categorycode is not found
- throw exception if days in advance cannot be configured but is given
- throw exception if days in advance configuration is invalid (value between 0-30)
- throw exception if digest is not available but attempted to set on
- throw exception if digest must be enabled but attempted to set off
- throw exception on duplicate messaging preference

Adds a method for getting available messaging options.

Adds a method for setting default messaging preferenes.
  $patron->set_default_messaging_preferences (where $patron is a Koha::Patron)
  ...or...
  Koha::Patron::Message::Preference->new_from_default({
    borrowernumber => 123,
    categorycode => "ABC",
    message_attribute_id => 1,
  });

Since messaging preference is a feature that has multiple related database tables,
usage via Koha-objects is sometimes frustrating. This patch adds easy access to
message transport types via
  $preference->message_transport_types                              (for getting)
  $preference->set({ message_transport_types => ['email', 'sms'] }) (for setting)
  (also supports other calling conventions, see documentation for more)

Adds optional parameter message_name for Koha::Patron::Message::Preferences->find
and ->search. Simplifies the Koha-object usage by allowing developer to skip joins
and / or querying the message name via attribute_id from message_attributes table.

Includes test coverage for basic usage.

To test:
1. prove t/db_dependent/Koha/Patron/Message/*

Following Bug 17499, check also Bug 18595 that replaces C4::Members::Messaging
with these new Koha-objects.

Signed-off-by: Dominic Pichette <dominic@inlibro.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Michal Denar <black23@gmail.com>
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>
9 months agoBug 34502: Remove useless SEARCH_RESULT.localimage
David Cook [Wed, 9 Aug 2023 01:06:05 +0000 (01:06 +0000)]
Bug 34502: Remove useless SEARCH_RESULT.localimage

This patch removes a useless Template Toolkit tag.

To test:
0. Apply the patch
1. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=LocalCoverImages
2. Change to "Show"
3. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
4. Upload an image
5. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test
6. Note that the local cover image appears even without the TT tag

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 32765: Retry transfer after cancelling hold
Julian Maurice [Tue, 31 Jan 2023 08:20:15 +0000 (09:20 +0100)]
Bug 32765: Retry transfer after cancelling hold

When trying to manually transfer an item that is on hold, we have the
choice to cancel the hold and try the transfer again. When choosing
this option, the hold is correctly cancelled but the transfer is not
tried again.
This patch fixes that

Test plan:
1. Place a hold on a specific item
2. Try to transfer it manually (Circulation Â» Transfer)
3. Choose the option to "Cancel hold and then attempt transfer"
4. See that the hold was cancelled, but no transfer was made
5. Apply the patch
6. Repeat step 1-3
7. See that the hold was cancelled, and the transfer was made

Signed-off-by: Nicolas Giraud <nicolas.giraud@inlibro.com>
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 27378: Fix permissions
Tomas Cohen Arazi [Tue, 12 Sep 2023 12:48:04 +0000 (09:48 -0300)]
Bug 27378: Fix permissions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34223: (follow-up) Ensure consistent ordering of statuses
Martin Renvoize [Mon, 11 Sep 2023 13:50:43 +0000 (14:50 +0100)]
Bug 34223: (follow-up) Ensure consistent ordering of statuses

This patch adds an order_by clause to ensure consistent ordering of the
returned status and status_alias statuses from the database between
MySQL 8 and other DB engines.

This fixes the failing tests introducd in bug 34223.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34572: Simplify template logic around check-in input form
Owen Leonard [Fri, 18 Aug 2023 07:40:16 +0000 (07:40 +0000)]
Bug 34572: Simplify template logic around check-in input form

This patch makes a minor simplifying change to the check-in template
around how to style the barcode input field in dropbox or fine-exempt
mode.

To test, apply the patch and go to Circulation.

- If necessary, check some items out to patrons so that you have items
  to check in.
- Go to the check-in page and click the icon inside the barcode field to
  expand the panel of options.
- Check the "book drop mode" checkbox. The barcode field should now be
  highlighted yellow.
- Check in an item. When the page redisplays, the barcode field should
  have the same highlighted style.

- If necessary, enable the finesMode system preference.
- On the check-in page, in the panel of options, check the "Forgive
  overdue fines" checkbox. Test checking in again, confirming the same
  style consistency in the barcode field.

Signed-off-by: Inkeri <inkeri.hakulinen@helsinki.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34723: Show thumbnails on opac-imageviewer.pl when imagenumber not provided
David Cook [Wed, 6 Sep 2023 06:28:45 +0000 (06:28 +0000)]
Bug 34723: Show thumbnails on opac-imageviewer.pl when imagenumber not provided

This patch fixes a method call in the opac-imageviewer.pl so that thumbnails
correctly appear.

Test plan:
0. Apply the patch
1. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=localcover
2. Change both *LocalCoverImages sysprefs to "Show"
3. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=AllowMultipleCovers
4. Change "AllowMultipleCovers" to "Allow"
5. Go to
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
6. Click "Images (0)" tab
7. Download or make two JPEG images
8. Upload the images
9. Go to http://localhost:8080/cgi-bin/koha/opac-imageviewer.pl?biblionumber=29
10. See one large image in the centre and two smaller thumbnails on the right side

PA amended patch: Added missing test plan step

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 27378: DBRev 23.06.00.018
Tomas Cohen Arazi [Tue, 12 Sep 2023 12:37:31 +0000 (09:37 -0300)]
Bug 27378: DBRev 23.06.00.018

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 27378: (QA follow-up) Tidy admin/preferences.pl
Katrin Fischer [Fri, 4 Aug 2023 12:47:04 +0000 (12:47 +0000)]
Bug 27378: (QA follow-up) Tidy admin/preferences.pl

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 27378: Introduce cookie consent to OPAC and staff client
Matt Blenkinsop [Mon, 11 Jan 2021 14:50:17 +0000 (14:50 +0000)]
Bug 27378: Introduce cookie consent to OPAC and staff client

To avoid confusion around commit messages and the content of this enhancement, this first commit is a squashed commit of all the original code submited to this bug. Following a few years of inactivity, it has been rebased and re-submitted with some fixes and concept changes contained in the more recent commits.

Signed-ff-by: Barry Cannon <bc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (follow-up) Add missing filters

(cherry picked from commit 6b8565b949b62269f6d850e6d412458d0dbcfb37)
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Fix accessibility issues

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Update to new atomicupdate structure

This patch consolidates the previous 4 database update files into one atomicupdate file in line with the new structure

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Change ConsentJS to CookieConsentedJS

This patch updates the name of the ConsentJS syspref to CookieConsentedJS and amends the description to be more clear what the syspref is for

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Stop the codemirror editor and delete confirmation from duplicating

Previously, if the "Add new code button" was clicked in the CookieConsentedJS editor, the original entry would have duplicated CodeMirror editors.
This was exponential, i.e adding two new lines would result in three codemirror editors appearing on the first entry, two on the second and so on.
The click event was not being applied properly and was being applied to every element with the .expand-textarea class, rather than specifically the new elements being created. The addExpandHandler function now loops through each element individually and decides whether to apply the click event handler.

Similarly, the delete confirmation was dupliacting for the same reason. This has also been resolved.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Remove two sysprefs and replace with html customisations

Currently there are two sysprefs - CookieConsentBar and CookieConsentPopup. These allow the user to select what text they would like to see in the consent bar and modal. These have been removed and replaced with HTML customisations to allow more flexible customisations and different languages.

Sponsored by: PTFS-Europe

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Small fixes and tidy-ups

This patch does the following:
- Realphabetizes the lines in sysprefs.sql
- Fixes a formatting error in patrons.pref
- Adjusts the position of the cookie consent bar if the language selector is visible
- Fixes translatability on the syspref modal

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Allow staff to view their cookie consents

This patch allows staff to view their cookie consents through a link in the dropdown menu in the navbar. Previously staff had no way of accessing their cookie consents

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Add cancel button to cookie modal

This patch adds a cancel button to the modal for reviewing cookie consents. Previously there was no way to exit without selecting one of the cookie options

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Add filtering for OPAC only and staff only cookies

This patch fixes an issue where cookies selected as OPAC only would still show in the staff client and vise versa. The cookies are now filtered and only the correct cookies will be used in the OPAC and staff client

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Fix tests and character encoding

This patch fixes an encoding issue when using diacritics. It also fixes a failing test, corrects the format of the "Cancel" links in the modal and perltidy has been used on all relevant files

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34079: The phrase "Displaying [all|approved|pending|rejected] terms" was separated
Caroline Cyr La Rose [Wed, 21 Jun 2023 14:59:47 +0000 (10:59 -0400)]
Bug 34079: The phrase "Displaying [all|approved|pending|rejected] terms" was separated

This patch reunites the words for the sentence "Displaying
[all|approved|pending|rejected] terms" in order to facilitate
translating in languages that have a different syntax.

To test:
1. Install a new language

   ./misc/translator/translate install xx-XX

2. Check the xx-XX-staff-prog.po file for the sentence
   --> All the words are individual strings

3. Apply patch

4. Update the po files

   ./misc/translator/translate update xx-XX

5. Check the xx-XX-staff-prog.po file again
   --> The sentence is reunited for each status (Displaying all terms,
       Displaying approved terms, etc.)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34081: Contextualization of "Approved" (one term) vs "Approved" (more than one...
Caroline Cyr La Rose [Wed, 21 Jun 2023 16:27:12 +0000 (12:27 -0400)]
Bug 34081: Contextualization of "Approved" (one term) vs "Approved" (more than one term), and other tag statuses

To test:

1. Apply patch

2. Install language

   ./misc/translator/translate install xx-XX

3. Update po files

   ./misc/translator/translate update xx-XX

4. View the xx-XX-messages.po file

   --> Strings for tag statuses for one tag should be separated from
       strings for statuses for multiple tags, with context Tags
       (single) or Tags (multiple)

5. Change the strings so you know which is which

   For example, in French, the approved status for a single tag would
   be "Approuvé" and for multiple tags would be "Approuvés" (with the
   plural s at the end)

6. Apply translations

   ./misc/translator/translate install xx-XX

7. Add tags through the OPAC
   7.1. In another tab, go to the OPAC
   7.2. Log in
   7.3. Search for a record
   7.4. From the detailed record, click Add tags
   7.5. Enter a tag and click Add

8. In the staff interface, go to Tools > Tags

9. Approve/Reject the tag
   --> The status in the table and on the button should be the singular
       status, the status in the summary on the right should be plural

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34257: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Sun, 3 Sep 2023 23:06:23 +0000 (01:06 +0200)]
Bug 34257: (QA follow-up): tidy up code

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34257: Limit item types by branch in batchMod.pl
Lucas Gass [Fri, 18 Aug 2023 14:45:14 +0000 (14:45 +0000)]
Bug 34257: Limit item types by branch in batchMod.pl

To test:
1. Go to Item types administration.
2. Set some items types to be limited to a branch you are not logged in as.
3. Find some items from the branch you are logged in at and go to Batch item modification.
4. Add the barcodes and attempt to edit the item type to the one you limited in step 2.
5. You can change these item types to ones that your branch should not be able to.
6. Apply patch
7. Try steps 4 -5 again but this time you should not see item types in the dropdown that are limited to other branches.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34402: Sorting holds on patron account includes articles
Owen Leonard [Wed, 26 Jul 2023 12:25:11 +0000 (12:25 +0000)]
Bug 34402: Sorting holds on patron account includes articles

This patch adds some configuration to the table of holds shown on the
checkout and patron detail pages so that sorting by title correctly
excludes articles.

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

- Check out to a patron who has multiple holds on titles which include
  leading articles like "a" "an" and "the."
- Click the holds tab and click the "title" column to sort by title.
  - The titles should be correctly sorted alphabetically while ignoring
    articles.

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34624: (follow-up) Add "for" attribute to serials-search.inc label
Owen Leonard [Fri, 8 Sep 2023 10:56:24 +0000 (10:56 +0000)]
Bug 34624: (follow-up) Add "for" attribute to serials-search.inc label

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34624: (follow-up) fix broken <span>
Victor Grousset/tuxayo [Thu, 7 Sep 2023 03:34:59 +0000 (05:34 +0200)]
Bug 34624: (follow-up) fix broken <span>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34624: Add "for" attribute to label in header search forms which lack it
Owen Leonard [Fri, 25 Aug 2023 17:43:00 +0000 (17:43 +0000)]
Bug 34624: Add "for" attribute to label in header search forms which lack it

This patch adds a "for" label to header search forms labels which lack
it.

To test, apply the patch and test the affected pages to confirm that
clicking the label corresponding to the active search form can be
clicked to move cursor focus to that input field.

As you activate each search form, the cursor focus will automatically be
moved to the input. Click outside of the field to remove the focus, and
then click the label to test that it is correctly tied to the field.

- Staff interface home page:
  - Checkout, Check in, Renew, Search patrons, and Search catalog.
- Acquisitions: Vendor search and orders search
- Acquisitions -> Vendor search -> Vendor -> Contracts: Contract search
- Acquisitions -> Vendor search -> Vendor -> Basket -> Add to basket ->
  From a suggestion: Search suggestions
- Authorities: Main heading ($a only), Main heading, All headings, and
  Entire record.
- Administration -> Budgets: Search funds
- Administration -> Cities & towns: City search
- Administration -> Currencies: Currencies search
- Administration -> Desks: Search desks
  * With UseCirculationDesks enabled
- Administration -> Patron categories: Search patron categories
- Administration -> System preferences: Search system preferences
- Administration -> Z39.50 servers -> Z39.50 server search
- Cataloging: Cataloging search
- E-resource management: Search agreements, Search licenses, Search
  packages, and Search titles
  * With ERMModule enabled
- Patrons -> Search patrons
- Serials: Search subscriptions
- Tools -> Notices & slips: Search notices

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34163: Handle both anonymous userenv when generating CSRF tokens
David Cook [Fri, 30 Jun 2023 02:50:17 +0000 (02:50 +0000)]
Bug 34163: Handle both anonymous userenv when generating CSRF tokens

An anonymous session might have a userenv which is undef or which is
a hashref of undef/empty values.

This patch generates the "anonymous" prefix for undef/empty 'id'
values, which prevents CSRF errors when logging in via OAuth2/OIDC
following a Koha logout.

Test plan:
Before applying patch:
1. Go to https://wiki.koha-community.org/wiki/Testing_SSO
2. Set up OpenID Connect realm, user, client, and Koha
integration to Keycloak for koha-testing-docker as noted in the wiki

3. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl?logout.x=1
4. Click on OIDC "Log in with XXXX" button and log into IDP
5. Note that you're not logged in and you instead see an error message like:
"There was an error authenticating to external identity provider wrong_csrf_token"

6. Apply patch
7. Go to "Sessions" section of the test realm in Keycloak
e.g. http://sso:8082/auth/admin/master/console/#/test/sessions
8. Click "Action" on the far right side of the screen
9. Choose "Sign out all active sessions"

After applying patch:
10. koha-plack --restart kohadev
11. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl?logout.x=1
12. Click on OIDC "Log in with XXXX" button and log into IDP
13. Note that you're logged in

14. prove t/Token.t
15. Note all tests pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34731: (follow-up) Fix conditional variable declaration
Martin Renvoize [Mon, 11 Sep 2023 11:47:48 +0000 (12:47 +0100)]
Bug 34731: (follow-up) Fix conditional variable declaration

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34731: Use Koha::Notice::Message in EnqueueLetter
Kyle M Hall [Thu, 7 Sep 2023 15:40:59 +0000 (11:40 -0400)]
Bug 34731: Use Koha::Notice::Message in EnqueueLetter

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Letters.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34731: Don't call SendQueuedMessages if message_id is bad
Kyle M Hall [Thu, 7 Sep 2023 15:15:25 +0000 (11:15 -0400)]
Bug 34731: Don't call SendQueuedMessages if message_id is bad

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34731: Throw exception if SendQueuedMessages is passed a bad message_id
Kyle M Hall [Thu, 7 Sep 2023 15:04:32 +0000 (11:04 -0400)]
Bug 34731: Throw exception if SendQueuedMessages is passed a bad message_id

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Letters.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34639: Restore order_by
Lari Taskula [Tue, 29 Aug 2023 19:14:56 +0000 (19:14 +0000)]
Bug 34639: Restore order_by

To test:
1. prove t/db_dependent/Koha/Item.t
2. Observe success

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34639: Use coderef for releationship
Nick Clemens [Tue, 29 Aug 2023 12:17:14 +0000 (12:17 +0000)]
Bug 34639: Use coderef for releationship

This patch switches from a simple relationship to a custom join as
illustrated in the DBIx::Class docs

Reference:
https://metacpan.org/pod/DBIx::Class::Relationship::Base#Custom-join-conditions

This does not include an order_by, so I am not sure if it is sufficient

To test:
1 - On command line:
    export DBIC_TRACE=1;
2 - Save simple script:
use Modern::Perl;
use Koha::Items;

my $items = Koha::Items->search( {'me.itemnumber'=>27}, {prefetch => 'current_branchtransfers'} );
my $item = $items->next;

warn $item->_result->current_branchtransfers->count();
warn $item->get_transfer();
3 - run it
4 - Note that the query doesn't include conditions on the transfers
5 - Apply patch
6 - Repeat
7 - Note that query is correct

Test in staf client:
1. Add an item to library A
2. Go to Circulation -> Transfer
3. Transfer the item from library A to another library B
4. Set your currently logged in library to library B
5. Check-in the item
6. Observe message "Item received from A"
7. View the bibliographic record of the item (catalogue/detail.pl)
8. Observe item in "In transit from A to B since xx/xx/xxxx Available"
9. Apply patch
10. Restart all
11. Reload details - item no longer in transit

Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34639: Add tests
Lari Taskula [Tue, 29 Aug 2023 09:34:04 +0000 (09:34 +0000)]
Bug 34639: Add tests

To reproduce:

1. Add an item to library A
2. Go to Circulation -> Transfer
3. Transfer the item from library A to another library B
4. Set your currently logged in library to library B
5. Check-in the item
6. Observe message "Item received from A"
7. View the bibliographic record of the item (catalogue/detail.pl)
8. Observe item in "In transit from A to B since xx/xx/xxxx Available"

To test:
1. prove t/db_dependent/Koha/Item.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34403: Inconsistencies in Currencies and exchange rates page titles, breadcrumbs...
Owen Leonard [Fri, 25 Aug 2023 17:38:56 +0000 (17:38 +0000)]
Bug 34403: Inconsistencies in Currencies and exchange rates page titles, breadcrumbs, and header

This patch updates the currencies administration page in order to make
the page title, breadcrumb navigation, and page headings consistent with
each other.

To test, apply the patch and go to Administration -> Currencies and
exchange rates. Test each variation of the page to confirm that the
title, breadcrumbs, and headings are consistent.

- Currencies main page
- New currency
- Edit currency
- Delete currency confirmation

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34412: (QA follow-up) Terminology updates
Owen Leonard [Fri, 8 Sep 2023 10:42:24 +0000 (10:42 +0000)]
Bug 34412: (QA follow-up) Terminology updates

- Use "system preference" instead of just "preference"
- Use "system_preference" as placeholder in translatable strings

This patch also updates a few places where the placeholder i18n syntax
can be used for consistency.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34412: (follow-up) Clarify page heading, remove unused markup
Owen Leonard [Wed, 6 Sep 2023 10:53:55 +0000 (10:53 +0000)]
Bug 34412: (follow-up) Clarify page heading, remove unused markup

This patch updates the heading for the "modify" view so that it includes
the name of the preference being modified.

The patch also removes markup related to the "add_validate"
state--a view confirming that a preference has been added--because that
view doesn't exist.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34412: Inconsistencies in System preferences page titles, breadcrumbs, and header
Owen Leonard [Tue, 5 Sep 2023 17:58:58 +0000 (17:58 +0000)]
Bug 34412: Inconsistencies in System preferences page titles, breadcrumbs, and header

This patch makes changes to the markup of various areas of the local use
system preferences template in order to make it more consistent with
other pages in Koha.

To test, apply the patch and go to Administration -> System
preferences -> Local use. View each variation of the page to confirm
that breadcrumb navigation, page title, and page headings are consistent
with each other.

- On the main page confirm that the heading is "Local use system
  preferences"
  - New preference:
    - The form on this page has been updated to make the markup
      structure more consistent with other pages, with the heading
      outside the white box of the form.
    - The two portions of the form have been combined into one so that
      the layout of the form is more consistent with similar forms.
 - Edit preference
 - Delete:
   - The deletion confirmation page has been reformatted to use an
     "alert" style dialog with styled confirmation buttons.
   - The "Data deleted" view has been reformatted to use a "message"
     style dialog.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34085: (follow-up) remove typo in Javascript
David Cook [Thu, 24 Aug 2023 06:25:52 +0000 (06:25 +0000)]
Bug 34085: (follow-up) remove typo in Javascript

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34085: Remove the use of event attributes from basket groups template
Owen Leonard [Wed, 21 Jun 2023 17:24:20 +0000 (17:24 +0000)]
Bug 34085: Remove the use of event attributes from basket groups template

This patch removes the use of event attributes (onclick, onsubmit) from
the basket groups template. These events are defined now along with the
other in-page JS.

This change allows us to move the scripts to the bottom of the page.

Unrelated changes: There was no confirmation tied to the process of
deleting a basket group. I've added one. And there were several "MSG_"
variables defined which were unused and have been removed.

To test you should have at least one vendor with at least one basket
group.

- Apply the patch and go to Acquisitions.
- Locate a vendor with an associated basket group.
- Edit a basketgroup
  - Confirm that editing works correctly (leaving "Close basket group"
    unchecked")
  - Confirm that editing works correctly with "Close basket group"
    checked.
- In the list of closed basket groups, confirm that all the controls
  work correctly.
- Create an empty basket group and confirm that clicking the associated
  "Delete" button in the list of basket groups triggers a confirmation,
  "Are you sure you want to delete this basket group?" Test that both
  confirming and cancelling work correctly.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34310: Input prompt in datatables column search boxes untranslatable
Owen Leonard [Thu, 20 Jul 2023 11:24:23 +0000 (11:24 +0000)]
Bug 34310: Input prompt in datatables column search boxes untranslatable

This patch corrects the internationalization function wrapped around the
"% search" string in datatables.js. It should be the double-underscore
function instead of the single-underscore.

To test, apply the patch and test that the placeholder string is
translatable. In this example I'm testing fr-FR:

- Update a translation:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for the strings pulled from
  JavaScript  e.g.  misc/translator/po/fr-FR-messages-js.po
  - Locate strings pulled from prog/js/datatables.js for
    translation, e.g.:

    \#: koha-tmpl/intranet-tmpl/prog/js/datatables.js:894
    \#, javascript-format
    msgid "%s search"
    msgstr "%s recherche"

  - Install the updated translation:

    > perl translate install fr-FR

In the staff interface, test a page that has column header filters, e.g.
patron search. Confirm that the table of search results shows the
translated string in the column header placeholders.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 28995: Update aliases
Martin Renvoize [Mon, 15 Nov 2021 09:35:04 +0000 (09:35 +0000)]
Bug 28995: Update aliases

Add an alias for added-before, added-after (Using an alias makes it
backwards compatible) and update the POD.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 28995: Add `--added_after` filter to writeoff_debts script
Martin Renvoize [Tue, 9 Nov 2021 10:33:01 +0000 (10:33 +0000)]
Bug 28995: Add `--added_after` filter to writeoff_debts script

This adds, as requested, the `added_after` filter option to
writeoff_debts.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34666: Tidy
Nick Clemens [Tue, 5 Sep 2023 14:38:38 +0000 (14:38 +0000)]
Bug 34666: Tidy

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34666: Combine queries in _Findgroupreserve
Nick Clemens [Wed, 30 Aug 2023 18:56:59 +0000 (18:56 +0000)]
Bug 34666: Combine queries in _Findgroupreserve

The queries here are the same except for 2 differences:
1 - They check if the hold was on a particular item
2 - The latter confirms that the reserve item group matches the item's item group

For 1, it doesn't matter - only 1 item can be mapped ot a reserve, itemnumber is the primary key
for hold_fill_targets - so we are either matching it in the first query or the second, either way we get the same
reserve - the returns are the same so we don't care which query it came from

For 2, this has already been checked when the queue was built. We don't need to verify the match because
it wouldn't be in the targets if they didn't match

To test:
1 - Apply second unit test patch
2 - prove t/db_dependent/Reserves.t
3 - It should pass
4 - Apply this patch
5 - prove t/db_dependent/Reserves.t
6 - It continues to pass

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>
9 months agoBug 34666: Add a second unit test for item level
Nick Clemens [Wed, 30 Aug 2023 18:54:15 +0000 (18:54 +0000)]
Bug 34666: Add a second unit test for item level

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>
9 months agoBug 34666: Allow item_group to be null and still match
Nick Clemens [Wed, 30 Aug 2023 18:38:56 +0000 (18:38 +0000)]
Bug 34666: Allow item_group to be null and still match

The current logic requires that the grop ids match, but this eliminates null matches
from the group.

The fallout essentially is that the queue won't be checked to fill holds in cases of title level matches
where holds don't have an item group id. The queue checks the transport cost matrix while the check reserves
check does not, so this may have an impact on holds costs and delivery times

To test:
0 - Apply unit test patch
1 - prove -v t/db_dependent/Reserves.t
2 - It fails
3 - Apply this patch
4 - prove -v t/db_dependent/Reserves.t
5 - It passes!

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>
9 months agoBug 34666: Unit test
Nick Clemens [Wed, 30 Aug 2023 18:29:27 +0000 (18:29 +0000)]
Bug 34666: Unit test

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>
9 months agoBug 34339: (QA follow-up) Replace new by search in Licenses
Marcel de Rooy [Fri, 8 Sep 2023 06:16:44 +0000 (06:16 +0000)]
Bug 34339: (QA follow-up) Replace new by search in Licenses

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34339: Avoid relying on $c->validation - ERM
Jonathan Druart [Fri, 21 Jul 2023 14:35:05 +0000 (16:35 +0200)]
Bug 34339: Avoid relying on $c->validation - ERM

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34339: (bug 33556 follow-up) Easy ERM-related changes
Tomas Cohen Arazi [Thu, 8 Jun 2023 16:27:13 +0000 (13:27 -0300)]
Bug 34339: (bug 33556 follow-up) Easy ERM-related changes

I left the (easy) ERM cases out because it throws this when running the
QA script:

Processing files before patches
|========================>| 51 / 51 (100.00%)

An error occurred : Inconsistent hierarchy during C3 merge of class 'Koha::REST::V1::ERM::EHoldings::Titles::Local':
current merge results [
Koha::REST::V1::ERM::EHoldings::Titles::Local,
]
merging failed on 'Mojolicious::Controller' at /kohadevbox/qa-test-tools/koha-qa.pl line 112.

and didn't want this to pollute the rest of the changes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34038: Fix incorrect use of __() in .tt and .inc files
Owen Leonard [Fri, 16 Jun 2023 14:29:42 +0000 (14:29 +0000)]
Bug 34038: Fix incorrect use of __() in .tt and .inc files

This patch corrects instances of the double-underscore function being
used in .tt and .inc files where the single-underscore function should
be used instead.

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 for JavaScript strings, in this case
  misc/translator/po/fr-FR-staff-prog.po
- Confirm that the strings are now in the .po file for translation. You
  should find these lines:

- koha-tmpl/intranet-tmpl/prog/en/includes/js-biblio-format.inc: "No
  title."
- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt:
  "Check in and add to bundle"
  "Ignore holds and add to bundle"
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt:
  "Please enter only a barcode, or only a biblionumber."
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt:
  "Please enter only barcodes, or only biblionumbers."
- koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt:
  "Please specify a content for 'Default'"

- Check fr-FR-opac-bootstrap.po for these lines:

- koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc:
  "Please enter a valid date (should match %s)."
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:
  "No item was selected"
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt:
  "No item was selected"

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34223: (QA follow-up) Fix file permissions
Tomas Cohen Arazi [Wed, 6 Sep 2023 19:47:09 +0000 (16:47 -0300)]
Bug 34223: (QA follow-up) Fix file permissions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 33480: Tidy tests
Tomas Cohen Arazi [Wed, 6 Sep 2023 18:05:00 +0000 (15:05 -0300)]
Bug 33480: Tidy tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 33480: (QA follow-up) Add cypress tests:
Pedro Amorim [Wed, 6 Sep 2023 15:34:07 +0000 (15:34 +0000)]
Bug 33480: (QA follow-up) Add cypress tests:

Add tests for vendor aliases
Test plan:
perl /kohadevbox/misc4dev/run_tests.pl --run-cypress-tests-only

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 33480: Remove vendors when not needed
Jonathan Druart [Tue, 11 Apr 2023 09:09:16 +0000 (11:09 +0200)]
Bug 33480: Remove vendors when not needed

Several components retrieve the vendor list from store but it's not
needed in those components.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 33480: Improve vendor aliases display in dropdown list
Jonathan Druart [Tue, 11 Apr 2023 09:05:07 +0000 (11:05 +0200)]
Bug 33480: Improve vendor aliases display in dropdown list

On bug 33103 we are adding the ability to filter vendors by aliases.
To make it possible in the ERM module we are adding the alias list in
the dropdown list. However it's not nicely displayed, especially if
there are several entries.

This patch suggests to display the aliases in a different line, and not
for the selected option.

To acchieve that we create a new Vue component FormSelectVendors.

Test plan:
Create several vendors, and add some aliases to them (keep one vendor
without alias)
Go to the ERM module go to the following page, search for vendors by
aliases, save the form, and confirm that everything is nice and works
correctly:
* Add/edit an agreement
* Add/edit a license
* Add/edit a local package
* Add a new package to a title (edit a title)

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34223: (follow-up) Mock backend in tests
Pedro Amorim [Thu, 27 Jul 2023 14:20:11 +0000 (14:20 +0000)]
Bug 34223: (follow-up) Mock backend in tests

Add a new request with a backend specific status

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34223: Add unit test for existing_statuses
Martin Renvoize [Thu, 27 Jul 2023 12:20:13 +0000 (13:20 +0100)]
Bug 34223: Add unit test for existing_statuses

This patch adds a unit test for the 'existing_statuses' method.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34223: (follow-up) Restore status_alias handling
Pedro Amorim [Thu, 27 Jul 2023 11:25:20 +0000 (12:25 +0100)]
Bug 34223: (follow-up) Restore status_alias handling

By reducing the original call to all distinct 'status' we also removed
the status_alias combinations. This patch adds an additional distinct
query to fetch all 'status_alias' and add them to the returned data
structure.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34223: Work around ONLY_FULL_GROUP_BY in Illbackend
Martin Renvoize [Mon, 10 Jul 2023 17:03:34 +0000 (17:03 +0000)]
Bug 34223: Work around ONLY_FULL_GROUP_BY in Illbackend

This patch re-works the query in the existing_statuses method to remove
the FIXME and improve performance.  We pass an SQL literal into the
query to make it explicit which illrequest_id we're looking for (which
dampens the SQL warning) even though we really don't mind which request
is returned here.

Test plan:

The following command will (hopefully) reset your ILL data and create 10k fake ILL requests (run this in DEV KTD only).

1) On an empty k-t-d, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev-data.sh)
2) Pet a cat
3) Visit /cgi-bin/koha/ill/ill-requests.pl and select a backend on the left side filters
4) Notice how the status filter takes a while (3-5 secs) to load
5) Apply patch and koha-plack --restart kohadev
6) Repeat 3, notice how the status filter now loads fast

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34685: Make updatedatabase.pl propagate the error
Jonathan Druart [Fri, 1 Sep 2023 07:10:52 +0000 (09:10 +0200)]
Bug 34685: Make updatedatabase.pl propagate the error

updatedatabase.pl already return 0 even if an error occurred during the upgrade.

Test plan:
Adjust a db rev to make it fail and modify the value of the syspref 'version' in DB to
make the db rev run.

Run updatedabase.pl and `echo $?`

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34684: Prevent 220600007.pl to fail if run twice
Jonathan Druart [Thu, 31 Aug 2023 15:05:57 +0000 (17:05 +0200)]
Bug 34684: Prevent 220600007.pl to fail if run twice

The error is
  ERROR 1292 (22007): Truncated incorrect DECIMAL value: 'no'

Happens on MariaDB 10.5.22, not MySQL 8

Test plan:
update systempreferences set value="0" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "no"

update systempreferences set value="1" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "issueslip"

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>
10 months agoBug 30451: DBIC schema
Tomas Cohen Arazi [Wed, 6 Sep 2023 17:58:28 +0000 (14:58 -0300)]
Bug 30451: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34217: Add vendor tests for licenses
Pedro Amorim [Fri, 25 Aug 2023 10:20:14 +0000 (10:20 +0000)]
Bug 34217: Add vendor tests for licenses

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34217: (QA follow-up) Clean-up old unused code
Pedro Amorim [Thu, 20 Jul 2023 13:49:25 +0000 (13:49 +0000)]
Bug 34217: (QA follow-up) Clean-up old unused code

Spotted this and didn't want to open a new bug for it

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34217: Add vendor tests for agreements
Pedro Amorim [Thu, 6 Jul 2023 10:14:11 +0000 (10:14 +0000)]
Bug 34217: Add vendor tests for agreements

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 23548: (QA follow-up) tidy up code
Victor Grousset/tuxayo [Thu, 31 Aug 2023 21:00:46 +0000 (23:00 +0200)]
Bug 23548: (QA follow-up) tidy up code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 23548: Set AQ to empty when item not exist
Per Larsson [Wed, 18 Sep 2019 08:50:37 +0000 (10:50 +0200)]
Bug 23548: Set AQ to empty when item not exist

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 23548: Unit test - Set AQ to empty when item not exist
Matthias Meusburger [Thu, 17 Aug 2023 12:26:39 +0000 (12:26 +0000)]
Bug 23548: Unit test - Set AQ to empty when item not exist

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34036: Reload 'already received' table when edit modal closed
Aleisha Amohia [Thu, 31 Aug 2023 22:31:36 +0000 (22:31 +0000)]
Bug 34036: Reload 'already received' table when edit modal closed

Bug 33784 introduced a fix that prevents the 'already received' table from reloading completely if the modal is hidden and there is only one order in the table. This appears to assume that the 'hidden modal' event is only triggered if the receive form is cancelled, but the 'hidden modal' event is also triggered when the receive form is submitted. This means that the table isn't redrawn when the form is submitted and there's one order already received, so the next order does not show in the table when the page reloads.

To test:
1. Set up a vendor, budget, fund, and create a new basket.
2. Add two orders (two different records) to this basket.
3. Close the basket and go to receive the orders.
4. Once on the 'Receive orders' page, use the checkboxes in the Pending orders table to receive both orders at once. Choose the 'Receive selected' button
5. Click Edit for the first order, receive the item and click 'Next order'. Receive the next item and click 'Save changes'. Then Confirm
6. Both orders should now show under Already received. Click Cancel receipt for one of the orders. It should go back to Pending orders.
7. Click Receive for the now pending order. Receive the item and Confirm.
8. Notice that the page appears to reload but the order doesn't show under Already received with the other order. The order also no longer shows under Pending orders.

9. Apply the patch and restart services. Reload the page. Cancel receipt of the order again.
10. Click Receive for the now pending order. Receive the item and Confirm.
11. The Already received table should reload so that both orders now show under Already received.
12. Click Cancel receipt for the order.
13. Click Receive for the now pending order, then Cancel without receiving the item.
14. Confirm the page loads as expected with one pending order and one already received order.

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
10 months agoBug 34109: Check mandatory item fields when creating during recipt
Nick Clemens [Fri, 4 Aug 2023 14:13:25 +0000 (14:13 +0000)]
Bug 34109: Check mandatory item fields when creating during recipt

This patch adds a check of mandatory item fields before saving during order receipt.
We check both when adding the item initially, and when submitting the order, as it will use
the values from the open form.

To test:
* Go to administration > frameworks > ACQ > MARC structure > 952
* Set callnumber (o) or barcode (p) to mandatory
* In acquisition:
* Create a basket with "create items on order" and "is standing"
  "standing" helps as you can do multiple receives testing different things,
  but is optional
* Add an order line
* Receive shipment
* Verify the mandatory fields show in the item form
* Set itemtype = Music
* Save with the fields blank
* Item row is added, no warning
* Edit the item, change the item type to blank
* Click 'Confirm' for the order without closing the item edit form
* Verify the item was added with itemtype Books (on sample data) and empty mandatory field
* Apply patch
* Repeat above, however, you should not be able to submit the item or order until mandatory fields are filled

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>