koha.git
4 years agoBug 23204: Add script for exporting Elasticsearch mappings
Alex Arnaud [Tue, 25 Jun 2019 14:14:19 +0000]
Bug 23204: Add script for exporting Elasticsearch mappings

Test plan:

  - launch perl misc/search_tools/export_elasticsearch_mappings.pl >
    /path/to/my_mappings.yaml
  - set koha-conf.elasticsearch_index_mappings to
    /path/to/my_mappings.yaml,
  - go to admin -> Search engine configuration,
  - click on "Reset mappins",
  - check that your search fields and mappings are as expected

Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24700: Avoid validating REST API spec multiple times
Ere Maijala [Thu, 20 Feb 2020 14:17:58 +0000]
Bug 24700: Avoid validating REST API spec multiple times

This patch changes the spec loading so that it is fully loaded and merged with any plugin routes before validation. The individual parts are separately validated only if the resulting complete spec is invalid. Note: the OpenAPI plugin validates the spec given to it, so normally no manual validation is necessary.

Test plan:
1. prove -v t/db_dependent/Koha/REST/*
2. prove -v t/db_dependent/api/v1/*

Sponsored-by: The National Library of Finland
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24982: (follow-up) Retain checkbox selections after for submit
Kyle M Hall [Thu, 26 Mar 2020 15:14:59 +0000]
Bug 24982: (follow-up) Retain checkbox selections after for submit

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24982: (follow-up) Move checkboxes to left side of label
Kyle M Hall [Thu, 26 Mar 2020 13:49:04 +0000]
Bug 24982: (follow-up) Move checkboxes to left side of label

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24982: (follow-up) Give checkboxes more structured layout
Owen Leonard [Thu, 26 Mar 2020 12:48:02 +0000]
Bug 24982: (follow-up) Give checkboxes more structured layout

This patch makes minor markup changes and adds some CSS so that the
module and actions checkboxes are laid out a little more clearly.

The patch includes some whitespace changes, so diff accordingly.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24982: Use checkboxes in Log Viewer
Aleisha Amohia [Tue, 24 Mar 2020 16:00:41 +0000]
Bug 24982: Use checkboxes in Log Viewer

So we can see all options at once, and more easily select more than one
option.

Test plan:
1) Go to Tools -> Log viewer
2) Notice the new checkboxes under Modules, Actions and Interface. 'All'
should be selected by default for all three options
3) Confirm you can deselect 'All' and the other options are enabled.
Confirm selection all of the other options automatically selects 'All'
and disables the options again.
4) Confirm the results still work as expected when clicking 'Submit'
button

Sponsored-by: Catalyst IT
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24765: Updated on date in Claims returned starts off as 12/31/1969
Kyle M Hall [Mon, 2 Mar 2020 14:36:47 +0000]
Bug 24765: Updated on date in Claims returned starts off as 12/31/1969

When an item is claimed returned by staff, there is a column called Updated On - this date field column should remain blank until this claimed returned has been updated.  Currently, when an item has been claimed returned, the date in the updated column states 12/31/1969. This date only shows up in the display, it is doesn't show up in the database like this.

Test Plan:
1) Enable return claims
2) Make a claim
3) Note the 'updated on' column has the date 1969-12-31
4) Apply this patch
5) Reload the page ( you may need to clear your browser cache )
6) Note the field is now blank

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22001: (RM follow-up) Allow RaiseError tests in Reports/Guided.t
Martin Renvoize [Fri, 27 Mar 2020 11:12:41 +0000]
Bug 22001: (RM follow-up) Allow RaiseError tests in Reports/Guided.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22001: Enable RaiseError for tests
Jonathan Druart [Fri, 14 Dec 2018 16:30:02 +0000]
Bug 22001: Enable RaiseError for tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22001: Add tests
Jonathan Druart [Fri, 14 Dec 2018 16:30:27 +0000]
Bug 22001: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22001: Remove the RaiseError occurrences from tests
Jonathan Druart [Fri, 14 Dec 2018 16:30:52 +0000]
Bug 22001: Remove the RaiseError occurrences from tests

Unless it is needed!
Also remove $dbh when not used later.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22685: Use DBIx::Class relationships in Koha::Acq::Bookseller methods
Jonathan Druart [Thu, 30 Jan 2020 11:26:57 +0000]
Bug 22685: Use DBIx::Class relationships in Koha::Acq::Bookseller methods

To match PERL15 we change the behavior of Koha::Object methods to make
them use the DBIx::Class relationships.

Test plan:
- Create a vendor, basket and contact
- Edit the vendor => the contact must appears
- Go to the view of a vendor => you cannot delete the vendor, it has
a basket attached
- Create another vendor, without basket
- Go to the view of the vendor => You can delete it

Additionally:
 % prove t/db_dependent/Koha/Acquisition/Booksellers.t
must return green

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20648: Attribute option 'Display in check-out' should be renamed
David Roberts [Wed, 25 Mar 2020 21:14:06 +0000]
Bug 20648: Attribute option 'Display in check-out' should be renamed

This patch rewords the 'Display in check-out' option in the patron
attribute policy

To test:

1) Apply patch
2) Go to /cgi-bin/koha/admin/patron-attr-types.pl?op=add_attribute_type
3) Check that the 8th line down has been renamed to "Display in patron's
brief information:"
4) Check the description of this same option has been changed to "Check
to show this attribute in the brief information panel in the patron's
record (staff client)."

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24475: Cronjobs don't always live in misc
Kyle M Hall [Thu, 26 Mar 2020 11:41:46 +0000]
Bug 24475: Cronjobs don't always live in misc

In git installs, cronjobs live in misc, but for package installs, they
live under bin. Let's just still with 'misc/cronjobs' which is always
cromulent.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24475: Reword FinesMode system preference
David Roberts [Wed, 25 Mar 2020 21:59:22 +0000]
Bug 24475: Reword FinesMode system preference

This patch changes the wording of the FinesMode and
CalculateFinesOnReturn system preferences explanations

1) Install Patch
2) Check that the wording of the FinesMode system preference has changed
to "NOTE: If the misc/cronjobs/fines.pl cronjob is being run, accruing
and final fines will be calculated when the cron runs and accruing fines
will be finalized when an item is returned. If CalculateFinesOnReturn is
enabled, final fines will be calculated when an item is returned."
3) Check that the wording of the CalculateFinesOnReturn system
preference has changed to add "NOTE: This system preference requires
FinesMode to be set to 'Calculate and charge.'" to the existing note.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24905: Make installer update log4perl.conf for instances
Tomas Cohen Arazi [Thu, 19 Mar 2020 13:51:40 +0000]
Bug 24905: Make installer update log4perl.conf for instances

This patch makes koha-common.postinst check if the log4perl.conf files
on the instances need tweaking. If they do, it appends the relevant
configuration text.

To test:
1. Install Koha 19.11 or earlier using the packages
2. Create an instance:
   $ koha-create --create-db test1
   $ koha-create --create-db test2
=> FAIL: /etc/koha/sites/test1/log4perl.conf doesn't include an entry for
z39.50
3. Apply this patch and run:
   $ docker run \
      --volume=/path/to/your/clone:/koha \
      --volume=/dest/path/for/debs:/debs \
      --privileged
      --env VERSION=19.12.00.047 \
      koha/koha-dpkg:master
Note: Paths need to be adjusted
4. Grab the .deb files and put them on the machine you're testing this
5. Edit /etc/koha/sites/test2/log4perl.conf and add the following text
   at the bottom: log4perl.logger.z3950
6. Install the debs:
   $ sudo dpkg -i koha-perldeps koha-deps koha-common
=> SUCCESS: Install process doesn't explode due to the addition
=> SUCCESS: /etc/koha/sites/test1/log4perl.conf has a new entry for log4perl.logger.z3950
=> SUCCESS: /etc/koha/sites/test2/log4perl.conf doesn't have a new entry for log4perl.logger.z3950
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24905: Add missing entry in log4perl-site.conf.in
Tomas Cohen Arazi [Thu, 19 Mar 2020 12:47:25 +0000]
Bug 24905: Add missing entry in log4perl-site.conf.in

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24988: Default to autorenew_checkouts for new patrons
Nick Clemens [Thu, 26 Mar 2020 13:38:07 +0000]
Bug 24988: Default to autorenew_checkouts for new patrons

To recreate:
1 - Create a new patron on the staff interface
2 - Note that 'Allow auto-renewal of items' defaults to 'no'
3 - Apply patch
4 - Create another patron
5 - 'Allow auto-renewal of items' defaults to 'yes'

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24964: Fix perl critic warning
Kyle M Hall [Thu, 26 Mar 2020 12:53:59 +0000]
Bug 24964: Fix perl critic warning

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24964: Prevent random failures sorting by borrowernumber
Jonathan Druart [Wed, 25 Mar 2020 12:50:45 +0000]
Bug 24964: Prevent random failures sorting by borrowernumber

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24964: Do not filter patrons after they have been fetched
Jonathan Druart [Wed, 25 Mar 2020 10:21:15 +0000]
Bug 24964: Do not filter patrons after they have been fetched

The svc/members/search script is called in different places.
In some places (Set owner for a fund, add users to a fund, or set a
manager to a suggestion), we need patrons to be filtered depending on
the permissions they have.
For instance you can only set a fund's owner with a patron that has
acquisition.order_manage.

Currently we have fetching X (default 20) patrons, then filter them
depending on their permission.
Says you have 3 patrons that have the correct permissions but are not in
the 20 first patrons, if you do not define a search term, the search
result will be empty.

This is not ideal and we should filter when requesting the DB.

Test plan:
- Have more than 20 patrons, remove them their permissions
- Create 3 more:
1 superlibrarian
1 with the full acq permission
1 with acquisition.order_manage
- Create a fund and set a owner
- Search for patrons, without specifying a search term (to get them all)
=> Without this patch the new patrons you created are not displayed
=> With this patch they are!

Same test plan apply to set a manager to a suggestion (freshly pushed,
see bug 23590), with suggestions and suggestions.suggestions_manage

Note: The code has been written that way to rely on
C4::Auth::haspermission, but the SQL query is quite trivial and the gain
is important.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24964: Add tests
Jonathan Druart [Wed, 25 Mar 2020 10:20:20 +0000]
Bug 24964: Add tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24976: Guided report - "Save" button on last step is misleading
David Roberts [Wed, 25 Mar 2020 20:52:19 +0000]
Bug 24976: Guided report - "Save" button on last step is misleading

This patch changes the text of the save button on the final step.

To test:

1) Build a guided report (the selections are immaterial)
2) Note that after you have been through the six stages, the button on
the "Confirm custom report" screen should be labelled "Save"
3) Install patch
4) Repeat Step 1. Note that on the "Confirm custom report" screen, the
button is now labelled "Next".
5) Run the report to check that the functionality still works.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years ago Bug 20415: (follow-up) DBRev 19.12.00.056
Jonathan Druart [Fri, 27 Mar 2020 07:20:47 +0000]
 Bug 20415: (follow-up) DBRev 19.12.00.056

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

4 years agoBug 13881: (RM followup) Fix incorrect idempotency test
Martin Renvoize [Thu, 26 Mar 2020 15:51:54 +0000]
Bug 13881: (RM followup) Fix incorrect idempotency test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20399: (RM follow-up) Fix update statement
Martin Renvoize [Thu, 26 Mar 2020 15:29:04 +0000]
Bug 20399: (RM follow-up) Fix update statement

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 14715: DBRev 19.12.00.058
Martin Renvoize [Thu, 26 Mar 2020 12:01:57 +0000]
Bug 14715: DBRev 19.12.00.058

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 14715: (QA follow-up) Remove limit on Zebra
Katrin Fischer [Wed, 25 Mar 2020 20:47:40 +0000]
Bug 14715: (QA follow-up) Remove limit on Zebra

Found in testing that this appears to work well for Elasticsearch -
so removing everything that made this Zebra only.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 14715: (QA follow-up) Add missing filters
Katrin Fischer [Wed, 25 Mar 2020 20:08:53 +0000]
Bug 14715: (QA follow-up) Add missing filters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 14715: (follow-up) Keep results per page setting when selecting facets and sortin...
Aleisha Amohia [Tue, 25 Feb 2020 20:40:57 +0000]
Bug 14715: (follow-up) Keep results per page setting when selecting facets and sorting results

Also adding missing filters

ALSO ensuring you can switch back to library default on staff side

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 14715: Results per page dropdown for catalogue search
Aleisha Amohia [Tue, 5 Nov 2019 02:53:26 +0000]
Bug 14715: Results per page dropdown for catalogue search

This patch utilises an unused search facet to handle results shown per
page.

Sponsored-by: Region Halland
Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 16457: (follow-up) Enable click event on dynamically-created elements
Owen Leonard [Tue, 24 Mar 2020 12:14:21 +0000]
Bug 16457: (follow-up) Enable click event on dynamically-created elements

This patch moves the click handler for patron attribute actions ("new",
"clear") from the links themselves to the container. This allows jQuery
to correctly target dynamically-created copies of the links.

To test you should have extended patron attributes enabled and you
should have some repeatable attributes defined.

 - Create or edit a patron record
 - In the "Additional attributes and identifiers" section, test the
   "Clear" and "New" links. Confirm that the controls work with both the
   original instance of the field and those created by clicking "New."

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 16457: Remove the use of "onclick" from the patron entry form
Owen Leonard [Tue, 17 Mar 2020 23:57:06 +0000]
Bug 16457: Remove the use of "onclick" from the patron entry form

This patch removes several event attributes from the patron entry form
and replaces them with event handlers in the <script> block.

Some event attributes were removed altogether because they weren't
functional: Onchange events on jQueryUI datepickers don't work, and they
would have been redundant even if they did work.

To test you should have some patron attributes configured
(Administration -> Patron attribute types). At least one attribute
should be configured to apply to one particular patron category.

Apply the patch and begin the process of adding a new patron.

1. Try to add a patron with details matching a patron which already
   exists. You should get a confirmation message on screen which asks if
   the patron is a duplicte. Test the link which shows the existing
   record. It should trigger a popup window with details about the
   patron.

2. Test the process of setting a patron's date of birth. Selecting a
   date should trigger the display of the patron's age immedately below
   the field.

3. Test that you cannot set a patron's expiration to a date which
   precedes the date in the registration date field.

4. Test that you can add a manual restriction's expiration date, and
   that the "Clear date" link works correctly.

5. Test that the "clear" and "new" controls links work with additional
   attributes and identifiers.

6. Test that changing the patron's category correctly affects the
   display of available attributes and identifiers: The attribute you
   have associated with a particular patron category should only show if
   that category is selected under "Category."

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20399: DBRev 19.12.00.057
Martin Renvoize [Thu, 26 Mar 2020 11:57:26 +0000]
Bug 20399: DBRev 19.12.00.057

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20399: (QA follow-up) Remove mention of INTRAdidyoumean from text and delete...
Katrin Fischer [Wed, 25 Mar 2020 20:34:46 +0000]
Bug 20399: (QA follow-up) Remove mention of INTRAdidyoumean from text and delete commented code

Removes some last "remains" of INTRAdidyoumean.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20399: Remove "did you mean" for the staff interface
Fridolin Somers [Thu, 19 Mar 2020 14:59:39 +0000]
Bug 20399: Remove "did you mean" for the staff interface

The amdin page for the "did you mean" feature has two block for setting it up in the staff interface, and a note saying this isn't implemented on the staff interface yet.
We remove the part about the staff interface until it actually is implemented.

Test plan :
1) Apply patch
2) Go to Administration > Did you mean?
3) See there is only the OPAC block
4) Change some checkboxes
5) Save configuration
6) Check that configuration is saved

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20415: DBRev 19.12.00.056
Martin Renvoize [Thu, 26 Mar 2020 11:54:44 +0000]
Bug 20415: DBRev 19.12.00.056

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20415: Add POD
Kyle M Hall [Wed, 25 Mar 2020 13:27:30 +0000]
Bug 20415: Add POD

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20415: Remove UseKohaPlugins system preference
Fridolin Somers [Thu, 19 Mar 2020 14:22:30 +0000]
Bug 20415: Remove UseKohaPlugins system preference

Owen Leonard 2018-03-16 10:47:47 UTC :
<<
I don't think the system preference adds any security. There are already multiple permissions required for working with plugins:

- Configure plugins
- Manage plugins ( install / uninstall )
- Use report plugins
- Use tool plugins

And even with those permissions your server must be configured to allow the use of plugins.
>>

Test plan :
1) Install kitchen sink plugin https://github.com/bywatersolutions/koha-plugin-kitchen-sink
2) Run misc/devel/install_plugins.pl
3) Set config enable_plugins=1
4) Check all parts of the plugin are working
5) Set config enable_plugins=0
6) Check all parts of the plugin are disabled

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20415: add Koha.ArePluginsEnabled Template Toolkit method
Fridolin Somers [Thu, 19 Mar 2020 14:01:13 +0000]
Bug 20415: add Koha.ArePluginsEnabled Template Toolkit method

In order to remove UseKohaPlugins syspref, adds to Koha Template Toolkit
plugin a method ArePluginsEnabled().

Test plan:
1) Set syspref UseKohaPlugins enabled
2) Set config enable_plugins=1
3) Check you see "Tool plugins" in "Tools" home page and menu
4) Check you see "Manage plugins" in "Koha administration" home page
5) Check you see "Report plugins" in "Reports" home page and menu
6) Set config enable_plugins=0
7) Check you don't see in 3) 4) 5)
8) Run prove t/Koha_Template_Plugin_Koha.t

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24614: Use Koha::Reports from save_report and update_sql
Jonathan Druart [Tue, 11 Feb 2020 16:21:38 +0000]
Bug 24614: Use Koha::Reports from save_report and update_sql

In order to get the default value defined at DBMS level, we use
Koha::Reports (to inherit from Koha::Object->store) from the 2 add/edit
methods of C4::Reports::Guided.
A second step would be to remove completely those CRUD subroutines and
use directly Koha::Reports instead.

Test plan:
1. Add and edit some reports
2. Disable memcached, create a report, edit it
=> Should not crash
3. Make sure the tests make sense and that they pass after the second
patch.

The error was:
DBD::mysql::db do failed: Column 'cache_expiry' cannot be null [for
Statement "UPDATE saved_sql SET savedsql = ?, last_modified = now(),
report_name = ?, report_group = ?, report_subgroup = ?, notes = ?,
cache_expiry = ?, public = ? WHERE id = ? "] at
/kohadevbox/koha/C4/Reports/Guided.pm line 633.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24614: Add tests
Jonathan Druart [Tue, 11 Feb 2020 16:21:15 +0000]
Bug 24614: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24829: ClaimReturnedWarningThreshold is always triggered if patron has one or...
Kyle M Hall [Mon, 9 Mar 2020 13:33:54 +0000]
Bug 24829: ClaimReturnedWarningThreshold is always triggered if patron has one or more claims

ClaimReturnedWarningThreshold is supposed to display a warning if a patron has more than the number of claims specified in the system preference. Currently the warning is displayed for any number of claims over zero.

Test Plan:
1) Make 3 return claims for a patron
2) Set ClaimReturnedWarningThreshold to 4
3) Note the claims warning displays for the patron on circulation.pl
4) Apply this patch
5) Reload circulation.pl, the warning should go away
6) Set ClaimReturnedWarningThreshold to 2
7) Reload the page, the warning should reappear

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24959: Fix id/label pairs in saved reports table
Owen Leonard [Mon, 23 Mar 2020 20:10:15 +0000]
Bug 24959: Fix id/label pairs in saved reports table

This patch adds a unique id attribute to each checkbox in the table of
saved reports. Also updated is the corresponding <label>'s "for"
attribute so that clicking the report id will toggle the checkbox.

To reproduce, go to Reports -> Use saved and click a number in the ID
column. Nothing happens.

After applying the patch clicking the number should check or uncheck the
corresponding checkbox.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works Ok, no errors.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24878: Add auth check for copy-holidays
Jonathan Druart [Tue, 17 Mar 2020 10:37:12 +0000]
Bug 24878: Add auth check for copy-holidays

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24878: Add authentication checks to the calendar tool
Jonathan Druart [Mon, 16 Mar 2020 15:26:48 +0000]
Bug 24878: Add authentication checks to the calendar tool

There is a security hole in 2 scripts that are used by the UI to edit
holidays.

To test:
1) Go to Tools -> Calendar, for Centerville
   Check no holiday for 30/4/2020
2) To add a new holiday without login execute
   a curl command with necessary parameters
3) Reload page from 1), verify the new holiday
   edit and delete the holiday
4) Apply the patch
5) Do 2) again, this time you get a lengthy output,
   with the magic words:

   <title>Koha &rsaquo;
       Log in to Koha
   </title>

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24673: Add CSRF token support to opac-messaging.pl
David Cook [Mon, 17 Feb 2020 06:50:49 +0000]
Bug 24673: Add CSRF token support to opac-messaging.pl

This patch adds CSRF token support to opac-messaging.pl,
which allows users to manually update their messaging preferences,
but prevents bad actors from tricking people into updating their
preferences from cross-site requests.

Test plan:
0. Set SMSSendDriver global system preference to "Test" if unset
1. Log into the OPAC
2. Navigate to a URL in your browser like the following:
http://localhost:8080/cgi-bin/koha/opac-messaging.pl?modify=yes
&1=email&digest=1&2-DAYS=5&2=email&digest=2&4=email&SMSnumber=0444444444
3. Observe that the preference and SMS number update

4. Apply the patch

5. Navigate to a URL in your browser like the following:
http://localhost:8080/cgi-bin/koha/opac-messaging.pl?modify=yes
&1=email&digest=1&2-DAYS=5&2=email&digest=2&4=email&SMSnumber=0444444444
6. Observe that you get an error message of "Wrong CSRF token" instead
of the previous behaviour
7. Navigate to a URL in your browser like the following:
http://localhost:8080/cgi-bin/koha/opac-messaging.pl
8. Update "Advance notice" to 3 and update "SMS number" to 61111111111
9. Observe that the "Advance notice" and "SMS number" fields update
correctly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24801: Display all the libraries - Selenium fix
Jonathan Druart [Thu, 26 Mar 2020 08:59:32 +0000]
Bug 24801: Display all the libraries - Selenium fix

Same as for categories.

22:41:28 koha_1       | STRACE: /usr/share/perl5/Try/Tiny.pm:104 in Selenium::Remote::Driver::catch {...}
22:41:28 koha_1       |  /usr/local/share/perl/5.20.2/Selenium/Remote/Driver.pm:353 in Try::Tiny::try
22:41:28 koha_1       |  (eval 1337):1 in Selenium::Remote::Driver::__ANON__
22:41:28 koha_1       |  (eval 1339):2 in Selenium::Remote::Driver::__ANON__
22:41:28 koha_1       |  /usr/local/share/perl/5.20.2/Selenium/Remote/Driver.pm:1330 in Selenium::Remote::Driver::_execute_command
22:41:28 koha_1       |  /usr/local/share/perl/5.20.2/Selenium/Remote/Driver.pm:1330 in (eval)
22:41:28 koha_1       |  /kohadevbox/koha/t/lib/Selenium.pm:174 in Selenium::Remote::Driver::find_element
22:41:28 koha_1       |  /kohadevbox/koha/t/lib/Selenium.pm:166 in t::lib::Selenium::click_when_visible
22:41:28 koha_1       |  t/db_dependent/selenium/administration_tasks.t:128 in t::lib::Selenium::click
22:41:28 koha_1       |
22:41:28 selenium_1   | 14:41:28.273 INFO - Executing: [take screenshot])
22:41:28 selenium_1   | 14:41:28.873 INFO - Done: [take screenshot]
22:41:31 koha_1       |
22:41:31 koha_1       | SCREENSHOT: https://framapic.org/0nvX5dhLHpU1/tAEnENSeLRXB
22:41:31 koha_1       | An element could not be located on the page using the given search parameters: //div[@class="main container-fluid"]//a[contains(@href, "/admin/branches.pl?op=add_form&branchcode=UT_BC")],xpath at /kohadevbox/koha/t/lib/Selenium.pm line 174.

The screenshot was obvious, the UT_BC was not on the first page.
There was a total of 33 libraries at this point, which is not expected,
maybe data not deleted from previous selenium tests.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24455: (follow-up) Document function
Martin Renvoize [Wed, 25 Mar 2020 13:40:04 +0000]
Bug 24455: (follow-up) Document function

This patch just adds some minimal documentation to the main exported JS
function.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24455: Add Moment.js to About page
Kyle M Hall [Wed, 4 Mar 2020 13:51:42 +0000]
Bug 24455: Add Moment.js to About page

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24455: Add JS functions to format date and datetime strings
Agustin Moyano [Fri, 17 Jan 2020 19:19:30 +0000]
Bug 24455: Add JS functions to format date and datetime strings

This patch adds the a js-date-format.inc file on each opac and staff interface (date-format.inc whas not available as name)

When you include that file in your TT, you'll get the following functions available:

1. $date(raw_date_string, options)

   This function parses a date string, as produced by an api call, and returns the corresponding date formatted according to 'dateformat' and 'TimeFormat' parameters.

   For example:

   // dateformat: us
   // timeformat: 12hr
   // Timezone: UTC

   $date('2020-03-23T15:00:00+01:00') // You will get '03/23/2020'

   $date('2020-03-23T15:00:00+01:00', {withtime: true}) // You will get '03/23/2020 14:00'

   $date('2020-03-23T15:00:00+01:00', {withtime: true, tz: 'Europe/Paris'}) // You will get '03/23/2020 15:00+01:00'

   Options:

   * dateformat: override date format as configured in staff interface (accepts also 'rfc3339')

   * timeformat: override time format as configured in staff client (available options are '12hr' and '24hr')

   * withtime: also print the time part (default false)

   * tz: set the timezone

2. $datetime(raw_date_string, option)

   The same as $date but sets withtime to true

3. $time(raw_date_string, option)

   The same as $datetime but shows only the time part

To test you must implement and test bug 20936, where it will be used

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24455: Add moment-timezone library in staff
Agustin Moyano [Fri, 17 Jan 2020 21:04:55 +0000]
Bug 24455: Add moment-timezone library in staff

This patch adds koha-tmpl/intranet-tmpl/lib/moment/moment-timezone-with-data-10-year-range.min.js in order to use the moment library with timezones (https://momentjs.com/timezone/)

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24455: Add moment-timezone library in opac
Agustin Moyano [Fri, 17 Jan 2020 19:19:30 +0000]
Bug 24455: Add moment-timezone library in opac

This patch adds koha-tmpl/opac-tmpl/bootstrap/lib/moment-timezone-with-data-10-year-range.min.js in order to use the moment library with timezones (https://momentjs.com/timezone/)

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24455: Add moment library in staff
Agustin Moyano [Fri, 17 Jan 2020 21:03:48 +0000]
Bug 24455: Add moment library in staff

This patch adds koha-tmpl/intranet-tmpl/lib/moment/moment.min.js in order to use the moment library (https://momentjs.com/)

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24455: Add moment library in opac
Agustin Moyano [Fri, 17 Jan 2020 19:19:30 +0000]
Bug 24455: Add moment library in opac

This patch adds koha-tmpl/opac-tmpl/bootstrap/lib/moment.min.js in order to use the moment library (https://momentjs.com/)

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24886: (follow-up) Add markup comments
Owen Leonard [Mon, 23 Mar 2020 19:48:25 +0000]
Bug 24886: (follow-up) Add markup comments

This patch adds comments to the template to highlight the markup
structure.

This patch should have no effect on the interface or functionality.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24886: Reindent reports template
Owen Leonard [Tue, 17 Mar 2020 00:55:05 +0000]
Bug 24886: Reindent reports template

This patch reindents the template for saved reports, replacing tabs with
spaces and making indentation consistent. Some lines have been split up.

To test, apply the patch and go to Reports -> Use saved.

 - Test adding, editing, viewing, and running reports
 - Test filtering by group and subgroup
 - Test the process of adding a guided report

 Everything should work as expected.

 Use your preferred method for checking the differences between files
 while ignoring whitespace. I use diff with the  "-w" flag, but I'm not
 your dad. The only changes you see should be split lines.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24158: Add missing html filters
Jonathan Druart [Mon, 23 Mar 2020 08:33:27 +0000]
Bug 24158: Add missing html filters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24158: Convert actual cost in an other currency when receiving
Jonathan Druart [Wed, 4 Dec 2019 16:40:17 +0000]
Bug 24158: Convert actual cost in an other currency when receiving

This patch adds a currency dropdown list to the Actual cost field when
receiving items in the acquisition module.
The idea is to let the librarian entered a price in a foreign currency
that will automatically be converted in the local currency ('active').
This converted value will be use as the actual cost once the form is
submitted.

Test plan:
- Create several currencies with different rates
- Create an order, close the basket and receive
- On the receipt page you will notice a new "change currency" checkbox
right close to the 'Actual cost' input.
- Check it
=> The 'Actual cost' input is readonly and a new line appears at the
bottom.
- Enter a number and select a currency
=> The 'Actual cost' input is automatically filled with the converted
value
- Save
=> The converted Actual cost has been inserted in the database.

Sponsored-by: Athlone Institute of Technology
Signed-off-by: Devinim <nazli@devinim.com.tr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24828: Add ability to specify cash register in SIP config
Martin Renvoize [Mon, 9 Mar 2020 14:53:05 +0000]
Bug 24828: Add ability to specify cash register in SIP config

This patch adds the ablity to specify a cash register id to link to
payments taken via SIP2 clients.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Add notice template for translated installer files
Jonathan Druart [Wed, 25 Mar 2020 11:45:13 +0000]
Bug 23590: Add notice template for translated installer files

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23355: (RM follow-up) Make DB update idempotent
Martin Renvoize [Wed, 25 Mar 2020 11:19:17 +0000]
Bug 23355: (RM follow-up) Make DB update idempotent

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24745: (follow-up) Correct return statement in news plugin
Owen Leonard [Tue, 24 Mar 2020 12:42:11 +0000]
Bug 24745: (follow-up) Correct return statement in news plugin

Subroutine should "return;" instead of "return 0;"
We also prevent ProhibitExplicitReturnUndef by not returning "undef"
explicitly.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24745: OPAC news block plugin should evaluate as false if there are no items
Owen Leonard [Thu, 27 Feb 2020 01:31:37 +0000]
Bug 24745: OPAC news block plugin should evaluate as false if there are no items

This patch changes the way news is returned from GetNewsToDisplay in
KohaNews.pm so that the template variable will evaluate as false instead
of simply being an empty data structure.

To verify the bug, remove your opacheader news entry and view source on
any page in the OPAC. You should find some empty markup right after
'</div> <!-- /navbar -->'

<div class="container-fluid">
    <div class="row-fluid">
    </div>
</div>

To test the fix, apply the patch and reload the OPAC page. The empty
divs should be gone. Add content to the opacheader news item and confirm
that it displays correctly.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24185: Make holds page fast when 'on shelf holds' set to 'If all unavailable'
Andrew Nugged [Tue, 14 Jan 2020 22:50:49 +0000]
Bug 24185: Make holds page fast when 'on shelf holds' set to 'If all unavailable'

When "reserve/request.pl -> C4/Reserves.pm::IsAvailableForItemLevelRequest" called many times with hundred of items and "on shelf holds" parameter set to "If all unavailable" for these items + patron, it goes slow.

It happens because in subloop it is checking if all items available so it is O(n^2) and it re-checks each time the same info for each item with repeating DB/data requests.

Fix:
The inner loop 1:1 picked out into separate subroutine and called outside of the loop, saving data in 'items_any_available' variable once, this variable passed to IsAvailableForItemLevelRequest to be used inside as the precalculated result.

This made algorithm O(n) instead of O(n^2) so there is noticeable speed increase.

How to reproduce:

1) on freshly installed kohadevbox create/import one book,
remember that biblionumber for later use it in down below,

2) add 100 items for that book for some library,

3) find some patron, that patron's card number we will
use as a borrower down below to open holds page,

4) check for the rule or set up a single circulation rule
in admin "/cgi-bin/koha/admin/smart-rules.pl",
that rule should match above book items/library/patron,
check that rule to have a non-zero number of holds (total, daily, count) allowed,
and, IMPORTANT: set up "On shelf holds allowed" to "If all unavailable",
("item level holds" doesn't matter).

5) open "Home > Catalog > THAT_BOOK > Place a hold on THAT_BOOK" page
("holds" tab), and enter patron code in the search field,
or you can create a direct link by yourself, for example, in my case it was:
/cgi-bin/koha/reserve/request.pl?biblionumber=4&findborrower=23529000686353

6) it should be pretty long page generation time on old code, densely increasing for every hundred items added. In the case of this solution, it's fast, and time increases a little only, linear.

I tested on my computer in VirtualBox for page generation times,
did 3-5 runs for same case to check if results are stable, and got such values:

(old code):
  100 items:    50 seconds
  200 items:   3.2 minutes
  300 items:   7.3 minutes

(version with fix):
  100 items:   4.4 seconds
  200 items:   7.5 seconds
  300 items:  10.4 seconds

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24185: Make holds page faster: Preparatory refactoring
Andrew Nugged [Tue, 14 Jan 2020 20:51:57 +0000]
Bug 24185: Make holds page faster: Preparatory refactoring

This is just refactoring. extracting logically independent code
to separate sub + tests update. No logic change yet.

Searching for "any_available" item among all biblionumber items was done
inside of "elsif on_shelf_holds == 2", and it is logically very independent
piece of code (this "@items" loop), it needs just biblionumber and patron
as parameters so it can be extracted into separate subroutine, and
later also called/reused from somewhere else.

This ability to call from another place also made for future patch
to remove O(n^2) problem with nested loops.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24185: Make holds page faster - Call to subroutine moved below "if"
Andrew Nugged [Thu, 19 Dec 2019 16:20:24 +0000]
Bug 24185: Make holds page faster - Call to subroutine moved below "if"

`$on_shelf_holds` was assigned before "return .. if" but not used in that code piece,
so sometimes it was useless. Moved assignment after "return .. if".

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24185: Make holds page faster - Improved "if"
Andrew Nugged [Thu, 19 Dec 2019 16:16:33 +0000]
Bug 24185: Make holds page faster - Improved "if"

`$can_item_be_reserved eq 'OK'` moved in `&&` before `IsAvailableForItemLevelRequest`
to cut away with static known values before calling to more resource consuming subroutine.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: DBRev 19.12.00.055
Martin Renvoize [Wed, 25 Mar 2020 09:38:32 +0000]
Bug 23590: DBRev 19.12.00.055

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: (QA follow-up) Fix links to patron records (TT variable confusion)
Katrin Fischer [Tue, 24 Mar 2020 14:53:26 +0000]
Bug 23590: (QA follow-up) Fix links to patron records (TT variable confusion)

Fixes links to the patron accounts from the edit and list view of
suggestions.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: DBIC Changes
Jonathan Druart [Tue, 24 Mar 2020 12:05:19 +0000]
Bug 23590: DBIC Changes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Fix 'select manager' when creation a suggestion
Jonathan Druart [Tue, 24 Mar 2020 11:12:06 +0000]
Bug 23590: Fix 'select manager' when creation a suggestion

On creating the TT var managedby_patron does not exist yet

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Create a separate template notice NOTIFY_MANAGER
Jonathan Druart [Mon, 16 Mar 2020 17:46:22 +0000]
Bug 23590: Create a separate template notice NOTIFY_MANAGER

To separate the two feature we want to create a distinct template
notice.
A new NOTIFY_MANAGER notice is added.
A follow-up patch will be added for other languages, when this one will
be approved by QA.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Fix ergonomic issue if last modification by is empty
Jonathan Druart [Mon, 16 Mar 2020 17:31:05 +0000]
Bug 23590: Fix ergonomic issue if last modification by is empty

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Update new fields with relevant values
Jonathan Druart [Mon, 16 Mar 2020 17:21:56 +0000]
Bug 23590: Update new fields with relevant values

We are filling lastmodificationdate and lastmodificationby depending on
the max dates between manageddate, accepteddate and rejecteddate

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Remove unused variable
Jonathan Druart [Mon, 3 Feb 2020 10:19:46 +0000]
Bug 23590: Remove unused variable

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: (QA follow-up) Fix some problems created by recent changes and updatedatab...
Katrin Fischer [Fri, 31 Jan 2020 21:18:29 +0000]
Bug 23590: (QA follow-up) Fix some problems created by recent changes and updatedatabase statement

- Ensure that the sequence of columns will be the same for new
  and updated installations (add AFTER ...)
- Fix permissions (see bug 22868)
- Fix column configuration (see 16784)
- Remove '- ' displying before the date

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: (QA follow-up) Add missing filters and drop script type
Martin Renvoize [Fri, 31 Jan 2020 14:35:39 +0000]
Bug 23590: (QA follow-up) Add missing filters and drop script type

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Fix select manager on list for all tabs
Jonathan Druart [Wed, 13 Nov 2019 16:49:59 +0000]
Bug 23590: Fix select manager on list for all tabs

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Remove JS error on the suggestion list
Jonathan Druart [Wed, 13 Nov 2019 15:39:18 +0000]
Bug 23590: Remove JS error on the suggestion list

The notify option is only available from the edit view

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Add atomic update file
Jonathan Druart [Wed, 13 Nov 2019 14:55:19 +0000]
Bug 23590: Add atomic update file

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Add lastmodification by and date columns
Jonathan Druart [Thu, 7 Nov 2019 14:32:50 +0000]
Bug 23590: Add lastmodification by and date columns

No tests are provided for the changes made to SearchSuggestion. It is
going to be remove very soon as it is super ugly...

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Add the ability to notify a new manager
Jonathan Druart [Thu, 7 Nov 2019 13:42:12 +0000]
Bug 23590: Add the ability to notify a new manager

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Only return patrons that have the suggestions_manage permission
Jonathan Druart [Wed, 6 Nov 2019 18:59:21 +0000]
Bug 23590: Only return patrons that have the suggestions_manage permission

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Batch update manager for suggestions
Jonathan Druart [Wed, 6 Nov 2019 18:41:36 +0000]
Bug 23590: Batch update manager for suggestions

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Cleaning - Remove op_* vars
Jonathan Druart [Wed, 6 Nov 2019 18:17:32 +0000]
Bug 23590: Cleaning - Remove op_* vars

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Clean TT variables for patrons
Jonathan Druart [Wed, 6 Nov 2019 18:16:57 +0000]
Bug 23590: Clean TT variables for patrons

Just a bit of cleaning

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23590: Add ability to edit the manager of a suggestion
Jonathan Druart [Wed, 6 Nov 2019 18:05:05 +0000]
Bug 23590: Add ability to edit the manager of a suggestion

Prior to this patch there was an hidden behavior that set the manager to
the logged in user when a suggestion was edited. This patch proposes to
let the librarian pick another manager.
Other small adjustements will be added to polish this new behavior:
 * Create 2 new DB columns: suggestions.lastmodificationby and
 suggestion.lastmodificationdate
 * Choose a manager when editing a suggestion
 * Batch modify suggestions and set a manager for them
 * Let notify the new manager using the TO_PROCESS letter
 * Display the manageddate, lastmodificationby and lastmodificationdate
 info where appropriate

This first patch adds a new "Select manager" link when editing a
suggestion.

Test plan for the whole patchset:
0/
  a. Execute the update DB entry, generate the new DBIC file and restart all
  b. Create at least 2 patrons with the suggestions_manage permission
1/ Submit a new suggestion (OPAC or staff, not important)
2/ Accept it
3/ Edit it
=> "Last modification by" is empty
=> You see that you are the manager of this suggestion
4/ Click "Select manager" and search for a new manager
=> The patron search will only display patrons with the
suggestions_manage permission
5/ Save
6/ Edit again
=> The manager is set to you, but there is a note saying that previously
it was the patron you picked
=> The "Last modification by" is set to you
7/ Click "Keep existing manager"
=> The manager is now set to the previous manager
8/ Select another manager (which has a valid email address defined)
9/ Click the "notify" checkbox
10/ Save
11/ Confirm that a TO_PROCESS notice has been generated into the
message_queue table
12/ Create at least one other suggestion
13/ List the suggestions
=> There is a 4th action column to assign a manager to several
suggestions in one go.
14/ Use this new button and confirm that it works as expected
15/ Go to your purchase suggestion list (OPAC and staff)
=> You see the "managed date" displayed in a new column

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24754: (QA follow-up) Add timestamp, remove 11th parameter
Marcel de Rooy [Fri, 20 Mar 2020 12:38:29 +0000]
Bug 24754: (QA follow-up) Add timestamp, remove 11th parameter

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24754: Set userenv for ilsdi requests
Nick Clemens [Fri, 28 Feb 2020 14:46:37 +0000]
Bug 24754: Set userenv for ilsdi requests

Currently ILSDI scripts do not have a userenv set. This affects both
action_logs and statistics.

For action_logs we either get no user or, if there is an active session, we use that one. This can have unintended consequences and we should explicitly set the env so that system user (0) is recorded

For statistics we need to specify a branch to record for actions like renewals. With bug 24759 we add an items method for this. We should take advantage of this method and use the 'opac' interface as the ilsdi scripts live there.

To test:
1 - Enable ILSDI in systempreferences
2 - Checkout an item to a patron
3 - Enable Renewal logs
4 - Ensure you will be able to renew the item several times
5 - Open an incognito/private browser
6 - Renew item via ilsdi:
    http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=RenewLoan&patron_id=5&item_id=1128
7 - Check action logs, interface may be random, user should be 0, if not make sure the user in step 9 is a different one
8 - In private browser open a new tab
9 - Sign in to staff client
10 - Return to other tab
11 - Refresh page to repeat renewal
12 - Check action_logs
13 - The second renewal indicates it was renewed via intranet by logged in staff member
14 - Apply patch
15 - restart_all
16 - Ensure staff client still signed in
17 - Repeate renewal again
18 - Check logs, renewal now indicates opac again (as it should), user is 0 even if logged in on other tab

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22771: (QA follow-up) Fix POD
Nick Clemens [Tue, 24 Mar 2020 12:15:26 +0000]
Bug 22771: (QA follow-up) Fix POD

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22771: Fix mistakes in list of nonfiling character fields
David Gustafsson [Fri, 6 Mar 2020 13:07:53 +0000]
Bug 22771: Fix mistakes in list of nonfiling character fields

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22771: Respect nonfiling indicators for search fields
David Gustafsson [Wed, 26 Feb 2020 15:14:36 +0000]
Bug 22771: Respect nonfiling indicators for search fields

Strip initial characters from search fields in accordance with
nonfiling character indicators.

To test:

1) Apply patch
2) Run tests in t/Koha/SearchEngine/Elasticsearch.t
3) All tests should pass

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 13881: DBRev 19.12.00.054
Martin Renvoize [Wed, 25 Mar 2020 09:28:16 +0000]
Bug 13881: DBRev 19.12.00.054

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 13881: Update Schema
Nicolas Legrand [Wed, 2 Oct 2019 12:28:43 +0000]
Bug 13881: Update Schema

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 13881: (QA follow-up) Some documentation and terminology fixes
Katrin Fischer [Tue, 24 Mar 2020 11:24:52 +0000]
Bug 13881: (QA follow-up) Some documentation and terminology fixes

- Branchcode = Library
- Desk id = Desk ID
- Show library name on desk list and when deleting desk instead of code
- Some small changes to the database documentation.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 13881: (QA follow-up) Check for manage_libraries permission
Katrin Fischer [Tue, 24 Mar 2020 11:24:33 +0000]
Bug 13881: (QA follow-up) Check for manage_libraries permission

The .pl was checking for a new permission desks_management not
(yet) added. As the templates already checked for manage_libraries
the .pl was changed accordingly to also use it.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 13881: Add desk management
Nicolas Legrand [Wed, 2 Oct 2019 12:09:21 +0000]
Bug 13881: Add desk management

Add a desk and linked it to a library (branch). That's it. In the
future it'll have super features like being able to link waiting
reserve to a specific desk.

Test plan:

1. go to the administration page and notice there isn't any mention of
desk whatsoever
2. apply patches
3. ./installer/data/mysql/updatedatabase.pl
4. prove t/db_dependent/Koha/Desks.t
5. you now have desks links in admin-home and admin-menu
6. click the link
7. add a desk
8. add another one
9. delete one
10. you should have a fair list of all current desks defined
11. Done

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 13881: Datebase changes, kohastructure and atomicupdate
Nicolas Legrand [Wed, 2 Oct 2019 12:25:50 +0000]
Bug 13881: Datebase changes, kohastructure and atomicupdate

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21800: (RM follow-up) Fix unit tests
Martin Renvoize [Wed, 25 Mar 2020 08:04:26 +0000]
Bug 21800: (RM follow-up) Fix unit tests

We were not setting the repeatable flag for the default framework in the
Item2Marc tests and we also needed to flush the cash to get our
framework changes to be recognised.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>