Bug 9330: title field empty when duplicating a patron

For a duplicated patron, the "Saluation" information
is now empty by default.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9556: fix setting messaging prefs when changing patron category

As a result of accumulated changes to field names returned
by the members/default_messageprefs.pl service, the JavaScript
to change the patron messaging preferences to the category default
when changing a patron's category in the patron editor stopped
working.

To test:

[1] Turn on the EnhancedMessagingPreferences feature.
[2] Set message preference defaults for at least two
    patron categories.
[3] Before applying the patch, create a new patron record
    using one of the categories you set prefs for, then
    change the category, then change it back again.  You
    will see that numeric settings like the number of days
    for advanced notices will change, but checkboxes won't change.
[4] Apply the patch, then create a new patron record and
    try changing the patron category.  You will see that all of
    the preferences will get updated to the category default
    each time you change the category.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9392: confirmation does not appear for negative notforloan items issues

When checking-out an item marked "not for loan" with a positive value,
you get a message to forbid or confirm issue (depending on
AllowNotForLoanOverride syspref).  For an item with a negative value
(usually during acquisition process), the issue is made without forbid
or confirm message.

This patch simply changes the test notforloan > 0 into notforloan != 0.

Test plan :
- Checkout an item with items.notforloan = 0
=> The item is issued without message
- Checkout an item with items.notforloan > 0
=> A message forbids or asks confirmation to override
- Checkout an item with items.notforloan < 0 (e.g., on order)
=> A message forbids or asks confirmation to override

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Checked with AllowNotForLoanOverride on and off.
All tests and QA script pass.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 5790 - Prevent deletion of records with holds

Test Plan:
1) Apply patch
2) Create a record
3) Create an item for the record
3) Place a hold on the bib
4) Attempt to 'Delete all items', you should recieve
   an error message stating to delete all holds before
   deleting all items.

Also, it is possible to get into a situation where a record has
holds but no items. In this situation, it is not possible to
view/delete the holds without adding an item back to the record.
In this case, attempting to delete the bib causes a warning, but
does not prevent deletion.

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Passes tests - do note that it was a design decision to leave the delete links clickable even though they are grey.
The reasoning is that librarians will want to be able to know *why* they cannot delete a given item or bib - I like this.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 5790 - Prevent deletion of records with holds - QA Followup

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
fixes qa concerns, feature still works

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9608 - White background on header on check in

The white background behind the header search form on the checkin
page appears because the search include is missing a <div> which carries
the background gradient CSS. This patch adds the missing markup to the
checkin search header include file and 6 others.

To test, view the following pages and confirm that the normal gradient
background appears behind the header search form:

- Checkin
- Contracts administration
- Currencies administration
- Notices and slips
- Printers administration (admin/printers.pl)
- Stop words administration (admin/stopwords.pl)
- Adding an order to a basket from a suggestions (Acquisitions -> Basket
  -> Add order to basket -> From a suggestions).

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9555: Another template contains single quotes in a js string

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9035 - delete bulkauthimport.pl

<dcook> Then bulkauthimport.pl?
<jcamins> bulkauthimport should not be used ever.
<eythian> it probably should be deleted
<jcamins> It should be.

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

I've poked around in bulkmarcimport.pl and it certainly seems to have the functionality that Mason (and Jared and Robin) mention.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9019: Return item fields in ILS-DI GetRecords

Signed-off-by: Srikanth Dhondi <srikanth@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

1) Activate ILS-DI in system preferencs
2) Access http://.../cgi-bin/koha/ilsdi.pl to see documentation
3) Try http://.../cgi-bin/koha/ilsdi.pl?service=GetRecords&id=12+14
   with various valid biblionumbers for your system
4) Verify 952 is included in the <marcxml> and all other data displays
   correctly

All tests pass.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9213 - Implement analytics for NORMARC XSLT

Problem:
Links between anaytics records were not being displayed for NORMARC setups.

What this patch does:
1. Add indexing for 773 subfield a, w and 9; both for GRS-1 and DOM indexing
   (The DOM indexing config was generated from the GRS-1 record.abs)
2. Add "analytics links" to NORMARC XSLT files, both for OPAC and intranet

To test:
- Make sure you have a NORMARC installation
- Set UseControlNumber = Use
- Create a parent record with LDR/07=c. Leave 001 empty.
- In the "Normal" view, do New > New child record and create another record. Do
  this twice (so you get a list of hits when you click on the "Show anaytics"
  links later on).

- Do the following steps both in the OPAC and the Intranet:
  - Search for the parent record in such a way that you can see the record in a
    *result list*
  - Check that the "Show analytics" link is displayed, and uses the title of the
    parent record for linking: ?q=Host-item:<Title of parent record>
  - Clik on the "Show analytics" link and check that you get a result list with
    the two child records you created earlier
  - Go back to the result list and click on the parent record, so you get the
    *detail view*
  - Check that the "Show analytics" link is displayed, and uses the title of the
    parent record for linking: ?q=Host-item:<Title of parent record>
  - Clik on the "Show analytics" link and check that you get a result list with
    the two child records you created earlier
  - Search for one or both of the child records in such a way that you can see
    the record(s) in a *result list*
  - Check that the "In: <Title of parent record>" link is displayed, and that it
    uses the biblionumber of the parent record for linking:
    ?q=Control-number:<biblionumber of parent record>
  - Click on the "In: <Title of parent record>" link, and check that the parent
    record is displayed
  - Go back to the result list and click on the child record, so you get the
    *detail view*
  - Check that the "In: <Title of parent record>" link is displayed, and that it
    uses the biblionumber of the parent record for linking:
    ?q=Control-number:<biblionumber of parent record>
  - Click on the "In: <Title of parent record>" link, and check that the parent
    record is displayed

- Now edit the parent record and put it's biblionumber in 001. Repeat the steps
  above, and check that everything still works, but that the links are different:
  - The "Show analytics" link on the parent record should look like this:
    ?q=rcn:<biblionumber of parent record>+and+(bib-level:a+or+bib-level:b)
  - The "In: <Title of parent record>" link on the child records should be the
    same as it was earlier

- Now set UseControlNumber = "Don't use" and repeat all of the steps above
  - All of the links should still be displayed and work, of course
  - The "In: <Title of parent record>" link on the child records should look
    like this: ?q=ti,phr:<Title of parent record>
  - The "Show analytics" link on the parent record should look like this:
    ?q=Host-item:<Title of parent record>

- Change LDR/07 to "s" and repeat all of the steps above
- Do all of this both for GRS-1 indexing and for DOM indexing...

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

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 7241: circulation action logs record biblionumber instead of item number

Issue log and and circulation logs are incorrectly recording biblionumber instead of item number, creating incorrect logs.
This patch corrects this, and modifies the action_logs table in two ways:
- the timestamp is not updated anymore with UPDATES (but still automatically filled when INSERTing)
- to partially correct the broken logs, the log history is filled with the first found item for each biblio

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 7241 follow-up: DB changes

Reset timestamp modification on update after patch application.
Give more information about the log history fix.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 7241, follow-up: viewlog link for circulation

Fixes a few things about the CIRC link in viewlogs:
- "itemnumber=" instead of "item="
- anchor #item was filled with the wrong field
- tooltip now indicates "item" instead of "biblio"

Signed-off-by: Adrien Saurat <adrien.saurat@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9759: last subfield can be deleted

In authorities and biblios editors, a repeatable subfield can be deleted (small icon next to input).
Clone subfields are really deleted but last existing subfield is just set empty instead of deleted.
But when same field is repeated, the last subfield can be deleted.

This patch corrects this, last subfield of a field, even repeated, can not be deleted.

Test plan :
- Edit a biblio
- Choose a repeatable field with a repeatable subfield : ie 600 and $x
- Edit 600, enter a text in $x : ie "subA"
- Clone $x
- Delete second $x
=> second $x is deleted
- Delete first $x
=> $x is not deleted but set empty
- Edit 600, enter a text in $x : ie "subA"
- Clone 600
- Edit second 600, enter a text in $x : ie "subB"
- Clone $x of second 600
- Delete second $x of second 600
=> second $x of second 600 is deleted
- Delete first $x of second 600
=> with this patch : first $x of second 600 is set empty
=> without this patch : first $x of second 600 is deleted, second 600 has no $x anymore
Perform same test plan on an authority.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9720 : uninitialized value warnings in circulation

This patch corrects several uninitialized value errors.

Test plan:
- Go to check out page
- Check that issues and old issues are in different tables
- Check that author is diplayed if exists
- Check that patron address is displayed if exists
- Perform a checkout

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 9720 : uninitialized value warnings in circulation (followup 1)

This patch corrects several uninitialized value errors.

Test plan:
- Edit a borrower
- Enter a surname using lowercase (it will be displayed uppercase by CSS) and save
=> Borrower surname is uppercase
- Edit an organisation (depends on borrower category)
- Enter a surname using lowercase (it will be displayed uppercase by CSS) and save
=> Borrower surname is uppercase
- Go to a borrower page who has today issues
- Click on More/Export today's checked in barcodes
=> You get a file to dowload

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 8508 - Holds to Pull : Library dropdown options are erroneously concatenated by br tags

This patch introduces a new javascript function that breaks apart option
strings that are erroneously concatenated by br tags. The split strings
are then checked against non-concatenated option strings, and pushed into
the option array if there is no duplication.

This function is nestled into the JQuery datatable function for populating
the drop-down menu.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 8508: Followup: Simplify the separateData js function

I think this patch does the same job as previously.
+ It replaces tabulation characters with 4 spaces

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9484: userid not generated consistently (different editing pages)

When modifying a patron through different pages, the userid
generation does not behave always the same way; this patch
corrects this:
- when firstname and surname are present in the form, they
are used for the generation;
- if there are not in the form, the firstname and surname
in database are used instead.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Work as described. No errors.
Test
This patch lacks a test plan, so I do the following
1) New user, empty userid, autocompleted
2) Edit user, change userid, saved correctly
3) Edit user, main edit window, emptied userid, autocompleted
4) Edit user, Detail > Library use, emptied userid, not autocomplete (not even a dot)
5) Applied patch
6) Repeated 1-3, same behavior
7) Repeated 4), now autocompletes with same userid as 3)

So, works as described.
No koha-qa errors.

NOTE: It's impossible now to delete userid from interface.

Off-topic: tried an userid in Arabic, works very well.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9479: The member notices page doesn't display dates in the syspref format

In order to let the KohaDates plugin display a datetime, this patch
modify this plugin.
Now it uses Koha::DateUtils instead of C4::Dates.

Test plan:
- check that the date format on the member notices page
  (members/notices.pl) is displayed according your syspref dateformat.
- check that existing dates are always in the good format (without the
  hours) e.g. acqui/histsearch.pl, acqui/basket.pl, etc.
- Modify your syspref and recheck the previous pages

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

This is a nice addition, and works according to the test plan. A nice
follow-up would be to create a system pref for formatting times
(12/24hr).

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixed a tab in notices.tt to make QA script happy.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>