koha.git
6 years agoBug 19052 - XSS Flaws in vendor search page
Amit Gupta [Mon, 7 Aug 2017 16:34:30 +0000 (22:04 +0530)]
Bug 19052 - XSS Flaws in vendor search page

1. Hit /cgi-bin/koha/acqui/booksellers.pl
2. Enter <IFRAME SRC="javascript:alert('XSS');"></IFRAME> vendor search box.
3. Notice the iframe is executed.
4. Apply patch.
5. Reload page, and enter iframe again on vendor search box.
6. Notice it is no longer executed.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d8b1c8fc7d9ba254b1e71d1501abfae4102e7eea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 19054 - XSS Flaws in Report - Top Most-circulated items
Amit Gupta [Mon, 7 Aug 2017 17:04:05 +0000 (22:34 +0530)]
Bug 19054 - XSS Flaws in Report - Top Most-circulated items

1. Hit /cgi-bin/koha/reports/cat_issues_top.pl
2. Enter <IFRAME SRC="javascript:alert('XSS');"></IFRAME> in Callnumber, Day, Month, Year search box.
3. Notice the iframe is executed.
4. Apply patch.
5. Reload page, and enter iframe again on Callnumber, Day, Month, Year search box.
6. Notice it is no longer executed.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 755a1fb372b29443b7d128c4c710f7a7ed63f189)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 19078 - XSS Flaws in System preferences
Amit Gupta [Thu, 10 Aug 2017 16:21:38 +0000 (21:51 +0530)]
Bug 19078 - XSS Flaws in System preferences

1. Hit /cgi-bin/koha/admin/preferences.pl
2. Enter <script>alert('amit')</script> in search system preferences box.
3. Notice the java script is executed.
4. Apply patch.
5. Reload page, and enter <script>alert('amit')</script> in search system preferences box.
6. Notice it is no longer executed.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b7bb60d76041bf00f6a28fe3a55ecc2c7912a275)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18726: Fix XSS at the OPAC - biblionumber
Jonathan Druart [Wed, 9 Aug 2017 17:08:24 +0000 (14:08 -0300)]
Bug 18726: Fix XSS at the OPAC - biblionumber

The biblionumber parameter is sent by the user, we must escape all of
them to avoid XSS.

Fixes: Cross-site scripting OPAC pages

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0676334968c27337cc1f3a3407ac6eeaef75f201)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18951: Adjust Isbd.t
Marcel de Rooy [Wed, 19 Jul 2017 11:59:45 +0000 (13:59 +0200)]
Bug 18951: Adjust Isbd.t

Add schema calls.
Remove an unneeded AddBiblio call.

Test plan:
Run t/db_dependent/Biblio/Isbd.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 40c719a5248877d200920c2c9a028e273a5f1370)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18951: Create data for TransformKohaToMarc.t
Marcel de Rooy [Wed, 19 Jul 2017 11:48:55 +0000 (13:48 +0200)]
Bug 18951: Create data for TransformKohaToMarc.t

Adding schema and caching statements.
Adjust it so that the Koha to MARC mappings are not assumed to be present,
but are created as needed.
Remove the mock on marcflavour. It is no longer needed.
Resolving a small typo.

Test plan:
Run t/db_dependent/Biblio/TransformKohaToMarc.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f839955db707415368d23ae81bdb14505dd058ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18951: Some t/Biblio tests are database dependent (git mv)
Marcel de Rooy [Wed, 19 Jul 2017 11:33:34 +0000 (13:33 +0200)]
Bug 18951: Some t/Biblio tests are database dependent (git mv)

Move Isbd.t and TransformKohaToMarc.t to db_dependent.
Next patch will add a few adjustments too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 50bc4170cec172de04db2033d464c96348d5a508)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18361: [QA Follow-up] Resolve warning on undef values supplied
Marcel de Rooy [Fri, 16 Jun 2017 05:57:14 +0000 (07:57 +0200)]
Bug 18361: [QA Follow-up] Resolve warning on undef values supplied

The following warning was raised in Letters.t:
DBIx::Class::ResultSource::_minimal_valueset_satisfying_constraint():
NULL/undef values supplied for requested unique constraint 'primary' (NULL
values in column(s): 'id'). This is almost certainly not what you wanted,
though you can set DBIC_NULLABLE_KEY_NOWARN to disable this warning.

This warning is triggered by this line in C4/Letters.pm:
    Koha::SMS::Providers->find( $member->{'sms_provider_id'} );
As you already guessed, the sms_provider_id returns undef.

Resolved in sub find by testing if there are parameters and if so, they
should not be all undefined. (In most cases there will be only one
parameter; but this report is about composite keys.)

Added a trivial test case in Objects.t too.

Test plan:
Run t/db_dependent/Koha/Object.t
Run t/db_dependent/Koha/Objects.t
Run t/db_dependent/Letters.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit e1afa469f8313144c70ae91d7efa356beb8168b8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18361: (QA followup) Add tests for the no params case
Tomas Cohen Arazi [Wed, 19 Apr 2017 14:57:33 +0000 (11:57 -0300)]
Bug 18361: (QA followup) Add tests for the no params case

This patch adds a test for the trivial case in which no param is passed
and the ->find method returns undef.

For completeness purposes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e1f943b9992ea1a3c5d4659ca6fa787834d66376)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18361: Additional tests for Koha::Objects->find
Marcel de Rooy [Thu, 13 Apr 2017 11:15:30 +0000 (13:15 +0200)]
Bug 18361: Additional tests for Koha::Objects->find

Adding a subtest find in t/db_dependent/Koha/Objects.t.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit de74a4e5a0ec0fcf85a42b637d07c2bcd81d63f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18361: Koha::Objects->find should accept composite primary keys
Marcel de Rooy [Fri, 31 Mar 2017 11:52:15 +0000 (13:52 +0200)]
Bug 18361: Koha::Objects->find should accept composite primary keys

Changes the $id parameter to an array. (IssuingRule has three keys.)
The build_object method in TestBuilder.pm has been adjusted to pass
multiple primary key values to find.

Also adjusted the POD section to show more clearly that we accept
the same parameters as DBIx ResultSet does.

Test plan:
Run t/db_dependent/Koha/Object.t
Run t/db_dependent/Koha/Objects.t
Run t/db_dependent/TestBuilder.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ec288a50def5c4fdcd7b001087fed0b120e4a211)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18539: remove occurrence in ReNewSubscription.t
Jonathan Druart [Thu, 15 Jun 2017 18:46:17 +0000 (15:46 -0300)]
Bug 18539: remove occurrence in ReNewSubscription.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ad7ff09b995e5275f2c6d664b31351321b1674af)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18539: Forbid list context calls for Koha::Objects->find
Jonathan Druart [Tue, 18 Apr 2017 16:49:18 +0000 (13:49 -0300)]
Bug 18539: Forbid list context calls for Koha::Objects->find

Reading https://perlmaven.com/how-to-return-undef-from-a-function
this sound like the more correct behaviour.

Considering:
$template->param(
    stuff => Koha::Stuffs->find( $id ),
    foo   => 1,
);
without this patch, if the $id does not represent any rows in the DB,
stuff will be assigned to 'foo' and $foo will be undef in the template.
That can lead to very bad side-effects.

With this patch we make sure that it will never happen again.

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Marc Véron <veron@veron.ch>
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>
(cherry picked from commit 15cbf14f4d4f8039ad7820ce37da202b19e0075d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18367 - (QA Followup) Only warn if doing a lookup and not having an item
Nick Clemens [Fri, 28 Jul 2017 11:38:33 +0000 (11:38 +0000)]
Bug 18367 - (QA Followup) Only warn if doing a lookup and not having an item

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1b73cae6eb4ce7e7ca675d6db84fe8ce0cd2f499)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18367 - Fix untranslatable string from Bug 18264
Nick Clemens [Tue, 11 Apr 2017 20:09:27 +0000 (16:09 -0400)]
Bug 18367 - Fix untranslatable string from Bug 18264

Restore display of message when no barcode found

To test:
1 - Go to course reserves
2 - Add an item to a course
3 - Try adding an invalid barcode - should get an alert
4 - Try force adding an item with itemnumber:
    http://localhost:8081/cgi-bin/koha/course_reserves/add_items.pl?op=lookpup&course_id=11&itemnumber=1234523546
5 - Should recieve an error

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1fc3751804146e92c0d8d85517ffcd6ec338808e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18991: [QA Follow-up] Use schema txn_begin and txn_rollback
Marcel de Rooy [Fri, 28 Jul 2017 09:58:24 +0000 (11:58 +0200)]
Bug 18991: [QA Follow-up] Use schema txn_begin and txn_rollback

We also need just one rollback at the end here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e5e5402f36c923775b341bd1900aa6468d42aa9a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18991: Fix cleanup in t/db_dependent/Log.t
Lari Taskula [Thu, 27 Jul 2017 14:56:18 +0000 (14:56 +0000)]
Bug 18991: Fix cleanup in t/db_dependent/Log.t

There is an action_logs entry via logaction() without transaction to be rolled
back in t/db_dependent/Log.t. This leaves an entry in action_logs after
the test is over.

To replicate:
1. prove t/db_dependent/Log.t
2. Observe a new entry in action_logs table

To test:
1. Apply patch
2. prove t/db_dependent/Log.t
3. Observe there are no new entries in action_logs

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f49f5a67d3512ea75d92cb551ebd79a9de7e53d7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18987 - Added Koha::Account package pragma to Patron.pm
Alex Buckley [Fri, 21 Jul 2017 08:47:48 +0000 (08:47 +0000)]
Bug 18987 - Added Koha::Account package pragma to Patron.pm

Test plan:
1. On an up to date branch go to Patrons and try to browse for a patron
by last name
2. Notice that the page processes indefinately
3. Apply patch
4. Repeat step 1
5. Notice the patron results are displayed

Signed-off-by: David Cook <dcook@prosentient.com.au>
Works as described.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ac8e39d1e742b196677d395dc89d92848560b903)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 19000: Fix typo in closing p tag for items
Marcel de Rooy [Fri, 28 Jul 2017 05:56:21 +0000 (07:56 +0200)]
Bug 19000: Fix typo in closing p tag for items

Close the p tag and add a br tag to visually divide the two sections
Data problems and Warnings regarding system configuration.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Discovered the problem when testing a duplicate key in deleteditems.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3c87b6f387831053e01ecc86b91d61669af9696b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18545: Re-add call to enableCheckboxActions
Jonathan Druart [Mon, 24 Jul 2017 17:25:21 +0000 (14:25 -0300)]
Bug 18545: Re-add call to enableCheckboxActions

This call is used to refresh the page correctly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 37fc0d817d46d21897015a8e1df754b59ba477a6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18545 [Follow-up] Remove use of onclick from OPAC Cart
Owen Leonard [Fri, 9 Jun 2017 15:50:41 +0000 (15:50 +0000)]
Bug 18545 [Follow-up] Remove use of onclick from OPAC Cart

This patch makes a few corrections:

- Use 'e.preventDefault()' instead of 'return false' in changed
  sections.
- Modify the event handler on checkboxes to successfully handle the
  un-check action as well as the check action. (QA comment 5).

To test, follow the original test plan.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 04a601ef659c64446790758ebbe369a2ce090875)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18545: Remove use of onclick from OPAC cart
Aleisha Amohia [Fri, 5 May 2017 03:58:49 +0000 (03:58 +0000)]
Bug 18545: Remove use of onclick from OPAC cart

To test:
1) Apply patch and add one or more items to your cart
2) Confirm that clicking the following things still works as expected:
 - more details
 - brief display
 - send
 - download
 - print
 - select all
 - clear all
 - selecting by clicking checkbox
 - remove title
 - add title to list
 - place hold
 - add tag
 - empty and close

Sponsored-by: Catalyst IT
Followed test plan, works as expected. Resolves issue with two
print dialogues from Bug 18544.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1b4d4f989b1d6c589a08f21ce19a48dca9072ec7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18605: Remove TRUNCATE from C4/HoldsQueue.pm
Marcel de Rooy [Mon, 15 May 2017 08:38:43 +0000 (10:38 +0200)]
Bug 18605: Remove TRUNCATE from C4/HoldsQueue.pm

Replaces TRUNCATE by DELETE, since truncate implicitly commits. We don't
need to do that here. (Would complicate testing it too.)
Fixes typo disablig.
Add a simple test to HoldsQueue.t.

Test plan:
Run t/db_dependent/HoldsQueue.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit db64c94953be772fb316d508fdfffd374ea1d835)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18965 - branch transfer limits pagination save bug
Fridolin Somers [Thu, 20 Jul 2017 14:08:59 +0000 (16:08 +0200)]
Bug 18965 - branch transfer limits pagination save bug

In branch transfer limits, tables are paginated with 20 rows by default.

The bug is that datatable not only hides rows, they are not in form.
So when submitting form, rows not visible are erased.

Test plan :
Wihout patch :
- Create 22 branches, you can hack the creation form by manualling calling URL : /cgi-bin/koha/admin/branches.pl?op=add_validate&branchcode=Bxx&branchname=Bxx
- Go to Administration > Library transfer limits
- You see table first page : only 20 first rows are shown
- You see all checkboxes are checked
- Go to second page of this table
- Save
=> You see table first page with all checkboxes unchecked
With patch the is no pagination, all checkboxes are shown when you save

Signed-off-by: Axelle Clarisse <axelle.clarisse@univ-amu.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7a306d72ab98f2abf2266716761820f1098ede9b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18977: Rollback branch in t/db_dependent/SIP/Message.t
Lari Taskula [Mon, 24 Jul 2017 15:30:10 +0000 (18:30 +0300)]
Bug 18977: Rollback branch in t/db_dependent/SIP/Message.t

To test:
1. Before applying patch, check the amount of branches in database
2. prove t/db_dependent/SIP/Message.t
3. See that a new branch is stored
4. Apply patch
5. prove t/db_dependent/SIP/Message.t
6. See that a new branch is no longer stored

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 139b66f65611cff0a2551662e0fd5c2e50b4c10f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18976: (follow-up) Fix t/db_dependent/Search/History.t cleanup
Lari Taskula [Mon, 24 Jul 2017 15:16:25 +0000 (18:16 +0300)]
Bug 18976: (follow-up) Fix t/db_dependent/Search/History.t cleanup

Same problem in t/db_dependent/Search/History.t.

To replicate:
1. Check the row count of borrowers, branches, categories, sessions, sms_providers
   tables
2. prove t/db_dependent/Search/History.t
3. Repeat step 1
4. Observe borrowers the following tables have increased in row count:
   - borrowers
   - branches
   - categories
   - sessions
   - sms_providers

To test:
1. Before applying the patch, go through steps at "To replicate" plan
2. Apply patch
3. Go through steps at "To replicate" plan
4. Observe step 4 no longer applies and those tables have the same number of
   rows as before executing the test.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6d8b26b01f505771fe0d359d29fff8bc963e5291)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18976: Fix t/db_dependent/Auth.t cleanup
Lari Taskula [Mon, 24 Jul 2017 13:43:18 +0000 (16:43 +0300)]
Bug 18976: Fix t/db_dependent/Auth.t cleanup

Test t/db_dependent/Auth.t seems to have an ineffective test data cleanup.
Data generated by TestBuilder is left in borrowers, branches, categories,
sms_providers and sessions tables after the test.

To replicate:
1. Check the row count of borrowers, branches and categories tables
2. prove t/db_dependent/Auth.t
3. Repeat step 1
4. Observe borrowers the following tables have increased in row count:
   - borrowers
   - branches
   - categories
   - sessions
   - sms_providers

To test:
1. Before applying the patch, go through steps at "To replicate" plan
2. Apply patch
3. Go through steps at "To replicate" plan
4. Observe step 4 no longer applies and those tables have the same number of
   rows as before executing the test.

This issue has been happening in REST tests as well, and this solution is
directly copy-pasted from t/db_dependent/api/v1/cities.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 99d18bf0f3f729261b6560f0dd3c5d757aba3a19)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18832: Missing space between icon and label in button 'Patron lists'
Marc Véron [Wed, 21 Jun 2017 07:47:13 +0000 (09:47 +0200)]
Bug 18832: Missing space between icon and label in button 'Patron lists'

On page Home > Patrons the button 'Patron lists' misses a space between
icon and text. This patch adds it to make the button display like the other
ones.

To test, apply patch and verify that the button displays as expected.

Signed-off-by: fcouffignal <fcouffignal@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 85b895c2dfdf9499fdb12bd108c740144597c89e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18839: Suggestion.pl spelling mistake
Chris Kirby [Wed, 21 Jun 2017 18:27:21 +0000 (18:27 +0000)]
Bug 18839: Suggestion.pl spelling mistake

On the suggestion management page, 'unknown' is spelled 'unkown'

This patch corrects this spelling mistake in

suggestion/suggestion.pl

koha-tmpl/intranet-tmpl/prog/en/include/strings.inc

koha-tmpl/intranet-tmpl/prog/en/include/search_indexes.inc

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit afddf4145fbbfd978e4c5cd22f0ae2cbbef70560)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18918: Disable CSV option if no CSV profiles exist
Aleisha Amohia [Mon, 10 Jul 2017 02:31:22 +0000 (02:31 +0000)]
Bug 18918: Disable CSV option if no CSV profiles exist

To test:
1) Confirm you have no MARC CSV profiles (tools -> csv profiles)
2) Go to Tools -> Export data
3) Select the CSV file format for biblios
4) Notice the CSV profile dropdown shows up but the dropdown is empty
5) Click the Export button, notice Koha breaks
6) Go back and apply the patch, refresh
7) Notice the CSV option is now disabled in the file format menu
8) If you hover over CSV, an appropriate message should show explaining
why it is disabled
9) Create a CSV profile for MARC
10) Go back to Export and you should be able to use CSV now without
problem

Sponsored-by: Catalyst IT
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7723ffdd130996ec946d5b9149f90cb0cdc447fc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18982: Remove data in the correct order
Jonathan Druart [Wed, 26 Jul 2017 16:50:14 +0000 (13:50 -0300)]
Bug 18982: Remove data in the correct order

To respect FK

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6cb3abcbd95fe673d5b0426f5f8c23a0c7683e65)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18982: Create a circ rule for the data we created
Jonathan Druart [Tue, 25 Jul 2017 19:49:38 +0000 (16:49 -0300)]
Bug 18982: Create a circ rule for the data we created

No need to have a default circ cule, we create one for the categorycode
and itemtype we are going to use.
The 3 checkouts will not be rejected (5 are allowed)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5b84987f28b43f0c92eeff9ed1067ed61f822a4b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18982: Create a specific itemtype for these tests
Jonathan Druart [Tue, 25 Jul 2017 19:48:06 +0000 (16:48 -0300)]
Bug 18982: Create a specific itemtype for these tests

No need to require rentalcharge=0 for all itemtypes, we create our own.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ca0568f58393cff3fce6b362e59e90daa1b1524a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18982: category.categorycode must be uppercase
Jonathan Druart [Tue, 25 Jul 2017 19:46:08 +0000 (16:46 -0300)]
Bug 18982: category.categorycode must be uppercase

Otherwise it is not selected in the dropdown list and the patron created
does not belong to this category

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 60478e6544ddfd37dc82829f684c3837b534d146)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18982: Use KOHA_INTRANET_URL instead of syspref staffClientBaseURL
Jonathan Druart [Tue, 25 Jul 2017 17:37:27 +0000 (14:37 -0300)]
Bug 18982: Use KOHA_INTRANET_URL instead of syspref staffClientBaseURL

That way we do not need to set the syspref, we can define it setting an
env var, like other tests.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 78d77163af407dc639764cdf1b8936b8f0f715d6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoIncrement version for 17.05.02 release v17.05.02
Fridolin Somers [Thu, 27 Jul 2017 12:10:29 +0000 (14:10 +0200)]
Increment version for 17.05.02 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoMerge remote-tracking branch 'translate/17.05.02-translate-20170727' into 17.05.x
Fridolin Somers [Thu, 27 Jul 2017 12:04:18 +0000 (14:04 +0200)]
Merge remote-tracking branch 'translate/17.05.02-translate-20170727' into 17.05.x

6 years agoUpdate release notes for 17.05.02 release
Fridolin Somers [Thu, 27 Jul 2017 11:58:22 +0000 (13:58 +0200)]
Update release notes for 17.05.02 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoTranslation updates for Koha 17.05.02
root [Thu, 27 Jul 2017 11:44:56 +0000 (08:44 -0300)]
Translation updates for Koha 17.05.02

6 years agoBug 18572: Remove AddRenewal parameter
Jonathan Druart [Mon, 24 Jul 2017 17:04:06 +0000 (14:04 -0300)]
Bug 18572: Remove AddRenewal parameter

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 51e8b7bbc9d4fe1d560b65eef3285ec3c0b74e71)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18572 - QA Followup
Nick Clemens [Wed, 19 Jul 2017 18:26:07 +0000 (18:26 +0000)]
Bug 18572 - QA Followup

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9b92d79817c359635f463fd5a1e5715affe96356)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18572 - Improper branchcode set during OPAC renewal
Nick Clemens [Fri, 23 Jun 2017 12:27:19 +0000 (12:27 +0000)]
Bug 18572 - Improper branchcode set during OPAC renewal

To test:
1 - Set 'OpacRenewalBranch' to various settings
2 - Renew an item for a ptron under each setting
3 - Confirm action_log entries reflect the correct branch for each
secnario
4 - prove t/db_dependent/Circulation/issue.t

Signed-off-by: David Kuhn <techservspec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e9374dcf6308256f4597e1c83920559d2673b90c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18826 - (QA Followup) Add mock SessionStorage to patrons.t
Nick Clemens [Fri, 21 Jul 2017 12:07:19 +0000 (12:07 +0000)]
Bug 18826 - (QA Followup) Add mock SessionStorage to patrons.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a696843f82dc026ab6545f18b113af8efc753715)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18826: rollback transaction for api tests
Jonathan Druart [Wed, 12 Jul 2017 20:24:24 +0000 (17:24 -0300)]
Bug 18826: rollback transaction for api tests

The holds.t tests for the REST api do no rollback properly and modify
the DB (no cleanup).
This comes from a bug caused by SessionStorage = mysql (default)

The error is:
    "rollback ineffective with AutoCommit enabled"

Test plan:
  select count(*) from borrowers;
  prove t/db_dependent/api/v1/holds.t
  select count(*) from borrowers;
=> The number of entry must be the same before and after the tests have
been executed

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d5dc473382ccfa118e78e91507384245ce0dcfcb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18955 - autocomplete is on in OPAC password recovery
Fridolin Somers [Wed, 19 Jul 2017 07:48:04 +0000 (09:48 +0200)]
Bug 18955 - autocomplete is on in OPAC password recovery

In OPAC password recovery form autocomplete is not disabled.
So when login or email is entered, it is saved in browser input history for autocomplete.
This is a major issue for OPAC on computers with public access.

This patch adds autocomplete off on forms.

Test :
- Enable system preferences OpacPasswordChange and OpacResetPassword
- Go to OPAC
- Be sure to not be logged in
- Click on "Forgot your password?"
- Enter a loggin and email and Submit
=> Without patch there is an autocompletion with values you entered
=> With patch there is no autocompletion

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 214a0e61021934c7e6deee5a24cf11606a57199b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18910: Revert "Bug 18152 : fix unimarc label in SetMarcUnicodeFlag"
Jonathan Druart [Mon, 17 Jul 2017 18:58:49 +0000 (15:58 -0300)]
Bug 18910: Revert "Bug 18152 : fix unimarc label in SetMarcUnicodeFlag"

This reverts commit bf551a07222a7b9beffd7ca6cba38c675aa3ab28.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8e0bb409aef75ac0f18a50d3a34a749f4e87da84)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18910: Revert "Bug 18152: Add tests"
Jonathan Druart [Mon, 17 Jul 2017 18:58:33 +0000 (15:58 -0300)]
Bug 18910: Revert "Bug 18152: Add tests"

This reverts commit a807d7199ea025aa507e0ca7e3ff2330902844f8.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dd60cd9635fd51073d01ec5a24340564f61cd5e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years ago(17.05.x) Bug 18966: Do not deal with duplicate issue_id on checkin
Jonathan Druart [Thu, 20 Jul 2017 16:39:43 +0000 (13:39 -0300)]
(17.05.x) Bug 18966: Do not deal with duplicate issue_id on checkin

Koha suffers of big bugs due to its history: When data are deleted, they are moved to another tables.
For instance issues and old_issues: when a checkin is done, it is moved to the old_issues table.
That leads to a main problem that is described on https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix

However we tried first to fix the problem (for issues/old_issues) at code level on bug 18242.
The goal was to prevent data lost.
Data lost may happens in this case:
Check an item out (issue_id = 1)
Check an item in (issue_id = 1)
Restart MySQL (reset auto increment for issue_id to 1)
Check an item out (issue_id = 1)
Check an item in => BOOM, the issue_id is a PK in old_issues and the move fails.
Before bug 18242 the data were lost, we inserted the value into old_issues, which fails silently (because of RaiseError set to 0 in Koha::Database), then delete the row from issues.
That has been fixed using a transaction.

This patch introduced a regression we tried to fix on bug 18651 comment 0, the patron was charged even if the checkin was rejected.
A good way to fix that would have been to LOCK the tables:
1- Start a transaction
2- LOCK the table to make sure nobody will read id and avoid race conditions
3- Move the content from one table to the other, dealing with ids
4- UNLOCK the table
5- Commit the transaction
But there were problems using LOCK and DBIx::Class (See commit 905572910b3a - Do no LOCK/UNLOCK the table).

Finally the solution implemented is not acceptable for several reasons:
- batch checkins may fail
- issue_id will always stay out of sync (between issues and old_issues)
See 18651 comment 66.

Since the next stable releases are very soon, and we absolutely need to fix this problem, I am suggesting to:
1- Execute the move in a transaction to avoid data lost and reject the checkin if we face IDs dup
=> It will only reject 1 checkin (max is 1 * MySQL restart), no need to deal with race conditions,
2- Display a warning on the checkin page and link to a solution/explanation
3- Communicate as much as we can on the proper fix: Update auto increment values when the DBMS is restarted - https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix
4- Display a warning on the about page for corrupted data (see bug 18931)
5- Write and make available a maintenance script to fix corrupted data (TODO LATER)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18931 - Follow up - Typo fix in template for holds
Mason James [Wed, 26 Jul 2017 06:42:19 +0000 (18:42 +1200)]
Bug 18931 - Follow up - Typo fix in template for holds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 45ff2ef129ea8a52ad7d08a531aad6b3e1e665f3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18931: (followup) Tidy text
Tomas Cohen Arazi [Tue, 25 Jul 2017 17:37:55 +0000 (14:37 -0300)]
Bug 18931: (followup) Tidy text

Some minor style and idiomatic issues.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f5988bb3d233fa29f2af649748bbca611c99b739)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18931 - Follow up - Typo fix in SQL statement
Katrin Fischer [Mon, 24 Jul 2017 21:26:04 +0000 (23:26 +0200)]
Bug 18931 - Follow up - Typo fix in SQL statement

Fixes the table alias in the SQL statement for items and
adds items to the if clause for showing data problems.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c3dca8c24b53aa63838687f536a5509855ccc21c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18931: Add items/deleteditems tables
Jonathan Druart [Mon, 24 Jul 2017 20:46:27 +0000 (17:46 -0300)]
Bug 18931: Add items/deleteditems tables

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 193ecb0a2bb397bf67488f6342f02adda0328031)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18931: Add a "data corrupted" section on the about page - MySQL AI
Jonathan Druart [Wed, 12 Jul 2017 18:52:19 +0000 (15:52 -0300)]
Bug 18931: Add a "data corrupted" section on the about page - MySQL AI

See the following wiki page for more information
https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix

Test plan:
Create (at least) a patron, a checkout, a biblio and a hold
Then fill the old_* or deleted* tables with:
 INSERT INTO deletedborrowers SELECT * from borrowers WHERE  borrowernumber=XXX;
 INSERT INTO deletedbiblio SELECT * from biblio WHERE biblionumber=XXX;
 INSERT INTO old_issues SELECT * from issues WHERE issue_id=XXX;
 INSERT INTO old_reserves SELECT * from reserves WHERE reserve_id=XXX;

Go to the about page, 'System information' tab. You should see a new
"Data problems" section with the list of the ids that are wrong

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1d1d6ddc9d1e4929d9eb232e0745bcf31749cfdb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 16711: OPAC Password recovery: Handling if multiple accounts have the same mail...
Marc Véron [Sun, 21 May 2017 16:28:48 +0000 (18:28 +0200)]
Bug 16711: OPAC Password recovery: Handling if multiple accounts have the same mail address

To reproduce:
- Create 3 Accounts, login names are test01, test02, test03, Email is the same
for all.
- Go to OPAC -> Password recovery and indicate E-Mail only
- You will get an email for only one of the accounts above.

To test:
- Apply patch, restart memcached and plack
- Go to db, delete from borrower_password_recovery;
- Try steps above to reproduce. You will get an error message:
    Account identification with this email address only is ambiguous.
    Please use the field 'Login' as well.
- Verify that other cases work as before (provide valid / invalid login only,
  provide valid email for an existing account, provide unknown email, provide
  both login and email with all combinations of valid / invalid)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 16711: (QA-followup) Use count directly

See comment # 13

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3829020c2664ec531354f78f0c04d00f5dd6795d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18613: Add unit tests for getletter
Baptiste Wojtkowski [Tue, 11 Jul 2017 09:12:37 +0000 (09:12 +0000)]
Bug 18613: Add unit tests for getletter

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ad367a47003f341e1c517c6fbcc96246cbf21609)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18613: Remove letter rule correctly as superlibrarian
Baptiste Wojtkowski [Fri, 19 May 2017 09:23:17 +0000 (09:23 +0000)]
Bug 18613: Remove letter rule correctly as superlibrarian

TEST PLAN

(reproducing bug)
1 - Set 'IndependantBranches' to enable
2 - Log in as Superlibrarian.
3 - Create 3 rules
    - 1 for all librairies (1)
    - 1 for the library of the superlibrarian (2)
    - 1 for another library (3)
4 - Try to delete them and see them and see that (3) isn't the good one

(checking patch)
5 - Apply patch
6 - Try again 3-
7 - Connect as not superlibrarian
8 - Try again 3-

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 648e2a2b808efac22a8b88545d53b05112a1f6f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18901: [QA Follow-up] Do not translate zzpref either
Marcel de Rooy [Wed, 12 Jul 2017 11:33:51 +0000 (13:33 +0200)]
Bug 18901: [QA Follow-up] Do not translate zzpref either

Adding one backslash makes a difference :)
We need to escape the dot in the regex to exclude a file like zzpref
from translation too. Perfect_regexes++

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a2c9513b1c3449a34f942d8fa53f8ce1fe374e3f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18901: Sysprefs translation: translate only *.pref files (not *.pref*)
Julian Maurice [Thu, 6 Jul 2017 12:39:20 +0000 (14:39 +0200)]
Bug 18901: Sysprefs translation: translate only *.pref files (not *.pref*)

Text editors can create temporary files in this folder and this can
confuse the translator.
For instance, vim can create a file named '.opac.pref.swp' which will
make the translator dies with the following error message:

Can't use string ("b0VIM 8.0") as a HASH ref while "strict refs" in use
at LangInstaller.pm line 248.

Test plan:
1. echo 'Oops' > .../en/modules/admin/preferences/whatever.pref.whatever
2. cd misc/translator && ./translate update fr-FR
3. Verify that you have the error message mentioned above
4. Apply patch
5. cd misc/translator && ./translate update fr-FR
6. No more errors!

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ec51335e9cc4e090ef80f592cc0cc7a0786661f8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18748: Noisy t/db_dependent/AuthorisedValues.t
Mark Tompsett [Wed, 7 Jun 2017 16:53:52 +0000 (12:53 -0400)]
Bug 18748: Noisy t/db_dependent/AuthorisedValues.t

This noise is from a failure. This patch expands the delete
to 952$c for the ACQ framework as per comment #5.

TEST PLAN
---------

insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian, libopac, repeatable, mandatory, kohafield,tab,authorised_value,authtypecode,value_builder,isurl,hidden,frameworkcode,seealso,link,defaultvalue,maxlength) values (952,'c','Shelving location','Shelving location',0,0,'items.location',10,'LOC','','',0,0,'ACQ','','',null,9999);
-- this makes sure you have a pre-existing 952$c ACQ record.

prove t/db_dependent/AuthorisedValues.t
-- should have ugly message like in comment #0
apply patch
prove t/db_dependent/AuthorisedValues.t
-- should be green
run koha qa test tools

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 441f6fac33975f7e0f7c96b262bc0c0ee3b0c82e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoRevert "Bug 18938: (bug 17829 follow-up) Replace 2 occurrences of GetMember left...
Fridolin Somers [Tue, 18 Jul 2017 14:38:23 +0000 (16:38 +0200)]
Revert "Bug 18938: (bug 17829 follow-up) Replace 2 occurrences of GetMember left behind"

This reverts commit 8af64fe6128d20917ca413613ce387a3ef196632.

6 years agoBug 18938: (bug 17829 follow-up) Replace 2 occurrences of GetMember left behind
Jonathan Druart [Fri, 14 Jul 2017 15:19:13 +0000 (12:19 -0300)]
Bug 18938: (bug 17829 follow-up) Replace 2 occurrences of GetMember left behind

Between patch submission and push, 2 new occurrences appeared in the
codebase.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2f1a1fc4b96a91fc054646f91643d8ff46456055)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18880: [QA Follow-up] Finishing touch
Marcel de Rooy [Fri, 14 Jul 2017 06:07:31 +0000 (08:07 +0200)]
Bug 18880: [QA Follow-up] Finishing touch

Do not fill @return if retval == -1 for LDAP (see cfc484b17).
No need to call store after an DBIx update. Rearranged the if statement.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 313e1f2f271bad995f33db6884b553efe79e9438)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18880: Fix authentication fallback for external authentications
Jonathan Druart [Tue, 11 Jul 2017 15:24:36 +0000 (12:24 -0300)]
Bug 18880: Fix authentication fallback for external authentications

A regression in commit cfc484b17 / bug #18314 breaks the local
authentication fallback for all external authentications like LDAP, CAS
and Shibboleth.

The regression itself is a logical error as "@return = (0)" is
considered to be "false" when checked with "unless" (line 1814). That's
wrong as "unless" tests the number of elements in a list.

This patch tries to simplify the logic by adding a $passwd_ok and
$check_internal_as_fallback flags to be more verbose and hopefully more
understandable.
The goal here is simply to restore back the same logic as before cfc484b17

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d852b332666da212f1ab8667fa044b16eb151717)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18854: Protect few other occurrences of offset
Jonathan Druart [Mon, 10 Jul 2017 14:56:46 +0000 (11:56 -0300)]
Bug 18854: Protect few other occurrences of offset

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9f47bd88252e201f9f06fd734dae154d9bc41543)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18854: Make sure offset will not be < 0 - protect from DoS
Jonathan Druart [Wed, 5 Jul 2017 13:44:55 +0000 (10:44 -0300)]
Bug 18854: Make sure offset will not be < 0 - protect from DoS

There was a bug that meant a very large offset in the search params
will cause the search script to run forever (or long enough to crash
the machine)

To test

1/ Get ready with sudo top so you can kill the thread before it causes
your machine to OOM
2/ Hit a page like yourdomain.com/cgi-bin/koha/opac-search.pl?q=1&offset=-9999999999999999999
3/ Notice the process runs for a long time
4/ Kill the process
5/ Apply the patch
6/ Hit the page again, notice the it loads (offset is set to zero)
7/ Do the same to search in the staff client

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit aabf001232fc46ee04cecb3a43fe8c0366a091df)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18854 - Protect from DOS
Chris Cormack [Sun, 25 Jun 2017 05:34:12 +0000 (17:34 +1200)]
Bug 18854 - Protect from DOS

There was a bug that meant a very large offset in the search params
will cause the search script to run forever (or long enough to crash
the machine)

To test

1/ Get ready with sudo top so you can kill the thread before it causes
your machine to OOM
2/ Hit a page like yourdomain.com/cgi-bin/koha/opac-search.pl?q=1&offset=-9999999999999999999
3/ Notice the process runs for a long time
4/ Kill the process
5/ Apply the patch
6/ Hit the page again, notice the it loads (offset is set to zero)
7/ Do the same to search in the staff client

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: changed -2 to 0 in opac-search.pl.
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 99b32717cd2596ce89a2d46b8cb4ddbba2dea5ad)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 17639 - Remove white filling inside of Koha logo
Owen Leonard [Tue, 6 Jun 2017 15:50:19 +0000 (15:50 +0000)]
Bug 17639 - Remove white filling inside of Koha logo

This patch modifies the Koha logo SVG file to remove the fill from two
letters. This patch also optimizes the file and converts the text object
to paths for better cross-platform portability.

To test you could:

- Open the file in an editor and confirm that the change is correct
  - or -
- Open the file in a browser and use the code inspector to add a
  background-color attribute to the top-level <svg> tag. The logo should
  appear transparent, with no white fills.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 068db9aaabb0694b4d12404bda16525efad0fde7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18934: Preventing warns in Admin -> SMS providers
Aleisha Amohia [Thu, 13 Jul 2017 05:16:53 +0000 (05:16 +0000)]
Bug 18934: Preventing warns in Admin -> SMS providers

This patch initialises the $op variable to prevent the warns

To test:
1) Go to admin -> sms providers
2) Notice warns in error log
3) Apply patch and refresh page
4) Notice warns are gone

Sponsored-by: Catalyst IT
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 88ab0ef5791d2b428399690c505ac42aba4616df)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18858: Prevent warn when deleting a borrower debarment
Aleisha Amohia [Tue, 27 Jun 2017 01:40:48 +0000 (01:40 +0000)]
Bug 18858: Prevent warn when deleting a borrower debarment

To test:
1) Look at intranet log
2) Go to delete a debarment on a borrower
3) Notice warn
4) Apply patch
5) Add a new debarment
6) Delete this debarment
7) Notice warn is gone

Sponsored-by: Catalyst IT
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7ed66a6c8ae1c3c824e496c2d312e23db1dd8e41)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18577: Add FIXME about the missing FK
Jonathan Druart [Mon, 10 Jul 2017 21:09:23 +0000 (18:09 -0300)]
Bug 18577: Add FIXME about the missing FK

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5d6813e0708a54a9113cd74cc6a2558c77b5fc33)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18577 - Importing a batch using a framework not fully set up causes and endless...
Nick Clemens [Fri, 23 Jun 2017 14:11:44 +0000 (14:11 +0000)]
Bug 18577 - Importing a batch using a framework not fully set up causes and endless loop

To test:
1 - Create a new framework - don't set it up
2 - Stage some records for import
3 - Manage the import, note your new framwork is in the list
4 - Apply patch
5 - Reload the page
6 - Note the framework is no longer an option

Followed test plan,  worked as intended
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 96b1f92ae218bc889d1490385f934deec28f630a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18633: Remove remaining use of CGI.param in template
Julian Maurice [Mon, 12 Jun 2017 07:18:30 +0000 (09:18 +0200)]
Bug 18633: Remove remaining use of CGI.param in template

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2f7bad7039137fe1b3263cbaded1ce68f8daba04)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18633: Remove useless use of CGI TT plugin
Julian Maurice [Wed, 28 Jun 2017 17:05:42 +0000 (13:05 -0400)]
Bug 18633: Remove useless use of CGI TT plugin

The form is sent using AJAX so there is never a query string in
the URL (no POST parameters either)

Tested both patches together, item search behaves as before, log
entries are gone
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a000d95a4d322607eccdbf08abc94dd78d4e5617)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18830: Fix phrasing of screen message
Colin Campbell [Tue, 20 Jun 2017 15:35:35 +0000 (16:35 +0100)]
Bug 18830: Fix phrasing of screen message

Verb should be plural in this message

Signed-off-by: Israelex A Veleña for KohaCon17 <israelex19@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8a0ecda6c4ff368b9ff7a18593d7bdf4fc07e541)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18824: Remove stray i from matching-rules.tt
Marc Véron [Mon, 19 Jun 2017 19:23:54 +0000 (21:23 +0200)]
Bug 18824: Remove stray i from matching-rules.tt

The file
koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt
contains a stray i that should not be there.
This patch removes it.

Signed-off-by: Chris Kirby <chris.kirby@ilsleypubliclibrary.org>
Applied patch.
Checked line 516. Stray i had been removed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ce176fd170227456fa725e5f1f2f6b1b04fd044d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18848: borrowers.lastseen comment typo
Lee Jamison [Thu, 22 Jun 2017 16:42:15 +0000 (16:42 +0000)]
Bug 18848: borrowers.lastseen comment typo

Typo in comment for the lastseen column in the borrowers table.

To test:
1. Verify lastseen column displays "last time a patron has been seed"
2. Apply patch
3. Verify lastseen column changed to "last time a patron has been seen"

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e3bf4fc8bb821456305d587a8d49fe39b07abd06)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18848: borrowers.lastseen comment typo
Lee Jamison [Thu, 22 Jun 2017 16:42:15 +0000 (16:42 +0000)]
Bug 18848: borrowers.lastseen comment typo

Typo in comment for the lastseen column in the borrowers table.

To test:
1. Verify lastseen column displays "last time a patron has been seed"
2. Apply patch
3. Verify lastseen column changed to "last time a patron has been seen"

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 23b84c0b6532d9c42894b648891d835e7624db49)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18881: [QA Follow-up] Remove even more
Marcel de Rooy [Mon, 3 Jul 2017 07:31:52 +0000 (09:31 +0200)]
Bug 18881: [QA Follow-up] Remove even more

Removing the commented section from the template: If it does not work, it should not be here.
When it works again, put it back in.

Since @itemtypesloop is not used, remove it from the script too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e48a5fb560123bac31e9a692026601ddd320f966)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18881: Remove dead code from view_holdsqueue.pl
Marc Véron [Fri, 30 Jun 2017 18:20:44 +0000 (20:20 +0200)]
Bug 18881: Remove dead code from view_holdsqueue.pl

Aleisha spotted the typo in $itemtypes and proposed a correction on bug 18859.
The description was not even used. Template calls GetDescription.

To test:
Verify that viewing the holds queue still works as expected.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f40c093c19e21c6a8aa7a41d4e51fc4e3fc1d8e9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 14572 - insert_single_holiday() forces a value on an AUTO_INCREMENT column, durin...
Rodrigo Santellan [Wed, 21 Jun 2017 18:40:43 +0000 (15:40 -0300)]
Bug 14572 - insert_single_holiday() forces a value on an AUTO_INCREMENT column, during an INSERT

Removing all the id from the columns on the inserts and removing the
parameter '' of the values for the id.

Test plan:
1) Go to tools -> calendar
2) Add a Holiday only on this day.
3) Add a Holiday repeated every same day of the week.
4) Add a Holiday repeated yearly on the same date.
5) Add a Holidays on a range.
6) Add a Holidays repeated yearly on a range.
7) You should have the five calendars displayed.

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b94b16f67963b03fd17170d2c2f2efa581c12c0f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18755: Allow empty passwords in Patron Info to return OK
Colin Campbell [Thu, 8 Jun 2017 11:59:55 +0000 (12:59 +0100)]
Bug 18755: Allow empty passwords in Patron Info to return OK

With this patch a parameter 'allow_empty_passwords="1" can be added to a
login in the SIP configuration file to allow the behaviour as was normal
before the patch for bug 16610 was applied. Some sip clients rely on
this behaviour sending an empty password field when they wish to
validate to user but do not have the password.
If a password is supplied it will be validated

A test has been added to Message.t to confirm this behaviour

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>
(cherry picked from commit ebb887e5c93c96c6fc51d95b76de6a221ba4463e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18771: CGI.pm: Subroutine multi_param redefined
Mark Tompsett [Fri, 9 Jun 2017 17:01:14 +0000 (13:01 -0400)]
Bug 18771: CGI.pm: Subroutine multi_param redefined

The commands in the test plan are examples, and may need varying
depending on your installation. This was created as a result
of attempting to clean the installation process up. However,
I believe the redefine might exist normally too. I just didn't
check. This is tested on a Debian 8 box sudo apt-get update'd
fully.

TEST PLAN
---------
empty error log
$ echo > ~/koha-dev/var/log/koha-error_log

drop and recreate and empty db
> drop database koha_library;
> create database koha_library;
> quit

run the web installer, but DO NOT LOG IN!
*opening chrome to Staff Client URL*

check the error log
$ less ~/koha-dev/var/log/koha-error_log
...
[Fri Jun 09 13:08:52.793627 2017] [cgi:error] [pid 5802] [client 192.168.71.101:58169] AH01215: [Fri Jun  9 13:08:52 2017] CGI.pm: Subroutine multi_param redefined at /usr/share/perl5/CGI.pm line 419.
...

apply patch

empty error log
$ echo > ~/koha-dev/var/log/koha-error_log

refresh the installation login page

recheck the error log
$ less ~/koha-dev/var/log/koha-error_log

notice no reference to "Subroutine multi_param redefined"

run koha qa test tools

Notice that it is just a require CGI; and comment added.

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d222da0602ba96f08cc6c026f39451b0aa7de01e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18634: Handle colliding translation for preference sections
Marcel de Rooy [Wed, 14 Jun 2017 13:37:55 +0000 (15:37 +0200)]
Bug 18634: Handle colliding translation for preference sections

Problem on this report was caused by translating the tabs Privacy
and Payments by the same string. This caused overwriting a hash entry.

This patch tests if the key already exists and if so, it merges the
entries instead of overwriting the old contents.

Test plan:
[1] Make sure that e.g. Privacy and Payments translate to e.g Vie privee.
[2] Run translate install fr-CA (or the language you altered)
[3] Without this patch you should loose preferences from either Privacy or
    Payments. With this patch, they should be merged.

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

Signed-off-by: Blou <philippe.blouin@inlibro.com>
Reset the .po files, reproduced the problem.  Applied the patch and suddenly 'paypal' appeared.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0d98089ec701bc96893e68408ce2dedad36f7235)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18434 - Followup fix tests for sorting and factes
Nick Clemens [Mon, 3 Jul 2017 09:42:21 +0000 (09:42 +0000)]
Bug 18434 - Followup fix tests for sorting and factes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 540d488e980b2521b424bed0f0267002c6dbd03e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18434 - Followup - same changes for sort and facet fields
Nick Clemens [Fri, 16 Jun 2017 14:01:12 +0000 (10:01 -0400)]
Bug 18434 - Followup - same changes for sort and facet fields

To test:
1 - Index some stuff with multiple fields defined for sorting
  i.e. Authorites - make heading sortable - default is 110a and 111a for
  heading - a record with 111a empty will make the sort field empty
2 - view the record:
curl http://localhost:9200/koha_kohadev_authorities/data/30?pretty=true
3 - Note the blank field
4 - Apply patch
5 - Reindex
6 - Fields should be correctly populated

Unit tests to follow (once I have the originals working for all)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 241be8ff1ae24fff6165c8d6877945637467ee9a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18434: (QA followup) Move _convert_marc_to_json tests into Indexer.t
Tomas Cohen Arazi [Mon, 15 May 2017 14:46:00 +0000 (11:46 -0300)]
Bug 18434: (QA followup) Move _convert_marc_to_json tests into Indexer.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3b5529c3abca87afb4f66f5bc7d3aa0fe005c1aa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18434: Elasticsearch indexing broken with newer catmandu version
Nick Clemens [Fri, 14 Apr 2017 14:03:11 +0000 (10:03 -0400)]
Bug 18434: Elasticsearch indexing broken with newer catmandu version

To test:
1 - Make sure you have latest koha deps, catmandu versions should be:
    libcatmandu-marc-perl   1.09-1~kohadev1
    libcatmandu-perl        1.0304-2~kohadev1
2 - Reindex elastic
3 - Try searching and likely notice odd results
4 - Try:
curl -XGET
'http://localhost:9200/koha_kohadev_biblios/data/792?pretty=true'
with a known biblionumber and notice some null fields
5 - Apply patch
6 - Reindex
7 - Note fields are populated and search works as expected

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9eb88f588bd13ddf25135c26acd905abe71f326a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18434: Add tests for K:SE:E::get_fixer_rules
Tomas Cohen Arazi [Fri, 12 May 2017 18:39:25 +0000 (15:39 -0300)]
Bug 18434: Add tests for K:SE:E::get_fixer_rules

This patch tries to introduce exhaustive tests for this class method.
I didn't try to provide a regression test for the current bug per-se, but
cover the current method behaviour as much as I could.

(kidclamp) I added a quick test of _convert_marc_to_json to use the mocking here
and illuminate what the change does, before the patches this should
fail (fields are indexed in place of one another), after it should succeed (new indexed fields are appended).

A minor bug is highlighted by this new tests, I'll provide a followup for it.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ de kohaclone
 k$ prove t/db_dependent/Koha_Elasticsearch.t
=> FAIL: The returned fixer rules are not the expected ones

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2d19a34529bc313922a085a99288e55d8634c8b6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18756: Users can view aq.baskets even if they are not allowed
Christophe Croullebois [Thu, 8 Jun 2017 13:17:56 +0000 (13:17 +0000)]
Bug 18756: Users can view aq.baskets even if they are not allowed

Due to bad use of grep syntax if there is one or more Basket Users the result of grep is not equal to 0 and the borrower is allowed.

Test plan :
1- select system preference 'AcqViewBaskets' on 'user'
2- create 2 borrowers (A, B) with only permissions on acquisition :
group_manage
order_manage
order_receive
staff
3- login with A and create a basket
4- add a basquet manager other than B
5- relog with account B
6- you can see the basket

Apply the patch.
The basket is no longer visible.
1- relog with A
2- add basquet manager B
3- relog with B
5- you must see the basket

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0c09adbfc87b950b9f08aebede131ba694997290)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18756 - add Unit Test
Fridolin Somers [Wed, 14 Jun 2017 10:33:25 +0000 (12:33 +0200)]
Bug 18756 - add Unit Test

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8b15c064405ff4a48cb3f5803dd6bd16d49d5b9b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18870: Force scalar context for Koha::Club methods
Jonathan Druart [Wed, 5 Jul 2017 23:03:24 +0000 (20:03 -0300)]
Bug 18870: Force scalar context for Koha::Club methods

These 2 methods are called from the template in list context.
However since bug 18539 Koha::Objects->find can no longer be called in
list context.
Forcing the context to scalar fixes the problem and should not
introduced side-effects.

Test plan:
- Create a club template
- Create a club using this template
=> Without this patch you should no longer get the following error:
Template process failed: undef error - Cannot use "->find" in list
context at /home/vagrant/kohaclone/Koha/Club.pm line 51.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a81947782bb884feccd5401499f1a6e8f469b0b0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18782: Remove unused C4::Serials::getsupplierbyserialid
Julian Maurice [Mon, 12 Jun 2017 10:28:31 +0000 (12:28 +0200)]
Bug 18782: Remove unused C4::Serials::getsupplierbyserialid

TEST PLAN
----------
git grep -i getsupplierby
-- only the code removed and the test tweaked
git bz apply 18782
sudo koha-shell -c bash kohadev
prove -v t/db_dependent/Serials.t
qa -v 2 c 1
exit
-- sign off

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit c69e02c4419a2d4a7ca31af6441081cadd4e51b3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18214: Add check for shared or public list
Marcel de Rooy [Thu, 22 Jun 2017 06:55:16 +0000 (08:55 +0200)]
Bug 18214: Add check for shared or public list

Following the idea behind bug 10865, we are only showing the permissions
when the list is shared or public.
Adding a simple test in opac-shelves here.

Note 1: Since the owner can always add or delete entries, the permissions
will not be relevant anymore for a strictly private list.

Note 2: Staff view always shows the permissions. This could have been
changed here too, but that change is far less urgent (bug 10865 did not
touch staff view and bug 18228 will rearrange permissions anyway).

Test plan:
[1] Verify on OPAC that you see the permissions for a private list with
    shares or a public list. And you do not see them for a private list
    without shares.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit b494837c8d17a29936e2c2bcc067120c26876855)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
6 years agoBug 18214: Cannot edit list permissions of a private list
Marcel de Rooy [Mon, 6 Mar 2017 08:44:48 +0000 (09:44 +0100)]
Bug 18214: Cannot edit list permissions of a private list

If you have disabled the pref OpacAllowPublicListCreation, your users are
not able to edit the list permissions for private/shared lists.
For a private list they may only be theoretically relevant, but for a shared
list they are relevant.
Since we do not always know the history of a list (has it been public or
shared, does it contains entries from other users) and therefore permissions
are even relevant for a currently private list, we should just allow editing
these permissions.

Test plan:
[1] Do not yet apply this patch.
[2] Disable OpacAllowPublicListCreation.
[3] Create a private list in OPAC. Edit the list. Verify that you do not
    see the permission combo boxes.
[4] Apply this patch. Edit the list again. Do they appear now?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.

(cherry picked from commit 3d2eddaf3da3e090d00b4e5823f8f70a70c06ea1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 years agoUpdate mailmap - Jonathan Druart
Jonathan Druart [Wed, 21 Jun 2017 15:41:22 +0000 (12:41 -0300)]
Update mailmap - Jonathan Druart

I do not longer work at biblibre

(cherry picked from commit 2702b4688e31e62fb6851b7979dc56011d38ce89)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 years agoBug 18800: Patron card images: Add some more explanation to upload page and fix small...
Marc Véron [Wed, 14 Jun 2017 09:10:56 +0000 (11:10 +0200)]
Bug 18800: Patron card images: Add some more explanation to upload page and fix small translatabiity issue

The file
koha-tmpl/intranet-tmpl/prog/en/modules/help/patroncards/image-manage.tt
has a small translatability issue (sentence splitting by html tags).

This patch fixes it and adds a little bit more explanation about
uploading, using and replacing such images.

To test:
- Verify that text changes make sense
- Apply patch
- Go to Home > Tools > Patron card creator > Images and verify
  that the page displays properly

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 053fbaf9267cce79ba80d23389b26f46a91111f8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 years agoBug 18697: Final polishing
Marcel de Rooy [Wed, 31 May 2017 14:19:35 +0000 (16:19 +0200)]
Bug 18697: Final polishing

GetFictiveIssueNumber:
Returns undef instead of 0 for irregular frequencies. Also added to POD.
Removed unused variable $wkno.
Adding a return makes the if(unit) unneeded.
Replaced (a+b)/b by 1+a/b.

_delta_units:
Added a comment about its parameters.

GetFictiveIssueNumber.t:
Adjusted the tests for irregular frequencies accordingly.

Test plan:
[1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t
[2] Run t/db_dependent/Serials/GetNextDate.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4e9701c36a6743eff72b8127de2cc79ff463013b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 years agoBug 18697: Adjusting unit tests for dayly serial frequencies
Marcel de Rooy [Wed, 31 May 2017 13:20:40 +0000 (15:20 +0200)]
Bug 18697: Adjusting unit tests for dayly serial frequencies

No changes were needed for GetNextDate.t.
In GetFictiveIssueNumber.t we add a subtest for daily frequencies.

Test plan:
[1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8eae9660839750d95c53f6cc2a4287a6196f0cc6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 years agoBug 18697: Fix date calculation for dayly frequencies in Serials
Marcel de Rooy [Tue, 30 May 2017 14:44:46 +0000 (16:44 +0200)]
Bug 18697: Fix date calculation for dayly frequencies in Serials

The changes in _get_next_date_day are actually only cosmetic. The sub
now reads exactly the same as its counterparts for other units, but
the results are exactly the same as before.

In GetFictiveIssueNumber we now call _delta_units for each type of unit.
The two Delta_Days calls are moved to _delta_units. Note that this also
is a cosmetic change; results should be exactly the same.

Test plan:
[1] Edit a subscription. Test predication pattern for some daily freq.
[2] Run t/db_dependent/GetNextDate.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f65ca90b0f3d12a22c02918a37131b0c1ff8bd5e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
7 years agoBug 18697: Adjusting unit tests for weekly serial frequencies
Marcel de Rooy [Tue, 30 May 2017 13:56:22 +0000 (15:56 +0200)]
Bug 18697: Adjusting unit tests for weekly serial frequencies

Corrections and added unit tests following the changes of the first patch.

GetFictiveIssueNumber.t: New subtest for weekly frequencies.

GetNextDate.t: Correcting a few dates one day. If we use 2/week, we will
calculate an interval of 3 days and correct with 4 days at the end of
the cycle. The connection with firstacqui is not relevant anymore.

Test plan:
[1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t
[2] Run t/db_dependent/Serials/GetNextDate.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e25f4670f36e53db44931cbbcfb3c5df2125c71a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>