koha.git
5 years agoBug 18973: Auto focus the ISBN field on Z39.50 search form in cataloguing
fv@spots.school [Sun, 6 Aug 2017 05:42:03 +0000 (22:42 -0700)]
Bug 18973: Auto focus the ISBN field on Z39.50 search form in cataloguing

Signed-off-by: George <george@nekls.org>
Signed-off-by: BWS Sandboxes <ByWaterSandboxes@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20727: Add use line for File::Spec in C4::Context, sort used modules
Kyle M Hall [Tue, 5 Jun 2018 18:48:54 +0000 (14:48 -0400)]
Bug 20727: Add use line for File::Spec in C4::Context, sort used modules

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20727: Replace use of tmpdir in updatedatabase.pl
Kyle M Hall [Tue, 5 Jun 2018 18:48:14 +0000 (14:48 -0400)]
Bug 20727: Replace use of tmpdir in updatedatabase.pl

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20727: (QA follow-up) Remove a few use statements again
Marcel de Rooy [Wed, 30 May 2018 14:50:27 +0000 (16:50 +0200)]
Bug 20727: (QA follow-up) Remove a few use statements again

We do no longer need "use Koha::UploadedFile" in a few places.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20727: (QA follow-up) Fix Upload.t and Plugins.t
Marcel de Rooy [Wed, 30 May 2018 14:39:25 +0000 (16:39 +0200)]
Bug 20727: (QA follow-up) Fix Upload.t and Plugins.t

Trivial changes.
Adding C4::Context->temporary_directory to subsequent tmpdir call in Plugins.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20727: Move temporary_directory() to C4::Context
Kyle M Hall [Tue, 29 May 2018 12:03:55 +0000 (08:03 -0400)]
Bug 20727: Move temporary_directory() to C4::Context

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20727: Replace usage of File::Spec->tmpdir with Koha::UploadedFile->temporary_dir...
Kyle M Hall [Wed, 9 May 2018 10:44:41 +0000 (06:44 -0400)]
Bug 20727: Replace usage of File::Spec->tmpdir with Koha::UploadedFile->temporary_directory

As explained in bug 20428 use tmpdir can cause issues and it just makes sense to standardize our temp directory in a universal way.

Test Plan:
1) Apply this patch
2) Verify you can still log in and use Koha
3) Verify the web installer still works
4) Verify EDI module can still download files via FTP
5) Verify fines.pl still runs with -o option
6) prove t/db_dependent/Plugins.t
7) prove t/db_dependent/Sitemapper.t
8) prove t/db_dependent/Templates.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20339: Unify MARC21 ISBN/ISSN handling in XSL
Pasi Kallinen [Tue, 6 Mar 2018 09:59:28 +0000 (11:59 +0200)]
Bug 20339: Unify MARC21 ISBN/ISSN handling in XSL

The code to show the ISBN and ISSN is repeated between the search results
and the detail view. Create a function to show the ISBN/ISSN, and call
that instead.

Test plan:
1) Apply patch
2) Search for any records, check that the ISBN and ISSN are shown
   correctly
3) Go to biblio detail pages, check that the ISBN and ISSN are shown
   correctly

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>
Signed-off-by: claude <claude.brayer@cea.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 19820: (QA follow-up) Fix pod in C4::Biblio
Josef Moravec [Fri, 11 May 2018 06:26:40 +0000 (06:26 +0000)]
Bug 19820: (QA follow-up) Fix pod in C4::Biblio

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 19820: Add unsafe param to GetMarcSubfieldStructure
David Gustafsson [Fri, 15 Dec 2017 13:19:49 +0000 (14:19 +0100)]
Bug 19820: Add unsafe param to GetMarcSubfieldStructure

Add unsafe param to GetMarcSubfieldStructure and use this options
where it's safe to do so to increase performance

Sponsored-by: Gothenburg University Library
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20456: (follow-up) Fix number of subscriptions and position display
Katrin Fischer [Sat, 21 Apr 2018 01:07:58 +0000 (01:07 +0000)]
Bug 20456: (follow-up) Fix number of subscriptions and position display

TT variables needed to be adjusted because of changes from bug 20400.
Also: while we want logged_in_user in OPAC, we don't want that in staff.

1) Check the right number of subscriptions is displayed on top of the table
2) check the right position number is display for the routing list

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20456: Remove the C4::Serials::GetSubscriptionsFromBorrower
Katrin Fischer [Fri, 16 Mar 2018 09:13:19 +0000 (10:13 +0100)]
Bug 20456: Remove the C4::Serials::GetSubscriptionsFromBorrower

Bug 20400 added a routing list tab to the patron account in the
OPAC using Koha::Object. After changing the staff view too,
we can now safely remove GetSubscriptionsFromBorrower as it
is no longer used.

To test:
- Make sure that GetSubscriptionsFromBorrower is no longer used.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20456: Switch routling list tab in staff to use Koha::Object
Katrin Fischer [Fri, 16 Mar 2018 08:57:06 +0000 (09:57 +0100)]
Bug 20456: Switch routling list tab in staff to use Koha::Object

Bug 20400 added a routing list tab to the patron account in the
OPAC using Koha::Object.

This patch switches the routing list tab in the patron account
in intranet over to the new code. It also adds an additional
column showing the position of the patron on the routing list
and fixes the search.

To test:
- Create some subscriptions with routing lists
- Take a look at the patron accounts of several patrons having
  - no entries on routing lists
  - 1 entry on a routing list
  - entries on several routing lists
- Make sure the display works correctly.
- Search for a subscription and make sure search works.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20073: Remove perlcritic error
Jonathan Druart [Mon, 23 Apr 2018 18:12:20 +0000 (15:12 -0300)]
Bug 20073: Remove perlcritic error

"return" statement with explicit "undef" at line 245, column 5.  See
page 199 of PBP.  (Severity: 5)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20073: Move Elasticsearch configs to yaml files and improve the default settings.
Ere Maijala [Tue, 23 Jan 2018 13:21:31 +0000 (15:21 +0200)]
Bug 20073: Move Elasticsearch configs to yaml files and improve the default settings.

Improvements:
1) Index settings moved from code to etc/searchengine/elasticsearch/index_config.yaml. An alternative can be specified in koha-conf.xml.
2) Field settings moved from code to etc/searchengine/elasticsearch/field_config.yaml. An alternative can be specified in koha-conf.xml.
3) mappings.yaml has been moved from admin/searchengine/elasticsearch to etc/searchengine/elasticsearch. An alternative can be specified in koha-conf.xml.
4) Default settings have been improved to remove punctuation from phrases used for sorting etc.
5) State variables are used for storing configuration to avoid parsing it multiple times.
6) A possibility to reset the fields too has been added to the reset operation of mappings administration.
7) mappings.yaml has been moved from admin/searchengine/elasticsearch to etc/searchengine/elasticsearch.
8) An stdno field type has been added for standard identifiers.

To test:
1) Run tests in t/Koha/SearchEngine/Elasticsearch.t
2) Clear tables search_fields and search_marc_map
3) Go to admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1
4) Verify that admin/searchengine/elasticsearch/mappings.pl displays the mappings properly, including ISBN and other standard number fields.
5) Index some records using the -d parameter with misc/search_tools/rebuild_elastic_search.pl to recreate the index
6) Verify that you can find the records
7) Put <elasticsearch_index_mappings>non_existent</elasticsearch_index_mappings> to koha-conf.xml
8) Verify that admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1 fails because it can't find non_existent.
9) Copy etc/searchengine/elasticsearch/mappings.yaml to a new location and make elasticsearch_index_mappings setting in koha-conf.xml point to it.
10) Make a change in the new mappings.yaml.
11) Clear table search_fields (mappings reset doesn't do it yet, see bug 20248)
12) Go to admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1
13) Verify that the changes you made are now visible in the mappings UI

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 20073: Move Elasticsearch yaml files back to admin directory

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20702: Bind results of GetHostItemsInfo to the EasyAnalyticalRecords pref
Marcel de Rooy [Thu, 3 May 2018 11:12:19 +0000 (13:12 +0200)]
Bug 20702: Bind results of GetHostItemsInfo to the EasyAnalyticalRecords pref

Triggered by the finding on bug 20697.
The three calls of GetHostItemsInfo should be controlled by the pref. This
patch makes the sub return an empty list when the pref is disabled.

The patch simplifies the sub by merging the two identical foreach loops
depending on the field number in MARC21/UNIMARC.

Will add a unit test on a follow-up patch.

Test plan:
See next patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20702: Add unit tests for GetHostItemsInfo
Marcel de Rooy [Thu, 3 May 2018 12:08:01 +0000 (14:08 +0200)]
Bug 20702: Add unit tests for GetHostItemsInfo

Unfortunately, we did not have unit tests yet.
Adding some simple tests that test basic operation of the sub when the
pref is enabled/disabled and for MARC21/UNIMARC.

Test plan:
[1] Run t/db_dependent/Items/GetHostItemsInfo.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20259: Shorter JS and CSS rewrite rule
Fridolin Somers [Wed, 21 Feb 2018 10:07:56 +0000 (11:07 +0100)]
Bug 20259: Shorter JS and CSS rewrite rule

Bug 20187 has changed the JS and CSS rewrite rules to :
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].js$ $1.js [L]
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].css$ $1.css [L]

This patch changes this rules using [0-9]{N} and fusion in one rule.
And espaces the dot in extension js and css.

Test plan :
1) Go to intranet and opac
2) Check CSS and JS are doing well
3) Apply patch changes on our Apache configuration
4) Reload intranet and opac pages (Ctrl + F5)
5) Check CSS and JS are doing well

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20794: Hide holds tab on details when user lacks circulate_remaining_permissions
Katrin Fischer [Sun, 20 May 2018 02:23:47 +0000 (04:23 +0200)]
Bug 20794: Hide holds tab on details when user lacks circulate_remaining_permissions

If a user doesn't have circulate_remaining permissions, but has borrowers:
- checkouts tab is hidden
- details tab is visible
- holds tab on details is visible, but results in an error

The problem is that the svc/holds script requires circulate_remaining_permissions.

To test:
- Create 2 staff users with and without circulate_remaining_permissions
  Both need borrowers permission
- Go to the details tab in a patron's account who has holds
- Verify that you get a datatables error for the staff patron without
  circulate_remaining_permissions
- Apply patch
- Verify that now the holds tab is no longer displayed for this patron

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20881: Order receiving: Price filter missing on_editing
Pasi Kallinen [Tue, 5 Jun 2018 10:26:43 +0000 (13:26 +0300)]
Bug 20881: Order receiving: Price filter missing on_editing

When the Price-filter is used on editable data, it should have the
on_editing -tag. Add it to the orderreceive.tt

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
To test:
- Set CurrencyFormat to FR
- Create a basket with orders in acq
- Close it
- Receive shipment and pick order line to receive
- On this screen verify that the actual cost appears as comma-separated
- Apply patch
- Refresh page
- Verify that the actual cost now appears .-separated

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20981: Fix organization name when displaying patron's info
Jonathan Druart [Thu, 21 Jun 2018 20:34:17 +0000 (17:34 -0300)]
Bug 20981: Fix organization name when displaying patron's info

Caused by bug 18403.
From patron-title.inc, we need a IF instead of UNLESS.

Test plan:
Create organizations
Search for patrons
=> Without this patch the "Name" column is empty for organizations
=> With this patch applied you will see the surname (and othernames if
exists)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 13655: Same fix for partial edit
Jonathan Druart [Thu, 21 Jun 2018 15:28:18 +0000 (12:28 -0300)]
Bug 13655: Same fix for partial edit

Test plan:
- Create an organisation with surname='xxx'
userid will be autogenerated with 'xxx''
- Edit the surname with 'yyy'
userid will be unchanged, 'xxx'
- Parial edit and blank userid
userid will be autogenerated with 'yyy'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 13655: Allow creation of organisations without entering userid
Jonathan Druart [Thu, 12 Apr 2018 16:40:59 +0000 (13:40 -0300)]
Bug 13655: Allow creation of organisations without entering userid

See comment 1 of the bug report for defails of the issue.

Test plan:
Good luck (you will need to test all combinations (category type eq and
ne 'I'), then quick edition and partial edit)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20951: add missing use Koha::Patron::Debarments in Koha::Patron::Discharge
Fridolin Somers [Fri, 15 Jun 2018 10:56:36 +0000 (12:56 +0200)]
Bug 20951: add missing use Koha::Patron::Debarments in Koha::Patron::Discharge

Koha::Patron::Discharge was missing use Koha::Patron::Debarments used in discharge() method.

Test plan :
1) Enable pref useDischarge
2) Go to OPAC user page
3) Go to 'ask for a discharge' tab
4) Click on 'Ask for a discharge'
5) Go to staff interface : /cgi-bin/koha/members/discharges.pl
6) Click on Allow
=> Without patch you get software error
=> With patch the discharge is validated

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20928: Fix regression - display patron's info on moredetail if item is checked out
Jonathan Druart [Thu, 14 Jun 2018 14:43:12 +0000 (11:43 -0300)]
Bug 20928: Fix regression - display patron's info on moredetail if item is checked out

This patch is a follow-up of
  commit 5f80977875ff124d411f2cd89de4a944fa9c27af
  Bug 18403: Use patron-title.inc when hidepatronname is used

Test plan:
- Check an item out
- Go on the moredetail.pl page of this biblio record
Home › Catalog › Item details for your biblio
- Confirm that you see:
"Checkout status: Checked out to"
followed by the patron's info

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and it works.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20906: Fix translatable-templates.t
Jonathan Druart [Fri, 8 Jun 2018 16:06:58 +0000 (13:06 -0300)]
Bug 20906: Fix translatable-templates.t

From Jenkins:
koha_1       | #   Failed test 'staff_prog templates are translatable'
koha_1       | #   at xt/author/translatable-templates.t line 87.
koha_1       | # Can't locate TmplTokenizer.pm in @INC (you may need to install the TmplTokenizer module) (@INC contains: /kohadevbox/koha /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./tmpl_process3.pl line 20.

On Stretch, '.' is not longer added to @INC, see bug 17717 for more info

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20906: Prevent test failures due to precision changes (2)
Martin Renvoize [Fri, 8 Jun 2018 14:21:22 +0000 (15:21 +0100)]
Bug 20906: Prevent test failures due to precision changes (2)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20906: Prevent test failures due to stricter perl
Martin Renvoize [Fri, 8 Jun 2018 13:32:02 +0000 (14:32 +0100)]
Bug 20906: Prevent test failures due to stricter perl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20906: Prevent test failures due to precision changes
Martin Renvoize [Fri, 8 Jun 2018 11:50:31 +0000 (12:50 +0100)]
Bug 20906: Prevent test failures due to precision changes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20934: (QA follow-up) Fix showing number of records in checkout history
Josef Moravec [Mon, 18 Jun 2018 15:48:12 +0000 (15:48 +0000)]
Bug 20934: (QA follow-up) Fix showing number of records in checkout history

Test plan:
0) Do not apply this patch
1) Go to biblio checkout history page (issuehistory.pl)
2) You'll see something like "Checked out ARRAY(0xf830378) times"
3) Apply this patch
4) Now you should see number of checkout history records

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20934: (QA follow-up) Fix pod in Koha::Old::Checkout
Josef Moravec [Mon, 18 Jun 2018 15:15:31 +0000 (15:15 +0000)]
Bug 20934: (QA follow-up) Fix pod in Koha::Old::Checkout

Test plan:
Run qa tools - it shouldn't complain about pod levels

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20934: Fix display of old checkouts in the checkout history page
Jonathan Druart [Wed, 13 Jun 2018 16:26:43 +0000 (13:26 -0300)]
Bug 20934: Fix display of old checkouts in the checkout history page

Again a regression caused by
  commit fa54100dffe092e606f79b15692eedaf78f42e45
  Bug 18403: Use patron-title.inc when hidepatronname is used [SPECIFIC for issuehistory]

GetBiblioIssues does a union all with issues and old_issues, so we
should old_issues as well.
To make the join on the items table we need to define the item and
patron methods. For consistency the relationships have been redefined
(item instead of itemnumber, borrower instead of borrowernumber) in the
DBIx::Class definition.

This is not perfect but I think the best way to provide an easy to
backport patch.

It highlights that we need improvements in this area.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
The patch works as expected.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20285: Lost item refund won't always pay down lost item fee first
Kyle M Hall [Fri, 23 Feb 2018 13:44:45 +0000 (08:44 -0500)]
Bug 20285: Lost item refund won't always pay down lost item fee first

Due to a simple typo, the accountline passed to Koha::Account::pay from _FixAccountForLostAndReturned is not used. That means that the credit for the lost item fee may be applied to other fees before it is used on the lost fee itself.

Test Plan:
1) Find a patron with existing fines
2) Ensure your settings will charge patrons for lost items
3) Check out an item to a patron with existing fees that need paid
4) Mark the item lost, charging the lost item fee
5) Return the item
6) Note the fee was refunded, but it paid down earlier fines first,
   and not the lost item fee first
7) Apply this patch set
8) Repeat steps 1 - 5
9) Note the lost item fee is the first fee to be paid off by the lost
   item fee refund

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and it works as expected.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20285: Unit Test
Kyle M Hall [Fri, 23 Feb 2018 13:44:24 +0000 (08:44 -0500)]
Bug 20285: Unit Test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 19970: Revise change of bug 19413 to work better for translations
Owen Leonard [Thu, 31 May 2018 15:32:29 +0000 (15:32 +0000)]
Bug 19970: Revise change of bug 19413 to work better for translations

This patch changes how the submit and cancel buttons appear in the MARC
008 plugin window. The controls are now displayed as buttons in a
floating toolbar.

To test you must have MARC tag 008 configured to use the
marc21_field_008.pl plugin.

- Apply the patch and open an existing or blank record in cataloging.
- Click the plugin link next to tag 008 to trigger the popup window.
- Confirm that "Save" and "Cancel" appear correctly in a toolbar.
- Scroll down the page to confirm that the toolbar "sticks" to the top
  of the window.
- Confirm that the "Save" and "Cancel" buttons work correctly.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and the patch works.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20760: Fill authorised values in svc framework
Jonathan Druart [Mon, 4 Jun 2018 16:02:33 +0000 (13:02 -0300)]
Bug 20760: Fill authorised values in svc framework

To test:
 1 - Map a marc field to an authorised value in the default framework -
say 300$c -> CCODE
 2 - Open the advanced cataloguing editor
 3 - Create a new field 300$c - note there is no dropdown
 4 - browse to: /cgi-bin/koha/svc/cataloguing/framework?callback=define
 5 - Note the many instance of
Koha::Schema::ResultSet::AuthorisedValueCategory->HASH...
 6 - Apply patch
 7 - Restart memcached and plack
 8 - reload/recreate record in rancor
 9 - Note that 300$c is now a dropdown as expected
10 - repeate 4
11 - note the authorised values look correct in response

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20911: Use 'POST' to submit search history forms
Nick Clemens [Mon, 11 Jun 2018 15:28:19 +0000 (15:28 +0000)]
Bug 20911: Use 'POST' to submit search history forms

To test:
1 - Enable EnableOpacSearchHistory and EnableSearchHistory
2 - Do some searches
3 - View your search history in staff/opac
4 - Confirm you can delete single or multiple rows
5 - Confirm other page functionality has not changed

Signed-off-by: Ed Veal <eveal@mckinneytexas.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20892: Correct basketgroup link in histsearch.pl
Fridolin Somers [Thu, 7 Jun 2018 13:59:39 +0000 (15:59 +0200)]
Bug 20892: Correct basketgroup link in histsearch.pl

When searching an order, histsearch.pl page, you see if exists the backetgroup as a link.
This link is composed of "basketgroup.pl?booksellerid=xxx", it must also contain "basketgroupid=xxx" and "opa=add".

See Bug 11429 for example.

Test plan :
1) Create an order in a basket and add it to a basketgroup
2) Search for this order, you get to page histsearch.pl
3) Check clicking on basketgroup id leads to basketgroup details page

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20899: Fix patron's name display
Jonathan Druart [Tue, 12 Jun 2018 14:13:46 +0000 (11:13 -0300)]
Bug 20899: Fix patron's name display

This is a follow-up for
  commit fa54100dffe092e606f79b15692eedaf78f42e45
  Bug 18403: Use patron-title.inc when hidepatronname is used [SPECIFIC for issuehistory]

We should use patron-title.inc to display (or hide) patron's info on the
checkout history view

Test plan:
Issue an item, go to the biblio, click the circulation history for this
tab.
Note that the patron's name is showing.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20918: Fix left-side navigation on the checkout history page
Jonathan Druart [Tue, 12 Jun 2018 14:26:02 +0000 (11:26 -0300)]
Bug 20918: Fix left-side navigation on the checkout history page

  commit fa54100dffe092e606f79b15692eedaf78f42e45
  Bug 18403: Use patron-title.inc when hidepatronname is used [SPECIFIC for issuehistory]

Removed:
-    biblionumber => $biblionumber, # required for left-side navigation

But did not deal with the side-effects.

Test plan:
When you are on the "Checkout history" page (/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=42),
the left-side navigation is broken if this patch is not applied, the biblionumber is not set.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20922: Remove use of Koha::Number::Price in updatedatabase.pl
Jonathan Druart [Tue, 12 Jun 2018 16:12:25 +0000 (13:12 -0300)]
Bug 20922: Remove use of Koha::Number::Price in updatedatabase.pl

Koha::Number::Format->round use Number::Format->round with a precision=2
We should use it directly instead of Koha::* modules. It will avoid the
DB entry to fail because schema changes.

From the koha-devel list:

http://lists.koha-community.org/pipermail/koha-devel/2018-June/044608.html

16.06.00.042

Upgrade to 16.06.00.041 done (Bug 14629 - Add aggressive ISSN matching
feature equivalent to the aggressive ISBN matcher)
DBD::mysql::st execute failed: Unknown column 'me.p_sep_by_space' in
'field list' [for Statement "SELECT `me`.`currency`, `me`.`symbol`,
`me`.`isocode`, `me`.`timestamp`, `me`.`rate`, `me`.`active`,
`me`.`archived`, `me`.`p_sep_by_space` FROM `currency` `me` WHERE (
`active` = ? )" with ParamValues: 0=1] at
/usr/local/share/perl/5.24.1/DBIx/Class/Storage/DBI.pm line 1836.
DBIx::Class::Storage::DBI::_dbh_execute(): Unknown column
'me.p_sep_by_space' in 'field list' at
/inlibro/git/koha-csf-prod-inlibro/Koha/Objects.pm line 209

Basically, the update code uses Koha::Number::Price, which in full
modern object mode goes for its newly added *p_sep_by_space* _in the
18.05 code_.  But the DB doesn't have it yet (it comes with 17.12.00.022).

Signed-off-by: Blou <philippe.blouin@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20832: Fix opac user profile page when there is overdue fine and no rental charge
Josef Moravec [Tue, 29 May 2018 11:48:14 +0000 (11:48 +0000)]
Bug 20832: Fix opac user profile page when there is overdue fine and no rental charge

Test plan:
0) Do not apply the patch
1) Have an overdue fine linked with specific item currently checked out
to your patron
2) Do not have any unpaid rental fees
3) Go to this patron profile in opac - page opac-user.pl
4) The page crashes with "Can't call method "get_column" on an undefined
value at
/usr/share/koha/opac/cgi-bin/opac/opac-user.pl line 217" in log
5) Apply the patch
6) Restart plack
7) The page should working and show the right amounts for fines

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20851: Add module to circ/article-request-slip.pl
Marcel de Rooy [Fri, 1 Jun 2018 07:21:48 +0000 (09:21 +0200)]
Bug 20851: Add module to circ/article-request-slip.pl

See bug 20468, comment7.
Although the script seems to compile well, we better add the module here.
Trivial change.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20756: Compiled CSS
Owen Leonard [Mon, 14 May 2018 15:08:13 +0000 (15:08 +0000)]
Bug 20756: Compiled CSS

This patch contains the compiled CSS file

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20756: OPAC "Share list" button should be styled with an icon
Owen Leonard [Mon, 14 May 2018 15:07:42 +0000 (15:07 +0000)]
Bug 20756: OPAC "Share list" button should be styled with an icon

This patch adds a new "share" icon to the sprite image used to style
controls in the OPAC. The "share list" links now have a "sharelist"
class which is used to style the links with the new icon.

Also changed: Fixed the page structure markup of opac-shareshelf.tt.

To test you must have the OpacAllowSharingPrivateLists system preference
enabled.

 - Log in to the OPAC and go to Lists -> Your lists.
 - Create one or more private lists if necessary.
 - In the table of your lists there should be a "Share" link with the
   new icon.
 - View one of these lists and confirm that the "Share" link at the top
   of the table of list items.
 - Click through to the share list page and confirm that the page looks
   correct.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20700: MARC21 add/update leader/007/008 codes
Bernardo Gonzalez Kriegel [Wed, 2 May 2018 22:42:22 +0000 (19:42 -0300)]
Bug 20700: MARC21 add/update leader/007/008 codes

This add/updates some codes from updates 22 (Apr/16)
and 23 (Nov/16)

Update 22 https://www.loc.gov/marc/up22bibliographic/bdapndxg.html

Sound Recording 007/03 n (new)
Sound Recording 007/10 n (new)
Sound Recording 007/01 r (new)
Sound Recording 007/01 s (new)

Update 23 https://www.loc.gov/marc/up23bibliographic/bdapndxg.html

Leader/18 n (new)
Music 008/20 p (new), b (renamed)

To test:
1) Apply the patch
2) Clean your browser cache
3) Go to cataloguing -> new record
4) Leader plugin: check leader/18, new option 'n'
5) 007 Plugin:
a) Sound recording
check 007/01 new 'r'
check 007/03 new 'n'
check 007/10 new 'n'
b) Electronic resource
check 007/01 new 's'
6) 008 Plugin: Music, check 008/20 renamed 'b', new 'p'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20886: Do not cast undef to 0 (TO_JSON)
Jonathan Druart [Wed, 6 Jun 2018 14:12:24 +0000 (11:12 -0300)]
Bug 20886: Do not cast undef to 0 (TO_JSON)

We should not cast undefined values to 0.

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This was a bug I introduced. I think the fix is right, and if something
gets broken for this, it means it was making the wrong assumptions on
the data.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20778: (bug 19777 follow-up) Fix subscription deletion
Jonathan Druart [Mon, 4 Jun 2018 15:14:10 +0000 (12:14 -0300)]
Bug 20778: (bug 19777 follow-up) Fix subscription deletion

Caused by
  commit 666a1b276097785c2a7c33e718f26f5512b3d972
  Bug 19777: Move template JavaScript to the footer: Serials, part 3

TT vars should not be used in .js files

Test plan:
Delete a subscription, confirm you see the confirmation popup and that
the it deletes the subscription correctly after it has been confirmed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20053: Drop type attribute "text/javascript" in OPAC templates
Owen Leonard [Tue, 1 May 2018 13:08:18 +0000 (13:08 +0000)]
Bug 20053: Drop type attribute "text/javascript" in OPAC templates

This patch is a reimplementation of the original from Indranil Das Gupta
and the QA follow-up from Julian Maurice. Original test plan:

Conformance rules for HTML5 is generating warnings for <script> element
with type="text/javascript" attribute when the OPAC page is checked
with W3C Validator. This patch removes the cause of these warnings.

Test plan
=========

1/ Paste the URL to your OPAC page (if it is hosted) to W3C Validator
   and watch about 10+ warnings being generated by the validator.

2/ Apply patch and re-submit the page to the Validator. The warnings
   would be gone.

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20829: Handle non-existent barcode when linking to host item
Jonathan Druart [Wed, 30 May 2018 15:10:58 +0000 (12:10 -0300)]
Bug 20829: Handle non-existent barcode when linking to host item

Since commit 2c9aeb9b0f4449d1a25274b8fbf8dae4ec11d3bf
  Bug 18277: Remove GetBiblionumberFromItemnumber - linkitem

$item is not defined if the barcode is invalid, we should not call
method on it in that case.

Test plan:
- Turn on EasyAnalyticalRecords
- Go to a detail page
- Edit > Link to host item
- Enter an invalid barcode
=> With the patch you get a friendly error message
=> Without this patch it explodes with
Can't call method "itemnumber" on an undefined value at
/home/vagrant/kohaclone/cataloguing/linkitem.pl line 86.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 2426: DBRev 18.06.00.002
Nick Clemens [Fri, 8 Jun 2018 12:20:13 +0000 (12:20 +0000)]
Bug 2426: DBRev 18.06.00.002

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 2426: Remove deprecated management permission
Katrin Fischer [Tue, 15 May 2018 23:19:53 +0000 (01:19 +0200)]
Bug 2426: Remove deprecated management permission

After review of the code it turns out that the management permission
that has been marked as deprecated a long time ago, does not have
any function.

The patch removes all remaining code related to it.

To test:
- Make sure you have a patron with the management permission
- Apply patch
- Run database update
- Check everything still works as expected

Bonus:
borrowers.flags is recalculated for patrons with management
permission.

To check:
- Create some 'permission twins' with and without management
  permission
- Note the value in borrowers.flags
- Apply patch, don't run database update
- Save permissions from GUI for one of the twins
- Note the newly calculated value
- Run database update
- Now both twins should have the same borrowers.flags value

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20120: (QA follow-up) display correct amount in redirect
Nick Clemens [Fri, 8 Jun 2018 12:03:01 +0000 (12:03 +0000)]
Bug 20120: (QA follow-up) display correct amount in redirect

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20120: force scalar context for CGI->param
Jonathan Druart [Thu, 3 May 2018 16:26:08 +0000 (13:26 -0300)]
Bug 20120: force scalar context for CGI->param

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20120: (QA follow-up) Pass on_editing parameter for Price plugin
Kyle M Hall [Fri, 27 Apr 2018 10:00:41 +0000 (06:00 -0400)]
Bug 20120: (QA follow-up) Pass on_editing parameter for Price plugin

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20120: Prevent writeoffs of more than the amount owed for a fee
Kyle M Hall [Fri, 9 Mar 2018 14:20:40 +0000 (09:20 -0500)]
Bug 20120: Prevent writeoffs of more than the amount owed for a fee

In short, it is possible to 'over-writeoff' a fee such that the value of the fee is now a credit.

Test Plan:
1) Attempt to writeoff a single fee, set the amount input to more than
   the amount of the fee.
2) Note the writeoff makes the fee go negative.
3) Apply this patch
4) Attempt to repeat step 1, you should be unable to write-off an
   amount more than the amount outstanding for the fee!

Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20875: (bug 16735 follow-up) Fix library list for OpacAddMastheadLibraryPulldown
Jonathan Druart [Mon, 4 Jun 2018 14:23:35 +0000 (11:23 -0300)]
Bug 20875: (bug 16735 follow-up) Fix library list for OpacAddMastheadLibraryPulldown

This patch fixes a regression introduced by
  commit 2059f7d8016ab61172830e9b670279d3e28882b7
  Bug 16735: Migrate library search groups into the new hierarchical groups

It re-added code that was removed by bug 15758 (use of var BranchesLoop).

Test plan:
- Create library search groups
- Turn OpacAddMastheadLibraryPulldown on
- At the OPAC confirm that the search box with libraries and library
groups is displayed and works correctly.
- Remove the library search group
- The dropdown list should not have the optgroup tags

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20877: Do not consider DB user has permissions
Jonathan Druart [Mon, 4 Jun 2018 18:45:22 +0000 (15:45 -0300)]
Bug 20877: Do not consider DB user has permissions

Test plan:
0/ Do not apply the patch
1/ Confirm the new test fails
2/ Apply the patch
3/ Confirm the new test passes
4/ Test the installation process

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 18821: (QA follow-up) Last tweaks for performance
Marcel de Rooy [Fri, 1 Jun 2018 09:00:57 +0000 (11:00 +0200)]
Bug 18821: (QA follow-up) Last tweaks for performance

[1] passing unsafe has no use since it is a scalar, removed it to unconfuse
[2] remove caching when pref is disabled
[3] caching userid removes the need for calling Patron->find each time
[4] subsequent changes in unit test
[5] cosmetic renames to move from session to daily basis (changed dev angle)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
First call going thru Koha::Patron takes about 0.0150 sec.
Subsequent calls only use caching and take about 0.0006 sec.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 18821: Convert to using cache with date checking
Kyle M Hall [Sat, 26 May 2018 06:40:24 +0000 (06:40 +0000)]
Bug 18821: Convert to using cache with date checking

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 18821: TrackLastPatronActivity is a performance killer
Kyle M Hall [Mon, 7 May 2018 17:29:12 +0000 (17:29 +0000)]
Bug 18821: TrackLastPatronActivity is a performance killer

Test Plan:
1) Apply this patch
2) Start a new session ( a private browser window works well )
3) Note the lastseen column in the borrowers table is updated
4) Browse a few pages, not the lastseen column is not updated again
5) Close the browser window and repeat steps 2-4
6) prove t/db_dependent/Auth.t

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20889: Prevent not for loan items to be checked out
Jonathan Druart [Wed, 6 Jun 2018 17:25:19 +0000 (14:25 -0300)]
Bug 20889: Prevent not for loan items to be checked out

1. Item type defined at item level (item-level_itypes=1)
2. Mark an item type not for loan (itemtypes.notforloan=1)
3. Checkout an item using this item type (items.itype="BK" for instance)
=> Checkout is not blocked!

I suspect
  commit 3953fdb921d7f280ffbaca813956357aa67d42ca
  Bug 19943: Remove itemtype vs itype confusion in CanBookBeIssued
to be the root of this issue.
One occurrence of $item->{itemtype} has not been replaced.
In this case it refers to the biblioitem->{itemtype} value whereas we want to use
$item->{itype}. So this issue does not happen if items.itype==biblioitem.itemtype
(just in case you are not reproducing the problem).

Test plan:
Make sure not for loan items cannot be checked out

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20889: Add tests - not for loan items cannot be checked out
Jonathan Druart [Wed, 6 Jun 2018 17:24:33 +0000 (14:24 -0300)]
Bug 20889: Add tests - not for loan items cannot be checked out

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20866: (QA follow-up) Use build_object and remove two tests
Marcel de Rooy [Tue, 5 Jun 2018 11:45:06 +0000 (13:45 +0200)]
Bug 20866: (QA follow-up) Use build_object and remove two tests

The unique constraint on userid is handled in TestBuilder. So let's use it.
The two tests if count==$count do not make much sense anymore when we
call ->count a few lines before. The check with search_limited is enough.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20866: Make ArticleRequests.t pass even if table is not empty
Jonathan Druart [Mon, 4 Jun 2018 18:28:02 +0000 (15:28 -0300)]
Bug 20866: Make ArticleRequests.t pass even if table is not empty

Previous patch from Marcel removed the data from article_requests, I do
not think it is a good idea to remove existing data, it could hide bugs.

This patch moves the count inside the subtest block in order to have the
correct value when these tests are executed.
Previous code was broken: Koha::Patron->store does not generate a
userid, and ->search_limited did not work correctly
(Koha::Patron->has_permission returned early because of the non-existing
userid, 'return unless $self->userid;');

Test plan:
[1] Create an article request.
[2] Run t/db_dependent/ArticleRequests.t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 17561: (follow-up) Pass itemnumber on returns and correct itemnumber param in...
Nick Clemens [Wed, 30 May 2018 13:07:39 +0000 (13:07 +0000)]
Bug 17561: (follow-up) Pass itemnumber on returns and correct itemnumber param in circulation

To test:
1 - Place two holds on a bib for a single patron
2 - Check in both items, confirm the screen message and slip are correct
3 - Checkout both items to another patron, confirm the screen message
and slip are correct

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 17561: (QA follow-up) Update existing unit tests
Kyle M Hall [Fri, 18 May 2018 12:00:03 +0000 (08:00 -0400)]
Bug 17561: (QA follow-up) Update existing unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 17561: (QA follow-up) Simplify new ReserveSlip code
Kyle M Hall [Fri, 18 May 2018 11:20:06 +0000 (07:20 -0400)]
Bug 17561: (QA follow-up) Simplify new ReserveSlip code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 17561: ReserveSlip needs itemnumber for item level holds on same biblio
Benjamin Rokseth [Thu, 15 Mar 2018 11:57:37 +0000 (12:57 +0100)]
Bug 17561: ReserveSlip needs itemnumber for item level holds on same biblio

This patch fixes a regression after bug 14695.
This patch adds itemnumber and barcode as optional params in ReserveSlip used
by hold-transfer-slip.pl to generate HOLD_SLIP. This is for ReserveSlip to be
able to generate correct slips when items in multi-item holds are checked in.

Test plan:

1) activate a circulation rule with multi-item holds
2) Place two holds on same biblio for patron
3) for debugging, either use browser console to observe POST request and responses
   or use info from reserves, e.g. reserve_id in the HOLD_SLIP
4) checkin two items from same biblio on pickup branch
5) note that both holds are effectuated, but reserve_id is the same on both slips
6) also note that there is no itemnumber or barcode in the requests from returns.pl
7) Apply this patch
8) repeat 2-4
9) note that reserve_id is now different on the two slips

and/or:
Run tests:
  t/db_dependent/Reserves/ReserveSlip.t

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20861: Correct EDI permissions on EDI messsages
Katrin Fischer [Sun, 3 Jun 2018 08:09:23 +0000 (10:09 +0200)]
Bug 20861: Correct EDI permissions on EDI messsages

The permission for EDI is edi_manage, but 2 pages asked
for manage_edi, allowing users not to access those.

To test:
- Add edi_manage to your permissions
- Try to access the EDIFACT messages from the
  acq start page
- Verify it doesn't work
- Apply patch and try again
- You should be able to access the page now
- Try to access the other page directly (if you don't
  have EDI data):
  /cgi-bin/koha/acqui/edimsg.pl
- Verify you can access the page and don't get a
  permission error

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20838: Add 2 small tests to check ref
Jonathan Druart [Fri, 1 Jun 2018 14:39:52 +0000 (11:39 -0300)]
Bug 20838: Add 2 small tests to check ref

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20838: Make Koha::Library::Group->all_libraries return a list of Koha::Libraries
Jonathan Druart [Wed, 30 May 2018 17:53:28 +0000 (14:53 -0300)]
Bug 20838: Make Koha::Library::Group->all_libraries return a list of Koha::Libraries

Instead of a list of Koha::Library::Group
Ideally it should be a Koh::Libraries iterator

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20838: (bug 16735 follow-up) Fix search by group of libraries
Jonathan Druart [Wed, 30 May 2018 17:41:14 +0000 (14:41 -0300)]
Bug 20838: (bug 16735 follow-up) Fix search by group of libraries

In the last patches of bug 16735, we completely broke the feature!

The limit is using library_groups.id instead of branches.branchcode.

Test plan:
Create a group of library with the search feature
Search (OPAC and staff interfaces) using this limit

=> Without this patch you will see that the generated search query does
not contain branchcodes
=> With this patch applied you will see the branchcodes

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 3849: DBRev 18.06.00.001
Nick Clemens [Mon, 4 Jun 2018 15:21:06 +0000 (15:21 +0000)]
Bug 3849: DBRev 18.06.00.001

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 3849: (follow-up) Add database update to change descriptions
Katrin Fischer [Mon, 28 May 2018 22:17:46 +0000 (22:17 +0000)]
Bug 3849: (follow-up) Add database update to change descriptions

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 3849: Improve descriptions of granular acquisition permissions
Katrin Fischer [Sun, 20 May 2018 19:06:25 +0000 (21:06 +0200)]
Bug 3849: Improve descriptions of granular acquisition permissions

The permissions for acquisitions were not very clearly described.
This patch changes the descriptions in the include file (GUI) and
in the default SQL.

To test:
- Go to any patron account in staff
- Go to more > permissions
- Verify that the meaning of each acquisition permission is clear
  from the description

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20831: Fix KohaTable calls after bug 9573
Josef Moravec [Tue, 29 May 2018 08:49:19 +0000 (08:49 +0000)]
Bug 20831: Fix KohaTable calls after bug 9573

Test plan:
0) Do not apply the patch
1) Confirm not working datatable on patrons hold history page
2) Apply the patch
3) The table should be working now

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20763: Remove unecessary Koha::Patron fetch
Jonathan Druart [Mon, 28 May 2018 19:36:54 +0000 (16:36 -0300)]
Bug 20763: Remove unecessary Koha::Patron fetch

If $borrowernumber is not set, there is no userenv.
So let's pick the library code set in the userenv instead of fetching
the Koha::Patron->branchcode from DB

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20763: AllowPurchaseSuggestionBranchChoice triggers error opac-suggestions.pl...
Kyle M Hall [Mon, 14 May 2018 12:45:00 +0000 (08:45 -0400)]
Bug 20763: AllowPurchaseSuggestionBranchChoice triggers error opac-suggestions.pl is visited without logging in

Some code executed in the script opac-suggestions.pl if the system preference AllowPurchaseSuggestionBranchChoice is enabled assumes there is a logged in user. If there is not, patrons will see the error "Internal Server Error".

Test Plan:
1) Enable AllowPurchaseSuggestionBranchChoice
2) Enable AnonSuggestions
3) In the OPAC, perform a search that will have no results,
   click the "Make a purchase suggestion" link.
4) Note the error
5) Apply this patch
6) Reload the page
7) The page should load now!

Signed-off-by: Pierre-Luc Lapointe <pierreluc.lapointe@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20840: (bug 2696 follow-up) Fix biblio info fetch
Jonathan Druart [Fri, 1 Jun 2018 16:54:53 +0000 (13:54 -0300)]
Bug 20840: (bug 2696 follow-up) Fix biblio info fetch

There is no accountlines.biblionumber field, if the account line is
linked to an item, accountline-details.pl will explode with:
Template process failed: undef error - The method biblionumber is not
covered by tests!

Test plan:
Create a fine for a given item
Pay the fine
View the detail of the account line

=> Without this patch you get a software error
=> With this patch applied you will see the biblio's title

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20825: (QA follow-up) set biblioitemnumber with correct value
Nick Clemens [Tue, 29 May 2018 15:53:59 +0000 (15:53 +0000)]
Bug 20825: (QA follow-up) set biblioitemnumber with correct value

Both biblionumber and biblioitemnumber for item were set to
biblionumber, when they don't line up tests fail

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20798: Client side validation for for fund selection prevents adding only some...
Kyle M Hall [Mon, 21 May 2018 18:56:58 +0000 (14:56 -0400)]
Bug 20798: Client side validation for for fund selection prevents adding only some records to a basket

Bug 19453 "fixed" the fund validation that never actually worked. This validation should be removed altogether instead. It is overly simplistic and simply checks to see if each record in the batch has a fund selected regardless of whether that record will be imported or not.

In addition, the code completely ignores items generated by MarcItemFieldsToOrder such that even if items on that page have a fund selected, the javascript forces the librarian to make a selection from the left-hand fund pulldown even though it will not be used.

Considering this bad validation is basically 'new' as it never worked before, the most sensible course of action would be to 'undo' the change and remove the validation.

Test Plan:
1) Add records to a basket from an import batch
2) Select only some of those items in the batch
3) Note Koha will not let you import them unless you set funds for *all*
   records in the batch
4) Apply this patch
5) Note Koha no longer forces a budget to be selected in the pulldown

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=20789
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20761: Fix some js includes in rancor
Nick Clemens [Sun, 13 May 2018 01:44:28 +0000 (01:44 +0000)]
Bug 20761: Fix some js includes in rancor

To test:
1 - Load the advanced cataloging editor
2 - Inspect the network tab in your browser (F12)
3 - Note failure to load 'cataloging_.js'
4 - Note some other scripts don't have versioning
5 - Apply patch
6 - Reload page
7 - Note cataloging.js loads with version number
8 - Note more js files have versioning

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20696: Fix a few ugly "eq undef" comparisons in Search.pm
Marcel de Rooy [Wed, 2 May 2018 14:13:20 +0000 (16:13 +0200)]
Bug 20696: Fix a few ugly "eq undef" comparisons in Search.pm

Comparisons like $a eq undef should normally raise a warning like:
    Use of uninitialized value in string eq at ...
But unfortunately we still suppress warnings here and there.

Test plan:
[1] Just read this patch and confirm the small changes.
[2] Git grep on "eq undef" and do not find other occurrences.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Passes test plan and QA tools. Searching works correctly.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20818: Add missing QA Manager entry in 18.05.00 release notes
Jonathan Druart [Thu, 24 May 2018 19:33:19 +0000 (16:33 -0300)]
Bug 20818: Add missing QA Manager entry in 18.05.00 release notes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20781: Set a minimum enrollemnt period 'in months' of 1
Nick Clemens [Fri, 18 May 2018 14:01:09 +0000 (14:01 +0000)]
Bug 20781: Set a minimum enrollemnt period 'in months' of 1

To test:
 1 - Browse to Admin->Patron Categories
 2 - Click '+ New category'
 3 - Enter data as required, however, enter 0 in 'Enrolment period' ->
'in months'
 4 - Save
 5 - View the list of categories, the new category has 'Enrolment period'
= 'until'
 6 - Create a patron in this category, note their dateexipry is
'0000-00-00'
 7 - Search for them
 8 - internal server error
 9 - Delete that patron
10 - Apply patch
11 - Edit the category, note you cannot save with 0 months
12 - Set 1 month and save
13 - Create a patron in this cateogry
14 - Note they have a valid dateexpiry
15 - Search for them
16 - All works
17 - Create a new category and verify you cannot add with 0 months

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20767: Display a stack trace when a method is not covered by tests
Jonathan Druart [Mon, 14 May 2018 17:04:01 +0000 (14:04 -0300)]
Bug 20767: Display a stack trace when a method is not covered by tests

When a method is not allowed yet (not covered by tests), developers get
an error the is not really useful: "The method XXX is not covered by
tests!"
It would be more useful to have a stack trace in order to know where
this error come from.

Test plan:
Modify some code to display this stack trace and confirm it makes sense
to have it, i.e. it will make debug easier

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 3886: Fix mismatch of required permissions for printing slips
Katrin Fischer [Wed, 16 May 2018 00:45:02 +0000 (02:45 +0200)]
Bug 3886: Fix mismatch of required permissions for printing slips

- Print summary (summary-print.pl)
- Print quick slip (printslip.pl)
- Print slip (printslip.pl)
- Print overdues (print_overdues.pl)

Perl scripts all require circulate_remaining_permissions, while
in the template we were checking for edit_borrowers.

Now the print pull down will only be visible if the patron has
circulate or circulate_remaining_permissions.

To test:
- Verify that printing the listed slips works for staff users
  with either circulate or circulate_remaining_permissions
  and without edit_borrowers.

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20774: Trivial HTML error in itemslost.tt
Owen Leonard [Thu, 17 May 2018 11:38:39 +0000 (11:38 +0000)]
Bug 20774: Trivial HTML error in itemslost.tt

This patch makes a minor correction to the markup of the lost items
report template.

To test, apply the patch and run the lost items report with parameters
which will return results. The report results should look correct, and
the page should validate with no relevant errors.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20752: Fix capitalization on the files tab for patron files
Katrin Fischer [Thu, 10 May 2018 17:54:38 +0000 (17:54 +0000)]
Bug 20752: Fix capitalization on the files tab for patron files

- Activate EnableBorrowerFiles
- Go to any patron account in staff
- Go to the files tab
- Check that strings on the page ar all properly capitalized
  - button
  - legend on section

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20791: Correct capitalization on 'Notices & slips' page
Katrin Fischer [Fri, 18 May 2018 05:39:19 +0000 (05:39 +0000)]
Bug 20791: Correct capitalization on 'Notices & slips' page

- Standardizes spelling to 'Notices & slips'

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20827: Display Fund's owner name when selected
Jonathan Druart [Mon, 28 May 2018 14:40:20 +0000 (11:40 -0300)]
Bug 20827: Display Fund's owner name when selected

When a fund is created or edited and does not have a owner yet, the
name of the patron will not be displayed when selected.

The HTML element the JS code expects is not present in the DOM.

Test plan:
- Create a fund, set a owner
- remove the owner, edit, etc.
- Save
- Edit again
Make sure it works as expected.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20652: Fix result sorting after search on limit only
Jonathan Druart [Tue, 24 Apr 2018 18:38:41 +0000 (15:38 -0300)]
Bug 20652: Fix result sorting after search on limit only

1 chomp was missing, spaces were replaced with %20
This patch adds extra chomps, but it does not hurt

Test plan:
Advanced Search
Choose an Item type (do not enter any other search limits)
Search
Click on Sort (it doesn't appear to matter what you sort on)

Signed-off-by: Pierre-Luc Lapointe <pierreluc.lapointe@inLibro.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20822: (bug 18789 follow-up) Fix HOLD_SLIP
Jonathan Druart [Mon, 28 May 2018 18:11:09 +0000 (15:11 -0300)]
Bug 20822: (bug 18789 follow-up) Fix HOLD_SLIP

Caused by
  commit ab47e46ea0ade643b308a8b00708d57995c57050
  Bug 18789: Pass a Koha::Patron object from returns.pl

circ/returns.pl does not send a $patron Koha::Patron object to the
template in case print_slip is set

Test plan:
Confirm a hold and print the slip

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20825: (bug 19943 follow-up) call notforloan on itemtype instead of biblioitem
Jonathan Druart [Mon, 28 May 2018 14:24:43 +0000 (11:24 -0300)]
Bug 20825: (bug 19943 follow-up) call notforloan on itemtype instead of biblioitem

On bug 19943:
 -        elsif ($biblioitem->{'notforloan'} == 1){
 +        elsif ($biblioitem->notforloan == 1){

The biblioitems table does not contain a notforloan column, this comes
from the item type.

This bug only appears when item type is defined at biblio level
(item-level_itypes=0)

Test plan:
Set item-level_itypes = biblio
Check an item out

Without this patch it explodes with
"The method notforloan is not covered by tests!"

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
I reproduced the error condition and verified the tests failed without
this patch. After this patch is applied, tests pass and checkout
succeeds.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoBug 20825: Add regression tests
Jonathan Druart [Mon, 28 May 2018 14:20:32 +0000 (11:20 -0300)]
Bug 20825: Add regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoKoha 18.06 - It's Adventure time!
Nick Clemens [Fri, 25 May 2018 16:54:31 +0000 (16:54 +0000)]
Koha 18.06 - It's Adventure time!

There was once an ILS from New Zealand
They said "How hard could it be?" and
So we all came together
To help make it better
Come join us! The adventure will be grand!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
5 years agoKoha 18.05.00 is here! v18.05.00
Jonathan Druart [Thu, 24 May 2018 13:40:27 +0000 (10:40 -0300)]
Koha 18.05.00 is here!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
5 years agoAdd release notes for Koha 18.05.00
Jonathan Druart [Thu, 24 May 2018 14:45:52 +0000 (11:45 -0300)]
Add release notes for Koha 18.05.00

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
5 years agorevert missing part of bug 20073
Jonathan Druart [Thu, 24 May 2018 17:18:08 +0000 (14:18 -0300)]
revert missing part of bug 20073

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