koha.git
7 months agoBug 32379: Add check on existing item
Marcel de Rooy [Thu, 2 Nov 2023 10:47:50 +0000 (10:47 +0000)]
Bug 32379: Add check on existing item

Simplest fix; bail out with output_error.

Test plan:
Try /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1&op=saveitem&itemnumber=999999
Note: Replace 1 by existing biblionumber, and iitem 999999 should not exist.
You should get the 404 screen now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
(cherry picked from commit 0677a53e1445342ac4927a1177100f69e4f02271)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35190: DBIC schema
Tomas Cohen Arazi [Fri, 3 Nov 2023 17:19:52 +0000 (14:19 -0300)]
Bug 35190: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cfc63f77bbeb10f3b80c706361ffabed041853ef)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35190: DBRev 23.06.00.062
Tomas Cohen Arazi [Fri, 3 Nov 2023 17:18:17 +0000 (14:18 -0300)]
Bug 35190: DBRev 23.06.00.062

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2a0410a70146a6d2bc223300255262bc6190eb7c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35190: Adjust UI handling to avoid inserting an empty string
Emily Lamancusa [Mon, 30 Oct 2023 17:19:02 +0000 (13:19 -0400)]
Bug 35190: Adjust UI handling to avoid inserting an empty string

To test:
1. In the Administration module, create an Additional Field that is
   not linked to an authorized value
2. Create another Additional Field that is linked to an authorized
   value
3. Access the database in the command line (koha-mysql kohadev)
4. Select all from additional_fields
5. Confirm that each field correctly lists either the appropriate
   authorized value, or NULL

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 97c09f1d3cf58500bf7b0f06446592fb77f6570f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35190: Adjust tests
Emily Lamancusa [Mon, 30 Oct 2023 16:07:28 +0000 (12:07 -0400)]
Bug 35190: Adjust tests

Test plan:
prove t/db_dependent/Koha/AdditionalField.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a3be301e628d63e3fc71bcd709f90756f0b9aab8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35190: Set default NULL for authorised_value_category in additional_fields table
Emily Lamancusa [Mon, 30 Oct 2023 15:31:31 +0000 (11:31 -0400)]
Bug 35190: Set default NULL for authorised_value_category in additional_fields table

To test:
1. Start KTD without this patch
2. In the Administration module, create an Additional Field with
   Authorized Value set to None
3. Create another Additional Field with Authorized Value set to an
   existing authorized value
4. Apply patch and updatedatabase
5. Access the database in the command line with koha-mysql kohadev
6. Select all rows from additional_fields
7. Confirm that the two Additional Fields from earlier have values of
   NULL and the correct authorized value, respectively, in their
   authorised_value_category fields.
8. reset_all to test new install
9. Access the database in the command line
10. Show the table structure for additional_fields and confirm that
    default for authorised_value_category is NULL

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 40414f9c694f3d044f81662c6d9df9c6ca19e2fc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 30024: Make link_bibs_to_authorities.pl rely on LinkerRelink
Tomas Cohen Arazi [Tue, 27 Sep 2022 19:10:51 +0000 (16:10 -0300)]
Bug 30024: Make link_bibs_to_authorities.pl rely on LinkerRelink

This patch makes the trivial change of making the linker script rely on
LinkerRelink instead of CatalogModuleRelink, which is confusing and
incorrect (according to both sysprefs descriptions).

To test:
1. Verify that relinking is now tied to the right syspref

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4310e13a6416d680e825621278859e3b91b1942a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35242: Force memcache restart after koha upgrade
Mason James [Thu, 2 Nov 2023 22:56:51 +0000 (11:56 +1300)]
Bug 35242: Force memcache restart after koha upgrade

to test..

1/ install koha-common
    $ sudo apt install koha-common

2/ start memcached, check PID
    $ sudo service memcached start
    $ sudo systemctl status  memcached | grep PID
        Main PID: 52851 (memcached)

3/ build and install new koha-common package (will trigger a restart)
    $ sudo apt install ./koha-common-git+deadbeef.deb

5/ check that memcache is started, and has new PID (52900)
    $ sudo systemctl status  memcached | grep PID
        Main PID: 52900 (memcached)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1fa096e7a03ad7d42ca5f4de12d873ea1b8a4bce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35004: Set row.quantity_received to 1 if row.quantity_received is empty and we...
Slava Shishkin [Fri, 6 Oct 2023 16:25:30 +0000 (19:25 +0300)]
Bug 35004: Set row.quantity_received to 1 if row.quantity_received is empty and we're in 'cataloguing' mode

Before the code changes only field value was set to 1,
but "row.quantity_received" still had an undefined value.
After correction row.quantity_received set to 1 if it is empty,
but only when effective_create_items == 'cataloguing',
and after that its value assigned to the form field.

To test:
1. Add a new basket.
2. Create an order line
3. Receive shipment and create an invoice
4. Start receiving your order:
    Verify:
    - Quantity ordered: X
    - Quantity received: 1 (pre-filled, don't touch or change it)
5. Click "Confirm"
6. Observe the Receive error popup: "Order ZZZ: No quantity to receive
   set. No items will be created."
7. Verify that "Order receive" was not happen (received orders remains
   empty)
8. Apply the patch and make sure your order is received correctly after
   step 5.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9110547de098264e2574e27f35859674f1ed18a2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35073: perltidy subscription-batchedit.pl
Pedro Amorim [Tue, 17 Oct 2023 09:24:09 +0000 (09:24 +0000)]
Bug 35073: perltidy subscription-batchedit.pl

git show -w <this_patch_hash>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ffb5022591f6b96c50bf8a9c0409bd01b108a65c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35073: Default to existing value if there is one
Pedro Amorim [Tue, 17 Oct 2023 09:20:59 +0000 (09:20 +0000)]
Bug 35073: Default to existing value if there is one

For values that dont exist in the batch edit submission, i.e. UI says 'No change', we default to existing value if there is one.

Test plan:
Preparation - Additional fields:
1) Add a new 'additional field', visit:
/cgi-bin/koha/admin/additional-fields.pl
2) Click 'subscription' and '+ New field'. Enter a 'name' and hit 'save'.

Serials:
1) Add a new serial, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Put a biblionumber in the 'record' field, i.e. '112'. Press 'next' and click 'ok' on the alert box
3) Fill all the required fields and click 'test prediction'
4) Input something in the additional field created previously.
5) Click 'save subscription'. Notice the additional field is as expected.
6) Repeat steps 1-5 to create a second serial.

Batch edit:
1) Visit serials and hit the 'Search' button:
/cgi-bin/koha/serials/serials-home.pl
2) Click the 2 checkboxes for the 2 serials we created previously and click the new link that pops up 'edit selected serials'.
3) Click 'Save' without changing anything.
4) Go back to either of the serials, notice the value for the additional field is unchanged. Visit:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=1

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7294908de35a46f491af4e170fb9f6294a5fb4bf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35073: Rename additional_fields to available_additional_fields
Pedro Amorim [Tue, 17 Oct 2023 09:18:29 +0000 (09:18 +0000)]
Bug 35073: Rename additional_fields to available_additional_fields

'additional_fields' is ambiguous and in other places we name this available_additional_fields instead. Do the same here.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 05d131febf2d98d1c0ec18da845589dcd80a5e8d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35185: Remove is_html flag from sample notices that are plain text
Katrin Fischer [Sun, 29 Oct 2023 15:20:03 +0000 (15:20 +0000)]
Bug 35185: Remove is_html flag from sample notices that are plain text

Some notices had the is_html flag for new installations, but actually
didn't include any HTML formatting. These should be plain text
to have the line breaks behave as expected.

This updates:
* 2FA_OTP_TOKEN
* OPAC_REG_VERIFY

We cannot do a database update here, as libraries will
have changed and updated these. So this is only for new
installations.

To test:
* Apply patch
* reset_all (create a new sample database)
* Verify that the HTML checkbox is not set for these notices
* Verify they appear as plain text notices, not including HTML tags

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>
(cherry picked from commit c6284eed812eb4de52738e845b662e199f58fd1a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 24480: (follow-up) Adjust tests
Nick Clemens [Fri, 15 Sep 2023 20:06:41 +0000 (20:06 +0000)]
Bug 24480: (follow-up) Adjust tests

With the way the patchset alters to use insert_fields_ordered, we now add fields to the beginning of their number group as opposed to appending before. We just need ot shift the order we expect the fields to end up in to make the tests pass

To test:
1 - Apply all patches except this
2 - prove -v t/SimpleMARC.t t/db_dependent/MarcModificationTemplates.t
3 - It fails
4 - Apply this
5 - prove -v t/SimpleMARC.t t/db_dependent/MarcModificationTemplates.t
6 - It passes

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>
(cherry picked from commit eeffa57eab1a693fe8c91990a987e12b61962e80)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 24480: (follow-up) Shift new fields into array and add after all are copied
Nick Clemens [Fri, 15 Sep 2023 19:59:57 +0000 (19:59 +0000)]
Bug 24480: (follow-up) Shift new fields into array and add after all are copied

The updated code removed the pushing of fields to an array - this caused a bug.
When multiple fields were copied and replaced and there were more fields added than existed originally we were adding the new field to the end, then removing the first occurence of the original field. If we tried to move 2 650 fields to 651 and the record had no 651 we would:
- Delete the first 651, there were none, so nothing happened
- Take the first 650, add it to the end of the 651 group (there were none, so it became the first 651)
- Delete the first 651, which was the field we just copied
- Take the second 650 and add it to the end of the 651 group (whihc had none, because we deleted it)

I re-add the line, but do as suggesed by Phil and reverse the order (unshift vs push)

To test:
1 - Apply other patches
2 - prove -v t/SimpleMARC.t
3 - It fails
4 - Apply this patch
5 - prove -v t/SimpleMARC.t
6 - It still fails, but more tests pass (there's another patch to follow)

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>
(cherry picked from commit 498f0dfeccacb38fbc0b3ccbc6c47e769f7f8518)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 24480: Unit test
Arthur Suzuki [Sat, 25 Jan 2020 22:19:52 +0000 (23:19 +0100)]
Bug 24480: Unit test

This updates the SimpleMARC tests and MarcModificationTemplates
tests to expect the new order of fields

Signed-off-by: Kelly <kelly@bywatersolutions.com>
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>
(cherry picked from commit 48fd8d1900f23d33c2e7aa5f3a9f10c21cafdb54)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 24480: Fix insert_fields_ordered instead of append_fields in SimpleMARC
Arthur Suzuki [Fri, 17 Jan 2020 09:26:58 +0000 (10:26 +0100)]
Bug 24480: Fix insert_fields_ordered instead of append_fields in SimpleMARC

Test plan :
 - create a marc modification template which add a new field to a record
 - apply that template to some records
 - verify that the new field is always appended at the bottom of the record, even if some fields are higher.
 - apply patch
 - apply template to another set of records
 - verify the added field is now ordered within the already existing fields in the records

Signed-off-by: Kelly <kelly@bywatersolutions.com>
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>
(cherry picked from commit d3112dc3191a82e6cc6072394bd8d6035f66e15c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35079: Replace --force-extract by --generate-pot={always,auto,never}
Julian Maurice [Tue, 17 Oct 2023 15:13:55 +0000 (17:13 +0200)]
Bug 35079: Replace --force-extract by --generate-pot={always,auto,never}

This restores the original behaviour of always building the POT file
in order to not break existing workflows
Option --force-extract is deleted in favor of a new option
--generate-pot that can have 3 values:

* always: always build the POT file. This is the default value
* auto: build the POT file only if it does not exist
* never: never build the POT file

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
7 months agoBug 35079: Rebuild POT files only if necessary or asked explicitely
Julian Maurice [Tue, 17 Oct 2023 14:33:37 +0000 (16:33 +0200)]
Bug 35079: Rebuild POT files only if necessary or asked explicitely

By default, gulp tasks po:create and po:update won't rebuild the POT
files if they already exist.
Both tasks gained a new option --force-extract to rebuild them
unconditionally

This makes it possible to create/update PO files for multiple languages
sequentially without rebuilding the POT file for each language.
For instance:

    gulp po:update --lang fr-FR
    # do something with the PO files
    gulp po:update --lang en-GB
    # ...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
7 months agoBug 35043: Do not have \n or \t appear in PO files
Jonathan Druart [Thu, 12 Oct 2023 10:35:12 +0000 (12:35 +0200)]
Bug 35043: Do not have \n or \t appear in PO files

This is a trick, so that we won't have to deal with \t in PO files.
\n is not a problem, but it seems consistent to use the same method for
both.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
7 months agoBug 35043: Use Locale::PO->quote
Jonathan Druart [Thu, 12 Oct 2023 09:44:16 +0000 (11:44 +0200)]
Bug 35043: Use Locale::PO->quote

We have our own "quote_po" sub that is stating that Locale::PO::quote
is buggy because it does not deal with quoting new lines correctly.
However it seems that it is fixed now.

Ideally we could use Locale::PO::quote everywhere, but it does not
escape tab characters:
  $string =~ s/\\(?!t)/\\\\/g;           # \t is a tab

This means the following:
msgid "Tabulation (\\t)"
msgstr "Tabulation (\\t)"
become:
-msgid "Tabulation (\t)"
-msgstr "Tabulation (\t)"

And we are seeing the following on Weblate:
https://snipboard.io/BjQmDC.jpg

Note that Locale::PO has not been updated since 2014...

The real problem behind this is that we have 2 methods to quote strings.
At first glance it seems that Locale::PO::quote was not used before, but
with the introduction of the koha-i18n project we will have scripts that
will use Locale::PO->save_file_fromarray, which uses Locale::PO->quote
=> Those scripts will be used on the translation server for post
processing (security reason, marking potential XSS strings as fuzzy).

Test plan:
0. Do not apply the patch
1. gulp po:update --lang LANG # Replace LANG with your favorite language
   code
2. git commit -a -m"init PO files"
3. Apply this patch
4. Repeate 1.
5. git diff
   => The change is about the "Tabulation" and "New line" strings from
      tools/csv-profiles.tt
6. Translate them (replace the \t and \n with %s) and remove the fuzzy
   flag
7. install the template: cd misc/translator && perl translate install
   LANG
8. Enable the language, use it and go to the "Nouveau profil CSV" view
   => Notice that the \t and \n are correctly displayed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
7 months agoBug 35024: Do not wrap translations
Jonathan Druart [Wed, 11 Oct 2023 09:35:41 +0000 (11:35 +0200)]
Bug 35024: Do not wrap translations

PO files wrap differently depending on versions.

Looks like (thanks Julian!) it's coming from libunistring, between 0.9.10 and 1.0 I am seeing a change in how the strings in the PO files are wrapped.

Debian 11 (using libunistring 0.9):
"%s %sPrintemps%s %s %sÉté%s %s %sAutomne%s %s %sHiver%s %s %sPrtps%s %s %sÉté"
"%s %s %sAut%s %s %sHiv%s %s %s %s"

Debian 12, Ubuntu 22.04(using libunistring 1.0)
"%s %sPrintemps%s %s %sÉté%s %s %sAutomne%s %s %sHiver%s %s %sPrtps%s %s "
"%sÉté%s %s %sAut%s %s %sHiv%s %s %s %s"

It *could* come from this changes:
https://git.savannah.gnu.org/gitweb/?p=libunistring.git;a=blob;f=NEWS;h=5a43ddd7011d62a952733f6c0b7ad52aa4f385c7;hb=HEAD
   * The functions u*_possible_linebreaks and u*_width_linebreaks now make it
     easier to work with strings that contain CR-LF sequences: In this case,
     in the returned array, it will return UC_BREAK_CR_BEFORE_LF followed by
     UC_BREAK_MANDATORY (instead of twice UC_BREAK_MANDATORY).

The command used is:
% msgmerge --backup=off --quiet -F --update misc/translator/po/fr-FR-staff-prog.po misc/translator/Koha-staff-prog.pot

No matter the value of --width.

One solution is to use --no-wrap, and never wrap :)

I sent an email to the list about this suggestion https://lists.katipo.co.nz/pipermail/koha/2023-October/060143.html

Test plan:
% gulp po:update --lang LANG

And notice that the lines are no wrapped anymore.

Note that in master there were already not wrapped (?)
commit edd378f4d14d79107d662b053c8e6f750326dd23
Translation updates for Koha 23.05.00

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
7 months agoBug 34959: Sort PO files correctly
Jonathan Druart [Fri, 6 Oct 2023 14:48:57 +0000 (16:48 +0200)]
Bug 34959: Sort PO files correctly

The PO files are not sorted when we update them which leads to
unnecessary changes that are commited: hard to see differences and
make git index grow superfluously.

Test plan:
0. Do not apply this patch
1. gulp po:update --lang es-ES
2. git commit -a -m"First PO update"
3. Run again the gulp update command
4. git diff
=> You have a lot of changes generated here, the po:update is not
idempotent.

5. Apply this patch
6. Run the gulp update command
7 git commit -a -m"PO update after 34959"
8. Run the gulp update command
9. git diff
=> No changes are generated

Note that this patch will all the entries by files, and per line
numbers.
It fixes a bug in some condition, where we add information/context about
the string. For instance search for "For the first occurrence" in the
file. Prior to this patch this was not correct, we didn't add info about
the first occurrence (but whichever in the list).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 months agoBug 34959: Remove unused sub
Jonathan Druart [Fri, 6 Oct 2023 15:17:51 +0000 (17:17 +0200)]
Bug 34959: Remove unused sub

Nothing special here, this sub is not used and we can remove it.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 months agoBug 35171: (QA follow-up): tidy up POD
Victor Grousset/tuxayo [Mon, 30 Oct 2023 19:58:21 +0000 (20:58 +0100)]
Bug 35171: (QA follow-up): tidy up POD

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1e53f48efecfdd05db6acc31083ee2590f278f1d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35171: Add send_empty option to runreport
Nick Clemens [Thu, 26 Oct 2023 18:03:40 +0000 (18:03 +0000)]
Bug 35171: Add send_empty option to runreport

This patch adds a new 'send_empty' option to runreport.pl

To test:
1 - Create a report in Koha that will not return any results:
    SELECT barcode FROM items WHERE 1=2
2 - perl misc/cronjobs/runreport.pl 1
3 - Output is: NO OUTPUT: 0 results from execute_query
4 - perl misc/cronjobs/runreport.pl 1 --send_empty
5 - Output is: no results were returned for the report
6 - perl misc/cronjobs/runreport.pl 1 --send_empty --email
7 - It will die on an email error unless you have SMTP configured - this si good, it means we sent an email
8 - Bonus points: Test on a system that can correctly send emails, confirm it works :-)

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>
(cherry picked from commit 4bfd1e21c6ff2415c8e36ec2e376ca1c1330fbb2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34008: Harmonize attribute names
Tomas Cohen Arazi [Mon, 30 Oct 2023 16:14:16 +0000 (13:14 -0300)]
Bug 34008: Harmonize attribute names

This patch harmonizes the attribute names with what is used for `items`
and `checkouts` in terms of terminology.

It also adapts the tests so they are less random failure-prone (they had
a fixed value for the item type, which might make things explode if the
chosen value already exists on the DB.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 78589dbe6ecf1a4126b0420894a732bd58a9752a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34008: (QA follow-up) 'item_type_id' should be used
Tomas Cohen Arazi [Mon, 30 Oct 2023 14:08:15 +0000 (11:08 -0300)]
Bug 34008: (QA follow-up) 'item_type_id' should be used

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 05f0604d609c180070207f5608b256639e2e2ccb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34008: Add REST endpoint for list of itemtypes
Andreas Jonsson [Sat, 16 Sep 2023 10:13:15 +0000 (10:13 +0000)]
Bug 34008: Add REST endpoint for list of itemtypes

Test plan:
* Enable the system preference RESTBasicAuth
* curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes
  should give 401 Unauthorized
* curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes
  should produce JSON-list of itemtypes
* curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes
  should include the field translated_descriptions containing the translated descriptions, if any

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] perltidy -b t/db_dependent/api/v1/itemtypes.t # Resolve bad score of 44
[EDIT] chmod 755 t/db_dependent/api/v1/itemtypes.t
[EDIT] perltidy -b Koha/REST/V1/ItemTypes.pm
Lesson: Please run qa tools yourself and adjust accordingly?
Edit (tcohen): I restored the item_type_translated_description.yaml file
as the entire API was broken because of the lack of it.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 82bdf93ab71f4d16ced622667ef89bafb5008d1e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35033: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Mon, 30 Oct 2023 17:58:09 +0000 (18:58 +0100)]
Bug 35033: (QA follow-up): tidy up code

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0a8303c9fac42e16d4ff5c13dd700789d4a438c3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35033: Add a validation for biblioitems in about/system information
Blou [Wed, 11 Oct 2023 15:57:28 +0000 (11:57 -0400)]
Bug 35033: Add a validation for biblioitems in about/system information

In the About section, under the System information tab, we get validation between
issues, borrowers, biblio, items, reserves tables, and their deleted/old counterpart.

But there's no validation for biblioitems.

This patch will simply add the same test (and display) as the others, but for biblioitems.

Testing
0) Create a simple biblio entry through cataloguing. Note the biblioitemnumber created.
1) Insert a dummy entry in deletedbiblioitem using the biblioitemnumber.  An simple SQL will do
insert into deletedbiblioitems select * from biblioitems where biblioitemnumber = GIVENbin;
2) Go to about, see there's no warning in systeminformation.
3) apply the patch, validate that an error appears.

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>
(cherry picked from commit 07ac0b1f72245de6e8ecf2a1a9d2e485ca233f79)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34424: Add Emily Lamancusa to QA Team
Katrin Fischer [Sun, 29 Oct 2023 14:36:38 +0000 (14:36 +0000)]
Bug 34424: Add Emily Lamancusa to QA Team

Long overdue.

To test:
* Apply patch
* Verify that Emily shows as part on the QA Team
  on the About page

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e42d5c6e6f5a8d5c958a3dad5583490a550ce862)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35180: DBIC schema
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:26:00 +0000 (15:26 -0300)]
Bug 35180: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3f1e21bbca753168e194f0d4f23f9c84ebadeeaf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35180: Fix 246 to 264 in COMMENT of deletedbiblioitems.publishercode
Katrin Fischer [Sun, 29 Oct 2023 09:31:06 +0000 (09:31 +0000)]
Bug 35180: Fix 246 to 264 in COMMENT of deletedbiblioitems.publishercode

This fixes a typo in the comment.

To test:
* Please check diff of the patch closely.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f5d0667f5a1eb6898c14a5cefddfe9c21609762d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35186: Remove unnecessary html tags from PASSWORD notices
Katrin Fischer [Sun, 29 Oct 2023 15:42:36 +0000 (15:42 +0000)]
Bug 35186: Remove unnecessary html tags from PASSWORD notices

In HTML notices we don't need to explicitly use <html></html>.

This removes them from the 2 notices using them:
* PASSWORD_RESET
* STAFF_PASSWORD_RESET

To test:
* Apply patch
* Make sure your Koha can send email (set up SMTP server, KohaAdminLibraryAddress)
* Make sure your patron has an email set
* In patron account, use "More > Send password reset"
* Log out
* In the OPAC, request password reset ("forgot your password?")
* Verify both notices appear nicely formatted (line breaks, bold, etc.)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e772b96cacb509a54a52427262da03efd4e38015)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 29811: Add timestamp option on authority record type
Thibaud Guillot [Thu, 6 Jan 2022 13:48:36 +0000 (14:48 +0100)]
Bug 29811: Add timestamp option on authority record type

According to the timestamp option for bibs record type I added the
timestamp option for authority records.
Timestamp is already present in database on field "modification_time"

Test Plan :
1 - Be sure to have authority record type for easiest test create one
2 - Execute script export_records.pl in your koha/misc directory and
choose a date (example yesterday if you just created an authority
right now).(see export_records.pl -h for help)
3 - Timestamp option has no effect on authority record type
4 - Execute script again but choose the date of tomorrow for example
5 - Same result
6 - Apply this patch
7 - Play again steps 2 and 4
8 - On step 2 you will see only your authorities created today (because
script show you authority has changes since the date you choose in
option) and for step 4 you must see an empty file.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 24ee60cb62cfbe5dc80bbb698eb6fa1e99d1cd4e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 22712: Make 'Show inactive funds' button on addorderiso2907.pl work for item...
Nick Clemens [Mon, 23 Oct 2023 19:56:21 +0000 (19:56 +0000)]
Bug 22712: Make 'Show inactive funds' button on addorderiso2907.pl work for item budgets

This requires enabling MarcItemFieldsToOrder, see bug 34645

Add an inactive Budget and some funds to your system

Import a file with multiple biblios

Confirm the button hids/displays the funds for all item orders

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 60ed1898a09b638ddbf16c5b0054348cd3967832)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 31393: Tidy
Tomas Cohen Arazi [Mon, 30 Oct 2023 12:00:31 +0000 (09:00 -0300)]
Bug 31393: Tidy

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f1bbdee7ac8a49a5ba85686d8a0edb59efecc8ba)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 31393: Koha::Config: handle the special case for 'content' attribute
Julian Maurice [Mon, 26 Jun 2023 13:25:12 +0000 (15:25 +0200)]
Bug 31393: Koha::Config: handle the special case for 'content' attribute

<key content="value"></key>

was wrongly parsed as

{ key => 'value' }

whereas it should be

{ key => { content => 'value' } }

The 'content' attribute is used in shibboleth config

Test plan:
1 Run `prove t/Koha/Config.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>
(cherry picked from commit 6973625e7a06e66ee731ea8f5b69f296943c580f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 32312: Add missing column descriptions to the statistics table
David Nind [Sun, 4 Dec 2022 01:33:32 +0000 (01:33 +0000)]
Bug 32312: Add missing column descriptions to the statistics table

This adds missing descriptions to the existing statistics database
columns.

It also improves some existing descriptions.

1. Go to Reports > Guided reports > Create guided report.
2. Choose 'Circulation' for the module to report on and select
   'Next'.
3. Choose 'Tabular' for the type of report and select 'Next'.
4. Scroll down to the statistics table section and note that there
   are no descriptions for:
   - statistics.other
   - statistics.location
   - statistics.ccode
   - statistics.categorycode
5. Note that:
   - the description for statistics.type is 'Type'
   - the description for statistics.itemtype is 'Item type'
6. Apply the patch.
7. Restart all the things (restart_all).
8. Reload the page.
9. Note that:
   . there are now descriptions for the columns in step 4
   . the description for statistics.type is now 'Transaction type'
     (to more clearly indicate what it contains)
   . the description for statistics.itemtype is now 'Koha item type'
     (consistent with other tables where this is used, such as items)
10. Sign off :D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b0a8372c2f5eec6dd1671c0557bb82e3a71436db)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35147: (QA follow-up) Capitalzation: Shibboleth Login
Katrin Fischer [Sat, 28 Oct 2023 22:44:56 +0000 (22:44 +0000)]
Bug 35147: (QA follow-up) Capitalzation: Shibboleth Login

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9cea8312a5e2444ed142e44e2ca5041ba7373b7b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35147: Add classes to Shibboleth text on OPAC login page
Aleisha Amohia [Wed, 25 Oct 2023 00:40:26 +0000 (00:40 +0000)]
Bug 35147: Add classes to Shibboleth text on OPAC login page

This enhancement makes it easier for libraries to change the Shibboleth-related messages on the OPAC login page.

Libraries can employ OPACUserJS to change the text. For e.g., I can replace the message "If you do not have a Shibboleth account, but you do have a local login, then you may login below." by putting the following in OPACUserJS:

$(".shib_local_text").text("If you do not have a staff member account, but are a member of the library, then you may log in below.");

To test:

1. Go to <your-opac-url>/cgi-bin/koha/opac-user.pl , or disable the OpacPublic system preference. Ensure you are logged out of the OPAC.
2. In the staff interface, search for the OPACUserJS system preference under Koha Administration. Add the following JS and Save:

$(".shib_invalid").text("Test changing the invalid Shibboleth login message.");
$(".shib_title").text("Test changing the Shibboleth login heading.");
$(".shib_url").text("Test changing the Shibboleth account link text.");
$(".shib_local_title").text("Test changing the local login heading.");
$(".shib_local_text").text("Test changing the message that shows if you do not have a Shibboleth account.");

3. Refresh the OPAC and confirm the text changes to reflect your JS. Note: The invalid Shibboleth login will be a bit harder to test, so if you can't test, confirm the HTML in the patch looks correct.

Sponsored-by: New Zealand Council for Educational Research
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 184299c9c84ee35cdd31149214710778648729ad)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 32853: Fix cataloguing/value_builder/unimarc_field_125.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:53 +0000 (11:58 +0100)]
Bug 32853: Fix cataloguing/value_builder/unimarc_field_125.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 826aeaf22f36fb3ebacafdacf7c270cc72d8c5fe)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 32856: Fix cataloguing/value_builder/unimarc_field_126.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:53 +0000 (11:58 +0100)]
Bug 32856: Fix cataloguing/value_builder/unimarc_field_126.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4fa7d59c61b524238b2e30f383ccda44e61e1096)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35173: Correctly concat error strings
Martin Renvoize [Fri, 27 Oct 2023 10:48:07 +0000 (11:48 +0100)]
Bug 35173: Correctly concat error strings

This patch moves the call to $sftp->error outside of the double quote
string and into a . concat to properly expose the error message as
apposed to outputting 'Net::SFTP::Foreign=HASH(0x559c9118f0c8)->error'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 43bd124f873ac118a9f87a5b5160ee99dc8b8a47)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35003: Make cancelled hold requests filter by branch
Lucas Gass [Fri, 6 Oct 2023 15:15:39 +0000 (15:15 +0000)]
Bug 35003: Make cancelled hold requests filter by branch

To recreate:
1. Make sure you have the "Default waiting hold cancellation policy" set to allow via circulation rules.
2. Make several holds at different branches  holds and set them to waiting
3. Request to cancel those holds, making sure you cancel some for different branches.
4. Go to waitingreserves.tt and notice that you see all of the holds from all branches.
5. APPLY PATCH and restart services
6. Vist the waitingreserves.tt page and notice that the "Holds with cancellation requests" table can now filters by branch.
7. Use the "View all libraries" and make sure you can see all the holds with a cancellation request.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 67f4fcc204c11998f9110d8ed723fa826c62a5ce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35141: (QA follow-up) Increment the bad count
Marcel de Rooy [Fri, 27 Oct 2023 07:21:03 +0000 (07:21 +0000)]
Bug 35141: (QA follow-up) Increment the bad count

Also move earlier print to warn for consistency.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 3439185bb0b901e5a902cc8887fa07526f33ea55)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35141: Prevent link_bibs_to_authorities from dying on invalid metadata
Nick Clemens [Tue, 24 Oct 2023 12:01:09 +0000 (12:01 +0000)]
Bug 35141: Prevent link_bibs_to_authorities from dying on invalid metadata

When fetching the record we need to eval in case of exception

To test:
1 - Apply first patch
2 - perl misc/link_bibs_to_authorities.pl
3 - Note it dies on parser error at record 369
4 - Apply this patch
5 - perl misc/link_bibs_to_authorities.pl
6 - The process completes - with warning thrown on record 369

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 706641e747336eeb341172ed3d794d86551a45a9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35141: Catch ES search exceptions in link_bibs_to_authorities, warn, and continue
Nick Clemens [Tue, 24 Oct 2023 11:51:29 +0000 (11:51 +0000)]
Bug 35141: Catch ES search exceptions in link_bibs_to_authorities, warn, and continue

This patch simplay adds an eval and a warning to link_bibs_to_authorities to catch any errors while searching and continue linking.

To test:
1 - edit /etc/kohia/sites/kohadev/koha-conf.xml and add to elasticsearch stanza
    <request_timeout>0</request_timeout>
2 - perl misc/link_bibs_to_authorities.pl
3 - It dies immediately
4 - Apply patch
5 - perl misc/link_bibs_to_authorities.pl
6 - Now it tries every record, throwing warnings along the way, but completes

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 22c0be31c73249fa534afb209f2a0229f84b7568)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34678: Allow new entries to overwrite hold_fill_targets
Nick Clemens [Wed, 13 Sep 2023 17:03:32 +0000 (17:03 +0000)]
Bug 34678: Allow new entries to overwrite hold_fill_targets

When using background jobs, there is a possibility of a race condition where two jobs will be updating the holds queue for the same biblio. We should try to minimize those cases (see bug 34596)

In the meantime though, we should prevent jobs possibly dying, and allow the most recent update to succeed.

There is a possibility two updates wil assign different items to the same reserve, and that a reserve could end up in the queue twice, however, whichever one is filled first will delete both entries. as filling the hold deletes by reserve id (see bug 24359)

This patch adds a transaction to delete and then inset the new row

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

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit bbeab36789d8dd020bc5395d76c54cc2910caf49)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34678: Unit test
Nick Clemens [Wed, 13 Sep 2023 17:01:09 +0000 (17:01 +0000)]
Bug 34678: Unit test

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit dfad12d0790e38e739c610dd2a5f2345a053ed52)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33662: Add link to acq advanced search to acq navigation
Katrin Fischer [Fri, 15 Sep 2023 15:11:21 +0000 (15:11 +0000)]
Bug 33662: Add link to acq advanced search to acq navigation

Right now 3 clicks are needed to open the advanced search page
in the acquisitions module.

This adds a link to the advanced search to the left hand
module navigation.

To test:
* Go to acquisitions
* Verify the way is long to advanced search:
  At the top: Orders search > config icon > advanced search link
* Apply patch
* Notice new 'Order search' link on the left
* Verify it's way shorter now :)

Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
  Renamed link from 'Advanced search' to 'Order search'
  Adjusted test plan

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 67930244ad5dc4e65e9e040b38d0080cb80b23b9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33810: Opac advanced search fields need aria-labels
Matt Blenkinsop [Tue, 23 May 2023 14:49:08 +0000 (14:49 +0000)]
Bug 33810: Opac advanced search fields need aria-labels

The OPAC advanced search fields need aria-labels to assist with screen reading. This patch adds labels to both the dropdown selects and the text inputs

Signed-off-by: joubu <xxx@example.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 933c779b7d49525a561070dd8d60941f5f000c06)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34954: Fixed typo to 'dateexpiry'
Laura Escamilla [Thu, 19 Oct 2023 18:25:51 +0000 (18:25 +0000)]
Bug 34954: Fixed typo to 'dateexpiry'

To test:

1. In KTD use grep -rn --exclude=*.po "datexpiry" *
2. Notice that the four locations below are showing the typo:
    1. git add koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
    2. git add misc/release_notes/release_notes_18_05_00.html
    3. git add misc/release_notes/release_notes_18_05_00.md
    4. git add t/db_dependent/Koha/Patrons/Import.t
3. Apply patch. Repeat step 1.
4. Notice that no results show. All instances of the typo have been fixed to dateexpiry.
5. Sign off and have a great day :)

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>
(cherry picked from commit d742f29d77ee1e8a6f825678ce879d4a04037c92)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35078: Remove invalid HTML from OpacShowSavings system preference
Owen Leonard [Tue, 17 Oct 2023 13:51:49 +0000 (13:51 +0000)]
Bug 35078: Remove invalid HTML from OpacShowSavings system preference

The options defined for the OpacShowSavings system preference contain
HTML: "on patron's checkout history page (the system preference
<em>opacreadinghistory</em> must be enabled)". This text ends up in an
<option> tag, and even though the form is rendered using the
multiple-select plugin the HTML still won't render and should
be removed.

To test, apply the patch and restart all.

- Go to Administration -> System preferences and search for
  "OpacShowSavings"
- Check the dropdown of options on the preference. The system
  preference names referred to should now be single-quoted instead of
  wrapped in visible <em> tags.
- Confirm that the preference still works correctly.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit dc9f6f09d8d6869a41e80a496b58038c246ad6cf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34910: (follow-up) alert in patron details
Fridolin Somers [Tue, 26 Sep 2023 08:11:39 +0000 (22:11 -1000)]
Bug 34910: (follow-up) alert in patron details

The anonymous patron details page should show an alert message.

1) Configure an existing borrowernumber in system preference 'AnonymousPatron'
2) Go to details page of this borrower :
   /cgi-bin/koha/members/moremember.pl?borrowernumber=x
3) Check you see alert 'This is the anonymous patron.'

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Johanna Miettunen <johanna.miettunen@haaga-helia.fi>
Signed-off-by: Päivi Knuutinen <paivi.knuutinen@joensuu.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a8e770d9c49a88fbfd46c27b31d3eb2a413a1618)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34910: Do not allow checkout for anonymous patron
Fridolin Somers [Tue, 26 Sep 2023 07:53:45 +0000 (21:53 -1000)]
Bug 34910: Do not allow checkout for anonymous patron

The anonymous patron circulation page should show an alert message and not allow check-out.

1) Configure an existing borrowernumber in system preference
   AnonymousPatron
2) Go to circulation page of this borrower :
   /cgi-bin/koha/circ/circulation.pl?borrowernumber=x
3) Check you see alert 'This is the anonymous patron, so circulation is disabled.'

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Johanna Miettunen <johanna.miettunen@haaga-helia.fi>
Signed-off-by: Päivi Knuutinen <paivi.knuutinen@joensuu.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit aca49ca14b9f2d009f469144f975cd9fbf098181)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34966: Terminology - fix add item form (& to and)
David Nind [Sat, 30 Sep 2023 06:27:39 +0000 (06:27 +0000)]
Bug 34966: Terminology - fix add item form (& to and)

This patch updates the add item form in the staff interface to
change the 'Add & duplicate' button to 'Add and duplicate'.

In our terminology guide, & should only be used when
it is part of a proper noun or a common abbreviation:
https://wiki.koha-community.org/wiki/Terminology

Test plan:
1. In the staff interface, search for and select a record.
2. Select New > New item.
3. Note that "Add & duplicate" is one of the action buttons at the
bottom of the add item form.
4. Apply the patch.
5. Refresh the page.
6. Note that the action button is now labelled 'Add and duplicate'.
7. Sign off! 8-)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katariina Hanhisalo <katariina.hanhisalo@xamk.fi>
Signed-off-by: Reetta Pihlaja <reetta.pihlaja@siilinjarvi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoRemove reverted bugs from release notes
Fridolin Somers [Wed, 8 Nov 2023 07:00:03 +0000 (21:00 -1000)]
Remove reverted bugs from release notes

7 months agoUpdate release notes for 23.05.05 release v23.05.05
Fridolin Somers [Wed, 8 Nov 2023 06:41:04 +0000 (20:41 -1000)]
Update release notes for 23.05.05 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoIncrement version for 23.05.05 release
Fridolin Somers [Wed, 8 Nov 2023 06:34:25 +0000 (20:34 -1000)]
Increment version for 23.05.05 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoTranslation fixes for Koha 23.05.05
Fridolin Somers [Fri, 28 Jul 2023 21:08:22 +0000 (11:08 -1000)]
Translation fixes for Koha 23.05.05

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoTranslation updates for Koha 23.05.05
Koha translators [Wed, 8 Nov 2023 06:22:47 +0000 (03:22 -0300)]
Translation updates for Koha 23.05.05

7 months agoRevert "Bug 35024: Do not wrap translations"
Fridolin Somers [Fri, 3 Nov 2023 20:27:54 +0000 (10:27 -1000)]
Revert "Bug 35024: Do not wrap translations"

This reverts commit f687d3d3eb83c996621d8974b7e222c92d2ec539.

7 months agoBug 33606: (QA follow-up) Cosmetic changes
Marcel de Rooy [Fri, 23 Jun 2023 07:11:23 +0000 (07:11 +0000)]
Bug 33606: (QA follow-up) Cosmetic changes

Even the POD name wasnt changed after copying :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 9c1dcfea13d6ac24bc9bceda601a95eb3f1a7623)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33606: Fix settings
Pedro Amorim [Wed, 17 May 2023 16:28:23 +0000 (16:28 +0000)]
Bug 33606: Fix settings

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit e98eb4e0ad643fc57ce82b71caab2056284b1d45)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33606: Mark the endpoint as experimental
Jonathan Druart [Tue, 16 May 2023 12:33:29 +0000 (14:33 +0200)]
Bug 33606: Mark the endpoint as experimental

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 42eb2fd2c98275e979c44fa8b65dd9d7b128357e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33606: Add a erm/config route to retrieve the ERM config needed for the Vue app
Jonathan Druart [Tue, 25 Apr 2023 13:56:51 +0000 (15:56 +0200)]
Bug 33606: Add a erm/config route to retrieve the ERM config needed for the Vue app

This could be extended later in bug 32968 to pass the permission of the
logged in user.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit cda3c377a20c401ef9a755f24eb839d515a8af72)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33169: (QA follow-up) Fix some icons for lower FA version
Katrin Fischer [Wed, 25 Oct 2023 11:38:27 +0000 (11:38 +0000)]
Bug 33169: (QA follow-up) Fix some icons for lower FA version

In the navigation some icons were missing, because they had changed
names between versions, this restores them. Fixed icons concerned
the navigation items:

* Local
* Local > Titles
* EBSCO > Titles

7 months agoBug 33169: (QA follow-up) Tidy Vue-related files
Tomas Cohen Arazi [Wed, 21 Jun 2023 19:20:09 +0000 (16:20 -0300)]
Bug 33169: (QA follow-up) Tidy Vue-related files

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 40b1d6f6afb189b55db34ce48bc33b86e78c59ca)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33169: Add support for FA styles
Tomas Cohen Arazi [Wed, 21 Jun 2023 19:05:26 +0000 (16:05 -0300)]
Bug 33169: Add support for FA styles

Font awesome now provides a different approach to icon styles so you can
specify things like:

```
<i class="fa fa-camera-retro"></i>
```

but also

```
<i class="fa-solid fa-camera-retro"></i>
```

The original implementation had a hardcoded `fa` and having an extra
parameter for the *style* seemed overkill, as we would need to handle
even a list of styles like on this example:

```
<i class="fa-sharp fa-solid fa-camera-retro"></i>
```

So I chose to just explicitly require the full FA icon class and pass it
thru. With no manipulation on the Vue side.

This patch does that, and adjusts the 'style' for some icons, as
introduced by the FA v6 patchset.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 19221dc960532084e3e72e611403f4d2a43adfc9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 33169: Build breadcrumbs and left-hand side menu from routes definition
Agustin Moyano [Mon, 6 Mar 2023 19:44:44 +0000 (16:44 -0300)]
Bug 33169: Build breadcrumbs and left-hand side menu from routes definition

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e3f88f0438232ab2c61129466aaa1fb205f4f720)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35199: (bug 34448 follow-up) Fix error handling in http-client.js
Jonathan Druart [Tue, 31 Oct 2023 13:45:08 +0000 (14:45 +0100)]
Bug 35199: (bug 34448 follow-up) Fix error handling in http-client.js

From bug bug 34448.

386         // Submit the form, get 500
387         cy.intercept("POST", "/api/v1/erm/agreements", {
388             statusCode: 500,
389             error: "Something went wrong",
390         });
391         cy.get("#agreements_add").contains("Submit").click();
392         cy.get("main div[class='dialog alert']").contains(
393             "Something went wrong: SyntaxError: Unexpected end of JSON input"
394         );

This is wrong: we are now showing a JS error (SyntaxError) instead of the expected 500: internal server error!

The problem was that a regular 500 does not have anything in the body,
and _fetchJSON didn't handle that ( JSON.parse(text) ).
If the body of the response does not contain anything we need to get the
text from statusText (which contains "Internal Server Error" in case of
500).

Test plan:
1. Make sure all cypress tests pass
2. Confirm the above:
Raise an exception from a given route (/agreements for instance) and
confirm that the error displayed on the interface is correct (ie. not
SyntaxError, but "Error: Internal Server Error")

For QA:
* This change is covered properly in Dialog_spec.ts, no need to redo it in
every other test files.
* Without the following change in count, we see:
"Something went wrong: Error: Error: Internal Server Error" because
setError is called twice. We don't need to set the error from count, it
has been set from _fetchJSON already.
-            error => {
-                setError(error.toString());
-            }
+            error => {}

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit df3acf3d68cd24d3b1015432206236b563aaa5d1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35167: Make 'effective_not_for_loan_status' fallback to 0 if itype has it undef
Tomas Cohen Arazi [Thu, 26 Oct 2023 17:58:40 +0000 (14:58 -0300)]
Bug 35167: Make 'effective_not_for_loan_status' fallback to 0 if itype has it undef

This patch makes the effective not for loan status be set the item value
if not defined at itype level.

To test:
1. Apply the regressions tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/items.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit b9ea3eb988b116ffc912fad9315533c7774a3754)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35167: Regression tests
Tomas Cohen Arazi [Thu, 26 Oct 2023 17:56:35 +0000 (14:56 -0300)]
Bug 35167: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit c67d28c5f9136a96bfb665cd13f354af492e3233)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35111: Ignore SIGPIPE in background jobs worker
David Cook [Fri, 20 Oct 2023 01:15:00 +0000 (01:15 +0000)]
Bug 35111: Ignore SIGPIPE in background jobs worker

This change explicitly ignores SIGPIPE signals in the background jobs
worker.

Daemons like Starman ignore SIGPIPE so it makes sense to explicitly set this.
Differences in the inner workings of MySQL vs MariaDB client libraries have yielded
different behaviours in automatic reconnections and potentially SIGPIPE handling,
so this helps to make the overall behaviour more consistent.

Test plan:
0. Apply patch and run "restart_all"
1. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
2. Click "Save" > "MARCXML"
3. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
4. Click "Choose file", choose the MARCXML file, click "Upload file"
5. Click "Stage for import"
6. Note the job is marked as "100% Finished"

7. In a separate window run "docker restart koha-db-1"
8. Repeat steps 3-5 for uploading file and running stage for import
9. Note that the job is marked as "100% Finished" as you'd expect

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Added comment on the SIG PIPE line.
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2988c549719197a5a46a94039f7881b3e74e6e19)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 35014: Only set time for enable-time flatpickr
Martin Renvoize [Mon, 9 Oct 2023 15:37:22 +0000 (16:37 +0100)]
Bug 35014: Only set time for enable-time flatpickr

This patch adds a check to the onChange function such that we only
attempt to set the default time on change for time enabled flatpickrs
when the date is entered manually.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5b25b26f70c21c609793f10706c04c9dbce4a5ad)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34520: DBIC schema
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:24:43 +0000 (15:24 -0300)]
Bug 34520: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c7571c6a3295835c5016d02360af6ba7c4aecdeb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoBug 34520: DBRev 23.05.04.001
Tomas Cohen Arazi [Tue, 31 Oct 2023 14:02:20 +0000 (11:02 -0300)]
Bug 34520: DBRev 23.05.04.001

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
7 months agoBug 34520: Fix FK for item_groups in reserves for new installations
Katrin Fischer [Sun, 29 Oct 2023 14:14:37 +0000 (14:14 +0000)]
Bug 34520: Fix FK for item_groups in reserves for new installations

There was a discrepancy between the database update for reserves
and the kohastructure.sql definition. This makes sure that the
FK is always "ON DELETE SET NULL".

To test:
* Before applying this path
* sudo koha-mysql kohadev
* show create table reserves;

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE

* Apply patch
* Run database update
* Check database again:

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE

* reset_all (create a new database)
* Check database again:

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6dd4626711866fbf92b49f88770a6b3bfb75ddca)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 months agoRevert "Bug 34959: Remove unused sub"
Fridolin Somers [Sat, 28 Oct 2023 21:04:35 +0000 (11:04 -1000)]
Revert "Bug 34959: Remove unused sub"

This reverts commit 01af59c6fc95bf6b90d8619514227a336820ab96.

7 months agoRevert "Bug 34959: Sort PO files correctly"
Fridolin Somers [Sat, 28 Oct 2023 21:04:34 +0000 (11:04 -1000)]
Revert "Bug 34959: Sort PO files correctly"

This reverts commit a2e33131ce6d61f63f743ee97fb8d3b6a96cd3f9.

8 months agoBug 34908: Sort item types alphabetically by description when adding a new empty...
Aleisha Amohia [Tue, 26 Sep 2023 22:40:01 +0000 (22:40 +0000)]
Bug 34908: Sort item types alphabetically by description when adding a new empty record as an order to a basket

To test:

1. Go to Koha administration -> Item types. Add a new item type "B" with the description "Test" so it will be obvious if it is sorted by the code "B" instead of the description "Test".
2. Go to Acquisitions. Add to a basket from a new empty record
3. In the Catalog details section, note the Item type dropdown. Confirm your "Test" item type, is showing near the top of the list, indicating it has been sorted based on the code "B"
4. Apply patch and restart services. Refresh the page.
5. Open the Item type dropdown again and confirm your "Test" item type is showing in the expected alphabetical order.

NC amended patch - tidied

Sponsored-by: South Taranaki District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0ef83c041d55cb95a4fd839101135126c3d9854a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35148: before_send_messages plugin hook does not pass the --where option
Kyle M Hall [Wed, 25 Oct 2023 13:34:53 +0000 (09:34 -0400)]
Bug 35148: before_send_messages plugin hook does not pass the --where option

The before_send_messages plugin hook currently sends all the non-smtp related options with the exception of the --where option. This should be added.

Test Plan:
1) Install the latest version of the kitchen sink plugin (
   https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases
   )
2) Apply this patch
3) Run process_message_queue.pl with a --where option
4) Run the command: ./misc/cronjobs/process_message_queue.pl --where "letter_code='test'"
5) Note the output looks like:
Plugin hook before_send_message called with the params: $VAR1 = {
          'verbose' => 0,
          'where' => 'letter_code=\'test\'',
          'letter_code' => [],
          'type' => [],
          'limit' => undef
        };

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1508e81505f978b473f06b9f8e71a8f22721a7f5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35069: Fix hold ratios items needed column sorting
Lucas Gass [Mon, 16 Oct 2023 23:03:03 +0000 (23:03 +0000)]
Bug 35069: Fix hold ratios items needed column sorting

This patch adds the data-sort attribute to the "Items needed" column to
ensure proper sorting.

To test:
1. Make a lot of holds.
2. On some holds have a high enough holds/copies ratio so the "Items
   needed" has values greater than 10.
3. Sort by that column. Notice the copies with an "Items needed" higher
   than 10 do not get sorted correctly.
4. APPLY PATCH
5. Try steps 1 -3 again. Everything should sort properly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2ce68244991fc90b4606e1aa06e874c9854107a2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35127: Fix 'Search type' for patron search
Jonathan Druart [Tue, 24 Oct 2023 13:32:53 +0000 (15:32 +0200)]
Bug 35127: Fix 'Search type' for patron search

We need to fallback on the syspref DefaultPatronSearchMethod but keep
the value when one is passed!

Test plan:
Search for patrons, and use the "search type". Set it to different
values than DefaultPatronSearchMethod and confirm that the value is
kept.
Fix is expected when searching for patrons in the header (use the
options to select a different value and run the search)

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>
(cherry picked from commit e08bf3bb4c4ef8208f7895c000397e4122664c57)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35072: Fix invalid usage of "&amp;" in JavaScript intranet-tmpl script redirects
Michał Kula [Mon, 23 Oct 2023 13:51:40 +0000 (15:51 +0200)]
Bug 35072: Fix invalid usage of "&amp;" in JavaScript intranet-tmpl script redirects

These escapes were invalid in these places, as HTML entity escapes
are meant to be used only inside of HTML elements/attributes, not
inside of JavaScript code.

These URLs would be sent out by the browser as-is, and that'd usually
work on the default install only coincidentally. Unfortunately, on some
setups (such as when using reverse proxies), this would break, and the
URL after "&amp;" would have been truncated.

This small patch adjusts the URLs in templates to not use wrong escapes,
and makes them consistent with how URLs are formatted for JavaScript
redirects in most of the templates already.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit da9f74e56aa3fcaab2a53f0211113d7600263806)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34983: Force a sort order in JSON output of po2json
Marcel de Rooy [Wed, 4 Oct 2023 13:04:27 +0000 (15:04 +0200)]
Bug 34983: Force a sort order in JSON output of po2json

This patch does so by default. If you do not want them sorted,
export CANONICAL-0 on the command line.

Test plan:
Copy a staff PO file from misc/translator to test.po
Now run:   time misc/translator/po2json test.po > json1
And do:    time misc/translator/po2json test.po > json2
Run:       diff json1 json2; #They should be the same.
Now:       export CANONICAL=0
And run:   time misc/translator/po2json test.po > json3
And again: time misc/translator/po2json test.po > json4
And run:   diff json3 json4; # Lots of changes
Remove the created cruft. And signoff :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
(cherry picked from commit a5fc346403665cf6eb692f401bf1cca5ece3cb81)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35124: Incorrect item groups table markup
Owen Leonard [Fri, 20 Oct 2023 17:01:00 +0000 (17:01 +0000)]
Bug 35124: Incorrect item groups table markup

This patch corrects the markup of the item groups table which is found
under the "Item groups" tab on the bibliographip detail page in the
staff interface.

The patch also adds the "NoSort" class to the "actions" column to
prevent it from being sortable.

To test, apply the patch and make sure the "EnableItemGroups" system
preference is enabled.

- In the staff interface, locate a record with items and view the detail
  page.
- Under the "Item groups" tab confirm that the table looks correct: The
  heading labels should be centered bold text.
- You should see sorting indicators on the "Display order" and "Description"
  headings but not on the last one.

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>
(cherry picked from commit 174cd59cea0e9a69aa3d690ef25190c293345a83)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34946: Remove the use of event attributes from self checkout and check-in
Owen Leonard [Thu, 28 Sep 2023 12:48:36 +0000 (12:48 +0000)]
Bug 34946: Remove the use of event attributes from self checkout and check-in

This patch removes the use of event attributes from the self checkout
and self check-in templates. These events are defined now along with the
other in-page JS.

To test you must have SelfCheckInModule and WebBasedSelfCheck
preferences enabled. And SelfCheckoutByLogin = cardnumber.

- Navigate to the self checkout interface
  (/cgi-bin/koha/sco/sco-main.pl).
- When the page loads, cursor focus should be automatically placed in
  the barcode field.
- Test the "munge history" feature from Bug 10016:
  [1] Start a web-based self-check session.
  [2] Enter a patron barcode.
  [3] Allow the self-check session to time out.
  [4] Use the back button.  You should get the patron barcode
      entry form; you should not be prompted to resubmit form input.
  [5] Enter a patron barcode, perform some transactions, then
      use the finish button.
  [6] Next, use the back button.  You should get the patron barcode
      entry form.
- Test the updated checkout_confirm function by submitting the "magic"
  barcode for checkout: __KOHA_NEW_CIRC__. The user's session should be
  ended.

- Navigate to the self check-in interface
  (/cgi-bin/koha/sco/sci-main.pl).
- Test the cursor focus and "munge history" feature on this page too.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 76d522a90346ccbdb38793c048d61e73e869d9a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35110: Authorities editor with JS error when only one tab
Fridolin Somers [Thu, 19 Oct 2023 19:17:57 +0000 (09:17 -1000)]
Bug 35110: Authorities editor with JS error when only one tab

Exactly like Bug 34251 for biblios :
When using the an authorities framework with all fields in the same tab, there is thrown a JS error in selectTab( "#tab0XX_panel" );
This is because no nav tabs are build in authorities/authorities.tt as BIG_LOOP has a length(size) of 1

Test plan :
1) Edit an authority framework, for example 'Meeting Name', to set all sufields in tab 0
   You may use SQL : UPDATE auth_subfield_structure SET tab=0 WHERE authtypecode='MEETI_NAME'
   Don't forget to restart memcached
2) Go to 'Authorities'
3) Click on 'New authority' then 'Meeting Name'
4) Check you don't see any JavaScript error
5) Check you can save

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 35110: (follow-up) Fix comment in addbiblio.tt

Change comment in addbiblio.tt since any biblio framework may use only
one tab.
Also fixes indenting using 4 spaces.

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>
Edit: squashed because follow-up fixes code introduced by the same
author.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 32e301df15d2eb73d43cb4cdbbb4b5b45bd3e784)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35000: Fix OPACMandatoryHoldDates feature in opac-reserve
Marcel de Rooy [Tue, 10 Oct 2023 11:36:45 +0000 (13:36 +0200)]
Bug 35000: Fix OPACMandatoryHoldDates feature in opac-reserve

Somewhere (perhaps after bug 29012) this feature has been broken
somehow.
The fact that we have two inputs for the date and the active one
is one level deeper, requires a few adjustments in the jquery
selectors etc. (Note that two Required lines were visible too.)
The corrected jquery constructs become a bit complexer now.

Test plan:
Enable AllowHoldDateInFuture + OPACAllowHoldDateInFuture.
Set circ rule for book to test with allows item level holds.
Set OPACMandatoryHoldDates to no hold dates.
Place hold on a book in OPAC. Check that More options is collapsed.
(If you force item level holds, it will open.)
Set OPACMandatoryHoldDates to Hold start date.
Refresh place hold page. More options is expanded now.
Click Place hold. You should see an alert and focus goes to start date.
Set OPACMandatoryHoldDates to Hold end date. Repeat place hold.
Set OPACMandatoryHoldDates to Both hold dates. Fill one. Place hold.
Bonus: Place hold on multiple biblios. Repeat former steps.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cd7a8840d54a8db00096e1e9044e600c226935a8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 35019: Add a CSRF token when deleting news
Emily-Rose Francoeur [Tue, 10 Oct 2023 17:30:43 +0000 (13:30 -0400)]
Bug 35019: Add a CSRF token when deleting news

I add a CSRF token as a parameter in the link for deleting a news
entry, which solves the problem.

TEST PLAN
1) Apply the patch
2) Go to "Tools > News > New entry"
3) "Display location" should be set to "Staff interface"
4) Fill in the fields
5) Return to the homepage
6) Delete the created news entry
7) The "Additional contents" page is displayed, and the deleted news
   entry no longer appears
8) Return to the homepage; the news entry no longer displays

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: adapted the template change to latest master inline
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f4b858778268730d49dc9f11d9d2d9bf6faf3f6e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 26994: List names in alphabetical order in Suggestion filter
Shi Yao Wang [Wed, 26 Jul 2023 16:58:39 +0000 (12:58 -0400)]
Bug 26994: List names in alphabetical order in Suggestion filter

Display list of names in alphabetical order when using the Suggestion information filter in Suggestions management

Test plan:
1. Add different purchase suggestions from various patron's names
2. Go to Acquisition > Suggestions
3. Click on the Suggestion information filters on the left-hand side
4. Use one of these drop-down menus: "Suggested by" or, "Managed by" or "Accepted by"
--> notice the list of names in menus, names aren't displayed from A to Z
5. Apply patch and refresh page
6. Redo step 4
--> notice now it's sorted alphabetically

Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bcaaffa838c3276b8590863c826cb133dae03258)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34171: Use barcodedecode when attaching items to another record
Katrin Fischer [Fri, 21 Jul 2023 15:25:00 +0000 (15:25 +0000)]
Bug 34171: Use barcodedecode when attaching items to another record

Bug 26351 added barcodecode that transforms scanned barcodes either
by using itemBarcodeInputFilter  or via a plugin to various pages in
Koha, including checkout and checkin. But the feature for attaching
items to a new record was missed.

To test:
* Add an item with barcode "ab" to any record
* Set itemBarcodeInputFilter to "Remove spaces from"
* Search for another record in the catalog
* Edit > attach item > "a b"
* The item is not found.
* Apply patch, restart_all
* Try again with "a b"
* Verify that the item is found and attached to the record

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cd033bfc60f9700d0d52986a95da55a92c88ee01)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34014: (follow-up) No need to parse old record before updating
Nick Clemens [Tue, 17 Oct 2023 19:15:24 +0000 (19:15 +0000)]
Bug 34014: (follow-up) No need to parse old record before updating

If the old record doesn't parse correctly it will cause a failure - the check is just to ensure we
are editing an existing biblio, just getting the metadata object should confirm it exists

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e8b66cadf2e2e313663544d3978e9c8b1ddeba32)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34014: (follow-up) Tidy
Nick Clemens [Tue, 17 Oct 2023 18:13:32 +0000 (18:13 +0000)]
Bug 34014: (follow-up) Tidy

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f7630f5de412b98d562f8df3a22a1786a2367d56)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34014: Unit test
Nick Clemens [Tue, 17 Oct 2023 18:06:27 +0000 (18:06 +0000)]
Bug 34014: Unit test

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5506a031ed20dd95f77fe165dfc05ab5cd4a4217)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34014: Add support for advanced cataloging editor
Nick Clemens [Tue, 17 Oct 2023 17:06:22 +0000 (17:06 +0000)]
Bug 34014: Add support for advanced cataloging editor

To test:
1 - Enable the advanced cataloging editor
2 - Edit record 369 in the advanced cataloging editor
3 - On load, get a notice that there were issues and to check logs
4 - Save record
5 - Close and reopen in editor
6 - Confirm warning is gone

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8dc2152e2f32b79abfe5f5531ddc225601498116)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34014: Allow staff to edit degraded records
Nick Clemens [Wed, 14 Jun 2023 19:05:14 +0000 (19:05 +0000)]
Bug 34014: Allow staff to edit degraded records

This patch adds an eval to the call for the record form metadata

If there is an error we catch it, display it, and attempt to strip bad characters from the record

To test:
1 - In koha testing docker attempt to view record 369 in the staff interface
2 - You see a warning about degraded view
3 - Attempt to edit the record
4 - Internal server error
5 - Apply patch, restart all
6 - Reload the editor
7 - Record successfully loads!
8 - You have a warning about encoding issues!
9 - Save the record
10 - No more warning!
11 - Edit again, no more warning!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 66d519ae41756c38ecc6baef622c30ef596b599c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>