Bug 11503: fix several typos

This patch corrects several typos: Some reported in Bug 11503, others
found during a systematic spell check of the help files.

To test, examine the changes and confirm that the spelling changes are
correct.

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>
(cherry picked from commit a5c762d491465bcc7ad8d8f5e94ff5c36c172091)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11503: [Follow-up] fix another typo

There is still a typo left to fix which I didn't catch because I was
doing a spell-check and didn't double-check the bug report:

Van der Griten -> Van der Grinten

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>
(cherry picked from commit 5c67d182ea718a37032edabbe000933776baa251)
Bug 11509: (trivial rmaint followup) wrong parameter count

While adding the --help and -h switches I forgot to change to arguments
count validation so that one can actually use those parameters (i.e.
koha-create should accept being invoked with only one parameter).

This patch just changes the minimum parateres required from 2 to 1.

To reproduce:
- Run 'koha-create --help' from master
=> Usage information is printed BUT ALSO an "Error: wrong parameters"
   message
- Apply the patch and
- Run 'koha-create --help'
=> Usage informatio it printed and no error message.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 692c4f03b5adebec754c1a8db16e2db97c63f554)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11381: improve styling of IDreamBooks content in bootstrap theme

Styling of IDreamBooks elements is not correct in the bootstrap theme
because the relevant CSS was not transferred from the prog theme. This
patch adds it back.

To test, switch to the bootstrap theme and enable IDreamBooks system
preferences in the OPAC, particularly IDreamBooksReadometer. Find a book
in the OPAC which shows IDreamBooks review data and confirm that
everything looks correct.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described. Tested with "The help".

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit f2c61429944140abfd0a097bdb50b03e08ef569b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11505: fix untranslatable table headers in Label batch manager

The label batch manager script hard-codes the table header cell labels
in order to pass them to an HTML-building function. This obviously isn't
the best solution for internationalization, but picking the whole scheme
apart would be very complicated.

Instead this patch uses a SWITCH statement to check for each possible
case and outputs the correct translatable string for each.

To test, apply the patch and run "perl translate update" for any
translation. Check the revised po file and confirm that the new strings
are present. View the label batch edit page and confirm that the table
headings look correct: Tools -> Labels -> Manage batches -> Edit batch.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests.
Similar fixes are probably needed for other pages of the labels
modules.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit e8f5ee9eef7a558ae1af8237493f8dc52e52945a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11502: make library filter in "Holds To Pull" more precise

This patch uses regex checking via the DataTables fnFilter API method
to make the branch filter more precise on the "Holds to Pull" page.

The ability to use regex is built into DataTables so this just adds
the actual expression.

_TEST PLAN_

Before applying:

1) Add library (branches) with codes of NM, NMH, and NB
2) Add items (that can be placed on hold) at all these branches
3) Place a hold on an item that is only available at NM
4) Place a hold on an item that is only available at NMH
5) Place a hold on an item that is only available at NM and NB
6) Go to "Holds to Pull" in the Circulation module
7) Filter by these three different values
8) Note that filtering by "NM" will incorrectly bring up all three
holds, while "NMH" and "NB" will only pull up one (like they should).

Apply the patch.

9) Shift+refresh the page so that your Javascript refreshes
10) Repeat step 7 (filtering by the different branch values)
11) Note that filtering by "NM" will now only bring up the hold for "NM"
and the hold for "NM" and "NB", while the others still only bring up
one hold.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit e96d73aa9f462fb653b8b67d7d5bff81dab94be7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 9210: wrap long lines in printed hold notices

This commit adds wrapping styles to print-notices.tt template

Test plan:
  * place a hold on a title with a very very long title or author
  * mark it as "waiting for pickup" by doing a checkin
  * go to command line interface, and run
  * misc/cronjobs/gather_print_notices.pl /tmp
  * misc/cronjobs/printoverdues.sh /tmp
  * if your title/author is long enough, it's split on 2 lines
    with this patch (it is not before this patch)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 06a8b6f314ded89fa6b4f94276e68e390b7afc3a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11522: improve formating of self-registration form

1. in prog theme, enable opac self-registration and inspect clear date
   with firebug; note that there are empty paragraph tags
2. add date of birth as a requirment in self-registration
3. apply patch
4. refresh page and notice that empty paragraph tags have been deleted,
   so that required lines up with clear date
5. repeat the above steps for bootstrap theme

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>
(cherry picked from commit 42ec10670efb6e33fa23537c1037ff9087f55e30)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 7143: Updating about page and history

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ef7480f362a0286b13e1ba1b99e58c6d2ca7ba72)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 7143: add another name to the about page

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4e4a33ef5deecc32711092d78d87f2eefe3fbcf5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 9788: Improvements when calling GetReservesFromItemnumber

This patch makes GetReservesFromItemnumber also returns the waiting
date and removes some repeated code.

Improves item status display on catalogue detail, when placing a hold at
opac-reserve and in staff, and on transfers to receive form.

This patch builds on work from reports 9367 and 9761.

Test plan:

Place a future next-av. hold (enable future holds prefs), say 2 days ahead.
Check item status on catalogue detail. Nothing to see.
Enable ConfirmFutureHolds by inserting a number of days, say 2.
Confirm earlier hold by checking it in. Look at item status again on detail.
Switch to other opac user. Try to place a hold again. Check item status with
item level hold info. Try to place hold in staff, check item level status.
Make a transfer for that item. Switch branch. Look at transfers to receive.

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 1a9737be768aa1e585addc596e2fcb5a77482c38)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 9788: (follow-up) removing the alldates parameter from GetReservesFromItemnumber

Before bug 9788 the alldates parameter of GetReservesFromItemnumber was
actually not used in the codebase.
The first patch of bug 9788 did change that and passed true by default.

But a closer look revealed that we do not really need it.

The parameter is removed by this patch; the SQL statement is slightly
adjusted: if reservedate<=now or a waitingdate is filled for the
requested itemnumber, GetReservesFromItemnumber will return the reserve.

This includes so-called future waits: a future hold that has been confirmed
ahead of time with pref ConfirmFutureHolds > 0 days.

Note that future item-level holds are not really interesting to return; this
just corresponds to original behavior. Future next-available holds are not
in view at all; they do not contain an item number.

Test plan:
Actually, the test plan of the first patch is valid. But for completeness I
repeat it here:

[1] Enable future holds and set ConfirmFutureHolds to 2 days.
[2] Place a future next-available hold for 2 days ahead.
[3] Check item status on catalogue detail. Available? That is fine.
[4] Confirm the future hold by checking it in. ('future wait')
[5] Look at item status again on catalogue detail. Must be Waiting now.
[6] Switch to OPAC and login as another opac user. Goto Place a hold.
[7] Check item status with item level hold info. Is it waiting?
[8] Try to place hold in staff, check item level status again. Waiting?
[9] Make a transfer for the item. Switch branch. Check hold status on
    Transfers to receive.

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 92be11bbcf20628dd7db8b83fc0b902ba578a28a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 9788: (follow-up) for expirationdate in Letter.pm

Pasting comment from the Bugzilla report:

Looking bit longer at this code, it is kind of strange to find it
there in the first place. Adding maxpickupdelay in Letters.pm should
not be there, but it is..

Also this date is not used normally in the default HOLD Available for
Pickup notice (that we are generating in this case). And if it would be
undef, the expiration date should imo be empty instead of today+0.
(before adding maxreservespickupdelay, you should test the allowexpire
pref first) So it is an (invisible) bug on its own.

Test plan:
See former patch. Kyle just discovered this bug, apparently by
deleting the maxpickupdelay pref..

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 a23d4181b1e756a61a036059b8b909d4f0d30537)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 9788: QA followup

1/ CURRENT_DATE() is a MySQLism and should be replaced with CAST(now() AS
DATE).
2/ The date formatting should be done in the template (using the TT
plugin).

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 38edd714c598322e81a32a0dfc5f2ce0da46826d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 9788: (follow-up) Unit tests for changed routine GetReservesFromItemnumber

Adds three tests to Reserves.t for GetReservesFromItemnumber.
We test if this routine does not return a future next available hold,
a future item level hold. And if it does return a future wait (that is:
a confirmed future hold, using ConfirmFutureHolds).

Note that Holds.t does also contains some basic tests for this routine,
but the additional tests seem to better located in the direct context of
tests for bug 9761 for ConfirmFutureHolds.

Test plan:
Run both t/db_dependent/Holds.t and t/db_dependent/Reserves.t.
Verify if both tests do not fail.

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 d211fa50ede180ed511cdf7f55be6c084abc1ff5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 9788: (follow-up) update the bootstrap theme

This patch applies the change made in the QA follow-up
to the Bootstrap theme.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit a776c7764050290d20ad4e5200aaed11a3983bf7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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>
(cherry picked from commit 69216d2217519cd6d8ad97710236251abdd89ae9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11018: allow adding order from a reverted MARC batch

Weird behavior:
When an import is undone into catalog, the status is set to "reverted".
But if you open the add orders from iso2709, the status is automatically
set to "imported" and does not appear in the list.
So it is not possible to import a reverted batch.

[RM note: since a reverted batch is nonetheless a staged batch, and
could be reused, allowing orders to be placed by taking bibs
from a reverted batch is not as odd as it might sound.  It *can* look
odd for a staged or reverted batch to contain records that are
imported, but that's a long-standing oddity.]

Test plan:
- verify you reproduce the weird behavior
- apply this patch
- import a file and the batch into the catalog
- verify (in the your mysql/MariaDB cli) the status is "imported"
- verify it does not appears in the add orders from iso2809 page
- undo the import
- verify (in the your mysql/MariaDB cli) the status is "reverted"
- verify it appears in the add orders from iso2809 page and the status
  is always "reverted"
- finish the order

Signed-off-by: Pierre Angot <tredok.pierre@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4bd730d4c24440c157801b68e248002b10ec0dd3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11476: remove extra empty option from title pull-down in OPAC self-registration

If you have patron titles enabled, the OPAC patron details form lists 2
empty spaces instead of 1. An empty option is passed by the script, so
the template does not need to include one.

To test you must have at least one patron title set in BorrowersTitles
system preference and OPACPatronDetails must be set to "allow."

1. Apply the patch
2. Log in to the OPAC
3. Click the "personal details" tab.
4. Click the "salutation" dropdown. There should be only one blank line
   preceding the existing titles.

Test in both prog and bootstrap.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described for existing and creating new accounts.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit a8aa6e8f7efd1ea29fdbd99cf3e573e72b424eb5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11473 - Fix log viewer template conditions

This patch adds the 'loopro' key to the 'module' value, so that
conditions are actually triggered in the template logic.

(Note: loopro.CIRCULATION is valid, but I changed it for the sake
of consistency across the different conditions.)

This patch also adds substr checks to the 'info' column when
using the cataloguing module. This will check for 'item' and 'biblio',
so that the appropriate label qualifer can be shown in the log viewer.
If either term is absent, the unqualified number will be shown instead
(this will be the majority of action logs at this point).

_TEST PLAN_

Before applying:

1) Access log viewer from Tools (or wherever really)
2) Look up logs for circulation, patrons, cataloguing, serial,
authorities, etc.
3) Note that the "Object" will always just be a number without qualification.

After applying the patch:

1) Look at those same logs
2) Note that the object number for borrowers will usually be prefaced
by 'member' (notwithstanding FINES which aren't taken into account in
this template yet); new bibs and new items should say 'Item X' or
'Biblio X'. Serials should have a link. Authorities should have a link
and an 'auth' preface.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Works as advertised

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ac6fb12c9aff29a652ee10c960ab10309d22adee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>