koha.git
6 years agoBug 19554: The inventory table should jump to detail instead of MARCdetail
Marcel de Rooy [Tue, 31 Oct 2017 14:57:13 +0000 (15:57 +0100)]
Bug 19554: The inventory table should jump to detail instead of MARCdetail

This patch just replaces the link to detail.
Detail provides item information needed in case of inventory problems.

Test plan:
Go to Tools/Inventory.
Create an inventory list without barcode file.
Check if the link goes to detail now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19759: Make TestBuilder generates only 2 decimals for float
Jonathan Druart [Wed, 6 Dec 2017 16:03:15 +0000 (13:03 -0300)]
Bug 19759: Make TestBuilder generates only 2 decimals for float

For instance items.replacementprice is decimal(8,2) but more than 2 decimals are generated.

It leads to issues when we compare expected objects:

    #          got: '135623.866142537'
    #     expected: '135623.87'

Test plan:
  prove t/db_dependent/TestBuilder.t
must return green

Signed-off-by: Dominic Pichette <dominic@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Somehow I have the feeling that we should allow more decimals sometimes
and perhaps have a number of decimals parameter or so. Think of fields
like currency or discount.
But the current issues justify this change.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19706: (QA follow-up) Hide the collection code selector if no value is defined...
Josef Moravec [Sun, 17 Dec 2017 07:24:53 +0000 (07:24 +0000)]
Bug 19706: (QA follow-up) Hide the collection code selector if no value is defined (for consistency)

Test plan:
0) Go to item search
1) Do have some authorized values in CCODE category -> selector of
collection is visible
2) Don't have any authorized value in CCODE category -> selector of
collection is not visible

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19706: Fix bad json formed when there are no CCODE values
Nick Clemens [Tue, 12 Dec 2017 11:15:34 +0000 (11:15 +0000)]
Bug 19706: Fix bad json formed when there are no CCODE values

To test:
1 - Delete all ccode values in your system
2 - Load the item search page
3 - View the console and note a js error
4 - Try to perform an item search to screen
5 - Internal server error ("unsupported format 'html'" in logs)
6 - Apply patch
7 - Reload page
8 - Note js error is gone
9 - Perform search to screen, success!

To test there is no regression:
1 - Have some values in CCODE authorised values
2 - Ensure collection drop down on item search displays correctly
3 - Ensure item search returns results ot screen with no js errors

Signed-off-by Owen Leonard <oleonard@myacpl.org>

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18330: (follow-up) Do not return undef explicitely
Jonathan Druart [Mon, 18 Dec 2017 15:12:09 +0000 (12:12 -0300)]
Bug 18330: (follow-up) Do not return undef explicitely

This patch fixes a perl critic issue, hopefully it will not break
something else.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19767: Remove unused serial-issues.pl script
Owen Leonard [Mon, 11 Dec 2017 16:47:00 +0000 (16:47 +0000)]
Bug 19767: Remove unused serial-issues.pl script

This patch removes three unused files:

serials/serial-issues.pl

...and its associated templates:

koha-tmpl/intranet-tmpl/prog/en/modules/serials/serial-issues-full.tt
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serial-issues.tt

To test, apply the patch and search the Koha codebase for references to
any of those files. None should exist.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18330: (follow-up) Adapt holds.t to match the new datetime format
Tomas Cohen Arazi [Tue, 12 Dec 2017 21:35:47 +0000 (18:35 -0300)]
Bug 18330: (follow-up) Adapt holds.t to match the new datetime format

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18330: Handle date-time in Koha::Object->TO_JSON
Lari Taskula [Fri, 24 Mar 2017 13:29:30 +0000 (15:29 +0200)]
Bug 18330: Handle date-time in Koha::Object->TO_JSON

This patch formats timestamps and datetimes to meet date-time definition
in RFC3339, as required by Swagger documentation.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18330: Add RFC3339 to Koha::DateUtils
Lari Taskula [Fri, 24 Mar 2017 14:29:46 +0000 (16:29 +0200)]
Bug 18330: Add RFC3339 to Koha::DateUtils

To test:
1. prove t/DateUtils.t

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19663: Move JS to the footer: Reports
Owen Leonard [Mon, 20 Nov 2017 19:43:11 +0000 (19:43 +0000)]
Bug 19663: Move JS to the footer: Reports

This patch modifies the staff client's reports templates so
that JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of
reports pages: All button controls, DataTables functionality, form
validation, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Fix for QA: Remove unused Dopop function.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19627: (follow-up) Include tools-menu.js on required templates
Owen Leonard [Thu, 7 Dec 2017 13:25:11 +0000 (13:25 +0000)]
Bug 19627: (follow-up) Include tools-menu.js on required templates

This follow-up adds tools-menu.js to the two patron clubs templates
which include the tools sidebar menu.

The patch also modifies tools-menu.js so that the correct sidebar link
is highlighted when editing or viewing club enrollments.

To test, apply the patch and view the patron clubs main page and the
patron clubs enrollments page. The sidebar menu should have the correct
link highlighted in both cases.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19627: Move patron clubs templates JS to the footer
Owen Leonard [Wed, 15 Nov 2017 14:13:46 +0000 (14:13 +0000)]
Bug 19627: Move patron clubs templates JS to the footer

This patch modifies the staff client's patron clubs templates so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of
each page: All button controls, DataTables functionality, tabs, etc.

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19607: Move admin templates JavaScript to the footer: Basic parameters
Owen Leonard [Fri, 10 Nov 2017 13:23:43 +0000 (13:23 +0000)]
Bug 19607: Move admin templates JavaScript to the footer: Basic parameters

This patch modifies the staff client catalog-related administration
templates so that JavaScript is included in the footer instead of the
header.

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
tabs, etc.

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Edit: Rebased on Bug 19560

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19778: Move template JavaScript to the footer: Serials, part 4
Owen Leonard [Fri, 8 Dec 2017 16:04:15 +0000 (16:04 +0000)]
Bug 19778: Move template JavaScript to the footer: Serials, part 4

This patch modifies more and more staff client serials templates so
that JavaScript is included in the footer instead of the header.

This patch adds a new JavaScript include, showpredictionpattern.js,
which is used by subscription-add.tt and subscription-numberpatterns.tt.
it also adds subscription-add.js, moving most of the JS embedded in
subscription-add.tt into an external file.

To test, apply the patch and test the JavaScript-driven features of the
modified templates: All button controls, DataTables functionality, tabs,
etc.

 - Serials -> New subscription
   - Date pickers
   - Popup search windows for vendors and bibliographic
     records
   - Next / Previous buttons
   - Form validation
   - Prediction pattern operations

   Test with new subscriptions, editing existing subscriptions, and
   duplicating subscriptions.

 - Serials -> Manage Numbering Patterns
   - Datatable
   - Delete confirmation
   -> Edit
      - Datepicker, test pattern
 - Serials -> Manage frequencies
   - Delete confirmation
   -> Edit
      - Form validation
 - Serials -> Subscription details -> Planning tab
   -> Edit history
      -> Datepicker
 - Serials -> Subscription details -> Renew
   - Datepicker

Signed-off-by: Dominic Pichette <dominic@inlibro.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19777: Move template JavaScript to the footer: Serials, part 3
Owen Leonard [Thu, 7 Dec 2017 19:00:12 +0000 (19:00 +0000)]
Bug 19777: Move template JavaScript to the footer: Serials, part 3

This patch modifies even more staff client serials templates so
that JavaScript is included in the footer instead of the header.

This patch adds a new JavaScript include, serials-toolbar.js, which is
required on pages which include serials-toolbar.inc.

To test, apply the patch and test the JavaScript-driven features of the
modified templates: All button controls, DataTables functionality, tabs,
etc.

 - Serials
   - Search for a subscription
     - Tabs, datatables, date pickers
     - Open a subscription for viewing
       - Tabs, toolbar buttons for delete, renew, and close.
   - Serial collection (in the sidebar menu)
     - Select all / clear all
     - Datatable
     - Print slip
     - Generate next

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19761: Move template JavaScript to the footer: Serials, part 2
Owen Leonard [Thu, 7 Dec 2017 17:20:48 +0000 (17:20 +0000)]
Bug 19761: Move template JavaScript to the footer: Serials, part 2

This patch modifies more staff client serials templates so
that JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of the
modified templates: All button controls, DataTables functionality, tabs,
etc.

 - Serials -> Subscription detail -> Edit routing list
   - Add recipients
   - Save
     - "Save and preview routing slip" should trigger preview
       - In preview popup: Print and Close buttons should work correctly

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19758: Move template JavaScript to the footer: Serials, part 1
Owen Leonard [Wed, 6 Dec 2017 15:52:37 +0000 (15:52 +0000)]
Bug 19758: Move template JavaScript to the footer: Serials, part 1

This patch modifies some staff client serials templates so
that JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of the
modified templates: All button controls, DataTables functionality, tabs,
etc.

- Serials -> New subscription
  - Search for a vendor
    - "Choose" link and "Cancel" button should work correctly
  - Search for record
    - "Choose" link and "Cancel" button should word correctly
- Serials -> Add subscription fields
  - Datatable, delete confirmation
  - Edit
    - Form validation (submit both authorised value and MARC field)
- Serials -> Check expiration
  - Date picker in search form
  - Search
    - Renew button triggers popup
- Serials -> Claims -> Search results
  - Date picker, datatable, form validation
  - Select all/none; Download claims

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19514: Add client-side check
Jonathan Druart [Mon, 6 Nov 2017 15:22:59 +0000 (12:22 -0300)]
Bug 19514: Add client-side check

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19514: Implement password restrictions into onboarding tool
Alex Buckley [Sat, 21 Oct 2017 00:54:23 +0000 (00:54 +0000)]
Bug 19514: Implement password restrictions into onboarding tool

Test plan:
1. Drop and recreate your database
2. Restart memcached
3. Go through the web installer
4. In the onboarding tool create a patron with a password of only 2 characters in length
5. Notice the patron is successfully created and no warning message is
displayed
6. Repeat step 1,2,3 and create a patron with a password of 3 characters
none of which are a uppercase letter or number and notice the patron is
successfully created and no warning message is displayed
7. Apply patch
8. Repeat steps 1,2,3 and create a patron with a password consisting of
2 characters, notice that after submitting the form the same form is
loaded again and there is a warning message at the top of the page
informing you the patron wasn't created
9. Repeat steps 1,2,3 and create a patron with a password consisting of
3 characters (all lower case) and submit the form, notice the same form
is reloaded and a warning message at the top of the page informs you
that the patron wasn't created because the password was weak
10. Repeat steps 1,2,3 and create a patron with a password consisting of
3 characters (one lower case letter, one upper case letter and one
number) and submit the form and notice this time the next form in the onboarding is displayed with the message at the top of the screen informing you that the patron was successfully created

Sponsored-By: Catalyst IT
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19560: Correctly escape branchcode in admin/branches.pl
Jonathan Druart [Wed, 29 Nov 2017 18:24:40 +0000 (15:24 -0300)]
Bug 19560: Correctly escape branchcode in admin/branches.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19776: (follow-up) remove dup category_type keys
Jonathan Druart [Thu, 14 Dec 2017 19:01:33 +0000 (16:01 -0300)]
Bug 19776: (follow-up) remove dup category_type keys

The previous patch was obviously wrong, the category_type key appeared
twice.
categories.category_type is a varchar(1) and 'P' is not 'X'.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19410: (follow-up) Move build_query_params_from_api into a helper
Jonathan Druart [Mon, 11 Dec 2017 20:12:05 +0000 (17:12 -0300)]
Bug 19410: (follow-up) Move build_query_params_from_api into a helper

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19410: (follow-up) Add reserved params definitions
Tomas Cohen Arazi [Tue, 5 Dec 2017 18:40:56 +0000 (15:40 -0300)]
Bug 19410: (follow-up) Add reserved params definitions

This patch re-adds some parameters I left out during some rebasing tasks
and ended up on a separate patchset (bug 18731).

The introduced parameters definitions are only used on endpoint definitions
that implement (at least) pagination. No need to test them here but easier
adding them here than on a patch implementing a new enpoint, which would become
a dependency for other endpoints.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19410: Move build_query_params_from_api into a helper
Tomas Cohen Arazi [Tue, 21 Nov 2017 19:12:08 +0000 (16:12 -0300)]
Bug 19410: Move build_query_params_from_api into a helper

This patch creates the 'build_query_params' helper, instead of the
original function in Koha::Objects.

Unit tests are removed for Koha::Objects::_build_query_params_from_api and
written for the helper plugin.

The objects.search helper gets a call to build_query_params added. Tests for it
updated to match this behaviour change.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/Koha/REST/Plugin/Query.t \
          t/db_dependent/Koha/Objects.t \
          t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19410: Move search_for_api into a Mojo helper
Julian Maurice [Tue, 21 Nov 2017 14:36:49 +0000 (14:36 +0000)]
Bug 19410: Move search_for_api into a Mojo helper

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19410: (follow-up) Fix typo in POD
Lari Taskula [Sat, 7 Oct 2017 12:55:56 +0000 (12:55 +0000)]
Bug 19410: (follow-up) Fix typo in POD

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19410: Unit tests
Tomas Cohen Arazi [Fri, 6 Oct 2017 15:49:27 +0000 (12:49 -0300)]
Bug 19410: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19410: Add Koha::Objects->search_for_api
Tomas Cohen Arazi [Wed, 4 Oct 2017 18:41:35 +0000 (15:41 -0300)]
Bug 19410: Add Koha::Objects->search_for_api

Following the discussion about the best way to make things simpler for
developing the REST api, I quote Lari's email:

"As many other endpoint will have the exact same usage, by looking at your example, I would prefer to avoid writing parameter / pagination / sorting / header handling for each list operation in our API controllers. Do you think it's possible to centralize all of this e.g. by passing $c into a customized search sub? Perhaps in Koha::Objects?
so instead we could have something like (ignore my bad choice of naming)...:
sub list_vendors {
  my $c = shift->openapi->valid_input or return;
  my $args = $c->validation->output;
  my $vendors;

  return try {
    $vendors = Koha::Acquisition::Booksellers->api_list_search($c);
    return $c->render(status => 200, openapi => $vendors);
  } catch {
    ...
  }
}"

We all agreed we neeed something like that. Here's a possible implementation. I take
advantage of the previously written Mojo helpers, that are fully covered by tests.

I submit this early so anyone can take a look and gather ideas to make it even better.
I'm already using it (effectively) for the /acquisitions/orders endpoint I'm writing
on bug 18731.

Thanks!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19370: (QA follow-up) Use OpenAPI's handling of pipe separated values
Tomas Cohen Arazi [Thu, 23 Nov 2017 13:45:59 +0000 (10:45 -0300)]
Bug 19370: (QA follow-up) Use OpenAPI's handling of pipe separated values

This patch makes the helper handling _order_by params expect a list of
values instead of a (to-be-splitted) string.

The idea is that the OpenAPI plugin will take care of splitting
pipe-delimited values if the spec is correctly defined.

Note: In the process I noticed + on the URL represents a space, so the
helper function is updated to handle both + and %2B as ascending.

To test:
- Run:
  $ kshell
 k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass!
- Sign off :-D

Edit: Removed rebasing leftover making the tests fail.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19370: Remove undefined variable warning
Tomas Cohen Arazi [Tue, 3 Oct 2017 20:03:54 +0000 (17:03 -0300)]
Bug 19370: Remove undefined variable warning

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19370: Add helper function for order_by attribute generation
Tomas Cohen Arazi [Tue, 26 Sep 2017 18:17:43 +0000 (15:17 -0300)]
Bug 19370: Add helper function for order_by attribute generation

This patch introduces a helper function called 'dbic_merge_sorting'
to Koha::REST::Plugin::Query.

This simple function adds SQL::Abstract order_by attribute to the passed
$filter hashref, as explained in the POD.

It introduces a syntax for passing sorting params on the request to the REST api.
The proposed syntax has been found in the wild, and is pretty trivial to parse/work with:

    GET /api/v1/<endpoint>?order_by=+column_1|-column_2|column_3

As explained on the POD, + stands for 'asc' and - for 'desc'. If ommited, it defaults to the
DB engine default (usually asc).

To test:
- Apply this patches
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass! And they make sense! :-P
- Sign off :-D

Edit: renamed params to match DBIC terminology. My bad :-D (tcohen)

Sponsored-by: Camden County
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19370: Unit tests
Tomas Cohen Arazi [Tue, 26 Sep 2017 18:17:01 +0000 (15:17 -0300)]
Bug 19370: Unit tests

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19278: DBRev 17.12.00.004
Jonathan Druart [Mon, 11 Dec 2017 20:30:49 +0000 (17:30 -0300)]
Bug 19278: DBRev 17.12.00.004

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19278: Mention RESTdefaultPageSize in POD
Tomas Cohen Arazi [Fri, 22 Sep 2017 22:15:43 +0000 (19:15 -0300)]
Bug 19278: Mention RESTdefaultPageSize in POD

This patch adds information about RESTdefaultPageSize usage
when the per_page parameter is absent on the query.

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19278: (follow-up) Make the pagination plugin use RESTdefaultPageSize
Jonathan Druart [Mon, 11 Dec 2017 20:42:15 +0000 (17:42 -0300)]
Bug 19278: (follow-up) Make the pagination plugin use RESTdefaultPageSize

Use 20 as default for RESTdefaultPageSize (just in case)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19278: Make the pagination plugin use RESTdefaultPageSize
Tomas Cohen Arazi [Fri, 8 Sep 2017 15:20:20 +0000 (12:20 -0300)]
Bug 19278: Make the pagination plugin use RESTdefaultPageSize

This bug introduces a new syspref RESTdefaultPageSize that is used on
the Koha::REST::Plugin::Pagination plugin to default to a valid value
for the page size if the param is not present on the query.

This patch also considers the situation in which no 'page' param is
passed, and no header should be added.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Pagination.t
=> FAIL: Tests fail because the plugin doesn't behave as the tests
expect.
- Apply this patch
- Run:
 k$ prove t/Koha/REST/Plugin/Pagination.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: Camden County
Sponsored-by: ByWater Solutions
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19278: Unit tests
Tomas Cohen Arazi [Fri, 8 Sep 2017 15:18:35 +0000 (12:18 -0300)]
Bug 19278: Unit tests

This patch introduces tests for a behaviour change in
Koha::REST::Plugin::Pagination.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Pagination.t
=> FAIL: Tests should fail without the followup patch applied

Sponsored-by: Camden County
Sponsored-by: Bywater Solutions
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19278: Add RESTdefaultPageSize syspref
Tomas Cohen Arazi [Fri, 8 Sep 2017 15:18:21 +0000 (12:18 -0300)]
Bug 19278: Add RESTdefaultPageSize syspref

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19369: Add helper function for pagination attributes generation
Tomas Cohen Arazi [Tue, 26 Sep 2017 18:12:19 +0000 (15:12 -0300)]
Bug 19369: Add helper function for pagination attributes generation

This patch introduces a new helper function to the Koha::REST::Plugin::Pagination
plugin, called 'dbic_merge_pagination'.

This simple function adds SQL::Abstract pagination attributes ('page' and 'rows') to the
passed $filter hashref.

To test:
- Apply this patches
- Run:
  $ koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Pagination.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: Camden County
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19369: Unit tests
Tomas Cohen Arazi [Tue, 26 Sep 2017 18:11:38 +0000 (15:11 -0300)]
Bug 19369: Unit tests

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19234: (follow-up) Make Query plugin available to endpoints
Tomas Cohen Arazi [Fri, 1 Sep 2017 15:01:08 +0000 (12:01 -0300)]
Bug 19234: (follow-up) Make Query plugin available to endpoints

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19234: Add query parameters handling helpers
Tomas Cohen Arazi [Fri, 1 Sep 2017 14:53:35 +0000 (11:53 -0300)]
Bug 19234: Add query parameters handling helpers

This patch introduces a Mojolicious plugin to be used on the REST api.
It adds a helper method:

generate_dbic_query
===================

When used, it generates what's needed to perform a search on
DBIC/Koha::Objects like this:

    my $params  = $c->validation->output;
    my ($filtered_params, $reserved_params) = $c->extract_reserved_params($params);

    my $filter = do_smth($filtered_params, $reserved_params);
    my $attributes = do_smth_reserved($reserved_params);

    my $patrons = Koha::Patrons->search( $filter, $attributes );

It introduces reserved param names:
- _match
- _order_by
- _page
- _per_page

They are reserved for later usage (pagination, matching algorithm on building DB queries)

All the plugin's behaviour is tested.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater solutions
Sponsored-by: Camden County
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19234: Unit tests for query parameters handling helpers
Tomas Cohen Arazi [Fri, 1 Sep 2017 14:52:29 +0000 (11:52 -0300)]
Bug 19234: Unit tests for query parameters handling helpers

This patch adds unit tests for the new query parameters handling Mojo plugin.

Sponsored-by: Camden County
Sponsored-by: ByWater Solutions
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 17182: (QA follow-up) Fix call to GetMarcBiblio
Julian Maurice [Fri, 8 Dec 2017 14:31:49 +0000 (15:31 +0100)]
Bug 17182: (QA follow-up) Fix call to GetMarcBiblio

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 17182: Allow Keyword to MARC mapping for acquisitions searches
Nick Clemens [Wed, 19 Jul 2017 14:10:05 +0000 (14:10 +0000)]
Bug 17182: Allow Keyword to MARC mapping for acquisitions searches

This patchset adds the 'subtitle' field to the results display on
acquistions search for adding an order form an existing item.

Any field mapped to 'subtitle' in 'Keyword to MARC mapping' will be
fetched and displayed in the results

To test:
1 - Perform an acquisitions search for existing record
2 - Note record subtitles are not displayed
3 - Map 245$b and 245$n to 'subtitle' in 'Keyword to MARC mapping'
4 - Note they are still not displayed ion acq results
5 - Apply patch
6 - subtitle fields should now display

Sponsored by: Round Rock Public Library
<https://www.roundrocktexas.gov/departments/library/>

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19542: Use comma to separate indices
Jonathan Druart [Mon, 11 Dec 2017 17:28:26 +0000 (14:28 -0300)]
Bug 19542: Use comma to separate indices

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19542: (QA follow-up) Remove debug warn
Nick Clemens [Thu, 7 Dec 2017 15:35:42 +0000 (15:35 +0000)]
Bug 19542: (QA follow-up) Remove debug warn

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19542: Add Elasticsearch information in the 'About' page
Tomas Cohen Arazi [Tue, 31 Oct 2017 14:29:28 +0000 (11:29 -0300)]
Bug 19542: Add Elasticsearch information in the 'About' page

This patch adds Elasticsearch related information to the 'About' page.

The information is gathered and displayed only when the 'SearchEngine' syspref
is set to 'Elasticsearch'. It displays configured nodes, and the status:
- Running
- Not running

In case it is running, it displays the defined indices and the document count on each.
If there are configuration problems, exceptions are catch and a convenient warning
message is displayed.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Have ES configured in your koha-conf.xml file (by default in kohadevbox)
- Set the 'SearchEngine' syspref to 'Elasticsearch'
- Comment out pieces of the elasticsearch-specific entries (server, index_name,
  the whole elasticsearch block). Reload on each change.
=> SUCCESS: Warning messages are displayed and make sense in the context of your changes.
----> the rest of the tests require having ES running on the dev env. This can be easily
      achieved by creating the kohadevbox using:
        $ KOHA_ELASTICSEARCH=1 vagrant up
- Stop the 'elasticsearch' service:
  $ sudo service elasticsearch stop
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, and the status is 'not running'
- Start the 'elasticsearch' service:
  $ sudo service elasticsearch start
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, the status is 'running' and
            created indices info is displayed, along with the document count
            on each index.
- Sign off :-D

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19542: Add a check for ES configuration health
Tomas Cohen Arazi [Tue, 31 Oct 2017 14:26:36 +0000 (11:26 -0300)]
Bug 19542: Add a check for ES configuration health

This patch adds a new statuc function to Koha::SearchEngine::ElasticSearch
which is instended to replace most of get_elasticsearch_params. This function
reads the configuration from C4::Context->config('elasticsearch') and raises
relevant exceptions when mandatory entries are missing.

Its behaviour is covered by tests.

To test:
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 11210: Writeoff partial amounts
David Bourgault [Mon, 25 Sep 2017 17:05:01 +0000 (13:05 -0400)]
Bug 11210: Writeoff partial amounts

Minor changes to pay.pl and paycollect.tt to allow writing off a partial amount of a fine.

Test plan:
0) Go to the Fines tab of a test patron's profile
1) Create a fine if there are none (under the Manual invoice tab)
2) Go to the "Pay fines" tab
3) Press the write off button on the corresponding account line

Without patch, you'll be asked to confirm, but will not be able to edit the amount
With patch, you'll be able to edit the amount.

Followed test plan, patch worked as described. Also ran QA test tool and
modified files passed

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19769: 'Pickup library is different' message does not display library branch...
Claire Gravely [Thu, 7 Dec 2017 07:35:37 +0000 (07:35 +0000)]
Bug 19769: 'Pickup library is different' message does not display library branch name when placing hold

When placing a hold for a patron whose pickup library and home library
are different, the message displayed only shows the branch code and not
the branch name.

This patch displays the branch name as well as the branch code.

To test:
1. Search for an item
2. Click 'place hold'
3. Enter patron name/card number for a patron whose home library is
   different to the item's
4. Note the message displayed only shows the branch code but not the
   name
5. Apply Patch
6. Repeat 1-3
7. Message should now also display the branch name

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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19746: Remove debug statements in returns.pl
Jonathan Druart [Mon, 4 Dec 2017 19:07:52 +0000 (16:07 -0300)]
Bug 19746: Remove debug statements in returns.pl

From bug commit bb6277ffcc593685554112d770ac273c9efeda33
Bug 14464: Add ability to cancel waiting holds from checkin screen

+use Carp 'verbose';
+$SIG{ __DIE__ } = sub { Carp::confess( @_ ) };

See also
http://lists.koha-community.org/pipermail/koha-devel/2017-November/044168.html

Test plan:
Read the changes and make sure they make sense

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 3841: Add the ACQ framework for new installations
Jonathan Druart [Thu, 26 Oct 2017 18:41:47 +0000 (15:41 -0300)]
Bug 3841: Add the ACQ framework for new installations

This patch adds the acquisition frameworks (frameworkcode=ACQ) for new
installations.
It copies the 952 (MARC21) or 995 (UNIMARC) fields from the default
framework (frameworkcode='')

Test plan:
Create a new installation and make sure the ACQ framework exists.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19563: (follow-up) Restore checking sort variable
Nick Clemens [Fri, 17 Nov 2017 12:13:55 +0000 (12:13 +0000)]
Bug 19563: (follow-up) Restore checking sort variable

This code seems a bit odd, $self->sort_fields()->{$name} is checking if
there is any mapping in ES for a field, so if one marc field in an index
is marked as sortable this will exists. We need to check the individual
marc field to see if it should be added to the sort index here.

If you apply the first patch, reindex, and view a record in es:
curl -XGET 'localhost:9200/koha_kohadev_biblios/data/19/?pretty' | grep
-A 10 author__sort

You will see that 245$c is included in the record without that
additional check

Apply this, reindex again, and that field should not be included

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19563: Unit tests
Nick Clemens [Fri, 17 Nov 2017 12:12:32 +0000 (12:12 +0000)]
Bug 19563: Unit tests

To test:
1 - Apply first patch and this patch
2 - prove -v t/db_dependent/Koha_Elasticsearch.t
3 - New tests will fail
4 - Apply followup patch
5 - Tests shuld pass

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19563: Generation of sort_fields uses incorrect condition
David Gustafsson [Thu, 2 Nov 2017 12:44:13 +0000 (13:44 +0100)]
Bug 19563: Generation of sort_fields uses incorrect condition

Fix incorrect condition for if clause for generating <field>__sort mappings
for Elasticsearch. Also remove redundant check for same condition when
generating fixer rules.

Test plan:
1. Inspect current mappings for example by viewing: http://<elasticsearch_host>:9200/koha_<koha_instance_name>_biblios/_mapping.
2. If using the default configuraion only "author" has a sort field (author__sort).
4. Appy patch.
5. Reindex using rebuild_elastic_search.pl.
6. All fields except those with sort sort set to "0" should now have sort fields, which in the default configuration is all but "author".

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Only display outstanding fines in 'Pay fines'
Jonathan Druart [Mon, 11 Dec 2017 16:57:39 +0000 (13:57 -0300)]
Bug 10021: Only display outstanding fines in 'Pay fines'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Remove notify headers from pay*.tt
Jonathan Druart [Mon, 11 Dec 2017 16:32:09 +0000 (13:32 -0300)]
Bug 10021: Remove notify headers from pay*.tt

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19439: (follow-up) Remove four spaces from lines 133-149
Marcel de Rooy [Tue, 10 Oct 2017 13:50:24 +0000 (15:50 +0200)]
Bug 19439: (follow-up) Remove four spaces from lines 133-149

Speaks for itself. No test plan.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19439: Remove eval with exit statements from opac/unapi
Marcel de Rooy [Mon, 9 Oct 2017 13:12:05 +0000 (15:12 +0200)]
Bug 19439: Remove eval with exit statements from opac/unapi

The script contains some error responses that get lost when using them
in an eval statement. (Since exit should not be used within an eval
construction.) The eval is removed now.

Test plan:
[1] Before applying this patch, you could look at the current responses
    from unapi for the calls in the next steps. Apply the patch now.
[2] Call http(s)://[your-server]/cgi-bin/koha/unapi with only a format
    parameter.
    Check if you have a 400 status response. (In Firefox, look at Network
    tab of Developer Tools.)
    Note: Have to admit (reluctantly) that MS Edge shows the status code in
    the browser rightaway in contrast with Firefox.
[3] Call unapi with a format=marcxml&id=999
    The wrong id parameter should trigger a 404 response.
[4] Call unapi with format=marcxml&id=koha:biblionumber:[notexist]
    where notexist is a biblionumber that not exists.
    This should trigger again a 404 response.
[5] Call unapi with format=marcxmlx&id=koha:biblionumber:[exist]
    where exist should be a good biblionumber.
    The wrong format should trigger a 406 response.
[6] Bonus: The 500 response can be tested by manipulating a XSLT file.
    Create invalid xml in the file for marcxml (identity.xsl in intranet
    xslt folder).
    Call unapi with format=marcxml&id=koha:biblionumber:[exist].
    You should get a 500 response and have warnings in your logfile.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19726: Move admin templates JavaScript to the footer: Preferences
Owen Leonard [Fri, 1 Dec 2017 13:53:16 +0000 (13:53 +0000)]
Bug 19726: Move admin templates JavaScript to the footer: Preferences

This patch modifies the staff client's system preferences templates so
that JavaScript is included in the footer instead of the
header.

To test, apply the patch and test the JavaScript-driven features of
both the standard and local use system preferences:

 - WYSIWYG editor
 - Confirmation messages
 - Table sorting
 - Multiple selects (CoceProviders for example)

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19710: Move plugins templates javascript to the footer
Owen Leonard [Tue, 28 Nov 2017 19:04:43 +0000 (19:04 +0000)]
Bug 19710: Move plugins templates javascript to the footer

This patch modifies the staff client plugins template so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of
the modified template:

- The plugins link should be bold in the sidebar menu.
- Choosing "Uninstall" for an installed plugin should trigger a
  confirmation alert.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19700: Move template JavaScript to the footer: Some circulation pages
Owen Leonard [Mon, 27 Nov 2017 15:15:06 +0000 (15:15 +0000)]
Bug 19700: Move template JavaScript to the footer: Some circulation pages

This patch modifies some staff client circulation templates so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of the
modified templates: All button controls, DataTables functionality, tabs,
etc.

- Article requests (enable ArticleRequests system preference, have at
  least one outstanding article request)
  - Request article (Bibliographic detail page -> Request article).
- Item circulation statistics (Bibliographic detail page -> Items ->
  View item's checkout history).
- On-site checkouts (enable OnSiteCheckouts system preference; Check out
  some items as on-site checkouts; Go to Circulation ->
  Pending on-site checkouts
- Overdues report (Circulation -> Overdues).
- Holds to pull (Circulation -> Holds to pull).
- Renew
- Holds ratios (Circulation -> Holds ratios).
- Check in
- Transfers to receive (Circulation -> Transfers to receive).
- Holds queue (Circulation -> Holds queue).
- Holds awaiting pickup (Circulation -> Holds awaiting pickup).

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19697: Move template JavaScript to the footer: Search results
Owen Leonard [Mon, 27 Nov 2017 12:51:16 +0000 (12:51 +0000)]
Bug 19697: Move template JavaScript to the footer: Search results

This patch modifies the staff client catalog search results template so
that JavaScript is included in the footer instead of the header.

To test, apply the patch and test the various JavaScript-driven features
of the results page: Floating toolbar, cart, lists, cover images, search
to hold, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19680: Move JS to the footer: Patron and circulation tools
Owen Leonard [Wed, 22 Nov 2017 19:03:15 +0000 (19:03 +0000)]
Bug 19680: Move JS to the footer: Patron and circulation tools

This patch modifies more staff client patrons and circulation tools
templates so that JavaScript is included in the footer instead of the
header.

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
form validation, etc.

  - Batch patron deletion/anonymization
  - Overdue notice/status triggers
  - Batch patron modification

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19679: Move templates JavaScript to the footer: More tools templates
Owen Leonard [Wed, 22 Nov 2017 15:53:42 +0000 (15:53 +0000)]
Bug 19679: Move templates JavaScript to the footer: More tools templates

This patch modifies more staff client tools templates so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
form validation, etc.

  Export data
  Inventory
  Notices & slips
  Upload local cover image

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19672: Move tools templates JavaScript to the footer: More MARC tools
Owen Leonard [Tue, 21 Nov 2017 15:14:58 +0000 (15:14 +0000)]
Bug 19672: Move tools templates JavaScript to the footer: More MARC tools

This patch modifies some staff client templates from the "Tools"
section so that JavaScript is included in the footer instead of the
header.

- Automatic item modifications by age
- MARC modification templates
- Stage MARC records for import
- Staged MARC record management

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
form validation, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19659: Move JS to the footer: Suggestions and tags
Owen Leonard [Mon, 20 Nov 2017 18:05:14 +0000 (18:05 +0000)]
Bug 19659: Move JS to the footer: Suggestions and tags

This patch modifies the staff client's suggestions and tags templates so
that JavaScript is included in the footer instead of the header.

This patch adds a new JS file, acquisitions-menu.js, which will be added
to each template which has the Acquisitions sidebar menu (in this case,
suggestions). Highlighting of the current page in the sidebar menu will
be broken for pages which have not been modified to use this file.

To test, apply the patch and test the JavaScript-driven features of
suggestions and tags pages: All button controls, DataTables
functionality, form validation, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19657: Move lists templates JS to the footer
Owen Leonard [Mon, 20 Nov 2017 17:05:10 +0000 (17:05 +0000)]
Bug 19657: Move lists templates JS to the footer

This patch modifies the staff client's lists templates so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of the
lists page: All button controls, DataTables functionality, form
validation, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19656: (QA follow-up) Add bold style to rotating colections menu item
Josef Moravec [Wed, 6 Dec 2017 16:14:51 +0000 (16:14 +0000)]
Bug 19656: (QA follow-up) Add bold style to rotating colections menu item

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19656: Move rotating collections templates JS to the footer
Owen Leonard [Mon, 20 Nov 2017 16:41:33 +0000 (16:41 +0000)]
Bug 19656: Move rotating collections templates JS to the footer

This patch modifies the staff client's rotating collections templates so
that JavaScript is included in the footer instead of the header.

The patch moves JavaScript from each template and the rotating
collections toolbar into a single external JavaScript file.

To test, apply the patch and test the JavaScript-driven features of
each page: All button controls, DataTables functionality, form
validation, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19653: (QA follow-up) Add bold style to quotes menu item on quotes-upload page
Josef Moravec [Wed, 6 Dec 2017 15:19:46 +0000 (15:19 +0000)]
Bug 19653: (QA follow-up) Add bold style to quotes menu item on quotes-upload page

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19653: Move tools templates JavaScript to the footer: Additional tools
Owen Leonard [Tue, 28 Nov 2017 15:41:54 +0000 (15:41 +0000)]
Bug 19653: Move tools templates JavaScript to the footer: Additional tools

This patch modifies the staff client "Additional tools" templates so
that JavaScript is included in the footer instead of the header:

- Calendar
- CSV profiles
- Log viewer
- News
- Task scheduler
- Edit quotes for QOTD feature
- Upload

Note that the log viewer template has been modified so that the
"interface" variable (passed to the template to provide the correct path
to staff client assets) isn't overwritten by an "interface" variable
required by the log viewer.

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
form validation, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19628: Move course reserves templates JS to the footer
Owen Leonard [Wed, 15 Nov 2017 16:08:57 +0000 (16:08 +0000)]
Bug 19628: Move course reserves templates JS to the footer

This patch modifies the staff client course reserves templates so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of
each page: All button controls, DataTables, autocomplete, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19601: Move admin templates JavaScript to the footer: Additional parameters
Owen Leonard [Thu, 9 Nov 2017 13:53:19 +0000 (13:53 +0000)]
Bug 19601: Move admin templates JavaScript to the footer: Additional parameters

This patch modifies the staff client "additional parameters"
administration templates so that JavaScript is included in the footer
instead of the header.

To test, apply the patch and test the JavaScript-driven features of
each page: All button controls, DataTables functionality, tabs, etc.

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19600: (QA follow-up) Apply css to menu item for item_search_field page
Josef Moravec [Tue, 5 Dec 2017 10:58:11 +0000 (10:58 +0000)]
Bug 19600: (QA follow-up) Apply css to menu item for item_search_field page

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19600: Move admin templates JavaScript to the footer: Other catalog pages
Owen Leonard [Thu, 9 Nov 2017 13:24:04 +0000 (13:24 +0000)]
Bug 19600: Move admin templates JavaScript to the footer: Other catalog pages

This patch modifies the staff client catalog-related administration
templates so that JavaScript is included in the footer instead of the
header.

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
tabs, etc.

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19647: Move patron lists templates JS to the footer
Owen Leonard [Fri, 17 Nov 2017 16:32:56 +0000 (16:32 +0000)]
Bug 19647: Move patron lists templates JS to the footer

This patch modifies the staff client patron lists templates so that
JavaScript is included in the footer instead of the header.

This patch adds a new JS file, tools-menu.js, which will be added to
each template which has the Tools sidebar menu. Highlighting of the
current page in the sidebar menu will be broken for pages which have not
been modified to use this file.

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
form validation, etc.
resolved the issue, sorry about that, everything is working fine!Signed-off-by: Dominic Pichette <dominic@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19594: Move admin templates JavaScript to the footer: MARC-related
Owen Leonard [Wed, 8 Nov 2017 17:40:55 +0000 (17:40 +0000)]
Bug 19594: Move admin templates JavaScript to the footer: MARC-related

This patch modifies the staff client MARC-related administration
templates so that JavaScript is included in the footer instead of the
header.

To test, apply the patch and test the JavaScript-driven features of the
cart: All button controls, DataTables functionality, tabs, etc.

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19592: Move admin templates JavaScript to the footer: Acquisitions
Owen Leonard [Wed, 8 Nov 2017 15:55:23 +0000 (15:55 +0000)]
Bug 19592: Move admin templates JavaScript to the footer: Acquisitions

This patch modifies the staff client acquisitions-related adminisration
templates so that JavaScript is included in the footer instead of the
header.

To test, apply the patch and test the JavaScript-driven features of the
cart: All button controls, DataTables functionality, tabs, etc.

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 12227: Remove the demo functionality
Jonathan Druart [Wed, 27 Sep 2017 17:30:20 +0000 (14:30 -0300)]
Bug 12227: Remove the demo functionality

This is a legacy mode that did not really work.

Test plan:
Play with frameworks and sysprefs and confirm the changes
(add/del/update) are taken into account.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19292: Add MARC code column on libraries list
Josef Moravec [Fri, 6 Oct 2017 07:26:31 +0000 (07:26 +0000)]
Bug 19292: Add MARC code column on libraries list

Test plan:
0) Apply the patch
1) Go to admin/branches.pl
2) In the list of libraries, you should see new column "MARC Organization Code"
3) Insert some codes to some libraries
4) Confirm they are shown in new column

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Fixed capitalization.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19299: Replace C4::Reserves::GetReservesForBranch with Koha::Holds->waiting
Jonathan Druart [Mon, 11 Sep 2017 15:49:33 +0000 (12:49 -0300)]
Bug 19299: Replace C4::Reserves::GetReservesForBranch with Koha::Holds->waiting

GetReservesForBranch simply returns the waiting holds, for a specific
branch of not. This can easily be replaced with a call to
Koha::Holds->waiting

To avoid any regressions, I reuse the exact conditions (priority = 0),
but I do not think it is useful.

Test plan:
Make sure the holds information are correctly displayed on the waiting
holds screen.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19751: Holds awaiting pickup report should not be fixed-width
Owen Leonard [Tue, 5 Dec 2017 15:26:58 +0000 (15:26 +0000)]
Bug 19751: Holds awaiting pickup report should not be fixed-width

This patch changes the grid used for the holds awaiting pickup report so
that the results are full page and fluid instead of fixed-width.

To test, apply this patch and the patch for Bug 19700 if necessary.

View the holds awaiting pickup report. The report should fluidly fill
the page width.

Test with the CircSidebar system preference enabled and disabled.

Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: BWS Sandboxes <ByWaterSandboxes@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: DBRev 17.12.00.003
Jonathan Druart [Wed, 29 Nov 2017 18:18:31 +0000 (15:18 -0300)]
Bug 10021: DBRev 17.12.00.003

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: (QA follow-up) Rename variables
Jonathan Druart [Fri, 3 Nov 2017 16:40:38 +0000 (13:40 -0300)]
Bug 10021: (QA follow-up) Rename variables

To avoid $account, $accounts and @accounts variables in the same scope

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Restore "Pay fines" list
Jonathan Druart [Tue, 24 Oct 2017 21:45:31 +0000 (18:45 -0300)]
Bug 10021: Restore "Pay fines" list

Previous changes were wrong, the notify_id was always equal to 1 and
GetBorNotifyAcctRecord was used to retrieved the account lines to pay

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Remove notify columns in circ/branchoverdues.tt
Jonathan Druart [Tue, 24 Oct 2017 21:25:38 +0000 (18:25 -0300)]
Bug 10021: Remove notify columns in circ/branchoverdues.tt

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Remove accountlines columns - DBIC Schema changes
Jonathan Druart [Mon, 23 Oct 2017 15:27:58 +0000 (12:27 -0300)]
Bug 10021: Remove accountlines columns - DBIC Schema changes

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Update DB changes
Jonathan Druart [Mon, 23 Oct 2017 15:27:33 +0000 (12:27 -0300)]
Bug 10021: Update DB changes

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Drop columns notify_id and notify_level from accountlines
Jonathan Druart [Wed, 18 Oct 2017 13:43:17 +0000 (10:43 -0300)]
Bug 10021: Drop columns notify_id and notify_level from accountlines

It appears that has never worked.
Could someone confirm?

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10021: Drop table notifys and related code
Jonathan Druart [Mon, 8 Aug 2016 15:24:21 +0000 (16:24 +0100)]
Bug 10021: Drop table notifys and related code

This patch drops the notifys table and its related code in C4::Overdues.
A second patch should remove the 2 columns notify_id and notify_level
from the accountlines table.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19096: DBRev 17.12.00.002
Jonathan Druart [Mon, 11 Dec 2017 14:22:41 +0000 (11:22 -0300)]
Bug 19096: DBRev 17.12.00.002

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19096: Add update DB entry to sync kohafield in all frameworks
Marcel de Rooy [Thu, 17 Aug 2017 08:57:28 +0000 (10:57 +0200)]
Bug 19096: Add update DB entry to sync kohafield in all frameworks

Squashed the last four follow-ups into one patch. Instead of adding
two routines to Koha::MarcSubfieldStructures, and instead of moving
them to Koha::Util::Dbrev, we finally ended up with converting the
code to raw SQL queries (thx Jonathan). No need to 'pollute' the git
history with all this moving around.

As Jonathan pointed out, there is a risk in using DBIx calls (with Koha
objects) while running database revisions. See also bug 17292 and
bug 19789.

I tested the resulting db revision by adding a few fields to the Default
framework and adding deviating kohafields in other frameworks. And confirm
that it works as expected.

Please read the remainder of this commit message in the light of the above:

===

The dbrev will use two new routines in MarcSubfieldStructures:
[1] get_kohafield_exceptions is used to report deviating kohafields in
    the additional frameworks,
[2] sync_kohafield is used to reset kohafield in the other frameworks to
    the mapping in Default.

Test plan:

Unit test and database revision:
[1] Run t/db_dependent/Koha/MarcSubfieldStructures.t
[2] Verify that your Default 100a is mapped to biblio.author. Go to another
    framework and clear the mapping via mysql command line:
    UPDATE marc_subfield_structure SET kohafield=NULL WHERE frameworkcode=[your_framework] AND tagfield='100' AND tagsubfield='a';
[3] Run the db revision. It should report that 100a was adjusted.
[4] Check in admin/marc_subfield_structure that your 100a is mapped to
    biblio.author again in that framework.

Additional interface testing (ensuring that the changes on this report do
not interfere with multiple mappings):
[5] Make two mappings for copyrightdate: 260c and 264a. And make two
    mappings for biblioitems.pages: 300a and say 300g. Toggle with some
    field values in those fields in the cataloging editor and verify the
    contents of biblio.copyrightdate and biblioitems.pages. The former
    should contain one year (due to additional logic) and the latter should
    contain A | B if both fields are filled.
    Remove the mapping for 300g.
[6] Set AcqCreateItem to ordering or placing. Verify that you can still
    add or receive an order as usual.
[7] Add a mapping for itemcallnumber to 952f (this should remove the one
    for coded_location_qualifier). This is very unusual but serves well in
    testing multiple mappings for items.
    Add or receive an order (fill 952f and 952o) with same and/or different
    values. Verify the contents of items.callnumber. (Check with regular
    item editor; see note.)
    Do a similar edit in the regular item editor.
    Note: You should expect to see A | B in both 952f and 925o if both
    fields are filled with a different value.
    Set items.coded_location_qualifier back to 952f in koha2marclinks.

    Note: When AcqCreateItem==ordering, you will not see A|B in the callno
    field when adding an item on neworderempty.pl. But when you submit
    the main form, addorder.pl is called. At that time an item is created
    and you will see that A|B is in both fields (952f and 952o).

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 19096: (QA follow-up) Move two routines out of Koha::MSS

As requested by RM, this patch moves sync_kohafield and
get_kohafield_exceptions from Koha/MarcSubfieldStructures.pm.

At this moment they are only used in a database revision; it is not clear
if they may be of use later on.

In order to keep them in a module and not remove the unit tests, this
patch adds a Koha::Util module Dbrev.pm. It is now required in the atomic
update, but could be added in a use statement in updatedatabase.pl.

Test plan:
[1] Run updatedatabase.pl
[2] Run t/db_dependent/Koha/MarcSubfieldStructures.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 19096: Use raw SQL queries instead for the update DB entry

I strongly thing we must not use C4 or Koha subroutine in the update DB
process, only sql queries.
Especially not DBIC Schema files as they will change.
For instance the update DB 17.12.00.00X is using a specific Koha::Schema::RS::MSS
representing the current schema, but in X months/years, this schema will change
and the ->search we used may failed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 19096: Move the sql queries to the update DB entry

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: Print "Field 700$a" instead of "Field 700.a" in the dbrev.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19096: Restructure MarcSubfieldStructures.t first
Marcel de Rooy [Thu, 17 Aug 2017 09:44:18 +0000 (11:44 +0200)]
Bug 19096: Restructure MarcSubfieldStructures.t first

Before adding more tests, move all current tests in one subtest.

Test plan:
Run t/db_dependent/Koha/MarcSubfieldStructures.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19096: Online help changes
Marcel de Rooy [Wed, 16 Aug 2017 12:37:06 +0000 (14:37 +0200)]
Bug 19096: Online help changes

On the page admin/marc_subfields_structure we now tell that Koha link
has been disabled and refer to the help for koha2marclinks.
On the page admin/koha2marclinks we mention that the Default mapping is
considered authoritative now.

Test plan:
Read these online help pages and verify that the changes make sense.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19096: Do not allow changes to kohafield within MARC frameworks
Marcel de Rooy [Mon, 7 Aug 2017 13:02:10 +0000 (15:02 +0200)]
Bug 19096: Do not allow changes to kohafield within MARC frameworks

This patch makes two changes in the script for managing the MARC
frameworks in order to support making the Default authoritative
as for Koha to MARC mappings:

[1] Disable the kohafield select combo. Add a hidden input to save value.
[2] When a new subfield is added, the kohafield is still empty and should
    be overwritten with its Default counterpart.
    Note: Although we could leave the field empty, since Koha looks at the
    Default framework only, it does not cost much to keep these fields in
    sync with Default and perhaps catch a bug when someone somewhere looks
    in the wrong framework.

Note: The description of Koha to MARC mapping on admin-home has been
adjusted accordingly (removing last two lines).

Test plan:
[1] Add a new tag and subfield in Default.
[2] Map it to a kohafield in koha2marclinks.pl
[3] Add the same tag and subfield in another framework.
    Verify that the kohafield is updated after you saved the subfield.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19096: Adjusts unit tests
Marcel de Rooy [Thu, 10 Aug 2017 08:59:07 +0000 (10:59 +0200)]
Bug 19096: Adjusts unit tests

The subroutines listed in the former patch are extensively tested in
Biblio.t, TransformKohaToMarc.t and TransformMarcToKoha.t.
These tests do no longer use new frameworks to add mappings.

In Biblio.t and TransformMarcToKoha.t we also test passing an individual
framework code (for an empty framework) to see if Default is still used.
Note that this parameter will be removed later on.

In Items.t the cache keys MarcStructure-0- and MarcStructure-1- are not
touched, so they do not need to be cleared. The cache key
default_value_for_mod_marc- should be used without framework now.
Similar adjustments in Items/AutomaticItemModificationByAge.t and
Reserves.t.

Furthermore the subtest for _build_default_values_for_mod_marc in Items.t
is adjusted since framework is no longer relevant. The biblio record with
items is created in a new framework, but the mappings from Default are
consulted.

Test plan:
Run all adjusted unit tests.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19096: Make Default authoritative in core modules
Marcel de Rooy [Thu, 10 Aug 2017 08:59:07 +0000 (10:59 +0200)]
Bug 19096: Make Default authoritative in core modules

After feedback from the dev mailing list, it seems appropriate here to
propose making the Default framework authoritative for Koha to MARC
mappings. This implies checking only the Default framework in the
routines:

[1] GetMarcFromKohaField: The parameter frameworkcode is removed. A
    follow-up report (19097) will update the calls not adjusted here.
    This is safe since the parameter is silently ignored.
[2] GetMarcSubfieldStructureFromKohaField: Framework parameter is removed
    and calls are adjusted. Includes acquisitions_stats.pl.
[3] TransformKohaToMarc: The parameter is removed; all calls are verified
    or adjusted.
[4] TransformMarcToKoha: The parameter is no longer used and will be
    removed in a follow-up report (19097). It always goes to Default now.
[5] TransformMarcToKohaOneField: The parameter is removed and all calls
    are adjusted. Including: Breeding, XISBN and MetadataRecord modules.
[6] C4::Koha::IsKohaFieldLinked: This routine was called only once (in
    C4::Items::_build_default_values_for_mod_marc. It can be replaced by
    calling GetMarcFromKohaField. If there is no kohafield linked, undef
    is returned. (Corresponding unit test is removed here.)
[7] C4::Items::ModItemFromMarc: The helper routine
    _build_default_values_for_mod_marc does no longer have a framework
    parameter. The cache key default_value_for_mod_marc- is no longer
    combined with a frameworkcode. Three admin scripts are adjusted
    accordingly; some tests will be corrected in the next patch.

Test plan:
See next patch. That patch adjusts all tests involved.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 10306: (QA follow-up) More feedback for admins in koha2marclinks
Marcel de Rooy [Mon, 23 Oct 2017 10:07:04 +0000 (12:07 +0200)]
Bug 10306: (QA follow-up) More feedback for admins in koha2marclinks

As requested by Tomas, this patch does:

[1] Add a js alert when you did not type field,subfield
[2] Print a yellow alert div when the field,subfield is not found.
[3] Bonus: Make it little bit more secure by demanding a POST. (Leaving
    CSRF etc. for another report.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>