Bug 11279: Improve how a new quote of the day is selected
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Wed, 11 Dec 2013 23:54:08 +0000 (00:54 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 7 Feb 2014 15:12:06 +0000 (12:12 -0300)
commitbff00739703bd38951b171078f0413d3413705fe
tree2c9db2751ff54c4089f1d4b3fe14752236371906
parentcc71930a84761177279554dc467e23bf9d736f62
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>
(cherry picked from commit 5a3db23362eb076a2f6d5a87f87b29f4a436a14f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ae55277499f06ae0d3e2973349d1f34cf7f60ec8)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Koha.pm