Bug 10499: VirtualShelves.t - wrap tests in a database transaction

Before this patch, the queries in VirtualShelves.t were committed in the
database and have to be removed at the end.

This patch wraps tests in a database transaction.

Test plan:
prove t/db_dependent/VirtualShelves.t
VirtualShelves.t .. ok
All tests successful.
Files=1, Tests=72,  1 wallclock secs ( 0.06 usr  0.00 sys +  0.72 cusr  0.06 csys =  0.84 CPU)
Result: PASS

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10275: UT: OrderFromSubscription.t needs to create its own data

Try before the patch:
prove t/db_dependent/Acquisition/OrderFromSubscription.t

And after, it should produce:
  t/db_dependent/Acquisition/OrderFromSubscription.t .. ok
  All tests successful.
  Files=1, Tests=12,  2 wallclock secs ( 0.02 usr  0.00 sys +  0.46 cusr
  0.02 csys =  0.50 CPU)
  Result: PASS

And some warnings...

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests.
Assumes Dateformat is set to US dates as in the sample data.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10275: Use a transaction for OrderFromSubscription.t

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10274: UT: Acquisition.t needs to create its own data

Try before the patch:
prove t/db_dependent/Acquisition.t

And after, it should produce:
  t/db_dependent/Acquisition.t .. ok
  All tests successful.
  Files=1, Tests=41,  2 wallclock secs ( 0.03 usr  0.00 sys +  0.42 cusr
  0.02 csys =  0.47 CPU)
  Result: PASS

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Tests pass and the bookseller is deleted.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10274: Execute sql queries into a transaction

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
bug 10556: regression test for setting deliverytime when adding vendor

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10556: The delivery time is not inserted on adding a supplier.

Test plan:
Add/edit a supplier and check that the delivery time is set in DB.

Note: This patch cleans the code (sql query) in order to see easily if a
problem occurred.

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>
Bug 10170: strings in MARC import made translatable

Following bug 9215: non translatable strings are now
present in the template and translatable

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

Not only does this make the strings translatable it makes the template
a lot easier to read
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10170: expose more managed staged MARC strings to translation

This commit makes it possible to translated the 'staged'
and 'error' record statuses as well as the 'auto_match'
overlay status.

Also takes out a bit of HTML cruft in one string that is
not needed for translation.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass. New strings are parsed into the po files:
"%s Always add items %s Add items only if matching bib was found %s Add items only if no matching bib was found %s Ignore items %s %s %s %s "
"%s No match %s Match applied %s Match found %s %s %s "
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10127 : Printoverdues.sh should tar only pdf files

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

From the bug report:
At the end of printoverdues.sh, an archive is generated
containing all files present in  directory given as parameter.
As archives are generated in this given directory, they
contain previously generated tar files, creating oversized files.
Only .pdf files should be archived

All tests and QA script pass.
Worked ok in my tests, only packign PDF in the given directory.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10409 - Do not show course entry form if no departments are found

The course reserves entry form should not be shown if there are no
DEPARTMENT authorized values, since this prevents the form from being
submitted. This patch replaces the form with an error message when no
DEPARTMENT authorized values are found.

Also corrected:

- Corrected grid structure for more standard display
- Converted labels with no corresponding inputs to <span class="label">
- Closed unclosed tags
- Corrected incorrect capitalization

This patch contains whitespace changes, so please ignore whitespace when
examining changes.

To test, delete any DEPARTMENT authorized values, if present. Create a
new course in Course Reserves. You should see a warning that no
DEPARTMENT values were found.

If you are logged in with the correct permission, the warning should
contain a link to the correct authorized value page. If you do no, the
warning should refer the problem to an administrator.

After creating one or more DEPARTMENT values, the form should display
and submit correctly.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
After this patch has been applied, I get an error message and no form
if I don't have any DEPARTMENTs defined, which makes sense given that
the form can't be submitted without a DEPARTMENT.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
You now see a useful error message, when no departments have been
defined. Else you are taken to the correct form.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10409: Follow up - improving strings for easier translation

Fixing this line:
<legend>[% IF course_id %] Edit [% ELSE %] Create [% END %] course</legend>

As grammar works different in different languages, having single
strings like that in a predefined order makes having a nice translation
unnecessarily hard.

This will make it a little easier:
<legend>[% IF course_id %]Edit course[% ELSE %]Create course[% END %]</legend>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 7019: fix sorting by return date in Circulation History

The "return date" column sort is not using the date sort algorithm because it is
confused by the combination of date data and text data ("Checked out").

This patch adds the use of datatable "title-string" sort type.
With that, the date in ISO format are used for sorting and because
letters are before numbers, "Checked out" rows are more recent than any date.

Test plan :
- set dateformat syspref to "dd/mm/yyyy"
- Go to members/readingrec.pl for a borrower having a old issues and
checked out issues
=> Check that sort of "Return date" is correct.
For example :
With patch :
  20/01/2011
  06/03/2011
  20/03/2011
  Checked Out
Without patch :
  06/03/2011
  20/01/2011
  20/03/2011
  Checked Out
- Test also with dateformat syspref "mm/dd/yyyy"

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10563: Fix broken 'Edit' link on check expiration page

This fixes the broken 'Edit' (subscription) link on the
check expiration page in serials.

To test:
- Add a subscription
- Go to the check expiration page
- Search for your subscription, use an expiration date in the
  far future
- Verify the edit link on the result list doesn't work right
  before applying the patch, but works after

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 9576: can now control whether max loans limit can be overriden

Adds a new system preference AllowTooManyOverride to control whether
a librarian can override the 'Too many checked out' message which is
currently always overridable.

Test Plan:
1) Apply patch
2) Run updatedatabase.pl
3) Attempt to check out 1 more item to a patron than the max issues
4) You should be allowed to override by default ( current behavior )
5) Set AllowTooManyOverride to "Don't allow"
6) Repeat step 3
7) You should be blocked from being able to issue the item

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

The new system preference is activated by default, which mean there
will be no change in behaviour on update.

The system preference is correctly added to the database and .pref
files.

Test plan and QA script passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9576: DBRev 3.13.00.013

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9362: fix query that finds upcoming due loans

C4:Circulation:GetUpcomingDueIssues is used in the advance_notices.pl
script.  This patch corrects an error in its handling of the maxdays
parameter that resulted in it picking up *all* upcoming due loans and
recently overdue loans.

Test plan :
- Create an issue with a date due in the paste
- Create an issue with a date due in two days
- Launch advance notices with due date in max 2 days : perl misc/cronjobs/advance_notices.pl -c -n -v -m=2
=> You get a warn "found 0 issues"
- Launch advance notices with due date in max 3 days : perl misc/cronjobs/advance_notices.pl -c -n -v -m=3
=> You get a warn "found 1 issues"

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
I did the following test :

- 1 book to check in 2 days
- 2 books to check in in the past

before applying the patch :

$perl ../misc/cronjobs/advance_notices.pl -c -n -v -m=2
getting upcoming due issues at ../misc/cronjobs/advance_notices.pl line 203.
found 1 issues at ../misc/cronjobs/advance_notices.pl line 205.

I changed the value of "-m" : 0, 1, 2, 3, 4
=> always 1 issue found (the book to check in in 2 days)

after applying the patch :

$perl ../misc/cronjobs/advance_notices.pl -c -n -v -m=2
found 0 issues
for m = 0, 1, 2 => 0 issues

$perl ../misc/cronjobs/advance_notices.pl -c -n -v -m=3
found 1 issues
for m = 3,4,5 => 1 issues (the book to check in in 2 days)

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 10541: enable cross-browser AJAX in additem.js

Currently, the additem.js is using "indexOf" to search
for a value in an array. While this works in Chrome, Firefox,
and IE > 9, it fails miserably in IE 8 and 7 (which don't have
the indexOf method). This means that users aren't able to add
items using the acquisitions module!

Instead of using "indexOf", we should be using the jQuery function
$.inArray. It was added in jQuery v1.2 (3.8.0 uses v1.3.2 so even
our oldest supported release can use this method). It's perfectly
cross-browser compatible...works in Chrome, Firefox, and every
version of IE that I've tried (i.e. 7, 8, 9).

Test Plan:

Before applying patch:

0) Switch to Internet Explorer 7, or 8, or 9, or 10.

If you're using IE 9 or 10, you'll need to change the Document Mode to
IE7 standards or IE8 standards.

You can do this by opening Internet Explorer 9 or 10, pressing F12 (or
clicking on the gear in the top right corner and choosing
F12 Developer Tools), and then clicking on "Document Mode" on the
top toolbar. There, you can change to IE7 or IE8 standards.

N.B. This is not always a perfect emulation in every case, but this
time it does show you the bug.

1) Set the system preference AcqCreateItem to "receiving an order"
2) Go to Acquisitions
3) Either:
    a) Receive a shipment for a basket with items
    b) Create a new basket, create an order, close the basket, and
       then do 3a)
4) In the "Item" fieldset, fill out some fields such as barcode,
   Date acquiried, Public note, etc.
5) Click "Add" at the bottom of the fieldset
6) Note that while the item may have been added, the "Item" fieldset
is not being shown again. You may also notice a Javascript error
appearing in a pop-up window or you might see a yellow warning flag
on the bottom status bar.

APPLY THE PATCH

7) Do a full refresh of the page (hold down shift and press the refresh
button on the browser next to the address bar), and try adding items
again.
8) Note that you receive no warnings and that items are added correctly
as they would be in Firefox or Chrome.

OPTIONALLY

9) To be sure that I haven't broken anything, go through the same steps
in IE9 (with IE9 standards) or Chrome or Firefox. Everything should be
working.

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

Tested in IE10 in IE7 mode and IE9 mode. Also tested in Firefox.

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 10515: make behavior of library category fetchers consistent with other fetchers

The prototype is not consistent, GetBranchCategory should return only 1 result
and GetBranchCategories should not have a categorycode argument.
This patch fixes that.

Test plan:
1/ Try to add/remove/modify a library.
2/ Add some groups
3/ Add these groups to a library

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10515: add regression tests

Signed-off-by: Galen Charlton <gmc@esilibrary.com>