Bug 9933: Unable to edit or add rules for any branch except default

To test
1/ Select a branch in circ rules
2/ Edit or add a rule, note this change is made for default instead of
the library you selected
3/ Apply the patch
4/ Try 1 and 2 again

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Works as expected.
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_9933' into 3.12-master
Bug 9591 : Set Library changes after viewing Holds Queue >> reserves item

To test
1. Log in to the staff client. Note your logged in library.
2. Navigate to Circulation -> Holds queue.
3. Select a holds queue report for a library other than your own.
4. From the holds queue report page, click the "Check out" tab and
   enter the card number of a patron who has holds.
5. On the circulation page for that patron, click the "Holds" tab.
6. Click one of the titles in the list of holds.

Your logged in branch will now match the library you chose for the
holds queue report.

Alternate sequence:

4. From the holds queue report page, click the "Check out" tab and
   do a non-exact search (search which will return more than one result)
   for a patron who has holds.
5. Choose the correct patron from the list of results.

Your logged in branch will now match the library you chose for
the holds queue report.

Apply the patch and repeat, this time it should not change your logged
in branch

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Weird bug, the patch works for me.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Good catch. All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_9591' into 3.12-master
Bug 9986: Two fixes for Z3950 search

Searching for stdid: Standard ID, srchany: RAW (any) somehow did not work
anymore.
Probably my fault :) Note that these two fields are in Cataloging Z3950 search
and not in Acquisition.

Fixing encoding problems: When adding -utf flag for CGI in acqui/z3950 and
cataloging/z3950, the decoding statements in C4/Breeding, Z3950Search should be
removed.

Test plan:
Search in Cataloging with:
Standard ID: 9782358670043 on LOC
RAW (any): musee [add an accent aigu on first e]  on LOC  -- Add diacritic!!!

Search in Acquisition
Somewhere, does not matter, but use a diacritic.

A note: My git version still has a hard time with utf8. Need to upgrade to version 1.7.10 to resolve this..

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

Comment: Work as described. No errors
Without patch z39.50 search for example Std ID OR musee gives no results,
with patch there are.
No problems in acq search.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Good catch, passes all tests and QA script.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9414 - Fix sample letters for German and Norwegian

Some letters were missing or not translated in the German and
Norwegian data for the webinstaller. This patch adds them.

German
- RENEWAL (present, but not translated)
- OPAC_REG_VERIFY (missing)

Norwegian
- RENEWAL (present, but not translated)
- ISSUESLIP (missing)
- ISSUEQSLIP (missing)
- RESERVESLIP (missing)
- TRANSFERSLIP (missing)
- OPAC_REG_VERIFY (missing)

To test:
- Install Norwegian and German* translations
- Run through the web installer in German, making sure that
  the sample letters are selected
- Check that there are no errors in the web installer
- Check <intranet>/cgi-bin/koha/tools/letter.pl - that the
  letters look OK, and are translated
- Repeat the process for Norwegian

* = I had some problems with installing the German
translations that are in master, but now I can't reproduce
it. If you run into a problem where only some of the
subdirectories of koha-tmpl/intranet-tmpl/prog/de-DE/modules/
are cerated, try downloading and installing the 3.10 .po
files from Pootle.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 58f42441bc8135ba2e322a6c6904c103682bac48)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9887 [Revised] Use DataTables on circulation page

The circulation page, when the  UseTablesortForCirc preference is
enabled, uses the old tablesorter plugin. It should use DataTables
instead.

This patch removes references to the tablesorter plugin and makes these
changes to enable use of DataTables:

- Pass two new unformatted date variables to the template from
  circulation.pl so that sorting can be performed on this data.
- Add DataTables configurations for the table of checkouts and the
  table of relatives' checkouts.
- Add a new plugin to the main DataTables configuration script to allow
  sorting on data embedded in a <span>'s 'title' attribute.
- Add <span>s to each table with a title attribute containing the
  unformatted date data which DataTables needs to perform correct
  sorting.  This eliminates the need for a special sorting algorithm to
  accomodate various date and datetime formatting options.
- Set a template variable for checking whether circ exports are enabled.
  This reduces repetition. DataTables configuration changes based on how
  many columns are present.

To test, load the circulation page for patrons who match various
conditions:

- Having only checkouts from today
- Having checkouts from today and previous days
- Having checkouts only from previous days
- Having relatives who have checkouts (from today, from previous days,
  from both)

Test these situations with UseTablesortForCirc enabled and disabled.
Test these situations with circ exports enabled or disabled (with
ExportRemoveFields filled or empty, for instance).

Sorting should work correctly on all columns with the dateformat
preference set to any option.

All other circulation functions should work normally.

Revision adds missing include for table footer when there are previous
checkouts and removes &nbsp; from empty table header cells which were
messing up auto-detection of numeric data. The global CSS for table
borders has been tightened up to improve handling of alternating row
colors in DataTables-sorted tables.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Note: Don't forget it's the checkout tab and to turn on the
preference to allow sorting there.
Also, while checkouts sorts dates correctly, sorting on the
details tabs was not always correct in my tests.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit ec9fc2fce4fef573cc337ff3de9b102d6dad3ded)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9905 - Use DataTables on calendar page

The calendar management page uses the old tablesorter plugin. This patch
replaces tablesorter code with DataTables.

In order to easily sort date columns under various dateformat system
preference settings, date columns now sort based on an unformatted date
in a <span>'s title attribute (requiring the patch for Bug 9887).

To test, view the calendar page--preferably with plenty of existing
holiday data to populate the holiday summary tables. Confirm that
sorting works correctly on all sorted tables with the dateformat
preference set in all settings.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Note: This has to be tested together with the patch for bug 9887.
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 2c2dfd91e7f58fd155362872f156224e8077cb58)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9463 [Revised] Use DataTables on patron sent notices page

Replace the tablesorter plugin with the DataTables plugin on the
patron sent notices page.

This patch adds default sorting by time (descending).

This patch depends on the one for Bug 9887, which introduces a new
DataTables plugin to allow sorting on data embedded in a <span>'s
"title" attribute. This allows sorting to be done on an unformatted
datetime.

To test, open the sent notices page for a patron who has multiple sent
notices. Confirm that table sorting works correctly with various date
format settings.

Revision corrects an error which occurs when there are no notices:
Instead of displaying an empty table with a message the table is not
displayed and a standard dialog message is displayed. In order to
prevent page-specific CSS and JS from conflicting with the standard
"message" class the page-specific classes have been changed from
"message*" to "notice*" Test this change by viewing a page with existing
notices and clicking the titles to show/hide the notice contents.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 9c3137bbf4716a12b9a68febfe201aed8a5b80de)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9172 - Move TinyMCE library outside of language-specific directory

This patch removes the TinyMCE library from its language-specific
location and puts it in intranet-tmpl/lib. The most recent version
of TinyMCE is used, and the files added have been limited to
those required for proper functionality of the editor.

Files omitted: documentation, examples, unused plugins.

To test, visit each page which uses the TinyMCE editor: News
editing (tools/koha-news.pl), library editing (admin/branches.pl),
and online help editing (help/edithelp.pl). The editor should
look and function as before.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
(cherry picked from commit 81714f8141de147a9133944057b059df47160315
 on github.com/KohaAloha/Koha-Dev:bug_9172)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Corrected authorship and date
(cherry picked from commit 77210d74353cbd2f968df462c2f1b968c3e7decd)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10061 - Fix tinymce path references broken by bug 9172

Only affects the package builds

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 15f58c257f8830dffb7b7d565f868f4614f2063d)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9894 - (3.12) de-serialize the 'hidden' value for subfields in frameworks

This patch aims to provide a non-intrusive way (with respect to Koha's code, so
it could have got into 3.12) for the users to easily choose the visibility settings
for each subfield.

This patch is also known to have arrived late for 3.12. I've been struggling with
other stuff at work, but I just wanted to put this somewhere just in case it can
be reused or something else.

The patch adds two JavaScript functions that deal with (de)serialization of the 'hidden'
value for subfields. One each way. Listeners are added to the checkboxes so the (actually, heh)
'hidden' value gets correctly updated on each checkbox change.

There's a costly function to update all checkboxes on every tab to match the 'hidden' value on page load.

To test:
- open the docs to have at hand the list of codes/visibility options combinations and
try changing several subfields from a single tagfield. Save, and reopen the "Edit subfields" page.
- I had a MySQL shell opened to repeatedly run this query (i tested against field 886
  on the default framework):
>  SELECT tagfield,tagsubfield,hidden FROM marc_subfield_structure WHERE frameworkcode='' AND tagfield=886;
- Compare what was saved on the DB with the docs for that visibility selection.

Regards
To+

PS: I promise I'll work on the proper patch for 3.14, which would involve DB structure changes and
(more than I expected) rewriten code.

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
I promise to hug you the next time we meet. This works, and is a reasonable work around for a very longstanding awkward interface.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 557857cf2c881fb7beec2019d3c85cef893c5342)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9894 - Followup: Add support for "flagged" values

Even though we don't know what they mean or do.

To test:
- open the docs to have at hand the list of codes/visibility options combinations and
try changing several subfields from a single tagfield. Save, and reopen the "Edit subfields" page.
- Click the "Flagged" checkbox - it should disable the other checkboxes as this setting is (apparently) exclusive to the others.
- Step through several tabs and set your visibilities as you like.
- I had a MySQL shell opened to repeatedly run this query (i tested against field 886
  on the default framework):
>  SELECT tagfield,tagsubfield,hidden FROM marc_subfield_structure WHERE frameworkcode='' AND tagfield=886;
- Compare what was saved on the DB with the docs for that visibility selection.

Bug 9894 - Help file updates

To test:

Click the Help link in the upper right hand corner of the MARC subfield editor
Verify that the epic list of values is gone
Verify that the help page overall looks alright
Verify that the help makes sense and is understandable.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 0a91a071efa49b77ca1ff2923aafbd9de1a1a481)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9894 - (3.12) Small followup

Liz's patch adds the 'flagged' value back, but there's a problem with its logic that prevents it to work on startup (works fine for changing values)

Regards
To+

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit a0680d0ca2ff9c7b087cd995b85d5614d902e2d9)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9894: Add labels for checkboxes

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit e3a9d492cc5ca142784c3e385867cd5a04b26ce8)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9737 - Local Covers sometimes appear then disappear on OPAC Search Results/Lists

The current problem:

When the verify_images() function runs from amazonimages.js, it loops
through every img element and selects the elements that come from Amazon
sources.

However, if the height/width is 1 (i.e. Amazon passes off a blank image)
or if the img element's complete property is null or non-existent, then
it searches for the parent node and re-writes the HTML with the "No
Cover Image Available" (NO_AMAZON_IMAGE) text, even though that parent
node might contain other img elements that have images available (from
Google, local images, etc)!

Proposed fix:

Wrap the Amazon image in a span tag (as we do with the Google and local
covers), so that it re-writes the HTML within that parent span, rather
than the parent anchor which contains all the other images.

To test:

1) Turn on the OPACAmazonCoverImages, GoogleJackets, and
   OPACLocalCoverImages system preferences
2) Replace the ISBN in one of your records with 9780615352435
3) Now load a local cover image for that record
4) Search for that record (but make sure you're vague enough to have
   multiple search results)
5) For a split second, you may notice the local cover image appears before being replaced by a "No Cover Image Available".

Now apply this patch

6) Refresh your search results page
7) You should now see your local cover image, PLUS the "No Cover Image
   Available" for the Amazon image, and whatever other graphics/"no
   cover image available" "graphics" for the Google Jackets.

To be comprehensive, try the same set of steps using the OPAC Lists
rather than the OPAC Search Results

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 2e4747566457d807fef88dff8332c3db18b86b49)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9997 - Suspected typo in patron self registration code

String fix. The field name is also incorrect, causing the alternate
contact country to not be stored.

To test: Submit an update to an existing patron record an include a
change to the alternate contact's country field. Before the patch this
line would not appear in the staff client for approval. After the patch
it should.

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

Reminder: Even small patches require test plans. I have added one which
I think covers the changes in the patch.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 3cd8189fa862164a64215a8c1d8690645c5397f2)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10042 - Minor typo ("Communnity") in packages docs

VERY trivial string patch. Couldn't help sending it.

To+

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Thanks for fixing my typo! I did not test by building packages
etc, but by grepping for "Communnity". The patch removes
all occurences of the typo.

Passed-QA-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit fd3aed11ec912fc09161db12f18f26c7e0279c51)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10008 - Serials search results 'Opened' tab should be 'Open'

The searials search results "Opened" tab should be labeled "Open." This
patch makes this correction and changes the wording in another place
which used "opened." Markup has also been added to maintain consistency
in display of messages.

To test, perform a search for a subscription. If your search returns
results you should see an "Open" and a "Closed" tab. To test other
affected changes perform searches which return no results, only open
subscriptions, or only closed subscriptions. "No results" messages
should display correctly and consistently.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit ce1c6ce4d22ee9226f65ec8a1b69874629113df7)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10002 - Don't include line breaks in strings that are translated

Several JS alert messages contain "\n" which is problematic for
translation. This patch removes those instances (a line break is not
strictly necessary anyway). Also corrected: two instances of "holds(s)"

To test, place a hold on a title with items. From the biblio detail page
choose Edit -> Delete all items and Edit -> Delete record. In each case
you should see error messages with no line breaks and no misspellings.

Delete all items attached to the record with holds from the item edit
page. Go back to the detail page and choose Edit -> Delete record. You
should see an error message about existing hold(s) with no line breaks
or misspellings.

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

Harmless change, fixes misspellings and makes translations easier

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 24d9d9c1712526cb0fe0a000fe255bfd8dbf1d22)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>