Bug 9618: Add support for intranetuserjs to labels/spinelabel-print.pl

The template for printing a single spine label is a stripped-down
version of a standard Koha template, but it should include
intranetuserjs and IntranetUserCSS so that libraries can make local
customizations.

This patch updates the page's DOCTYPE to HTML5 and adds the missing
markup for including those preferences. Also added is jQuery, since
there's a good chance local customizations are using jQuery.

To test, make sure there is something in your intranetuserjs and
IntranetUserCSS system preferences. Visit
/cgi-bin/koha/labels/spinelabel-home.pl and submit a barcode. View
source on the spine label output page and confirm that your custom js
and css were included correctly.

Signed-off-by: Campbell Reid-Tait <campbellreidtait@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template only change, works nicely.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit cb59e37e56c255219298450f7a289cf7c3fe819b)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9618: (follow-up) include link to jQuery only if needed

The jQuery lib is useful only if js code is filled into the
intranetuserjs pref.

Signed-off-by: Campbell Reid-Tait <campbellreidtait@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

To test:
- Use Quick spine label creator
- Make sure you have Javascript in your intranetuserjs system
  preference
- Validate Javascript effect on screen or check source code
  to make sure your code is visible there.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 94868f61c4c395f8393d34862a99609247f6dd73)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10570: Show nonpublic note on check expiration page

The check expiration page in serials only showed the OPAC note,
but it makes sense to also show the nonpublic note here.

This patch adds it.

To test:
- Add a subscription, make sure to enter different notes in
  nonpublic note and OPAC note to check for display later on.
- Go to the check expiration page and search for your subscription.
- Check both notes show up correctly.

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 29498bf696d86a761708ec59f0a75be6353feecf)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 8821: make receive shipment page hide inactive funds like new order form

This patch adapts the fund-handling code from neworderempty.pl
in order to limit the display of funds by default to active ones,
with the option to check a box to display all funds.

This patch also adds "(inactive)" to the display of funds on this and
the neworderempty.tt template because it seemed like that was useful
information.

To test, make sure you have both active and inactive funds.
Start the process of receiving a shipment. The "fund" option
in the receive shipment form should show only active funds.
Checking the "show all" checkbox should allow you to choose
from both active and inactive funds.

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 04aa35077730bdd4bc8d3c01c461518ecb0d9e60)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10841: Make edit/delete item context links in cataloguing translatable

HTML created with Javascript is not translatable the way HTML is
normally translated. _() syntax has to be used to have strings
translatable.

To test:
- Edit items for a record with multiple items
- Click somewhere in the items table
- Verify the links for editing and deleting items show up and work correctly
- Apply patch
- Verify the links still show the same behaviour

Bonus:
- Run 'perl translate update <languagecode>' in misc/translator
- Verify that Edit item and Delete item show up in the po file, translate them
- Install updated po files running 'perl translate install <languagecode>'
- Verify links show up translated and work correctly

Patch also fixes capitalization for a couple of error messages - only change
there is: Deleted > deleted.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
(cherry picked from commit 7c82fe1a670892b07f426f356c67bc3cd60a37f3)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9372: replace carriage return with <br /> in printed HTML files for overdues

For PDF generation, HTML files need explicit <br /> HTML tags. With
this patch, carriage return are replaced by <br /> when letters are
written into HTML files.

Test plan :
- Ensure you've got at least one reader with overdue triggering notice
- Ensure that your notice template got HTML checked
- Run misc/cronjobs/overdue_notices.pl -v -n -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of the letter is all on one line in PDF file
With the patch, PDF file is correctly formated

- remove your reader email
- Run misc/cronjobs/overdue_notices.pl -v -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of PDF file is all on one line
with the patch, PDF file is correctly formated.

- restore reader email
- run misc/cronjobs/overdue_notice.pl -v -html <dirname>

Verify that the a message has been generated in message_queue table
With or without patch, the message is the same

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 6dbfe1512dc39e82084f9aa8b8ecce38fa24c5c5)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9372: (follow-up) tidy whitespace in new lines

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit fc84903dfb73212029466764005bb53e5089acc8)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10667: Add unit tests for ILSDI::Services::AuthenticatePatron

This patch adds unit tests for Authenticate patron.

To test:
- Run perl t/db_dependent/ILSDI_Services.t
- Verify all tests pass

Note: there are some tests marked as TODO.

Rewriting AuthenticatePatron to make cardnumber and userid
work for authenticating a patron will be implemented in the
next patch. Tests related to this are currently showing as
'not ok', but are still passing.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No koha-qa errors
With both patches applied, all test pass.
Signed-off-by: Mason James <mtj@kohaaloha.com>

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 995f4b6ecb504e1648816b0841e90efb814f25c7)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10667: Allow authentication with cardnumber for ILS-DI

Test authentication via ILS-DI:
- with userid and password
- with userid and wrong password
- with cardnumber and password
- with cardnumber and wrong password
...

Before the patch only userid will authenticate the patron.
After the patch was applied, userid and cardnumber will work.

To test:
- Run t/db_dependent/ILSDI_Services.t - all tests should pass.

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

Test:
Enable ISL-DI
access opac with /cgi-bin/koha/ilsdi.pl?service=AuthenticatePatron&username=XXX&password=YYY
With userid/cardnumber & password returns borrowernumber
With userid/cardnumber & wrong password returns PatronNotFound
Signed-off-by: Mason James <mtj@kohaaloha.com>

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ddb67e32377185df371c85172308be882968b14f)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10667: Follow up - prevent t/00-load from failing

To test:
- Apply first 2 patches for unit tests and changes to Services.pm
- Turn off mysql
- Run t/00-load.t
- Verify that the test fails.
- Apply this third patch.
- Run t/00-load.t again.
- Verify this time it passes.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Work well, no koha-qa errors.

Without third patch and mysql down, test fails,
with third patch it succeed.
Signed-off-by: Mason James <mtj@kohaaloha.com>

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 8e0c21cf38b930c207d2efab4a3b55e359b95b89)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10667: (follow-up) fix reference to UT library in test case

This patch prevents a spurious test case failure if the
test database happens to already have a library whose
code is 'UT'.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 2a8481a5e2f487c649fc9b2e1c03b42fe42fee07)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10897: remove test for module that has become DB-dependent

This is an alternative appraoch to fixing this bug; as the
compilation test for C4::ILSDI::Services also resides
in t/db_dependent/ILSDI_Services.t, we don't need t/ILSDI_Services.t
at present.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit dcbe50cde84505198dffbd1a65d998287f0902dc)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10872 - C4::Items GetHiddenItems fix and optimization

There should be a:
"require YAML;"
or
"use YAML qw/Load/;"

as the GetHiddenItems routine has a reference to YAML::Load.

This was discovered while adding a GetHiddenItems() call into
opac/opac-MARCdetail.pl. I believe this problem dates back to
bug 6488 or bug 5984.

I also added an optimization to GetHiddenItems to prevent
processing if there is nothing in the system preference. Test
by searching for a biblio which has some or all of its items
hidden.

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Maybe
  return () unless $yaml =~ /\S/;
or
  return () if $yaml =~ /^\s*$/;
would have been easier to read.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 9ab593440b6d2b1f9c417631a4cf5cabcf1a0032)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10872: UT for GetHiddenItemnumbers and POD fix

This patch adds several unit tests for GetHiddenItemnumbers and fixes the POD for it.
It also wraps the tests for rollback, modernizes and adds a license text to it.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 5d8ad739293ef8cf22a808404e52a9c74275aaf0)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
"Fixed" 'wthdrawn' column name for 3.12.x
Bug 10731 - IntranetSlipPrinterJS is not working for hold slips [v3.10/v3.12]

Hold slips aren't printing automatically with JS Print Setup because it
appears the system preference IntranetSlipPrint is never being passed to
the template.

Test Plan:
1) Set up JSPrintSetup
   http://wiki.koha-community.org/wiki/Setting_up_slip_printer_to_print_silently
2) Place a hold
3) Check the item in to capture the hold
4) Click "Print and confirm"
5) Note the slip does not print automatically
6) Apply this patch
7) Repeat steps 2 through 4
8) Observe that the slip now prints automatically

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

Tested successfully in 3.10.x and 3.12.x

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10376: fix ability to print cart from IE9 & 10

Test plan:
1) Test with Firefox (or any other browser except IE):
Add biblio to cart
Go to Cart and click Print
Does the Cart window come back to its original state after confirm/cancel Print?
2) Test with Internet Explorer (I used IE9; testing another version is fine)
Do the same as above. Is behavior now more or less the same?

Signed-off-by: Marc Veron <veron@veron.ch>

1) Test without patch:
IE 10: Does not show print dialog
IE 9 (Developer Emulation in IE 10): Does not show print dialog (as expected)
FF 21.0 OK
Chrome 27.0.1453.110 m: OK

2) Test with patch:
IE 10: OK
IE 9 (Developer Emulation in IE 10): OK
IE 8 (Developer Emulation in IE 10): OK
IE 7 (Developer Emulation in IE 10): OK
FF 21.0 OK
Chrome 27.0.1453.110 m: OK

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Trusting Marc here, as I don't have IE available.
Regression tests in Firefox and Chromium went well.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 990eebf132fef94dfbac4d3e17fe7acd9ce7b2c6)
Bug 10894: Add ID to main address in member entry form

Add an ID to ease customization via jQuery; an ID is already present
on alt address but was missing from main address

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ace550530550ba72b93f34b446e681ab72024f8c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10871: Make confirmation message for deleting news translatable

To test:
- Create a news entry in tools > news
- Delete the news entry or multiple entries by selecting them
  using the checkboxes to the left and the delete button at the
  bottom of the page.

Verify confirmation message shows up correctly with patch applied.

Bonus:
- Update one of the po files and make sure the new strings shows up
  there.

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 da856fc46cfd4cccb092c339eee0e3ce1262e9d8)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>