Bug 11713 - Use new DataTables include in course reserves templates

This patch modifies two course reserves templates to use the new
DataTables include. This simplifies the inclusion of assets and updates
to the latest DataTables version. Also included:

- Adds a sorting filter on the course reserves detail table to excluding
  articles from sorting.
- Corrects the styling of toolbar buttons (buttons should have btn and
  btn-small classes).

To test you must have UseCourseReserves enabled and have multiple
existing courses, at least one of which should have items on reserve.

1. View the list of courses. Table sorting should work correctly. The
   "new course" button should look consistent with other staff client
   toolbar buttons.

2. View the list of reserves on a course.
   - Toolbar buttons should look consistent with other staff client
     toolbar buttons.
   - Sorting should work correctly, excluding sorting on the Edit,
     Remove, and "Other course reserves" columns.
   - Titles on reserve which begin with an article should be sorted
     correctly with article excluded
   - Test sorting with item-level_itypes on and off.
   - Test sorting using a patron whose permissions include various
     combinations of add_reserves and delete_reserves

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit e0b13056b24655e52bb80543995ff9efe0470e34)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10452: make AllowHoldsOnDamagedItems control using damaged items to fulfill holds

AllowHoldsOnDamagedItems will stop item-specific holds from being placed
on damaged items, but does not stop Koha from using damaged items to
fill holds. This seems like incorrect behavior.

Test Plan:
1) Set 'AllowHoldsOnDamagedItems' to "Don't Allow"
2) Pick an item, set it to damaged
3) Place a bib-level hold on this item's record
4) Scan the item though the returns system
5) Koha will ask to use this item to fill the hold, click "ignore"
6) Apply this patch
7) Repeat step 4
8) Koha will not ask to use this item to fill the hold

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit cb45d4c2184622e15239077dd1c535a13abc53ce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10452: [QA Followup] - Unit tests

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script. Also checked
  t/db_dependent/Holds.t
  t/db_dependent/HoldsQueue.t

Tested holds triggering with different settings of
AllowHoldsOnDamagedItems. Works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 2e6d44bd3200d0dceef59f04a79a27dcadceab1d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10452: (follow-up) remove duplicate check of damaged status

While reviewing the main patch for this bug to verify that the
holds queue routines and C4::Reserves had the same conception of
when a damaged item could fill a hold request, I noticed that
GetItemsAvailableToFillHoldRequestsForBib() duplicated the code
for adding an SQL clause to filter out damaged items.  This patch
removes the duplication and improves the POD for that routine.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 67d3985929d70b67e64d5f0c275109b109065d2d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10955 - Add ability to skip deletions in zebraqueue

It seems that record deletions can cause extreme slowdowns for Koha
installations with extremely large numbers of records. It would be
helpful to be able to skip record deletions when processing the
zebraqueue with rebuild_zebra.pl so the deletions can be processed with
a lower frequency.

Test Plan:
1) Disable any zebra indexing cronjobs you may have
2) Delete a record
3) Note the operation recordDelete in the zebraqueue table having done = 0
4) Run misc/migration_tools/rebuild_zebra.pl -b -z --skip-deletes
5) Note the delete still has done = 0
6) Run misc/migration_tools/rebuild_zebra.pl -b -z
7) Note the delete now has done = 1

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also tested for authorities, no problems found.

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

RM note: this is at best a work-around, and I will emphasize that
--skip-deletes should be used only when absolutely necessary.

I hope that --skip-deletes can go away at some point soon, but
that may depend on changes to Zebra.

(cherry picked from commit b0870311e1b8fae10a6ab17d0e132e911c3ab3aa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10955: (follow-up) improve usage information

This patch improves rebuild_zebra.pl's usage help
by explaining when --skip-deletes should be considered
and noting that it should be used in conjunction with
a cronjob to process deletions after hours.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 03338b70e4de9866bd4afb69f0d8e5eeae3d7866)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>