Bug 9294 - Move JavaScript out of circulation template

This patch creates a new js file, js/pages/circulation.js, and begins
the process of moving JavaScript into it from circulation.tt. I have
started the process by focusing on sections which are least dependent on
template variables.

To test, load a patron for checkout who has something checked out.
There should be no JavaScript errors:
 - Tabs should work.
 - Showing and hiding the "Add message" form should work.
 - The "specify due date" datepicker should work.
 - Controls for selecting checkboxes in the checkouts table should work

Signed-off-by: Campbell Reid-Tait <campbellreidtait@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Just found a weird behavior with checkboxes in the checkouts table, but
still exists on master.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 249b37ef488d90d8cd9104c4d3d806f7a30590d8)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9294: Followup : add missing lines.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit da9863f1a5225d3af7daac1e4874e42fbd7dd369)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10884: circulation table: fix odd behavior on checkboxes

Test plan:
Play with renew, check in and export checkboxes.
The expected behavior is: the renew and check in cb should work as radio
button, without affecting the export cb.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template changes only.
Amended test plan:
* Create a CSV profile under Tools > CSV profiles
* Add CSV profile to system preference ExportWithCsvProfile

1) Check export checkbox
2) Check check in for same item
3) Switch to Renew

The export checkbox should not get unchecked when switching
between renew and check in.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit fa3903fe3d4955e2fd36613a7d7ac7f3a363913a)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10935: fix breakage of CSV acq exports when using a non-English translation

To reproduce:
- cd misc/translator
- ./translate update LANG
- ./translate install LANG
- go to the Koha mainpage and change the language.
- go to acqui/basketgroup.pl?booksellerid=XX and try to export a
  basketgroup.
The headers is followed by the first basketgroup information. There is
no carriage return.

It looks like it is caused by a routine used by the translator script
(TmplTokenizer::string_canon).

To test this patch:
- apply it
- cd misc/translator
- ./translate -f update LANG
- translate headers in your po file
- ./translate -f install LANG
- go to acqui/basketgroup.pl?booksellerid=XX and try to export a
  basketgroup.
- verify that the csv looks good now.
- same thing for basket.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Good idea and seems to work - just fixing a small glitch
with the first entry of the list in a follow-up.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 6bf848303fd4a0d827cc688dab907166df701102)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10935: (follow-up) adding a line break to fix first list item

Without the line break after the include the first entry
of our list of orders was behind the header row in the first row
of the spreadsheet.

Adding the line break seems to fix that and translated CSV can
be exported correctly now.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit b1e4db6be9bbb18c07c16f0eb2ad02867cf938de)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10535: (follow-up) add test case

This adds a test case for the new default sort
order for GetBudgets().

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 5a384cc64367647aa519c196ae8927d309b1ec19)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10535: (follow-up) wrap Budgets.t in transaction

This patch also temporarily removes any existing
budgets to avoid issues where tests can fail if there
is already an active budget in the database.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 969669bb1e2cb08bbfc91334b6c52e3dd0413e11)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10038: fix doubled 'default' entry when creating a new authority type

Test plan:
- Create a new authority type
- Click MARC structure
- Verify the pull down has only 1 entry for Default
- Go on the authority type home (admin/authtypes.pl)
- Click on the "MARC structure" link for the default type
- Verify the pull down has only 1 entry for Default

This patch adds a sort (on the authtypecode) for these 2 lists.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Works as described. No koha-qa errors.

When creating a new framework it would be better to have Default
on top, but one is way better than two :)

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Agreed, one is better than two :)
All tests and QA script pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit b04118df82a20eeec71bfb99349ab28943011c42)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10038: (follow-up) fix tabs

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ce9f504c7903d7431c8e18754f18ddf5bca2727a)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10850 - give quick spine label template page its own ID

Out of three conditional cases for display of the <body> tag one lacked
a unique ID. This patch copies the unique ID from the other cases to the
one lacking.

This patch also corrects the case of an "onload" attribute which should
follow XHTML style rules.

To test, the patch for Bug 9618 must be applied. Set the
SpineLabelAutoPrint system preference to "[don't] automatically pop up a
print dialog." Submit a barcode on the quick spine label creator and
view source. The <body> tag should have an ID attribute.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 5fe524cf3ab0ff78401e7b467823da4d62d9a537)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10298: Followup: Adapt existing code

This unit tests file does not need the t::lib::Mocks::Context module.

To test:

prove t/db_dependent/Circulation_issuingrules.t

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, test checks out.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit a765d5f88e125e0f43e2e5cfe766bc22f0fd0d08)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10298: Mock C4::Context->preference

t::lib::Mocks::Context tried to deal with preferences but did not manage
to.

This patch removes this module and add 2 routines in t::lib::Mocks in
order to mock C4::context->preference and C4::Context->config.

To test:

===START t/test.pl===

use Modern::Perl;
use t::lib::Mocks;
use C4::Context;

say "initial value for version: " . C4::Context->preference('Version');
say "initial value for language: " . C4::Context->preference('language');
t::lib::Mocks::mock_preference('Version', "new version for testing");
say "version is mocked with: " . C4::Context->preference('Version');
say "language is not yet mocked: " . C4::Context->preference('language');
t::lib::Mocks::mock_preference('language', 'new langage for testing');
t::lib::Mocks::mock_preference('Version', 'another version for testing');
say "version is mocked with another value: " . C4::Context->preference('Version');
say "language is finally mocked: " . C4::Context->preference('language');
===END===

Try to execute this file and check that the output is consistent.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit eb90241c7941760a79c48c745c8fd938780490a8)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10843: fix crash that can occur when confirming hold if ReservesMaxPickUpDelay is undefined

Test plan:
1) set an empty string for the ReservesMaxPickUpDelay pref
2) place a hold on an item
3) check in the item
4) click on "Print and confirm"
5) an error occurs
> The 'days' parameter (undef) to DateTime::Duration::new was an 'undef'
6) apply the patch
7) repeat steps 1 to 4
8) the error does not occur anymore.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
An empty string didn't do it for me, I had to set the
variable for the systempreference to NULL. I am not sure
if this can happen when editing from the interface, but
this change should not have any ill side effects and it has
unit tests!

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit a9b564678e184b44b4c54d72e21f66efc3810f4e)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Adjusted some bits.
Bug 8368: fix email lists from OPAC when using non-English templates

This patch ports to list sending by email, the technique used in sending
cart, i.e. (1) format email in HTML, and (2) transform it into Text with
TT filter html2text.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixes a very annoying translation bug successfully.
Also passes all tests and QA script.

To test:
- Add a few records to a shelf, ideally use some with diacritics.
- Send shelf from English templates, verify email is ok
- Send shelf from translated templates (de-DE or similar) - verify
  email content is broken.
- Apply patches, update po files and reinstall the language.
- Send shelf from English templates again, verify there is no
  regression.
- Send shelf form translates templates - verify this email is now
  also working correctly.

Patch also changes the name of the file attachement from shelf.iso2709
to list.iso2709.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit bbcc715c9435fc82fd6179722332128e4e5c6ee5)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 8368: (follow-up) port change to the Bootstrap OPAC; restore ISBN display

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 745bcfe0a6066a552d53d813ed4aed625c7e52b4)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Kept the ISBN fix back, dropped the bootstrap bits.

Conflicts:
	koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt
Bug 8368: (follow-up) restore use of quoted printable for message body

This is necessary to prevent the equals sign that is part of the
link back to the OPAC from being mangled, thereby breaking the
link.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 51a6f0958926fcbdf48e97d386a2463a9c113d73)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>