Commit graph

794 commits

Author SHA1 Message Date
Aleisha Amohia
a75be3ab0d Bug 11541: increase test coverage of Installer.pm
To test
1. Run prove t/Installer.t
2. Apply patch
3. Run prove t/Installer.t
   Notice more tests are run

Signed-off-by: Francesca Moore <francescalamoore@gmail.com>
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>
2014-01-14 21:37:47 +00:00
0db732980a Bug 11540: (follow-up) add a couple of tests more
This patch makes sure all scenarios are covered for SetUTF8Flag.

Signed-off-by: Emma Heath <emmaheath.student@wegc.school.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 21:29:49 +00:00
Emma Heath
6a6df3f5d7 Bug 11540: increase test coverage of Charset.pm
To test
1. run prove t/Charset.t
2. apply patch
3. run prove t/Charset.t
 notice more tests are run

Signed-off-by: Tom Houlker <thomas.houlker@hibs.school.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass!

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 21:29:33 +00:00
Tom Houlker
397d95821c Bug 11539: removing 2 unused files
This patch removes C4::Barcodes::PrinterConfig, which is
used by no other code in the database.

Signed-off-by: Emma Heath <emmaheath.student@wegc.school.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
No instances of PrinterConfig found in the codebase

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Couldn't find any reference to those files in Koha.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 20:55:28 +00:00
Galen Charlton
53d5a8ba53 Bug 11545: (follow-up) move Languages.t to t/db_dependent
This patch moves t/Languages.t to t/db_dependent/Languages.t,
as the new get for getAllLanguages() works best if there's
a database available.

To test:

[1] Run prove -v t/db_dependent/Languages.t
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 20:48:33 +00:00
merllissia
a52919a222 Bug 11545: Increasing test coverage for Languages.pm
To test
1. Run prove t/Languages.t
2. Apply patch
2. Run prove t/Languages.t again and notice: More tests are run

Signed-off-by: alex_h <dhorsman@xtra.co.nz>
Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Adds another passing test. I took th liberty of moving the test plan
from the subject to the commit message. :-)

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass :)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 20:46:59 +00:00
daniel
0f82b21204 bug 11542: Increase test coverage for Print.pm
to test
1. run prove t/Print.t
2. apply patch
3. run prove t/Print.t
Notice more tests are done

Signed-off-by: Roman Amor <romanwilton@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
UT passes, also passes koha-qa.pl

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass :)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 20:41:31 +00:00
Galen Charlton
fc0a201bd9 Bug 11537: (follow-up) mock C4::Context::preference
This avoids turning t/Log.t into one that requires a valid
session context.

To test:

[1] Run the following and verify that the test passes.

unset KOHA_CONF
prove -v t/Log.t

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 19:27:07 +00:00
alex_h
5ebca4f340 Bug 11537: Increasing test coverage for C4::Log
To test:
1. run prove t/Log.t
   Notice 1 test is run
2. apply patch
3. run prove t/Log.t
   Notice 3 tests are run

Signed-off-by: David Cook <dcook@prosentient.com.au>

Works as described.

I think there might be a typo in "Testing git log status". Should
this read "Testing get log status"? (Noticed while looking at the
code/running perl t/Log.t.)

In any case, thanks for the patch. Looks good!

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

Fixed typo, thanks David

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described:
1..3
ok 1 - use C4::Log;
ok 2 - Testing GetLogStatus
ok 3 - Testing hash is non empty

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 16:30:18 +00:00
Galen Charlton
5920ca6fa0 Bug 11389: reenable Pg as a DB scheme that Koha can connect to
This patch restores the ability to request a DBI database handle
or a DBIx::Class schema object connected to a PostgreSQL database.

To address the concerns raised in bug 7188, only "mysql" and "Pg"
are recognized as valid DB schemes.  If anything else is passed
to C4::Context::db_scheme2dbi or set as the db_scheme in the Koha
configuration file, the DBD driver to load is assumed to be "mysql".

Note that this patch drops any pretense of Oracle support.

To test:

[1] Apply patch, and verify that the database-dependent tests
    pass when run against a MySQL Koha database.
[2] To test against PostgreSQL, create a Pg database and
    edit koha-conf.xml to set db_scheme to Pg (and adjust
    the other DB connection parameters appropriately).  The
    following tests should pass, at minimum:

    t/Context.t
    t/db_dependent/Koha_Database.t

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, some additional notes:

- Installed Postgres following
  http://wiki.ubuntuusers.de/PostgreSQL
- Created a database user koha
- Created a database koha
- Changed the koha-conf.xml file
    <db_scheme>Pg</db_scheme>
    <database>koha</database>
    <hostname>localhost</hostname>
    <port>5432</port>
    <user>koha</user>
    <pass>xxxx</pass>
- Installed libdbd-pg-perl
- Ran the web installer until step 3 everything looked ok
  Step 3 complains:
    Password for user koha: psql: fe_sendauth: no password supplied
- Both t/Context.t and t/db_dependent/Koha_Database.t pass

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-13 20:56:14 +00:00
Galen Charlton
da853bf74e Bug 10952: (follow-up) remove mention of KohaOpacRecentSearches cookie
Now that this cookie no longer exists, remove mention of it
from a test case.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 16:55:37 +00:00
Julian Maurice
bbf7cd6876 Bug 10952: (follow-up) comments fixes and unit tests
- Remove unit tests for ParseSearchHistoryCookie, which doesn't exist
  anymore
- Add unit tests for ParseSearchHistorySession and
  SetSearchHistorySession
- Remove/Modify comments about search history cookie

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

Tests fixed and moved, and comments tidied up

Signed-off-by: Charlene Criton <charlene.criton@univ-lyon2.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 16:21:18 +00:00
0ba13938fb Bug 11452: Add unit tests for Koha::Template::Plugin::Cache
To test

run prove t/Koha_Template_Plugin_Cache.t

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works nicely.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 15:42:23 +00:00
5666ed77a3 Bug 11499: UT: Make zebra_setup.pl correctly set indexing mode
By adding the relevant environment variables to the script the generated
koha-conf.xml file for the unit tests is correct now.

Test plan:
- Verify that tests pass now:
  $ prove -v t/db_dependent/Search.t 2> /dev/null | grep 11499

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes unit test, koha-qa.pl

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 15:42:23 +00:00
7b1d49f84b Bug 11499: (regression tests) indexing modes not properly set on generated koha-conf.xml
t/db_dependent/Search.t creates its own temporary koha-conf.xml and
related files, and it fails to properly set indexing modes for
bibliographic and authority records.

This patch adds regression tests for that.

To test:

 $ prove -v t/db_dependent/Search.t 2> /dev/null | grep 11499

The test should fail unless the main page is applied.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 15:42:23 +00:00
d6979f71a3 Bug 11439: (follow up) add missing rollback call
This UT got wrapped inside a transaction with autocommit=0 but
the rollback call was inadvertedly ommited. Adding it.

[RM note: an explicit rollback is not required, as the
 transaction will roll back automatically at the end of
 the DB session. Nonetheless, it hurts nothing to have
 it be explicit.]

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 15:42:22 +00:00
Colin Campbell
732ad864f6 Bug 11480: Fix invalid assumptions in JSONStream test
Tests for C4::Output::JSONStream made the invalid assumption
that the hash keys of the modules internal structure
will always be returned in the same sequence.
A hash is an unordered structure. as of perl 5.18
this has beem reinforced by random seeding of the
hashing function. See the info in perldelta and
the doc for JSON.

This patch changes the tests to be sequence-neutral
where the previous test was testing that a new element
was added and an existing one was untouched these have
been separated into individual tests.

Some typos in the messages have been corrected

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

Test Plan

1/ Run t/Output_JSONStream.t , 8 tests should pass (or perhaps fail,
   but inconsistently under perl 5.18 or greater)
2/ Apply patch
3/ Run t/Output_JSONStream.t 10 tests should pass now

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 15:42:17 +00:00
8209bf1026 Bug 11457: avoid spurious test failure in t/db_dependent/Bookseller.t
This patch clears the subscription table so tests pass correctly if
there happens to have been a subscription with an end date before
2013-08-01.

To test
1/ Add a subscription in the serials module, with an end date before
2013-08-01
2/ run prove -v t/db_dependent/Bookseller.t
   Notice tests 22 and 23 fail
3/ Apply patch
4/ run test again
5/ Notice tests succeed

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests now clean the subscription table before running
the tests, so that the will always pass.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-09 19:09:56 +00:00
Galen Charlton
7af64ff7bd Bug 11336: (follow-up) fix typo in previous follow-up
This patch corrects a typo that broken ModReserveFill().  This
patch also adds a unit test that (via two levels of indirection)
exercises ModReserveFill().

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-06 16:16:22 +00:00
Galen Charlton
7c518bd250 Bug 11470: fix occassional spurious test failure in Circulation_transfers.t
This patch makes Circulation_transfers.t no longer be sensitive to
the exact time it runs, avoiding spurious test failures due
to datesent being a second off between the creation of the test
transfer and the comparison.

To test:

[1] To simulate the failure, add a "sleep(2);" after the
    "#Test GetTransfers" comment and run
    prove -v t/db_dependent/Circulation_transfers.t
[2] Remove the sleep and apply the patch.
[3] Verify that prove -v t/db_dependent/Circulation_transfers.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-06 05:31:21 +00:00
Jonathan Druart
78037c5573 Bug 11336: update hold queue priorities correctly when deleting holds
In various places, deleting a hold request did not trigger recalculating
the priority of the other holds on the bib:

To reproduce the bug:
- select or create 2 users U1 and U2
- select or create an holdable item
- place on hold for both U1 and U2. U1 has priority 1 and U2 has
  priority 2.
- delete the hold for U1
- go on circ/circulation.pl?borrowernumber=XXXX for U2 (or in the DB
  directly) and verify the priority has not been set to 1

The issue is repeatable (at least) on these 2 pages:
 * circ/circulation.pl?borrowernumber=XXXX (tab 'Holds', select "yes"
  in the dropdown list and submit the form)
 * reserve/request.pl?biblionumber=XXXX (click on the red cross)

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Reran my tests:

Preparations:
- Create holds for different patrons on a record:
  * 1st - title level hold
  * 2nd - item level hold
  * 3rd - title level hold
  * 4th - title level hold
- AllowOnShelfHolds = On/Allow (items were not checked out)

Tests:
Deleted holds from various pages, confirming bugs first,
then testing with applied patches. Reloading database
after each test.

1) Cancel holds from OPAC patron account
  /cgi-bin/koha/opac-user.pl#opac-user-holds
- Cancel 4th - ok, before and after applying the patch
- Cancel 2nd - ok, after applying the patch

2) Cancel hold from holds tab on staff detail page
  /cgi-bin/koha/reserve/request.pl?biblionumber=7

  a) Setting priority to 'del', submitting with 'Update holds'
  - Cancel first (1st) - ok, before and after
  - Cancel hold in the middle (was 3rd) - ok, before and after
  - Cancel last (was 4th) -ok, before and after

  b) Using red X
  - Repeating tests from a) - before the patch is applied holds
    get totally 'out of order' - after applying the patch, it works
    correctly

Additional tests done on this page:
- Change priority using up, down, to top, to bottom icons
- Change priority with 'toggle to lowest'

3) Cancel hold from the patron's account

  a) Check out tab - Delete? Yes, 'Cancel marked holds'
    /cgi-bin/koha/circ/circulation.pl?borrowernumber=X
  - Cancel first (1st) - ok, after applying the patch
  - Cancel hold in the middle (was 3rd) - ok, after applying the patch
  - Cancel last (was 4th) - ok, after applying the patch

  b) Details tab - Delete? yes, 'Cancel marked holds'
    /cgi-bin/koha/members/moremember.pl?borrowernumber=X
  - Cancel first (1st) - ok, after applying the patch
  - Cancel hold in the middle (was 3rd) - ok, after applying the patch
  - Cancel last (was 4th) - ok, after applying the patch

  Without the patch, holds priorities get out of order.

Additional tests done:
- Check in one item to trigger first hold
- Check in one item to trigger second hold
- Check out first item
Priorities are kept while the item is waiting, when it's
checked out, priorities of remaining holds get reset correctly.

Conclusion:
Big improvement, no regressions found.

Passes all tests in t, xt and QA script.
Also: t/db_dependent/Holds.t
      t/db_dependent/HoldsQueue.t
      t/db_dependent/Reserves.t

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-04 22:42:10 +00:00
Galen Charlton
7f90a4fb27 Bug 11066: (follow-up) add regression test
This patch adds a regression test for using the MARC21
264 field in the Bibtex export.

To test:

[1] Verify that prove -v t/db_dependent/Record.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-03 15:54:45 +00:00
Galen Charlton
b753678c3d Bug 11208: regression test for failing SMS messages
This patch adds a regression test for verifying that queued
SMS messages meant for patrons who have no SMS alert number
set are marked as failed after the first attempt to send them.

To test:

[1] Run prove -v t/db_dependent/Letters.t.  The fourth
    test should.
[2] Apply the main patch and run t/db_dependent/Letters.t
    again.  This time, all tests should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 16:45:45 +00:00
Galen Charlton
7d01e61cdf Bug 11402: (follow-up) add one more unit test
This test exercise the case where defined parameters
are passed to the _guide_box() routine.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 16:23:10 +00:00
4720cbc414 Bug 11402: make Labels::_guide_box return undef if undefned data is passed
That's it. A guide box cannot be created if invalid data is passed.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, includes new unit tests.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 16:17:35 +00:00
Jonathan Druart
3e866d216d Bug 10277: Add UT for C4::Context::IsSuperLibrarian
Note that I modify the return value. Before this patch, it returned an
empty string or 1. Now it returns 0 or 1.

Test plan:
- same as the original patch
- verify that unit tests pass:
    prove t/Context.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, including new tests.
Checked the code and tested superlibrarian behaviour in some places:

moremember.pl:
With IndyBranches only superlibrarian can delete borrowers from
other branches. Accessing the borrower with a direct link.
OK

C4/Members.pm
With IndyBranches only superlibrarian can search for borrowres
from other branches.
OK

tools/holidays.pl
With IndyBranches only superlibrarian can edit holidays for other
branches.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:47:46 +00:00
Galen Charlton
2b6a20c509 Bug 11445: regression test for duplicate hold notifications
This patch implements a regression test for verifying that
duplicate hold notifications aren't sent if ModReserveAffect() is
called repeatedly (as might happen if a circ operator accidentally
checks in an item and confirms its hold more than once).

Note that the test depends on the fact that _koha_notify_reserve()
defaults to sending a HOLD_PRINT letter if the borrower has not
specified an email or SMS hold notification.

To test:

[1] Run prove -v t/db_dependent/Reserves.t
[2] The 'patron not notified a second time (bug 11445)' test
    should fail.
[3] Apply the main patch and run prove -v t/db_dependent/Reserves.t
    again.  This time all tests should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:10:17 +00:00
Jonathan Druart
0d71139fff Bug 11439: UT: Improve XISBN.t
The tests should be executed into a transaction and the SimpleSearch
routine correctly mocked.

Test plan:
Verify that prove t/db_dependent/XISBN.t returns green.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-27 00:16:22 +00:00
Jonathan Druart
81133cf2c2 Bug 11439: UT: fix XISBN.t test failure
A unit test fails in t/db_dependent/XISBN.t, the get_xisbn routine, if
ThingISBN is enabled, returns the 3rd biblionumber, not the second one.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-27 00:15:55 +00:00
Galen Charlton
cea5f944a9 Bug 11338: (follow-up) take IndependentBranches into account for DelItemCheck() test
Fixes a test failure if the test database happens to have
IndependentBranches set to true.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-27 00:13:31 +00:00
Galen Charlton
18888359b6 Bug 11338: add unit tests for DelItemCheck
This patch adds unit tests for two parts of DelItemCheck: checking
if the item is on loan, and checking if it is waiting on the hold
shelf.

To test:

[1] Verify that prove -v t/db_dependent/Circulation/IsItemIssued.t
    is successful.
[2] Verify that prove -v t/db_dependent/Reserves.t is *not*
    successful -- as it turns out, there was a latent bug where items
    waiting on the hold shelf or in transit to fill a hold could still
    be deleted without any warning.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-25 17:07:53 +00:00
Jonathan Druart
8ee6e4290e Bug 11279: (follow-up) remove unnecessary check on number of quotes
It is not necessary to process the case where the number of quotes
is just one, as int(rand(1)) will always produce 0, which is a valid
offset.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-19 15:06:39 +00:00
Katrin Fischer
f874eec079 Bug 11279: regression test for picking random quote
This patch adds new tests based on the db_dependent tests in
t/db_dependent/Koha.t for GetDailyQuote().

Tests run on an empty database and don't require Test::Deep.

Tests will fail before applying the patch for 11297, but will
pass after applying the patch.

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-19 15:06:16 +00:00
Galen Charlton
437f066247 Bug 7518: regression test double-quote in search operand
Under certain circumstances, namely where QueryParser is off,
QueryWeightFields is on, and QueryFuzzy and QueryAutoTruncate are
off, a search with a double-quote embedded in it can fail: for
example

    web application

would return results where

    web "application

does not.

This patch adds an automated regression test.

To test:

[1] Apply this patch and run prove -v t/db_dependent/Search.t;
    two tests should fail.
[2] After applying the main patch that fixes the bug, the
    prove -v  t/db_dependent/Search.t should succeed.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-17 16:32:09 +00:00
6000bfdf87 Bug 10626 - Remove doubled up TT plugins - Merge KohaBranchName and Branches
Looking at the TT plugin directory I notice we have some plugins that
seem to do the same thing:

KohaBranchName.pm
Branches.pm

This patch drops KohaBranchName in favor of Branches

Test Plan:
1) Apply this patch
2) View a basket group, note the branch name is displayed
3) View a subscription's details, note the branch name is displayed
4) View suggestions, note the branch names are displayed
5) Return an item that needs transfered, note the branch name is displayed
6) Run 'prove t/db_dependent/Koha_template_plugin_Branches.t'

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also tested with a branch name with umlauts.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-14 01:05:56 +00:00
Galen Charlton
659ac6a904 Bug 10852: (follow-up) regression tests
This patch adds regression tests for the changes to
C4::Serials::SearchSubscriptions().

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-14 00:35:22 +00:00
Galen Charlton
08c47cbfe2 Bug 11112: (follow-up) repair Koha::Calendar->add_holiday()
This patch ensures that the package-level cache is updated
when add_holiday() is used.  Note that except for the test
case added by this patch, there doesn't seem to be anything
that actually calls ->add_holiday(); it may be better to remove it.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-10 18:19:15 +00:00
Colin Campbell
2e0e15485e Bug 11032: Check a valid MARC::Record passed to Biblio
Intermittently problems in the calling environment
cause a C4::Biblio routine to be called with an undefined
MARC::Record object. This results in the process
dying and returning to the end user a low level
message such as 'cannot call method x on an undefined
object'.

For exported subroutines taking a MARC::Record object,
check that object is defined otherwise return a logical
return value and log a stack trace to the error log.
A couple of cases were checking but dying, this may have
unwelcome results in a persistent environment so croak has
been downgraded to carp

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Adds lots of checks for $record in various places, should
not affect behaviour.
Passed all tests and QA script, including new unit tests.
Tested adding and saving a new record.
Also tested detail and result pages without XSLT.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-10 05:01:54 +00:00
Srdjan
7675ede590 bug_10781: Remove C4::ILSDI::Utility
This patch removes C4::ILSDI::Utility on the basis
that one of its routines (BorrowerExists) was not used
and that the other routine can be (and is) moved to
C4/ILSDI/Services.pm.

Test:
This should be a noop. Regression testing required:
/cgi-bin/koha/ilsdi.pl functioanality, in particuler:
GetAvailability - ?service=Describe&verb=GetAvailability
AuthenticatePatron - ?service=Describe&verb=AuthenticatePatron

ILS-DI syspref must be turned on

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-10 01:27:44 +00:00
Jonathan Druart
7d2f975f3b Bug 11111: UT: SearchOrders returns keys basketgroupid and basketgroupname
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-05 15:38:06 +00:00
Galen Charlton
49916a669b Merge branch 'new/bug8854' 2013-11-19 16:12:42 +00:00
Galen Charlton
f1aa43b75f bug 8854: fix some invoice search filters
Fix the supplier, shipment date, and library filters
on the invoice search.  An invoice's library is
(in parallel with order search) defined as the library
of the staff member that approved the basket.  Before this
patch, the code was referring to an aqorders.branchcode
column that doesn't exist.

This patch also improves the author, title, ISBN/EAN/ISSN,
publisher, and publication year filters to no longer require
exact matches; substring matches now suffice.

Finally, this patch considers biblio.copyrightdate in addition
to biblioitems.publicationyear for publication date searches, as
the MARC21 frameworks use the former column but not the latter.

This patch also fixes the current test cases for invoices
so that they pass and adds regression tests.

Test plan:

[1] Create two invoices for different vendors.
[2] Do an invoice search and filter on shipment
    date.  Verify that the expected invoice(s)
    are returned.
[3] Do an invoice search and filter on branch
    (of the staff member that approved the basket).
    Verify that the expected invoice(s) are returned.
[4] Do an invoice search and filter on supplier.
    Verify that the expected invoice(s) are returned.
[5] Do invoice searches on author, title, ISBN/EAN/ISSN,
    publisher, and publication year and verify that the
    results are as expected.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Patch passes all tests, test plan and QA script.

(Adding from Katrin notes early) I agree with
Possible improvements:
- Document the behaviour of the library search as there are
  lots of branches all over acquisitions with different meaning.
- Add the shipment date to the results list table
- Change label ISBN/EAN/ISSN to not include EAN for MARC21
  installations

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-19 16:12:31 +00:00
Galen Charlton
942226d333 Merge branch 'new/bug11221' 2013-11-19 15:45:22 +00:00
Galen Charlton
15812e80c8 Bug 11221: (follow-up) test for NULL rather than empty string
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-19 15:35:25 +00:00
11fbcb30de Bug 11221: (follow-up) add unit test to test handling empty strings as dates
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-19 15:31:06 +00:00
Galen Charlton
eeb409a97d Merge branch 'new/bug10684_take2' 2013-11-14 18:05:58 +00:00
Galen Charlton
7e6364baee Bug 10684: add regression test
This patch adds a regression test for Koha's ability
to gracefully handle records that Zebra will index but
which MARC::Record won't parse.  In particular, MARC::File::USMARC
croaks on records that contain non-alphanumeric characters in the
tag name.

To test:

[1] After applying this test, run prove -v t/db_dependent/Search.t
    The test script will die when it gets to the regression test.
[2] After applying the main patches that fix the bug, the test
    script should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-14 18:04:39 +00:00
Galen Charlton
37d5da91cd Merge branch 'new/bug11137' 2013-11-14 15:51:17 +00:00
Galen Charlton
dd36a1ffa1 Bug 11137: fix certain types of searches run using QueryParser
QueryParser was loading redundant search aliases, which in turn resulted
in certain queries involving two or more clauses joined by a Boolean
operator getting parsed in correctly.

To test:

[1] Enable QueryParser.
[2] Arrange your database so that some some bib records contain
    the keyword 'history' while a smaller subset contain
    both 'history' and 'earth'.  (The exact words used don't
    matter.)
[3] Run the following search from the OPAC global search bar:

    kw:history && kw:earth

[4] Observe that the records that are returned include *all* bibs
    in the database with the keyword 'history'.  In other words, the
    restriction  that the records must also contain 'earth' is not
    observed.
[5] Apply the patch and rerun the search.
[6] This time, the results that are returned should include only those
    that contain both 'history' and 'earth'.
[7] Verify that prove -v t/QueryParser.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plans, all tests and QA script.
Also checked the db_dependent/Search.t tests.
Tried some other searches, all seems to be working correctly.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
I reproduce the bug and I confirm this patch fixes it.
Without the patch, kw:history && kw:earth, I got:
  Search biblios OK 4 1 1+0 RPN @attrset Bib-1 @attr 4=6 @attr 1=1016 history
With the path, I get:
   Search biblios OK 2 1 1+0 RPN @attrset Bib-1 @and @attr 4=6 @attr 1=1016 history @attr 4=6 @attr 1=1016 earth

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-14 15:50:50 +00:00
Galen Charlton
5ca295738a Bug 11137: regression tests for QP search field alias bug
This patch adds regression tests to verify that
Boolean searches using QueryParser function correctly.

This patch also ensures that QP is correctly initalized
when Search.t is run.

To test:

[1] Apply this patch and the following patch.
[2] Verify that prove -v t/QueryParser.t works
[3] Verify that prove -v t/db_dependent/Search.t works
[4] (optional) instead of applying both patches at the same
    time, apply only the regression test patch and run the
    tests listed in steps 2 and 3.  The following tests
    should fail:

t/db_dependent/Search.t (Wstat: 512 Tests: 198 Failed: 2)
  Failed tests:  42, 71
  Non-zero exit status: 2
t/QueryParser.t (Wstat: 256 Tests: 28 Failed: 1)
  Failed test:  12
  Non-zero exit status: 1

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-14 15:50:16 +00:00
Galen Charlton
87470f394a Bug 11218: (follow-up) fix whitespace
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-08 16:23:39 +00:00
Katrin Fischer
1528a6deda Bug 11218: (follow-up) fix some whitespace and a variable declaration
Fixing some things the QA script pointed out this morning:

- whitespace
- variable declaration

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-08 16:23:22 +00:00
Katrin Fischer
2b391db890 Bug 11218: regression tests for Due notice generation
Changes tests for GetUpcomingDueIssues:

days_in_advance should be inclusive:
 2 should find items due in 2 days from now.
 1 should find items due tomorrow.
 0 should only find items due today.

Adds new tests for Bug 11218:

As the advance_notices.pl, the only script using GetUpcomingDueIssues
is not only used for PREDUE notices, but also for
DUE notices, we need to also select items due today.

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-08 16:21:55 +00:00
Galen Charlton
9c5e40e492 Bug 10403: (follow-up) fix test to use vendor created earlier during test
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-01 02:31:22 +00:00
Jonathan Druart
5d170aa268 Bug 8015: Add unit tests for SimpleMARC and MarcModificationTemplates routines
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Bug 8015: Fix complains from qa tools

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

Bug 8015: Get rid of the eval in ModifyRecordWithTemplate

This patch removes the use of eval in the
C4::MarcModificationTemplates::ModifyRecordWithTemplate routine.

Now this routine call the wanted modification routine with the list of
parameters.
This call is done only if the condition is respected.

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

Bug 8015: Get rid of eval for evaluating =~ m//

Koha::SimpleMarc::field_equals uses eval in order to check if a string
matches a pattern.
Now this eval is removed and the "regex" variable does not contain the
regex separated character (/ or |).

Regression: Before this patch, the user was able to user a modifier. Now
it is not possible.

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

Bug 8015: Get rid of the eval for substitution

Before this patch, the regex substitution was contain into only one
variable (e.g. my $regex = "/foo/bar/i").
Now each member of the regex is stored into a field in the
marc_modification_template_actions sql table.

In order to avoid a complex code, only modifiers i and g are take into
account.

Note: If you already add the mmta table, you have to drop it.
This patch also adds a foreign key from mmta to mmt tables.

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

Bug 8015: FIX ui issue

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

Bug 8015: The template name is a required field

Test plan:
Try to add a template with an empty string as name.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 22:50:11 +00:00
Galen Charlton
7c521a8cf2 Bug 8435: (follow-up) prevent t/00-load.t failing
C4::Serials now needs a valid context in order to
load.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 18:51:04 +00:00
Julian Maurice
fe777ef937 Bug 7295: (follow-up) several fixes
- List of libraries in basket.pl is now sorted by branch name, not code
- When IndependantBranches is ON, user has only the possibility to set
  basket branch to its own branch, or to no branch at all.
- When basket do not belong to any branch, selected branch by default is
  connection branch (was 'no branch')
- added id attributes to both added li elements
- change description of 'order_manage_all' permission to make it
  clearer.
- remove Test::MockModule dependency

Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr>
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>
2013-10-31 16:37:08 +00:00
Julian Maurice
54616c37e2 Bug 7295: More granular permissions for baskets
- Add branch info to baskets
- Add a list of borrowers that are allowed to manage a basket (one list
for each basket).
- Add a new subpermission: acquisition => order_manage_all

If user is superlibrarian, or if that user has permission acquisition = 1
(GranularPermissions = OFF), or subpermission acquisition =>
order_manage_all (GranularPermissions = ON), that user is authorised to manage
all baskets.

Depending on syspref AcqViewBaskets:
  'all': user can manage all baskets
  'branch': user can manage baskets of their branch (the basket branch is
            taken into account, not the branch of the basket's creator).
            If basket branch is not defined, all users can manage this
            basket.
  'user': user can manage baskets she created, and baskets in their
          user list

There are unit tests in t/Acquisition/CanUserManageBasket.t, which
require Test::MockModule

You can edit basket's branch and users list in basket modification page
(acqui/basket.pl)

Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr>
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>
2013-10-31 16:35:35 +00:00
Jonathan Druart
5248f12a0e Bug 8435: (follow-up) handle lack of userenv gracefully
C4::Serials::can_edit_subscription now deals with C4::Context->userenv.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 15:29:42 +00:00
Jonathan Druart
019049fc51 Bug 8435: (follow-up) the unit tests should create the biblio
Previous version does not create the biblio.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 15:29:32 +00:00
Jonathan Druart
56ee35d3fb Bug 8435: (follow-up) use a transaction for unit tests
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 15:29:25 +00:00
Jonathan Druart
dc3dd3ede6 Bug 8435: (follow-up) add unit tests for can_edit_subscription
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 15:29:19 +00:00
Galen Charlton
8c60cd41a8 Bug 8037: (follow-up) improve GetBudgetByOrderNumber test
This patch moves the GetBudgetByOrderNumber() test from
Budgets.t to Acquisition.t, thereby making it easier to
test without doing a direct SQL insert into the aqorders table.

To test:

[1] Verify that prove -v t/db_dependent/Budgets.t passes
[2] Verify that prove -v t/db_dependent/Acquisition.t passes

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 14:57:18 +00:00
dd22c0ec0f Bug 8037: (follow-up) fix various issues
[1] Add test for GetBudgetByOrderNumber()
[2] Remove unconditional warn.
[3] Remove MySQLism

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 14:53:16 +00:00
Galen Charlton
72b1782487 Bug 7688: (follow-up) have Serials.t create its test subscription
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 05:07:44 +00:00
Jonathan Druart
378ae7d0e6 Bug 2720: (follow-up) improve unit tests
Create the patron.
Use a transaction.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 01:55:04 +00:00
80897930b7 Bug 2720 - Overdues which debar automatically should undebar automatically when returned
This patch adds a more extensible and flexible debarments system to Koha. The fields
borrowers.debarred and borrowers.debarredcomment are retained for compatibility and
speed.

This system supports having debarments for multiple reasons. There are currently
three types of debarments:
OVERDUES    - Generated by overdue_notices.pl if the notice should debar a patron
SUSPENSION  - A punative debarment generated on checkin via an issuing rule
MANUAL      - A debarment created manually by a librarian

OVERDUE debarments are cleared automatically when all overdue items have been returned,
if the new system preference AutoRemoveOverduesRestrictions is enabled. It is disabled
by default to retain current default functionality.

Whenever a borrowers debarments are modified, the system updates the borrowers debarment
fields with the highest expiration from all the borrowers debarments, and concatenates
the comments from the debarments together.

Test plan:
 1) Apply patch
 2) Run updatedatabase.pl
 3) Verify the borrower_debarments table has been created and
    populated with the pre-existing debarments
 4) Run t/db_dependent/Borrower_Debarments.t
 5) Manually debar a patron, with an expiration date
 6) Verify the patron cannot be issued to
 7) Add another manual debarment with a different expiration date
 8) Verify the 'restricted' message lists the date farthest into the future
 9) Add another manual debarment with no expiration date
10) Verify the borrower is now debarred indefinitely
11) Delete the indefinite debarment
12) Verify the debarment message lists an expiration date dagain
13) Enable the new system preference AutoRemoveOverduesRestrictions
14) Set an overdue notice to debar after 1 day of being overdue
15) Check out an item to a patron and backdate the due date to yesterday
16) Run overdue_notices.pl
17) Verify the OVERDUES debarment was created
18) Return the item
19) Verify the OVERDUES debarment was removed
20) Disable AutoRemoveOverduesRestrictions
21) Repeat steps 15 though 18, verify the OVERDUES debarment was *not* removed
22) Add issuing rules so that an overdue item causes a temporary debarment
23) Check out an item to a patron and backdate the due date by a year
24) Return the item
25) Verify the SUSPENSION debarment was added to the patron

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>
2013-10-31 01:53:22 +00:00
Galen Charlton
a0b042b8a2 Bug 10078: (follow-up) add regression test
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 05:02:45 +00:00
e74b91165d Bug 10243: (follow-up) add unit tests
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 03:13:23 +00:00
Galen Charlton
f0aef5e044 Bug 7688: (follow-up) update test cases to reflect change in NewSubscription()
This patch also corrects an error in the description of
NewSubscription().

Named parameters for this function cannot come soon enough.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 02:27:20 +00:00
Julian Maurice
89938401c8 Bug 7688: (follow-up) rewrite 'for' loop in unit tests
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 00:38:52 +00:00
Julian Maurice
21be80ff97 Bug 7688: (follow-up) add unit tests for C4::Serials::GetNextSeq()
These tests are split in two parts: "db dependent" and "db
independent".
GetNextSeq requires DB only when checking for irregularities.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 00:38:28 +00:00
Julian Maurice
8f31154cbc Bug 7688: (follow-up) add unit tests for C4::Serials::GetNextDate()
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 00:37:58 +00:00
Julian Maurice
a575582cf2 Bug 7688: (follow-up) add unit tests for C4::Serials::Numberpattern
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 00:37:32 +00:00
Julian Maurice
05bb6f4f37 Bug 7688: (follow-up) add unit tests for C4::Serials::Frequency
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 00:37:05 +00:00
Julian Maurice
d93ec41012 Bug 7688: (follow-up) rewrite t/db_dependant/Serials.t
A lot of tests were just a call to a funtion without any arguments,
whereas the function expect at least one argument.
These tests were kept, but all return values are now undef when a
mandatory argument is missing, so return values are consistent.

The part where subscription periodicity is changed could not work
because of ',' appended to each key in ModSubscription call. So it's
rewritten, taking into account the new API for subscription frequencies.
This script should leave your database intact because it revert any
modification made.

Also fix some warnings in C4::Serials and in C4::Items.
And fix a typo in koha-tmpl/.../subscription-numberpatterns.tt

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

Comment: Work as described. No errors
Tested, again, without trouble.
With a suscription, tests successful.
No koha-qa errors

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 00:35:38 +00:00
Galen Charlton
935ed2876b Bug 10271: regression test for search using indexes containing 'ns'
This patch adds a regression test for doing a form-based catalog
search using an index that contains the string 'ns' in its name.  In
this case, the index being tested is 'Code-institution'.

To test
-------
[1] Prove -v t/db_dependent/Search.t should have two failed tests;
    one each for GRS-1 and DOM testing.
[2] After applying the main patch for this bug, the tests should
    pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-28 16:10:33 +00:00
Galen Charlton
b67654ecc2 Bug 10493: (follow-up) fix test errors
[1] Fix regression on bug 10663

Looks like the regression was introduced by a glitch during rebasing.

[2] Fix errors in Circulation_issue.t

The change in AddRenewal() turned up an issue with how the test
script issued one of the test items.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-23 04:25:34 +00:00
Jonathan Druart
1afd7fe270 Bug 5336: (follow-up) use understandable codes rather than magic numbers for orderstatus
This patch uses understandable codes instead of magical numbers for the
aqorders.orderstatus field.

+ execute sql queries in unit tests into a transaction.

Signed-off-by: Pierre Angot <tredok.pierre@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-22 13:29:23 +00:00
Jonathan Druart
11165a05af Bug 5336: (follow-up) add unit tests for 3 acq routines
Unit tests In C4::Acquisition for:
- CloseBasket
- ReopenBasket
- GetBiblioCountByBasketno

Signed-off-by: Cedric Vita <cedric.vita@dracenie.com>
Signed-off-by: Pierre Angot <tredok.pierre@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-22 13:28:43 +00:00
Jared Camins-Esakov
480841965e Bug 10403: add ability to change fund on receipt
Right now there is no way to change the budget or fund when receiving an
item, which is annoying, particularly at the end of the fiscal year when
every item not already received has to be switched to the following
year's budget. This patch adds the ability to change the budget and fund
when receiving.

To test:
1) Apply patch.
2) Create an order for a vendor, choosing a fund to use for that order.
3) Receive the order, leaving the fund unchanged. Make sure the fund
   did not change.
4) Create another order for a vendor, choosing a fund to use for that
   order.
5) Receive the order, this time changing the fund. Make sure the fund
   is changed.
6) Run the unit test:
    > prove t/db_dependent/Acquisition.t
7) Sign off.

(Notes: this patch depends on the Acquisitions.t unit test improvements
in bug 10274; the seemingly-unrelated change in SQLHelper quiets an
irritating warning caused by the NewOrder call in ModReceiveOrder)

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-22 12:57:25 +00:00
Jared Camins-Esakov
88b46f3422 Bug 10401: Add ability to merge invoices
Given how easy it is to accidentally receive items from one invoice on
multiple invoices, the ability to merge invoices can be quite handy.
This patch adds that ability to Koha's Acquisitions module.

To test:
1) Apply patch.
2) Run unit test:
    > prove t/db_dependent/Acquisition/Invoices.t
3) Create two invoices from the same vendor for merging, and receive at
   least one order on each.
4) Do a search on the Invoices page that brings up both the invoices you
   created.
5) Check the boxes next to the two invoices.
6) Click "Merge selected invoices."
7) Choose which invoice you want to keep (the default will be the first).
8) Click "Merge."
9) Confirm that the resulting invoice has all the orders you received
   listed on it.
10) Sign off.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Merged several invoices sucessfully - with and without received
orders, open and closed. Works nicely.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-21 19:08:03 +00:00
Galen Charlton
7c4f526a86 Bug 10723: (follow-up) add more unit tests for SearchOrders()
In particular, verify that the pending filter option works.

To test:

[1] Verify that prove -v t/db_dependent/Acquisition.t passes

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-21 18:49:37 +00:00
Jonathan Druart
4820462185 Bug 10723: Merge GetPendingOrders and SearchOrders routines
In the C4::Acquisition module, 2 routines do the same work. This patch
merges these 2 routines.

Test plan:
test the acqui/orderreceive.pl, acqui/uncertainprice.pl
and serials/acqui-search-result.pl, acqui/parcel.pl scripts.

Note: on acqui/parcel the basket filter is a search on basket name (was
on basket id, which was not relevant).

Signed-off-by: Pierre Angot <tredok.pierre@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pm, no adverse bahaviors noted. All sub calls updated.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-21 18:24:32 +00:00
Galen Charlton
7b165794cd Bug 10016: force zero browser-side caching of SCO pages
This patch makes the web-based self-check module pages
specify that no browser (or proxy caching) occur at all.
This prevents a security issue where letting the SCO session time out,
then hitting the back button allowed one to view the previous
patron's session.

This patch adds an optional fifth parameter to output_with_http_headers(),
and output_html_with_http_headers(), a hashref for miscellaneous
options.  One key is defined at the moment: force_no_caching, which if
if present and set to a true value, sets HTTP headers to specify no
browser caching of the page at all.

To test:

[1] Start a web-based self-check session and optionally perform
    some transactions.
[2] Allow the session to time out (it may be helpful to set
    SelfCheckTimeout to a low value such as 10 seconds).
[3] Hit the back button.  You should not see the previous patron's
    self-check session.
[4] Verify that prove -v t/Output.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Ed Veal <ed.veal@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-21 18:05:12 +00:00
Jonathan Druart
a9b564678e 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>
2013-10-18 06:16:57 +00:00
Galen Charlton
66de7d0e17 Bug 10380: (follow-up) remove inadvertant database dependency for t/DateUtils.t
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-18 04:27:42 +00:00
Galen Charlton
4b863c1b36 Bug 10380: (follow-up) update two more uses of output_pref()
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-17 23:35:31 +00:00
Jonathan Druart
977d78dd5b Bug 10380: (follow-up) update some uses of output_pref()
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-17 23:35:15 +00:00
Jonathan Druart
45e6a7e58f Bug 10380: Change prototype for output_pref() routine
Koha::DateUtils::output_pref took 4 parameters and the last one is a
boolean, so some calls were:
  output_pref($dt, undef, undef, 1)

This patch changes its prototype to
  output_pref({
    dt => $dt,
    dateformat => $dateformat,
    timeformat => $timeformat,
    dateonly => $boolean
  });

An alternative is to call the output_pref routine with a datetime
object, without using an hashref:

  output_pref($dt);

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>
2013-10-17 23:34:26 +00:00
Galen Charlton
969669bb1e 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>
2013-10-17 23:06:49 +00:00
Galen Charlton
5a384cc643 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>
2013-10-17 23:06:44 +00:00
Galen Charlton
d1ddce95d4 Bug 8798: (follow-up) remove DBIC_DONT_VALIDATE_RELS
This corrects a failing test and follows a recommendation
by the maintainer of DBIx::Class.  This patch also
adds a couple new directories for t/00-testcritic.t to
check.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 22:51:44 +00:00
b41d5d0e8a Bug 10565: (follow-up) don't assume borrowernumber 1 exists in unit test
Signed-off-by: Nora Blake <nblake@masslibsystem.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:30:34 +00:00
3b70e7e62c Bug 10565: Add a "Patron List" feature for storing and manipulating collections of patrons
The patron lists feature is somewhat similar to the record lists feature
in that it allows a librarian to create a list of patrons for later
retrieval and manipluation. These lists can then be used with the batch
patron modification tool.

Test Plan:
 0) Apply the patch for Bug 8798
 1) Apply this patch
 2) Run updatedatabase.pl
 3) Access the patron lists feature from Koha's Tools menu.
 4) Create a new list via the "New patron list" button.
 5) For this list, click the "Edit" button, and change the list name.
 6) For this list, click the "Add patrons" button, and search for and
    add some patrons to your list.
 7) For this list select some patrons to remove them.
 8) Try both adding some new patrons, and removing some old patrons
    as a single action.
 9) Click the "Patrons" link on the Koha toolbar
10) Search the patrons, or browse by letter to get patron results
11) Check the checkboxes next to one or more patrons, and add the
    selected patrons to your existing list.
12) Change the "Selected patrons" pulldown to "All resultant patrons"
    and add them to your list.
13) Check the checkboxes next to one or more patrons, and add the
    selected patrons to a new list.
14) Try manipulating a list of patrons using the batch patron
    modification tool.
15) Go back to the Patron Lists feature and delete your lists.
16) Run 'prove t/db_dependent/PatronLists.t'

Signed-off-by: Nora Blake <nblake@masslibsystem.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:29:44 +00:00
Chris Cormack
398b9dfdbd Bug 8798: moving code to Koha::Database and adding tests
- Fixing a bug .. ping does not exist we need to use connected

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:08:02 +00:00
Elliott Davis
8a480ad75d Bug 8798: DBIx::Class base classes for all Koha tables
* Added base class files for all tables in koha using
DBIx::Class::Schema::Loader.
* Added a (very basic) test file for C4::Context
* Also added dependencies in required files.

To Test:

[1] Install patch
[2] Make sure you can still connect to Koha
[3] You may optionally run this test script:

        use Koha::Database;
        use Data::Dumper;
        my $db = Koha::Database->new();
        my $schema = $db->schema();
        print Dumper($schema->resultset("Borrower"));

    If you run this file you should get a DBIx dump of the borrowers table.

Signed-off-by: wajasu <matted-34813@mypacks.net>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:07:24 +00:00
Galen Charlton
f17fab3ed9 Bug 10689: add regression test
This adds a test to verify that the public subscription
note is returned by a subscription search.

To test:

[1] Verify that t/db_dependent/Bookseller.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-11 04:24:57 +00:00
Galen Charlton
567e86d575 Bug 10853: (follow-up) expand unit tests for C4::Csv
To test:

[1] Verify that prove -v t/db_dependent/Csv.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-11 03:25:42 +00:00
Jared Camins-Esakov
b5bd2b7586 Bug 5202: merge authorities from the authority file and reservoir
This patch gives Koha the ability to merge authority records using the
same interface used by bibliographic records, though slightly different
methods for selecting which records to merge. The two ways to select
records are as follows:

1) Records can be selected from authority search results by clicking
   the "Merge" link for two records.
2) Authority records can be merged from the reservoir by clicking the
   merge-related links in the Manage staged MARC batch screen.

To test:
1) Apply patch.
2) Do a search for an authority record that will turn up multiple
   identical records (or at least two records that you don't mind
   merging).
3) Click the "Merge" link for the first record.
4) Click the "Merge" link for the second record.
5) Choose which fields from which record you want to appear in the
   resulting record.
6) Confirm that those are the fields that exist in the resulting record.
7) Stage an authority record (for example, an authority record you
   saved from your catalog.
8) Search for a record to merge with it using the "Search for a record
   to merge in a new window" link.
9) Merge these records, confirming that the resulting record (after
   going through the entire merging process) matches your expectations.
10) Set up a matching rule for authorities, and export an authority from
    your catalog that will match based on that rule. For MARC21, the
    following is a good choice for a rule:
    Matching rule code:  AUTHPER
    Description:         Personal name main entry
    Match threshold:     999
    Record type:         Authority record
    [Match point 1:]
    Search index:   mainmainentry
    Score:          1000
    Tag:            100
    Subfields:      a
11) Stage the record you just exported, choosing the matching rule you
    just created.
12) Merge the record using the "Merge" link, confirming that the
    resulting record (after going through the entire merging process)
    matches your expectations.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch in series.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-10 21:32:27 +00:00