Bug 9673 - Track when items are marked as lost or withdrawn

Add date fields to track when an item was marked as lost or withdrawn.
Display those fields on catalogue/moredetail.pl

Test Plan:
1) Apply patch
2) Run updatedatabase.pl
3) Pick a record with items, browse to the 'items' tab ( moredetail.pl )
4) Mark an item as lost, verify the field "Lost on:" displays below
   the "Lost status" field with todays date.
5) Mark the item as not lost, verify the field no longer displays
6) Repeat steps 4 and 5 with the Withdrawn field.

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
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>
Bug 9673: QA followup

This followup fixes the wthdrawn typo exist in updatedatabase.pl and
does not display the lostitem date if the lostitem value is not set (!=
"").

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9673: DBRev 3.15.00.007

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9673: (follow-up) update DBIx::Class schema classes

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11279: regression test for picking random quote

This patch adds new tests based on the db_dependent tests in
t/db_dependent/Koha.t for GetDailyQuote().

Tests run on an empty database and don't require Test::Deep.

Tests will fail before applying the patch for 11297, but will
pass after applying the patch.

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11279: Improve how a new quote of the day is selected

If there is a gap in the id sequence for the quotes table, it
is possible that no new quote will be selected. This will happen
particularly when a lot of the older quotes with low ids have been
deleted.

This patch improves the selection of a new quote.

To test:
- Load sample quotes
- Delete the first half of the quotes.
  Note: With 34 quotes, delete the quotes with ids from 1-17
- Activate the QuoteOfTheDay system preference
- Check if a quote is displayed in OPAC
- Reload the page a few times, no quote should be displayed
  Note: make sure you don't have a quote with the current
  date in your quotes table before running those tests
- Run 'perl t/db_dependent/Koha.t'
  Note: requires sample quotes!
- Apply patch
- Reload the OPAC start page
- Verify a quote was now picked
- Run 'perl t/db/dependent/Koha.t' again - all tests should still pass

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

Patch modified to use "LIMIT 1 OFFSET ?" rather than "LIMIT ?, 1"; the
latter construction does not work in PostgreSQL.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11279: (follow-up) remove unnecessary check on number of quotes

It is not necessary to process the case where the number of quotes
is just one, as int(rand(1)) will always produce 0, which is a valid
offset.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11417: make sure remove_unused_authorities.pl accepts --test

This patches adds support for the --test option, as well as a
short message telling the user the script is running in test mode.

Test plan :
- Launch the script with -h to see the help
- Launch the script with --test and --aut with an authtypecode
  that is used in your instance
- Make sure it does the same thing as launching it with -t
- Launch the script for real and make sure it still works as
  expected, deleting unused authorities.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11228: Improve hint on patron notification when adding/editing subscriptions

The hint was not quite correct, as it said patrons on the routing list
would be informed, but it's only the patrons that have subscribed to
email notifications in the OPAC who will receive the email when a
new serial issue is received.

To test:
- Add a new subscription, find the hint about patron notification on the form
- Apply patch
- Refresh page
- Verify the new hint text makes sense and is correct

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11179: make OPAC course details page display status of checked out items correctly

If an item is listed for a course and is checked out, the item will
still show as being available from the course details page which lists
all the items that are part of a course. This is due to the way the
course reserves system handles items and issues separately, while
item-status.inc assumes the due date has been embedded in items.datedue

Test Plan:
1) Create a course
2) Add an item to that course
3) Check the item out to a patron
4) View the course details from the opac
5) Note the status says "Available"
6) Apply this patch
7) Repeat step 4
8) Note the status no longer says "Available"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11179: (follow-up) apply fix to Boostrap theme

This follow-up applies the same fix to the Bootstrap theme. This patch
also includes the changes to item-status.inc in the Bootstrap theme
which were made to the prog theme in Bug 10820: display item status as
lost if item is both lost and on loan.

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Bootstrap theme looking so nice. Also the patch works.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11179: (follow-up) add comment to item-status.inc

This patch adds a comment to item-status.inc to describe
the parameters it can accept.

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