Commit graph

638 commits

Author SHA1 Message Date
Jonathan Druart
dd36f80e2c Bug 12168: Add unit tests for GetBudgetHierarchySpent & GetBudgetHierarchyOrdered
Test plan:
prove t/db_dependent/Budgets.t

Note: This addition may sound overkill but I found this bug developing
bug 12164 and I will reuse all of that.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 21:55:21 +00:00
Galen Charlton
4af38b9908 Bug 7841: add a direct regression test
This patch adds a direct regression test for verifying that
no warnings are generated when getTranslatedLanguages() is called
without a defined current language, as might happen during
installation.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 16:40:23 +00:00
Mark Tompsett
5b898a09bb Bug 7841: add unit tests to detect no functional changes to getTranslatedLanguages()
When called with undef, floody messages appear in the error
logs. Less floody messages appear when using 'en' as the
language.  This patch adds tests to verify that the behavior of
getTranslatedLanguages() doesn't change when a subsequent
patch updates it to not generate the warnings.

TEST PLAN
---------
1) apply the patch
2) prove -v t/db_dependent/Languages.t
   -- All the tests should pass, including the last two which
      a) check that when undef is used no language is marked
          as current.
      b) check that when 'en' is used there is a language marked
          as current.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 16:38:57 +00:00
Galen Charlton
795700d8f0 Bug 12214: add regression test for reporting error when running report with SQL error
To test:

[1] Run prove -v t/db_dependent/Reports_Guided.t. Last test should
    fail.
[2] Apply the main patch.
[3] Run step 1 again.  This time, all tests should pass.

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-05-09 14:39:54 +00:00
Julian Maurice
606e902838 Bug 11843: (follow-up) fix unit test in t/db_dependent/Serials.t
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-05-09 14:28:58 +00:00
Galen Charlton
ac3e5e5147 Bug 8375: (follow-up) adjust another test case for change in fonts
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-06 21:24:40 +00:00
Galen Charlton
2afadcc358 Bug 9532: add regression test
To test:

[1] Run prove -v t/db_dependent/Holds.t.  The last test
    should fail.
[2] Apply the main patch.
[3] Run step 1 again.  This time the tests should all pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 17:17:36 +00:00
Galen Charlton
e92b6e3dff Bug 4397: (follow-up) adjust unit test reflect return of display version of scan terms
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 05:26:18 +00:00
Galen Charlton
cf7d0c3a99 Bug 7442: (follow-up) adjust UNIMARC test case to match change in BuildSummary()
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 04:18:22 +00:00
Galen Charlton
b16336caf8 Bug 10807: (follow-up) remove comment about routine that is no longer present
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 02:58:29 +00:00
Jonathan Druart
50e326e5c2 Bug 10807: (follow-up) fix UT t/db_dependent/Search_SearchHistory.t
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 02:34:39 +00:00
Jonathan Druart
ba41b7da79 Bug 10807: Add an authority search history for the OPAC
Like biblio, this feature provides an authority search history.
This history is available for connected and disconnected user.
If the user is not logged in Koha, the history is stored in an
anonymous user sessin.

The search history feature is now factorized in a new module.

This patch adds:
- 1 new db field search_history.type. It permits to distinguish the
  search type (biblio or authority).
- 1 new module C4::Search::History. It deals with 2 different storages:
  DB or cookie
- 2 new UT files: t/Search/History.t and t/db_dependent/Search/History.t
- 1 new behavior: the 'Search history' link (on the top-right corner of
  the screen) is always displayed.

Test plan:
 1/ Switch on the 'EnableOpacSearchHistory' syspref.
 2/ Go on the opac and log out.
 3/ Launch some biblio and authority searches.
 4/ Go on your search history page.
 5/ Check that all yours searches are displayed.
 6/ Click on some links and check that results are consistent.
 7/ Delete your biblio history searches.
 8/ Delete your authority searches history searches.
 9/ Launch some biblio and authority searches
10/ Delete all your history (cross on the top-right corner)
11/ Check that all your history search is empty.
12/ Launch some biblio and authority searches.
13/ Login to your account.
14/ Check that all previous searches are displayed.
15/ Launch some biblio and authority searches.
16/ Check that these previous searches are displayed under "Current
session".
17/ Play with the 4 delete links (current / previous and biblio /
authority).

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All patches together pass QA script and tests.
Also, new tests in t/db_dependent/ pass.

Tested in all 4 OPAC themes, being logged in and anonymous.
Anonymous search history will be appended to personal search
history after logging in.
Also verified that cleanup_database still purges search history,
now also including the authority searchs.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 02:32:27 +00:00
Galen Charlton
275e389afb Bug 6739: (follow-up) add unit tests for GetMemberDetails()->{is_expired}
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 02:07:32 +00:00
Galen Charlton
c221194a94 Bug 11466: (follow-up) add additional test
This adds an additional test case to document the behavior
that if AdvancedSearchTypes contains 'itemtypes' or /is/
'itemtypes', that it returns the same results.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 23:24:06 +00:00
Olli-Antti Kivilahti
24dd5ea3d2 Bug 11466: improve selection of item types for purchase order desired format list
This patch ensures that the list of desired formats for a purchase
suggestion includes the list of item types so long as the
AdvancedSearchTypes system preference includes 'itemtypes'.

--------------
-- Synopsis --
--------------

When system preference AdvancedSearchTypes has other values than 'itemtypes',
for ex 'itemtypes|loc', itemtypes selection in opac-suggestions.pl
is not populated with available itemtypes.

This patch fixes the issue by broadening the strict comparison of
($advanced_search_types eg 'itemtypes') #fails 'itemtypes|loc'
to
($advanced_search_types =~ 'itemtypes') #succeeds 'itemtypes|loc'

Unit tests included

---------------
-- Test plan --
---------------

REPLICATING THE ISSUE
1. Set system preference  AdvancedSearchTypes to itemtypes|loc
2. Go to opac-suggestions.pl and observe Item type <select> dropdown list
2.1. List should have only the default value

AFTER APPLYING THIS PATCH
1. Set system preference  AdvancedSearchTypes to itemtypes|loc
2. Go to opac-suggestions.pl and observe Item type <select> dropdown list
2.1. List should have itemtypes available for selection

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Tests worked as expected. Placed a suggestion and saw the whole
list of item types, chose one, saved, checked staff and it loaded
as expected. Changed item type in staff and it applied in both
views.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests including new regression tests.
Restores old functionality.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 23:20:33 +00:00
Galen Charlton
f13c72ebee Bug 9593: (follow-up) don't make currency.isocode required
This patch changes the price parsing so that it can fall
back on the currency name if an ISO code is not supplied; this allows
for handling the very common situation where the currency name
as entered was already the same as the ISO code.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 22:21:17 +00:00
Lyon3 Team
94d3aed746 Bug 9593: improve parsing of prices from staged files
Initial bug :
When there's a round price with no decimals after it,
or when the symbol is after the digits, the price is not captured
by regular expression in MungeMarcPrice routine and the variable
is not initialized.

Enhancement :
The MungeMarcPrice routine had been widely modified.
It's still possible to priority pick the active currency but
unlike the previous mechanism that worked only for prices preceded
by the currency sign, it's now valid wherever the symbol is situated.
As symbol you may enter a pure currency sign as well as a string
including it like '$US'. Moreover, an 'isocode' column had been
added in currency table (editable in the staffo interface from
Administration/Currencies and exchange rates). So the active
currency can be picked either through its symbol or through its iso
code.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests, especially t/db_dependent/MungeMarcPrice.t
Checked currencies can be added, edited and deleted.
Notes: new ISO code field is mandatory.
       Sample sql files need to be updated (bug 12146)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 22:02:08 +00:00
Jonathan Druart
a6affb44e2 Bug 7180: QA followup
- fix unit tests (use a transaction).
- add 3 tabs on the page in order to be more understandable.
- fix a warn in logs

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:52:06 +00:00
Jonathan Druart
3c8c0591e2 Bug 7180: Add UT for C4::Budgets::GetBudgetByCode
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:45:17 +00:00
Galen Charlton
80c68171bd Bug 10694: (follow-up) remove truncate table from test case
Doing a truncate of a table in MySQL causes an implicit commit.
Consequently, they should not be used in DB-dependent test cases,
as they will cause the changes to NOT be rolled back.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 22:00:45 +00:00
0b2e9dbf62 Bug 10694: (follow-up) add unit tests, improve AddReturn POD
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 21:46:41 +00:00
Jonathan Druart
7ca4f590ac Bug 11696: ensure that print overdue notices use the print template
This reordering avoids the case where a print notice is sent with an
email or sms template is no email or SMS is defined.

Test plan:
Check print, sms and email for an overdue rule
Don't define an email address and generate an overdue for a user
Define 3 templates for the notice used
Launch the cronjob script and verify the print notice is generated using
the print template.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:21 +00:00
Galen Charlton
6b1c114cc6 Bug 10845: (follow-up) update how a test case counts print hold available notices
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:19 +00:00
Jonathan Druart
f7537bc938 Bug 9016: (follow-up) fix unit tests
The unit tests should insert overdue rules.
+ Fix the doc for GetOverdueMessageTransportTypes

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:17 +00:00
Jonathan Druart
e421ec4925 Bug 9016: Define different transport types for overdues
This patch adds:
- a new routine C4::Overdues::GetOverdueMessageTransportTypes.
- the ability to define one or more transport types for an overdue
  level.

Test plan:
- go on tools/overduerules.pl.
- verify that previous rules still exist and that the 'email' checkboxes
  is checked if a rule is defined.
- redefined rules at different levels and check the transport type
  needed. Currently, only email, sms and print are relevant
- Save the changes.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:16 +00:00
Jonathan Druart
8214541114 Bug 9016: Create a message for each transport type.
This patch adds:
- a new jquery plugin : insertatcaret.
- the ability to define a notice template for each transport type.
- a new routine C4::Letters::GetMessageTransportTypes.

Test plan:
- Go on tools/letter.pl and check that all existing notices are still
  there.
- Modify one. A new empty message is present for sms, print, etc. The
  email message is filled with the existant value.
- Add a message for sms for example (don't forget the subject) and save.
- edit again and verify the sms message has been saved.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:16 +00:00
Galen Charlton
18ae04a4ac Bug 11334: (follow-up) teach the search tests to mock the DisplayLibraryFacets syspref
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-30 03:29:46 +00:00
Galen Charlton
17a43f9159 Bug 7844: (follow-up) don't test koha.psgi for ability to compile (yet)
Given the experimental nature of Plack support, for now we're
excluding koha.psgi from the Perl compilation tests.  This should be
changed as we get closer to making Plack support a first-class option.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-29 19:34:23 +00:00
ddab9e939b Bug 11518: (follow-up) Make unit tests pass
This works around a problem where the database handle
returned by C4::Context->dbh() is not the same as the one
used by Koha::Database.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-29 15:06:24 +00:00
c3c7105fe7 Bug 11518: (follow-up) Change method name from 'itemtype' to 'effective_itemtype' for clarity
Test runs without errors.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-29 15:05:24 +00:00
cef35259ee Bug 11518: Add new method to K::S::R::Item that will always return the correct itemtype
There are many disparate areas of Koha that deal with item level
itemtypes vs record level itemtypes. We can take advantage of
DBIx::Class to make smarter objects that automatically return the
correct value depending on the system preference.

Test Plan:
1) Apply this patch
2) Run t/db_dependent/Items.t

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-29 15:04:55 +00:00
Galen Charlton
2f5e9df121 Bug 12134: (follow-up) fix one of the IsDebarred() tests
- pass valid ISO date to the debar-date-in-future test
- correctly verify that patron is restricted

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 17:08:00 +00:00
Jonathan Druart
c2d0a49def Bug 12134: (follow-up) add more unit tests to reflect the change in IsDebarred
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 17:04:39 +00:00
Jonathan Druart
9f1f7da8ac Bug 12134: Add unit tests to reflect the change in IsDebarred
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 17:03:48 +00:00
Jonathan Druart
89eb48b1e1 Bug 10859: (follow-up) GetIssues.t - Execute unit tests in a transaction
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 05:30:25 +00:00
Jonathan Druart
b7d47ac66b Bug 10859: Alert if a borrower already has an issue for the same biblio
This patch adds a new system preference, AllowMultipleIssuesOnABiblio.

If this system preference is OFF, an alert is raised if a patron
tries to check out an item even when they already have a different
item checked out from that bib.

The librarian can force the checkout anyway.

It doesn't alert the librarian if the biblio is a subscription

Test plan:
1. Create a biblio with at least 2 items
2. Checkout the first item for a borrower
3. Set syspref AllowMultipleIssuesOnABiblio to OFF.
4. Try to checkout the second item with the same borrower. A message
should appear telling you that this borrower already borrowed an item
from this biblio.
If you have the permission 'force_checkout' You should also see two
buttons to confirm (or not) the checkout
5. Click on 'No'. The checkout is not done
6. Repeat step 4 and click 'Yes', the checkout is done.
7. Return the second item.
8. Set syspref AllowMultipleIssuesOnABiblio to ON
9. Try to checkout the second item with the same borrower. This time
the checkout is done without warnings.

Followed test plan. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass, works well. Tested:

* Permission to override
  * check out a second item from a record with subscriptions works
  * check out a second item from a 'normal' record is warned about,
  but can be done

* No permission to override
  * subscription item: can be checked out
  * normal item: can't be checked out

* Feature turned off
  * Check out never warns/blocks

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 05:28:05 +00:00
Galen Charlton
2ca087cf5c Bug 7288: (follow-up) add unit test for is_linked_to_subscriptions flag
This adds a direct unit test of the is_linked_to_subscriptions flag
and corrects a typo in the previously-submitted test.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 05:16:29 +00:00
Galen Charlton
afa6a33449 Bug 7288: (follow-up) various fixes
- Fix syntax error in supplied test
- remove subscriptionid as a field returned by GetInvoices(), as
  the is_linked_to_subscriptions Boolean takes its place.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 05:07:37 +00:00
Jonathan Druart
c2461cf171 Bug 7288: (follow-up) set a boolean if the invoice if linked to subscriptions
If an invoice is linked to subscription, we need to set a boolean to
true in order to filter them in the interface.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 05:02:48 +00:00
Galen Charlton
e453ba2fa5 Bug 11027: (follow-up) update unit test to reflect new columns returned by GetLateOrders
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 04:39:04 +00:00
Jonathan Druart
e8e0af4c37 Bug 11551: Add unit tests for using GetHistory to search by order number
prove t/db_dependent/Acquisition.t should return green.

Signed-off-by: remy juliette <juliette.levast@iepg.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 04:22:12 +00:00
Jonathan Druart
6eb69ed3ec Bug 11552: allow searching on original order number after a transfer
If an order is transferred from one basket to another, it should be
possible to retrieve it with the original order number (AKA order
line).  This patch makes it so.

Test plan:
- transfer an order
- note the original order number and the new one
- receive the order and, on the parcel page, try to find your order with
  the original order number and the new one.

Signed-off-by: sonia bouis <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

RM note: this works only for the most recent transfer, so if an order
gets transferred multiple times, earlier order numbers won't retrieve
it.
2014-04-21 03:48:31 +00:00
Galen Charlton
1931d2d22f Bug 9915: (follow-up) use SQL placeholders
This patch teaches C4::Reports::Guided::execute_query()
how to accept a list of query parameter values.  It then
follows-up on the main patch by simplifying how it converts
report parameters to a complete SQL query, and removes the
use of DBI->quote() and complicated regexes.

To test:

[1] Verify that using the OPAC svc/report service with
    sql_params continues to work.
[2] Verify that there are no regressions with running
    reports from the staff interface, both via the web
    service and the reports interface.
[3] Verify that prove -v /db_dependent/Reports_Guided.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
No regressions found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 22:54:09 +00:00
Galen Charlton
9708138a86 Bug 9032: (follow-up) restore documented intepretation of virtualshelfshares.sharedate
The sharedate column is documented as having the following meaning:

"date of invitation or acceptance of invitation"

This patch adjust the new list-sharing code to stick with that
interpretation, as otherwise the column should have been renamed
to 'invite_expiration_date' or the like.

It also removes the "housekeeping" functionality from AddShare, as
otherwise the routine should have been named AddShareAndDoOtherStuff.

To prevent list shares from piling up, a new --list-invites flag
has been added to cleanup_database.pl.  The default crontabs have
been modified to use the --list-invites flag by default.

To test
-------
[1] Make some list share invites and accept some, but now all of them.
[2] Wait 14 days (or more reasonably, manually edit the sharedate
    values for the unaccepted shares to put them at least 14 days in the
    past.).
[3] Run cleanup_database.pl --list-invites
[4] Verify that accepted shares remain, as to share invites that have
    not yet reached more than 14 days of age.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 22:52:21 +00:00
d1244ad33f Bug 9032: Unit tests for sharing lists
This patch combines some work from bugs 10389 and 10441.
With thanks to Srdjan and Jonathan Druart for their contributions.

Adds tests for AddShare, AcceptShare, IsSharedList, RemoveShare.
This patch also restores the inadvertently deleted DelShelf tests
in bug 10499.

Test plan: Run the test VirtualShelves.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 21:19:19 +00:00
Jonathan Druart
734846e4cb Bug 11243: UT: unit tests for GetBasketsInfosByBookseller
Verify prove t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t
returns green.

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>
2014-04-20 15:19:17 +00:00
Jonathan Druart
c5f8bf244b Bug 11912: (follow-up) Use the common way to mock syspref
t::lib::Mocks::mock_preference provides a simple way to mock syspref.

Test plan:
Verify that t/db_dependent/Biblio.t returns green.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 18:41:43 +00:00
774483772b Bug 11912: (refactoring followup) make GetMarcISBN implement its advertised API
The current implementation of GetMarcISBN contradicts the documented API.
It currently returns an array of hashes with only one key (marcisbn)
which doesn't add any value to it.

I chose to fix GetMarcISBN to honour the API instead of changing thex
 docs, because it seems a really silly change.

To test:
- Run:
  prove t/db_dependent/Biblio.t
=> SUCCESS
- catalogue/detail.pl should correctly show ISBNs.
- opac/opac-detail.pl should correctly show ISBNs in both prog and bootstrap.
- opac-opac-sendshelf.pl should correctly show ISBNs in the email.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 18:23:15 +00:00
da7dd4ed8c Bug 11912: (regression tests) GetMarcISBN wrongly prepends a space to ISBNs
This patch makes the tests run in both MARC21 and UNIMARC contexts.
It previously run only for MARC21. It mocks what needs to be mocked.

To test, run
 - prove t/db_dependent/Biblio.t
=> Notice the first ISBN has a space in front of it and those tests fails.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 18:20:03 +00:00
Galen Charlton
cc37493602 Bug 10986: (follow-up) add unit tests for getLanguages() and language filter
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 17:34:34 +00:00
Galen Charlton
58b5b384f6 Bug 9416: (follow-up) reconcile with work done on bug 11699
This patch teaches the ordering receiving process how to
set vendor and internal order notes.

One observation: I'm not sure it's entirely useful to set
a note to communicate to the vendor during receiving --
how is it to be sent to them, and why?

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:55:38 +00:00
Mathieu Saby
2407fcb28a Bug 9416: (follow-up) update acquisitions unit tests
This patch fixes UT, to take into account the new fields
order_internalnote and order_vendornote.

Note that "notes" field is still returned as well by some
acquisition subs (those which return all the fields of biblio
and biblioitems table)

Test plan :
run prove t/db_dependant/Acquisition.t

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:55:37 +00:00
Galen Charlton
e7433b970c Bug 11699: (follow-up) update one more test that uses ModReceiveOrder
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:55:35 +00:00
Jonathan Druart
36fc9a3e64 Bug 11699: change ModReceiveOrder to used named parameters
Test plan:
prove t/db_dependent/Acquisition.t
prove t/db_dependent/Acquisition/Invoices.t
prove t/db_dependent/Acquisition/OrderFromSubscription.t

all should return green.

NOTE: Any error messages are the same between master and this
      patch, and are unrelated to the added/revised tests.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:08:21 +00:00
Jonathan Druart
ab1a74897e Bug 11699: fixed saving notes entered when receiving orders
Revised test plan:
1/ Create an order with 2 items
2/ Receive 1 item and enter a note for the order
3/ Verify the note is not saved
    The note should be visible on the Mod Order Details screen,
    but it isn't there.
4/ Apply patch
5/ Receive the second item and enter a note for the order
6/ Verify the note is correctly saved
    The note is visible on the Mod Order Details screen.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described. The note now saves correctly and also remains when
you undo a receipt.

Note: it would be nice to show the note on the receive page as well.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 14:59:17 +00:00
Galen Charlton
9bcd3fcb99 Bug 9578: (follow-up) bump up number of MARC21/DOM tests
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 14:49:11 +00:00
Galen Charlton
70499239ba Bug 9578: add regression test
This patch adds a regression test for the condition noted
in bug 9578, where attempting a sort of a Zebra search that
fails because of an invalid query crashes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 22:34:00 +00:00
Jonathan Druart
d2c424eda2 Bug 11689: (follow-up) fix warnings generated when running Serials.t
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 21:10:39 +00:00
Jonathan Druart
a9f1c3a66f Bug 11689: Add unit tests for serials statuses
prove t/db_dependent/Serials.t

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 21:10:04 +00:00
Julian Maurice
47a9afcb7e Bug 12003: Do not calculate next pubdate for irregular subscriptions
Show 'Unknown' when planneddate and publisheddate cannot be calculated

Also fixes SQL query in misc/cronjobs/serialsUpdate.pl that was still
using "periodicity != 32" to exclude irregular subscriptions from
results

Test plan:

1) Create a subscription in the serials module. Make sure to choose:
   Frequency = Irregular
2) Test the prediction pattern, first publication date is set to
   "First issue publication date" field, others will show as
   'unknown'
3) Save the subscription
4) Check the created issue - it will show a published date and a
   planned date (same as "First issue publication date" field)
5) Receive the issue and check the next generated issue, planned
   date and published date should show as 'Unknown'
6) Generate a next issue, planned date and published date should
   also show as 'Unknown'

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described following test plan.
No koha-qa errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also tested:
- multi receiving generates mulitple issues without dates - 'unknown'
- staff detail page shows the dates empty, which is fine
- OPAC detail page shows the dates empty, which is fine
- serial collection page shows 'unknown' and those issues appear
  on the 'manage' tab, as they did in the past
- Editing the issue from the serial collection page leaves the
  date fields empty.
- Receving the issue, setting the status to 'Arrived' the Expected on
  date is set to 'today' automatically. Date published has to be
  entered manually (maybe something we could improve later
- subscription detail > issues tab shows Uknown.
- t/db_dependent/Serials/GetNextDate.t pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 20:57:51 +00:00
Galen Charlton
be3ce1e7a2 Bug 12098: (follow-up) deal with FIXMEs in t/db_dependent/Serials_2.t
This patch nails down the number of tests to be run.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 20:46:00 +00:00
Jonathan Druart
4f7803e469 Bug 12098: Fix C4::Serials::can_edit_subscription
This patch fixes a problem whereby staff users could
edit subscriptions they are not permitted to by going directly
to the subscription details page.

It also adds some unit tests for the can_edit_subscription routine
and add a new can_show_subscription routines.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Notes on second patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 20:45:59 +00:00
Galen Charlton
9af0aa288c Bug 12048: add regression test
This patch adds a regression test for verifying that superlibrarians
can see all subscription when IndependentBranches is on.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 20:45:58 +00:00
7966037747 Bug 11258: fix another case where holds queue made transfer requests that contradict the library holds policy
This patch fixes a problem where the holds queue generator
was making requests where the pickup library is the
same as the item's library but not the patron's branch,
even if there is a "Default holds policy by item type" rule that states
this item can only fill holds for patrons of the same library as the
item.

Test Plan:
1) Create a test record with 2 items with different itemtypes
2) Set the Default holds policy by item type for the first
   item to "From any library"
3) Set the Default holds policy by item type for the second
   item to "From home library"
4) Place a record level hold for a patron from another library,
   but for pickup at the same library as the item is from
5) Rebuild the holds queue
6) View the holds queue, note the item is listed, though this
   patron cannot place a hold on this item
7) Apply this patch
8) Repeat step 5, note the hold is no longer in the queue

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
automated tests pass, functional tests pass. Bug replicated, eradicated by patch.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I finally managed to reproduce this, patch works as described.
Passes tests and QA script, provided tests fail without patch, but
succeed with the patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 15:23:23 +00:00
Galen Charlton
695fdebdee Bug 12079: ensure that CheckReserves() includes reserve_id in its response
This patch modifies _Findgroupreserve so that its one caller,
CheckReserves(), would include the reserve_id field in the
hold request it returns.

Failure to include reserve_id in every circumstance resulted
in bug 11947.  This patch is therefore a complementary fix for
that bug, but is not meant to preempt the direct fix for
that bug.

To test:

[1] Verify that t/db_dependent/Reserves.t passes.
[2] Verify that the following test plan taken from
    the patch for bug 11947 works for this patch
    *without* applying the patch for 11947:

* have a few borrowers, say 4.
* have a biblio with a single item (you can scale this up, it should
  work just the same.)
* issue the item to borrower A
* have borrowers B, C, and D place a hold on the item
* return the item, acknowledge that it'll be put aside for B.
* view the holds on the item.

Without the patch:
* the hold priorities in the UI end up being "waiting, 2, 1" when they
  should be "waiting, 1, 2".
* in the database "reserves" table, they're really "0, 2, 3" when they
  should be "0, 1, 2".

With the patch:
* the hold priorities in the UI end up being "waiting, 1, 2"
* in the database, they're "0, 1, 2"

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Work as described. No koha-qa errors. Test pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-17 15:32:25 +00:00
Jonathan Druart
25451ce624 Bug 11630: (follow-up) unit tests can be independent of DB
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-16 14:55:39 +00:00
31995cbcd1 Bug 11630: (QA Followup) Move code to subroutine, add unit tests
Patch behaves as expected.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-16 14:55:08 +00:00
Galen Charlton
f2b655dfab Bug 11797: add regression test
This patch adds unit tests for C4::AuthoritiesMarc::BuildSummary
for both UNIMARC and MARC21 and a regression test for the "Odd
number of elements in anonymous hash" warning.

To test:

[1] Run prove -v t/db_dependent/AuthoritiesMarc.t.  It should
    report one failure.
[2] Apply the main patch.
[3] Run t/db_dependent/AuthoritiesMarc.t again; it should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-15 16:01:24 +00:00
Robin Sheat
95056d17b7 Bug 11947 - renumber reserves when hold is confirmed
Currently when a reserve is moved to "waiting" status because it's
acknowledged on checkin, the reserve priorities aren't renumbered. This
causes things to go a bit haywire in the UI, in particular, some
reserves can unjustly end up with priority 1 when they shouldn't. It
also seemed to mess with the logic of who should get it next, but I
didn't look too closely at that.

This patch forces a renumbering so that all the priorities remain
copacetic.

Test plan:
* have a few borrowers, say 4.
* have a biblio with a single item (you can scale this up, it should
  work just the same.)
* issue the item to borrower A
* have borrowers B, C, and D place a hold on the item
* return the item, acknowledge that it'll be put aside for B.
* view the holds on the item.
Without the patch:
* the hold priorities in the UI end up being "waiting, 2, 1" when they
  should be "waiting, 1, 2".
* in the database "reserves" table, they're really "0, 2, 3" when they
  should be "0, 1, 2".
With the patch:
* the hold priorities in the UI end up being "waiting, 1, 2"
* in the database, they're "0, 1, 2"

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

Test plan confirms that the problem exists and that the patch corrects
it.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, especially t/db_dependent/Reserves.t.
Improves priority calculation.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-15 14:18:19 +00:00
Galen Charlton
9d9ae48a0c Bug 7413: (follow-up) add direct unit tests
This patch adds a direct unit test of GetSoonestRenewDate()
and verifies that CanBookBeRenewed() returns a 'too_soon'
error as expected.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-08 23:05:13 +00:00
Holger Meißner
e005f0f911 Bug 7413: Unit test
This patch makes the new parameter norenewalbefore known to
unit test Circulation_Issuingrule.t.

To test:
1) Before applying the patch:
   prove t/db_dependent/Circulation_Issuingrule.t
2) Notice that the test fails with:
   $got->{norenewalbefore} = undef
   $expected->{norenewalbefore} = Does not exist
3) Apply the patch.
4) Run test again and it should pass.

Sponsored-by: Hochschule für Gesundheit (hsg), Germany
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
2014-04-07 18:28:58 +00:00
Galen Charlton
c3c07d9376 Bug 7567: (follow-up) make tests of get_opac_new more readable
This patch updates two of the tests cases to directly compare
the results returned by get_opac_new with the expected value
by using is_deeply().  Consequently, it removes the use of magic
numbers (which do not stop being magic numbers if they're wrapped
in constants named F1, F2, etc.).

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-07 18:14:20 +00:00
Mark Tompsett
53f15f678f Bug 7567 - Use, display, filter News by library
This adds the ability to specify whether staff, OPAC,
or slip news entries apply to all libraries or just a
particular library.

With the branch parameter added to key functions in
C4/NewsChannels.pm, function calls in C4/Members.pm,
mainpage.pl, opac/opac-main.pl, tools/koha-news.pl, and
t/db_dependent/NewsChannels.t were needed.

Some license texts were updated.

Templates were modified to display, allow for entry and editing
of the branches selected.

TEST PLAN
---------
1) Having logged into the staff client, is the news displaying
   correctly? Have you entered a news item which should not
   display for this branch of logged in user?
2) Find a patron (with some items checked out?)
3) Print a slip
   - News which is labelled 'All Branches' or for the same branch
     as the one printing the slip should display on the slip.
   - THIS DOES NOT AFFECT QUICK SLIPS
4) Home -> Tools -> News
   - Can you edit a news item?
   - Does the change save correctly?
   - Can you filter based on location and branch correctly?
   - Can you add a new entry correctly?
   - Can you delete an entry correctly?
5) Open an OPAC client.
   - Does only the news for all branches display?
6) Log into the OPAC client.
   - Does the news for all branches and the specific branch display?
7) prove -v t/db_dependent/NewsChannels.t
   - Does it run and all succeed?
   - Does the code seem to catch the required cases?
8) Comparing the patched and unpatched versions of files affected,
   are the license changes missing anything?

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-07 18:14:19 +00:00
Mark Tompsett
2f2a0cf53e Bug 7567: convert news add/update routines to take hashref; fix bugs
Changed the add and update functions to use a hash reference
for the parameter, so that adding or subtracting parameters
should be easier. Added some POD for the add_opac_news and
upd_opac_news functions, so that developers would know how to
call it.

The hashref changes resulted in being able to return 0 for
failure and 1 for success. This meant adding a couple tests
to the test file.

And while testing, there was some sort of logic problem with
the matter of '' being all, but selecting all only showed
things set for all, and excluded particular languages, or other
interfaces.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-07 18:13:56 +00:00
Mark Tompsett
a6213abe01 Bug 7567: add tests for C4::NewsChannel
Testing was lacking, this tests every function call. As a
side effect, this moved the stub of a test file from
t/NewsChannels.t to t/db_dependent/NewsChannels.t, since the
table opac_news must exist.

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

Passes all 8 tests

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-07 18:02:15 +00:00
Galen Charlton
b21d16ca75 Bug 11906: regression test for using DBIC to store & fetch UTF8 strings
This patch adds a regression test for verifying that a
DBIx::Class schema object initialized by Koha database sets up
the database connection to correct store and retrieve UTF8
values as Perl utf8 strings.

To test:

[1] Apply this patch.
[2] Run prove -v t/db_dependent/Koha_Database.t
[3] The test should fail.
[4] Apply the main patch for this bug, then do step 2 again.
[5] The test should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-27 14:44:39 +00:00
Galen Charlton
8205529683 Bug 11701: (follow-up) move unit tests to t/db_dependent
The new tests will not function if there isn't a valid
configuration (or mocking of preference()) so this patch
moves them to t/db_dependent/Context.t.

To test:

[1] After applying the main patch for this bug, verify that
    prove -v t/db_dependent/Context.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-25 14:41:07 +00:00
Galen Charlton
3a99c0441a Bug 11934: (follow-up) tidy up whitespace
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-13 15:18:49 +00:00
Nicolas Legrand
12df62ca33 Bug 11934 - Replace given by if-else statements
To test:

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
replaces given-when with if-elsif-else constructs.
Tests still pass and code looks good.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-13 15:18:40 +00:00
Jonathan Druart
0b35290011 Bug 11550: Add UT for C4::Acquisition::GetOrder
If GetOrder is called with a nonexistent ordernumber or without any
ordernumber, it should return undef.

Test plan:
prove t/db_dependent/Acquisition.t

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Updated number of tests to 68, tests and QA script all happy now.
Looked at a few pages in aquisition using GetOrder as well.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-12 14:16:20 +00:00
Galen Charlton
556eb67718 Bug 108661: (follow-up) enshrine letting CardnumberLength specify just a maximum
This patch finishes the work started in one of the previous
follow-ups and allows CardnumberLength to be set to a value
like ',5'.  In conjunction with not including cardnumber in
BorrowerMandatoryField, this allows a cardnumber to not be
required but, if present, to not exceed the specified length.

This patch also updates t/db_dependent/Members.t so that
it runs in a transaction, tests the new return value
of checkcardnumber, and manages the CardnumberLength syspref.

To test:

[1] Verify that prove -v t/db_dependent/Members.t and
    prove -v t/Members/cardnumber.t pass.
[2] Set CardnumberLength to ",5" and take cardnubmer out of
    the BorrowerMandatoryField list.
[3] Verify that you can save a patron record without a cardnumber,
    but if you supply one, that it can be at most 5 characters long.
[4] Add cardnumber back to BorrowerMandatoryField.  This time, the
    minimum length is 1 even though CardnumberLength is ",5".

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-12 04:07:03 +00:00
Jonathan Druart
1e0375e91c Bug 11755: ensure that SearchOrders returns booksellerid
The SearchOrders routine should return the booksellerid and this
patch adds it.

This fixes several problems:

[1] The link to the vendor on the order receive page breadcrumbs
    was broken.
[2] The tax calculation in finishreceive.pl didn't run.
[3] The item booksellerid field never got updated during
    receipt.

Booksellerid was returned before bug 10723.

Quick test plan:
Go on orderreceive.pl and verify that the vendor link is correct.

Followed test plan. Vendor link is now correct.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-11 16:18:48 +00:00
Jonathan Druart
87330b90f4 Bug 11170: (follow-up) improve a bit of unnecessarily convoluted logic
This patch also adds POD and UT for the change in SearchOrders()

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-11 15:11:00 +00:00
Jonathan Druart
4ae3665ad8 Bug 10611: Use mysql_auto_reconnect instead of ping
DBD::Mysql provides a mysql_auto_reconnect flag. Using it avoids
the time required to do a $dbh->ping().

Benchmarks:

use Modern::Perl;
use C4::Context;
for ( 1 .. 1000 ) {
    $dbh = C4::Context->dbh;
}

* without this patch on a local DB:
perl t.pl  0,49s user 0,02s system 98% cpu 0,525 total
* without this patch on a remote DB:
perl t.pl  0,52s user 0,05s system 1% cpu 37,358 total
* with this patch on a local DB:
perl t.pl  0,46s user 0,04s system 99% cpu 0,509 total
* with this patch on a remote DB:
perl t.pl  0,49s user 0,02s system 56% cpu 0,892 total

Testing the auto reconnect:
use Modern::Perl;
use C4::Context;
my $ping = $dbh->ping;
say $ping;
$dbh->disconnect;
$ping = $dbh->ping;
say $ping;

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

prove t/db_dependent/Circulation_issuingrules.t produces no error
prove t/db_dependent/Context.t produces no error

Test
1) dumped Koha DB, load it on a non-local server
2) run sample script whit and without patch, local and remote

use Modern::Perl;
use C4::Context;
for ( 1 .. 100000 ) {
    my $dbh = C4::Context->dbh;
}

Main difference I note is with remote server
a) without patch
real    0m16.357s
user    0m2.592s
sys     0m2.132s

b) with patch
real    0m0.259s
user    0m0.240s
sys     0m0.012s

I think this could be good for DBs placed on
remote servers

Bug 10611: add a "new" parameter to C4::Context->dbh

When dbh->disconnect is called and the mysql_auto_reconnect flag is set,
the dbh is not recreated: the old one is used.

Adding a new flag, we can now force the C4::Context->dbh method to
return a new dbh.

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

Bug 10611: Followup: remove useless calls to dbh->disconnect

These 3 calls to disconnect are done at the end of the script, they are
useless.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 23:15:35 +00:00
2e6d44bd32 Bug 10452: [QA Followup] - Unit tests
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script. Also checked
  t/db_dependent/Holds.t
  t/db_dependent/HoldsQueue.t

Tested holds triggering with different settings of
AllowHoldsOnDamagedItems. Works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 18:15:33 +00:00
5f8bef581d Bug 8918: (follow-up) support creating brief UNIAMRC bibs in Reserves.t
Changed title and author field for UNIMARC.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested for MARC21, NORMARC and UNIMARC by adding temporary set_preference..

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 17:35:38 +00:00
Julian Maurice
adc09764bc Bug 8918: (follow-up) allow t/db_dependent/Reserves.t to pass if marcflavour is UNIMARC
Set marcflavour to MARC21 to make tests pass.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Works for MARC21. But I would prefer a better fix for UNIMARC.
Will send a follow-up for that.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 17:35:17 +00:00
9b9fd85979 Bug 8918: (follow-up) more unit tests for CalculatePriority
Adding a few unit tests, including the following situations:
Placing a hold when there is a wait.
Placing a hold when there is a future hold.
Calculating priority with future date.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 17:35:00 +00:00
Julian Maurice
52924e7b0e Bug 8918: Add a unit test for CalculatePriority
Rebased on January 29, 2014 (marcelr)
Added text on the two 'is'-statements.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 17:34:50 +00:00
Galen Charlton
8d76441a4c Bug 11224: (follow-up) clean up unit test for bug 10723
This patch removes the remainder of the old unit test
for bug 10723 and updates the label of the new test that
now checks that SearchOrders({ pending => 1}) omits received
orders.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 16:44:00 +00:00
Galen Charlton
f4251e85fa Bug 11224: (follow-up) apply tidying
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 16:43:56 +00:00
Galen Charlton
b8173f2cd9 Bug 11224: (follow-up) incorporate test for bug 11777
This patch adds authorisedby to the list of expected fields
returned by SearchOrders().

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 16:28:59 +00:00
Mathieu Saby
575aa91ffa Bug 11224 : Add UT to routines of C4::Acquisition returning order(s)
C4::Acquisition need more UT, and more robust ones.  This patch
adds some.

This patch adds UT to
- GetOrder
- GetOrders
- GetCancelledOrders
- GetLateOrders

It refactors UT for SearchOrders

New UT use 2 new routines, used for check the list of fields returned
by a routine:
    _check_fields_of_order
    _check_fields_of_orders
These 2 routines could later be used by other UT

_check_fields_of_order has its own UT (tests n°14,15,16).

to test :
prove -v t/db_dependent/Acquisition.t

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Unit tests pass, passes koha-qa.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa and t

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 16:27:21 +00:00
Doug Kingston
88e7faf860 Bug 11078: Add locking to rebuild_zebra
This patch adds locking to rebuild_zebra.pl to ensure that simultaneous
changes are prevented (as one is likely to overwrite the other).
Incremental updates in daemon mode will skipped if the lock is busy
and they will be picked up on the next pass.  Non-daemon mode
invocations will also exit immediately if they cannot get the lock
unless the new flag -wait-for-lock is specified, in which case they
will wait until the get the lock and then proceed.

Supporting changes made to Makefile.PL and templates for the new
locking directory (paralleling the other zebra lock directories).
We stash the zebra_lockdir in koha-conf.xml so rebuild_zebra.pl
can find it.

To address earlier QA concerns we:
1. added code to check if flock is available and ignore locking if
it's missing (from M. de Rooy)

2. changed default for adhoc invocations to abort if they cannot
obtain the lock.  Added option -wait-for-lock if the user prefers
to wait until the lock is free, and then continue processing.

3. added missing entry to t/db_dependent/zebra_config.pl

4. added a fallback locking directory of /tmp

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Doug merged the original patch with the QA changes.
Just for the record, noting here that the original patch was tested
extensively too by Martin Renvoize.
I have added a followup for some exceptional cases.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 22:21:41 +00:00
daf2ebc4f5 Bug 11096: support the retrieval of large MARCXML records
This patch makes Koha <-> Zebra use MARCXML for the serialization when
using DOM, and USMARC for GRS-1.

* The following functions are modified to set the Zebra record syntax
according to the current sysprefs and configuration:

- C4::Context->Zconn
- C4::Context-_new_Zconn

* A new function 'new_record_from_zebra' is introduced, which checks the
context we are in, and creates the MARC::Record object using the right
constructor.

The following packages get touched to make use of the new function:
- C4::Search
- C4::AuthoritiesMarc

and the same happens to the UI scripts that make use of them (both in
the OPAC and STAFF interfaces).

* Calls to the unsafe ZOOM::Record->render()[1] method are removed.

Due to this last change the code for building facets was rewritten. And
for performance on the facets creation I pushed higher version
dependencies for MARC::File::XML and MARC::Record (we rely on
MARC::Field->as_string).

* Calls to MARC::Record->new_from_xml and MARC::Record->new_from_usmarc
are wrapped with eval for catching problems [2].

* As of bug 3087, UNIMARC uses the 'unimarc' record syntax. this case is
  correctly handled.
* As of bug 7818 misc/migration_tools/rebuild_zebra.pl behaves like:

- bib_index_mode (defaults to 'grs1' if not specified)
- auth_index_mode (defaults to 'dom')

here we do exactly the same.

To test:
 - prove t/db_dependent/Search.t should pass.
 - Searching should remain functional.
 - Indexing and searching for a big record should work (that's what the
   unit tests do).
 - Test an index scan search (on the staff interface):
    Search > More options > Check "Scan indexes".
 - Enable 'itemBarcodeFallbackSearch' and try to circulate any word, it
   shouldn't break.
 - Searching for a biblio in a new subscription shouldn't break.
 - Running bulkmarcimport.pl shouldn't break.
 - And so on... for the rest of the .pl files.

[1] http://search.cpan.org/~mirk/Net-Z3950-ZOOM/lib/ZOOM.pod#render()
[2] a record that cannot be parsed by MARC::Record is simply skipped (bug 10684)

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 19:50:09 +00:00
5159a43d43 Bug 11096: Wrap each test set configuration in Search.t into a subtest
This makes it easier to read. Also fixes the test count, and is rebased
against 11499 which is needed to correctly test the patches for this bug
(i.e. indexing mode needs to be correctly set in koha-conf.xml)

To test:

[1] Run prove -v t/db_dependent/Search.t

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 19:49:15 +00:00
Galen Charlton
dc86557c34 Bug 11096: add regression tests for indexing/retrieving large MARC records
This adds direct tests of indexing and retrieving
bib records that are larger than the ISO2709 limit
of 99,999 octets.

To test: verify that prove -v t/db_dependent/Search.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 19:48:37 +00:00
Galen Charlton
a97f21ad3b Bug 11777: add regression test
This patch adds a regression test for ensuring that the
authorisedby field is returned by SearchOrders().

To test:

[1] Upon applying the main patch, verify that
    prove -v t/db_dependent/Acquisition.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-19 17:14:25 +00:00
Galen Charlton
065a3a5efa Bug 11779: (follow-up) improve GetLoggedInBranchcode() and add test cases
This patch adjusts the new GetLoggedInBranchcode() template function so
that it returns the empty string rather than undef if there is no
active user environment.  That way, there won't be lots of undefined
value warnings if/when this function gets used in the OPAC.

This patch also adds test cases.

To test:

[1] Verify that there are no regressions in the main test
    plan for this bug.
[2] Verify that prove -v t/db_dependent/Koha_template_plugin_Branches.t
    passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-19 16:40:06 +00:00
Jonathan Druart
8b685c1e80 Bug 9823: Refactor return from GetReservesFromBiblionumber
The return from GetReservesFromBiblionumber contains an unnecessary
extra variable. In scalar context an array returns its element count.
Maintaining a separate count can lead to unforeseen bugs
and imposes ugly constructions on the subroutine's users.

Remove the useless count variable from the return

This patch also changes the parameters: now the routine takes a hashref.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Placed biblio holds, future holds and item holds. Works as expected.
Tested Holds.t and Reserves.t. Pass.
Tested /cgi-bin/koha/ilsdi.pl?service=GetRecords&id=999 with two holds on
one item. Fine.
C4/SIP/ILS/Item.pm: Looked for "whatever" and "arrayref" and could not find
them anymore. Looks good.
Handled a few unneeded calls in QA follow-up.
Left only one point to-do for serials/routing-preview.pl. See Bugzilla.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-30 16:19:55 +00:00
Galen Charlton
6e21422d00 Bug 11439: (follow-up) adjust for change in list returned by OCLC XISBN
The set of related ISBNs for the first Harry Potter book returned
by OCLC's XISBN service has changed recently, so this patch adjusts
the test to match.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-30 15:48:48 +00:00
Galen Charlton
27c312b721 Bug 11533: fix authority searching with no sorting when QueryParser is enabled
This patch fixes an issue where chosing 'None' as the sort order
for an authority search would result in zero hits if QueryParser is
eanbled.

This patch also adds some additional test cases.

To test:

[1] Enable QueryParser.
[2] Perform an authority search in the staff interface that
    uses 'Heading A-Z' as the sort order and returns hits.
[3] Run the same search, but with the sort order set to 'None'.
    No hits are returned.
[4] Apply the patch.
[5] Do step 3 again.  This time, hits should be returned.
[6] Verify that prove -v t/db_dependent/Search.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-24 14:02:48 +00:00
99e2686a49 Bug 11533: (regression test) QP breaks authority search
This patch duplicates the SearchAuthority tests, with QP enabled.
Searching shouldn't be affected by QP. Instructions for manually
reproducing this can be read in the first comment for the bug entry.

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-24 14:02:41 +00:00
Jonathan Druart
e974b554a5 Bug 11549: Add regression test
test plan:
prove t/db_dependent/Acquisition/TransferOrder.t should fail before the
patch and success after applying it.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-23 16:17:24 +00:00
d211fa50ed Bug 9788: (follow-up) Unit tests for changed routine GetReservesFromItemnumber
Adds three tests to Reserves.t for GetReservesFromItemnumber.
We test if this routine does not return a future next available hold,
a future item level hold. And if it does return a future wait (that is:
a confirmed future hold, using ConfirmFutureHolds).

Note that Holds.t does also contains some basic tests for this routine,
but the additional tests seem to better located in the direct context of
tests for bug 9761 for ConfirmFutureHolds.

Test plan:
Run both t/db_dependent/Holds.t and t/db_dependent/Reserves.t.
Verify if both tests do not fail.

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>
2014-01-17 05:11:48 +00:00
Jonathan Druart
c37a8ad151 Bug 11543: (followup) add one more test
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-15 19:58:30 +00:00
Roman Amor
546c6861f9 Bug 11543: Increasing test coverage for Category.pm
To test:
1. Run prove t/Category.t
2. Apply patch
3. Run prove t/db_dependent/Category.t - Notice 2 tests were run

Signed-off-by: daniel <daniel.barker.nz@gmail.com>
Made the requested changes.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-15 19:58:03 +00:00
Galen Charlton
19b5ea868b Bug 11541: (follow-up) move Installer.t to t/db_dependent
This test requires a valid Koha context, so this patch
moves it to t/db_dependent.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-14 21:43:56 +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
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
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
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
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
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
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
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
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
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
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
Galen Charlton
521e599dd8 Bug 7421: add regression tests for UNIMARC authorities DOM indexing
This patch enhances  t/db_dependent/Search.t to test indexing and
searching of authority records.  It supplies a sample authority file
for MARC21 (consisting of the record for William Shakespeare from the
Library of Congress) and a sample UNIMARC authority file supplied
by Henri-Damien Laurent.

It also adds tests for both MARC21 and UNIMARC authorities.

When the main patch for bug 7421 is applied, t/db_dependent/Search.t
should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-10 21:02:04 +00:00
Galen Charlton
2173a97b29 Bug 10037: regression test for searching UNIMARC item index in DOM mode
This patch adds a regression test that verifies that searching the
UNIMARC 'item' index for a value that is indexed by virtue of being
included in the fallback index definition for the 995 field works for
both GRS-1 and DOM.

The main patch will allow t/db_dependent/Search.t to pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-10 18:50:13 +00:00
Galen Charlton
c9b09051e7 Bug 8252: (follow-up) add basic UNIMARC indexing tests
This patch adds a few basic search and indexing tests for UNIMARC,
using sample data provied by Frédéric Demians.  The new tests
by no means completely cover the possibilities, but should be
considered a starting point for future tests.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-10 18:31:02 +00:00
Galen Charlton
e3ccbe145c Bug 8252: (follow-up) make it easier to add UNIMARC indexing tests
This patch refactors t/db_dependent/Search.t so that it can be
subsequently modified to add tests for indexing and searching
UNIMARC records without duplicating the setup code.

This patch also moves the MARC21 records from t/db_dependent/data/zebraexport
to t/db_dependent/data/marc21/zebraexport so that UNIMARC sample
data can be slotted in t/db_dependent/data/unimarc/zebraexport.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-10 17:58:30 +00:00
Galen Charlton
104c10b248 bug 8252: (follow-up) add search tests on music number
There was some churn in previous patches about the desired
name of the music publisher number index, so this patch
adds tests to confirm that both the old and new names
work as CCL keywords.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-10 17:28:51 +00:00
Galen Charlton
1737ff4cc3 bug 8252: (follow-up) test both GRS1 and DOM indexing
This patch expands t/db_dependent/Search.t to run
the same tests using both the GRS-1 and DOM indexing
modes.  It also adds hooks in zebra_config.pl to make
it easier to stage test cases for non-MARC21 Zebra
indexing.

Note that in DOM mode one of the tests is currently a
TODO, as relevance ranking for wegihted queries differs
between GRS-1 and DOM.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-10 17:18:43 +00:00
Galen Charlton
d88e15acfb bug 6201: (follow-up) update unit tests
This patch updates the unit tests for the BibTeX export
to add a regression test for supplying the author for
non-UNIMARC records.  It also adjusts the test to reflect
the change in quote character from "" to {}.

To test:

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 05:26:27 +00:00
root
9620d2d249 Bug 10641 - GetBooksellerWithLateOrders in C4::Bookseller.pm has some incoherences
This patch fixes some incoherences of the routine
GetBooksellerWithOrders().

Now it considers the field $estimateddeliverydateto and it replaces it
by now() only if it is undef.

Also, it doesn't test if $aqbookseller.deliverytime is not Null anymore
but if $deliverytime = null or undef, it replaces it by 0.

It also verifies if $delay is >= 0 and return undef if it is a negative
value.

To Test:
Before, this routine sorts out the BookSellerWithLateOrders. If a
bookseller did not specify a deliverytime, it would never appears in
the list of LateOrders.  Moreover, if the field "Estimated delivery
date to" was specified, it didn't take care of the value and it
returns the late order up to today's date.

Now, the returned list considers all the fields give and if the
delivery time of the bookseller is not specified, it calculates the
late orders as if the deliverytime is 0.  By default, all booksellers
which have orders in late until today are listed unless "estimated
delivery date to" is specified.

prove t/db_dependent/Bookseller.t
t/db_dependent/Bookseller.t ..
[Some warnings about uninitialized values]
WARNING: GetBooksellerWithLateOrders is called with a negative value at C4/Bookseller.pm line 135.
t/db_dependent/Bookseller.t .. ok
All tests successful.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 04:02:47 +00:00
Jonathan Druart
5b74a81e3d Bug 10683: (follow-up) improvements to the unit tests
The borrowers table needs to be cleared after the items table
(last_returned_by column).

Some checks were missing for GetRenewCount and AddRenewal.

Now the tests simulated a renewal for a item and check that the renews
left is decremented.

Moreover the issuingrules tables should be cleared and filled with known
values.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:51:55 +00:00
Kenza Zaki
175cdb44f9 Bug 10683: add unit tests for CRUD routines in C4::Circulation
This patch adds some unit tests wrapped in a transaction for
C4::Circulation.pm.

Circulation_Branch.t adds tests for routines which deal with
branch_item_rules,branch_borrower_circ_rules,
default_branch_circ_rules, default_circ_rules, and
 default_branch_item_rules in the database.

Circulation_issue.t adds tests for routines which deal with accountline
and issues in the database.

NOTE: Some commented tests have to be fixed, and some tests can be added.
More, other routines of Circulation.pm are tested in the patches:

10692	UT: Routines about transfers in Circulation.pm need unit tests
10710	UT : OfflineOperation's routines in C4/Circulation.t need unit tests
10767   UT: Routines which interact with the table issuingrules in C4/Circulation need unit test

Test plan:
prove t/db_dependent/Circulation_issue.t
t/db_dependent/Circulation_issue.t .. ok
All tests successful.
Files=1, Tests=16,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.40 cusr  0.02 csys =  0.44 CPU)
Result: PASS

prove t/db_dependent/Circulation_Branch.t
t/db_dependent/Circulation_Branch.t .. ok
All tests successful.
Files=1, Tests=10,  2 wallclock secs ( 0.06 usr  0.00 sys +  1.02 cusr  0.06 csys =  1.14 CPU)
Result: PASS

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

Comment: Well, I don't know exactly what to do with this, so
I left it to QA

a) prove t/db_dependent/Circulation_Branch.t works well and without erros

b) prove t/db_dependent/Circulation_issue.t works without errors for me
ONLY if I have a issuingrule for All, All with 1 as renewals allowed, in
other cases it fails.

No koha-qa errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:50:22 +00:00
Galen Charlton
b6909640ef Bug 10698: (follow-up) remove now-superfluous FIXME comment
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:48:02 +00:00
Kenza Zaki
924c4f69e0 Bug 10698: give C4::Circulation::DeleteTransfer() a return value
This patch adds return values to DeleteTransfer:
Undef if no parameters are given
1 if a Transfer is deleted
0E0 if a wrong parameter is given

It also fixes some unit tests in t/db_dependent/Circulation_transfers.t

To test:
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=14, 20 wallclock secs ( 0.03 usr  0.00 sys +  0.39 cusr  0.02 csys =  0.44 CPU)
Result: PASS

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Applied 10681 and 10692 before 10698
Run prove t/db_dependent/Circulation_transfers.t without errors
No koha-qa errors on all 3 patches

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:46:53 +00:00
Galen Charlton
547c6d2949 Bug 9611: (follow-up) move new password hashing routines to separate module
The move avoids a problem where many modules would gain
a dependency on C4::Auth just because C4::Members needs access
to hash_password().

This patch also adds a couple unit tests for the new password
hashing code.

To test:

[1] Verify that there are no regressions on the test plan for bug
    9611.
[2] Verify that t/AuthUtils.t and t/db_dependent/Auth.t pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:29:22 +00:00
Jonathan Druart
5c0fa5ec3d Bug 10856: Improve the previous and next items on the shelf browser
The next and previous links should completely refresh the shelf.

For example:
[<] [1] [2] [3] [4] [5] [6] [>]
Before this patch, the next and previous links were the same as the 1
and 6.
With this patch, after clicking on next, we will get:
[<] [7] [8] [9] [10] [11] [12] [13] [>]

This patch adds a new AJAX script to get the shelf browser block.

Test plan:
- On a detail biblio page, click on a "Browse shelf" link.
- Play with the next and previous links.
- Deactivate Javascript (using NoScript for example) and check that you
  get the same behavior (but the page is reloaded).
- Launch the unit tests: prove t/db_dependent/ShelfBrowser.t

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-04 15:56:35 +00:00
f9068d5938 Bug 9735: Unit tests for get_template_and_user (cookies handling)
Galen found a case where the cookies array was not built flat. I add a
unit test for that (check the cookie array is flat) and also test the
cookies output of get_template_and_user so we are sure the &language=
parameter is correctly handled.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
- Tests in t/db_dependent/Auth.t pass
- Tested in intranet, OPAC logged in, OPAC logged out
  * Adding a valid language code to the URL switches the language
    as expected
  * Adding an invalid language code causes no change

Nice feature!

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-04 03:27:08 +00:00
Jonathan Druart
9db77158d0 Bug 10927: remove disused C4::Utils module
Bug 10925 removes the last call to C4::Utils.
The module becomes useless and can be deleted.

Verify that t/db_dependent/Context.t still successfully passes.
git grep hashdump
git grep maxwidth

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, no subs from the module are used anywhere

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 14:53:02 +00:00
Galen Charlton
11606693ef Bug 10949: restore ability to successfully print hold slips
This fixes a regression introduced by the patch for bug
9394 -- when printing a hold slip using the 'print and confirm'
button, the slip would contain only the text 'reserve not found',
not a full hold slip.

This patch also adds a regression test.

To test:

[1] Check in an item that would fill a hold.  Use the 'print
    and confirm button' to confirm the hold.
[2] The printout will only contain text to the effect of
    'reserve not found'.
[3] Apply the patch.
[4] Repeat step 1.  This time, a full hold slip should be printed.
[5] Verify that prove -v t/db_dependent/Reserves.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Pass all tests, new and old, and QA script.
Verified wrong and corrected behaviour.

Note: Sometimes there will not be the message 'reserve not found'
showing up, but hold information for a different record. This happens
when there exists a reserve_id with the borrowernumber of the patron
in question in your database.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-02 14:38:30 +00:00