koha.git
7 years agoBug 17486: [QA Follow-up] Changes as to set_userenv
Marcel de Rooy [Fri, 6 Jan 2017 07:58:20 +0000 (08:58 +0100)]
Bug 17486: [QA Follow-up] Changes as to set_userenv

Add shibboleth parameter to POD of set_userenv.
Removed a 12th set_userenv parameter from Borrower_Discharge.t.
Replaced set_userenv call in PatronLists.t looking like a fortunate typo.

Test plan:
Run the two corrected tests.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17486: Remove Mozilla Persona
Jonathan Druart [Wed, 14 Dec 2016 17:30:43 +0000 (18:30 +0100)]
Bug 17486: Remove Mozilla Persona

Persona never really took off, and although many browsers currently
support it, very few services actually implement it.

This has lead to it's founders, Mozilla, to end the project. In their
own words:

=============================================================================
Persona is no longer actively developed by Mozilla. Mozilla has
committed to operational and security support of the persona.org
services until November 30th, 2016.

On November 30th, 2016, Mozilla will shut down the persona.org services.
Persona.org and related domains will be taken offline.

If you run a website that relies on Persona, you need to implement an
alternative login solution for your users before this date.

For more information, see this guide to migrating your site away from
Persona:

https://wiki.mozilla.org/Identity/Persona_Shutdown_Guidelines_for_Reliers

=============================================================================

Given the above, and that the Persona authentication methods as a whole
are no longer being actively maintained by anyone anywhere to ensure
ongoing security, we should deprecate the option from koha.

Test plan:
Apply this patch and make sure you do not find any references of Persona
Have a look at patches from bug 9587 and confirm that everything has
been reverted

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Code looks good to me.
Also ran several tests including: Auth.t, Auth_with_shibboleth.t.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17466 [QA Followup] - Give the link some style
Kyle M Hall [Fri, 30 Dec 2016 18:30:46 +0000 (18:30 +0000)]
Bug 17466 [QA Followup] - Give the link some style

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17466: Followup, change button to link and fix terminology
Josef Moravec [Wed, 7 Dec 2016 11:23:47 +0000 (11:23 +0000)]
Bug 17466: Followup, change button to link and fix terminology

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17466: Show number of outstanding issues when checking in
Josef Moravec [Wed, 19 Oct 2016 10:55:55 +0000 (10:55 +0000)]
Bug 17466: Show number of outstanding issues when checking in

Test plan:
1) Apply patch
2) Checkout more then one item to a borrower
3) Check one of that items
4) Note, that on in returns table there is a button with number of
outstanding issues in patron column. The button should take you to checking
out page
5) When the outstanding issues count is 0, there is no button

Signed-off-by: Radek Šiman <rbit@rbit.cz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17181: Simplify code
Jonathan Druart [Wed, 11 Jan 2017 21:37:33 +0000 (22:37 +0100)]
Bug 17181: Simplify code

- do not prepare statement when used only once
- remove use of Data::Dumper
- remove $duplicate, not needed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17181: Check for duplicate image names when uploading image to patron card creator
Aleisha Amohia [Wed, 11 Jan 2017 00:40:31 +0000 (00:40 +0000)]
Bug 17181: Check for duplicate image names when uploading image to patron card creator

This patch adds a check for duplicates before uploading the image.

To test:
1) Go to Tools -> Patron card creator -> Manage images
2) If you haven't already, upload an image
3) Try to upload another image with the same image name
4) Notice the first image is replaced with the second image, with no
warning.
5) Apply patch and refresh page
6) Try to upload an image with the same image name again
7) Notice you are now warned about a duplicate image name.
8) Check that uploading an image with a unique name still works.

Sponsored-by: Catalyst IT
Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14187 - DBRev 16.12.00.002
Kyle M Hall [Fri, 13 Jan 2017 12:24:39 +0000 (12:24 +0000)]
Bug 14187 - DBRev 16.12.00.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14187: (QA followup) Properly check DB structure before altering it
Tomas Cohen Arazi [Thu, 12 Jan 2017 15:42:05 +0000 (12:42 -0300)]
Bug 14187: (QA followup) Properly check DB structure before altering it

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14187: branchtransfer needs a primary key (id) for DBIx and common sense.
Olli-Antti Kivilahti [Tue, 12 May 2015 07:19:05 +0000 (10:19 +0300)]
Bug 14187: branchtransfer needs a primary key (id) for DBIx and common sense.

* C4/Circulation.pm (GetTransfers, GetTransfersFromTo): Also return
  branchtransfer_id in return columns.
* installer/data/mysql/atomicupdate/14187.perl: New file.
* installer/data/mysql/kohastructure.sql: Modify branchtransfers structure.
* t/db_dependent/Circulation/transfers.t: Update tests to expect
  branchtransfer_id.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Test plan successful on all steps.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended patch: Remove Schema changes from this patch
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 16083: [QA FOLLOWUP] Add more cli arguments.
Alex Sassmannshausen [Thu, 5 Jan 2017 16:12:59 +0000 (17:12 +0100)]
Bug 16083: [QA FOLLOWUP] Add more cli arguments.

* Makefile.PL: Add `zebra_sru_host`, `zebra_sru_biblios_port` &
  `zebra_sru_authorities_port` as possible command line arguments.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 16083 Allow cli overrides for makefile settings.
Alex Sassmannshausen [Wed, 16 Mar 2016 16:04:48 +0000 (17:04 +0100)]
Bug 16083 Allow cli overrides for makefile settings.

Currently the Makefile.pl script only accepts the '--prev-install-log' commandline flag for reading Koha configuration values from the previous installation.

The Makefile does not have help output.

The aim of this bug report is to add 2 things:
- --help output
- commandline parameters that should allow automating many of the common settings if desired
- when commandline parameters are not passed we simply fall back to the interactive method of old

Test Plan:

- Run the Makefile without parameters — the script should work as before.
- Run the script with the '-h' flag — it should output help.
- Run the script with any number of additional legal flags — the script should skip those questions in its interactive mode.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Reworked the log message with Bugzilla comments.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: perltidy GetOptions block

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 6782 [QA Followup] - Remove unused param and limit calls to Koha.Preference
Kyle M Hall [Fri, 30 Dec 2016 18:42:37 +0000 (18:42 +0000)]
Bug 6782 [QA Followup] - Remove unused param and limit calls to Koha.Preference

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 6782 - Move auto member cardnumber generation to occur when record is "Saved...
Meenakshi.R [Wed, 6 Jun 2012 11:16:15 +0000 (16:46 +0530)]
Bug 6782 - Move auto member cardnumber generation to occur when record is "Saved" (avoid collisions).

Currently the card number is generated when the user enters the patron creation form. This creates a problem of concurrency - when two or more simulataneous users are registering members, the error "card no. in use" can occur.

This change moves the card number generation to occur after the "Save" button is pressed.

Changes:
-C4/Members.pm:
Added code to fixup_cardnumber,If the cardnumber is blank and "autoMemberNum" ON.
-koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt:
Added code to display "leave blank for auto calc during registration" in cardnumber label in patron registration form only if "autoMemberNum" ON.
-members/memberentry.pl:
Added code to get weather or not "autoMemberNum" is on or off and removed fixup_cardnumber generation.

Test cases:
-If "autoMemberNum" ON:
->In blank case, must generate auto card number in simulataneous users.
->If user entered, check for unique card number.

-If "autoMemberNum" OFF:
Must work normal.

Followed test plan, works as expected.
Note: Syspref PorrowerMandatoryField must not include cardnumber, otherwise
      you can not save. Maybe that should be mentioned in the comment for
      syspref autoMemberNum.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17879: Use image filename if no image name is entered
Aleisha Amohia [Tue, 10 Jan 2017 22:20:40 +0000 (22:20 +0000)]
Bug 17879: Use image filename if no image name is entered

This patch changes the code to use the filename of the uploaded image if
no specific image name is entered.

To test:
1) Go to Tools -> Patron card creator -> Manage images
2) Upload an image and leave the image name field empty
3) Notice this works and 'Name' is left empty.
4) Apply patch and refresh page
5) Upload an image and leave the image name field empty
6) Notice the image name is given the filename so that 'Name' is no
longer empty.

Sponsored-by: Catalyst IT
Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17859 - Move JavaScript to the footer on about and auth pages
Owen Leonard [Fri, 6 Jan 2017 16:12:25 +0000 (16:12 +0000)]
Bug 17859 - Move JavaScript to the footer on about and auth pages

This patch modifies the about page and the login page templates so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test each page to confirm that
JavaScript-based interactions are unaffected:

- On the About page tabs and header menu dropdowns should work correctly

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17800: Add admin sidebar menu to marc-subfields-structure.pl
Aleisha Amohia [Wed, 21 Dec 2016 02:59:44 +0000 (02:59 +0000)]
Bug 17800: Add admin sidebar menu to marc-subfields-structure.pl

Adding to marc-subfields-structure because auth-subfields-structure has
it, so I assume it was just missed when the admin-menu was added.

To test:
1) Go to admin -> MARC bibliographic frameworks -> Actions for any
framework -> MARC structure -> Actions for any tag -> Subfields
2) Notice no admin-menu on the side
3) Apply patch and refresh page
4) Notice admin-menu now shows

Note: the link in the sidebar menu for MARC bibliographic frameworks
does not show as active (bold) from this page. This is fixed in Bug
17794

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17741: Use Koha::Patron->holds when deleting a patron
Jonathan Druart [Wed, 7 Dec 2016 03:21:43 +0000 (03:21 +0000)]
Bug 17741: Use Koha::Patron->holds when deleting a patron

There is a TODO in Koha::Patron->delete, this method should call the
Koha::Patron->holds to retrieve the holds made by the patron we are
removing instead of calling Koha::Holds->search

Test plan:
  prove t/db_dependent/Koha/Patrons.t
Should return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17740: Add the Koha::Patron->holds method
Jonathan Druart [Wed, 7 Dec 2016 13:42:41 +0000 (14:42 +0100)]
Bug 17740: Add the Koha::Patron->holds method

The goal of this method is to replace
C4::Reserves::GetReservesFromBorrowernumber but could be reused for
something else, that's why it has its own bug report.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Rebased. Edited two test descriptions.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17447: %opt is unused
Mark Tompsett [Fri, 30 Dec 2016 15:12:24 +0000 (10:12 -0500)]
Bug 17447: %opt is unused

Deleted the line.
perlcritic -4 before and after.
Before there are issues. After there is not.

Also, changed function to not rely on implicit return value
of last line, but explicitly stated a return. And operator
changed, due to precedence issues.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17447: Remove unused vars from batchRebuildItemsTables.pl
Marcel de Rooy [Fri, 14 Oct 2016 12:27:15 +0000 (14:27 +0200)]
Bug 17447: Remove unused vars from batchRebuildItemsTables.pl

Variables $extkey not used, %opt not used.
Variables $tmptest[...] not used, calling _build_tag_directory useless.
The script now does not only print help if you specify -t.
Sub defnonull tidied.
Rearranged modules, removed Dumper.

Test plan:
[1] Run the script with -t flag. The script should not only print usage
    statement, but should do a dry run. (Test this on a small database,
    or pass an additional where clause.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17447: Run perltidy on batchRebuildItemsTables.pl
Marcel de Rooy [Fri, 30 Dec 2016 10:01:36 +0000 (11:01 +0100)]
Bug 17447: Run perltidy on batchRebuildItemsTables.pl

Test plan:
Verify that the output of diff -w between the original and tidied file
does not introduce code changes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17794: Menu items in Tools menu and Admin menu not showing bold when active but...
Aleisha Amohia [Wed, 21 Dec 2016 02:27:46 +0000 (02:27 +0000)]
Bug 17794: Menu items in Tools menu and Admin menu not showing bold when active but not on linked page

To reproduce:
admin-menu
1) Go to a page like admin/categories.pl
2) Click New Category
3) Notice Patron categories in the sidebar menu is no longer bold
tools-menu
4) Go to a page like reviews/reviewswaiting.pl
5) Notice bold Comments in sidebar menu
6) Click Approved Comments tab
7) Notice no longer bold in sidebar menu
To test:
8) Apply patch and refresh page
9) Follow above steps to reproduce bug, confirm that active links are
always bold
10) Test with other links to confirm nothing has broken
Special cases
11) Go To admin -> MARC bibliographic frameworks -> Actions for any
framework -> MARC structure
12) Confirm sidebar menu link is still bold
13) Go to admin -> Authority types -> Actions for any auth type -> MARC
structure
14) Confirm sidebar menu link is still bold
15) Click Actions for any tag -> Subfields
16) Confirm sidebar menu link is still bold
17) Go to admin -> OAI sets config -> Actions for any set -> Define
mappings
18) Confirm sidebar menu link is still bold

Sponsored-by: Catalyst IT
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17778: Simplify fetch date
Jonathan Druart [Tue, 10 Jan 2017 14:52:57 +0000 (15:52 +0100)]
Bug 17778: Simplify fetch date

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17778 - Make "Earliest Registered Date" in OAI dynamic
Magnus Enger [Fri, 6 Jan 2017 14:27:04 +0000 (15:27 +0100)]
Bug 17778 - Make "Earliest Registered Date" in OAI dynamic

This was hardcoded to 0001-01-01.

To test:
- Make sure you have a couple of records, with different timestamps
- Enable OAI-PMH
- Check http://localhost:2201/cgi-bin/koha/oai.pl?verb=Identify
  and verify that "Earliest Registered Date" is 0001-01-01
- Apply the patch
- Re-check the "Earliest Registered Date" and verify that it is now
  the lowest timestamp in your biblio table
- Manipulate the timestamps and verify that "Earliest Registered Date"
  changes accordingly
- Sign off!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17265 - Make koha-create-defaults less greedy
Magnus Enger [Thu, 8 Sep 2016 12:13:46 +0000 (14:13 +0200)]
Bug 17265 - Make koha-create-defaults less greedy

koha-create-defaults substitutes the instance name with the placeholder
__KOHASITE__ in the SQL file that it creates. If the instance name is
something common, like "data", this means that way too many substitutions
will be made, and when koha-create uses the SQL file as a template, broken
data can be the result.

The solution in this patch was suggested by drojf on IRC.

To test:
- Create an instance called "data"
- Run "sudo koha-dump-defaults data > test.sql"
- Take a look at test.sql and verify there are way too many occurences
  of __KOHASITE__, like "-- Dumping __KOHASITE__ for table `accountlines`"
- Apply the patch
- Copy the resulting koha-create and koha-dump-defaults to somewhere
  running off the packages
- Run "sudo koha-dump-defaults data > test.sql" again and verify there
  are only 4 occurrences of __KOHASITE__, in places that make sense
- Create an instance with something like:
  $ gzip test.sql
  $ sudo koha-create --create-db --defaultsql test.sql.gz test17265
- Verify that you have a working Koha install

Signed-off-by: Andreas Roussos <arouss1980@gmail.com>
Works as expected.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17766 - Patron notification does not work with multi item holds
Benjamin Rokseth [Tue, 13 Dec 2016 13:57:52 +0000 (14:57 +0100)]
Bug 17766 - Patron notification does not work with multi item holds

This patch fixes notification when same biblio has multiple reserves with same borrower,
introduced in Bug 14695. C4::Reserves::ModReserveAffect uses internal method
_koha_notify_reserve but sends itemnumber and biblionumber instead of record_id.

To test:
Prerequisites:
- One biblio with two items attached
- A patron with hold_filled notification activated
- A letter for HOLD with <<reserves.reserve_id>> in it
1) Place two reservations on same biblio
2) checkin item x on pickup branch, observe patron message generated
3) checkin item y on pickup branch, observe patron message generated
4) note that reserve_id is the same on both messages, which is wrong
5) apply this patch and repeat 1-3
6) now observe notifications have correct (different) reserve_id

Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17870 - Call to include file incorrectly moved into the footer
Owen Leonard [Mon, 9 Jan 2017 17:39:01 +0000 (17:39 +0000)]
Bug 17870 - Call to include file incorrectly moved into the footer

This patch moves a line of template code from js_includes.inc back into
doc-head-close.inc where it belongs.

To test, apply the patch and view a page which uses a template that
depends on html_helpers.inc being processed. For example:

- The set library page
- The holds queue report
- The new patron form

The pages should work correctly.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17725: Same for textarea when cloning a field
Jonathan Druart [Wed, 11 Jan 2017 20:06:09 +0000 (21:06 +0100)]
Bug 17725: Same for textarea when cloning a field

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>
7 years agoBug 17725: Do not copy subfield's content when cloning
Jonathan Druart [Wed, 11 Jan 2017 12:39:47 +0000 (13:39 +0100)]
Bug 17725: Do not copy subfield's content when cloning

To replicate:
- Open an existing record in your catalog
- Create another field or subfield of a field/subfield already used using the icon to repeat it
- Verify that the content is copied over
- Verify this happens for input (one line) and textare (multiple lines)

I can't make this happen for when creating a new record, but more consistently on editing existing records.

This is rather annoying when cataloguing in Koha, as the cataloguer has to empty the field first and that adds an extra step for each repeated field.

Test plan:
Confirm than the content is not copied when you clone a field or a subfield.

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>
7 years agoBug 17817: (Follow up) Fix reordering subfields issues
Patricio Marrone [Wed, 11 Jan 2017 15:39:21 +0000 (12:39 -0300)]
Bug 17817: (Follow up) Fix reordering subfields issues

Authority controlled subfields have invisible divs which produced
a strange behavior when reordering (multiple clicks were needed
to push a subfield up over an authority controlled subfield)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17817: Fix cloning subfields using select2
Patricio Marrone [Tue, 10 Jan 2017 18:53:33 +0000 (15:53 -0300)]
Bug 17817: Fix cloning subfields using select2

Based on Jonathan's patch (the DO NOT PUSH one), I put together this fix.
What was changed is that select2 is reinitialized only after the cloned element
has been appended to the DOM (so that select2 can correctly calculate the field's
width). Also, I changed the selectors that searched for the line divs (for reordering)
and for the subfield's input element (for erasing the field's value) to be more specific,
since select2 introduced divs that broke some assumptions about the expected HTML structure

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
I confirm that these 2 patches fix the add item and mod biblio views as
well as the batch item modification tools.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15905 [QA Followup] - Fix bad syntax in pay()
Kyle M Hall [Thu, 12 Jan 2017 13:50:05 +0000 (13:50 +0000)]
Bug 15905 [QA Followup] - Fix bad syntax in pay()

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15905 - Remove use of makepayment
Kyle M Hall [Wed, 11 Jan 2017 14:57:36 +0000 (14:57 +0000)]
Bug 15905 - Remove use of makepayment

Test Plan:
1) Apply these patches
2) prove t/db_dependent/Accounts.t
3) 'git grep makepayment' should return no results

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15905 - Update unit tests
Kyle M Hall [Wed, 24 Feb 2016 16:10:48 +0000 (16:10 +0000)]
Bug 15905 - Update unit tests

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15907 - Remove use of makepayment in opac/opac-account-pay-paypal-return.pl
Kyle M Hall [Wed, 24 Feb 2016 15:56:52 +0000 (15:56 +0000)]
Bug 15907 - Remove use of makepayment in opac/opac-account-pay-paypal-return.pl

Test Plan:
1) Apply this patch
2) Make a payment via PayPal in sandbox mode
3) Note the payment succeeds

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Bug 15907 [QA Followup] - Simplify code and call pay() only once

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17234: Need to separate KEY and FOREIGN KEY checks
Jonathan Druart [Thu, 12 Jan 2017 09:44:46 +0000 (10:44 +0100)]
Bug 17234: Need to separate KEY and FOREIGN KEY checks

In the previous patch we use the constraint_exists subroutine to verify
if an index or a foreign key exists.
But the `SHOW INDEX` query does not return foreign keys (as its name
suggests!).
We need another subroutine foreign_key_exists to check the FK existence.

I have found that because t/db_dependent/TestBuilder.t fails on
oai_sets_biblios, because oai_sets_biblios_ibfk_1 has not been removed.

Test plan:
0/ Do not apply this patch
1/ Use a 3.20 DB
2/ update the DB
3/ SHOW CREATE TABLE oai_sets_biblios
will display oai_sets_biblios_ibfk_1

Apply the patch and repeat 1, 2, 3
=> Will not display oai_sets_biblios_ibfk_1
It has been removed as expected.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15908 - Remove use of recordpayment_selectaccts
Kyle M Hall [Wed, 24 Feb 2016 16:24:04 +0000 (16:24 +0000)]
Bug 15908 - Remove use of recordpayment_selectaccts

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Accounts.t
3) Test fine payment via the "Pay selected" button

Signed-off-by: Laura Slavin <lslavin@hmcpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15909 - Remove the use of makepartialpayment
Kyle M Hall [Wed, 24 Feb 2016 16:34:23 +0000 (16:34 +0000)]
Bug 15909 - Remove the use of makepartialpayment

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Accounts.t
3) Test fine payment via the "Pay" button,
   but make the payment for less then the full amount

Signed-off-by: Laura Slavin <lslavin@hmcpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15898 - Use Koha::Account::pay internally for makepartialpayment
Kyle M Hall [Wed, 24 Feb 2016 14:01:23 +0000 (14:01 +0000)]
Bug 15898 - Use Koha::Account::pay internally for makepartialpayment

This is the fourth patch in a series to unify all payment functions into
a single mathod

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Accounts.t
3) Test fine payment via the "Pay" button,
   but make the payment for less then the full amount

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15879: Add Tests
Jonathan Druart [Tue, 10 Jan 2017 20:52:07 +0000 (21:52 +0100)]
Bug 15879: Add Tests

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15879: Allow multiple plugin directories to be defined in koha-conf.xml
Kyle M Hall [Mon, 22 Feb 2016 14:25:18 +0000 (14:25 +0000)]
Bug 15879: Allow multiple plugin directories to be defined in koha-conf.xml

It would be very useful to be able to define multiple plugin directories
in the Koha conf file. This would allow for ease of plugin development
so that each plugin installed can live in its own git repository. For
compatibility, the first plugindir instance defined should be the one
used for uploading plugins via the web interface.

Test Plan:
1) Apply this patch
2) Define a second pluginsdir line in your koha-conf.xml
3) Clone the kitchen sink plugin to this new path like this:
   git clone https://github.com/bywatersolutions/koha-plugin-kitchen-sink.git /path/to/new/plugins/dir
4) Restart memcached if you are running it
5) The Kitchen Sink plugin should now appear in your list of plugins!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
I rebased it against master and tested it on a kohadevbox

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17234: Test the column and constraint non-existence
Jonathan Druart [Mon, 2 Jan 2017 10:36:53 +0000 (11:36 +0100)]
Bug 17234: Test the column and constraint non-existence

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17234: Two new functions lack tests
Mark Tompsett [Fri, 30 Dec 2016 19:08:33 +0000 (14:08 -0500)]
Bug 17234: Two new functions lack tests

This adds two tests to t/db_dependent/Installer.t

TEST PLAN
---------
1) Apply patch
2) prove -v t/db_dependent/Installer.t
   -- column and constraint tests were added.
3) run koha qa test tools

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17234: Move new subroutines to C4::Installer
Jonathan Druart [Tue, 27 Sep 2016 07:28:09 +0000 (08:28 +0100)]
Bug 17234: Move new subroutines to C4::Installer

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17234: Add constraint_exists and column_exists to updatedatabase.pl
Jonathan Druart [Tue, 20 Sep 2016 15:55:40 +0000 (16:55 +0100)]
Bug 17234: Add constraint_exists and column_exists to updatedatabase.pl

These 2 subroutines will help us deal with the absense of ALTER IGNORE
TABLE

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17234: Follow up to handle new problems
Mark Tompsett [Mon, 19 Sep 2016 18:27:14 +0000 (14:27 -0400)]
Bug 17234: Follow up to handle new problems

Bug 16276 added two more ALTER IGNORES. This removes them.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17234 - updatedatabase.pl's ALTER IGNORE break with mysql 5.7.4+
Blou [Fri, 2 Sep 2016 12:05:48 +0000 (08:05 -0400)]
Bug 17234 - updatedatabase.pl's ALTER IGNORE break with mysql 5.7.4+

The doc says: "As of MySQL 5.7.4, the IGNORE clause for ALTER TABLE is removed and its use produces an error."
This fix replaces ALTER IGNORE with ALTER in updatedatabase.pl

To TEST, try an upgrade from 3.18 to 3.22 after installing the latest mysql (at least 5.7.4, by the doc).
Some will fail with error

DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE TABLE aqbasket
            ADD KEY authorisedby (authorisedby)' at line 1 [for Statement "
        ALTER IGNORE TABLE aqbasket
            ADD KEY authorisedby (authorisedby)
    "] at ./installer/data/mysql/updatedatabase.pl line 10563.

0) Find a database on 3.18, save it.
1) Set your code base to 3.22(or master)
2) run updatedatabase.pl
3) See the errors.
4) Apply the patch
5) Reload the 3.18 database
6) succeed with updatedatabase.pl

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15897: Update ->pay POD
Jonathan Druart [Tue, 10 Jan 2017 09:21:23 +0000 (10:21 +0100)]
Bug 15897: Update ->pay POD

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15897 [QA Followup] - Update unit tests
Kyle M Hall [Mon, 9 Jan 2017 17:19:54 +0000 (17:19 +0000)]
Bug 15897 [QA Followup] - Update unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15897 - Folowup Revert "Bug 15896: [QA Follow-up] Add accountlines_id parameter...
Josef Moravec [Wed, 7 Dec 2016 02:41:08 +0000 (02:41 +0000)]
Bug 15897 - Folowup Revert "Bug 15896: [QA Follow-up] Add accountlines_id parameter in paycollect"

This reverts commit b6d5748c001febc5acd67938d12ba25844d11fbc.

As this bug report no more uses the accounline_id parameter to identify
account lines to pay in Koha::Account->pay, it should revert this, to
use the new notation everywhere.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15897 - Use Koha::Account::pay internally for recordpayment_selectaccts
Kyle M Hall [Wed, 24 Feb 2016 13:30:07 +0000 (13:30 +0000)]
Bug 15897 - Use Koha::Account::pay internally for recordpayment_selectaccts

This is the third patch in a series to unify all payment functions into
a single mathod

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Accounts.t
3) Test fine payment via the "Pay selected" button

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14610 [QA Followup] - Minify opac.css
Kyle M Hall [Tue, 3 Jan 2017 11:01:08 +0000 (11:01 +0000)]
Bug 14610 [QA Followup] - Minify opac.css

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17830: CSRF - Handle unicode characters in userid
Jonathan Druart [Thu, 29 Dec 2016 16:54:40 +0000 (17:54 +0100)]
Bug 17830: CSRF - Handle unicode characters in userid

If the userid of the logged in user contains unicode characters, the token
will not be generated correctly and Koha will crash with:
  Wide character in subroutine entry at /usr/share/perl5/Digest/HMAC.pm line 63.

Test plan:
- Edit a superlibrarian user and set his/her userid to '❤' or any other strings
with unicode characters.
- Login using this patron
- Search for patrons and click on a result.

=> Without this patch, you will get a software error (with "Wide
character in subroutine entry" in the logs).
=> With this patch, everything will go fine

You can also test the other files modified by this patch.

Signed-off-by: Karam Qubsi <karamqubsi@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17569: [QA Follow-up] Small changes
Marcel de Rooy [Fri, 2 Dec 2016 09:30:55 +0000 (10:30 +0100)]
Bug 17569: [QA Follow-up] Small changes

Patron.pm: Adds two missing semicolons at the last statement. Not strictly
needed, but strongly recommended.
Patrons.t: Add a test description, remove two comments that refer to
previously hardcoded dates.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17569: Do not limit by branch if option is not passed
Jonathan Druart [Tue, 8 Nov 2016 08:07:02 +0000 (08:07 +0000)]
Bug 17569: Do not limit by branch if option is not passed

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17569: Remove C4::Members::GetUpcomingMembershipExpires
Jonathan Druart [Tue, 8 Nov 2016 08:02:38 +0000 (08:02 +0000)]
Bug 17569: Remove C4::Members::GetUpcomingMembershipExpires

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17569: Koha::Patrons - Move GetUpcomingMembershipExpires to search_upcoming_membe...
Jonathan Druart [Mon, 7 Nov 2016 14:38:17 +0000 (14:38 +0000)]
Bug 17569: Koha::Patrons - Move GetUpcomingMembershipExpires to search_upcoming_membership_expires

This patchset moves the C4::Members::GetUpcomingMembershipExpires
subroutine code to the Koha::Patrons->search_upcoming_membership_expires
method.
This subroutine was used from only 1 place, so it's an easier to move.

Test plan:
Use the membership_expiry.pl cronjob script using the different
options.
The behavior should be the same as prior to this patch.

  prove t/db_dependent/Koha/Patrons.t
should return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17569: Move tests to the patron module test file
Jonathan Druart [Mon, 7 Nov 2016 14:34:32 +0000 (15:34 +0100)]
Bug 17569: Move tests to the patron module test file

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17569: Rewrite existing tests to make them reusable and more robust
Jonathan Druart [Mon, 7 Nov 2016 13:18:54 +0000 (13:18 +0000)]
Bug 17569: Rewrite existing tests to make them reusable and more robust

In order not to cheat you, I am rewriting the tests in a separate
commit.
You can confirm that they pass with the other patches.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13726 - (QA followup) Fix vendor retrieval in invoices.pl
Nick Clemens [Wed, 28 Dec 2016 15:10:26 +0000 (15:10 +0000)]
Bug 13726 - (QA followup) Fix vendor retrieval in invoices.pl

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13726: Fix for serials/acqui-search-result.pl
Jonathan Druart [Tue, 29 Nov 2016 09:16:55 +0000 (09:16 +0000)]
Bug 13726: Fix for serials/acqui-search-result.pl

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>
7 years agoBug 13726: Make Koha::Acq::Bookseller using Koha::Object
Jonathan Druart [Tue, 17 Feb 2015 13:37:10 +0000 (14:37 +0100)]
Bug 13726: Make Koha::Acq::Bookseller using Koha::Object

This patch create a Koha::Acquisition::Booksellers module and
Koha::Acquisition::Bookseller::Contract[s] modules.

All code in the acquisition module is adapted to use the CRUD methods of
Koha::Object[s].
The former C4 routines are removed.

Test plan:
Since a lot of files are impacted by this patch, try a complete
acquisition workflow and try to catch errors.
Be focused on bookseller and bookseller' contacts data.

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>
7 years agoBug 17820: use ->find instead of search->next
Jonathan Druart [Wed, 28 Dec 2016 12:14:06 +0000 (13:14 +0100)]
Bug 17820: use ->find instead of search->next

From C4::Auth:
  my $patron = Koha::Patrons->search({ userid => $userid })->next;

This should be replaced with
  my $patron = Koha::Patrons->find({ userid => $userid });

userid is a unique key

Caught with NYTProf:
 # spent 78.9ms making 1 call to Koha::Objects::next

Test plan:
Login at the intranet
Reload the page
=> You must still be logged in

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested by enabling TrackLastPatronActivity and logging in again.
Verified lastseen column in borrowers.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17767 - DBRev 16.12.00.001
Kyle M Hall [Wed, 28 Dec 2016 13:56:07 +0000 (13:56 +0000)]
Bug 17767 - DBRev 16.12.00.001

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17767: (followup) Rename test file
Tomas Cohen Arazi [Wed, 14 Dec 2016 15:06:59 +0000 (12:06 -0300)]
Bug 17767: (followup) Rename test file

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17767: Unit tests
Tomas Cohen Arazi [Thu, 15 Dec 2016 04:31:01 +0000 (01:31 -0300)]
Bug 17767: Unit tests

This patch introduces tests for the new behaviour, and also
enhances the existing ones aiming to reach full coverage.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17767: Make Koha::Patron::Modification handle extended attributes
Tomas Cohen Arazi [Tue, 13 Dec 2016 20:45:41 +0000 (17:45 -0300)]
Bug 17767: Make Koha::Patron::Modification handle extended attributes

This patch makes Koha::Patron::Modification aware of the new extended_attributes
column, which is expected to contain valid JSON data.

The ->store method is modified so it validates the field value (i.e. the content
is decoded using the JSON library) and raises a convenient exception in case of
failure.

This behaviour change is covered by the provided unit tests.

To test:
- Apply the patchset
- Run:
  $ prove t/db_dependent/Koha/Patron/Modifications.t
=> SUCCESS: Tests make sense, and they pass
- Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17767: DBIC update
Tomas Cohen Arazi [Tue, 13 Dec 2016 20:42:53 +0000 (17:42 -0300)]
Bug 17767: DBIC update

This patch can be skipped by the RM, it just updates the DBIC schema files.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17767: Add borrower_modification.extended_attributes
Tomas Cohen Arazi [Tue, 13 Dec 2016 20:42:35 +0000 (17:42 -0300)]
Bug 17767: Add borrower_modification.extended_attributes

This patch changes the DB structure adding borrower_modifications.extended_attributes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17679: C4::Circulation - Remove unused GetItemIssues
Jonathan Druart [Fri, 25 Nov 2016 10:52:11 +0000 (11:52 +0100)]
Bug 17679: C4::Circulation - Remove unused GetItemIssues

Ready for an archaeology course?

C4::Circulation::GetItemIssues is only used once, from
catalogue/issuehistory.pl
This call has been added by
  commit 95d6452462a560ba0c0ac859a2cfb7783c25c925
    Adding some more information on issuehistory.
which says "Adding itemnumber to issuehistory.pl API so that one could search
for issuehistory of a specific item."
So it added the ability to see the item issue history but did not
provide a way to access it via the interface.
It's ok so far but this subroutine is broken since
  commit aa114f53499b9cffde0571fe7e08622f9c9a332a
    Bug 5549 : Only use DateTime for issues table
because of this change:
-    my $today = C4::Dates->today('iso');
+    my $today = DateTime->now( time_zome => C4::Context->tz);

I let you catch the typo ;)
And since this commit the subroutine explodes with "The following
parameter was passed in the call to DateTime::from_epoch but was not
listed in the validation options: time_zome"

Since it has never been raised by someone and that the feature is
hidden, I'd recommend to simply remove it.

Note that the "Checked out from" column would have been wrong even if we
fixed all the previous issue.

Test plan:
Just dig into the code and confirm what this commit message tells

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Looks fine for me.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17584 [QA Followup] - Rename Koha::Patron::get_checkouts to Koha::Patron::checkouts
Kyle M Hall [Fri, 23 Dec 2016 14:07:42 +0000 (14:07 +0000)]
Bug 17584 [QA Followup] - Rename Koha::Patron::get_checkouts to Koha::Patron::checkouts

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17584: Add the Koha::Patron->get_checkouts method
Jonathan Druart [Tue, 8 Nov 2016 12:52:52 +0000 (12:52 +0000)]
Bug 17584: Add the Koha::Patron->get_checkouts method

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17209: Remove use of onclick from masthead
Aleisha Amohia [Mon, 29 Aug 2016 04:47:36 +0000 (04:47 +0000)]
Bug 17209: Remove use of onclick from masthead

There are two instances which use onclick in the OPAC masthead: clearing
search history, and logging out.

To test:
Confirm that clearing search history using the 'x' in the masthead, and
logging out by clicking 'Log out' in the masthead, work the same before
and after the patch.

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 16072: Changing all instances of 'loading-small.gif' to 'spinner-small.gif' and...
Aleisha Amohia [Mon, 12 Dec 2016 00:00:30 +0000 (00:00 +0000)]
Bug 16072: Changing all instances of 'loading-small.gif' to 'spinner-small.gif' and removing loading-small.gif file.

Confirm that I have not missed any places where there is 'loading-small.gif'
Have amended patch to not include OPAC changes from previous patch.

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15711: Follow up batch_id not used
Mark Tompsett [Fri, 2 Dec 2016 19:37:07 +0000 (19:37 +0000)]
Bug 15711: Follow up batch_id not used

Changed batch_id to image_id in the template, as the multiparam
would catch the array case.

TEST PLAN
---------
1) attempt to delete a selected item, but get a warning.
2) apply this follow up
3) attempt to delete a selected item, it deletes.
4) run koha qa test tools

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15711: Fixing the 'Delete selected' button on patroncard images
Aleisha Amohia [Wed, 24 Aug 2016 01:08:11 +0000 (01:08 +0000)]
Bug 15711: Fixing the 'Delete selected' button on patroncard images

To test:
1) Go to Tools -> Patron Card Creator -> Manage images
2) Upload an image if you haven't already
3) Click Delete selected without selecting any images
4) Notice broken behaviour as described in Description
5) Apply patch, refresh page
6) Click Delete selected without selecting any images
7) Notice alert. Click OK
8) Select one image or more, click Delete selected
9) Notice confirm delete message.

Sponsored-by: Catalyst IT
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17785: Fix OAI-PMH's XSLT-generated URLs under Plack
Marcel de Rooy [Tue, 20 Dec 2016 15:11:36 +0000 (16:11 +0100)]
Bug 17785: Fix OAI-PMH's XSLT-generated URLs under Plack

Look at e.g. the URL for Show More at the end of the output of Records or
Identifiers. If you use Plack, you will see that it refers to
yourserver:/opac/oai.pl, which is not correct.

This is caused by using CGI's self_url in combination with script alias,
mounting point, etc. Note that we cannot solve this problem in the code of
Koha only. Since HTTP::OAI modules also call self_url, we still end up
with some wrong url's.

Instead of a larger architectural operation on Apache and Plack config files,
this patch adjusts the final xslt transformation on the OAI response.
It hardcodes the correct path only once, in a xslt variable. And replaces
all oai:OAI-PMH/oai:request/text() calls, containing wrong URLs, by this
variable.

Test plan:
Run oai.pl. Try the various verbs.
Verify that the URLs point to /cgi-bin/koha/oai.pl.

Edit: changed commit subject

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Works as expected. Good workaround until a definitive solution is implemented.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17781 - Improper branchcode set during renewal
Kyle M Hall [Thu, 22 Dec 2016 14:00:37 +0000 (14:00 +0000)]
Bug 17781 - Improper branchcode set during renewal

For no discernable reason, when AddIssue calls AddRenewal, it passes the
branchcode generated from _GetCircControlBranch. Assume
_GetCircControlBranch is set to return items.homebranch. So:
1) If an item owned by LibraryA is checked out at LibraryB, the
  statistic line branchcode will be LibraryB
2) If an item is renewed via the ajax datatables renewal function, the
  statistic line branchcode will be LibraryB the
3) If an item is renewed via scanning the item into the checkout again,
  statistic line branchcode will be *LibraryA*

This is clearly improper behavior. The renewal is taking place at
LibraryB, so the branchcode passed to AddRenewal should be LibraryB,
the logged in library. This also jives with the documentation for
the subroutine.

Test Plan:
1) Set CircControl to "the library the item is from" aka ( ItemHomeLibrary )
2) Set HomeOrHoldingBranch to 'The library the items is from" ( aka homebranch )
3) Create item with homebranch of LibraryA and holdingbranch of LibraryB
4) Set the logged in library to LibraryB
4) Check the item out to a patron at LibraryB
5) Note the statistics line has a branchcode of LibraryB
6) Check the item out again to trigger a renewal, renew the item
7) Note the statistic line has a branchcode of LibraryA!
8) Apply this patch
9) Repeat step 6
10) Note the statistics line has a branchcode of LibraryB!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Kuhn <kuhn@monterey.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17742: Use TestBuilder to create the library and patron category
Jonathan Druart [Wed, 28 Dec 2016 08:57:14 +0000 (09:57 +0100)]
Bug 17742: Use TestBuilder to create the library and patron category

Moreover we do not need to remove the existing issues and patrons

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17742: Fix t/db_dependent/Patrons.t
Josef Moravec [Tue, 6 Dec 2016 21:07:56 +0000 (21:07 +0000)]
Bug 17742: Fix t/db_dependent/Patrons.t

Moves the getting of testing date for updated_on just after the storing
the test patron data to make the gap between generating data and now
date as short as possible

Fixes test 7

Use Koha::Database instead of C4::Context->dbh

Test plan
1. prove t/db_dependent/Patrons.t
2. read the diff

NOTE: Only minor improvement could be using test builder to
      generate the category and branch codes, rather than assume
      data exists. However, that is beyond scope of this bug.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17520: Do not overlap with advance_notices.pl
Jonathan Druart [Tue, 27 Dec 2016 15:57:34 +0000 (16:57 +0100)]
Bug 17520: Do not overlap with advance_notices.pl

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17520: add serialsUpdate.pl to the list of regular cron jobs
Marcel de Rooy [Mon, 31 Oct 2016 13:44:51 +0000 (14:44 +0100)]
Bug 17520: add serialsUpdate.pl to the list of regular cron jobs

This patch adds the job to debian package file and the examples file
in misc.

Test plan:
Add these lines to your cron file.
Check the results. (If an issue you expect passes the grace period defined
in the subscription, its status should go from Expected to Late.)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17246: Do no support arrayref to define multiple FK
Jonathan Druart [Mon, 5 Sep 2016 08:54:35 +0000 (09:54 +0100)]
Bug 17246: Do no support arrayref to define multiple FK

Currently you can call GetPreparedLetter like:

$prepared_letter = GetPreparedLetter(
    (
        module      => 'test',
        letter_code => 'TEST_HOLD',
        tables      => {
            reserves => [ $fk1, $fk2 ],
        },
    )
);

It assumes that $fk1 is a borrowernumber and $fk2 a biblionumber.
It seems hazardous to do this guess.

I suggest to remove this feature and only allow hashref indeed.

Test plan:
Use different way to generate letters and make sure you do not reach the croak

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14637: Followup - Fix number of tests due to rebase
Kyle M Hall [Fri, 23 Dec 2016 13:35:34 +0000 (13:35 +0000)]
Bug 14637: Followup - Fix number of tests due to rebase

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14637: Fix add patron category under MySQL 5.7
Jonathan Druart [Tue, 6 Sep 2016 09:40:46 +0000 (10:40 +0100)]
Bug 14637: Fix add patron category under MySQL 5.7

If no dateofbirthrequired or upperagelimit is set on the interface, the
->store method will receive an empty string defined for these values.
For INT field, we must explicitely set these empty value to undef
instead to avoid MySQL 5.7 (and strict mode) to raise:
  DBD::mysql::st execute failed: Incorrect integer value: ' for column
'dateofbirthrequired''

Test plan:
Using MySQL 5.7 (and/or sql_mode=STRICT_TRANS_TABLES)
Create a patron category without specifying upperagelimit or
dateofbirthrequired

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14637: Fix add patron category under MySQL 5.7 - tests
Jonathan Druart [Tue, 6 Sep 2016 09:40:28 +0000 (10:40 +0100)]
Bug 14637: Fix add patron category under MySQL 5.7 - tests

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17783: Replace ok with is
Jonathan Druart [Tue, 20 Dec 2016 17:07:40 +0000 (18:07 +0100)]
Bug 17783: Replace ok with is

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17783: Prevent crash when providing an undefined value
Lari Taskula [Tue, 20 Dec 2016 14:54:44 +0000 (16:54 +0200)]
Bug 17783: Prevent crash when providing an undefined value

When calling the proposed version of get_effective_issuing_rule with undefined
parameter values, a following crash occurs:

SQL::Abstract::puke(): [SQL::Abstract::__ANON__] Fatal: SQL::Abstract before v1.75
used to generate incorrect SQL when the -IN operator was given an undef-containing
list: !!!AUDIT YOUR CODE AND DATA!!! (the upcoming Data::Query-based version of
SQL::Abstract will emit the logically correct SQL instead of raising this
exception) at /home/ubuntu/kohaclone/Koha/Objects.pm line 182

This patch adds a test to cover this problem and fixes the issue.

To test:
1. Run t/db_dependent/Koha/IsssuingRules.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17783: Optimize Koha::IssuingRules->get_effective_issuing_rule
Lari Taskula [Thu, 15 Dec 2016 17:31:30 +0000 (19:31 +0200)]
Bug 17783: Optimize Koha::IssuingRules->get_effective_issuing_rule

This patch modifies method get_effective_issuing_rule in Koha::IssuingRules
aiming to optimize the search for matching issuing rule.

Before this patch, in worst case scenario, we have had to make a SELECT query
eight times. This will have a negative impact on performance where-ever we need
to find matching issuing rule multiple times, if the search is not directly
matching an issuing rule on the first query.

This patch makes get_effective_issuing_rule have a stable performance on both
best and worst case, whereas the old method was really fast on the best case
and really slow on the worst case.

However, this patch slightly lowers the performance for best case, where matching
issuing rule is found instantly before (branchcode, categorycode and itemtype all
are specifically defined in issuing rules). For all other cases this patch offers
a performance improvement.

To test:
1. Run t/db_dependent/Koha/IssuingRules.t and compare the results with previous
   tests.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17783: Add Koha::Objects->single
Lari Taskula [Thu, 15 Dec 2016 17:28:38 +0000 (19:28 +0200)]
Bug 17783: Add Koha::Objects->single

Returns one and only one object that is part of this set.
Returns undef if there are no objects found.

->single is faster than ->search->next

This is optimal as it will grab the first returned result without instantiating
a cursor.

It is useful for this Bug as we only want to select the top row of found issuing
rules.

To test:
1. Run t/db_dependent/Koha/Objects.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17783: Test to print performance of get_effective_issuing_rule
Lari Taskula [Thu, 15 Dec 2016 16:35:13 +0000 (18:35 +0200)]
Bug 17783: Test to print performance of get_effective_issuing_rule

This test prints the amount of issuing rule matches per second for
1. worst case, when non-existent branchcode, categorycode and itemtype is
   being searched (currently 8 queries)
2. mid case (rule found on 4th query)
3. 2nd best case (rule found on 2nd query)
4. best case, when an issuing rule is defined for exactly those branchcode,
   categorycode and itemtype (currently 1 query)

To test:
1. Run t/db_dependent/Koha/IssuingRules.t
2. Write down the per-second amount to compare with next patch

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17783: Test to confirm correct effective issuing rule selection
Lari Taskula [Thu, 15 Dec 2016 15:58:39 +0000 (17:58 +0200)]
Bug 17783: Test to confirm correct effective issuing rule selection

This patch adds a test to cover the validity of effective issuing rule selection
in correct order.

To test:
1. Run t/db_dependent/Koha/IssuingRules.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17689: Add the Koha::Checkout->is_overdue method
Jonathan Druart [Fri, 25 Nov 2016 13:16:26 +0000 (14:16 +0100)]
Bug 17689: Add the Koha::Checkout->is_overdue method

This patch adds a new method Koha::Checkout->is_overdue and provide tests
to cover it.
The goal is to behave like GetItemIssues set the 'overdue' flag to
issues.
I don't understand why the existing GetItemIssues truncate dates to
minutes, so I did not recreate this behavior.

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

Signed-off-by: Mika Smith <mikasmith@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17678: Use Koha::Checkouts instead of Koha::Issues
Jonathan Druart [Tue, 20 Dec 2016 13:45:33 +0000 (14:45 +0100)]
Bug 17678: Use Koha::Checkouts instead of Koha::Issues

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17678: Typo iss in Circulation.t
Marcel de Rooy [Fri, 2 Dec 2016 08:57:50 +0000 (09:57 +0100)]
Bug 17678: Typo iss in Circulation.t

Iss should be is.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17678: C4::Circulation - Replace GetIssues with Koha::Issues
Jonathan Druart [Fri, 25 Nov 2016 10:12:20 +0000 (11:12 +0100)]
Bug 17678: C4::Circulation - Replace GetIssues with Koha::Issues

The C4::Circulation::GetIssues subroutine is only called once and can be
replaced with a call to Koha::Isues->search with a join on items.

Test plan:
- Apply first patch and make sure the tests pass
- Apply second patch and make sure the tests still pass

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17678: Add tests for CanBookBeIssued + AllowMultipleIssuesOnABiblio
Jonathan Druart [Fri, 25 Nov 2016 10:06:25 +0000 (11:06 +0100)]
Bug 17678: Add tests for CanBookBeIssued + AllowMultipleIssuesOnABiblio

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17398: Enhance circulation messages UI
Josef Moravec [Tue, 4 Oct 2016 12:55:51 +0000 (14:55 +0200)]
Bug 17398: Enhance circulation messages UI

Test plan:
1) Apply patch
2) Add same circulation messages, note that both buttons are in bootstrap style and the whole form is a bit cleaner
3) Confirm that adding works as expected
4) Try to delete some of your messages, note the delete link is also button now
5) Confirm that deleting works as expected

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17317: Perfomance Improvement
Lyon3 Team [Fri, 30 Sep 2016 12:50:16 +0000 (14:50 +0200)]
Bug 17317: Perfomance Improvement

- Use of GetItemnumbersForBiblio instead of GetItemsByBiblioitemnumber (thx Jonathan Druart)

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>