]> git.koha-community.org Git - koha.git/log
koha.git
4 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>
4 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>
4 years agoBug 25826: (QA follow-up) Add filters
Nick Clemens [Thu, 6 Aug 2020 12:40:20 +0000 (12:40 +0000)]
Bug 25826: (QA follow-up) Add filters

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25826: Forbid changing the hidden attributes for biblionumber
Tomas Cohen Arazi [Mon, 27 Jul 2020 15:18:36 +0000 (12:18 -0300)]
Bug 25826: Forbid changing the hidden attributes for biblionumber

This patch tweaks the UI so it forbids changing the hidden values when
they are correct (i.e. when they are not hidden in OPAC and intranet).

To test:
1. Apply the first patch
2. Play with the hidden values of the subfield you have mapped to
   biblio.biblionumber in your picked framework. This is usually 999$c
   in MARC21, and 001 in UNIMARC.
=> SUCCESS: When you verify the about.pl, it mentions issues when you
hide in some of the interfaces
3. Apply this patch and reload everything
4. Repeat 2
=> SUCCESS: If your framework is 'ok', it prevents you from editing this
values, otherwise you can change them.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25826: Add a warning to the about page
Jonathan Druart [Wed, 22 Jul 2020 14:43:38 +0000 (16:43 +0200)]
Bug 25826: Add a warning to the about page

This patch adds a warning to the about page if the biblionumber field is
hidden at the OPAC or staff interface.

Test plan:
Hide the biblionumber to some framework
Confirm that there is a warning on the about page

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agoBug 25871: DBRev 20.06.00.021
Jonathan Druart [Thu, 6 Aug 2020 09:36:33 +0000 (11:36 +0200)]
Bug 25871: DBRev 20.06.00.021

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25871: (QA follow-up) Update syspref
Nick Clemens [Tue, 4 Aug 2020 00:49:35 +0000 (00:49 +0000)]
Bug 25871: (QA follow-up) Update syspref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25871: Add "only library" to OpacItemLocation options
Owen Leonard [Tue, 16 Jun 2020 21:34:52 +0000 (21:34 +0000)]
Bug 25871: Add "only library" to OpacItemLocation options

This patch adds a new option to the OpacItemLocation system preference,
"only library." It also rewords the descriptions of the existing options
in order to make their use more clear.

To test, apply the patch and make sure your OPACXSLTResultsDisplay
system preference is set to "default."

Test the OPAC search results using each of the OpacItemLocation
preference options:

- location: "library, location, and call number," e.g.

  "Availability: Items available for loan: Athens (1).
   Location(s): Athens new book shelf Call number: JNF 952.025 Bl."

- ccode: "library, collection code, and call number," e.g.

  "Availability: Items available for loan: Athens (1).
   Collection(s): Juvenile non-fiction Call number: JNF 952.025 Bl."

- callnum: "library and call number," e.g.

  "Availability: Items available for loan: AthensCall number: JNF
   952.025 Bl (1)."

- library: "only library," e.g."

  "Availability: Items available for loan: Athens (1)."

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agoBug 26138: Make Koha::Plugins->call return consistent value
Jonathan Druart [Wed, 5 Aug 2020 07:30:31 +0000 (09:30 +0200)]
Bug 26138: Make Koha::Plugins->call return consistent value

It must return an empty array in case the enable_plugins config flag is
disabled

Test plan:
Turn the config off in koha-conf
Start a search at the OPAC
Without this patch you got:
  Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661
With this patch applied you see the search result

Followed test plan - works as described.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25811: Try to fix the random failure caused by not finding id=login
Jonathan Druart [Mon, 3 Aug 2020 15:57:02 +0000 (17:57 +0200)]
Bug 25811: Try to fix the random failure caused by not finding id=login

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24610: Compiled CSS
Jonathan Druart [Mon, 3 Aug 2020 09:57:55 +0000 (11:57 +0200)]
Bug 24610: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24610: Let user switch between 'Pay' and 'Write off' mode
Julian Maurice [Fri, 7 Feb 2020 10:21:43 +0000 (11:21 +0100)]
Bug 24610: Let user switch between 'Pay' and 'Write off' mode

In patron's accounting section, under 'Make a payment' tab, you have the
choice between 'Pay' and 'Write off'. It takes you to another form, but
once there you cannot change mode. You have to click on Cancel,
re-select the lines you had selected (if you made a selection) and click
on the right button.

This patch adds link above the form to easily switch between the two
modes.

Also fixes a CSS bug to be able to use Bootstrap's nav pills inside
.statictabs

Test plan:
1. Create some manual invoices
2. Go to 'Make a payment' tab
3. Click on the 'Pay' button in a table row
4. Above the form you should see two links ('Pay' and 'Write off').
   Click on 'Write off', confirm the write off and verify that it did
   make a 'write off'.
5. Go to 'Make a payment' tab
6. Click on the 'Write off' button in a table row
7. Click 'Pay', confirm the pay and verify that it did make a 'pay'
8. Go to 'Make a payment' tab
9. Select some lines and click on 'Pay selected'
10. Click on 'Write off', confirm the 'write off' and verify that it did
    make a 'write off'
11. Go to 'Make a payment' tab
12. Select some lines and click on 'Write off selected'
13. Click on 'Pay', confirm the pay and verify that it did make a 'pay'

Signed-off-by: Christofer <christofer.zorn@ajaxlibrary.ca>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agoBug 26108: Only call the plugin hook if a return took place
Tomas Cohen Arazi [Fri, 31 Jul 2020 12:52:10 +0000 (09:52 -0300)]
Bug 26108: Only call the plugin hook if a return took place

This patch makes the hooks be called only if the checkin is effective
(i.e. if it is not rejected for some reason.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26108: Regression tests
Tomas Cohen Arazi [Fri, 31 Jul 2020 12:47:56 +0000 (09:47 -0300)]
Bug 26108: Regression tests

The current implementation makes the assumption that if $issue is
defined, then it is the 'return' use case. This is correct, but
incomplete: after verifying that there's actually an issue, the return
can be rejected for various reasons.

This patch introduces a regression test for one of those situations
(which I consider enough for testing purposes) . It highlights that the
hook shouldn't be called if there hasn't been an actual checkin.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> FAIL: Tests fail because there's an unexpected warining printed by
the erroneous plugin call (i.e. there's been no return but the plugin is
called anyway).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25811: (follow-up) Debug - Paste the source of the page
Jonathan Druart [Fri, 31 Jul 2020 10:55:40 +0000 (12:55 +0200)]
Bug 25811: (follow-up) Debug - Paste the source of the page

Wide character in syswrite at /usr/share/perl5/File/Slurp.pm line 506.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25887: Keep library filter on the fund list view
Jonathan Druart [Thu, 30 Jul 2020 08:57:53 +0000 (10:57 +0200)]
Bug 25887: Keep library filter on the fund list view

The problem:
When filtering funds by library, the pull down for libraries resets to "empty" when the page is reloaded,
although the filter criteria is visible in the URL.

Test plan:
Create a fund for library A
Create a fund for library B
Go to the fund list view
=> All funds are listed
Select library A in the library filter, click "Go"
=> Funds for library A are listed
=> Library filter has "library A" selected
Edit fund for library B
=> The edit form has "library B" selected

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>
4 years agoBug 26093: Markup error after Bug 24279 creates formatting problem
Owen Leonard [Wed, 29 Jul 2020 20:01:24 +0000 (20:01 +0000)]
Bug 26093: Markup error after Bug 24279 creates formatting problem

This patch makes a few minor changes to the markup of the item detail
page in order for everything to be valid and styled correctly:

- Remove unnecessary and invalid <br clear="both"/>
- Move heading inside container so that floats clear correctly
- Change <span> tag back to <div> to enable the correct style.

To test, apply the patch and view the item details page for a title with
multiple items.

 - Each section starting with "Barcode" should be bordered above by a
   two-pixel gray line
 - The "statuses" section should be styled like the areas above and
   below, not as an ordered list.

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>
4 years agoBug 25852: Add tests
Jonathan Druart [Thu, 30 Jul 2020 09:59:44 +0000 (11:59 +0200)]
Bug 25852: Add tests

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25852: Improve C4::Creators::Lib reliability under plack
Jonathan Druart [Thu, 30 Jul 2020 10:00:03 +0000 (12:00 +0200)]
Bug 25852: Improve C4::Creators::Lib reliability under plack

This is certainly a major issue that leads to many side-effects.
Under plack, the structure of the default values are not handled
correctly.
Package variables are used to store stuff like the "layout type". They
are complex structures (arrays of hashes) and returned without being
copied.
When the caller (the controller script) retrieve them then modify the
returned structures, it actually modifies the package's variables.

One of the issue is:
Create a new layout
The script retrieve a structure with all "selected" flags are set to 0
It select the first one as default (BAR as selected => 1)
The user creates the new layout and will selected BIBBAR (for instance)
If you then edit this new layout, the script will retrieve the
"label_types" and set "selected" for BIBBAR. However BAR is still
selected!
The UI receives 2 selected and display the first selected one that has
the selected option.

Test plan:
1. Create a layout type for Barcode/Biblio
2. Choose fields to print and size of font
3. Save
4. Edit existing Layout
=> Withtout this patch "Barcode" is the preselected option
=> With this patch applied, the correct "Barcode/Biblio" option is
selected

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>
4 years agoBug 26108: (bug 25855 follow-up) Call after_circ_action hook only if issue exists
Jonathan Druart [Fri, 31 Jul 2020 07:49:06 +0000 (09:49 +0200)]
Bug 26108: (bug 25855 follow-up) Call after_circ_action hook only if issue exists

AddReturn can be called on an item even if it's not checked out (to
trigger holds for instance).
The hook should (?) not be called in that situation

Test plan:
Confirm the above and that the following tests are now passing:
 t/db_dependent/SIP/Message.t
 t/db_dependent/Reserves.t
 t/db_dependent/Circulation/issue.t
 t/db_dependent/SIP/Transaction.t
 t/db_dependent/Circulation.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26083: Item editor defaults to lost
Kyle M Hall [Wed, 29 Jul 2020 17:03:57 +0000 (13:03 -0400)]
Bug 26083: Item editor defaults to lost

When editing an item via additem.pl, koha defaults to the first
available lost status, rather than defaulting to not-lost.

Test Plan:
1) Ensure you do not have a value ClaimReturnedLostValue
2) Edit an existing item that is not lost
3) Note the lost value is set even though it is not lost
4) Apply this patch
5) Edit a different item that is not lost
6) Note the lost value is not set!

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>
4 years agoBug 26061: Compiled CSS
Jonathan Druart [Thu, 30 Jul 2020 15:40:28 +0000 (17:40 +0200)]
Bug 26061: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26061: Improve style of sidebar datepickers
Owen Leonard [Fri, 24 Jul 2020 15:59:42 +0000 (15:59 +0000)]
Bug 26061: Improve style of sidebar datepickers

This patch makes a small change to the staff interface CSS so that
datepicker form fields in sidebar forms don't force the datepicker icon
onto a second line.

The change uses the CSS calc() function to specify that form fields with
a .hasDatepicker class (dynamically added by jqueryUI) have a width of
100% minus 20 pixels, leaving room for the datepicker icon.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface).

- View a page in the staff interface which has a datepicker field in a
  sidebar form and confirm that the icon stays on the same line as the
  firm field at varying browser widths. Examples:

  - Reports -> Saved SQL reports
  - Circulation -> Overdues
  - Acquisitions -> Late orders

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25953: Add ID to installed plugins table on plugins-home.pl
David Cook [Wed, 8 Jul 2020 12:36:46 +0000 (12:36 +0000)]
Bug 25953: Add ID to installed plugins table on plugins-home.pl

This patch adds a "installed_plugins" ID to the table
of installed plugins.

The idea is that it will ease styling and DOM mods through Javascript.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26070: DBRev 20.06.00.020
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000 (15:21 +0000)]
Bug 26070: DBRev 20.06.00.020

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26070: Remove GoogleIndicTransliteration system preference
Owen Leonard [Mon, 27 Jul 2020 19:16:07 +0000 (19:16 +0000)]
Bug 26070: Remove GoogleIndicTransliteration system preference

The Google Transliterate API was deprecated on May 26, 2011. This patch
removes the feature and associated system preference.

To test, apply the patch and run the database update process.

 - Go to Administration -> System preferences and search for
   'GoogleIndicTransliteration.' There should be no results.
 - Search the Koha codebase for references to
   'GoogleIndicTransliteration.' There should be no current references..

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>
4 years agoBug 22660: DBRev 20.06.00.019
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000 (15:21 +0000)]
Bug 22660: DBRev 20.06.00.019

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22660: (QA follow-up) Fix capitalization in system preference
Katrin Fischer [Wed, 29 Jul 2020 22:51:34 +0000 (22:51 +0000)]
Bug 22660: (QA follow-up) Fix capitalization in system preference

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22660: (follow-up) Re-word system preference description
Owen Leonard [Thu, 23 Jul 2020 18:20:51 +0000 (18:20 +0000)]
Bug 22660: (follow-up) Re-word system preference description

This patch rewords the system preference description to focus on the
generic description of the editor rather than the name of the plugin:

    tinymce: "a WYSIWYG editor (TinyMCE)"
    codemirror: "a text editor (CodeMirror)"

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>
4 years agoBug 22660: (follow-up) Improve asset handling, add linting
Owen Leonard [Thu, 23 Jul 2020 17:58:22 +0000 (17:58 +0000)]
Bug 22660: (follow-up) Improve asset handling, add linting

This patch makes some changes to the way assets are included based on
the value of the system preferece in order to minimize unnecessary
JavaScript includes.

The patch also adds HTML syntax-highlighting and linting like we have in
the system preferences editor.

Removed are two JS files which were not required.

To test, apply the patch and set the NewsToolEditor preference to
"CodeMirror."

 - Edit a news item and confirm that the contents of the
   editor show HTML syntax highlighting.
 - Test HTML linting by adding some malformed HTML (missing closing tag,
   for instance). The error should be highlighted.
 - Set the NewsToolEditor to "TinyMCE" and confirm that WYSIWYG editing
   still works correctly.

https://bugs.koha-community.org/show_bug.cgi?id=22600

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>
4 years agoBug 22660: Add system pref to allow switching of editors in News Tool
Lucas Gass [Fri, 8 May 2020 22:57:40 +0000 (22:57 +0000)]
Bug 22660: Add system pref to allow switching of editors in News Tool

This patch adds a system preference called 'NewsToolEditor' which allows for the choice between TinyMCE and CodeMirror in the News Feature.

TEST PLAN:
1. Apply patch and run updatedatabase
2. Go to Tools > News and make a new entry or edit an existing News item.
3. When you initially load you should gte the TinyMCE editor (WYSIWYG)
4. Search for the NewsToolEditor system preference and switch to CodeMirror.
5. Reload your News item and now you should see the CodeMirror editor.
6. Try saving content with both and maki sure it works.
7. Try adding some different HTML tags in CodeMirror mode, saving, and making sure it looks right when you switch back to TinyMCE

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
4 years agoBug 25968: Make logs sort by date descending as a default
Owen Leonard [Fri, 10 Jul 2020 13:19:14 +0000 (13:19 +0000)]
Bug 25968: Make logs sort by date descending as a default

This patch adds DataTables with columns configuration to the log viewer.
The table of log entries is now sorted by default by date descending.

To test, apply the patch and go to Administration -> Table settings.

 - Expand the "Tools" section and confirm that there is a section for
   "logviewer."
 - Go to Tools -> Log viewer.
 - Perform a search which will return multiple results.
 - Confirm that the results are sorted by date descending.
 - Test that the table controls work correctly: Paging, columns, export.
 - Return to the Table settings administration page and test that
   changes to those settings are correctly reflected in the log viewer
   table.

Signed-off-by: barbara <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch: Fix indentation in .yml to match other entries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Compiled CSS
Jonathan Druart [Thu, 30 Jul 2020 15:40:18 +0000 (17:40 +0200)]
Bug 22087: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Add missing filters
Jonathan Druart [Mon, 27 Jul 2020 13:37:21 +0000 (15:37 +0200)]
Bug 22087: Add missing filters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Move the email into the list
Jonathan Druart [Tue, 7 Apr 2020 10:40:26 +0000 (12:40 +0200)]
Bug 22087: Move the email into the list

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Remove padding on li's
Jonathan Druart [Tue, 7 Apr 2020 10:40:24 +0000 (12:40 +0200)]
Bug 22087: Remove padding on li's

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Prevent variable names colision
Jonathan Druart [Tue, 7 Apr 2020 10:01:05 +0000 (12:01 +0200)]
Bug 22087: Prevent variable names colision

We should not use PROCESS:
http://www.template-toolkit.org/docs/manual/Directives.html

" The PROCESS directive is slightly faster than INCLUDE because it
avoids the need to localise (i.e. copy) the variable stash before
processing the template. "

The 'patron' variable is reused by patron-title.inc

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Add a no_line_break parameter to prevent new lines
Jonathan Druart [Mon, 6 Apr 2020 14:25:34 +0000 (16:25 +0200)]
Bug 22087: Add a no_line_break parameter to prevent new lines

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Add space between zipcode and country
Jonathan Druart [Mon, 6 Apr 2020 14:14:04 +0000 (16:14 +0200)]
Bug 22087: Add space between zipcode and country

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 22087: Use include file to display patrons address in search result
Jonathan Druart [Mon, 6 Apr 2020 14:00:13 +0000 (16:00 +0200)]
Bug 22087: Use include file to display patrons address in search result

In order to display the city and country in the patron search result, we
need to use the member-display-address-style include file, to satisfy
AddressFormat.

Test plan:
Modify some patrons and fill the different address info
Search for them and notice that the city, zipcode and country are now
displayed.
Modify the value of AddressFormat and confirm that the display is
modified according to its value

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26060: Compiled CSS
Jonathan Druart [Thu, 30 Jul 2020 15:40:02 +0000 (17:40 +0200)]
Bug 26060: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26060: Replace staff interface table sort icons with SVG
Owen Leonard [Fri, 24 Jul 2020 14:07:29 +0000 (14:07 +0000)]
Bug 26060: Replace staff interface table sort icons with SVG

This patch modifies the staff interface CSS to convert table sorting
icons from PNG to SVG. These icons are added via background-image
data-urls, so only the SCSS file is modified.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface).

 - Clear your browser cache if necessary
 - View any DataTable in the staff interface, for instance when checking
   out to a patron with existing checkouts, the catalog detail page for
   a title with holdings, the table of saved reports.
 - Confirm that the sorting icons in the table headers look correct in
   each state: Sorted ascending, sorted descending, and unsorted.

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>
4 years agoBug 25982: OPAC shelves RSS link output is xml
Didier Gautheron [Sun, 12 Jul 2020 12:09:15 +0000 (14:09 +0200)]
Bug 25982: OPAC shelves RSS link output is xml

Output rss feed as text/xml

Test plan:
1) have books entered
2) log in create a list
3) add books to list
4) display list in OPAC
5) click the RSS link button.
   -- output is displayed as html text
6) apply patch
7) repeat steps 4&5
   -- output is displayed as xml tree

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
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>
4 years agoBug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js
Owen Leonard [Thu, 18 Jun 2020 13:10:35 +0000 (13:10 +0000)]
Bug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js

This patch adds the necessary JavaScript includes to the OPAC to
enable translation of strings in JavaScript. It also updates the
translation of cart-related strings by removing the strings from
opac-bottom.inc and putting them in basket.js where they are used.

To test, apply the patch and test that the correct strings are
translatable. In this example I'm testing fr-FR:

 - Update a translation:

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

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

   #: koha-tmpl/opac-tmpl/bootstrap/js/basket.js:89
   msgid "Your cart is currently empty"
   msgstr ""

 - Edit the "msgstr" string however you want (it's just for testing)
 - Install the updated translation:

   > perl translate install fr-FR

In the OPAC, switch to the language you're testing. Confirm that your
translated string appears. In the above example, by clicking the "Cart"
icon in the header when there are no items in the cart.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21268: Don't remove 0 allocated funds from fund list
Jonathan Druart [Tue, 28 Jul 2020 07:23:35 +0000 (09:23 +0200)]
Bug 21268: Don't remove 0 allocated funds from fund list

If a fund is created with a amount of 0, it will not appear in the fund
list (when a new order is created for instance).
0 allocated funds can be used to track donations and other situations
where there is not an expected amount for the year.

Test plan:
0. Do not apply the patch
1. Create 1 active and 1 inactive budgets
2. Create some funds for each budgets, with amount > 0 and amount == 0
3. Add orders to basket
=> Note that the funds with amount == 0 are not displayed
4. Apply the patch
5. Add orders to basket (using the different possible ways we have)
=> Note that the funds with amount == 0 are displayed

This change is applied to the different views of the acquisition module.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25499: Fix fund code column when closing a budget
Katrin Fischer [Fri, 22 May 2020 23:12:22 +0000 (01:12 +0200)]
Bug 25499: Fix fund code column when closing a budget

When closing a budget the fund code column in the table is
always empty. This is due to a TT variable not being correct.

To test:
- Create a budget and fund
- Order anything, leave basket open or not, but don't receive
- Duplicate your existing budget
- Close the first budget in order to move the pending orders
- Verify the fund code is not showing in the table
- Apply patch and reload the patch
- Verify fund codes are now showing correctly

Bonus: Changes the column heading Fund id to Fund ID.

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25920: Add liblocale-codes-perl package to fix ubuntu-stable (focal)
Mason James [Fri, 3 Jul 2020 11:42:02 +0000 (23:42 +1200)]
Bug 25920: Add liblocale-codes-perl package to fix ubuntu-stable (focal)

to test on ubuntu-20...

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

2/ confirm liblocale-codes-perl pkg is not installed :(
 $ apt-cache policy  liblocale-codes-perl | grep Installed
 Installed: (none)

3/ apply patch

4/ build and install new koha-common pkg

5/ confirm liblocale-codes-perl pkg is now installed :)
 $ apt-cache policy  liblocale-codes-perl | grep Installed
 Installed: 3.62-1

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26063: Use Koha::Plugins->call for some other hooks
Jonathan Druart [Wed, 29 Jul 2020 13:11:24 +0000 (15:11 +0200)]
Bug 26063: Use Koha::Plugins->call for some other hooks

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26063: Use Koha::Plugins->call for circulation hooks
Tomas Cohen Arazi [Fri, 24 Jul 2020 19:00:52 +0000 (16:00 -0300)]
Bug 26063: Use Koha::Plugins->call for circulation hooks

This patch gets rid of a helper method used for calling the plugin
hooks.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21468: (QA follow-up) Simplify payload
Tomas Cohen Arazi [Thu, 23 Jul 2020 14:52:57 +0000 (11:52 -0300)]
Bug 21468: (QA follow-up) Simplify payload

This patch simplifies the payload as suggested on bug 25855. It also
keeps some specific params that cannot be deduced from the passed
checkout object, (e.g. if it is an onsite checkout).

Tests are cleared and added for this special exceptions.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21468: (QA follow-up) Enhance tests
Tomas Cohen Arazi [Wed, 15 Jul 2020 05:26:20 +0000 (02:26 -0300)]
Bug 21468: (QA follow-up) Enhance tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21468: Add 'checkin' action for _after_circ_actions
Martin Renvoize [Mon, 6 Jul 2020 12:46:47 +0000 (13:46 +0100)]
Bug 21468: Add 'checkin' action for _after_circ_actions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21468: Unit tests for AddReturn
Martin Renvoize [Mon, 6 Jul 2020 12:46:15 +0000 (13:46 +0100)]
Bug 21468: Unit tests for AddReturn

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21468: Add 'checkout' action for _after_circ_actions
Martin Renvoize [Mon, 6 Jul 2020 08:44:11 +0000 (09:44 +0100)]
Bug 21468: Add 'checkout' action for _after_circ_actions

This patch adds a call to _after_circ_actions into AddIssue and passes
an appropriate payload for plugins to utilise after issuing items.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21468: Unit tests for AddIssue
Martin Renvoize [Mon, 6 Jul 2020 10:43:25 +0000 (11:43 +0100)]
Bug 21468: Unit tests for AddIssue

This patch adds a unit test for the addition of a call to the
_after_circ_action hook in AddIssue.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24031: (QA follow-up) Add tests for the AddReserve intervention
Tomas Cohen Arazi [Fri, 24 Jul 2020 18:42:17 +0000 (15:42 -0300)]
Bug 24031: (QA follow-up) Add tests for the AddReserve intervention

This patch adds tests for AddReserve

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24031: Add hook to test plugin with unit test
Kyle M Hall [Fri, 17 Jul 2020 15:32:57 +0000 (11:32 -0400)]
Bug 24031: Add hook to test plugin with unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24031: Add safety checks in Koha::Plugins::call
Julian Maurice [Fri, 22 May 2020 10:29:11 +0000 (12:29 +0200)]
Bug 24031: Add safety checks in Koha::Plugins::call

- Check that the plugin has the method before calling it
- Call the method in an eval block to prevent fatal errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24031: Remove check for syspref UseKohaPlugins
Julian Maurice [Fri, 22 May 2020 10:28:17 +0000 (12:28 +0200)]
Bug 24031: Remove check for syspref UseKohaPlugins

UseKohaPlugins has been removed by bug 20415

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24031: Fix warnings
Kyle M Hall [Thu, 21 Nov 2019 13:08:38 +0000 (08:08 -0500)]
Bug 24031: Fix warnings

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24031: Add plugin hook after_hold_create
Julian Maurice [Wed, 13 Nov 2019 10:11:54 +0000 (11:11 +0100)]
Bug 24031: Add plugin hook after_hold_create

It is called after a hold has been placed

Test plan:
1. Write a plugin that implements only after_hold_create (see
   `perldoc Koha::Plugins` for implementation details). Install it and
   enable it
2. Place a hold and verify that your plugin method has been called with
   the right parameters

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25855: (QA follow-up) Simplify payload
Tomas Cohen Arazi [Thu, 23 Jul 2020 14:00:11 +0000 (11:00 -0300)]
Bug 25855: (QA follow-up) Simplify payload

This patch makes the hook be passed the Koha::Checkout object instead
of a hand-crafted list of attributes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25855: (QA follow-up) Generalize hook and simplify tests
Tomas Cohen Arazi [Fri, 3 Jul 2020 13:26:06 +0000 (10:26 -0300)]
Bug 25855: (QA follow-up) Generalize hook and simplify tests

This patch generalizes the hook so it can be used by other circulation
actions.

Tests are also simplified by mocking some of the (extensive) plugin
hooks.

To test:
1. Repeat the test plan on the original patch
=> SUCCESS: All good
2. 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>
4 years agoBug 25855: Add a post_renewal_action plugin hook
Tomas Cohen Arazi [Tue, 23 Jun 2020 19:23:06 +0000 (16:23 -0300)]
Bug 25855: Add a post_renewal_action plugin hook

This patch adds a new hook to notify plugins about renewal actions. To
test it:

1. Apply the unit tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> FAIL: The tests expect some warnings to show, and they don't (i.e.
        the sample plugin hook is not being called).
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The hook is being called on renewal!
5. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25855: Unit tests
Tomas Cohen Arazi [Tue, 23 Jun 2020 19:18:54 +0000 (16:18 -0300)]
Bug 25855: Unit tests

This patch adds tests fr a new circulation hook for plugins.
In this case the post_renewal_action hook,

The tests add the hook to the Test plugin, and verify that all the
required parameters are passed for the plugin hook to use them.
It relies on throwing an exception that is to be caught.

Sponsored-by: ByWater Solutions
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25961: Add hooks for plugins to inject variables to OPAC XSLT
Tomas Cohen Arazi [Wed, 8 Jul 2020 19:54:51 +0000 (16:54 -0300)]
Bug 25961: Add hooks for plugins to inject variables to OPAC XSLT

This patch adds the following plugin hooks:
- opac_results_xslt_variables
- opac_detail_xslt_variables

This hooks will inject variables returned by the plugin in the form of a
hashref, into the ones that are passed to the XSLT processing code.

To test:
1. Apply the 'DO NOT PUSH' commit
2. Install the Kitchensink plugin
3. Restart all
4. Search biblios in the OPAC
=> SUCCESS: A text is injected in front of the biblio title
5. Enter the detail page of any of the results
=> SUCCESS: A text is injected in front of the biblio title
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24157: DBRev 20.06.00.018
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000 (15:21 +0000)]
Bug 24157: DBRev 20.06.00.018

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24157: Handle the case where logged in user does not have edit_invoices
Jonathan Druart [Fri, 24 Jul 2020 11:03:31 +0000 (13:03 +0200)]
Bug 24157: Handle the case where logged in user does not have edit_invoices

This patch make possible the reopening and merging of invoices even if
the logged in user does not have the edit_invoices permission

I don't think it really makes sense but at least it's now possible.

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24157: (follow-up) New permission - delete_invoices
Jonathan Druart [Tue, 21 Jul 2020 09:09:50 +0000 (11:09 +0200)]
Bug 24157: (follow-up) New permission - delete_invoices

Hide the "Delete" invoice link if necessary on
/cgi-bin/koha/acqui/invoice.pl?invoiceid=X

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24157: New permission - merge_invoices
Jonathan Druart [Tue, 21 Jul 2020 09:03:07 +0000 (11:03 +0200)]
Bug 24157: New permission - merge_invoices

Add a new permission to merge invoices

Test plan:
- Remove the new permission "merge_invoices" for a given patron,
use it to log in into Koha
- Create 2 invoices, try to merge them
=> There is no way to merge it
- Add the permission
=> Now you can merge the invoices

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24157: (follow-up) Conditionally show controls to reopen and close invoice
Owen Leonard [Fri, 6 Mar 2020 19:13:35 +0000 (19:13 +0000)]
Bug 24157: (follow-up) Conditionally show controls to reopen and close invoice

This follow-up makes minor changes to the template so that the checkbox
for reopening or closing an invoice are not displayed when the user
doens't have the correct permissions.

To test, apply the patch and try the process of viewing or editing an
invoice as a user with these various permissions:

 - edit_invoices ON
 - edit_invoices OFF
 - reopen_closed_invoices ON
 - reopen_closed_invoices OFF

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24157: New permission - delete_baskets
Jonathan Druart [Wed, 11 Dec 2019 15:39:36 +0000 (16:39 +0100)]
Bug 24157: New permission - delete_baskets

Add a new permission to delete acquisition baskets

Test plan:
- Remove the new permission "delete_basket" for a given patron,
use it to log in into Koha
- Create basket, try to delete it
=> There is no way to delete it
- Add the permission
=> Now you can delete the basket

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>