Commit graph

32046 commits

Author SHA1 Message Date
7eceade7da Bug 19604: Unit tests
1 - Apply previous patches
2 - prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
3 - Should be green
4 - high fives!

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 17:23:55 +00:00
f983c1e3f7 Bug 19604: Elasticsearch Fixes for build_authorities_query for auth searching
To test:
1 - Do some authority searches in Zebra
2 - Switch to ES and repeat, results will vary and some may fail
3 - Apply patch and dependencies
4 - Reindex ES
5 - Repeat searches, they should suceed and results should be similar to
Zebra
6 - Slight differences are okay, but results should (mostly) meet
expectations

A few notes:
We add a 'normalizer' to ensure we get a single token from the heading
indexes, this makes 'starts with' work as expcted
We switch to 'AND' for fields searched from cataloging editor - this
matches Zebra results
We force the '__sort' fields for sorting - if sorting looks wrong try
reducing the heading field to a single subfield - this will need to be
addressed on a future bug (multiple subfields create an array, ES sorts
        those randomly)

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 17:23:54 +00:00
3286bead8e Bug 13560: DBRev 18.06.00.008
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 17:22:18 +00:00
284226a496 Bug 13560: Add an 'Add' option for marc modification templates
Add/Update would update a field or create new if it existed, but didn't
allow for creating new if the field existed.

This patchset splits the options to 'Add & Update' so that 'Add' will always
add a field and 'Update' will operate as it always has

To test:
1 - Have a record with a known existing field (make a copy)
2 - Define a marc modification template that 'Add/update' on that field
3 - Define an 'Add/Update' on a field that doesn't exist
4 - Batch modify the copy of record using the above template
5 - Verify the existing field was updated
6 - Verify the non-existing field was updated
7 - Apply patch and update database
8 - Make another copy
9 - Modify the copy with the same template as above
10 - Should match initial modification
11 - Add a new rule to add a new field
12 - Modify using the updated template
13 - Ensure your new field is created
14 - Test various options in the modification tool
15 - prove t/db_dependent/MarcModificationTemplates.t

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 17:22:18 +00:00
c20fbda461 Bug 13560: Unit tests
To test:
1 - apply all patches
2 - update database
3 - prove t/db_dependent/MarcModificationTemplates.t

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 17:22:12 +00:00
715bc0f96d Bug 13560: Database changes
Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 17:22:04 +00:00
ad34ef74cd Bug 20974: Remove files left behind after removing Solr
Some files were left behind when Bug 12538 removed support for Solr.
This patch removes them.

To test, apply the patch and fail to observe the existence of these
files:

koha-tmpl/opac-tmpl/bootstrap/en/includes/search/facets.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/search/page-numbers.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/search/resort_form.inc

Perform a search in the OPAC to confirm that nothing broke.

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>
2018-07-19 17:15:53 +00:00
3c034dcc3a Bug 21086: Fix wrong mock of DateTime->now
prove t/db_dependent/DecreaseLoanHighHolds.t
t/db_dependent/DecreaseLoanHighHolds.t .. 1/17 Can't locate object method
 "truncate" via package "80" (perhaps you forgot to load "80"?) at /home/vagrant/kohaclone/C4/Circulation.pm line 3497.

What is happening:
We mock DateTime->now in the script to avoid the date comparaisons to fail on
slow servers (see bug 19705).

  my $now_value       = DateTime->now();
  my $mocked_datetime = Test::MockModule->new('DateTime');
  $mocked_datetime->mock( 'now', sub { return $now_value; } );

Since bug 20287, we have the following calls:
Koha::Patron->store => Koha::Patron::Category->get_expiry_date

which does:
221         return $date->add( months => $self->enrolmentperiod, end_of_month => 'limit' );

as enrolmentperiod is generated by t::lib::TestBuilder, it can be quite big, and so
the date change from one call to the others.

The failure is actually coming from the date becoming > 9999, which is not handled correctly,
on purpose, by Koha::DateUtils (infinite)

On the way this patch fixes the other occurrence, in Sitemapper.t (just in case)

Test plan:
Make sure the tests pass now.

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>
2018-07-19 16:24:57 +00:00
367f47c416 Bug 21064: Use undefined instead of undef
To test:
1 - Load the advanced cataloging editor
2 - Refresh the page several times
3 - Check the JS console, you shoudl see an error:
    'undef is not defined'
4 - Apply patch
5 - Try again, should be no error

Signed-off-by: Pierre-Luc Lapointe <pierreluc.lapointe@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 16:24:30 +00:00
bfdf896111 Bug 21053: Encode URI characters in plugin 008
A # (or &) at any position in 008 field of a bib record causes
all subsequent data in field to be overwritten with default values when
record is saved.

These characters need to be correctly encoded before being passed as
parameters of the url

To reproduce:
1. Find and edit a bib record which has an 008 which differs from the
default values for the MARC framework
2. Choose 008 helper
3. Add # in any position before the end of the field noting the current
values of the data
4. Save record
5. Edit record and select 008 helper
6. Review characters after #

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 16:23:16 +00:00
5a9bad7874 Bug 21076: Don't call autocomplete code after patron found
To test:
1 - Enable article requests
2 - Search on staff client
3 - Click 'Request article'
4 - Find a patron
5 - View error in console
6 - Apply patch
7 - Reload
8 - Not error is gone

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 16:16:04 +00:00
Katrin Fischer
c02543baaa Bug 16575: (follow-up) Compiled CSS
This patch contains the compiled CSS for the OPAC print stylesheet.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-19 16:12:57 +00:00
a9836864dc Bug 16575: Irregular behaviour using window.print() followed by window.location.href
This patch updates the OPAC and staff client carts to use CSS to
control print output, removing a print parameter which was passed to the
script.

Currently, when you click "Print" on the OPAC basket, it navigates to
a new page and initiates window.print() followed by a
window.location.href change again. Unfortunately, due to differences in
IE, Chrome, and FF, it will either show the print options, navigate away
without showing them, or refuse to navigate away after printing. By
changing to using print CSS, we don't navigate away from the basket in
the first place, so we prevent this irregular behavior.

TEST PLAN

1) Apply the patch
2) Create an OPAC basket by clicking "Add to cart" on multiple items
3) Using Chrome, IE, and Firefox (of any version), click the "Print"
   button
4) You should see the relevant print menu without the OPAC basket
   re-loading in any way.
5) After printing is complete, you should still be on the OPAC basket
   pop-up
6) Perform the same tests in the staff client

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>
2018-07-19 16:12:56 +00:00
c95f5c17a6 Bug 21085: Fix add/edit of patrons when HouseboundModule is set
This script takes all the parameters then set it to create/edit the
patron. We must list housebound_chooser and housebound_deliverer as not
part of patron's attributes

Test plan:
- Enable HouseboundModule
- Create a patron
=> When you save, if the patch is not applied, you will get:
No property housebound_deliverer for Koha::Patron

- Edit a patron
=> When you save, if the patch is not applied, you will get:
Patron creation failed! - DBIx::Class::Row::store_column(): No such column 'housebound_chooser' on Koha::Schema::Result::Borrower at /home/vagrant/kohaclone/Koha/Object.pm line 75

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>
2018-07-19 15:44:03 +00:00
0906773333 Bug 20807: Lost items report: Improve the display of CSV profile errors
This patch modifies the template for the lost items report to change the
way it handles a missing CSV profile. Now, if there is a missing CSV
profile, a message is displayed with details about the profile
requirements. If the logged-in user has the right permission there is a
link to the CSV profiles page.

Since item selection is used only in conjunction with exporting results,
item selection controls are all hidden when there is no valid CSV
profile.

To test, apply the patch go to Reports -> Lost items.

 - Run the report with parameters which will return results.
 - If your system has no CSV profile for exporting lost items:
   - If you are logged in as a user with manage_csv_profiles permission:
     - You should see a message dialog instructing you to create a CSV
       profile with a link to the CSV profiles page.
   - If you are not logged in as a user with manage_csv_profiles
     permission:
     - You should see a similar message but without a link to the CSV
       profiles page.
   - In both cases, with no CSV profile defined there should be no
     checkboxes in the table of results and no "select all/clear all"
     controls.
 - If your system has a valid CSV profile for exporting lost items:
   - Checking the checkbox for one or more items in the table should
     trigger the display of an "Export selected items" link.

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>
2018-07-18 19:11:34 +00:00
90977aef1e Bug 7651: DBRev 18.06.00.007
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 19:11:27 +00:00
cb93ae3c56 Bug 7651: put TT directive on a single line to help translation
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:45:22 +00:00
Katrin Fischer
1fa2bd185d Bug 7651: (QA follow-up) Fix warning about undefined active currency
If no active currency is defined we show a warning. This fixes
the link shown below to check the correct permission.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:45:22 +00:00
Katrin Fischer
15974afb1a Bug 7651: (follow-up) Correct visibility on admin sidebar
This patch corrects visibility of links to the different
acquisition pages from the admin sidebar.

It also makes a correction to the links on the acq start
page:
- Budgets = period_manage
- Funds = budget_manage

To test:
- Follow the test plan of the first patch

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>
2018-07-18 17:45:21 +00:00
Katrin Fischer
ff83c7acdc Bug 7651: Add a new permission for managing currencies and exchange rates
At the moment staff users need parameters or parameters_remaining_permissions
in order to be able to change exchange rates for acquisition orders.

This patch adds a new separate permission currencies_manage and
updates staff users currently having those permissions to get the
new permission as well.

To test:
- Create some staff users with different permission sets
  1) superlibrarian
  2) parameters
  3) parameters_remaining_permissions
  4) manage_circ_rules, but not parmeters_remaining_permissions
  5) all acquisition permissions
- Apply patch and run database update
- Verify new permission has been added and staff users updated
  1) remains the same
  2) + 3) will have currencies_manage
  4) remains unchanged, doesn't have new permission
  5) remains the same, will have access now because of having
     the top level acquisition permission
- Verify the changed pages work correctly:
  - navigation on admin home page
    NOTE: the acquisition parameters section will now honor all
    different related permissions (edi_manage, budget_manage,...)
  - navigation on acquisition home page
  - try to access currencies page directly

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>
2018-07-18 17:45:21 +00:00
Julian Maurice
583d1c69c6 Bug 20393: (QA follow-up) Remove only occurence of misc/plack/koha.psgi
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:44:48 +00:00
68d722232f Bug 20393: Remove redundant 'koha.psgi' and 'plackup.sh' files
Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:44:47 +00:00
d7fb53f6fc Bug 18322: (follow-up) Use authorized value labels
Rather than using the raw ccode's use the labels as defined in the
authorized values.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:50 +00:00
14166c4a8c Bug 18322: Update xslt for NORMARC and UNIMARC
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:49 +00:00
f37cac60e0 Bug 18322: (follow-up) Add generated xsl
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:49 +00:00
17a354f5e8 Bug 18322: Add a facet for ccode fields to Zebra
This patch adds the index definitions for zebra faceting of ccode in
koha for marc21, normarc and unimarc.

We also add lines to the templates to expose the new facet and enable
non-zebra faceting for ccode too.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:48 +00:00
904d9d54c9 Bug 18072: Only accept Koha::Library in parameters
I do not think we should allowed branchode and Koha::Library objects, it
adds confusion in callers (we never know if we have a branchcode of a
library object).

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:47 +00:00
6db48e9d21 Bug 18072: (QA follow-up) Remove warning from tests
This patch removes a warning from Items.t due to bad parameters. It also
makes the tests use Test::Exception.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:42 +00:00
Lari Taskula
bd87407798 Bug 18072: Add Koha::Biblio->can_be_transferred
This patch adds a new method Koha::Biblio->can_be_transferred. The method checks
if at least one of the item of that biblio can be transferred to desired location.

This method will be useful for building a smarter pickup location list for holds,
because we will be able to hide those libraries to which none of the items of
this biblio can be transferred to due to branch transfer limits (see Bug 7614).

To test:
1. prove t/db_dependent/Koha/Biblios.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:41 +00:00
Lari Taskula
118a714c1d Bug 18072: (QA follow-up) let Koha::Item->can_be_transferred take HASHref as param
This patch changes Koha::Item->can_be_transferred to accept a HASHref as follows:
$item->can_be_transferred({ to => $library, from => $library2 })

To test:
1. prove t/db_dependent/Koha/Items.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:42:33 +00:00
Lari Taskula
d8e562a218 Bug 18072: Add Koha::Item->can_be_transferred
This patch adds a new method Koha::Item->can_be_transferred.

Includes unit test.

To test:
1. prove t/db_dependent/Koha/Items.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:29:04 +00:00
Lari Taskula
7816d09e71 Bug 18072: Add deprecation warning to C4::Circulation Branch Transfer Limit functions
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:29:03 +00:00
Lari Taskula
97ce836093 Bug 18072: Add Koha objects for Branch Transfer Limit
This patch also fixes documentation in Koha/Item/Transfer.pm and
Koha/Item/Transfers.pm.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:29:03 +00:00
d6b1b653e0 Bug 19902: (follow-up) Deal with patron column regarding on intranetreadinghistory setting
Test plan:
Try it with intranetreadinghistory allowed and not allowed and it should
still work in both cases

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:24:51 +00:00
c5954d5e94 Bug 19902: Add column settings to bibliographic record checkouts history table
Test plan:
0) Apply the patch
1) Go to administration -> Configure columns, note there is new
checkoutshistory-table in Catalogue section
2) Make some configuration in this table settings
3) Go to detail of any record -> Checkout history
4) The columns should be visible according to your configuration from
step 2
5) Play with Column visibility, to ensure it does work as it should

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

Fixed a minor typo during signoff.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:24:51 +00:00
eac802b712 Bug 20806: Surround string by span tag to help translation
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:01:47 +00:00
2a369663fd Bug 20806: Do not rely on column position
It is not the first time we have this splice call, it seems safer to
rely on the column's name instead of the column's position

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:01:46 +00:00
0c1490ec71 Bug 20806: Add item type description holds history page
Test plan:

0) Do not apply the patch
1) Set AllowHoldItemTypeSelection to Allow
2) Place some hold for a patron, some with specific item type and some
without item type
3) On holds history page you should see blank or item type code in item
type column
4) Apply the patch
5) Now you should see description in item type column
6) Set AllowHoldItemTypeSelection to Don't Allow
7) You shold not see the item type column, but column visibility
settings should continue working ;)

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

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:01:45 +00:00
8520d508a3 Bug 20079: Display stack trace for development installations
"""The default value is development, which causes plackup to
load the middleware components: AccessLog, StackTrace, and Lint unless
--no-default-middleware is set."""

Test plan:
Confirm that the stack trace is displayed when something is wrong (die somewhere to test)
for dev installations (inside a devbox)
The -E flag must remain deployment for non-dev installs

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 17:00:20 +00:00
dcf207170b Bug 19524: DBRev 18.06.006
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:55:56 +00:00
9b1316ffee Bug 19524: Use existing logged_in_user variable
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:30 +00:00
e2e0c32701 Bug 19524: Share patron lists between staff
Some libraries would like to allow arbitrary lists to be used by all
librarians with the 'manage_patron_lists' permission.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Create or find two patrons with the manage_patron_lists permission
4) Using the first patron, create two new lists, mark one of them as
   shared
5) Log in as the second patron, browse to the patron lists page
6) Note the second patron can view, add and remove patrons from
   the shared list owned by the first patron

Signed-off-by: George Williams <george@nekls.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:29 +00:00
2e610a370b Bug 19524: Update database
Signed-off-by: George Williams <george@nekls.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:29 +00:00
8202f95ad7 Bug 21038: Reserves should be holds
This patch corrects the text of the warning about discharges cancelling
holds.

To test, apply the patch and view the discharge for a patron who has
holds:

 - "Borrower" is changed to "patron"
 - "reserves" is changed to "holds"
 - "canceled" (18 instances in the templates) is changed to "cancelled"
   (51 instances).

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:28 +00:00
6672b26d16 Bug 20942: (QA follow-up) Use $lines->total_outstanding
This patch makes the controller code use $lines->total_outstanding
instead of expecting ->outstanding_debits and ->outstanding_credits
return the total.

Tests should pass as before. No behaviour change is expected.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> SUCCESS: Tests still pass, no behaviour change.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:27 +00:00
bb7c908dc0 Bug 20942: Split debit and credit lines
This patch splits the balance to match this object schema:

{
    balance             => #,
    outstanding_credits => {
        total => #,
        lines => [ credit_line_1, ..., credit_line_n ]
    },
    outstanding_debits  => {
        total => #,
        lines => [ debit_line_1, ..., debit_line_m ]
    }
}

This change is made to ease usage from the UI. Also because the
outstanding credits need to be applied to outstanding debits in order to
the balance value to make sense. So we still need to have each total.

Tests are added for this change, and the schema files are adjusted as
well.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> SUCCESS: Tests pass!
- Sign off :-D

staff_id is changed into user_id as voted on the dev meeting the RFC got
approved.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:27 +00:00
d079c80b05 Bug 20942: Add route to get patron's account balance
This patch implements the /patrons/{patron_id}/account endpoint. It can
be used to get the patron's balance information, including outstanding
lines.

To test:
- Apply this patchset
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> SUCCESS: tests pass!
- Make your favourite REST testing tool (RESTer on Firefox?) do:
  GET /api/v1/patrons/{patron_id}/account
to a valid patron_id. Play with Koha's UI to add credits/payments and
notice the endpoint returns the right info following the voted RFC. [1]
- Sign off :-D

[1] https://wiki.koha-community.org/wiki/Patrons_account_lines_endpoint_RFC

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:26 +00:00
7cbff1bce1 Bug 20942: Unit tests for /patrons/{patron_id}/account
This patch adds tests for the /patrons/{patron_id}/account endpoint.
To test:

- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> FAIL: Tests should fail because the endpoint is not implemented.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:26 +00:00
d383b49987 Bug 20942: OpenAPI spec for /patrons/{patron_id}/account
This patch adds the OpenAPI spec for the following paths:
- /patrons/{patron_id}/account

It also adds object definitions for:
- balance
- account line

Account line is to be used on both /account/lines (when implemented)
and for embeding the outstanding lines in the balance endpoint
(/patrons/{patron_id}/account).

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:25 +00:00
9c7b6416c7 Bug 20287: (RM follow-up) Add POD
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-18 16:49:24 +00:00