Bug 10584 - Hide OPAC biblio details if all items are hidden

If there are items for a given biblio number, and they are all
hidden, then biblio needs to be hidden. If the biblio needs to
be hidden, it immediately redirects to a 404.pl page, just as
if the biblionumber does not exist.

Arrays used to represent all the items were relocated and used,
added if they didn't exist. Arrays representing the hidden
items were relocated and used if they existed, added if they
didn't exist.

Upon debugging the opac-MARCdetail.pl modification, it was
discovered the reason getHiddenItems was failing was because
'use YAML qw/Load/;' was not mentioned in C4::Items, and other
libraries were triggering the loading of YAML to compensate
for opac-detail.pl and opac-ISBDdetail.pl files.

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.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>
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>
Bug 10876: Fix opac-MARCdetail.pl displaying items that are meant to be hidden

When OpacHiddenItems is used to hide some, but not all of the
items for a biblio, then the opac-MARCdetail page displayed
all the items, rather than just the ones intended to be visible.

By determining the tag and subtag for items.itemnumber, the
loop which builds the big array can be filtered to exclude
records that should be hidden.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Works as expected, passes koha-qa also.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10731: fix use of IntranetSlipPrinterJS by hold slips

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>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
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>
Bug 9294: Followup : add missing lines.

Signed-off-by: Galen Charlton <gmc@esilibrary.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>
Bug 10599: add option to unselect on loan items on the batch item modification tool

Sometimes when using the batch item modification tool, we would like to
automatically uncheck on loan items.

This patch also adds a new routine in C4::Circulation, IsItemIssued(),
which, when passed an itemnumber, returns whether the item is
currently on loan.

Test plan:
1/ Go to tools/batchMod.pl.
2/ Enter some barcode (at least 1 should be on loan).
3/ Click on the Continue button.
4/ Click on the "Clear on loan" link.
5/ Check that on loan items are unchecked.

Launch the unit test file:
prove t/db_dependent/Circulation/IsItemIssued.t

http://bugs.koha-community.org/show_bug.cgi?id=10572
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Works as expected, only modifies items that are checked (still). No regression noted.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10599: (follow-up) fix incomplete test case

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10601: Add a counter on batch items modifications

After executing a batch items modifications, a dialog is displayed above
the result table. It contains the number of items (and total fields)
which has been modified.

Note that items that are selected for modification but which do not
end up actually be changed are not reported in the final counts.

This patch adds two methiods to C4::BackgroundJob, ->set() and ->get(),
that allow background jobs to pass arbitrary data back to the client.

Test plan:
1/ Go to tools/batchMod.pl
2/ Enter a barcodes list
3/ Check/uncheck items and fill some values to apply
4/ Save
5/ The table summary will be displayed with a dialog box on top:
 XX item(s) modified (with YY fields modified)
Check that XX and YY correspond with what you expected.

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
batch modification still seems to work correctly, with the helpful addition of the counter. Thanks!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10601 [QA Followup] fix POD error

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10601: (follow-up) unit tests for new ->set() and ->get()

This adds unit test for the new methods in C4::BackgroundJob.  One
of the tests verfies that setting extra values does not scribble over
data that is mean to be internal to the C4::BackgroundJob object.

To test:

Verify that prove -v t/db_dependent/BackgroundJob.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10601: (follow-up) improvements to ->set() and ->get()

This patch improves the POD for C4::BackgroundJob->get().  It also
fixes ->set() so that it cannot scribble over values that are properly
internal to the object.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
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>
Bug 10915: fix About->timeline breakage on incompletely upgraded Koha

This patch supplies a default value for the koha-conf.xml
setting docdir to handle the case where the user neglects
to set it upon upgrade.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Fixes dev and standard installs without docdic tag in koha-conf.xml.
Doesn't break when docdir present either. Warning still present
on packages install that didn't add the docdir definition in koha-conf.xml

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10915: (QA followup) warn if cannot read history.txt

This patch makes about.pl test if success opening history.txt, and
shows a convenient warning to the end user. No more warnings in the logs
(about.pl: readline() on closed filehandle $file at /usr/share/koha/intranet/cgi-bin/about.pl line 166)
and better problem solving information for the end user.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.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>
Bug 10617 - koha-common init script cleanup

Removed unused stuff, added a new config file /etc/default/koha-common
to control the init script behaviour. Currently is only a stub. The config
file could be put on /etc/sysconfig on RedHat and friends. The init script
should work them too. Added a TODO comment regarding the 'status' switch.

To test:
- Apply the patch on master, build your own packages and install.
- The init script should continue to work as expected.
(it can be tested replacing the /etc/init.d/koha-common file with
debian/koha-common.init on a packages install).
- The absence of the /etc/default/koha-common file should not prevent
the init script from working.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10622: add --sip and --nosip switches to koha-list

Just added those switches.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Magnus Enger <magnus@enger.priv.no>

I applied the patch on my local dev install, and then copied the
patched koha-list script to a couple of servers with actual
instances running off the packages, to test the script.
- It seems that the -h switch did not work before this patch, now
  both -h and --help works nicely
- --sip and --nosip work as expected, also in combination with
  --email and --noemail

The patch does not add --sip and --nosip to the man page for
koha-list, but I will do a followup for that.

Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>