Bug 10782 - Add a koha-mysqlcheck script

This patch adds the koha-mysqlcheck script, as a "frontend" for
the mysqlcheck command. It can be used to check the integrity of
database tables, as well as to repair them. See "man mysqlcheck"
for more information.

The script takes a Koha instance name as its only required
parameter. Any other parameters provided before the instance
name are passed directly to mysqlcheck, which means that all
the functionality of mysqlcheck is available through this script.

To test the script:
- Apply the patch, build your own packages and install them, or
- copy koha-mysqlcheck to a server already running off packages

- Run some variations of the command, with and without arguments,
  and check that the output makes sense. E.g.:
    sudo koha-mysqlcheck myinstance
    sudo koha-mysqlcheck -e myinstance # Extended checks
    sudo koha-mysqlcheck -e -v myinstance # Extended checks and verbose
- See "man mysqlcheck" for other relevant options

To test the man page:
- Run these commands and look at the formatted man page:
    $ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
      debian/docs/koha-mysqlcheck.xml
    $ man -l koha-mysqlcheck.8
- Make sure this test passes:
    $ prove -v xt/verify-debian-docbook.t

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12105 - Remove duplicated plugin jquery.dataTables.columnFilter.js

This patch removes a redundant copy of the DataTables plugin
jquery.dataTables.columnFilter.js and corrects two templates.

The path to the plugin has been modified in acqui/parcel.tt:

- Go to Acquisitions and search for a vendor.
- Open the detail page for that vendor.
- Click the "Receive shipments" button.
- Select an invoice to view.
- In the table of titles, confirm that the column header search forms
  work to filter column data.

In the template for the Staged MARC management page the plugin has been
removed as it is unused. A couple of markup corrects have been made.
Confirm that table sorting is unaffected by going to Administration ->
Staged MARC management, clicking a staged MARC file, and viewing the
table of items in that batch.

There should be no more remaining instances of this path in the
templates:

[% themelang %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: I believe the sort order of the Order Line column is
      strange, but unrelated to this patch. The search area
      functions (filtering, paging, page size, etc.) worked
      fine.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10942: Provide a way for package upgrades to update template translations

This patch adds a new config variable AUTOMATIC_TRANSLATIONS_UPDATE at
/etc/default/koha-common that is used to control whether the upgrade
process should trigger a

 $ koha-translate --update <lang_code>

command for each installed template translation language.

To test:
- Have a koha-common setup with some languages installed
  (e.g. koha-translate --install es-ES)
- Apply the patch and build a package for it.
- Install it.
- A new AUTOMATIC_TRANSLATIONS_UPDATE config variable should be in place
  at /etc/default/koha-common
- Set AUTOMATIC_TRANSLATIONS_UPDATE to 'yes'
- Re-install the package to trigger the post-install script
- Verify that translations get updated.

Edit: added a warning message for the case AUTOMATIC_TRANSLATIONS_UPDATE=no
and there are translations installed (so they need to get updated).

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Works as advertised, default behaviour doesn't change.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10942: (follow-up) create a /etc/koha/koha-common.conf

This patch creates a new master configuration file for the
koha-common package, and moves the AUTOMATIC_TRANSLATIONS_UPDATE
variable rather than leaving in in /etc/default/koha, which is meant
to be used for init script settings.

The configuration format is simple - a shell script that
sets variables and which can sourced by another script or
trivially parsed.

To test:

- Apply the patch series for bug 10942 and build a package.
- Install the package.
- Verify that a new config file, /etc/koha/koha-common.conf.
- Follow the rest of the test plan for the main page (e.g.,
  set AUTOMATIC_TRANSLATIONS_UPDATE and force a package upgrade).

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10942: (follow-up) make AUTOMATIC_TRANSLATIONS_UPDATE default to yes

This patch makes AUTOMATIC_TRANSLATIONS_UPDATE default to yes,
meaning that package upgrades will update the translations by
default.  This seems definitely sensible for new installations,
but as there are some older installations that may be in the
habit directly editing generated translated templates, it's
less clear whether this is a good idea for upgrades.

This patch is intentionally separate, and can be ignored if
the consensus swings towards having AUTOMATIC_TRANSLATIONS_UPDATE
be off even for new installations or if somebody counter-patches
with adding debconf support.

To test:

- As with the previous patches in the series, except that the
  translations would be automatically updated upon installing
  the new package.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10942: (follow-up) debconfing the update option

This causes a question to be asked at installation time as to whether
translations should be updated or not. The answer is written to the
config file, and stored in debconf. Effort is taken to ensure that if
the admin changes the config file, the update will be picked up and
reflected in debconf (i.e. that the admin's decision is always the
correct one.)

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Fixed two typos that made it fail and it worked like a charm.

Tested like this:

- Install the package
=> no errors, the file is created, defaults to 'yes'
- Install a language (koha-translate --install es-ES)
- Re-install the package (simulating an upgrade)
=> es-ES gets updated
- Set preference to 'no'
- Re-install
=> es-ES doesn't get updated, the warning is printed correctly
- Installed a second language (koha-translate --install pt-BR)
- did all the tests again
=> Success

Note: on master there are obvious template translation warnings.
A copy of the generated package can be grabbed from:
http://es.koha-community.org/koha-common_3.15+20140312172225.af7c0a23_all.deb

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10942: (QA followup) make warnings to to STDERR

As noted by Robin, STDOUT is used by the script to communicate with
debconf and, hence, the warning messages should be directed to STDERR.

This patch does that. To test:

- Set AUTOMATIC_TRANSLATIONS_UPDATE="no" so the warning normally shows
- Redirect STDOUT to /dev/null:
  dpkg -i koha-common...deb > /dev/null
=> Warning message doesn't show (i.e. it is sent to STDOUT)
- Apply the patch, rebuild package
- Redirect STDOUT to /dev/null:
  dpkg -i koha-common...deb > /dev/null
=> Warning message shows (i.e. is correctly sent to STDERR)
- Redirect STDERR to /dev/null:
  dpkg -i koha-common...deb 2> /dev/null
=> Warning message doesn't show
- Verify that previous tests pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12112: remove disused routine C4::Breeding::ImportBreeding()

This patch removes the ImportBreeding() routine, which lost its
last caller as of the patch for bug 10462.

To test:

[1] Verify that prove -v t/Breeding.t passes.
[2] Perform a Z39.50 search in the staff interface.
[3] Perform a cataloguing reservoir search in the staff
    interface; verifying that cached records from the search
    done in step 2 are retrieved.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12103 - Move ajaxfileupload jQuery plugin outside of language-specific directory

This patch moves the ajaxfileupload jQuery plugin to
intranet-tmpl/prog/lib/jquery/plugins so that it will not be duplicated
for each set of translated templates.

To test, apply the patch and test a page which requires the file upload
plugin. For instance: Tools -> Upload local cover image. The upload
process should finish correctly.

Tested with patron and local cover images. Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12107 - Move checkboxes jQuery plugin outside of language-specific directory

This patch moves the checkboxes jQuery plugin to
intranet-tmpl/prog/lib/jquery/plugins so that it will not be duplicated
for each set of translated templates.

To test, apply the patch and confirm that select all/clear all controls
continue to work on the following pages:

- Acquisitions -> Late orders
- Acquisitions -> Add to order from an external source (search targets)
- Acquisitions -> Suggestions
- Administration -> Funds -> Planning (show/hide all columns)
  * Some unused code has been removed
- Administration -> Library transfer limits
- Staff client cart
- Authorities -> New from Z39.50 (search targets)
- Cataloging -> New from Z39.50 (search targets)
- Circulation -> Check out to a patron (renew/check in selections)
- Circulation -> Offline circulation -> Pending operations
- Patrons -> Patron detail (renew/check in selections)
- Patrons -> Fines -> Pay fines
- Serials -> Subscription -> Serial collection
- Tools -> Label creator -> Batches -> Search results
- Tools -> Patron card creator -> Batches -> Search results
- Tools -> Tags moderation
- Tools -> Batch item deletion
- Tools -> Batch item modification
- Tools -> Inventory -> Submit a batch of barcodes
- Lists -> List contents view

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

Works as described! I don't think I've ever checked so many boxes
before...

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12101 - Move Greybox library outside of language-specific directory

This patch moves the Greybox library to intranet-tmpl/lib so that it is
not duplicated for each set of translated templates. The Greybox library
files are called directly only by one include file, greybox.inc, which
is modified by this patch.

To test, apply the patch and view any page which calls the Greybox
library and confirm that modal windows are still generated correctly.

For instance, Cataloging -> Cataloging search, click the "Preview MARC"
link.

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

Works as described.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12116 - Move fixFloat jQuery plugin outside of language-specific directory

This patch moves the fixFloat jQuery plugin to
intranet-tmpl/prog/lib/jquery/plugins so that it will not be duplicated
for each set of translated templates.

This patch also includes a change to staff-global.css to override some
style the floating toolbar inherited when we added Bootstrap widgets.

To test, apply the patch and confirm that the toolbar "sticks" to the
top of the screen when scrolling down on the following pages:

- System preferences
- Authorities editor (Authorities -> New authority)
- Cataloging editor (Cataloging -> New record)
- List contents view (Lists -> View a list's contents)

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12119 - Move jeditable jQuery plugin outside of language-specific directory outside of language-specific directory

This patch moves the jeditable jQuery plugin to
intranet-tmpl/prog/lib/jquery/plugins so that it will not be duplicated
for each set of translated templates.

To test, apply the patch and confirm that editing quotes works correctly
in the Quote of the Day manager.

Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12131: Remove unused dependency on Exporter

C4::TmplToken depends on Exporter but does not use any
of its facilities. Removed the dead code so it does not
clog up the source and waste compilation time

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Module still compiles correctly; t/TmplToken.t passes.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12118 - remove unnecessary YUI assets included in offline circ manifest

The offline circulation asset manifest includes some YUI JavaScript
files which are no longer used by any template in Koha except for
acquisitions/basketgroup.tt. This patch removes them from the manifest.

To test, apply the patch and test offline circulation. Everything should
work correctly.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12114: Fix encoding problem with reports JSON web service (opac)

- catalog a record that includes umlauts äöü
- write a report, that has the record in the result set
- access the JSON output of the report
  <OPAC BaseURL/cgi-bin/koha/svc/report?id=1
- verify the umlaut displays not correctly
- switch the encoding in the browser to 'western'/latin1
- verify the umlaut now displays correctly
- apply patch
- verify umlaut now displays correctly from the beginning

Based on paste from Galen Charlton.

Followed test plan. Result as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12114: Fix encoding problem with reports JSON web service (staff)

Repeat tests from first patch, but this time, access the report
with your staff client base URL.

<Staff BaseURL>/cgi-bin/koha/svc/report?id=<reportid>

Based on paste from Galen Charlton.

Followed test plan. Result as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12114: (QA Followup) Use JSON instead of JSON::XS

RM note: on most platforms, the JSON module will use JSON::XS
by default.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11588: fix untranslatable subscription frequency units

To test:

1) cd misc/translator
2) perl translate update xx-YY
3) check that there's no msgid that contains the subscription
   frequencies (day, week, month and year) in
   po/xx-YY-i-staff-t-prog-v-3006000.po (search for
   "BLOCK translate_frequnit")
4) apply patch
5) perl translate update xx-YY
6) check po/xx-YY-i-staff-t-prog-v-3006000.po that it contains the
   msgid for the frequencies. (search for "BLOCK translate_frequnit")

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10823: add class info to enumchron data in detail.tt, for better styling

This patch adds spans to style parts of the enumchron and serialseq
information in the holdings table in the taff interface:

These include:

- items.enumchron
- the separator used
- serial.serialseq
- items.publisheddate

TEST PLAN
---------
1) Apply patch 10825
2) Find a biblio where the enumchron and serialseq are different.
   -- in MySQL:
      SELECT items.biblionumber,items.enumchron,serial.serialseq
      FROM items,serial,serialitems
      WHERE items.itemnumber=serilaitems.itemnumber
        AND serialitems.serialid=serial.serialid;
3) In the staff client, view the source for that item.
   -- It should be one class for the entire <td> cell.
4) Apply patch 10823
5) Refresh the page
6) Look at the source for that item again.
   -- It should have <span> tags around the 4 things listed
      above.
7) Run the koha qa test tools.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template change only, no regression found.
Using [%- -%] could improve readability of HTML source code.

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