]> git.koha-community.org Git - koha.git/log
koha.git
6 years agoBug 21208: Fix housebound deliverer/chooser names
Jonathan Druart [Fri, 10 Aug 2018 20:39:09 +0000 (17:39 -0300)]
Bug 21208: Fix housebound deliverer/chooser names

When creating a housebound visit, the names of the chooser and deliverer are the
same as the housebound patron (even though the housebound patron does not have
chooser and deliverer roles).

It has been caused by:
  commit 5f80977875ff124d411f2cd89de4a944fa9c27af
  Bug 18403: Use patron-title.inc when hidepatronname is used
patron-title.inc now starts looking for a variable named "patron", which exists in
members/housebound.
A better fix could be to renamed this "patron" variable tested by
patron-title.inc, but at first glance it's the only place this issue
exists.

Test plan:
1- Make sure HouseboundModule is enabled in system preferences
2- Go to a patron file (Patron A)
3- Edit this patron's housebound roles to Chooser
4- Go to another patron file (Patron B)
5- Edit this patron's housebound roles to Deliverer
6- Go to a third patron's file (Patron C)
7- Go to the Housebound tab
8- Fill out the housebound profile for Patron c
9- Click on "Add a new delivery"
10- Fill out day and time
11- Check the Chooser drop down
12- Check the Deliverer drop down
13- Save the delivery
14- Notice the Chooser and Deliverer names are correct
15- Click on the name of the Chooser, it goes to Patron A's file
16- Go back and click on the name of the Deliverer, it goes to Patron B's file

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit cacb57689070315fd1fae176e3761abc6870107f)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21125: Shortcut moredetail.pl on nonexistent biblionumber
Jonathan Druart [Wed, 11 Jul 2018 16:35:28 +0000 (13:35 -0300)]
Bug 21125: Shortcut moredetail.pl on nonexistent biblionumber

This replaces the solution for 17.11 on bug 20927.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 13cc5d3161b2630027a2c04cbc11414e83a4842b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20661: (QA follow-up) Add POD for output_and_exit
Marcel de Rooy [Fri, 27 Jul 2018 06:29:03 +0000 (08:29 +0200)]
Bug 20661: (QA follow-up) Add POD for output_and_exit

Resolve:
 FAIL   C4/Output.pm
   FAIL   pod
                *** ERROR: Apparent command =cut not preceded by blank line  in file C4/Output.pm
   FAIL   pod coverage
                POD is missing for output_and_exit

Test plan:
Run QA tools again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit ef58eff737b2fdcb4f97c8667e2f83e7f7aa70c7)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20661: Shortcut circ scripts if a blocking error appeared
Jonathan Druart [Wed, 25 Apr 2018 20:08:42 +0000 (17:08 -0300)]
Bug 20661: Shortcut circ scripts if a blocking error appeared

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
No test plan found ;)
But tested bookcount and request-article.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit ff21352a4a54a1b61f906aeffe7feef1506d4264)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20647: (alternate) When ILL is enabled the hover effect on the ILL requests butto...
Owen Leonard [Mon, 4 Jun 2018 18:16:54 +0000 (18:16 +0000)]
Bug 20647: (alternate) When ILL is enabled the hover effect on the ILL requests button is wrong

This alternate patch adds a new icon to the sprite image which gives
icons to the link on the staff client home page. It modifies the CSS
positioning for all the links as the new image sprite is somewhat
different.

The SVG file from which the sprite image was generated is also updated,
and the about page has been updated to give credit to the creator of the
icon.

Unrelated change: The cataloging link is moved to the second column.
Although it's probably rare for all modules to be enabled and available,
this puts the same number of links in each column.

To test, apply the patch and clear your browser cache if necessary. With
interlibrary loan enabled, view the staff client home page and confirm
that all the module links look correct, including when you hover your
mouse over them.

Confirm that the about page lists the new icon under the "licenses" tab.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 985eb929149737571e3830c837a127ab372e42fe)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20683: Update German web installer for 18.05
Katrin Fischer [Fri, 11 May 2018 06:24:06 +0000 (08:24 +0200)]
Bug 20683: Update German web installer for 18.05

Adds translations for 2 new notices CANCEL_HOLD_ON_LOST and
CHECKOUT_NOTE.
Some small changes to older notices to match them with the
English templates.

To test:
- Install German
- Run the web installer on an empty database
- Make sure all files install correctly and there are no SQL
  errors
- Check notices were loaded correctly

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 1da481f725e65c65e386c3b742d2f1e760f21a28)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 18635: Unit tests
Nick Clemens [Fri, 19 May 2017 01:07:11 +0000 (21:07 -0400)]
Bug 18635: Unit tests

I also adjust a few tests that assume value of $nb_of_patrons to not
rely on existing datas

To test:
1 - Apply this patch only
2 - Prove t/db_dependent/Koha/Patrons.t
3 - Tests fail
4 - Apply other patch
5 - Tests pass

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit ac0f3b880a4220317ddde107c508c32f75b09aa1)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 18635: Koha::Patron->guarantees() should return results alphabetically
Nick Clemens [Fri, 19 May 2017 01:08:22 +0000 (21:08 -0400)]
Bug 18635: Koha::Patron->guarantees() should return results alphabetically

To test:
1 - Add the same guarantor to a number of patrons, ensuring random order
alphabetically
2 - View the guarantors record, note unordered list of guarantees
3 - Apply patch
4 - Guarantees are alphabetical

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit fe6cb85c5580b582a0047769d88be23757df0ef5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21033: Remove few warns in acqui/basket.pl
Marcel de Rooy [Tue, 3 Jul 2018 13:52:05 +0000 (15:52 +0200)]
Bug 21033: Remove few warns in acqui/basket.pl

Resolve (line numbers based on 16.11.x):
Use of uninitialized value in hash element at acqui/basket.pl line 337.
Use of uninitialized value in hash element at acqui/basket.pl line 338.
Use of uninitialized value in hash element at acqui/basket.pl line 340.
Use of uninitialized value in hash element at acqui/basket.pl line 342.
Use of uninitialized value in hash element at acqui/basket.pl line 344.

Argument "" isn't numeric in multiplication (*) at koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt line 486.
Argument "" isn't numeric in multiplication (*) at koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt line 591.

Test plan:
If you have older acq data, you may have records in aqorders with field
tax_rate_on_ordering is NULL. These orders will trigger the above warns.
If you do not have, you could simulate by setting this field to NULL.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit af82a1d59709d02b767613539146b59fa10c3ab3)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20828: Step 4 of moremember is used for Housebound and additional attributes
Owen Leonard [Thu, 19 Jul 2018 15:13:55 +0000 (15:13 +0000)]
Bug 20828: Step 4 of moremember is used for Housebound and additional attributes

This patch modifies the patron edit process so that "Housebound roles"
can be edited as a separate step.

To test, apply the patch and open an existing patron's detail page
(moremember.tt). Test the "edit" links for 'Housebound roles' and
'Additional attributes and identifiers' and confirm that each opens its
own edit page, and saving changes works correctly.

Signed-off-by: Cab Vinton <bibliwho@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9d4c7350612dfb941a84a0e62ffe3efe19ccc4f8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21188: Convert return_date to a DateTime object
Nick Clemens [Thu, 9 Aug 2018 13:28:27 +0000 (13:28 +0000)]
Bug 21188: Convert return_date to a DateTime object

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit d035a140b51be6f2dad8f5f760ac0e626f952be5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20660: Return date override affects debarments in AddReturn
David Bourgault [Tue, 1 May 2018 18:03:52 +0000 (14:03 -0400)]
Bug 20660: Return date override affects debarments in AddReturn

Re-did the patch to follow best practices.

TEST PLAN:
0. Apply first patch only
1. prove t/db_dependent/Circulation.t
2. Apply second patch
3. prove t/db_dependent/Circulation.t

prove should fail the first time and pass the second time.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit bf9527457fb31012b65514a36f8f4001157771b4)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20660: Test AddReturn with $return_date override
David Bourgault [Tue, 1 May 2018 18:01:50 +0000 (14:01 -0400)]
Bug 20660: Test AddReturn with $return_date override

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8d9eb9734f2584c7b5f92689ecbd9a3adba173fd)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21035: Handle new lines when running reports
Jonathan Druart [Wed, 4 Jul 2018 18:05:25 +0000 (15:05 -0300)]
Bug 21035: Handle new lines when running reports

See https://metacpan.org/pod/Text::CSV_XS#Embedded-newlines

Test plan:

1) Choose two items, say barcode '123' and '456'
2) Change the public note on 123 to read

Line1
Line2

(I.e. type 'Line1', then press Enter, type 'Line2' and click update).
3) Change the public note on 456 to read

Public note has one and only one line.

Click update.
4) Create a report with the followng query:

select barcode, itemnotes from items where barcode in ( '123', '456' )

Let's say that this is report number 10.

5) run ./misc/cronjobs/runreport.pl --format=csv REPORT_ID:

=> You should see both lines

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>
(cherry picked from commit f16fb888f132703063f0591e329d72d065f4b1d9)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21131: Remove the TinyMCE.isDirty() check that caused unexpected behaviour
David Cook [Mon, 30 Jul 2018 04:35:40 +0000 (14:35 +1000)]
Bug 21131: Remove the TinyMCE.isDirty() check that caused unexpected behaviour

When using the WYSIWYG editor for system preferences, the editor only
updates the textarea element if the content is different from the
original content. This means if you change a system preference and
then change it back to the original content, the textarea will have
the 2nd last change you made.

This patch removes the TinyMCE.isDirty() check, which was responsible
for comparing the original and changed content. Every input/keydown/dragend
or TinyMCE command will cause the textarea element to be updated and
trigger the input event which causes the "modified" class to be added
to the element, so that the system preference can be saved.

__TEST PLAN__

_Before applying_
0. Change "UseWYSIWYGinSystemPreferences" to "Show"
1. Change "opaccredits" to "123a"
2. Click "Save all OPAC preferences"
3. Reload the page
4. Change "opaccredits" to "123"
5. Change "opaccredits" to "123a"
6. Click "Save all OPAC preferences"
7. Reload the page
8. Note that "opaccredits" says "123"

_Apply the patch_

_After applying_
1. Change "opaccredits" to "123a"
2. Change "opaccredits" to "123"
3. Click "Save all OPAC preferences"
4. Reload the page
5. Note that "opaccredits" says "123" (and not "123a")
6. Change "opaccredits" to "1234"
7. Click "Save all OPAC preferences"
8. Reload the page
9. Note that "opaccredits" says "1234"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit f4cf075fbea353a5cbf11aaead37c92eac8179b2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 19291: Make breadcrumbs for OPAC search history consistent with other patron...
Owen Leonard [Fri, 27 Jul 2018 17:22:54 +0000 (17:22 +0000)]
Bug 19291: Make breadcrumbs for OPAC search history consistent with other patron account pages

This patch adds the logged-in patron's name to the search history page's
breadcrumb navigation.

To test, apply the patch and view the OPAC search history page with no
user logged in. The breadcrumbs should read:

- Home ->  Search history

Log in and return to the search history page. The breadcrumbs should
read:

- Home -> Owen Leonard -> Your search history

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: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=21137

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit ff3987c023a658e63e46ea8601666916287c8ec5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21056: Add another flush later
Jonathan Druart [Tue, 31 Jul 2018 15:14:54 +0000 (12:14 -0300)]
Bug 21056: Add another flush later

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 5abcd3312adc02a14465a0781f735b8494d60f42)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21056: Changing the logged in library can fail sporadically
Kyle M Hall [Mon, 9 Jul 2018 18:05:29 +0000 (14:05 -0400)]
Bug 21056: Changing the logged in library can fail sporadically

We are getting reports that sometimes changing the logged in library via selectbranchprinter.pl sometimes appears to fail. Flushing the session after updating the branch appears to fix this.

Test Plan:
1) Change your logged in library repeatedly. Hopefully ( sort of ) it will fail to change.
   You may want to try various browsers.
2) Apply this patch
3) Note the change no longer fails

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 76a06a7050643add32f4cbccbdc2fb00f66f5485)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21141: Handle non-existent itemnumbers in batch item modification/deletion
Jonathan Druart [Mon, 6 Aug 2018 18:26:49 +0000 (15:26 -0300)]
Bug 21141: Handle non-existent itemnumbers in batch item modification/deletion

The itemnumber list passed from a file in the batch item
modification/deletion tools is not tested.
Like barcodes we should make sure they refer to a valid items in the DB.

Test plan:
- Create a file with barcodes, itemnumbers and random lines
- Use the batch item modification and deletion tools with this file
You should see a table with a list of invalid barcodes and itemnumbers.

Without this patch you got the following error:
Can't call method "title" on an undefined value at
/home/vagrant/kohaclone/tools/batchMod.pl line 580

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit e8e29d3140007b9b92d97ed2f1df7445c6eeb4f9)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21148: Dropdowns styled by the Select2 plugin do not highlight missing required...
Owen Leonard [Thu, 2 Aug 2018 13:46:31 +0000 (13:46 +0000)]
Bug 21148: Dropdowns styled by the Select2 plugin do not highlight missing required fields

This patch adds some CSS to target mandatory fields on the add item
screen which are styled by the Select2 plugin.

To test you must have at least one item field marked mandatory and
linked to an authorized value.

Open the add item form for an existing record. Try to submit the form
without making a selection in the mandatory dropdown. You should get an
alert warning you that you have empty mandatory fields, and the field
should be highlighted in yellow.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 62aacb5865719e27224bf8f1963de1888d2ca05d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21154: Remove unused subs from C4::Serials
Josef Moravec [Thu, 9 Aug 2018 15:57:58 +0000 (16:57 +0100)]
Bug 21154: Remove unused subs from C4::Serials

Test plan:
Run these commands, grep should not return any occurences, prove should
return green:

git grep GetSerialStatusFromSerialId
git grep GetDistributedTo
git grep SetDistributedTo
git grep SetDistributedto
git grep in_array
git grep is_barcode_in_use

kshell
prove t/db_dependent/Serials.t

Signed-off-by: Pierre-Luc Lapointe <pierreluc.lapointe@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
RMaint Comment: I have opted to replace this charry-pick with a
deprecation warning rather than the removal of these routines outright.

(cherry picked from commit 948566e7f36a75a186f96b5ee07b5120a5413ca5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21145: Do not show buttons for datatables on opac detail page
Josef Moravec [Thu, 2 Aug 2018 06:45:26 +0000 (06:45 +0000)]
Bug 21145: Do not show buttons for datatables on opac detail page

Test plan:
0) Do not apply the patch
1) Go to opac detail page
2) There are up to three datatables
    - items
    - items from other branches (only if there are any and the OpacSeparateHoldings preference is set)
    - subscriptions
3) try to find record with all three tables and confirm, there is button
"Columns visibility" above the table
4) Apply the patch
5) Repeat 1-3 and confirm the button is no more here

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit c0eb67a5572294c33e3f82c928e1cad709cb1c3a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21075: Unit tests
Nick Clemens [Fri, 13 Jul 2018 15:13:31 +0000 (15:13 +0000)]
Bug 21075: Unit tests

prove -v t/db_dependent/Reserves/AutoUnsuspendReserves.t

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>
(cherry picked from commit 6e5865ee4feaca3ca5575ce45d11fc88d88dc43d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21075: AutoUnsuspendHolds should unsuspend holds <= today
Nick Clemens [Fri, 13 Jul 2018 14:45:55 +0000 (14:45 +0000)]
Bug 21075: AutoUnsuspendHolds should unsuspend holds <= today

To recreate:
 1 - Place a hold in your system
 2 - Set that hold (or all holds) to expire today
    update reserves set suspend_until=CONCAT( CURDATE()," 00:00:00");
 3 - Run misc/cronjobs/holds/auto_unsuspend_holds.p
 4 - Note the hold is sitll suspended
 5 - Visit /cgi-bin/koha/reserve/request.pl for the book with the hold
 6 - Note the suspend date is tomorrow (and cannot be set to today]
 7 - Click update holds - the date in db is now set to tomorrow
 8 - Reset to today
 9 - Apply patch
10 - Run the cron again
11 - Visit the page and note hold is unsuspended

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit c0f7aed84d663029b2f1b37ce0391b5a40b10b97)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21099: Reposition floating toolbars earlier
Jonathan Druart [Fri, 20 Jul 2018 15:59:16 +0000 (12:59 -0300)]
Bug 21099: Reposition floating toolbars earlier

To recreate:
- Go to the advanced search form
- scrolldown to position the toolbar on top of the window
- scrollup

https://screenshots.firefox.com/NnkFg3iOXqLPxfkd/pro.kohadev.org

The toolbar should have been repositioned earlier

Test plan:
Edit a patron
- scrolldown
- scrollup
- unfold the form in the header (tab "Search patrons", link "[+]")
- scrolldown
- scrollup
Advanced search
scrolldown
scrollup

You should notice the difference with and without this patch

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>
(cherry picked from commit 68e735b10151d7b70187fa7f9d4ecb2b94b34e6a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21048: (QA follow-up) Fix authorized value statuses in filter
Marcel de Rooy [Fri, 27 Jul 2018 07:42:06 +0000 (09:42 +0200)]
Bug 21048: (QA follow-up) Fix authorized value statuses in filter

If you select an authorized value status in the filter, you want to keep
it too just like normal statuses as CHECKED.
The variable selected_status was not filled. The minimal fix is adding that
template variable in the script. Note that suggestion.STATUS is out of scope
within a loop using suggestion as loop var.

Note: Adding a regular status like CHECKED as an authorized value with
same code but another description works, but is kind of confusing ;) Not
in the scope of this report though.

Test plan:
Select an authval status in the filter. Apply the filter and verify again
that it is still selected under Suggestion information.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit b1e8193a84a8df6d70ad8de16dadb8c4301a706b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21048: Fix display of suggestion's status (SUGGEST_STATUS)
Jonathan Druart [Wed, 11 Jul 2018 21:23:49 +0000 (18:23 -0300)]
Bug 21048: Fix display of suggestion's status (SUGGEST_STATUS)

When a suggestion's status is set to a customized value (AV
SUGGEST_STATUS), the description is not always displayed correctly.

Test plan:
- Create different values for the AV SUGGEST_STATUS
- Create several suggestions
- Change the status using the SUGGEST_STATUS values
- Edit the suggestion and change again the status
- View the suggestions for a given patron
(members/purchase-suggestions.pl?borrowernumber=XX), the statuses must
displayed correctly

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit b25c063f950076234cf7bb4a496921983a7cc23f)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21041: "Merge patrons" button remains disabled with "Select all" option
Owen Leonard [Mon, 16 Jul 2018 17:24:04 +0000 (17:24 +0000)]
Bug 21041: "Merge patrons" button remains disabled with "Select all" option

This patch modifies the JavaScript functions for the select all/clear
all links so that each action triggers the "change" event, required to
enable or disabled the "merge selected patrons" button.

To test, apply the patch and perform a patron search which will return
multiple results.

 - Test the "select all" and "clear all" links, and confirm that the
   "Merge selected patrons" button is enabled and disabled.
 - Test that checking and unchecking multiple checkboxes still works
   correctly to enable and disable the button.

Signed-off-by: Pierre-Luc Lapointe <pierreluc.lapointe@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 4b9021895a46bda5234cd6c852f339ba7cd4d882)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21151: Fix SRU search fields mapping pop-up
Katrin Fischer [Wed, 1 Aug 2018 15:51:22 +0000 (15:51 +0000)]
Bug 21151: Fix SRU search fields mapping pop-up

The SRU search fields mapping pop-up comes up as a blank white
page.

To test:
- Go to Administration > Z39.50/SRU servers
- Modify or create an SRU server
- Click on the 'Modify' button to change mappings
- Verify the new window that opens is blank
- Apply patch
- Verify the pop-up now is no longer blank but works
  correctly.

Bonus: Spottd some HTML errors while looking for the
       problem. Also fixed in the patch.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 039d10044ce16f5a45ab35b79ea69d0526a1a519)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21018: Allow uris defined in the item
Jonathan Druart [Wed, 11 Jul 2018 14:29:15 +0000 (11:29 -0300)]
Bug 21018: Allow uris defined in the item

We need to search for uri defined for the itemnumber we passed in
parameter.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 1d888c8d0e9ee2eda9c793cf75fd73a7afeaef16)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21018: Fix TrackClicks for 952$u
Jonathan Druart [Fri, 29 Jun 2018 13:29:30 +0000 (10:29 -0300)]
Bug 21018: Fix TrackClicks for 952$u

Caused by
  commit 51b6cf2aafbfb45b9fcb072403b986fe3c2add53
  Bug 19847: Track links within the records and 404 for others

We should also accept uri stored in items.uri (952$u)

Test plan:
- Turn on TrackClicks
- Defined uri for some items
- At the OPAC click on the link (from opac-detail.pl)
=> Without this patch you will get 404 (redirected from tracklinks.pl)
=> With this patch applied you will be redirected correctly and the
linktracker will be filled correctly

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit d14ed73744fa23d4ed649da6d847f4b37cdfce92)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 14662: Add empty entries to pull downs in cataloguing form for mandatory subfields
Katrin Fischer [Thu, 2 Aug 2018 13:56:11 +0000 (15:56 +0200)]
Bug 14662: Add empty entries to pull downs in cataloguing form for mandatory subfields

First patch deals with the problem on the item form, this
patch fixes the same problem on catalouging form for the
bibliographic record.

To test:
- Adapt your frameworks:
  - Make sure 942$c is mandatory
  - Link another field to an authorised value, for example: 942$n to YESNO
- Add a new record
  - Verify that the first value of each pull down is preselected,
    there is no way to trigger the 'required' error
- Apply patch
  - Add a record
    - Verify that classification source is preselected according to the
      DefaultClassificationSource system preference
    - Verify that 942$c now defaults to empty
    - Verify all your other mandatory subfields can be set to empty
    - Verify that you can't save before correctly setting them
  - Chane your frameworks
    - Add a default value for 942$c, for example: CF
  - Add another record
    - Verify the itemtype is now preset to your default itemtype
  - Edit an existing record, verify all values show correctly

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 038e4011d4e4c1270592d476479062467a7a9be8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 14662: Add empty entries to pull downs on item form for mandatory subfields
Katrin Fischer [Tue, 31 Jul 2018 23:58:33 +0000 (23:58 +0000)]
Bug 14662: Add empty entries to pull downs on item form for mandatory subfields

The code assumed that if a subfield is marked as mandatory, there should be no
empty entry in the pull downs.

This assumption is not correct, as it leads to the first entry of the
pull down being preselected if there is no default set. Which means you
will never be alerted of any cataloguing errors and errors will be very
hard to find later on.

Correct behaviour would be to preselect the empty value when there is
no default. This means on saving the item an error message is triggered
and the cataloger is forced to set the value.

To test:
- Adapt your frameworks:
  - Make 942$c non-mandatory
  - In 952 make itemtype, classification source and some other pull downs
    like location or collection mandatory
- Add a new item
  - Verify that the first value of each pull down is preselected,
    there is no way to trigger the 'required' error
- Apply patch
  - Add a new item
    - Verify that classification source is preselected according to the
      DefaultClassificationSource system preference
    - Verify that the itemtype is preselected according to 942$c in
      the bibliographic record
    - Verify all mandatory fields can be set to empty
    - Verify that you can't save before correctly setting them
  - Change the 942$c in the record to empty
  - Add another item
    - Verify the itemtype is now empty
  - Change your frameworks and set a default for itemtype (Ex: BK)
  - Repeat default check with another pull down like collection or location

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
We do not want empty values for branches (holdingbranch and homebranch
must be mandatory, see bug 21011)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 003a4439802bc4053ed9e5db7719434256788b29)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20273: (follow-up) Autocomplete use start instead of contains
Alex Arnaud [Thu, 3 May 2018 09:38:19 +0000 (09:38 +0000)]
Bug 20273: (follow-up) Autocomplete use start instead of contains

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 1abee30bb8bd786d9523bf75594f3aae9a37d3d5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20273: Use compat routines for autocomplete in auth_finder.pl
Martin Renvoize [Mon, 6 Aug 2018 13:00:54 +0000 (14:00 +0100)]
Bug 20273: Use compat routines for autocomplete in auth_finder.pl

Test plan:
  - Context: Koha working with elasticsearch,
  - Apply BZ 19582 (that make auth_finder.pl works again),
  - apply this patch,
  - go to cgi-bin/koha/authorities/auth_finder.pl,
  - type at least 3 chararcters in a search field and
    check that the autocomplete returns results

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 96e768eb43a1555ae2f03b098edddbd051e8ae80)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 19604: Fix perlcritic "Loop iterator is not lexical"
Jonathan Druart [Tue, 31 Jul 2018 11:21:00 +0000 (08:21 -0300)]
Bug 19604: Fix perlcritic "Loop iterator is not lexical"

Loop iterator is not lexical at line 318, column 13.  See page 108 of
PBP.  (Severity: 5)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4d45bd575569880676a212655d3d747f368697e4)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 19604: Elasticsearch Fixes for build_authorities_query for auth searching
Nick Clemens [Thu, 9 Nov 2017 16:23:57 +0000 (16:23 +0000)]
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>
(cherry picked from commit f983c1e3f7404c60143d595ba5824f5324829723)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 19604: Unit tests
Nick Clemens [Fri, 17 Nov 2017 14:07:41 +0000 (14:07 +0000)]
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>
(cherry picked from commit 7eceade7daf2943f6112291a8bfd6aa754ffaa5c)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21031: Apache Rewrite rules don't work for API when using anything but Debian...
David Cook [Tue, 3 Jul 2018 09:04:50 +0000 (19:04 +1000)]
Bug 21031: Apache Rewrite rules don't work for API when using anything but Debian package Plack configuration

The Rewrite rules for Apache don't work unless you're using
debian/templates/apache-shared-opac-plack.conf or
debian/templates/apache-shared-intranet-plack.conf.

This patch fixes the Rewrite rules for the non-Plack Debian
Apache configuration templates as well as the standard
Apache configuration file that comes with Koha.

__BEFORE APPLYING__
1. Visit /api/v1/app.pl/api/v1/spec on your git dev install
2. This should display a large page of JSON
3. Visit /api/v1/spec on your git dev install
4. This should generate a 404 error

__APPLY PATCH__

__AFTER APPLYING__
5. Visit /api/v1/app.pl/api/v1/spec on your git dev install
6. This should display a large page of JSON
7. Visit /api/v1/spec on your git dev install
8. This should display a large page of JSON (identical to
the one from earlier steps)

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Passed QA with few notes posted separately to Bugzilla.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c6b50f0bac092779f93033c8a3f002cb8722d7d4)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20770: ILL loans OPAC form notes field allow arbitrary input
Andrew Isherwood [Tue, 15 May 2018 15:00:02 +0000 (16:00 +0100)]
Bug 20770: ILL loans OPAC form notes field allow arbitrary input

This patch addresses the lack of sanitization of the "notes" field on
the OPAC "View Interlibrary loan request" page.

To test:

- Apply the patch
- As an OPAC user, create an ILL request
- Navigate to the request's "View Interlibrary loan request" page
- Add the following note:

  Hello
  <h1>TESTING</h1>
  <script>alert('pwned');</script>

- Click "Submit modifications"
- TEST: Observe, when the page reloads, only the following is preserved in the
"Notes" textarea:

    Hello
    TESTING

- As a staff user, naviate to the ILL requests table
- Select "Manage request" for the request you created
- TEST: Observe that the Notes field only contains:

    Hello
    TESTING

- TEST: Observe that no Javascript alert is displayed

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 552873f7d466abee6919414b8d2f5e6c99f9a44f)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21122: Fix check-url-quick when utf8 characters in URL's
Liz Rea [Thu, 26 Jul 2018 04:26:15 +0000 (16:26 +1200)]
Bug 21122: Fix check-url-quick when utf8 characters in URL's

To test:

Make a record with a URL that has a UTF8 character, such as:
http://some.nonexistent.tld/MāoriWomenAotearoa.pdf
Run the check-url-quick.pl job, notice it dies at that URL
Apply this patch
Test again, it should work.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 10720d2a5c50b82d565cab9ad70c8498164d81b2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21094: Syndetics: always use https instead of http
Owen Leonard [Thu, 19 Jul 2018 16:57:42 +0000 (16:57 +0000)]
Bug 21094: Syndetics: always use https instead of http

This patch removes the 'using_https' check in OPAC templates in calls to
Syndetics resources. Instead, https is always used.

To test, apply the patch and enable Syndetics-related preferences. View
the following pages in the OPAC:

- Bibliographic detail page
  - Browse shelf section of the bibliographic detail page
- Search results
- List contents
- Recent comments
  - Recent comments RSS
- User summary page
  - Circulation history

NOTE: I tested with made-up Syndetics credentials. This means my changes
didn't make the template explode, but it doesn't confirm conclusively
that the resources work.

Signed-off-by: John Doe <you@example.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6e0548cc1a7a924731bd414fec2f7917f044040a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21077: Fix database documentation for statistics.type
Katrin Fischer [Sun, 15 Jul 2018 17:27:03 +0000 (19:27 +0200)]
Bug 21077: Fix database documentation for statistics.type

There's a typo for 'locause', this should be 'localuse'.
Also, 'Credit*' is never used.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0b89cbf6a473e71597bc051d88c2152531648ad8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21032: Fix using facet for searches made on specific index
Alex Arnaud [Tue, 3 Jul 2018 13:57:00 +0000 (13:57 +0000)]
Bug 21032: Fix using facet for searches made on specific index

Test plan:

  - Try a simple search (OPAC or staff) like "title:foo",
  - click on a facet: badaboum!
  - apply this patch,
  - retry

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 96f253d5ed2f1770b42f06554ebb4c4e14b3afdf)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21134: Correctly throw the exception in Koha::Patron::Modification->approve
Jonathan Druart [Tue, 31 Jul 2018 15:43:54 +0000 (12:43 -0300)]
Bug 21134: Correctly throw the exception in Koha::Patron::Modification->approve

koha_1       |     # Looks like you planned 20 tests but ran 9.
koha_1       |
koha_1       | #   Failed test 'approve tests'
koha_1       | #   at t/db_dependent/Koha/Patron/Modifications.t line
259.
koha_1       | [Something went wrong]# Looks like your test exited with
255 just after 5.
koha_1       | [21:13:47] t/db_dependent/Koha/Patron/Modifications.t
.....................

"Something went wrong" should never been thrown,
Koha::Patron::Modification->approve raises $@, but it's not defined, it
should raise $_ instead

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6e99cfbca7e904b7664163838a334c487c94e462)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20757: Add pod for ->capture
Jonathan Druart [Mon, 23 Jul 2018 14:02:02 +0000 (11:02 -0300)]
Bug 20757: Add pod for ->capture

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9eec98d31853737cbb755636c0acb2888e2b2f74)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20757: Capture and upload screenshot on selenium errors
Jonathan Druart [Fri, 11 May 2018 19:58:07 +0000 (16:58 -0300)]
Bug 20757: Capture and upload screenshot on selenium errors

It is a real pain to debug selenium errors, especially when it is
not reproducible locally.

This patch capture a screenshot when an error occurred and upload it
using the excellent lut.im service provided by framasoft
(We could host our own later).

Test plan:
Modify a selenium script to make it fails (search for find_element)
You will see a stack trace followed by a link to framapic.org

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 2898b580891e271c102d592c5040122007ee7a73)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20980: (RMaint follow-up) - Fix for missing use after merge
Martin Renvoize [Fri, 3 Aug 2018 13:09:58 +0000 (14:09 +0100)]
Bug 20980: (RMaint follow-up) - Fix for missing use after merge

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: (QA follow-up) Use $lines->total_outstanding
Tomas Cohen Arazi [Mon, 2 Jul 2018 19:18:33 +0000 (16:18 -0300)]
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>
(cherry picked from commit 6672b26d16065d877d6d7300830fc3d619b09898)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: Split debit and credit lines
Tomas Cohen Arazi [Mon, 25 Jun 2018 17:55:30 +0000 (14:55 -0300)]
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>
(cherry picked from commit bb7c908dc06697a4ebbf8633897d24e26798cb6d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: Add route to get patron's account balance
Tomas Cohen Arazi [Wed, 13 Jun 2018 17:02:44 +0000 (14:02 -0300)]
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>
(cherry picked from commit d079c80b05b36a177c80d8f585ae1515092e6ddb)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: Unit tests for /patrons/{patron_id}/account
Tomas Cohen Arazi [Wed, 13 Jun 2018 17:02:30 +0000 (14:02 -0300)]
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>
(cherry picked from commit 7cbff1bce1608016e8b8ceded7633678189b75cc)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: OpenAPI spec for /patrons/{patron_id}/account
Tomas Cohen Arazi [Fri, 1 Jun 2018 19:04:35 +0000 (16:04 -0300)]
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>
(cherry picked from commit d383b49987b8e5471cb9f30ed879e1311e762b26)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20990: (QA follow-up) make outstanding_credits return the account lines only
Tomas Cohen Arazi [Mon, 2 Jul 2018 18:59:54 +0000 (15:59 -0300)]
Bug 20990: (QA follow-up) make outstanding_credits return the account lines only

This patch was discussed with Jonathan on a QA conversation. It is
better to keep this simpler and more reusable. And is the right approach
in this case.

This patch makes Koha::Account::outstanding_credits return the account
lines, code that used the $total value, will just use

    $lines->total_outstanding;

Tests are adjusted accordingly.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Account.t
=> SUCCESS: Test pass.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9bfb3bc3782dd6b516d0144074b57e55cbefae2e)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20990: Make same changes that were made to outstanding_debits
Kyle M Hall [Tue, 26 Jun 2018 14:31:40 +0000 (14:31 +0000)]
Bug 20990: Make same changes that were made to outstanding_debits

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3e0aa0f3191a570dceb834e4036932d9af3c820e)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20990: (follow-up) Fix test description
Josef Moravec [Mon, 25 Jun 2018 18:57:20 +0000 (18:57 +0000)]
Bug 20990: (follow-up) Fix test description

Test plan:
prove -v t/db_dependent/Koha/Account.t
--> Test message of first test of subtest outtanding_credits correctly says
"Outstanding credits total..."

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>
(cherry picked from commit 9d596553369b2500d0e629aec1b085aa3836190a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20990: Add Koha::Account->outstanding_credits
Tomas Cohen Arazi [Mon, 25 Jun 2018 14:15:14 +0000 (11:15 -0300)]
Bug 20990: Add Koha::Account->outstanding_credits

This patch adds a method that retrieves (for a patron's account) the
outstanding credits (i.e. those that haven't been applied to any debit.

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

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>
(cherry picked from commit 4ee390cbb7ce0726c4d80c4581ef1a387abb47ce)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20990: Unit tests for Koha::Account->outstanding_credits
Tomas Cohen Arazi [Mon, 25 Jun 2018 14:15:08 +0000 (11:15 -0300)]
Bug 20990: Unit tests for Koha::Account->outstanding_credits

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>
(cherry picked from commit 0fb5019b7142396f0cd2cec1132dba767b0c64b2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20980: DBRev 18.05.02.001
Nick Clemens [Fri, 6 Jul 2018 12:56:54 +0000 (12:56 +0000)]
Bug 20980: DBRev 18.05.02.001

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 64761e56ccfbf98844d2fc8c7aa68ee608a2b162)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20980: (QA follow-up) Do not delete existing data on tests fix
Tomas Cohen Arazi [Fri, 6 Jul 2018 12:22:29 +0000 (09:22 -0300)]
Bug 20980: (QA follow-up) Do not delete existing data on tests fix

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8a83f1e1a975368c006c698f94357975333fd2d6)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20980: (follow-up) Offset name consistency
Tomas Cohen Arazi [Sat, 23 Jun 2018 10:41:15 +0000 (07:41 -0300)]
Bug 20980: (follow-up) Offset name consistency

This patch makes 'credit' account types generate 'Manual Credit' offset.
The original patch used 'Payment' but I think the code wants to
distinguish between payments and manually added credits (otherwise they
would've picked the same accounttype value, and they don't.

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>
(cherry picked from commit 65aacc1b1ded569a259f45c3abd5d1a73c3f37e6)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20980: (follow-up) Only use UpdateStats for 'payment' and 'writeoff'
Tomas Cohen Arazi [Fri, 22 Jun 2018 15:24:33 +0000 (12:24 -0300)]
Bug 20980: (follow-up) Only use UpdateStats for 'payment' and 'writeoff'

This patch makes Koha::Account::add_credit record statistics logs
(through C4::Stats::UpdateStats) only for the 'payment' and 'writeoff'
credit types.

Both credit types are whitelisted in UpdateStats, so we keep the current
behaviour. Another option would've been to add new account types to the
white list, but with the account offsets it seems that using the
statistics table for account changes won't be useful for too long, as
offsets contain the same (and more) information.

To test:
- Apply the patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Account.t
=> SUCCESS: Tests pass!
- Sign off :-D

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>
(cherry picked from commit 7b6c242d972e3edf5b4d75d6023a0ae1dc9d1f9d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20980: Make mancredit.pl use Koha::Account::add_credit
Tomas Cohen Arazi [Fri, 22 Jun 2018 15:23:47 +0000 (12:23 -0300)]
Bug 20980: Make mancredit.pl use Koha::Account::add_credit

This patch makes creating a manual credit from the UI record the account
offset as 'Manual Credit', and properly set account_offsets.credit_id
instead of account_offsets.debit_id.

To test:
- Create a manual credit (of 'Credit' type) for a known patron (acevedo?)
- Run:
  $ sudo koha-mysql kohadev
  > SELECT * FROM account_offsets;
=> FAIL: The account offset for the manual credit has type=Manual Debit,
    credit_id=NULL and debit_id=accountlines_id
- Run the atomic update:
  $ updatedatabase
- Run:
  $ sudo koha-mysql kohadev
  > SELECT * FROM account_offsets;
=> SUCCESS: The account offset has been corrected and now has
type=Manual Credit, credit_id=accountlines_id and debit_id=NULL
- Create a new manual credit (of 'Forgiven' type) for a known patron
- Run:
  $ sudo koha-mysql kohadev
  > SELECT * FROM account_offsets;
=> SUCCESS: The account offset has been stored correctly as a credit!
- Sign off :-D

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>
(cherry picked from commit cc30dc39bf3c8f627865c1a4891fac534266dc03)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20980: Add 'Manual Credit' and fix existing offsets
Tomas Cohen Arazi [Thu, 21 Jun 2018 17:43:34 +0000 (14:43 -0300)]
Bug 20980: Add 'Manual Credit' and fix existing offsets

This patch adds a new offset type 'Manual Credit'. And adds an atomic
update for fixing existing offsets.

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>
(cherry picked from commit f7ed22d25372bb7a68dcbf1a744b81aeb8657b0a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: Revert - Too many missing dependancies
Martin Renvoize [Thu, 2 Aug 2018 15:20:51 +0000 (16:20 +0100)]
Bug 20942: Revert - Too many missing dependancies

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 8604: Patron cards made for patrons which don't have patron images use preceding...
Chris Nighswonger [Wed, 4 Jul 2018 15:23:11 +0000 (11:23 -0400)]
Bug 8604: Patron cards made for patrons which don't have patron images use preceding card's image

This patch corrects referential problems which caused the script to
"re-use" images as well as other sorts of bad image behaviour.

To test:

1. Ensure that you can reproduce the original bug or some variation thereof
using the steps described in either of these two comments:

    https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8604#c0

    https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8604#c6

    NOTE: This is not an easy bug to reproduce.

2. Once you can reproduce the bug, apply this patch and follow the same steps
used to reproduce the bug.

3. Observe that the symptoms are corrected.

Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Reproduced the bug and resolved it with this patch.
Code is hard to read; exact cause of the problem was not fully uncovered.

Fixed spelling 'Destory' => 'Destroy'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit b5e60f15478a998f945ebc59b2c13ce9d37b8818)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21097: Missing optgroup closing tag in orderreceive.tt
David Cook [Fri, 20 Jul 2018 08:13:49 +0000 (18:13 +1000)]
Bug 21097: Missing optgroup closing tag in orderreceive.tt

There is a missing optgroup closing tag in orderreceive.tt. It doesn't
actually cause any display issues (at least in modern browsers), but
it's invalid markup, so this patch fixes it.

_TEST PLAN_
0. Add a budget and add a fund
1. Add a vendor
2. Add a basket
3. Add an order to a basket
4. Close the basket
5. Receive the order
6. Make sure the budget and fund both display when selecting the fund

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 12e18f91be2a26501fba502d5f1106d66b06caee)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20811: (RM follow-up) fix check for matching
Nick Clemens [Mon, 23 Jul 2018 12:23:07 +0000 (12:23 +0000)]
Bug 20811: (RM follow-up) fix check for matching

Notice should only be triggered if both settings are false

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 12b505f2b797d77e800a17830f71a9c054cd076b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20811: (QA follow-up) Prevent calling AddItemBatchFromMarc and ModBiblioMarc...
Marcel de Rooy [Fri, 20 Jul 2018 09:46:58 +0000 (11:46 +0200)]
Bug 20811: (QA follow-up) Prevent calling AddItemBatchFromMarc and ModBiblioMarc without biblionumber

If you use -update but do not find matches (or did not want to match), you
should not call those routines. We should warn and skip this record.

Adding a warn at the start that the choice of options may not be smart.
Note that this needs further attention somewhere else. You could mix
-update with -insert for instance and still see some problems. (May depend
on items with unique barcode etc.)

Test plan:
Run -update without match or isbn.
Or run -update -isbn with a non-matching ISBN.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 15b865c6ee558ef278f911ba3693c38c024c7f11)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20811: (QA follow-up) Make the isbn check work
Marcel de Rooy [Fri, 20 Jul 2018 09:21:11 +0000 (11:21 +0200)]
Bug 20811: (QA follow-up) Make the isbn check work

The following code was never reached, since $isbn was not filled.
    if (!$biblionumber && $isbn_check && $isbn) {
        $sth_isbn->execute($isbn);
        ($biblionumber,$biblioitemnumber) = $sth_isbn->fetchrow;
    }
Solution: Fix the code with two $isbn declarations. Move the checkisbn
condition a level deeper.

Test plan:
Run misc/migration_tools/bulkmarcimport.pl -file bib726.utf8 --update -isbn
Since you do not match on biblionumber, the ISBN should match.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit a49a7f08d6dbaf992d70420dae744c75c2ad8aae)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20811: Fix wrong usage of ModBiblio
Jonathan Druart [Mon, 28 May 2018 18:19:09 +0000 (15:19 -0300)]
Bug 20811: Fix wrong usage of ModBiblio

Since
  commit cefa7c21e28b88351ee8ae0dfefb80a515323df9
  Bug 5635: bulkmarcimport new parameters & features

AddBiblio call has been replaced with ModBiblio, but the return values
are different. We should not replace the value of $biblionumber with
what returns this subroutine.

Test plan:
If you are familiar with bulkmarcimport.pl you should know what to test,
I am not.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit d15185025a146656a1ad0d7d5a8eb261581c0f1e)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20974: Remove files left behind after removing Solr
Owen Leonard [Thu, 21 Jun 2018 13:37:35 +0000 (13:37 +0000)]
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>
(cherry picked from commit ad34ef74cdee0f204c03cdf88b1db775768a44fe)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21064: Use undefined instead of undef
Nick Clemens [Thu, 12 Jul 2018 10:18:10 +0000 (10:18 +0000)]
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>
(cherry picked from commit 367f47c416fa9164ccb8d9e5f50772e5a516d6b7)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21053: Encode URI characters in plugin 008
Jonathan Druart [Wed, 11 Jul 2018 21:55:06 +0000 (18:55 -0300)]
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>
(cherry picked from commit bfdf896111849454ade806bf49f48f1de5f626be)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21076: Don't call autocomplete code after patron found
Nick Clemens [Fri, 13 Jul 2018 17:49:14 +0000 (17:49 +0000)]
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>
(cherry picked from commit 5a9bad787458411c790d26b3b115fe3e7e2e0ab2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 16575: (follow-up) Compiled CSS
Katrin Fischer [Sun, 15 Jul 2018 18:00:44 +0000 (20:00 +0200)]
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>
(cherry picked from commit c02543baaab99841405ba9a47d894e54e7a8a27a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 16575: Irregular behaviour using window.print() followed by window.location.href
Owen Leonard [Wed, 30 May 2018 14:15:19 +0000 (14:15 +0000)]
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>
(cherry picked from commit a9836864dcbe4c11d370c245511ee4b9d6bd33f3)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20806: Surround string by span tag to help translation
Jonathan Druart [Fri, 29 Jun 2018 20:36:51 +0000 (17:36 -0300)]
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>
(cherry picked from commit eac802b712bd60c8307da7b6f709d347ffa4ffe3)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20806: Do not rely on column position
Jonathan Druart [Fri, 29 Jun 2018 20:30:39 +0000 (17:30 -0300)]
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>
(cherry picked from commit 2a369663fd37c41fb3ac810a8f42d84d69fa6f02)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20806: Add item type description holds history page
Josef Moravec [Tue, 29 May 2018 09:15:09 +0000 (09:15 +0000)]
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>
(cherry picked from commit 0c1490ec7111fb6160458463d98ccda333f347b3)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20079: Display stack trace for development installations
Jonathan Druart [Tue, 23 Jan 2018 18:54:41 +0000 (15:54 -0300)]
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>
(cherry picked from commit 8520d508a3154c6b30f1e710e518fe3b697a3194)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21038: Reserves should be holds
Owen Leonard [Mon, 16 Jul 2018 18:41:13 +0000 (18:41 +0000)]
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>
(cherry picked from commit 8202f95ad7001a5046f9f40e6322406b253ba3ed)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: (QA follow-up) Use $lines->total_outstanding
Tomas Cohen Arazi [Mon, 2 Jul 2018 19:18:33 +0000 (16:18 -0300)]
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>
(cherry picked from commit 6672b26d16065d877d6d7300830fc3d619b09898)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: Split debit and credit lines
Tomas Cohen Arazi [Mon, 25 Jun 2018 17:55:30 +0000 (14:55 -0300)]
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>
(cherry picked from commit bb7c908dc06697a4ebbf8633897d24e26798cb6d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: Add route to get patron's account balance
Tomas Cohen Arazi [Wed, 13 Jun 2018 17:02:44 +0000 (14:02 -0300)]
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>
(cherry picked from commit d079c80b05b36a177c80d8f585ae1515092e6ddb)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: Unit tests for /patrons/{patron_id}/account
Tomas Cohen Arazi [Wed, 13 Jun 2018 17:02:30 +0000 (14:02 -0300)]
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>
(cherry picked from commit 7cbff1bce1608016e8b8ceded7633678189b75cc)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20942: OpenAPI spec for /patrons/{patron_id}/account
Tomas Cohen Arazi [Fri, 1 Jun 2018 19:04:35 +0000 (16:04 -0300)]
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>
(cherry picked from commit d383b49987b8e5471cb9f30ed879e1311e762b26)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 6647: Revert - Label item search should use standard pagination routine"
Martin Renvoize [Wed, 1 Aug 2018 08:01:44 +0000 (09:01 +0100)]
Bug 6647: Revert - Label item search should use standard pagination routine"

This reverts commit 35fb1fe67cef029201eef6fd53c2d0e4af82195c which
depends on a bug not being backported to the 18.05.x branch.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoUpdate release notes for 18.05.02 release v18.05.02
Martin Renvoize [Fri, 20 Jul 2018 15:23:46 +0000 (16:23 +0100)]
Update release notes for 18.05.02 release

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoIncrement version for 18.05.02 release
Martin Renvoize [Fri, 20 Jul 2018 14:55:53 +0000 (15:55 +0100)]
Increment version for 18.05.02 release

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoRMaint Followup: Fix Armenian translation file error.
Martin Renvoize [Mon, 23 Jul 2018 20:28:05 +0000 (21:28 +0100)]
RMaint Followup: Fix Armenian translation file error.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoTranslation updates for Koha 18.05.02
Koha translators [Mon, 23 Jul 2018 20:07:00 +0000 (17:07 -0300)]
Translation updates for Koha 18.05.02

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20934: (QA follow-up) Fix showing number of records in checkout history
Josef Moravec [Mon, 18 Jun 2018 15:48:12 +0000 (15:48 +0000)]
Bug 20934: (QA follow-up) Fix showing number of records in checkout history

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 64c596b13c82a2942792d975363a0d689182d627)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20934: (QA follow-up) Fix pod in Koha::Old::Checkout
Josef Moravec [Mon, 18 Jun 2018 15:15:31 +0000 (15:15 +0000)]
Bug 20934: (QA follow-up) Fix pod in Koha::Old::Checkout

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 97b2bb8e7385c6af4d07666ce51df68b3bda8875)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 20934: Fix display of old checkouts in the checkout history page
Jonathan Druart [Wed, 13 Jun 2018 16:26:43 +0000 (13:26 -0300)]
Bug 20934: Fix display of old checkouts in the checkout history page

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

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

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

It highlights that we need improvements in this area.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 117e3a18f5b7c24e6c9fb7eabb78ab1b5320cd14)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21022: (follow-up) Move overloaded full_message method to subclass
Tomas Cohen Arazi [Fri, 29 Jun 2018 14:15:22 +0000 (11:15 -0300)]
Bug 21022: (follow-up) Move overloaded full_message method to subclass

We shouldn't have it overloaded on the base class, as it could get huge
and difficult to find things, and read.

This patch moves things to Koha::Exceptions::Object. We should overload
the full_message method on each exceptions class, as needed.

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21022: Use passed message if present
Tomas Cohen Arazi [Fri, 29 Jun 2018 14:02:57 +0000 (11:02 -0300)]
Bug 21022: Use passed message if present

This patch makes 'full_message' use the passed exception message instead
of trying to build it from the parameters. This is particularly useful
for some situations in which we don't have all the information but would
like to keep using the same exception.

To test:
- Apply this patchset
- Run:
  $ kshell
 k$ prove t/Koha/Exceptions.t
=> SUCCESS: Tests pass!
- Sign off

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21022: Unit tests
Tomas Cohen Arazi [Fri, 29 Jun 2018 14:02:40 +0000 (11:02 -0300)]
Bug 21022: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21008: Use Koha::Patron->is_child
Jonathan Druart [Thu, 28 Jun 2018 14:00:57 +0000 (11:00 -0300)]
Bug 21008: Use Koha::Patron->is_child

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: I removed the category parameter as it is not really used.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 years agoBug 21008: Use patron object to get category_type
Tomas Cohen Arazi [Thu, 28 Jun 2018 13:31:30 +0000 (10:31 -0300)]
Bug 21008: Use patron object to get category_type

This patch makes borrower_add_additional_fields() in both pay.pl and
paycollect.pl use the right object to pick the category_type.

It also populates the extendedattributes template variable in pay.pl
which was missed by a change.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>