]> git.koha-community.org Git - koha.git/log
koha.git
6 years agoBug 20115: Set the languages order with the pref values
Jonathan Druart [Wed, 31 Jan 2018 16:47:37 +0000 (13:47 -0300)]
Bug 20115: Set the languages order with the pref values

To avoid the languages to be ordered randomly, it is better to stick on
a default order.
Let's suppose that the order in the pref is correct.

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19578: Remove MARC punctuation in notices (TT syntax)
Jonathan Druart [Mon, 6 Nov 2017 18:35:50 +0000 (15:35 -0300)]
Bug 19578: Remove MARC punctuation in notices (TT syntax)

Jenkins fails (run 287) on a test in t/db_dependent/Letters/TemplateToolkit.t:

With the historical syntax:
        # Your request for an article from tQYRS (c3Av58O0P5xkkIGu) has been canceled for the following reason:

With the TT syntax:
        # Your request for an article from tQYRS_ (c3Av58O0P5xkkIGu) has been canceled for the following reason:

The last character of the biblio's title has been removed because it's a punctuation character.
It comes from: C4::Letters::_parseletter
 893         $val =~ s/\p{P}$// if $val && $table=~/biblio/;

The same replacement is done for patron's attributes too.

Test plan:
- Confirm that the new tests pass. That should be enough to confirm this change make sense.

Test plan (manual):
- Create a biblio with a title ending with a punctuation (like "with_punctuation_"), or any other fields of biblio/biblioitem
- Generate a notice which will display this field (CHECKIN for instance)

Use the historical syntax and the TT syntax, both should display the title without the punctuation character at the end

CHECKIN historical:
The following items have been checked in:
----
<<biblio.title>>
----

CHECKIN TT syntax:
The following items have been checked in:
----
[% biblio.title %]
----

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20083: (follow-up) use same logic in opac-showmarc
Mark Tompsett [Tue, 30 Jan 2018 22:35:39 +0000 (22:35 +0000)]
Bug 20083: (follow-up) use same logic in opac-showmarc

It was correctly pointed out that opac-showmarc would leak
the same way as catalogue/showmarc.pl, and so this patch
moves the authentication step up to the top where it
should be so as to prevent inappropriate data leaks.

TEST PLAN
---------
1) Set your OpacPublic system preference to Disabled
2) Open your OPAC and login
3) Find a biblio with items
4) Go to the opac details, particularly MARC view.
5) Copy the "view plain" shortcut link.
6) log out.
7) Paste the link into the address bar.
   -- the information will leak!
8) apply the patch
9) restart_all
10) Refresh the OPAC link
    -- log in screen will appear.
11) run koha qa test tools

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20083: Information disclosure when (mis)using the MARC Preview feature
Andreas Roussos [Fri, 26 Jan 2018 01:12:47 +0000 (14:12 +1300)]
Bug 20083: Information disclosure when (mis)using the MARC Preview feature

The MARC Preview feature in the Staff client (catalogue/showmarc.pl) does not
check whether a user is logged in or not. As a consequence, it can be used to
obtain information that would normally be available to logged-in users only.
For example, you can view any bibliographic record by passing a value to the
'id' argument, but you can also view records as they were imported (normally
done via the 'Staged MARC management' tool).

All three 17.11 installations currently listed at
https://wiki.koha-community.org/wiki/Koha_Demo_Installations
are affected by this issue, as demonstrated by the URLs below:

http://koha.adminkuhn.ch:8080/cgi-bin/koha/catalogue/showmarc.pl?importid=1&viewas=html
http://pro.demo1711-koha.test.biblibre.eu/cgi-bin/koha/catalogue/showmarc.pl?id=1000&viewas=html
https://staff-kohademo.equinoxinitiative.org/cgi-bin/koha/catalogue/showmarc.pl?id=1&viewas=html

It should be noted that this only applies to XSLT-enabled installations.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19223: Add methods to correctly handle plugin-generated output
Tomas Cohen Arazi [Tue, 27 Mar 2018 18:56:57 +0000 (15:56 -0300)]
Bug 19223: Add methods to correctly handle plugin-generated output

This patch introduces two methods to be used by plugin authors:

->output
->output_html

They are basically wrappers for the helper methods from C4::Output
(output_html_with_http_headers and output_with_http_headers).

Plugin authors can use them, or keep the current flexibility of handling
the headers themselves in their code.

The KitchenSink plugin should be updated to highlight this.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/Plugins.t
=> FAIL: The methods are not implemented
- Apply this patch
- Run:
 k$ prove t/db_dependent/Plugins.t
=> SUCCESS: Tests pass, and they are meaningful
- Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19223: Unit tests for output and output_html methods
Tomas Cohen Arazi [Tue, 27 Mar 2018 18:56:41 +0000 (15:56 -0300)]
Bug 19223: Unit tests for output and output_html methods

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: (follow-up) Replace GetPendingIssues - opac-user.pl
Jonathan Druart [Tue, 3 Apr 2018 12:52:57 +0000 (09:52 -0300)]
Bug 19935: (follow-up) Replace GetPendingIssues - opac-user.pl

Syntax issue, can be squashed on pushing.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Use ->checkouts when ->pending_checkouts->count was used
Jonathan Druart [Tue, 3 Apr 2018 12:49:54 +0000 (09:49 -0300)]
Bug 19935: Use ->checkouts when ->pending_checkouts->count was used

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - Remove the residue
Jonathan Druart [Mon, 8 Jan 2018 15:32:55 +0000 (12:32 -0300)]
Bug 19935: Replace GetPendingIssues - Remove the residue

Here we are, no more occurrences of GetPendingIssues, we can remove the
tests and subroutine \o/

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - SIP
Jonathan Druart [Mon, 8 Jan 2018 15:23:42 +0000 (12:23 -0300)]
Bug 19935: Replace GetPendingIssues - SIP

Sounds like we do not need related fields or 'overdue' flag here.
No idea how to confirm there is no regression here.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - sco-main
Jonathan Druart [Mon, 8 Jan 2018 15:06:59 +0000 (12:06 -0300)]
Bug 19935: Replace GetPendingIssues - sco-main

Same as previously, we do not need all the prefetched values here, just
a few.

Test plan:
Use the self checkout module to check some items out

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - opac-user.pl
Jonathan Druart [Mon, 8 Jan 2018 14:59:29 +0000 (11:59 -0300)]
Bug 19935: Replace GetPendingIssues - opac-user.pl

At first glance we just need the biblio title and the subtitle (in
addition of the fines info), we should not need the prefetch.

Test plan:
Loggin at the OPAC, on the summary page you should see your checkouts
and overdues with the correct values

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - opac-ics.pl
Jonathan Druart [Mon, 8 Jan 2018 14:47:46 +0000 (11:47 -0300)]
Bug 19935: Replace GetPendingIssues - opac-ics.pl

We only need the biblio title and the barcode, we should not need the
whole prefetch.

Test plan:
On your OPAC summary page export your checkout list using the
"Download as iCal/.ics file" link.
Before and after the patchset, the generated files must be the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - summary-print
Jonathan Druart [Mon, 8 Jan 2018 14:40:10 +0000 (11:40 -0300)]
Bug 19935: Replace GetPendingIssues - summary-print

We are in the notices part, so we need to fetch all the data to avoid
regressions.

Test plan:
Print a summary slip before and after this patch.
They must be the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - deletemem.pl
Jonathan Druart [Mon, 8 Jan 2018 14:16:09 +0000 (11:16 -0300)]
Bug 19935: Replace GetPendingIssues - deletemem.pl

Same as previously, we just want Koha::Patron->checkouts->count to know
if a patron has checkouts.

Test plan:
Confirm that you cannot delete a patron's card if they have pending checkouts

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - Discharges
Jonathan Druart [Mon, 8 Jan 2018 14:15:02 +0000 (11:15 -0300)]
Bug 19935: Replace GetPendingIssues - Discharges

We should actually use Koha::Patron->checkouts here to avoid the
prefetch.

Test plan:
A patron with checkouts cannot get a discharge

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - ILSDI
Jonathan Druart [Mon, 8 Jan 2018 14:10:50 +0000 (11:10 -0300)]
Bug 19935: Replace GetPendingIssues - ILSDI

Here we should only access to what we want in the template, but let do
it as it for now.

Test plan:
Hit
/cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=542&show_contact=0&show_loans=1

With 42 a borrowernumber with checkouts

Before and after these patches the XML must be the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Replace GetPendingIssues - IssueSlip
Jonathan Druart [Mon, 8 Jan 2018 18:49:18 +0000 (15:49 -0300)]
Bug 19935: Replace GetPendingIssues - IssueSlip

Luckily we have a good test coverage here!

Test plan:
Print issue slips before and after these patches (with overdues, etc.)
They should be the same.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19935: Add Koha::Patron->pending_checkouts
Jonathan Druart [Mon, 8 Jan 2018 18:49:03 +0000 (15:49 -0300)]
Bug 19935: Add Koha::Patron->pending_checkouts

To move this subroutine out of the C4 namespace we face the same
problematic as bug 17553 (with GetOverduesForPatron).
We need to provide an equivalent method and so return all the related
value for a given checkout.
We can acchieve the easily using Koha::Object->unblessed_all_relateds,
but we need to keep in mind that it is a temporary move.
Indeed we will want to use our API to only access/retrive values we really need.
The whole trick could be removed when the current syntax for notices
will be deprecated and removed.

Note: this method returns the same number of elements than ->checkouts
They indeed returns the same things, but it sounds better to me to have a
different method to highlight (from the callers) where does it come
from (C4::Members::GetPendingIssues).

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 17553: (follow-up) Adjust number of tests
Josef Moravec [Tue, 3 Apr 2018 12:28:21 +0000 (12:28 +0000)]
Bug 17553: (follow-up) Adjust number of tests

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 17553: Move GetOverduesForPatron to Koha::Patron->get_overdues
Jonathan Druart [Mon, 8 Jan 2018 16:19:51 +0000 (13:19 -0300)]
Bug 17553: Move GetOverduesForPatron to Koha::Patron->get_overdues

With the help of Koha::Object->unblessed_all_relateds we are going to
replace GetOverduesForPatron without introducing regressions (hopefully)
on both template notice syntaxes.

Test plan:
0/ Do not apply any patches
1/ Check some items in to a given patron, with and without overdues.
2/ Print the overdues slip (Circulation module > Print > Print overdues)
3/ Apply these patches
4/ Print again and compare the result
=> The 2 generated slips must be exactly the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 17553: Move existing tests
Jonathan Druart [Fri, 4 Nov 2016 10:23:56 +0000 (10:23 +0000)]
Bug 17553: Move existing tests

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19926: Add tests for Koha::Object->unblessed_all_relateds
Jonathan Druart [Mon, 8 Jan 2018 16:48:28 +0000 (13:48 -0300)]
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19926: Add the Koha::Object->unblessed_all_relateds method
Jonathan Druart [Mon, 8 Jan 2018 16:19:16 +0000 (13:19 -0300)]
Bug 19926: Add the Koha::Object->unblessed_all_relateds method

In order to refactor our legacy code step-by-step, we will need to
provide code with the exact same behaviors and then improve it.

The same idea appears for the TT syntax for notices: we will want to
deprecate the existing syntax in order to support only one syntax.
Currently we fetch all the values from the related tables, without
knowing which are actually used.

I am suggestion to introduce a Koha::Object->unblessed_all_relateds
method which will return a hash containing all the fields from the
related tables (with the problems we know: collision in column names).
It is the existing behavior of GetOverduesForPatron and GetPendingIssues
for instance, they are used to send notices and so we have to provide
all the data needed.

See dependent bugs to understand the context and test this patch.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 7143: Update about page for new dev - Roch D'Amour
Jonathan Druart [Tue, 3 Apr 2018 14:21:28 +0000 (11:21 -0300)]
Bug 7143: Update about page for new dev - Roch D'Amour

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 7143: Update about page for new dev - Philippe Audet-Fortin
Jonathan Druart [Tue, 3 Apr 2018 14:18:08 +0000 (11:18 -0300)]
Bug 7143: Update about page for new dev - Philippe Audet-Fortin

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 7143: Update about page for new releases
Jonathan Druart [Tue, 3 Apr 2018 14:16:53 +0000 (11:16 -0300)]
Bug 7143: Update about page for new releases

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18820: Main block size now adjust to OpacNavRight like it would for opacuserlogin
Roch D'Amour [Thu, 22 Feb 2018 21:08:59 +0000 (16:08 -0500)]
Bug 18820: Main block size now adjust to OpacNavRight like it would for opacuserlogin

Test plans  :
- "beforepatch.png" shows the result you get when OpacNavRight and opacnav are set to false.
- "opacuserlogin=f_opacnav=f.png" shows the result with the patch and OpacNavRight and opacnav set to false
- "opacuserlogin=t_opacnav=f.png" shows the result with the patch and OpacNavRight set to true and opacnav set to false

Applied patch, can confirm it functions as expected.
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18820: Adding lines that check if opacuserlogin is enable and if OpacNav has...
Paudet [Mon, 19 Jun 2017 13:27:15 +0000 (09:27 -0400)]
Bug 18820: Adding lines that check if opacuserlogin is enable and if OpacNav has content.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Dominic Pichette <dominic@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20497: Access LibraryThing assets using HTTPS
Tomas Cohen Arazi [Thu, 29 Mar 2018 19:12:28 +0000 (16:12 -0300)]
Bug 20497: Access LibraryThing assets using HTTPS

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19892: (follow-up) Replace one more instance
Owen Leonard [Tue, 27 Mar 2018 16:46:16 +0000 (16:46 +0000)]
Bug 19892: (follow-up) Replace one more instance

This patch replaces one more instance of [% IF ( numbersphr ) %].

To test, apply the patch and view the source of the OPAC home page.

With the OPACNumbersPreferPhrase system preference set to 'use,' you
should find this in the HTML source:

<option value="callnum,phr">Call number</option>

With the preference set to 'don't use,' you should find this:

<option value="callnum">Call number</option>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19892: Replace numbersphr variable with Koha.Preference('OPACNumbersPreferPhrase...
Charlotte Cordwell [Thu, 18 Jan 2018 01:29:05 +0000 (01:29 +0000)]
Bug 19892: Replace numbersphr variable with Koha.Preference('OPACNumbersPreferPhrase') in OPAC

Test Case
1) Check that the following files have been changed properly.
opac/opac-search.pl
 opac/opac-main.pl
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt

2)Apply bug
3) Check that there are no differences in behaviour as a result of the patch.

Signed-off-by: Roch D'Amour <roch.damour@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20291: DBRev 17.12.00.025
Jonathan Druart [Mon, 2 Apr 2018 21:05:39 +0000 (18:05 -0300)]
Bug 20291: DBRev 17.12.00.025

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20291: (follow-up) Rename NoLoginInstructions to OpacLoginInstructions
Nick Clemens [Thu, 29 Mar 2018 10:14:59 +0000 (10:14 +0000)]
Bug 20291: (follow-up) Rename NoLoginInstructions to OpacLoginInstructions

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20291: (follow-up) Add sysprefs.sql changes
Nick Clemens [Tue, 27 Feb 2018 10:45:46 +0000 (10:45 +0000)]
Bug 20291: (follow-up) Add sysprefs.sql changes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20291: Add a StaffLoginInstructions preference for adding text to staff client...
Nick Clemens [Wed, 21 Feb 2018 04:56:23 +0000 (04:56 +0000)]
Bug 20291: Add a StaffLoginInstructions preference for adding text to staff client login

To test:
1 - Apply patches
2 - Upgrade database
3 - Check the staff client login page, should be no change
4 - Add something to the preferene
5 - It should appear on the login page

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20052: (follow-up) Fix QA tool complaints and bad copy
Nick Clemens [Thu, 29 Mar 2018 13:00:36 +0000 (13:00 +0000)]
Bug 20052: (follow-up) Fix QA tool complaints and bad copy

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20052: Add Koha Reports object class
Nick Clemens [Mon, 15 Jan 2018 14:38:13 +0000 (14:38 +0000)]
Bug 20052: Add Koha Reports object class

To test:
prove -v t/db_dependent/Koha/Reports.t

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18382: (QA follow-up) Make new unit test pass
Kyle M Hall [Wed, 28 Mar 2018 19:58:37 +0000 (19:58 +0000)]
Bug 18382: (QA follow-up) Make new unit test pass

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18382: Add a test
Jonathan Druart [Tue, 27 Mar 2018 17:09:54 +0000 (14:09 -0300)]
Bug 18382: Add a test

This is what I am expecting but I may be wrong.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18382: (QA follow-up) Don't set suspend_until if dt if undefined
Kyle M Hall [Tue, 27 Mar 2018 14:45:09 +0000 (10:45 -0400)]
Bug 18382: (QA follow-up) Don't set suspend_until if dt if undefined

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18382: (QA follow-up) Replace ->ymd by ->datetime
Marcel de Rooy [Thu, 22 Mar 2018 08:17:46 +0000 (09:17 +0100)]
Bug 18382: (QA follow-up) Replace ->ymd by ->datetime

The first patch makes Hold.t fail on:
not ok 8 - Hold is suspended with a date, truncation takes place automatically
   Failed test 'Hold is suspended with a date, truncation takes place automatically'
   at Hold.t line 94.
          got: '2018-03-22'
     expected: '2018-03-22T00:00:00'

We could remove the midnight time there, but we also could replace ymd by
datetime. The cpan doc tells us:
    Same as $dt->ymd('-') . 'T' . $dt->hms(':')

Test plan:
With this patch, run Hold.t again. It should pass now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18382: action_logs entry for module HOLDS, action SUSPEND is spammy
Kyle M Hall [Mon, 5 Jun 2017 14:46:45 +0000 (10:46 -0400)]
Bug 18382: action_logs entry for module HOLDS, action SUSPEND is spammy

When a hold is suspended, 'suspend_until' is represented as a DateTime object, complete with locale. All told, this is about 800 lines of text.

Test Plan:
1) Enable the HoldsLog syspref
2) Add a hold on a record/item
3) Suspend the hold with a date to resume
4) Note the massive amount of date in the suspend_until field
5) Apply this patch
6) Suspend another hold with a date to resume
7) Note the log has an acutal date in the suspend_until field

Check the logs using module 'Holds' and Action 'Suspend'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20494: Remove unused code in neworderempty.pl and addbiblio.pl
Nick Clemens [Thu, 29 Mar 2018 12:33:56 +0000 (12:33 +0000)]
Bug 20494: Remove unused code in neworderempty.pl and addbiblio.pl

Should be sufficient to read code and see all lines were commented and
that this patch removes useless lines

To be thorough, ensure that your can add an order to a basket and add a
biblio.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18979: Speed up 'valid-templates.t' tests
Jonathan Druart [Wed, 19 Jul 2017 23:29:26 +0000 (20:29 -0300)]
Bug 18979: Speed up 'valid-templates.t' tests

Test plan:
Confirm than prove xt/author/valid-templates.t is quicker with this
patch.

Before I got:
Files=1, Tests=840, 21 wallclock secs ( 0.18 usr  0.02 sys + 20.28 cusr
0.32 csys = 20.80 CPU)

After:
Files=1, Tests=840, 17 wallclock secs ( 0.06 usr  0.01 sys + 21.56 cusr
0.48 csys = 22.11 CPU)

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20282: Match course reserve on holdingbranch
Nick Clemens [Fri, 23 Feb 2018 10:58:27 +0000 (10:58 +0000)]
Bug 20282: Match course reserve on holdingbranch

To test:
1 - Add a course (Course Reserves)
2 - Add an item to the course
3 - Ensure to change the holding branch for the course reserve
4 - Modify the course item
5 - Note the dropdwn for holding branch is unset
6 - Apply patch
7 - Modify the course item
8 - Dropdown should be correctly populated

Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20369: Analytics search is broken with QueryAutoTruncate set to 'only if * is...
Kyle M Hall [Mon, 12 Mar 2018 11:15:12 +0000 (07:15 -0400)]
Bug 20369: Analytics search is broken with QueryAutoTruncate set to 'only if * is added'

Test Plan:
1) Enable EasyAnalytics
2) Disable QueryAutoTruncate
3) Create an analytic record, add some host items to it
4) Browser to the analytics tab for the record
5) Click the link in the 'used in' column of the table
6) No search results
7) Apply this patch
8) Reload the page, now you get the analytic record!

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19907: Fix email validation in patron edit form
Josef Moravec [Wed, 3 Jan 2018 11:20:46 +0000 (11:20 +0000)]
Bug 19907: Fix email validation in patron edit form

Test plan:
0) Confirm that email validation is not working in add/edit patron form
1) Apply the patch
2) Edit/add patron, the e-mail validation should be working now
3) Ensure the password validation is still working (use test plan from
    bug 19908)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20462: Ensure batch item deletion will not delete the same item twice
Jonathan Druart [Mon, 26 Mar 2018 15:22:15 +0000 (12:22 -0300)]
Bug 20462: Ensure batch item deletion will not delete the same item twice

This has been done on bug 9509 when barcodes are scaned, but not when using a text file.

Test plan (stolen from Barton on the bug report):
1) Create a text file containing duplicate barcodes

Here's a quick way to do that, substitute INSTANCE for the instance name of your test server:

sudo koha-mysql INSTANCE <<< "select barcode from items where barcode is not null limit 3" | sed '1d;p' > /tmp/dup_barcodes.txt

2) Go to Home › Tools › Batch item deletion
3) Click 'Choose File', select the file you created in step 1.
4) Click 'Continue'
5) Note that duplicate items appear in the list of items to batch delete
6) Check 'Delete records if no items remain'
7) This will trigger a software error

Note that entering the barcodes via the 'scan items one by one' text box removes duplicates in the list, so this only causes problems when uploading a file.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20318: Add class 'required' to the label
Jonathan Druart [Mon, 2 Apr 2018 17:30:23 +0000 (14:30 -0300)]
Bug 20318: Add class 'required' to the label

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20318: Merge invoices can lead to an merged invoice without Invoice number
Christophe Croullebois [Wed, 14 Mar 2018 14:28:28 +0000 (14:28 +0000)]
Bug 20318: Merge invoices can lead to an merged invoice without Invoice number

When you want to merge invoices you have a page with a non editable
field 'Invoice number:' it shows the content of the first invoice to be
merged.
But if you validate by clicking the 'merge' button you arrive on the
next page which says that 'Invoice has been modified' and if you quit
this page without saving you have now a merged invoice without Invoice
number.
This tiny patch just prevents this issue to occur.

Test plan :

1° go to the acqui/invoices.pl page and search invoices to merge.
You must have at least 2 invoices on the same vendor
2° check boxes to select invoices to merge and click on 'merge selected
invoices' button
3° next page you see the non editable field 'Invoice number:'
4° click on the 'merge' button
5° next page you see 'Invoice has been modified'
6° leave this page i.e click on the left link 'Invoices'
7° search invoices you'll see the merged invoice without invoice number.

Apply the patch, replay the steps 1 to 3
4° on this page you can enter your invoice number and click on the
'merge' button.
If you leave this field empty and click merge, a message informs you
that it is required and you can not merge.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18474: (QA follow-up) Remove useless else in template
Kyle M Hall [Fri, 30 Mar 2018 11:08:30 +0000 (07:08 -0400)]
Bug 18474: (QA follow-up) Remove useless else in template

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18474: Restore multiple holds when patron is searched for
Jonathan Druart [Thu, 21 Dec 2017 18:59:24 +0000 (15:59 -0300)]
Bug 18474: Restore multiple holds when patron is searched for

We lost the ability to place multiple holds when we are searching for
patrons. The multi_holds parameter is lost and not handled correctly in
the template.

Test plan:
- Make sure you can place multiple holds for a patron you will search for
- Same for simple hold

TODO the multiple holds view should not be displayed if only 1 record
has been selected from the search result.

Signed-off-by: claude brayer <claude.brayer@cea.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20385: (follow-up) Assign blank instead of inappropraite value
Nick Clemens [Fri, 23 Mar 2018 17:12:13 +0000 (17:12 +0000)]
Bug 20385: (follow-up) Assign blank instead of inappropraite value

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20385: Don't try to get info for bad authtypecodes
Nick Clemens [Tue, 13 Mar 2018 14:57:47 +0000 (14:57 +0000)]
Bug 20385: Don't try to get info for bad authtypecodes

TO test:
0 - Have a koha with ES enabled and some auth records
1 - backup your db
2 - sudo koha-mysql <<instance>>
3 - UPDATE auth_types SET authtypecode="PERSO_NAMB" WHERE
authtypecode="PERSO_NAME" (or adjust as necessary)
4 - Search for some authorities where a PERSO_NAME record will be
returned
5 - KA_BOOM!
6 - Apply patch
7 - Results are returned, they do not display a code, viewing record you
won't see code

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20503: Prevent Borrower_PrevCheckout.t to fail randomly
Jonathan Druart [Fri, 30 Mar 2018 16:14:46 +0000 (13:14 -0300)]
Bug 20503: Prevent Borrower_PrevCheckout.t to fail randomly

category_type must be != "X"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20498: (bug 19641 follow-up) Patron advanced search form missing from patron...
Owen Leonard [Thu, 29 Mar 2018 17:57:01 +0000 (17:57 +0000)]
Bug 20498: (bug 19641 follow-up) Patron advanced search form missing from patron entry page

My patch moving patron-related templates' javascript to the footer left
out a script from the patron entry template which is required if the
patron header search menu is going to work.

To test, apply the patch and go to Patrons -> New patron.

Clicking the [+] link in the "Search patrons" header search form should
expand the advanced search options.

Test that the page's toolbar still "floats" correctly when you scroll
the page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 16330: Remove unecessary Koha::Patron->store method
Jonathan Druart [Thu, 29 Mar 2018 15:45:39 +0000 (12:45 -0300)]
Bug 16330: Remove unecessary Koha::Patron->store method

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20490: Correct bug number typo in comment in Circulation.t
Lari Taskula [Wed, 28 Mar 2018 21:19:52 +0000 (21:19 +0000)]
Bug 20490: Correct bug number typo in comment in Circulation.t

NOTE: Confirmed that the typo of 17641 was part of bug 17941.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19784: Adapt /v1/patrons to new naming guidelines
Tomas Cohen Arazi [Fri, 8 Dec 2017 12:35:45 +0000 (09:35 -0300)]
Bug 19784: Adapt /v1/patrons to new naming guidelines

This patch introduces two functions to the patrons endpoint:
- _to_api
- _to_model

This are in charge of field mappings in order to comply with the
guidelines.

Koha::REST::V1:Auth is adjusted to handle 'patron_id' as well. 'borrowernumber'
handling is kept until the existing endpoints get updated.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19784: Remove reference to 'borrowernumber' param from other endpoints
Tomas Cohen Arazi [Fri, 8 Dec 2017 12:25:35 +0000 (09:25 -0300)]
Bug 19784: Remove reference to 'borrowernumber' param from other endpoints

This patch removes the $ref occurences for borrowernumber in not
patron-specific endpoints. 'borrowernumber' is still used on them, but as a
hardcoded parameter. The param rename will happen on a separate bug for
each endpoint.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19784: Unit tests for /api/v1/patrons
Tomas Cohen Arazi [Fri, 8 Dec 2017 12:17:28 +0000 (09:17 -0300)]
Bug 19784: Unit tests for /api/v1/patrons

This patch adapts the existing endpoint's tests so they expect:
- 'patron_id' for 'borrowernumber'
- 'library_id' for 'branchcode'
- 'category_id' for 'categorycode'

In the process, I tried to make the tests more robust, by creating random
data that gets deleted to make sure our tests cases can't have false
positives.

Independent subtests are wrapped inside transactions to avoid
eventual interference.

To test:
- Apply the patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: The api doesn't implement the expected behaviour and attributes
for endpoint responses

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 16330: (QA follow-up) Update usage of search plugin because of bug 19686
Josef Moravec [Mon, 19 Feb 2018 07:15:22 +0000 (07:15 +0000)]
Bug 16330: (QA follow-up) Update usage of search plugin because of bug 19686

Test plan:
prove t/db_dependent/api/v1/patrons.t
--> without  patch the list subtest fail
--> with patch test pass

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 16330: Remove validation code from Koha::Patron
Tomas Cohen Arazi [Tue, 19 Dec 2017 17:46:45 +0000 (14:46 -0300)]
Bug 16330: Remove validation code from Koha::Patron

This patch removes previously added validation code from Koha::Patron
as we will rely on the DB structure and relationships to catch the same
problems. This is implemented on bug 19828.

This patch also adapts the API controller class to expect this behaviour
change from Koha::Patron. The expected exceptions are adjusted, and some
minor changes take place. The API tests are adjusted as well.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patrons.t
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests should still pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 16330: (QA follow-up) ModMember requires borrowernumber
Tomas Cohen Arazi [Tue, 12 Dec 2017 21:53:45 +0000 (18:53 -0300)]
Bug 16330: (QA follow-up) ModMember requires borrowernumber

Works perfectly. Well done everyone!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 16330: (QA follow-up) Repect guidelines on plurals Patron > Patrons
Tomas Cohen Arazi [Tue, 5 Dec 2017 19:43:00 +0000 (16:43 -0300)]
Bug 16330: (QA follow-up) Repect guidelines on plurals Patron > Patrons

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 16330: Move patches to OpenAPI
Tomas Cohen Arazi [Mon, 4 Dec 2017 19:18:47 +0000 (16:18 -0300)]
Bug 16330: Move patches to OpenAPI

This patch refactors the original work so it implements the controllers
and the spec using Mojolicious::Plugin::OpenAPI, and OpenAPI for the specification.

It removes the ability for patrons without permissions to edit their own data or their
guarantee's. This will be moved to a patron modification requests endpoint for simplicity.

It makes use of bugs 19410 and 19686 and their dependencies to deal with parameters handling,
query building and pagination.

Tests are adapted.

To test:
- Apply this patches and the dependencies
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 16330: Add routes to add, update and delete patrons
Benjamin Rokseth [Wed, 27 Apr 2016 13:47:04 +0000 (13:47 +0000)]
Bug 16330: Add routes to add, update and delete patrons

This patch adds support for add, edit and delete patrons via REST API.

GET  /api/v1/patrons                   Get patron list from params
GET  /api/v1/patrons/<borrowernumber>  Get single patron
POST /api/v1/patrons                   Create a new patron
PUT  /api/v1/patrons/<borrowernumber>  Update data about patron
DEL  /api/v1/patrons/<borrowernumber>  Delete a patron

Revised Test plan:
1) Apply this patch
2) Run tests perl t/db_dependent/api/v1/patrons.t
3) Add a user with proper rights to use the REST API
4) play with your favourite REST client (curl/httpie, etc.):
   Authenticate with the user created above and get a CGISESSION id.
   Use the CGISESSION to add, edit and delete patrons via the API.
5) Use PUT /patrons/<borrowernumber> for a patron without borrowers
   flag. This should go into pending patron modification status and
   needs to be accepted by a librarian.

Please note there is no validation of body input in PUT/POST other
than branchcode,category,userid,cardnumber.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19488: (QA follow-up) Fix spelling, remove ()
Katrin Fischer [Sun, 25 Mar 2018 20:10:22 +0000 (22:10 +0200)]
Bug 19488: (QA follow-up) Fix spelling, remove ()

Fixes spelling to match the details page and removes ().

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19488: Add borrowernumber to brief info on patron details pages in staff client
Jesse Maseto [Fri, 2 Mar 2018 14:48:06 +0000 (14:48 +0000)]
Bug 19488: Add borrowernumber to brief info on patron details pages in staff client

To test:
- View different tabs of a borrower's patron account in staff
- Verify the borrowernumber is shown in the brief info section
  on the left

Signed-off-by: JM Broust <jean-manuel.broust@univ-lyon2.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19564: (QA follow-up) Make commented out tests pass
Nick Clemens [Wed, 28 Mar 2018 12:42:19 +0000 (12:42 +0000)]
Bug 19564: (QA follow-up) Make commented out tests pass

We likely shoudln't pass through an uncoverted sort order for now, but
it does allow us to look ahead to implementing the orders directly so
seems a good option to have.

Either this patch should be used, or the commented out tests should be
removed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19564: Add tests for _convert_sort_fields
Jonathan Druart [Fri, 22 Dec 2017 18:21:51 +0000 (15:21 -0300)]
Bug 19564: Add tests for _convert_sort_fields

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19564: Fix extraction of sort order from sort condition name
David Gustafsson [Thu, 2 Nov 2017 14:02:23 +0000 (15:02 +0100)]
Bug 19564: Fix extraction of sort order from sort condition name

Currently sort order is extracted from sort condition by splitting the
field, instead use regular expression to extract the last part preceded
by underscore.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19673: Allow to set patron attributes to 0 with batch patron modification
Jonathan Druart [Thu, 21 Dec 2017 00:35:47 +0000 (21:35 -0300)]
Bug 19673: Allow to set patron attributes to 0 with batch patron modification

This patch will have to be tested deeply to make sure it will not
introduce regression!

The idea is to display an empty option in the patron attributes select
and ignore it. That way we can deal with false values 0 and "" which
were skipped before.

Test plan:
Add several patron attributes
Use the batch patron modification tool to add/update/remove them
Play with empty "" and 0 values, as well as other values
Modify several attributes in a row

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19916: Add keyword and standard ID fields to acq external search
Nick Clemens [Thu, 4 Jan 2018 15:31:52 +0000 (15:31 +0000)]
Bug 19916: Add keyword and standard ID fields to acq external search

To test:
1 - Add an order from external source
2 - Note you don't have keyword or standard ID fields
3 - Add a catalog record from Z3950, note those fields are there
4 - Apply patch
5 - Check acq and note you do have those fields
6 - Do some searches to verify they work as expected

Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20330: Allow translating more of quote upload
Pasi Kallinen [Mon, 5 Mar 2018 07:09:28 +0000 (09:09 +0200)]
Bug 20330: Allow translating more of quote upload

Translate the error messages, and the table headers.

Test plan:

1) Go to Home -> Tools -> Quote editor -> Import quotes
2) Upload quotes from a file. Try to trigger the error messages
3) On successful import, check the table header texts
4) Apply patch, update & install a language
5) The error messages and the table header texts should
   show up in the xx-YY-staff-prog.po
6) Repeat 1,2,3

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18055: The 2 new deps are used for testing purpose
Jonathan Druart [Wed, 28 Mar 2018 18:54:56 +0000 (15:54 -0300)]
Bug 18055: The 2 new deps are used for testing purpose

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18055: (QA followup) Only print output if DEBUG
Tomas Cohen Arazi [Fri, 1 Sep 2017 15:25:27 +0000 (12:25 -0300)]
Bug 18055: (QA followup) Only print output if DEBUG

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager
Mason James [Thu, 15 Jun 2017 13:20:05 +0000 (01:20 +1200)]
Bug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager

add KOHA_PROVE_CPUS envar to manually set number of cpus

to test..

1/ set number of cpus to 1
 $ export KOHA_PROVE_CPUS=1

2/ observe 1 cpus are used
 $ time prove -v  t/db_dependent/00-strict.t
 t/db_dependent/00-strict.t ..
 Using 1 CPUs...

3/ unset number of cpus
 $ export KOHA_PROVE_CPUS=

4/ observe all available cpus are used
 $ time prove -v  t/db_dependent/00-strict.t
 t/db_dependent/00-strict.t ..
 Using 32 CPUs...

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager
Mason James [Sun, 5 Feb 2017 01:40:06 +0000 (14:40 +1300)]
Bug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager

to test...

1/ run 00-strict.t test, (16.5 mins on a 4xcpu system)

$ time prove t/db_dependent/00-strict.t
...
Files=1, Tests=654, 994 wallclock secs ( 0.19 usr  0.04 sys + 873.40 cusr 116.20 csys = 989.83 CPU)
Result: PASS
real    16m34.104s

2/ apply patch

3/ install Parallel::ForkManager package
$ sudo apt-get install libparallel-forkmanager-perl libsys-cpu-perl

4/ run 00-strict.t test again, (now 6 mins.. much faster)

$ time prove t/db_dependent/00-strict.t
...
Files=1, Tests=654, 364 wallclock secs ( 0.07 usr  0.01 sys + 1159.20 cusr 153.41 csys = 1312.69 CPU)
Result: PASS
real    6m4.355s

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: removed debian/control changes as the file is generated

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20455: Fix sort patrons by date expired
Jonathan Druart [Mon, 26 Mar 2018 16:13:58 +0000 (13:13 -0300)]
Bug 20455: Fix sort patrons by date expired

We may need to apply this change for all other occurrences in our
codebase.

Test plan:
- Make sure sample patron data is loaded and you have a patron without a
date expired defined
- Make an empty search for all patrons or another search that gives you
a good amount of results
- Try to sort on the date expired column

=> Without this patch you get
Odd number of elements in anonymous hash
at /home/vagrant/kohaclone/C4/Utils/DataTables/Members.pm line 189.
output_pref is called with 'dateonly' (ref SCALAR), not a DateTime
object

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19233: Restore styling of the button
Jonathan Druart [Tue, 27 Mar 2018 20:53:13 +0000 (17:53 -0300)]
Bug 19233: Restore styling of the button

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19583: Remove use of C4::AuthoritiesMarc
Alex Arnaud [Tue, 13 Mar 2018 15:09:22 +0000 (15:09 +0000)]
Bug 19583: Remove use of C4::AuthoritiesMarc

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19582: (follow-up) get params in correct order
Nick Clemens [Mon, 12 Mar 2018 15:56:45 +0000 (15:56 +0000)]
Bug 19582: (follow-up) get params in correct order

We were ordering the values out of sync with the order of the mathclist
param and so causing 'entire record' and 'all headings' to be reversed

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19582: Unit tests
Nick Clemens [Tue, 7 Nov 2017 01:24:56 +0000 (01:24 +0000)]
Bug 19582: Unit tests

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19582: Use compat routines for searching authorities in auth_finder.pl
Nick Clemens [Mon, 6 Nov 2017 17:14:34 +0000 (17:14 +0000)]
Bug 19582: Use compat routines for searching authorities in auth_finder.pl

To test:
1 - Enable Zebra
2 - Perform an auth search
3 - note results
4 - Enable ES
5 - Repeat search, note (likely) diff results
6 - Open a record in cataloging and use the button to launch auth search
7 - Perform same search as above, note results match for eiher engine
selected
8 - NOTE: Disbale sorting for ES search - this will be dealt with in
another report

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20386: Improve warning and error messages for Search Engine Configuration
Claire Gravely [Tue, 13 Mar 2018 11:18:33 +0000 (11:18 +0000)]
Bug 20386: Improve warning and error messages for Search Engine Configuration

This patch updates a warning message and error message in the Search
engine configuration for Elasticsearch.

Note: elasticsearch does not need to be active in order to test.

To test warning message:
 1. go to: cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl
 2. note the warning message
 3. Apply patch
 4. Note the change in warning message. Confirm it makes sense.

To test error message:
  Apply patch and check the changed message in the template file mappings.tt and confirm it makes sense.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19739: Add default ES configuration to koha-conf.xml
Fridolin Somers [Mon, 4 Dec 2017 09:04:48 +0000 (10:04 +0100)]
Bug 19739: Add default ES configuration to koha-conf.xml

Bug 18571 added default ES configuration for packaging config.

This patch adds it to dev install in koha-conf.xml.
Database name is used in index_name to allow multiple installs.

Test plan :
- Run dev install
- Install ElasticSearch server and Koha deps
- Enable ElasticSearch in Koha
- Check indexing and searching works directly

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19233: (follow-up) Use a button to submit form
Nick Clemens [Tue, 27 Mar 2018 17:30:42 +0000 (17:30 +0000)]
Bug 19233: (follow-up) Use a button to submit form

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19233: (follow-up) Send itemnumbers in report results to batch modification
Owen Leonard [Mon, 18 Sep 2017 15:23:38 +0000 (15:23 +0000)]
Bug 19233: (follow-up) Send itemnumbers in report results to batch modification

This patch changes the obscure "^" symbol to a styled link with the text
"Batch modify." I think the only disadvantage of this is that it takes
up more space, but it is outweighed by the improved clarity.

This patch also makes minor indentation corrections to new lines of
HTML.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 19233: Add ability to send itemnumbers in report results to batch modification
Nick Clemens [Fri, 1 Sep 2017 00:54:44 +0000 (00:54 +0000)]
Bug 19233: Add ability to send itemnumbers in report results to batch modification

To test:
1 - Apply patch
2 - Run a report with an itemnumber column
3 - Note there is a linked '^' after column title
4 - Hover over the '^'
5 - You should see a tooltip 'Send visible items to batch modification'
6 - Click the '^'
7 - You should be sent to batch item modification with itemnumbers that
were visible in report

Signed-off-by: George <george@nekls.org>
Signed-off-by: BWS Sandboxes <ByWaterSandboxes@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20479: Ease readability - do not enter the block if not logged in
Jonathan Druart [Tue, 27 Mar 2018 16:37:35 +0000 (13:37 -0300)]
Bug 20479: Ease readability - do not enter the block if not logged in

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20479: Use $flag instead of fetching patron
Jonathan Druart [Tue, 27 Mar 2018 15:47:54 +0000 (12:47 -0300)]
Bug 20479: Use $flag instead of fetching patron

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20479: (follow-up) Don't try to get flags for database user
Nick Clemens [Tue, 27 Mar 2018 15:05:57 +0000 (15:05 +0000)]
Bug 20479: (follow-up) Don't try to get flags for database user

Login will still break in opac-user.pl, but that seems a bigger problem
not from SCI module

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20479: Don't kick superlibrarians out of the opac
Nick Clemens [Tue, 27 Mar 2018 12:47:57 +0000 (12:47 +0000)]
Bug 20479: Don't kick superlibrarians out of the opac

To test:
1 - Try to log in to opac with a superlibrarian
2 - Everythign goes wrong
3 - Apply patch
4 - Try to log in with superlibrarian
5 - You can sign in

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20480: send KOHA_VERSION even if only one language is enabled
Jonathan Druart [Tue, 27 Mar 2018 16:27:27 +0000 (13:27 -0300)]
Bug 20480: send KOHA_VERSION even if only one language is enabled

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20480: Make KOHA_VERSION available to all templates in all circumstances
Tomas Cohen Arazi [Tue, 27 Mar 2018 14:54:51 +0000 (11:54 -0300)]
Bug 20480: Make KOHA_VERSION available to all templates in all circumstances

This patch makes C4::Templates::gettemplate set the KOHA_VERSION param
for the template. This way this template parameter, which is required by
(probably) all pages that include CSS/JS content is available in all
circumstances.

A noticeable problem with the current approach is when using the SCO and
SCI modules with wrong/forbidden users: C4::Auth short-circuits and
redirects to the login page, without setting the KOHA_VERSION param.
This patch solves it for good.

To test:
- Enable the SCI module
- Open the browser at
  http://localhost:8080/cgi-bin/koha/sci/sci-main.pl
- Login with the db user (koha_kohadev / password)
=> FAIL: Login failure, but styling is broken
- Apply this patch
- Retry
=> SUCCESS: Everything looks as it should!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20474: Mimick Letters.t
Jonathan Druart [Tue, 27 Mar 2018 15:21:41 +0000 (12:21 -0300)]
Bug 20474: Mimick Letters.t

Please improve if needed the 2 occurrences on a separate bug reports.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20474: Mock sendmail instead of actually emailing
Mark Tompsett [Mon, 26 Mar 2018 15:39:28 +0000 (15:39 +0000)]
Bug 20474: Mock sendmail instead of actually emailing

Copy mocking sendmail code from t/db_dependent/Letters.t
into the Passwordrecovery.t test file.

prove t/db_dependent/Passwordrecovery.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 years agoBug 20474: Explicitly call sendmail to make mocking work
Mark Tompsett [Mon, 26 Mar 2018 16:46:19 +0000 (16:46 +0000)]
Bug 20474: Explicitly call sendmail to make mocking work

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