koha.git
3 years agoBug 26214: Remove the use of jquery.checkboxes plugin on late orders page
Owen Leonard [Fri, 14 Aug 2020 14:47:40 +0000 (14:47 +0000)]
Bug 26214: Remove the use of jquery.checkboxes plugin on late orders page

This patch replaces the use of the jquery.checkboxes plugin on late
orders page in acquisitions.

Unrelated changes: The "Check all" and "Uncheck all" links are moved out
of the table header so that it matches similar interfaces. Sorting is
now disabled on the checkboxes column and the table is sorted by default
on the "Order line" column.

To test, apply the patch and go to Acquisitions -> Late orders.

 - On the initial view, there should be no "Check all" or "Uncheck all"
   links.
 - Select a vendor in the left-hand sidebar form.
 - When the filtered table is redisplayed the "Check all" and "Uncheck
   all" links should now be visible.
 - Test that the links work correctly.
 - Confirm that the checkboxes column cannot be sorted and that the
   table is sorted by default by order line number.

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 41205adf34a4cde773fb399728ca74d9dada0e81)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26215: Remove the use of jquery.checkboxes plugin from Z39.50 search pages
Owen Leonard [Fri, 14 Aug 2020 15:18:37 +0000 (15:18 +0000)]
Bug 26215: Remove the use of jquery.checkboxes plugin from Z39.50 search pages

This patch removes the use of the jquery.checkboxes plugin from three
Z39.50 search templates: Acquisitions, Authorities, and Cataloging.

To test, apply the patch and test the controls for selecting and
deselecting Z39.50 search targets on the following pages:

 - In Acquisitions: Locate a vendor and add to basket -> From an
   external source.
 - In Authorities: Click "New authority" -> "New from Z39.50/SRU."
 - In Cataloging: Click "New from Z39.50/SRU."

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ff5f7c787482fff5611b3fdeaed89598dfa29d64)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26216: Remove the use of jquery.checkboxes plugin from catalog search results
Owen Leonard [Fri, 14 Aug 2020 17:28:22 +0000 (17:28 +0000)]
Bug 26216: Remove the use of jquery.checkboxes plugin from catalog search results

This patch removes the use of jquery.checkboxes plugin from the
staff interface catalog search results page.

To test, apply the patch and perform a catalog search in the staff
interface which will return results.

On the search results page test the "Select all" and "Clear all" links
at the top of the results. They should work correctly.

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit af8aa1ad7eb4857a86d395b3833b8040630306b6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26213: Remove the use of jquery.checkboxes plugin when adding orders from MARC...
Owen Leonard [Fri, 14 Aug 2020 14:18:00 +0000 (14:18 +0000)]
Bug 26213: Remove the use of jquery.checkboxes plugin when adding orders from MARC file

This patch removes the use of the jquery.checkboxes plugin from the page
for adding orders to a basket from a staged MARC file.

This patch fixes an unreported bug wherein the "select all" and "clear
all" controls affected not only MARC record checkboxes but also the
"show inactive funds" checkboxes.

To test, apply the patch and go to Acquisitions.

- Go to Vendor -> Add to basket -> From a staged file.
- Select a staged file with multiple records.
- Test the "Select all" and "Clear all" links at the top of the "Select
  to import" tab. They should work correctly to select and deselect
  checkboxes corresponding to staged MARC records.

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8344ee7b4ced266ac7bd48254f4695175fd8f19b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23632: Remove C4::Logs::GetLogs
Jonathan Druart [Thu, 6 Aug 2020 09:28:53 +0000 (11:28 +0200)]
Bug 23632: Remove C4::Logs::GetLogs

Koha::ActionLogs->search must be used instead.
There is no call to this subroutine in our code, it should be removed.

Test plan:
Make sure the 3 test files still return green and that there is no more
occurrences of GetLogs in the codebase.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 807147fb7b20c837f9afc3e2d6ba589d86d86cbe)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25751: Add ORDERED in dropdown list of suggestion's statuses
Jonathan Druart [Tue, 16 Jun 2020 13:44:40 +0000 (15:44 +0200)]
Bug 25751: Add ORDERED in dropdown list of suggestion's statuses

The status "ORDERED" is missing from the pull down list of
status values when editing a suggestion, so the first
option is selected "No status".

This leads to data loss when editing a suggestion in the
status "ORDERED". Worse: the status can't be reset to
"ORDERED" and so no AVAILABLE notice can be sent to the patron.

Test plan:
- Create a suggestion, accept it, create a new order from this suggestion.
- Verify status is "ORDERED"
- Edit the suggestion
=> Without this patch the dropdown list does not have
   "Ordered", and if you save you lost the status
=> With this patch applied the dropdown list has "Ordered"
   preselected. You can save and preserve the status.

Signed-off-by: Holly Cooper <hc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit eeb7ac6fc0d14c9e731b7759c78f37cadcfa575f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25750: fix fallback to ecost_tax_included/ecost_tax_excluded
Alex Buckley [Sun, 14 Jun 2020 22:41:03 +0000 (22:41 +0000)]
Bug 25750: fix fallback to ecost_tax_included/ecost_tax_excluded

If 'Actual cost' has not been set then it has the value of 0.00 which
Perl evaluates to true so this patchset resets it to 0, so the fallback
to ecost_tax_included/ecost_tax_excluded happens.

Test plan:
1. Add item to acquisition basket (make sure the vendor has: tax rate: 15%, 'List prices: Include tax', 'Invoice prices: Include tax')
2. Set 'Vendor price' = 10 and do not set 'Actual cost'
3. Save order
4. Observe basket.pl shows 'Total tax exc.' has a value of 0.00 and GST
column has value of -8.70

5. Jump into the database:
select tax_value_on_ordering from aqorders where
ordernumber=<ordernumber>;
[You can get the ordernumber from clicking on the 'Modify' line the item
is listed in]
6. Observe a negative value: -8.70

7. Apply patch and restart plack
8. Add a second item to the basket
9. Set 'Vendor price' = 10 and don't set 'Actual cost'
10. Save order
11. Observe basket.pl shows 'Total tax exc' has value of 8.70 and GST
has value of 1.30
12. Repeat step 5 and observe tax_value_on_ordering = 1.30
13. Run t/Prices.t unit test:
sudo koha-shell <instancename>
prove t/Prices.t

Sponsored-by: Horowhenua District Council, NZ
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7b66b90fe707e8ac650a1c85d87560fc2f4a223d)

3 years agoBug 25872: Fix scoping of $limits
Nick Clemens [Thu, 13 Aug 2020 12:56:33 +0000 (12:56 +0000)]
Bug 25872: Fix scoping of $limits

The code in build_query_compat contained a 'my' in the assigning of limits for the search in a conditional

This meant the limits were being set correctly during the conditional, but we blanked when passed to the rest
of the code. The effect was that the searches worked, however, the template params to repeat the search were
incomplete.

Removing the my ensures the same limits are applied during search and on re-sorting

To test:
1 - Enable Elasticsearch
2 - On OPAC perform advanced search, selecting only an itype, ccode, or LOC limit
3 - Attempt to sort results
4 - You are returned to Advanced search
5 - Apply patch
6 - Repeat
7 - It sorts!

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 43dc505a52a2679e40a22ff610c91552cd8f2fd1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25872: Unit tests
Nick Clemens [Thu, 13 Aug 2020 12:55:21 +0000 (12:55 +0000)]
Bug 25872: Unit tests

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2f3a886f7b23f37f04a687cb0c1755c3195c2ce6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26119: Enable patron's attribute edition when PatronSelfRegistrationVerifyByEmail
Jonathan Druart [Mon, 3 Aug 2020 11:09:54 +0000 (13:09 +0200)]
Bug 26119: Enable patron's attribute edition when PatronSelfRegistrationVerifyByEmail

There is no good reason remove the ability to edit patron's attributes
if PatronSelfRegistrationVerifyByEmail is set.

We cannot have them in the self-registration form (because we don't
store patron's attributes during self-ref), but we can have them when
a patron show/edit their information.

Test plan:
0. Enable PatronSelfRegistrationVerifyByEmail and create patron's
attributes that can be edited at the OPAC
1. Create a new patron using the self-reg feature
=> You don't have the ability to fill in the patron's attribute
2. Edit your personal details (OPAC)
=> Without this patch you still don't see the patron's attribute that
can be edited at the OPAC
=> With this patch applied you can!
3. Notice the wording change on the "Modify patron attribute type" form
and confirm it makes sense

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fc22fb308bdbfc6d1bda3448e966542f2828ad76)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26127: local_referer should not compare with OPACBaseURL case insensitive
Jonathan Druart [Mon, 3 Aug 2020 13:07:24 +0000 (15:07 +0200)]
Bug 26127: local_referer should not compare with OPACBaseURL case insensitive

In our test data we have OPACBaseURL that is filled with http://kohadev.myDNSname.org:8080,
but the CGI referer in local_referer is lowercase
We should compare it without case sensitivity

Test plan:
- Use koha-testing-docker
- Notice the value of OPACBaseURL
=> http://kohadev.myDNSname.org:8080
- Use the "reports a problem" feature at the OPAC
- Notice that the "Problem found on page" is correctly filled with the
referer

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7a53c5f04cf2bb03734c82e9f964f108f9198d28)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26182: Clarify wording on CanMarkHoldsToPullAsLost and UpdateItemWhenLostFromHoldList
Andrew Fuerste-Henry [Thu, 13 Aug 2020 13:13:55 +0000 (13:13 +0000)]
Bug 26182: Clarify wording on CanMarkHoldsToPullAsLost and UpdateItemWhenLostFromHoldList

To test:
- apply patch, restart
- search sysprefs for CanMarkHoldsToPullAsLost
- confirm both sysprefs come up in search and syspref descriptions refer to each other

Signed-off-by: Holly Cooper <holly.teresa.cooper@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9509e834de14b3fd88296143032100f2b1c907fe)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26228: Update gulpfile to work with Node.js v12
Tomas Cohen Arazi [Mon, 17 Aug 2020 15:12:55 +0000 (12:12 -0300)]
Bug 26228: Update gulpfile to work with Node.js v12

This patch makes the gulpfile work with gulp v4 on Node v12. To test it,
make sure your dev env has Node.js v12.

It also replaces the use of 'gulp-util' (deprecated) by 'minimist' as
recommended on their site.

On both KTD and KohaDevBox edit your sources.list so the node line
points to 'node_12.x' instead of 'node_8.x'.

Once that's done:
1. On your clone run:
   $ yarn install
   $ npm install -E
2. Build the CSS:
   $ yarn build
   $ yarn build --view opac
=> SUCCESS: Things build correctly
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a7e3c12e6175e19299e7bdbe60d1bc7d41d45ce8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26078: (follow-up) Use a boolean rather than changing returnbranch
Nick Clemens [Fri, 14 Aug 2020 11:30:12 +0000 (11:30 +0000)]
Bug 26078: (follow-up) Use a boolean rather than changing returnbranch

Bug 26078: (follow-up) used validTransfer instead of checking WrongTransfer message

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d8f3e0ec0dbaf73075299a88a254334cfaf1d29e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26078: Prevent generating a new transfer from return policy when resolving a...
Nick Clemens [Thu, 30 Jul 2020 16:59:14 +0000 (16:59 +0000)]
Bug 26078: Prevent generating a new transfer from return policy when resolving a transfer

To test:
- Have 2+ branches
- Set your default return policy to Item returns to issuing library
- Find an item with holding branch of Branch A
- Set your library to Branch B
- Check item in
- Koha generates a transfer to Branch A. In doing so, it sets the item holding branch to Branch B
- Set your library to Branch A
- Check item in
- Koha generate a transfer to Branch B. In doing so, it sets the item holding branch to Branch A
- Set you library to Branch A
- Check the item in
 . . . Repeat indefinitely.
 Apply patch
 Repeat
 No more loop

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 47671123206a475f86de9316d8b256e14aa54bc1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26090: Fix "item types" report
Jonathan Druart [Thu, 30 Jul 2020 12:16:09 +0000 (14:16 +0200)]
Bug 26090: Fix "item types" report

This report was broken with SQL strict mode, but also without.

DBD::mysql::st execute failed: 'koha_kohadev.itemtypes.itemtype' isn't
in GROUP BY [for Statement "

and, if no library was selected:

DBD::mysql::st execute failed: Unknown column 'biblioitems.itemtype' in
'field list' [for Statement "

This patch does the minimum to make it usable, but it would need more
love.

Test plan:
To test you will need to try the 4 combinaisons:
 item-level_itypes = item or biblio
 With or without a library selected in the dropdown list

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5bca73080f89bb2f4ca83ce6ceb9fa8e3c4a7d92)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26361: switch TableSettings to ColumnSettings
Lucas Gass [Thu, 3 Sep 2020 03:57:01 +0000 (03:57 +0000)]
Bug 26361: switch TableSettings to ColumnSettings

Test Plan:
-Be on 20.05.x
-Go to returns.tt
-See the error Uncaught SyntaxError: expected expression, got keyword 'var'.
-Apply patch
-Reload returns.tt, no error

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26270: Fix ThingISBN after a change in behaviour
Jonathan Druart [Fri, 21 Aug 2020 12:00:51 +0000 (14:00 +0200)]
Bug 26270: Fix ThingISBN after a change in behaviour

This is just a guess! One of our tests is failing since today and we
don't modify anything in this area.
My guess is that the service is now returning the normalized version of
the ISBN

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fe529e3324405b30329054b9e8125babc357e1fe)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26265: add a plan for tests
Jonathan Druart [Tue, 25 Aug 2020 13:14:27 +0000 (15:14 +0200)]
Bug 26265: add a plan for tests

Tests were run but no plan was declared and done_testing() was not seen.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 88f64019536887c094b0178007d3583a048917f2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26265: Add missing xt dir
Jonathan Druart [Fri, 21 Aug 2020 13:10:18 +0000 (15:10 +0200)]
Bug 26265: Add missing xt dir

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f9598240c5d94fa5bd20aac1c25e32ea2b5e57dd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoUpdate release notes for 20.05.03 release v20.05.03
Lucas Gass [Mon, 31 Aug 2020 21:03:41 +0000 (21:03 +0000)]
Update release notes for 20.05.03 release

3 years agoIncrement version for 20.05.03 release
Lucas Gass [Mon, 31 Aug 2020 20:59:45 +0000 (20:59 +0000)]
Increment version for 20.05.03 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoMerge remote-tracking branch 'translations/20.05.03-translate-20200824' into rmain2005
Lucas Gass [Mon, 31 Aug 2020 20:53:42 +0000 (20:53 +0000)]
Merge remote-tracking branch 'translations/20.05.03-translate-20200824' into rmain2005

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26265: (QA follow-up) Remove g option from regex, add few dirs
Marcel de Rooy [Mon, 24 Aug 2020 08:03:48 +0000 (08:03 +0000)]
Bug 26265: (QA follow-up) Remove g option from regex, add few dirs

Adding .git. Using a regex.
If we make it a bit smarter, we do not need most dirs listed.

Test plan:
Run the test again

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 01bee142e6e0b997ddfb000a9623082b74bbe9ab)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 87570d81a28d043ba7c5111a64552e82974ca07e)

3 years agoBug 26265: Add test for missing directory in Makefile.PL
Jonathan Druart [Fri, 21 Aug 2020 13:09:44 +0000 (15:09 +0200)]
Bug 26265: Add test for missing directory in Makefile.PL

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 035ed3cee5f391fc90df53e537589dd702e056a8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5ea5f7f420d9772d4a632cd1b72b9ed1e35836c5)

3 years agoBug 26265: Add pos directory to the Makefile
Martin Renvoize [Fri, 21 Aug 2020 08:24:29 +0000 (09:24 +0100)]
Bug 26265: Add pos directory to the Makefile

This patch adds the /pos directory to the Makefile so that pos gets
properly mapped at make and install time.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit acbd6b72052381151f69a3b8aa70ab39cf4fda1c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b1e7e904867d5170f3052c1d93c72ab66da7be09)

3 years agoBug 26253: (bug 22857 follow-up) Remove duplicated mana_config in etc/koha-conf.xml
Jonathan Druart [Thu, 20 Aug 2020 08:10:14 +0000 (10:10 +0200)]
Bug 26253: (bug 22857 follow-up) Remove duplicated mana_config in etc/koha-conf.xml

It was there already but not at the same place!

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a4998b7d5758b0bee682fa7485d66390a3657a20)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8305f582aafe348f5f2697fe5432e162989296b5)

3 years agoBug 26134: (bug 23463 follow-up) Fix add to basket from staged file
Jonathan Druart [Thu, 6 Aug 2020 10:50:36 +0000 (12:50 +0200)]
Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file

There is a ->store call missing when we attempt to create a new item.

Test plan:
- set at least one value in MARCItemFieldsToOrder
- add to a basket via staged file with at least one value matching your MARCItemFields mappings
- set required fields for your order and click Save
=> Without this patch you got:
receive error: "DBIx::Class::Storage::DBI::_dbh_execute(): Column 'itemnumber' cannot be null at /kohadevbox/koha/Koha/Acquisition/Order.pm line 113
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77"
=> With this patch applied the order has been created successfully

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 12e1b2faccf6396d3c4b5327c881e78f177f135b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5e972d95ac834859ec5f9eabae0b2c20f7754818)

3 years agoBug 26162: Don't fall into an infinite loop
Jonathan Druart [Wed, 19 Aug 2020 05:19:09 +0000 (07:19 +0200)]
Bug 26162: Don't fall into an infinite loop

If something went wrong we do want to stop the script!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a0b5cefdc88a3671a0310a90490be275bab46860)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a29a9ec75408f135e070205fbd1868789b90b54b)

3 years agoBug 25360: (follow-up) Remove the https FIXME in Auth.pm
Marcel de Rooy [Wed, 5 Aug 2020 13:48:59 +0000 (13:48 +0000)]
Bug 25360: (follow-up) Remove the https FIXME in Auth.pm

The FIXME is no longer valid since we fixed the X-Forwarded headers
for Plack. And since we do not even use using_https anymore in
the templates (see bug 21094).

Test plan:
Run Auth.t
Git grep for using_https

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5f6fb719bf6f6e6e0f830f97561ddc6e29012071)

3 years agoBug 25360: Use secure flag for CGISESSID cookie when using HTTPS
David Cook [Mon, 4 May 2020 01:12:26 +0000 (11:12 +1000)]
Bug 25360: Use secure flag for CGISESSID cookie when using HTTPS

This patch adds the secure flag to the CGISESSID cookie when using HTTPS.
This prevents the cookie being used again over a normal HTTP
request.

Bug 25360: [Follow-up] Test for "on" or "ON" value for HTTPS env var

This patch tests for HTTPS "on" or "ON" before setting the secure
cookie.

Bug 25360: [Follow-up] Fix typo in C4/InstallAuth.pm

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Amended number of tests in Context.t
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c2a0b7a4e761b7d3bea9145440313e832808c60b)

3 years agoBug 24663: (follow-up) Remove authnotrequired if set to 0
Jonathan Druart [Mon, 2 Mar 2020 09:08:12 +0000 (10:08 +0100)]
Bug 24663: (follow-up) Remove authnotrequired if set to 0

2 newly added scripts

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 12fc93f03a906317933dbd4dbbe63033e684840f)

3 years agoBug 24663: Handle special cases for recovery password and selfreg
Jonathan Druart [Mon, 17 Feb 2020 15:44:37 +0000 (16:44 +0100)]
Bug 24663: Handle special cases for recovery password and selfreg

The password recovery and self-registration features need to be
accessible at the OPAC even if not public.

Test plan:
Self register a new account, then ask for a new password with OpacPublic
turned off

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5df7a3b6b589e692bec13a8f09258f2c26bfaa2c)

3 years agoBug 24663: Force authentication in svc/records/preview (?)
Jonathan Druart [Mon, 17 Feb 2020 12:31:38 +0000 (13:31 +0100)]
Bug 24663: Force authentication in svc/records/preview (?)

Was this wrong?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f4bbeab8581b4abd926b14e4c2aed100598ec06e)

3 years agoBug 24663: Force auth in adveditorshortcuts.pl
Jonathan Druart [Mon, 17 Feb 2020 12:31:17 +0000 (13:31 +0100)]
Bug 24663: Force auth in adveditorshortcuts.pl

This was wrong!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 165c1c67613362a299138359e056f7b355d05c9e)

3 years agoBug 24663: Remove authnotrequired if set to 0
Jonathan Druart [Mon, 17 Feb 2020 12:20:48 +0000 (13:20 +0100)]
Bug 24663: Remove authnotrequired if set to 0

It defaults to 0 in get_template_and_user

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 79f7a3fc024323d8b4016d201a222118801bdcc6)

3 years agoBug 24663: Test OpacPublic for all OPAC scripts
Jonathan Druart [Mon, 17 Feb 2020 12:16:48 +0000 (13:16 +0100)]
Bug 24663: Test OpacPublic for all OPAC scripts

Prior to this patchset there were 3 different calls to
get_template_and_user (or checkauth) with the authnotrequired param:
 * authnotrequired => 0
 * authnotrequired => 1
 * authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 )

The first one says that an unauthenticated user can access the page, the
second that the user has to be authenticated, and the last one that it
depends on the OpacPublic syspref.
Actually we must replace the first one with the third one, if the OPAC
is not public, the authentication must be forced.

To do so we are going to remove the "authnotrequired => 0" occurrences,
and check the OpacPublic syspref's value in C4::Auth

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1b095d1d80e5d4026a68e8df72ccd9918aff3dee)

3 years agoBug 23634: (QA follow-up) Our PUT is really a PATCH
Tomas Cohen Arazi [Mon, 13 Jul 2020 15:25:13 +0000 (12:25 -0300)]
Bug 23634: (QA follow-up) Our PUT is really a PATCH

This patch makes the controller not expect that there will always be all
the email fields. So it now checks if an email field was passed, and
changed, and renders the error if that stands.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Tests written by Nick highlight a problem
2. Apply this patch
3. Repeat 1
=> SUCCESS: Problems solved
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f58ae3f0ead21e77da038f37fa098593e50615d5)

3 years agoBug 23634: (QA follow-up) Adjust tests
Nick Clemens [Mon, 13 Jul 2020 10:33:11 +0000 (10:33 +0000)]
Bug 23634: (QA follow-up) Adjust tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5ad5e09be0208290463a31ccb3be5b2be3a1082f)

3 years agoBug 23634: (QA follow-up) Catch all email cases in API
Martin Renvoize [Fri, 10 Jul 2020 08:38:31 +0000 (09:38 +0100)]
Bug 23634: (QA follow-up) Catch all email cases in API

The API was only catching the primary email change case, but we need to
catch email, emailpro and B_email.

We were also not accounting for any of the emails (on PUT or from the
DB) being undefined.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 31e362484bba5a42f218027cee0b15a714eccb8c)

3 years agoBug 23634: (follow-up) Prevent updates on POST
Martin Renvoize [Tue, 19 Nov 2019 16:59:06 +0000 (16:59 +0000)]
Bug 23634: (follow-up) Prevent updates on POST

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: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3e213d65860ab4fcb6a425244729ac4a9fe8c19f)

3 years agoBug 23634: Secure the email on the API
Tomas Cohen Arazi [Tue, 19 Nov 2019 16:16:16 +0000 (13:16 -0300)]
Bug 23634: Secure the email on the API

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 624aa55ff33e6fe228ca806f8eb9c6592ab8cdbc)

3 years agoBug 23634: Prevent non-superlibrarians from editing superlibarian emails
Martin Renvoize [Tue, 19 Nov 2019 14:51:50 +0000 (14:51 +0000)]
Bug 23634: Prevent non-superlibrarians from editing superlibarian emails

This patchset prevents a non-superlibrarian user from editing a
superlibrarians email address via memberentry.  This is to prevent a
privilege escalation vulnerability whereby a user could update a
superlibrarians contact details to match their own and then request a
password reset via the OPAC.

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: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e4fdbd69722ee33fb0e7125f9a1b316e7f9f8b02)

3 years agoBug 23634: Add tests for is_superlibrarian
Tomas Cohen Arazi [Tue, 19 Nov 2019 16:22:18 +0000 (13:22 -0300)]
Bug 23634: Add tests for is_superlibrarian

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8c8b23c42786463ce7eb617e5a22bf84e6635f1c)

3 years agoBug 23634: Add is_superlibrarian method to Koha::Patron
Martin Renvoize [Tue, 19 Nov 2019 14:11:34 +0000 (14:11 +0000)]
Bug 23634: Add is_superlibrarian method to Koha::Patron

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: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4825fd5d82241631745016e1dfbfe75e77138e7a)

3 years agoTranslation updates for Koha 20.05.03
Koha translators [Mon, 24 Aug 2020 15:57:22 +0000 (12:57 -0300)]
Translation updates for Koha 20.05.03

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25348: (QA follow-up) Silence irrelevant warnings
Tomas Cohen Arazi [Tue, 11 Aug 2020 15:41:57 +0000 (12:41 -0300)]
Bug 25348: (QA follow-up) Silence irrelevant warnings

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6d7e7fc066c93b3893527ec3de0e34b2fc4fe58f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25348: Add support for circulation status 12 ( lost )
Kyle M Hall [Fri, 1 May 2020 16:24:44 +0000 (12:24 -0400)]
Bug 25348: Add support for circulation status 12 ( lost )

We should support the SIP2 "circulation status" value 12, "lost".

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ed6a65c1ddacaa80fe825056cc77c3a3170af683)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25347: Add support for circulation status 11 ( claimed returned )
Kyle M Hall [Fri, 1 May 2020 16:16:48 +0000 (12:16 -0400)]
Bug 25347: Add support for circulation status 11 ( claimed returned )

Now that we have return claims in Koha, we should support the SIP2
"circulation status" value 11, "claimed returned".

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ca44a3f2ca82371bd6a2d731b7b4fd185d9fd93a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25344: Add support for circulation status 10 ( item in transit )
Kyle M Hall [Fri, 1 May 2020 16:04:37 +0000 (12:04 -0400)]
Bug 25344: Add support for circulation status 10 ( item in transit )

We should support the SIP2 "circulation status" value 10, "in transit
between library locations"

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit be719f30e4142e92d23f3a0566eca93f75224fc3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26114: ILL should mark status=RET only if a return happened
Tomas Cohen Arazi [Fri, 31 Jul 2020 14:14:20 +0000 (11:14 -0300)]
Bug 26114: ILL should mark status=RET only if a return happened

The original code assumed every codepath should be trated as a
successful check-in. Such is not the case and the regression tests
verify that the code acknowledges this.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Illrequests.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: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f916269465df99818fb15c108820d3b666968d39)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26114: Regression tests
Tomas Cohen Arazi [Fri, 31 Jul 2020 14:14:09 +0000 (11:14 -0300)]
Bug 26114: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8b106ed9c4b0588502c6dd485de2aec6a80b32c6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26008: Remove the use of jquery.checkboxes plugin from OPAC cart
Owen Leonard [Fri, 17 Jul 2020 14:43:39 +0000 (14:43 +0000)]
Bug 26008: Remove the use of jquery.checkboxes plugin from OPAC cart

This patch removes the use of the jquery.checkboxes plugin from the OPAC
cart and replaces its functionality with "plain" jQuery.

To test, apply the patch and add some items to the Cart in the OPAC.

 - Open the Cart window in the OPAC by clicking the "Cart" link in the
   header.
 - Test that the "Select all" and "Clear all" links work correctly to
   check and uncheck all checkboxes.
   - Controls like "Remove" and "Place hold" should be enabled or
     disabled according to whether there are any checked checkboxes.
 - Test that manually checking a checkbox correctly enables or disables
   the link options too.
 - Test that the "Remove" or "Place hold" controls work correctly,
   applying to only the checked checkboxes.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 26008: (follow-up) Removed checkboxed class

This patch removes the "checkboxed" class which was previously
associated with the jquery.checkboxes plugin and is now obsolete.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit db1587520778bd940da389fab8f46a12c1c11f73)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26010: Remove the use of jquery.checkboxes plugin from staff interface cart
Owen Leonard [Fri, 17 Jul 2020 17:29:15 +0000 (17:29 +0000)]
Bug 26010: Remove the use of jquery.checkboxes plugin from staff interface cart

This patch removes the use of the jquery.checkboxes plugin from the
staff interface cart and replaces its functionality with "plain" jQuery.

To test, apply the patch and add some items to the Cart in the staff
interface.

- Open the Cart window in the staff interface by clicking the "Cart"
  link in the header.
- Test that the "Select all" and "Clear all" links work correctly to
  check and uncheck all checkboxes.
- Test that the "Remove" or "Place hold" controls work correctly,
  applying to only the checked checkboxes whether they were checked
  using "Select all" or by manually checking them.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4cf5ef239f1e1a05c277a91f73b6fcd245eb5ec0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26161: Move actions under rhs fieldsets
Martin Renvoize [Thu, 6 Aug 2020 14:22:07 +0000 (15:22 +0100)]
Bug 26161: Move actions under rhs fieldsets

This patch moves the action buttons div to within the column div that
contains the 'This sale' and 'Collect payment' fieldsets.

Test plan
1/ Apply patch
2/ Navigate to the 'Point of sale' page (having enabled UseCashRegisters
and EnablePointOfSale)
3/ Confirm the 'Confirm' and 'Cancel' button/link now appear on the
correct side.
4/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3138c48f69ff19493c7433145144c06a077825be)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26179: Remove redundant import of Google font
Timothy Alexis Vass [Fri, 7 Aug 2020 12:59:16 +0000 (14:59 +0200)]
Bug 26179: Remove redundant import of Google font

Removed redundant @import of google font

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3d2a988809eddc4cdd3469aa5dc2a8f25252306b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26012: Correctly format "paid for" info on the item details view
Jonathan Druart [Wed, 29 Jul 2020 14:49:14 +0000 (16:49 +0200)]
Bug 26012: Correctly format "paid for" info on the item details view

The string is built controller side, which does not let the template
format the info nicely.
We want to display patron's info using patron-title.inc and the date
with the KohaDates plugin

Test plan:
- Make sure there is a replacement cost in the item
- check it out
- Mark it lost
- Pay the lost item fee
- Go to the detail page and look on the items tab for the item
- It will show an entry with "Paid for?" label
The patron's info and date must be correctly formatted

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ed4fc5889467bde858cfd4ac573cd40a5b4279c5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26165: Fix duplication of large saved reports
Jonathan Druart [Fri, 7 Aug 2020 10:44:28 +0000 (12:44 +0200)]
Bug 26165: Fix duplication of large saved reports

If the combined character length of a saved report's
title, notes and SQL is too long then pressing the
'duplicate' button will lead to an error:

"Request-URI Too Long
The requested URL's length exceeds the capacity limit
for this server."

Test plan:
1. Create a simple SQL report and add a lot of text
   into the notes field (the combined URL lenth must be
   >8225 characters)
2. Save the report
3. Press the duplicate the report from the saved reports page

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 81f06881a45d7647481aa8a21354a772f3daff88)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23542: Fix SRU import encoding
Fridolin Somers [Mon, 29 Jun 2020 13:07:10 +0000 (15:07 +0200)]
Bug 23542: Fix SRU import encoding

When importing records from a SRU server, the diacritics have bad encoding.
I reproduce with BNF server so it may be a UNIMARC issue.

Tests show that difference between Z39.50 server and SRU is that leader contains 'a' at postion 9.
Looking at MARC::Record->encoding() shows that encoding depends on leader even for UNIMARC.
So this patch adds a call to MARC::Record->encoding('UTF-8') in case of a SRU server in C4::Breeding.

Same use exists in Koha::MetadataRecord::Authority::get_from_breeding().

In case of import via Z3950, MarcToUTF8Record() is called,
 which calls SetMarcUnicodeFlag(),
 which calls MARC::Record->encoding('UTF-8')

Test plan :
1) Use a UNIMARC database
2) Configure a connexion to a UNIMARC SRU, for example BNF,
   see https://doc.biblibre.com/koha/autour_de_koha/serveurs_z3950_sru#serveur_de_la_bnf
3) Go to cataloguing module
4) Click on 'New from Z39.50/SRU'
5) Choose only the SRU target
6) Search for ISBN 2266072889
7) Confirm you see good encoding : diacritic on 'a' of title 'Strate-a-gemmes'
8) Click on 'Marc preview'
9) Confirm you see good encoding
10) Click import
11) Confirm you see good encoding
12) Check also Authorities import via SRU
13) Check also SRU imports on a MARC21 database

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: Removed change to new_from_xml call. We should respect syntax.
But the added MARC::Record encoding does the tric! Which is implicit
for Z3950 targets where MarcToUTF8Record does the same.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 19d9ba176dea6b7816a33b014a5f9e309af53dc0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25882: Remove phr indicator from limits when processing
Nick Clemens [Fri, 26 Jun 2020 13:19:47 +0000 (13:19 +0000)]
Bug 25882: Remove phr indicator from limits when processing

We assume all limits from advanced search to be a phrase and quote them
when doing this we should remove the phrase marker to avoid doulbe quoting

To test:
 1 - Have koha using ES
 2 - Go to advanced search
 3 - Limit by a single itemtype that exists
 4 - Get some results
 5 - Limit by a different itemtype that exists
 6 - Get some results
 7 - Limit by both itemtypes
 8 - Get only the results for the second itemtype
 9 - Enable DumpTemplateVarsIntranet and DumpSearchQueryTemplate
10 - Repeat search
11 - View page source and find 'search_query'
12 - See limit looks like itype:("("BK")" OR "("CR")")
13 - Apply patches
14 - Restart all the things
15 - Repeat search for both itemtypes
16 - Note results now include both types

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a2b2426de842ac86048cbf71e3760b6483fc0b3c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25882: Unit test
Nick Clemens [Fri, 26 Jun 2020 13:19:32 +0000 (13:19 +0000)]
Bug 25882: Unit test

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1a2d7f1eacc0722ea0723577823ee6a477a46b0a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24591: Add --help option to misc/devel/get-prepared-letter.pl
Julian Maurice [Fri, 10 Apr 2020 09:19:47 +0000 (11:19 +0200)]
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl

Also fix code style with perltidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit df0ef02de5e4efe23aafab77e25d0e19f658151c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24591: Add developer script to preview a letter
Julian Maurice [Wed, 5 Feb 2020 11:20:37 +0000 (12:20 +0100)]
Bug 24591: Add developer script to preview a letter

The script is very simple, it just calls GetPreparedLetter with
arguments given on command line and print the resulting letter content

Usage example:

misc/devel/get-prepared-letter.pl --module circulation \
    --letter_code ODUE --tables '{"borrowers":1,"branches":"CPL"}' \
    --repeat '{"item":[{"biblio":1,"items":1}]}' \
    --loops '{"overdues":[1]}'

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works for the example and other cases.
Correct option is 'letter-code', with dash, not underscore.
An usage message would be nice.
No errors

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
JD amended patch: tidy the new file and rename it matching the other
scripts' names in this directory

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f74ab4e9de75b53dc7040814b1f25ae282a81106)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25336: Show checkouts/fines to guarantor is in the wrong section of the patron...
David Roberts [Sun, 3 May 2020 23:48:09 +0000 (23:48 +0000)]
Bug 25336: Show checkouts/fines to guarantor is in the wrong section of the patron file

This patch moves the "Show checkouts to guarantor" and "Show fines to
guarantor" data to display under the Contact information block

To test:

1) Enable the AllowStaffToSetCheckoutsVisibilityForGuarantor and AllowStaffToSetFinesVisibilityForGuarantor system preferences to Allow
2) View a patron record.
3) The "Show checkouts to guarantor" and "Show fines to guarantor" field
will be on the right hand side of the screen under the Library use
block.
4) Apply patch
5) Check that this data has now moved to the Contact information block
on the left hand side of the patron record.

Works for me!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3abc4fb8584e0df2b71dd9d38f033e34b205e829)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25919: Only show Desks in admin navigation when UseCirculationDesks is used
Katrin Fischer [Sat, 18 Jul 2020 10:24:23 +0000 (10:24 +0000)]
Bug 25919: Only show Desks in admin navigation when UseCirculationDesks is used

We were missing a check for the UseCirculationDesks in the
template so the "Desks" link would only appear in the admin navigation
when the pref feature is activated.

To test:
- Turn off UseCirculationDesks
- Go to any administration page that shows the navigation on the left
- Verify Desks shows
- Apply patch
- Reload the admin page - Desks should be gone
- Turn on UseCirculationDesks
- Verify the Desks reappear

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 27ff36825dd6ac8f87dc7d380c60f21e8170dea6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25853: Fix file permissions for update_patrons_category script
Katrin Fischer [Sat, 18 Jul 2020 01:53:34 +0000 (01:53 +0000)]
Bug 25853: Fix file permissions for update_patrons_category script

The permissions for this were -rw-r--r-- and need to be -rwxr-xr-x.

To test:
- Verify the file permissions before and after applying the patch.

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e7661a37e657141b994d74398dd8e1b96d1da117)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26009: (QA follow-up) It does not harm to test more
Josef Moravec [Thu, 6 Aug 2020 19:15:44 +0000 (19:15 +0000)]
Bug 26009: (QA follow-up) It does not harm to test more

Test plan:
prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
--> should return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d08ce1d9406feca7bc7e5ab0be58efea94c7a2e5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26009: Add facet size to home/holdingbranch
Nick Clemens [Fri, 17 Jul 2020 16:23:42 +0000 (16:23 +0000)]
Bug 26009: Add facet size to home/holdingbranch

To test:
0 - Set DisplayLibraryFacets to 'both' and FacetMaxCount to 20
1 - Have more than 10 branches
2 - Have items in each of those branches
3 - Enable ES, set system preference SearchEngine to Elasticsearch
4 - Search for '*'
5 - Expand homebranch/holdingbranch facets
6 - Note you only get 10
7 - Apply patch
8 - Repeat search
9 - Now you get all your facets

Signed-off-by: Michael Springer <mspringer@mylakelibrary.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4dd1672c1b2f15e0b6be6071b6915c927c3a2ecc)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26136: Prevent double submit on checkin-form
Nick Clemens [Tue, 4 Aug 2020 13:13:43 +0000 (13:13 +0000)]
Bug 26136: Prevent double submit on checkin-form

To test:
 1 - Browse to Circulation->Check-in
 2 - Type a barcode into the Check in box
 3 - Hit Enter as many as times as you can
 4 - Check the statistics table:
    SELECT * FROM statistics WHERE itemnumber={itemnumber} AND DATE(datetime)=CURDATE();
 5 - Note you have multiple lines for the same item at the same time
 6 - Apply patch
 7 - Reload the page
 8 - Type the barcode
 9 - Press Enter even more fast and more furiously
10 - Check the statistics table
11 - Only one entry, huzzah!

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 44f54aac602ae99d83d954a2f102d77ff93ecfa7)

3 years agoBug 26158: Fix Z3950 search button broken for translations
Jonathan Druart [Thu, 6 Aug 2020 11:29:44 +0000 (13:29 +0200)]
Bug 26158: Fix Z3950 search button broken for translations

This is similar to bug 23713

var SEARCH_RESULTS = [% IF (SEARCH_RESULTS) %]1[% ELSE %]0[% END %];

become, once translated:

var SEARCH_RESULTS = [% IF (SEARCH_RESULTS) %]1[% ELSE %][% END %];

and a JS error appears in the console
 Uncaught SyntaxError: expected expression, got ';' search.pl:636:29

Caused by
  commit ef4306cc02e2f15aa2466ae65d0b4f9a1fd70ad9
  Bug 23885: Move staff client search results JavaScript into separate file

Test plan:
Use the staff interface in a translated language
Search for a term that won't return any results
Click the Z3950 button

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 85005b719876071047e4f6b99321549b665bcc05)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26037: openlibrary.org is hit on every Koha requests
Owen Leonard [Mon, 27 Jul 2020 12:26:41 +0000 (12:26 +0000)]
Bug 26037: openlibrary.org is hit on every Koha requests

This patch moves the inclusion of Open Library JavaScript from
opac-bottom.inc to the three templates where it might be used.

In addition, the Open Library JS has been modified to check for the
existence of the relevant markup on the page before executing a query.

Unrelated: The Open Library label is now hidden when the status returned
is "Not found." Previously this information was displayed.

To test, apply the patch and enable the OpenLibrarySearch system
preference.

 - Perform a search in the OPAC which will return results from Open
   Library. Some ISBNs: 014042382603950825520679436405.
   - On the search result page there should be an Open Library "Read
     now" button for each result that can be opened for reading in Open
     Library.
 - Add these titles to a list and view the list.
   - The "Read now" button should appear on the list page.
 - View the details for one of these titles.
   - The "Read now" button should appear on the page below the holdings.
 - Watch the browser's developer tools on these and other pages in the
   OPAC. There should be no errors in the console and no 404 errors in
   the network tab.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5bad8da970b299588b49ca061555e1633f95a6fe)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25683: (follow-up) Use COALESCE instead of IFNULL
Nick Clemens [Tue, 4 Aug 2020 18:28:42 +0000 (18:28 +0000)]
Bug 25683: (follow-up) Use COALESCE instead of IFNULL

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e1509855d3aa2729127ac352525be62505d752f9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25683: Fix grouping of results
Nick Clemens [Wed, 10 Jun 2020 12:26:06 +0000 (12:26 +0000)]
Bug 25683: Fix grouping of results

DBIX doesn't seem to work as I expected - if trying to group by we can only
get the columns we grouped by, otherwise the queries are much more complicated
and come out wrong

This patch removes the 'amountoutstanding' from the query. Note that we do return patron
object, however, to access all the columns we must discard_changes (or refetch)

Also fixes a typo 'verbosse'

To test:
1 - charge a $1 fine to a patron
2 - pay off the fine
3 - perl misc/cronjobs/update_patrons_category.pl -f J -t J -fu=5 -v
4 - Note the patron is returned twice
5 - export DBIC_TRACE=1
6 - repeat 3 - view the SQL query and see how odd it is
7 - Apply this patch
8 - repeat 3 - simpler query
9 - patron returned only once

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c7ae33f60c18d2874370e7c2d2f3042fe1331e0e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25683: Patron with no accountlines should have 0 outstanding (not NULL)
Nick Clemens [Tue, 9 Jun 2020 10:52:26 +0000 (10:52 +0000)]
Bug 25683: Patron with no accountlines should have 0 outstanding (not NULL)

Test plan:
- Have a patron with nothing in accountlines
- run update_patron_categories to find patrons with fines under $5 (-fu=5)
  - Your patron is not found
  - Give your patron a manual charge of $1
  - rerun the cron, your patron is found
  - pay off your patron's fine, putting their balance at $0
  - rerun the cron, your patron is found

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 09146f4a995d50206c7f1c2d80e797b3cb1175c5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26131: Remove parentheses in circulation.pref
Lucas Gass [Mon, 3 Aug 2020 21:56:48 +0000 (21:56 +0000)]
Bug 26131: Remove parentheses in circulation.pref

To test:
1. Search for a SCO system preference like SCOUserJS.
2. Note that there is a console error on that screen and you cannot open editor.
3. Apply patch
4. Reload the page.
5. No more console error and you can now edit the system pref!

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 759e52ac944d25cf019b83a68ea0329842e4d3e2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26125: (bug 23697 follow-up) open patron's details in autocompletion search
Didier Gautheron [Mon, 3 Aug 2020 06:40:06 +0000 (08:40 +0200)]
Bug 26125: (bug 23697 follow-up) open patron's details in autocompletion search

Test plan:

1 - Enable PatronAutoComplete syspref
2 - Go to "Patrons" (members/members-home.pl)
3 - Enter a patron first letters in "Search Patron" tab
4 - Select a patron
5 - You're wrongly redirected in koha/circ/circulation.pl
6 - Apply patch
7 - Repeat 3, 4
8 - You're correctly redirected in koha/members/moremember.pl
9 - double check "Check out" redirect hasn't changed

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8855908fdf8839878a233012f4d63b33949554c0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26098: Fix JS error on the fund list view when no fund displayed
Jonathan Druart [Thu, 30 Jul 2020 08:51:26 +0000 (10:51 +0200)]
Bug 26098: Fix JS error on the fund list view when no fund displayed

TypeError: this.data(...) is undefined
in jquery.treetable.js

Test plan:
Go to the fund list view
Select a filter that will return no result
=> With this patch applied there is no JS error in the console

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b6cb3c2ba54c0e10c27f37a0d2dec4f2875f2ddd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26017: (follow-up) Serverside permission check on registers page
Martin Renvoize [Tue, 4 Aug 2020 14:06:02 +0000 (15:06 +0100)]
Bug 26017: (follow-up) Serverside permission check on registers page

This patch adds a serverside permissions check for the display of the
registers summary page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1ae7efa3bb7806ac5a7e3f2882a7139e627b22c6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26017: Correct permission check on tools page
Martin Renvoize [Mon, 20 Jul 2020 08:40:00 +0000 (09:40 +0100)]
Bug 26017: Correct permission check on tools page

The 'Cashup registers' link from the tools page retained an previous
verions of the permission name. This patch corrects it to use the final
name we sebtled on and thus now correctly displays the link when
appropriate.

Test plan
1/ Enable cash registers via the 'UseCashRegisters' system preference
2/ Ensure you are logged in as a user who has the cash management
   cashup permission.
3/ Verify that the 'Cashup registers' option appears on the tools page.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ff4917197deaa6250d30c5729b2758db2b1f755e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26121: Add z-index for CodeMirror
Lucas Gass [Fri, 31 Jul 2020 22:47:21 +0000 (22:47 +0000)]
Bug 26121: Add z-index for CodeMirror

To test:
1. Make sure the system preference 'NewsToolEditor' is set to CodeMirror
2. Go add or edit some News content.
3. Add some content to the News section
4. Use the datepicker to pick a Publication date/Expiration date
5. Notice its very hard to see your dates overlapping with CodeMirror.
6. Apply patch
7. Much easier to see the dates!

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e0624f0e03e8d265cd3f2ab8434671700bf6984d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25893: Use wildcards when searching logs
Nick Clemens [Mon, 29 Jun 2020 18:15:39 +0000 (18:15 +0000)]
Bug 25893: Use wildcards when searching logs

The restores the wildcards that were used in the past

To test:
 0 - Ensure cataloguing logs and issues logs are enabled
 1 - Edit an item
 2 - Circulate that same item
 3 - Browse to tools-> log viewer
 4 - Put the itemnumber in the 'info' box
 5 - You see only the circulation
 6 - Put the itemnumber in the object box
 7 - You see only the cataloging modification
 8 - Apply patch
 9 - Put itemnumber in info box
10 - you see both actions
11 - Put the itemnumber in the object box
12 - You see only the catalogiong modification

Signed-off-by: Jason Robb <jrobb@sekls.org>
Bug 25893: Don't wildcard object

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 25893: (follow-up) Undo unrelated changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bb0abf99c451113e8649c494d3a8b99f3916f942)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26124: Load TinyMCE assets in correct order
Lucas Gass [Tue, 4 Aug 2020 02:59:32 +0000 (02:59 +0000)]
Bug 26124: Load TinyMCE assets in correct order

1. Make sure NewsToolEditor is set to TinyMCE
2. Go to Home › Tools › News › Add news item
3. Observe console error
4. Apply patch
5. No console error

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6d1c3af91bec4e5f93f6531be3aa8de4c4608efe)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26115: Remove leftover Carp::Always
Tomas Cohen Arazi [Fri, 31 Jul 2020 13:17:01 +0000 (10:17 -0300)]
Bug 26115: Remove leftover Carp::Always

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 550cb7eb431fe90c9cd1d7f9f711f617d0befe6e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26162: Wait for the table to be refreshed
Jonathan Druart [Mon, 10 Aug 2020 09:59:58 +0000 (11:59 +0200)]
Bug 26162: Wait for the table to be refreshed

The previous patch did not work as expected. We still got a
StaleElementReference exception.
But this time on
10:43:47 selenium_1   | Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"branchname\"]"}
Because we found the one that existed on the page, not the one sent back
in AJAX.

The idea of this patch is to search for the "Showing 1 to X of Y entries" info and wait for X == Y

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 70ff3bafa05a30944962747953c70bb8dc3c1ab8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26162: Make Selenium click action more robust
Jonathan Druart [Thu, 6 Aug 2020 13:08:48 +0000 (15:08 +0200)]
Bug 26162: Make Selenium click action more robust

See
https://stackoverflow.com/questions/12967541/how-to-avoid-staleelementreferenceexception-in-selenium
https://www.selenium.dev/exceptions/
https://developer.mozilla.org/en-US/docs/Web/WebDriver/Errors/StaleElementReference

This patch will fix the following failure we get under D11:
18:47:07 selenium_1   | 09:47:07.478 WARN - Exception: Element not found in the cache - perhaps the page has changed since it was looked up
18:47:07 selenium_1   | For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
18:47:07 selenium_1   | Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
18:47:07 selenium_1   | System info: host: '78b9a07f51f2', ip: '192.168.16.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-9-amd64', java.version: '1.8.0_91'
18:47:07 selenium_1   | Driver info: driver.version: unknown
18:47:07 koha_1       |
18:47:07 koha_1       | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
18:47:07 koha_1       |  /usr/local/share/perl/5.26.1/Selenium/Remote/Driver.pm:353 in Try::Tiny::try
18:47:07 koha_1       |  (eval 1571):1 in Selenium::Remote::Driver::__ANON__
18:47:07 koha_1       |  (eval 1573):2 in Selenium::Remote::Driver::__ANON__
18:47:07 koha_1       |  (eval 1546):17 in Selenium::Remote::Driver::_execute_command
18:47:07 koha_1       |  /usr/local/share/perl/5.26.1/Selenium/Remote/WebElement.pm:63 in Selenium::Remote::WebElement::_execute_command
18:47:07 koha_1       |  /kohadevbox/koha/t/lib/Selenium.pm:184 in Selenium::Remote::WebElement::click
18:47:07 koha_1       |  /kohadevbox/koha/t/lib/Selenium.pm:172 in t::lib::Selenium::click_when_visible
18:47:07 koha_1       |  t/db_dependent/selenium/administration_tasks.t:131 in t::lib::Selenium::click

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a96433446e87c03ac6e253a54eb067ac93a33575)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26143: Make the API handle per_page=-1
Tomas Cohen Arazi [Wed, 5 Aug 2020 15:09:40 +0000 (12:09 -0300)]
Bug 26143: Make the API handle per_page=-1

This patch introduces handling for per_page=-1 and actually adds a
missing feature to the API: being able to request all resources on a
route.

To test this:
1. Visit the libraries admin page
2. On the table, choose to display 'All' rows
=> FAIL: it doesn't refresh, the browser console displays a 500 error
code and so the logs
3. Apply the tests patches
4. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Pagination.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Tests fail loudly
5. Apply this patch
6. Restart plack
7. Repeat 2
=> SUCCESS: choosing to display all, works
8. Repeat 4
=> SUCCESS: Tests pass now!
9. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e4cae99f7ec76e40a57e4066e088b9b01caed744)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26143: Regression tests
Tomas Cohen Arazi [Wed, 5 Aug 2020 15:04:47 +0000 (12:04 -0300)]
Bug 26143: Regression tests

This patch introduces tests for the per_page=-1 handling use case. From
now on per_page=-1 means 'all resources'.

On writing this I noticed that we always paginate results no matter
what, but there was a weird condition under which on pagination headers
were sent back to the API consumer. This is highlighted in the precedent
patch, which is not the -1 situation this one tries to tackle.

Both pagination and searching are broken with per_page=-1, which is a
standard, and we actually didn't explicitly set a way to request all
resources.

To verify this:
1. Apply the previous tests patch and this one
2. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Pagination.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Things are damn broken

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d20bc39d759bc9321b1b7accb952f90351a14caa)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26143: The API is always paginated
Tomas Cohen Arazi [Wed, 5 Aug 2020 14:55:28 +0000 (11:55 -0300)]
Bug 26143: The API is always paginated

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 61e8dc8c7d489329c27aca3b6b10137c289161cb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26133: Remove GetMarcHosts
Jonathan Druart [Tue, 4 Aug 2020 11:55:13 +0000 (13:55 +0200)]
Bug 26133: Remove GetMarcHosts

We removed the single occurrence of this subroutine in the previous
patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 88ecaa54cdfec5d35091237821097877b0edb4eb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26133: Remove GetMarc* calls in detail.pl
Jonathan Druart [Tue, 4 Aug 2020 11:54:28 +0000 (13:54 +0200)]
Bug 26133: Remove GetMarc* calls in detail.pl

There are several calls in catalogue/detail.pl that can be removed:
GetMarcISBN, GetMarcAuthors, GetMarcSubjects, GetMarcSeries, GetMarcUrls and GetMarcHosts
They pass a variable to the template that is never used.

Test plan:
Confirm that this TT variable is never used.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5c190388ae1b69889e28c2dae80e0d9ea9baff1a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26141: Remove duplicated code from search.pl
Jonathan Druart [Wed, 5 Aug 2020 07:57:56 +0000 (09:57 +0200)]
Bug 26141: Remove duplicated code from search.pl

commit 417553a9e47bf31f4cb785162e3dced856a2ac2a
  Bug 12478: starting to add search to staff client

This commit added code related to the itemtypes to the advanced search, but this code already existed.

The weird bit is:
$template->param(advancedsearchesloop => \@advancedsearchesloop);
my $types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes";
my $advancedsearchesloop = prepare_adv_search_types($types);
$template->param(advancedsearchesloop => $advancedsearchesloop);

We are passing twice advancedsearchesloop to the template.

Test plan (for QA):
Review the changes and confirm that we can safely remove this code

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a51a4f117d13739687f7be47d56cae0352914901)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26043: Fix random failure from Holds.t
Jonathan Druart [Wed, 22 Jul 2020 12:11:03 +0000 (14:11 +0200)]
Bug 26043: Fix random failure from Holds.t

 #   Failed test 'Test ModReserveMinusPriority()'
 #   at t/db_dependent/Holds.t line 202.
 #          got: undef
 #     expected: '1605'
 # Looks like you failed 1 test of 66.

It is coming from Koha::Patron->holds that is ordering by reservedate,
so "sometimes" they are ordered in reverse (at least it's my
understanding of the problem).

Test plan:
Run the test file several times (from 20 to 60x), it must never fail
with this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 80a611797bf67b263b6b84a6e931833ea336b6a5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25762: Typo in linkitem.tt
Owen Leonard [Wed, 29 Jul 2020 12:21:29 +0000 (12:21 +0000)]
Bug 25762: Typo in linkitem.tt

This patch corrects the same typo in two different templates:

&rsquo; -> &rsaquo;

If you want to test beyond examining the patch, apply the patch
and go to Tools -> Rotating collections.

- Add an item to a rotating collection.
- In the browser's title bar (or the tab title if the title bar isn't
  shown) the separator between the rotating collection name and "Add or
  remove items" should be ">" instead of "`"
- Enable the EasyAnalyticalRecords system preference.
- View the detail page for a bibliographic record.
- From the "Edit" menu, choose "Link to host record"
- Check the title bar as you did previously.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 19f9bc0528ec0f5cdf000b5120138652b3ece57c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26085: Add the copy, print and export DataTables buttons to lost items report
Owen Leonard [Wed, 29 Jul 2020 12:58:22 +0000 (12:58 +0000)]
Bug 26085: Add the copy, print and export DataTables buttons to lost items report

This patch removes the in-page DataTables DOM configuration option so
that the default option is used. This will allow all the standard
controls to appear, including copy/print/export.

Since the default DataTables information includes the number of results
in the table, the template markup showing this information is removed.

To test, apply the patch and go to Reports.

- Run the "Items lost" report using parameters which will return
  multiple results.
- On the results page confirm that the standard controls are present:
  Result count, search form, columns filter, export buttons.
- Confirm that the "Activate filters" feature works, and that selecting
  results activates the option to download a CSV using a CSV export
  profile.

  Note that the "Activate filters" feature doesn't play well with hidden
  columns. However this issue predates the patch.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a7c85ad16303bb1a041663a13336f8446c26ee64)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26094: Add class to the "Suggest for purchase" button
Jonathan Druart [Thu, 30 Jul 2020 12:39:17 +0000 (14:39 +0200)]
Bug 26094: Add class to the "Suggest for purchase" button

Bug 14963 added a new "Suggest for purchase" button on the detail page
of bibliographic records at the OPAC.
This patch adds a specific CSS class to make it reachable easily

Like others button in this action list

Test plan:
Go to the detail page of a bibliographic record at the OPAc
Notice the new CSS class

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9f11ba114e13aee10e05ccb83096c7f02908085b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26004: Remove unused jQuery plugin jquery.hoverIntent.minified.js from the OPAC
Owen Leonard [Fri, 17 Jul 2020 13:20:45 +0000 (13:20 +0000)]
Bug 26004: Remove unused jQuery plugin jquery.hoverIntent.minified.js from the OPAC

The jQuery plugin jquery.hoverIntent.minified.js hasn't been used in
Koha in long time. This patch removes it from the OPAC.

To test, apply the patch and search for instances of "hoverIntent."
There should be none.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5d69ae18b5727d122575eb12a34f1712cb96b5b3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26011: Remove unused jQuery plugin jquery.metadata.min.js from the OPAC
Owen Leonard [Fri, 17 Jul 2020 18:09:30 +0000 (18:09 +0000)]
Bug 26011: Remove unused jQuery plugin jquery.metadata.min.js from the OPAC

The jQuery plugin jquery.metadata.min.js hasn't been used in
Koha in long time. This patch removes it from the OPAC.

To test, apply the patch and search for instances of "jquery.metadata."
There should be none.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7c100a7fd21bd4497be87df4b8cc94674a19c5f5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25873: Ignore malformed data for Elasticsearch integer fields
Julian Maurice [Thu, 25 Jun 2020 07:25:41 +0000 (11:25 +0400)]
Bug 25873: Ignore malformed data for Elasticsearch integer fields

If we try to put malformed data into an integer field, Elasticsearch
rejects the whole document.
Setting 'ignore_malformed' to true allows to ignore malformed data and
process the other fields of the document normally

https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ignore-malformed.html

Test plan:
* Without the patch
  1. In search engine configuration, change the type of a text field to
  'Number' (for instance 'title')
  2. misc/search_tools/rebuild_elasticsearch.pl -d -b
  3. See that the index is empty (unless you have titles consisting only
  of digits)
* With the patch
  1. misc/search_tools/rebuild_elasticsearch.pl -d -b
  2. Now records are correctly indexed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit cb5acdc6702cef4668921ccf2537797358981fff)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26084: Clarify language on ConsiderOnSiteCheckoutsAsNormalCheckouts
Andrew Fuerste-Henry [Wed, 29 Jul 2020 15:58:42 +0000 (15:58 +0000)]
Bug 26084: Clarify language on ConsiderOnSiteCheckoutsAsNormalCheckouts

To test:
- apply patch
- confirm explanation reads as suggested

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 622ea4627ae50c49f7547ee3a3a8b4bde18e17a3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26111: Add "Serials" (SER) to the reports dictionnary
Jonathan Druart [Fri, 31 Jul 2020 09:53:53 +0000 (11:53 +0200)]
Bug 26111: Add "Serials" (SER) to the reports dictionnary

It's missing in the template

Test plan:
Go go Home › Reports › Guided reports wizard › Dictionary
At step 2, notice that with this patch you have "Serials" in the
dropdown list (instead of an empty entry)

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b0eee4d2e1359050cee3dd23a121e75195b0ce11)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>