Bug 11957: reomve disused sample_only_param_tables.sql

This sql file tries to insert data into nonexistent tables.
It is useless and can be removed.

Test plan:
  git grep sample_only_param_tables
should not return any result.

NOTE: This is basically a git rm. Simple patch.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
File is not used by the installers and it wouldn't work
with today's Koha for trying to insert data into non-existant
tables and tables with different structure.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11973 - Fix Armenian language description

This patch fix Armenian language description

To test:
1) Do a fake translation to Armenian,
   mkdir koha-tmpl/intranet-tmpl/prog/hy-Armn
2) Go to Administration > System preferences > I18N/L10N
3) Armenian description looks like the second string in Bug description
4) Apply the patch
5) Run updatedatabase.pl
6) Reload page, now description look as first string in
Bug description (it's the sixth letter, similar to 't')

Ammended patch, wrong column.

Signed-off-by: Holger Meißner <h.meissner.82@web.de>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patch fixes the English sample file for translations and includes
a database update to correct the string in existing installations.
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11973: DBRev 3.15.00.026

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11352: fix unexpected data loss issues with batch patron deletion/anonymization

Batch patron deletion/anonymization tool has some issues:

1) If 'dateformat' setting in I18N/L10N system preferences is set
to anything other then 'iso' (eg. 'metric'), bulk deletion when using
'expiration date is before' criterion is not working properly. Date
entered in this field will be efectivelly ignored (or possibly
sometimes wrongly interpreted as different date, in other format)
on the final patron deletion stage. This may result in deleting
(or moving to trash) more borrower records then intended.
2) Bulk/batch patron deletion should skip borrowers with
nonzero account balance (ones with oustanding fines or credits)
3) This tool shouldn't offer to choose as deletion criterion
those patron categories which have category_type set to 'S'
(= staff patron categories)

This patch fixes above mentioned problems. It also adds an option
to "test run" patron batch deletion, and makes this option
the default choice in "warning" stage.

Test plan:
- prepare test database with some patron records (at least 2,
the more the better) set up in such a way that they will be vulnerable
to issues 1 & 2
- confirm issues 1,2
- restore test database
- apply patch
- ensure issues 1 & 2 are no longer present - first by using new "test
run" option: for #1, record counts in "warning" stage and "final" stage
should be now the same; for #2, observe that patron records with nonzero
balance are now excluded from deletion
- redo the tests, this time choosing "delete permanently" and "move
to trash" instead of "test run"
- test #3 by changing "Category type" to "S" in some
test patron categories - after that, those categories should no
longer be choosable as deletion criteria.

Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Tested with dateformat = dd/mm/yyyy. I tested with two expired patrons,
one with fines and one without. Before the patch a lot of unexpected
patrons were deleted along with the expected ones. After
applying the patch only the expired patron was deleted, not the
one with fines. The test run and the "real" run reported correct numbers.

The patch also makes sure no patron categories with category_type = S
are suggested for batch deletion.

Note: The ergonomics of the "Batch delete/anonymize" tool is hardly
optimal, but this patch fixes a real, data-loosing bug, so let's
deal with the ergonomics later.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11701: Unit tests for C4::Context::Zconn

TEST PLAN
---------
1) apply patch
2) run koha qa test tool
3) prove -v t/Context.t

Unit tests ran as expected.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11701: (follow-up) move unit tests to t/db_dependent

The new tests will not function if there isn't a valid
configuration (or mocking of preference()) so this patch
moves them to t/db_dependent/Context.t.

To test:

[1] After applying the main patch for this bug, verify that
    prove -v t/db_dependent/Context.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11701: Fix C4::Context::Zconn

When calling C4::Context::Zconn twice with different parameters,
the same ZOOM::Connection object is returned twice (parameters
of 2nd call are not used) This patch fixes that.

This is in part because the connection cache is keyed on server
name only. This patch corrects this by keying on all parameters.

TEST PLAN
---------
1) apply patch
2) run koha qa test tools
3) prove -v t/Context.t

The unit tests properly triggers the modified routine for
testing. Additionally, in hunting for ways it could break,
no nested synchronous or asynchronous Zconn's were found.
And even if they were, the keying on all parameters should allow
it to function properly without messing up the other connection.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11939: set active currency when using English sample data

This patch offers a better default for currencies,
with USA dollar as default active currency.

To test the patch:
1)Install master without the patch, during web installation
select 'parameters.sql' file
2)Finish install and go to Administration -Currencies & Exchange rates
3)No active currency

4)Install master with this patch, during web installation
 select 'parameters.sql' file
5)Finish install and go to Administration -Currencies & Exchange rates
6)Now USA dollar is the active currency

NOTE: This does solve the problem of everything being NULL for active,
      and lacking an active value. It also corrects the description
      of the optional item to check related to currencies.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11939: set active currency for non-English sample data

Revised Test Plan
-----------------
The following SQL commands were used to test this.

installer/data/mysql/en/optional/parameters.sql is part of the
first patch and didn't really need testing again.

installer/data/mysql/de-DE/optional/parameters.sql is not part
of the patch, but since I was playing with the script, which
is also attached here, it was included for good measure.

use kohadata;
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/pl-PL/optional/parameters.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/es-ES/optional/parameters.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/ru-RU/optional/sample_currency.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/uk-UA/optional/sample_currency.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/it-IT/necessari/parameters.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/de-DE/optional/parameters.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/nb-NO/2-Valgfritt/parameters.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE currency;
source /home/mtompset/kohaclone/installer/data/mysql/en/optional/parameters.sql

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11694: Improve handling of individual hold suspension in Bootstrap OPAC

This patch changes the way the controls to suspend and resume holds are
displayed on the OPAC for a logged-in user when using the Bootstrap
theme. Instead of showing all the suspend options in the table cell a
link will trigger a modal with the controls. This makes the table more
compact and readable.

The patch adds a span and class to the dateformat include so that the
dateformat hint can be hidden if JavaScript is enabled (and thus the
datepicker will use the correct format automatically).

A new class has been added to the CSS, ".js-show" to be used for
elements which should be hidden if JavaScript is disabled and made
visible by JavaScript if it is enabled.

To test you must have RequestOnOpac, SuspendHoldsOpac, and the bootstrap
theme enabled.

Apply the patch and test with AutoResumeSuspendedHolds enabled:

1. Log in to the OPAC and place a hold.
2. View the list of your holds in the OPAC.
3. Click the "Suspend" link for your new hold. A modal window should
   appear allowing you to specify a suspend-until date.
4. Specify a suspend-until date. Test the "clear" link and confirm that
   it clears the date.
5. Specify a suspend-until date and submit.
6. Confirm that the hold has been suspended with the specified
   resumption date.
7. Click the "Resume" link on the suspended hold to resume.
8. Click the "Suspend" link again and submit without specifying a date.
9. Confirm that the hold has been suspended indefinitely.

Follow the same steps above with JavaScript disabled. The "suspend
until" options will appear inside the table as before and everything
should work correctly.

Test with AutoResumeSuspendedHolds disabled. No modal dialog should
appear when the "Suspend" link is clicked. The hold should simply be
suspended indefinitely.

Test again with JavaScript disabled. There should be no change in
functionality.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.
Happy about the fallback for users without Javascript.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11694: [QA Followup] strip out time portion when setting suspension date for individual hold

This patch fixes an issue originally reported by bug 11702.

RM note: the patch is clear enough and doesn't break existing tests,
but on the other hand, I have been completely unable to reproduce
the original issue.

To test:

[1] Verify that prove -v t/db_dependent/Holds.t passes

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11877 - Eliminate use of deprecated jQuery .live() method

As of jQuery 1.9 the .live() method has been removed. A few templates
contain JavaScript which uses it. It can be easily replaced with .on().
This patch makes the correction.

To test, apply the patch and test the following pages:

- In the staff client, Administration -> OAI sets configuration:
  Define mappings for an existing set. You should be able to add rows by
  clicking the "OR" button. You should be able to delete or clear any
  line by clicking the "Delete" link.

- In the staff client, view the details for any patron and click the
  "Change password" button: In the change password form click the link
  to fill the password fields with a random password. This link should
  work correctly.

- If necessary enable OpacRenewalAllowed in system preferences. Log in
  to the OPAC as a patron who has checkouts. On the patron summary page
  (opac-user.pl) look for the "renew selected" and "renew all" links at
  the top of the table of checkouts. Both these links should work
  correctly. Test in prog and bootstrap themes.

Followed test plan. Same behaviour as without patch, i.e. patch OK
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.
No Javasript errors found.

Note: The buttons on the form show up, even if no item shows the
checkbox. In my case the problem was that I had 0 renewals allowed
in the circulation rules. Maybe we could hide them, if no item
can be renewed.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11806 - Use validation plugin when creating new OAI set

The form for adding a new OAI indicates that two fields are
required but does nothing to enforce this rule. This can be
handled client-side with HTML5 validation attributes and Koha's built-in
validation plugin. This patch implements this.

To test, apply the patch and go to Administration -> OAI sets
configuration -> New set. Try submitting the form without entering a
setSpec and/or setName. Doing so should trigger a validation warning.

Submission of the form with valid data should work correctly. Editing an
existing set should also work correctly.

Followed test plan. Patch behaves as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage

jQuery's .toggle() method can no longer be used to trigger a pair of
specified functions. .toggle() can only be used to change the visibility
of an element. This patch fixes a few places in Koha where the
deprecated functionality was used.

To test, apply the patch and clear your browser cache.

- View the system preferences page in the staff client. Clicking a
  heading ("Appearance" under OPAC preferences, for instance) should
  collapse that section. Clicking again should expand it.

- View the MARC detail page for a record in the OPAC. Clicking the "view
  plain" link should display the plain MARC view. Clicking the "view
  labeled" view should return to the original view. Test in both prog
  and bootstrap themes.

Signed-off-by: wajasu <matted-34813@mypacks.net>

Followed test plan. Works fine.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.
No Javascript errors found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11738: Use new DataTables include in batch patron modification template

Bug 10649 introduced a new include file for adding DataTables-related
JavaScript assets. This patch adds use of this include file to the
batch patron modification template.

This patch modifies the template so that date columns are sorted using
the "title-string" filter, based on the unformatted date. The DataTables
configuration has also been modified to account for varying structure
based on the page state.

Other minor edits: Corrected capitalization.

To test, go Tools -> Batch patron modification and submit a list of
patrons for modification. The resulting page should be correctly sorted.
Date columns should sort correctly for all dateformat system pref
settings.

Test with extended patron attributes enabled. Test adding and removing
varying numbers of attributes to patrons in your batch.

Submit a change to multiple borrowers. The results page should also be
sorted correctly.

Revision: Corrected error caused by the variable number of columns in
the table corresponding to varying numbers of patron attributes.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11671 - Restructure patron lists add form for improved usability

Non-standard interface features have the potential to cause confusion.
This patch brings various aspects of the patron lists add page into
conformity with other staff client pages.

- Add "select all/clear all" links for the checkboxes
- Add a "remove selected" to the top of the table (see also Lists)
- Split functionality of add from from delete form
- Hide "Add patrons" button until at least one patron has been selected
- Remove non-standard trash can icon from table's checkbox column
- Exclude checkbox column from table sorting
- Add confirmation to deletion actions
- Improve breadcrumb specificity
- Add title-string sorting to date column to accommodate sorting for all
  date format types

To test, apply the patch and create a patron list.

1. Search for and select patrons for the list. Selecting a patron should
   trigger the display of an "Add patrons" button.
2. Click "Add patrons" and confirm that the add process completes
   correctly.
3. Search for and select a patron and also check the box next to an
   existing patron. Click "Add patrons" and confirm that no patron is
   removed.
4. Check that the "select all" and "clear all" links work correctly.
5. Select patrons on the list and click the "Remove selected" link. You
   should be prompted to confirm your choice.
   4.a. Click cancel and confirm that the deletion process aborts.
   4.b. Click OK and confirm that the deletion process completes.
6. Repeat step 4 with the "Remove selected patrons" at the bottom of the
   page.
7. Confirm that the page title and breadcrumbs correctly show the list
   name.
8. Switch between us and metric dateformat settings and confirm that
   table sorting by date is correct in both cases.

Followed test plan. Patch behaves as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no regressions found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>