Commit graph

1386 commits

Author SHA1 Message Date
Mark Tompsett
49c384b242 Bug 13673: Silence noisy warnings in t/db_dependent/Barcodes.t
This last patch catches all the warning messages in tests.

TEST PLAN
---------
1) Apply first two patches
2) $ prove t/db_dependent/Barcodes.t
   -- still noisy warnings.
3) apply last patch
4) $ prove t/db_dependent/Barcodes.t
   -- All noisy warnings are caught.
5) koha qa test tools.

Signed-off-by: Indranil Das Gupta <indradg@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 16:00:28 -03:00
Mark Tompsett
aefcd68ff7 Bug 13673: Remove diags
TEST PLAN
---------
1) Apply first two patches
2) $ prove t/db_dependent/Barcodes.t
   -- Diags have been removed, just noisy warnings left.
3) $ git diff -w origin/master
   -- only excess print's and diag's removed.
4) koha qa test tools

Signed-off-by: Indranil Das Gupta <indradg@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 16:00:28 -03:00
Mark Tompsett
19e0fb4608 Bug 13673: Fix whitespace issues
Indentation was horrible. Fixed to meet 4 space standard.

TEST PLAN
---------
1) Notice tabs in t/db_dependent/Barcodes.t
2) $ prove t/db_dependent/Barcodes.t
3) apply patch
4) $ prove t/db_dependent/Barcodes.t
   -- same output as before.
5) $ git diff -w origin/master
   -- code is identical except for indentations.
6) koha qa test tools

Signed-off-by: Indranil Das Gupta <indradg@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 16:00:28 -03:00
Jonathan Druart
77930a5945 Bug 11385: Remove SQL::Helper
At this point, no occurrence of SQL::Helper should exist.
Let's remove the package and tests.

Test plan:
  git grep SQLHelper
and
  git grep InTable

Should not return anything in the Koha code.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 15:39:39 -03:00
Jonathan Druart
e196f19e2d Bug 12633: Remove SQLHelper in C4::Members
This is the only places where SQLHelper is still called.
The C4::Members::Search is not used anymore, but ModMember and
AddMember.

This patch replaced the calls to SQLHelper to use DBIX::Class.
TODO: Move them to Koha::Borrower.

Test plan:
1/ Make sure the patron search still works (no changes expected since the
code was not in used).
2/ Add a patron with all fields filled
3/ Add another patron with some fields filled
4/ Update them with other values
5/ Delete them

You should not get any errors.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 15:38:05 -03:00
a1b7f15062 Bug 14204: (QA followup) remove unneeded messages
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 15:34:22 -03:00
Nick Clemens
ad3b05996b Bug 14204: Fix t/db_dependent/Labels/t_Batch.t failing test from Bug 12991
This patch updaes the batch_id variable after items are added to test batch

To test:
1. prove t/db_dependent/Labels/t_Batch.t and see two tests fail
2. apply patch
3. prove again, tests pass!

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: The $batch->add_item() call to C4::Creators::Batch::add_item
      triggers the change of the batch_id so this line is necessary!
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 15:34:22 -03:00
Jonathan Druart
a072260bf6 Bug 13423: Fix number of tests in Serials.t
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-14 11:48:17 -03:00
Bernardo Gonzalez Kriegel
65b7ad030c Bug 13423: Remove unused serials-recieve
This patch removes two files, serials-recieve.pl and serial-recieve.tt
serials-recieve.pl is not called anyware
(it's recieve!)

Also removes the sub removeMissingIssue called only from serials-recieve.pl

git grep serials-recieve.pl .
C4/Serials.pm:called when a missing issue is found from the serials-recieve.pl file
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-recieve.tt:     <form method="post" name="f" action="serials-recieve.pl" onsubmit="return barcode_check()">
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-recieve.tt:     <form method="post" name="f2" action="serials-recieve.pl">
serials/serials-recieve.pl:serials-recieve.pl

Just a POD entry and self reference.

After removing of files

git grep removeMissingIssue .
C4/Serials.pm:      &check_routing &updateClaim &removeMissingIssue
C4/Serials.pm:=head2 removeMissingIssue
C4/Serials.pm:removeMissingIssue($subscriptionid)
C4/Serials.pm:sub removeMissingIssue {
t/db_dependent/Serials.t:is(C4::Serials::removeMissingIssue(), undef, 'test removing a missing issue');

Not used anymore

To test:
1) Apply the patch
2) Check serials workflow, no changes must be noted

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-14 11:48:17 -03:00
Jonathan Druart
a71a2cb9b6 Bug 11006: Drop column aqorders.totalamount
This column was not used in the Koha codebase, it can be removed.

Test plan:
Execute the updatedatabase.pl script and confirm that the column has
been dropped.

QA step:
1/ git grep totalamount
2/ prove t/db_dependent/Acquisition.t

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-14 11:11:58 -03:00
Julian FIOL
64b6df43c9 Bug 14147: Add unit tests to C4::External::OverDrive
This patch test 'IsOverDriveEnabled' subroutine

    TEST PLAN
    ---------
    1. Apply patch
    2. prove -v t/External/OverDrive.t
    -- All tests should run successfully without
    any error or warning

    TEST PLAN OPTIONAL
    ------------------

    Check with bug 13899 to see the coverage of this module.

    Coverage BEFORE this patch :
    Statement  :  47,5%
    Branch     :   0,0%
    Condition  :   0,0%
    Subroutine :  75,0%

    Coverage AFTER this patch :
    Statement  :  49,1%
    Branch     :   0,0%
    Condition  :  33,3%
    Subroutine :  83,3%

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-14 11:11:58 -03:00
31f60fd522 Bug 13969: (QA followup) Delete issues before borrowers
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-14 11:11:46 -03:00
Julian FIOL
f863292a92 Bug 13969: Replace calls to $sth->fetchrow* with a call to $dbh->selectrow* and Cleaning files
1. Replace all calls to $sth->fetchrow_array
   with a call to $dbh->selectrow_array

2. Cleaning Review.t file with perltiny

3. Cleaning Review.t && Review.pl files with koha-qa tool

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-14 11:11:41 -03:00
Julian FIOL
6bc6d0254b Bug 13969: Testing C4::Review
Testing C4::Review in t/db_dependent/Review.t
Adding a pod for every sub

    TEST PLAN
    ---------
    1. Apply patch
    2. prove -v t/db_dependent/Review.t
    -- All 117 tests should run successfully without
    any error or warning

    TEST PLAN OPTIONAL
    ------------------

    Go check bug 13899 and see that coverage is 100% for this module.

    Coverage BEFORE this patch :
    Statement  :  21,9%
    Branch     :   0,0%
    Condition  :   0,0%
    Subroutine :  33,3%
    Pod        :  33,3%

    Coverage AFTER this patch :
    Statement  : 100,0%
    Branch     : 100,0%
    Condition  :    N/A
    Subroutine : 100,0%
    Pod        : 100,0%

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-14 11:11:36 -03:00
Jonathan Druart
88537974e3 Bug 12743: ACQ: default values for catalogue records
At the moment, it is possible to create records in acquisitions, but the
ACQ framework is only used for items created in this module.

This patch allows to defined default values in the ACQ framework for
records created on the acquisition module.

Test plan:
1/ Make sure you have the ACQ framework created (otherwise create it
from the default framework).
2/ Define a default value for a field (for instance 099$z=1).
3/ Go in the acquisition module and create a new order from a new
record.
4/ Fill mandatory information and save.
5/ Go on the detail page of this record and verify the default value
exist.

Signed-off-by: Gaetan Boisson <gaetan.boisson@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-11 10:10:41 -03:00
20b842e7b0 Bug 13758: (QA followup) revert case change that broke the tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-07 14:12:14 -03:00
Mark Tompsett
c8d364ae72 Bug 14103: Improved testing coverage
As per Chris' comment #17, this improves the testing coverage.

Same test plan as comment #16, but add:

TEST PLAN SUPPLEMENT
--------------------
1) $ prove -v t/db_dependent/Borrower_Discharge.t
   -- notice only 5 tests, and generate_as_pdf not tested.
2) Apply this patch.
3) Retest as per comment #16
   -- this will test the error and no error cases
      tweaked in Koha/Borrower/Discharge.pm
4) remove PDF::HTML
   $ sudo apt-get purge libpdf-fromhtml-perl
5) $ prove -v t/db_dependent/Borrower_Discharge.t
   -- 7 tests, all successful
6) add PDF::HTML
   $ sudo dpkg -i /path/to/libpdf-fromhtml-perl...
   -- depends on how you get it. vary accordingly.
7) $ prove -v t/db_dependent/Borrower_Discharge.t
   -- 7 tests, all successful
   -- Note that is was a different 7th test. :)
8) koha qa test tools

Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-07 13:06:15 -03:00
Jonathan Druart
11049f9d02 Bug 13758: Move the Koha version from kohaversion.pl
It will permit not to run another perl interpreter.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-05-07 11:39:04 -03:00
Mark Tompsett
4e0468e8c2 Bug 14057: Inventory is painfully slow
This patch is a rough start. I believe it runs exponentially
faster, but its equality to the previous version needs to be
tested before I clean it up to acceptable standards.

Nested hashes of hashes was being a debugging nightmare.

Moved the SQL select to C4::Koha.

Changed the GetItemsForInventory to have a hashref parameter.
Added interface, in case there is a need for 'opac' vs. 'staff'.

Added t/db_dependent/Items/GetItemsForInventory.t
Added t/db_dependent/Koha/GetKohaAuthorisedValuesMapping.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-06 10:40:23 -03:00
Olli-Antti Kivilahti
0057fa933a Bug 12671: Guess next serial date when there are several issues per unit. Added support for real month and year lenghts.
When getting the next frequency number, use the real number of days for each month and each year.

Unit tests updated.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-05 15:22:10 -03:00
Julian Maurice
8b94c89f0b Bug 12671: Guess next serial date when there are several issues per unit
This guess uses the following algorithm
1/ Get the number of days remaining from first issue of this unit of
time until the end of the unit of time (using 7 days for week, 28 for
month and 365 for year)
2/ Divide it by the number of issues per unit
3/ Take the integer part of the result, this is the number of days to
add to previous serial published date

This patch also try to guess the date of the first issue of a unit of
time. Before that, it was:
- for week: monday of week
- for month: 1st day of month
- for year: 1st day of year
Now it uses firstacquidate.

Example:
  firstacquidate = 1970-01-07 (wednesday)
  unit = week
  issuesperunit = 2 (2 issues per week)

  From wednesday to sunday, there are 4 days so we add 2 days to get the
  next date.
  The next dates should be:
  - 1970-01-09 (+ 2 days)
  - 1970-01-14 (wednesday of next week)
  - 1970-01-16 (+ 2 days)
  - ... and so on

Test plan:
1/ Go to numbering pattern creation page (Serials -> Manager numbering
patterns -> New numbering pattern)
2/ In "Test prediction pattern" fieldset, set subscription length to 50
issues (this avoid to compute the next 1000 dates, which can take time)
3/ Fill first issue publication date
4/ Choose the frequency you want to test
5/ click on "Test pattern" button
6/ Check that the dates are correct
7/ Repeat steps 3-7 until you think you have tested enough cases

Interesting frequencies to test:
- 1/day
- 1/week
- 2/week
- 6/week (firstacquidate should be monday or tuesday, or the generated
  dates will be the same for all the week)
- 1/month
- 2/month
- 3/month
- 1/year
- 2/year
- 3/year

----------------
Sign off report:
----------------
-Followed the test plan. Unit tests work. Also trying some more strange
 frequencies with our librarians:
 5/year, 43/year, 10/year.
-Received all serials for a subscription and found no errors.
-Received some serials with frequency 2/month pre-patch, getting publication
 date as 1st of every month for each magazine. Having applied the patch,
 publication dates started working mid-subscription for new magazines.
-Works well and fine!
Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-05 15:22:10 -03:00
ca167b32b4 Bug 12412: Add ability for plugins to convert arbitrary files to MARC from record staging tool
Many libraries would like to be able to import various types of files as
MARC records ( citations, csv files, etc ). We can add a new function to
the plugins system to allow that kind of behavior at a very custom
level.

Test Plan:
1) Ensure you have plugins enabled and configured correctly
2) Installed the attached version 2.00 of the Kitchen Sink plugin
3) Download the attached text file
4) Browse to "Stage MARC records for import"
5) Select the downloaded text file for staging
6) After uploading, you should see a new area "Transform file to MARC:",
   select "Example Kitchen-Sink Plugin" from the pulldown menu
7) Click 'Stage for import"
8) Click 'Manage staged records"
9) You should now see two new MARC records!

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described - interesting new feature.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-04 15:33:51 -03:00
Mark Tompsett
00faa967bd Bug 13889: Add unit tests
Previous commit was lacking test coverage of new function.

TEST PLAN
---------
1) Apply all the patches
2) prove -v t/db_dependent/Log.t
   -- should be success.
3) koha qa test tools

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-04 11:11:32 -03:00
Jonathan Druart
7c5c6b3ca9 Bug 11814: Fix existing tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-30 15:33:12 -03:00
Yohann Dufour
ea6c9f8e84 Bug 8007: Discharge - Add unit tests
Signed-off-by: Lucie <lucie.rousseaux@dracenie.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-30 12:33:59 -03:00
Jonathan Druart
7e8295841f Bug 13919: Make the tests pass fixing the number of tests
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-28 15:11:34 -03:00
b921cca242 Bug 13919: Unit Test
Tested both unit test patches together.
Without main patch applied: do not pass as expected / with main patch pass OK as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-28 15:11:27 -03:00
Jonathan Druart
20ec29eb19 Bug 12404: Allow equal sign '=' in the TT directive
Signed-off-by: Courret <scourret@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-27 10:43:23 -03:00
Jonathan Druart
70fac393c8 Bug 12404: Add new unit tests
These unit tests reflect the changes done in next patches.

Signed-off-by: Courret <scourret@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-27 10:43:23 -03:00
Jonathan Druart
a468e8cf7a Bug 12404: Add UT for marcrecord2csv
Verify that these unit tests pass before any changes and after applying
all patches.

Signed-off-by: Courret <scourret@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-27 10:43:22 -03:00
Mark Tompsett
c066a8ca2f Bug 14030 - Added tests for duplicates.
It seems that the id's are not really used, but rather
the subtags, types, and language related fields.

These tests check for duplicates.

TEST PLAN
---------
1) Apply both patches
2) prove -v t/db_dependent/Languages.t
   -- may fail if you have duplicates.
3) ./installer/data/mysql/updatedatabase.pl
   -- this will trigger the atomicupdate, which because of
      this tweak, will correct duplicates.
4) prove -v t/db_dependent/Languages.t
   -- should succeed.
5) Run the updatedatabase.pl script multiple times.
6) prove -v t/db_dependent/Languages.t
   -- should still succeed.
7) koha qa test tools.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No koha-qa errors, test run successfully, no more duplicates

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-24 09:55:54 -03:00
Jonathan Druart
a9ac14658d Bug 13606: Add tests and fix existing ones
Some tests were wrong and not executed in a transaction.
Lot of sessions were created in DB because the session was never
flushed.

TEST PLAN
---------
$ mysql ...
> delete from sessions;
^Z
$ prove -v t/db_dependent/BackgroundJob.t
...
$ fg
> select id from sessions;
-- There will be lots of ids (10, if I recall)
^Z
$ git bz apply 13606
...
$ prove -v t/db_dependent/BackgroundJob.t
...
$ fg
> select * from sessions;
-- there should only be the one orphaned job.
   You can tell it is correct by the "making new job".
> quit

Run the koha-qa test tools.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-04-23 13:18:49 -03:00
Jonathan Druart
9d025e65a8 Bug 10706: Delete saved_reports to be sure no reports existed
We need to be sure no report existed before launching the tests.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-22 16:27:30 -03:00
Jonathan Druart
cc8601f486 Bug 10706: Add test
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-22 16:27:29 -03:00
Jonathan Druart
46fbcaadf1 Bug 13419: (follow-up) fix call to set_userenv
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-22 14:59:10 -03:00
Jonathan Druart
9df787a22d Bug 13419: (follow-up) Add tests - remove existing shelves
Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-22 14:59:09 -03:00
Jonathan Druart
8d39257de3 Bug 13419: Add tests
Test plan:
    prove t/db_dependent/Utils/Datatables_Virtualshelves.t
should return green

Tested together with follow-up, works as expected
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-22 14:59:07 -03:00
Jonathan Druart
927aedafa1 Bug 10985: [UNIMARC] Fix authority summary
The problem is the template in authority type summary is not respected
at all. It is only read to see which fields and subfields should appear
in the summary.
This patch fixes that.
It also fixes a bug in auth_finder.pl plugin when summary contains
fields other than 2XX.

Test plan:
0/ You must use a UNIMARC setup for those tests
1/ edit an authority type summary with:
     NP : [200a][, 200b][ 200d][-- 152b --][ ; 200c][ (200f)] [001*] [ppn: 009*]
2/ create a new authority with previous fields (it is possible some
   fields don't exist).
3/ search this authority and verify the summary is someting like:
     NP : Name, D.-- NP -- 23849 ppn: my_ppn
4/ Verify some summary for existing authorities and check they are
   correct.
5/ Edit a biblio record and use the plugin auth_finder.pl (for example
   in a 7XX field)
6/ Do a search and verify the summary is correct
7/ Click on 'choose' or one of the numbered links ('1', '2', ... ; you
should have multiple 2XX fields for the numbered links to show up)
8/ Verify that the biblio field is correctly filled.

/!\ For the ppn, it should be defined in the zebra indexes.

In MARC21 and NORMARC setups, this patch should change nothing, please
verify that too (you can check that the auth_finder.pl plugin is still
working and the auth type summary is correctly displayed in authorities
search and auth_finder.pl plugin).

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

It works as described, both in authority search result page, and in authority
data entry plugin.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-22 11:54:36 -03:00
1c88c819a4 Bug 13998: (RM followup) tests expect data on the database
This patch makes t/db_dependent/Ratings.t create its own biblio
instead of using a hardcoded '1' fr the biblionubmer.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-21 13:53:40 -03:00
Yohann Dufour
832fa0987b Bug 12604: refactoring Category.t with TestBuilder
The tests have been refactored with the module TestBuilder.

Test plan:
1/ Apply the patch 12603
2/ The command : prove t/db_dependent/Category.t has to be a success without error or warning :
t/db_dependent/Category.t .. ok
All tests successful.
Files=1, Tests=3,  1 wallclock secs ( 0.03 usr  0.01 sys +  1.05 cusr  0.05 csys =  1.14 CPU)
Result: PASS

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 10:12:08 -03:00
d8a5d2359f Bug 12603: (QA Followup)
* Fix syntax error
* Remove Schema files for nonexistant tables
* Fix circular dependency
  * Makes unpushed followup for bug 11518 unnessary

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 10:08:52 -03:00
Yohann Dufour
ec50dc7fd8 Bug 12603: creating TestBuilder to simplify tests
This patch contains a new module t::lib::TestBuilder which allows to write tests easier and it contains the unit tests of this module.
For more information, see the documentation of the module.

This module uses the DBIx::Class schema and works with a clean DBIx::Class schema. In order to use it, you have to remove the current circular dependence (existing in the DBIx::Class) by applying the last patch of the bug 11518.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 10:07:31 -03:00
Jonathan Druart
ba0f84b46c Bug 9978: (followup) Replace license header with the correct license (GPLv3+)
There was another form of the v2.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:43 -03:00
Jonathan Druart
a6c9bd0eb5 Bug 9978: Replace license header with the correct license (GPLv3+)
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

http://bugs.koha-community.org/show_bug.cgi?id=9987

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:38 -03:00
Jonathan Druart
4b0b273cb0 Bug 12847: Items issued today is considered as overdue
The date comparisons in C4::Members::IssueSlip does not work as
expected.
Is an item is issue yesterday and due today (23:59), it should not be
considered as an overdue yet.

Test plan:
Define a valid issue slip (code ISSUESLIP)
Check 2 items out and update the issuedate value for one of them as
yesterday (using the mariadb/mysql cli or similar)
Print the slip
Before this patch the item marked as issued yesterday is considered as
overdue.

Special cases:
- hourly loans
- Quick slip is impacted too

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:57:25 -03:00
f8f6500274 Revert "Bug 13189: (QA Followup) Unit Tests"
This reverts commit a7822b0a32.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-16 15:28:21 -03:00
0082a4587b Bug 10480: New module and unit test for framework plugins
This patch introduces the Koha::FrameworkPlugin object to Koha.
This object supports the current "old-style" plugins while adding a new
style based on the concept of two anynomous subroutines for building and
launching.

I will summarize the advantages of this new approach, justifying the
additional lines of code in this patch:

[1] Centralizing the code for building and launching plugins.
[2] Extensive unit testing: this was not possible before.
[3] Simplicity: Only define what you need in the plugin.
    A follow-up patch will delete 1500 lines with *empty* routines.
[4] Make it possible to restore the warnings pragma for all plugins.
    New style plugins do no longer depend on redefinition.
[5] Event binding moved from HTML attributes moved to jQuery code.
    This separates behavior and presentation.
[6] Much more documentation, including EXAMPLE plugin in follow-up.
[7] Improved error handling.
[8] Usability: property noclick tells you if plugin's buttonDot is active.
[9] More events supported: Change, keyboard/mouse events. See EXAMPLE.

NOTE ON EXAMPLE PLUGIN:
The example plugin is added in the third patch of this report. Since
it is new style, it can be used only after we start using this object. It
also contains an example for a keypress and mouseover event.

NOTE ON ITEM PLUGINS:
Old style plugins for items contain an additional parameter in the js
functions for Blur, Focus and Change. This distinction has no actual use
and is resolved for new plugins in the object code. When converting
item plugins, this minor correction will be addressed. In the meantime
old style item plugins behave as expected.

TEST PLAN:
Run the new test t/db_dependent/FrameworkPlugin.t
At this point in time, you do not need to do anything more. Follow-up
patches will incorporate the object in real-life Koha and provide
additional test plans.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-16 14:48:35 -03:00
Jonathan Druart
56d366f3b1 Bug 6520: Add unit test for C4::ImportBatch::GetRecordFromImportBiblio
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-16 13:40:59 -03:00
73c0c9ef00 Bug 13315: (QA followup) fix t/db_dependent/Circulation_issue.t
C4::Circulation::AddIssue now returns a Koha::Schema::Result::Issue object
so tests need to be fixed.

The old behaviour was to always return the due date. It now returns
undef if no issue performed. So one of the tests become irrelevant.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-13 15:15:31 -03:00
e96e1126b6 Bug 13315 - Add feedback for last item checked out to circulation.pl
It seems that many librarians find it disconcerting to have no feedback
with the new checkouts table. It seems that many of them wait for it to
fully load, check to verify the item was checked out, and only then
check out the next item.

To help alleviate this issue, we can have the checkouts page give
feedback about the item that was just checked out.

Test Plan:
1) Apply this patch
2) Check an item out
3) Note the message "$title ($barcode) due on $date_due"

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

This works well and fixes a very problematic issue with the new AJAX
circ. I will be submitting a follow-up which I think is an improvement
to the display.

Signed-off-by: Jason Burds  <jburds@dubuque.lib.ia.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-13 14:52:26 -03:00
Julian FIOL
9c6bc2543f Bug 13942 : Testing the 'recordpayment' function in C4::Accounts
for Kyle M Hall : Adding removal of the 'issues' table

TEST PLAN
---------

1. Apply patch
2. prove -v t/db_dependent/Accounts.t
-- All 15 tests should run successfully without any error or warning

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-13 11:53:45 -03:00
a7822b0a32 Bug 13189: (QA Followup) Unit Tests
Resolved easy conflict (test count) and tested.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-13 11:18:24 -03:00
Jonathan Druart
9fb422bb9f Bug 13244: Merge GetOrders and GetCancelledOrders
These two subroutines did the same job (same select, same join, etc.)

Test plan:
Go on the basket list page and verify you see the pending and the
cancelled baskets.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Two small things are adjusted in separate follow-ups.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-13 11:08:40 -03:00
Jonathan Druart
27b534dc56 Bug 11337: Remove the C4::Serials::GetSubscriptions routine
Since SearchSubscriptions is the way to search subscriptions, each call
to GetSubscriptions could be replaced by a call to SearchSubscriptions.

Test plan:
Verify following pages display the same thing as before this patch:
- catalogue/detail.pl
- opac/opac-ISBDdetail.pl
- opac/opac-detail.pl

Verify the following page returns correct results:
- serials/checkexpiration.pl

Verify the Serials UT file still passes:
- prove t/db_dependent/Serials.t

Note: The title filter on checkexpiration now only searches on the title
DB field. I don't think it is a regression, it should be the way to use
this field. Maybe should we add new search fields on this form.
Bug 5337 reintroduces a bug fixed by bug 5864, this patch restore the
right way to search subscription (based on biblionumber).

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-13 10:36:19 -03:00
Jonathan Druart
742a12e41d Bug 11008: Drop column aqorders.supplierreference
It seems that this column has never been used.

Test plan:
1/ Execute the updatedatabase entry.
2/ git grep supplierreference should not return occurrence in the code (except
in Koha/Schema/*
3/ prove t/db_dependent/Acquisition.t should return green.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-04-13 10:10:43 -03:00
653686cee9 Bug 13909: (QA followup) fix references to get_chargeable_units
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-12 10:54:50 -03:00
Jonathan Druart
68e4f96511 Bug 13934: C4::ItemType->get should return undef if no parameter given
The issue: If you try to check in an item with a non existent barcode,
the application will exploded with a software error:
"Can't bless non-reference at .../ItemType.pm Line 64".
It's caused by:
commit 7431f8cfe2
    Bug 11944: Fix encoding issue in C4::ItemType

and the following change:
@@ -105,9 +104,6 @@ sub get {
     my $data = $dbh->selectrow_hashref(
         "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype
     );
-    if ( $data->{description} ) {
-        $data->{description} = Encode::encode('UTF-8', $data->{description});
-    }

because of the following:
  my $s;
  $s->{foo} = "bar" if $s->{foo};
  use Data::Dumper;warn Dumper $s;
=> {} # not undef

So later,
  bless $opts => $class;
will fail because $opts is undef and was not (i.e. {}) before.

More explicit test plan:
1) Log in to staff client
2) Circulation -> Check in
3) Type a non-existent barcode into 'Enter item barcode:' textbox
4) Click 'Submit'
   -- Should receive nasty error.
5) apply patch
6) repeat steps 2-4
   -- Should be told 'No item with barcode: {what you typed}'
7) prove -v t/ItemType.t
   -- All tests should run successfully.
7) run koha qa test tools

Note: Having tried to create and use an itemtype '0', this only
      demonstrates a lack of validation on the itemtype creation
      screen. Unable to use it without tweaking back end.
      That is beyond the scope of this bug.

Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even
if the behavior is changed, it should not introduce any regression
somewhere else.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Works as expected. Fixes the problem and no regressions found.
It even has regression tests :-D

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-10 10:18:07 -03:00
Julian FIOL
7a94c50fa6 Bug 13940 : (QA followup) Add test for ModOAISet
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-09 11:56:53 -03:00
Julian FIOL
9be1d927bb Bug 13940 : (QA followup) Add tests for the 2 warnings which was not tested
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-09 11:56:47 -03:00
Julian FIOL
975b055c08 Bug 13940 : Testing C4::OAI::Sets
Testing C4::OAI::Sets in t/db_dependent/OAI/Sets.t
Adding &DelOAISetsBiblio in @EXPORT at the beginning
of OAI/Sets.pm, it was the only one missing

TEST PLAN
---------

1. Apply patch
2. prove -v t/db_dependent/OAI/Sets.t
-- All 145 tests should run successfully without any error or warning
3. Run koha qa test tools
   -- No issues found.

Additionally, I comfirmed why DelOAISetsBiblio was added in
the list of exported functions.

$ grep "^sub " C4/OAI/Sets.pm | sort > check1
$ for i in `grep "\&[A-Z]" C4/OAI/Sets.pm | xargs `; do echo $i; done | sort > check2

Of course the outputs have a little extra around them, so
$ vi check1
$ vi check2
$ diff check1 check2

Lo and behold, it was that one function. Necessary for 100% coverage.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-09 11:56:41 -03:00
565b97924e Bug 13882: Tidy t/Borrower.t to fix whitespace errors
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-08 12:19:15 -03:00
Julian FIOL
49d16fe062 Bug 13882 : Adding new unit tests in t/Borrower.t
This adds testing for all the 'borrower' database fields.

TEST PLAN
---------
1) apply patch
2) prove -v t/Borrowers.t
   -- All 67 subtests for both the setter and accessor
      should run successfully.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-08 12:17:57 -03:00
Mark Tompsett
e8b8fb3519 Bug 13928: Clean up noisy t/Borrower.t tests
While testing bug 13882, noisy messages were noticed. Also,
Test::Warn was used, but no catching attempts were made. This
patch solves that problem.

TEST PLAN
---------
1) prove -v t/Borrowers.t
   -- There should be three noisy lines.
2) apply patch
3) prove -v t/Borrowers.t
   -- There will be 3 more tests and no noisy lines.
4) Run koha qa test tool
   -- There should be no issues.

NOTE: This will conflict with bug 13882 if either gets pushed
      to master, but fixing the conflict should be easy enough.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Works as expected

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-08 12:09:01 -03:00
Matthias Meusburger
c3ff4298fc Bug 13507: (regression test) Intranet URL returned by C4::Auth_with_cas::_url_with_get_params
C4::Auth_with_cas::_url_with_get_params should return the right
URL for intranet.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Edit: added a proper commit message. Sort of :-P
2015-04-08 12:02:26 -03:00
Jonathan Druart
85a0f6a42f Bug 13933: Fix t/DateUtils.t without DB
If the mysql server is not running, the DateUtils.t tests failed.
This is caused by

commit dd9f456ab7
    Bug 13601: Add tests to highlight the problems with
    DateTime::Format::DateParse

The pref dateformat and TimeFormat were retrieved before the mock.
Before bug 13601, the complete preference method was mocked, that's why
the error did not appear.

Test plan:
  sudo service mysql stop
  prove t/DateUtils.t
should be happy

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-01 13:10:16 -03:00
589fd84107 Bug 13841 - Unit Test
Signed-off-by: Jen DeMuth <jdemuth@roseville.ca.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-31 11:36:02 -03:00
Jonathan Druart
e887ae544d Bug 11201: Add a in-house use list pages
The circulation page has a new entry: a link to a list of the pending
in-house use.

Bug 10860 introduces a new way for managing in-house uses.
This patch adds a new page (from the circulation home page) to list all
pending in-house uses.

Test plan:
Go on the circulation home page and click on the in-house use link.
Verify all your in-house uses are listed and information are consistent.

Bug 11201: Display lib instead of AV code

This patch assumes that items.location is linked the the LOC
authorised values.

Signed-off-by: Nicole <nicole@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-31 11:30:55 -03:00
Jonathan Druart
dc1eb56edf Bug 13601: The fallback regex should contain the time part
On displaying a sql date, if the dateformat is not set to sql, the
output should contain the date.
In the previous version, the fallback regex (used for sql format) did not
included the time part (hh:mm:ss).

Checked out an item with due date an ddue time. Time displays as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 13:40:07 -03:00
Jonathan Druart
304ad760a3 Bug 13601: t/Letters.t needs to mock the dateformat pref
Test passes OK.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 13:40:05 -03:00
Jonathan Druart
dd9f456ab7 Bug 13601: Add tests to highlight the problems with DateTime::Format::DateParse
Test behaves as expected (Fail as expected  with first patch only, OK after 3rd patch)
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 13:39:54 -03:00
Srdjan
1802aa9153 Bug 5786 - Move AllowOnShelfHolds and OPACItemHolds system prefs to the Circulation Matrix
C4::Reserves:
* Added OnShelfHoldsAllowed() to check issuingrules
* Added OPACItemHoldsAllowed() to check issuingrules
* IsAvailableForItemLevelRequest() changed interface, now takes
  $item_record,$borrower_record; calls OnShelfHoldsAllowed()

opac/opac-reserve.pl and opac/opac-search.pl:
* rewrote hold allowed rule to use OPACItemHoldsAllowed()
* also use OnShelfHoldsAllowed() through
* IsAvailableForItemLevelRequest()

templates:
* Removed AllowOnShelfHolds and OPACItemHolds global flags, they now
  only have meaning per item type

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>

I have tested this patch left, right and upside down for the last
several months. All tests have passed.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-25 10:33:14 -03:00
1d0143641f Bug 13713: Follow-up removing biblioitem routines
There is no need to define biblioitem routines, if we can access them
via biblioitemnumber.
Note that we actually need a FK for biblio in the items table. Now we do
need the intermediate level via biblioitems in the Items.t code. Even better,
we should move biblioitem to biblio. Formally it is 1-n, but in reality it
is 1-1.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-19 14:06:01 -03:00
Jonathan Druart
c2a86a4ee0 Bug 13713: Remove useless constraints previously added
This patch removes the 3 constraints added by patch from bug 11518.
Having 1-n + 1-1 relations for the same field is a non-sense.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Added a follow-up for removing some unneeded code.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-19 14:05:45 -03:00
a3775ceccd Bug 13814: (QA followup) test for generated warnings
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-15 09:03:33 -03:00
Julian FIOL
6be59e14a2 Bug 13814 : Add Lines Alignment
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-15 08:57:20 -03:00
Julian FIOL
d11c144eac Bug 13814 : add 6 unit tests in t/Boolean.t
Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-15 08:57:16 -03:00
Jonathan Druart
476febe5db Bug 13746: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-15 08:40:12 -03:00
c6249a08f3 Bug 11430: (QA followup) we test for warnings, always
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-11 15:14:24 -03:00
Jonathan Druart
252a4ea3b7 Bug 11430: UT: add unit tests to delete only selected lines
Signed-off-by: sonia BOUIS <sonia.bouis@univ-lyon3.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-11 15:02:39 -03:00
105f8f57f2 Bug 12648: QA Followup
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-11 11:48:18 -03:00
Jonathan Druart
753cbc4040 Bug 12648: Add unit tests for C4::Acquisition::*OrderUsers
Test plan:
Verify that unit tests pass with
    prove t/db_dependent/Acquisition/OrderUsers.t

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-11 11:47:33 -03:00
Benjamin Rokseth
7ba06aad68 Bug 12122: TransferSlip should accept both itemnumber and barcode
Added small patch to allow barcode as input in TransferSlip routine, mostly
to allow generating transfer slips where only barcode is present (aka.
javascript).

Test plan:
1) find book with <barcode> and <itemnumber>
2) generate transferslips with both:
  transfer-slip.pl?transferitem=<itemnumber>3967925&amp;branchcode=MPL&amp;op=slip
  transfer-slip.pl?barcode=<barcode>&amp;branchcode=MPL&amp;op=slip
and verify that the generated slips match.

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

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

Edit:
 - Added tests in t/db_dependent/Circulation_transfers.t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Passes tests and QA script.
Works with both itemnumber or barcode as described.
Tested printing transfer slips with the URL examples given
and in the UI.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-05 11:47:12 +01:00
Jonathan Druart
354ee6d427 Bug 13645: Cache the DBIx connection
We don't want to recreate a new connection to the DB every time we want
a new schema.

This patch creates a $database package level variable on the same way
it's done in C4::Context for $dbh.

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-02-20 14:37:08 -03:00
Jonathan Druart
f82064286d Bug 12669: Centralize the timezone handle into Koha::DateUtils
This patch adds unit tests for the previous changes and centralize the
timezone handle into the Koha::DateUtils module.
Like that the behavior will affect all date manipulations using this
module (should be all dates in Koha).

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>
2015-02-20 10:20:30 -03:00
Jonathan Druart
aed056a636 Bug 12976: Fix some comment in tests
Previous comments were wrong.
Actually the main part of price values is correct.
Only some rounding and tax values are badly calculated.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-19 09:46:44 -03:00
Jonathan Druart
4318eeef5f Bug 12976: Use the centralize VAT and prices calculation - invoice.pl
Bug 12969 introduces a subroutine to centralize VAT and prices
calculation.
It should be use in the acqui/invoice.pl script.

Test plan:
0/ Don't apply the patch
1/ Create 4 suppliers with the different configurations
2/ Create a basket and create several orders
3/ Receive the items and create an invoice
4/ Go on the invoice page acqui/invoice.pl?invoiceid=XXX
5/ Verify you don't see any difference before and after applying the
patch on the invoice details table.
Note: The only different you should see is the price formating for
"Total tax exc.". Before this patch "432.10" was displayed "432.1".

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-19 09:46:26 -03:00
a23c551f30 Bug 13019 [QA Followup] - Fix stale unit test
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-12 15:21:19 -03:00
074428bb8a Bug 13019: [QA Follow-up] Rename new_from_dbic and few typos
Since new_from_dbic is not meant as a public method, this patch adds
a prefix to the name of this internal routine. For the same reason I
removed it from t/Borrower.t.
Removed one use overload-line in Objects (not used).
Resolved a few typos.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-12 15:21:08 -03:00
d562df4af2 Bug 13019 [QA Followup] - Allow find() and search() to be called as static methods
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-12 15:21:05 -03:00
Jonathan Druart
3107975ba9 Bug 13019: (follow-up) Remove smartmatch operator
This patch also adds 1 test.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-12 15:21:03 -03:00
6f0316a8d2 Bug 13019 - Add base classes on which to build Koha objects
The idea behind this is to have a pair of base classes on which to build
our new generation of Koha objects. Koha::Object is a base class, which
in it's most basic form, is to represent a row in a table. For example,
Koha::Borrower inherits from Koha::Object. So too could Koha::Biblio
and Koha::Item for example.

Koha::Objects is to represent a way to fetch and manipulate sets of
objects. For example, Koha::Borrowers has a method to get a
Koha::Borrower object by id and a method to search for an get a list
of Koha::Borrower objects. Right now Koha::Objects has only the
essentials but can easily be extended and those enhancements will be
passed down to all the child classes based on it.

By using these classes as a base, we will add consistency to our
code, allow us to keep our code DRY, reduce bugs, and encapsulate our
database access among other benefits.

Test Plan:
1) Apply this patch
2) prove t/Object.t t/db_dependent/Object.t t/db_dependent/Objects.t

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-12 15:21:01 -03:00
Jonathan Druart
f19a1777a0 Bug 13319: Fix Koha::Acq::Order should set parent_ordernumber
The tests highligh the problem: if the parent_ordernumber attribute is
not set on inserting an order, the object returned by the method does
not contain the value (undef).

Test plan:
Verify the tests are consistent and
    prove t/db_dependent/Acquisition/CancelReceipt.t
should return green.

You can also verify that receive partially an order and cancel the
receipt work as expected.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-10 11:24:08 -03:00
Jonathan Druart
cf8cc47f6d Bug 10900: 2 occurrences more
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-09 17:00:17 -03:00
Mark Tompsett
bd769213eb Bug 10900 - Follow up, since more has been added to master
Booksellers.t and Koha_template_plugin_Branches.t both had
function calls to ::set_userenv added to them. This patch handles
those additions.

TEST PLAN
---------
1) Branch a new git branch
2) prove -v t/db_dependent/Bookseller.t
   -- It should work.
3) prove -v t/db_dependent/Koha_template_plugin_Branches.t
   -- It should work.
4) Apply only the first patch.
5) Repeat steps 2 and 3.
   -- They should both FAIL!
6) Apply the second patch as well.
7) Repeat steps 2 and 3.
   -- The should both work.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-09 17:00:15 -03:00
Mark Tompsett
78d6d794fe Bug 10900 - Incorrect calling conventions accessing C4::Context
There were multiple calling conventions for C4::Context's
set_userenv routine. So the following commands were used to
find discrepancies:
    grep "::set_userenv" `find .`
    grep "\->set_userenv" `find .`

The first grep demonstrated that the smaller change is from
:: to -> as only C4/Auth.pm, installer/InstallAuth.pm, and
t/db_dependent/Circulation.t would need to be modified. This
patch corrects C4::Context's set_userenv routine to be object
call based (use ->) by using a shift to ignore the first
parameter, and modify the three files found with :: calls.

As the result of trying to roll a distribution,
t/Circulation_barcodedecode.t was discovered to be faulty. The
cause being incorrect parameters! This was hidden when there
was no shift in the set_userenv routine. However, with its
correction, the test broke.

This led me to read the POD documentation for the function
set_userenv in C4::Context and realize it was outdated as
well. It has been revised to match the current version of
the function.

Then intentionally bad parameters passed to the set_userenv
routine in C4::Context were hunted down. The biggest problems
were missing surnames or branch names.

Rebase required because of shibboleth change in C4/Context.pm

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-09 17:00:13 -03:00
Jonathan Druart
f7220ba072 Bug 13007: Special case budgetid == ''
In this special case (the suggestion is linked to "all funds"), the
budgetid value should be NULL in DB.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes old and new tests.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-09 15:49:57 -03:00
Jonathan Druart
311afaaf91 Bug 13007: Add a foreign key for suggestions.budgetid
The DB field suggestions.budgetid should be linked to
aqbudgets.budget_id.

If the fund is removed, this column should be set to NULL.

Test plan:
1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and
set "0" in the budgetid field (or a nonexistent budget id).
2/ Execute the updatedabase script.
3/ Verify that your suggestion is unlinked to the nonexistent fund.
4/ Verify the constraint has correctly been added (show create table
suggestions).
5/ Check that this change does not affect the behavior on adding a
suggestion (linked to a fund or not).

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-09 15:49:50 -03:00
Jonathan Druart
945a0f09e7 Bug 13352: On editing, prices should not be formatted
Bug 12979 refactored the way to display prices.
The price format configuration was duplicated everywhere it was used.

All calls looks good except the one in admin/aqbudgetperiods.pl
In this one, the prices are formatted for an edition field (input).
This means the input is incorrectly filled even if the user does not
update the field.

At the end, maybe should we manage formatted prices everywhere, even in
inputs, but it's not in the scope of this bug.

Technically, a new subroutine format_for_editing is added to the
Koha::Number::Price module.
It should be called everywhere a price is displayed in an input field.
At the moment, it only does a sprintf("%.2f"), but it is a first step to
let the number of decimals to display configurable.

To test:
1/ Verify the issue described is fixed (editing a budget with a total
amount > 1000 (With CurrencyFormat is US or FR).
2/ Verify you can edit a fund with a total amount > 1000

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-09 13:35:14 -03:00
Julian Maurice
f70ad43f8f Bug 13562: Fix item search on item MARC subfields
Test plan:
1. Add 4 item search fields (in Administration › Items search fields):
   a. 1 biblio field linked to a DB field
   b. 1 biblio field not linked to a DB field
   c. 1 item field linked to a DB field
   d. 1 item field not linked to a DB field
2. Make sure you have some data in those fields to search on.
3. Go to item search page and do a search using these new fields, make
   sure the result is correct.

Signed-off-by: Nick <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-09 10:28:09 -03:00
e5b834a1c4 Bug 7904: (QA followup) fix tests
The package name for SIP wasn't fixed in the tests by the original patches.

This patch fixes it.

To test:
- Run
  $ prove t/db_dependent/SIP_ILS.t
- Tests should pass with the patch.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-05 15:50:32 -03:00
42c342972a Bug 13262: (QA followup) fix duplicate variable definition
Running

 $ prove t/db_dependent/XSLT_Handler.t

raises a couple warnings because of variable redefinitions. This small patch fixes that.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-05 15:25:50 -03:00
d3c128af9d Bug 13262 - Add parameters to XSLT Handler transform method
This patch adds an optional hashref argument to the XSLT_Handler
transform() method. It allows you to send key => value pairs
parameters to the XML::LibXSLT object, which you can reference
in a XSLT via <xsl:param name="XXX" />.

The parameter value is evaluated as an XPath query, so you can only
pass quoted strings (i.e. "'test'") or numbers. Otherwise, the
XSLT engine will interpret it as a Xpath query and will run it
on the XML that you're transforming.

The most common use case is sending strings to a XSLT. In my case,
this is an OAI-PMH identifier that comes in a OAI response but not
the actual metadata. See the following link from the official POD:
http://search.cpan.org/~shlomif/XML-LibXSLT-1.92/LibXSLT.pm#Parameters

_TEST PLAN_

1) Run "perl t/db_dependent/XSLT_Handler.t". If all tests pass,
you should be free to sign off. Feel free to inspect the last
test in XSLT_Handler.t and the XSL in test04.xsl to see how it
works.

If you really want to be thorough, you could write your own test
cases using mine as an example.

Alternatively, you could go into C4::XSLT, and try to pass a
value to a parameter in the search results or the detail page,
but that might be a bit over the top.

It's a pretty simple patch.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-05 15:24:29 -03:00
Jonathan Druart
74640683f0 Bug 13333: Fix Display basket group for already received orders
Bug 11111 adds a basket group column on the parcel page.
But it seems that the already received orders never contain the value
(always 'no basket group').

Test plan:
Receive an order which is in a basket group and verify the basket group
column is correctly filled.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-05 14:51:34 -03:00
Mark Tompsett
01c7c2a129 Bug 13457 - Followup for CPL and S codes
Based on comment #3, this corrects CPL and S issues if they do
not exist in the DB.

TEST PLAN
---------
0) Backup your DB.
1) Clear CPL and S from your DB.
   - delete from borrowers where categorycode='S';
   - delete from categories where categorycode='S';
   - delete from borrowers where branchcode='CPL';
   - delete from branch where branchcode='CPL';
2) prove t/db_dependent/Suggestions.t
   -- This should fail.
3) Apply patch
4) prove t/db_dependent/Suggestions.t
   -- This should work.
5) Intentionally add categorycode 'S' and branchcode 'CPL' back
   into the database.
6) prove t/db_dependent/Suggestions.t
   -- This should work.
7) run koha qa test tools.
8) Restore your DB :)

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-05 14:49:02 -03:00
Mark Tompsett
bfb035511e Bug 13457: Suggestions.t expects sample itemtypes
TEST PLAN
---------
1) Make sure you have more than 8 item types, and preferably
   something with a non-sample default code for itemtypes.
2) prove t/db_dependent/Suggestions.t
   -- this will fail
3) Apply patch
4) prove t/db_dependent/Suggestions.t
   -- this will succeed
5) run koha qa test tools

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-05 14:48:56 -03:00
Colin Campbell
d85f757ce7 Bug 7904 Change SIP modules to use standard LIB path
For historical reasons the SIPServer and SIP modules
have used an extra module path in addition to the
standard Koha one. This has caused numerous irritants
in attempting to set up scripts and basic tests. It
does not help in attempting to modify or debug
this code

This patch changes the package value in the modules
under the C4/SIP directory and makes calls to
them use the full package name.

Where the export mechanism was being short circuited
routines have been explicitly exported and imported
declarations of 'use ILS' when that module was
not being used and which only generated warnings
have been removed.

As a lot of the changes affect lines where
an object is instantiated with new. The opportunity
has been taken to replace the ambiguous indirect
syntax with the preferred direct call

In intializing ILS the full path is added as this
will not require any changes to existing configs.
I suspect this feature is unused, and adds
obfuscation rather than flexibility but have kept
the feature as we need this change in order to
rationalize and extend the testing of the server.

The visible difference is that with the normal Koha
PERL5LIB setting. Compilation of Modules under C4/SIP
should be successful and not fail with unlocated modules,
allowing developers to see any perl warnings

All the SIP modules can now be run through the tests
in t/00-load.t now except for SIPServer itself

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-02-05 14:44:54 -03:00
cb2f8f6635 Bug 12973: (QA followup) warnings are features, test them
This patch makes the test look for the warnings Koha::XSLT_Handler raises
instead of just throwing them to STDERR.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-18 10:29:19 -03:00
97acd9511e Bug 12973: Additional unit tests for XSLT_Handler.t
The additional way of parameter passing is tested in three additional
tests.

Test plan:
Verify if XSLT_Handler.t passes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-18 10:29:15 -03:00
Jonathan Druart
3b54dbabfe Bug 13554: t/Prices.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/Prices.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/Prices.t

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-17 10:30:34 -03:00
Jonathan Druart
adcabe6f8f Bug 13393: Remove C4::VirtualShelves::Merge
This is empty (?)

Test plan:
  git grep 'VirtualShelves::Merge'
should not return anything.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-17 10:22:29 -03:00
Jonathan Druart
8b19fd4b0d Bug 12850: C4::Serials::GetLateIssues can be removed
This routine is not used and can be removed.

Test plan:
  git grep GetLateIssues
should not return any result

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-14 21:32:03 -03:00
Jonathan Druart
178e51cad7 Bug 13579: Prefer like instead of ok to match a regex
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-14 12:24:29 -03:00
29ebdc3ad5 Bug 13579: (regression tests) Encoding issues on about > timeline get tested
This patch introduces two tests for encoding issues on about > timeline

To test:
- Apply the patch and run
  $ KOHA_USER=kohaadmin KOHA_PASS=katikoan KOHA_INTRANET_URL=http://koha-dev.biblioadmin prove t/db_dependent/www/history.t
  (adjust to your own settings, the user needs to have access to the about page)

Regards

Signed-off-by: Manuel Cohen Arazi <manuelcohenarazi@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-14 12:24:22 -03:00
Jonathan Druart
e20270fec4 Bug 11944: use CGI( -utf8 ) everywhere
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-13 13:07:21 -03:00
Jonathan Druart
55107741a2 Bug 11944: replace use of utf8 with Encode
See the wiki page for the explanation.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-13 13:06:45 -03:00
Zeno Tajoli
021c3695e8 Bug 13264: Follow up on record files: deleted fields (952/995) with items info
To insert items info you need to use correct code of sublibrary, not always the code is correct. Items info are not important for this test, so the fields are deleted (952 in MARC21, 995 in UNIMARC)

http://bugs.koha-community.org/show_bug.cgi?id=13264
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:27 -03:00
Zeno Tajoli
556b15f725 Bug 13264: More tests for Latin-1 vs. UTF-8 interpretation
New tests in search_utf8.t, now are tested also records with only utf-8 chars that could see also as latin-1 chars

http://bugs.koha-community.org/show_bug.cgi?id=13264
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:27 -03:00
Zeno Tajoli
0f8589483f Bug 13264: Update of unimarc and marc21 record to search publisher
http://bugs.koha-community.org/show_bug.cgi?id=13264
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:27 -03:00
Zeno Tajoli
4c7de64b3a Bug 13264: Add Latin-1 vs UTF-8 test specific records
This patch addes two new files .mrc for marc21 and unimarc to test chars in utf8/latin-1 section only, to be sure that perl doesn't switch between utf-8 nad ISO 8859-1 inside itself.

http://bugs.koha-community.org/show_bug.cgi?id=13264
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:27 -03:00
Zeno Tajoli
6691d273cd Bug 13264: Add tests for Latin-1 vs. UTF-8 deduction
add a test in auth_values_input_www to check chars that could be Latin-1 or UTF-8

http://bugs.koha-community.org/show_bug.cgi?id=13264
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
Zeno Tajoli
04ef213dec Bug 13264: Add more records to the marc21 aand unimarc files
Dupliacate record in marc21 and unimarc files, so the search finds always more than one result.

http://bugs.koha-community.org/show_bug.cgi?id=13264
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
9bba9fb386 Bug 13264: (QA followup) prevent double-encoding on the tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
Jonathan Druart
72563473ae Bug 13264: Refactor search utf8 tests and add some more
t/db_dependent/www/search_utf8.t and
t/db_dependent/www/intranet_search_utf8.t were quite similar, I merged
them into a single file (t/db_dependent/www/search_utf8.t).
On the way, I added some tests for them.

Note that you will need the last patch on branch bug_11944 to see the
tests pass.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
Emmanuele Somma
2e368c1478 Bug 13264: Additional test for search in intranet calatogue
The utf-8 test do: insert a biblio record with tool, search the record in intranet,
delete batch upload and biblio records.

To test: prove intranet_search_utf8.t

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
Zeno Tajoli
20a7f1d038 Bug 13264: Follow up: in opac_utf8.t insert also delete of biblio
In previous version of the test opac_utf8.t clears import from resevoir
but it doesn't delete record from biblio table in MySQL.
This the standard work of the feature, see:
http://manual.koha-community.org/3.18/en/catalogtools.html#managestaged

Now the script deletes also record on MySQL level.
No necessary on Zebra level because it uses a temporaney Zebra index that it is
clenaned at the end of the script.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
5e43f20a44 Bug 13264: Make opac_utf8.t launch its own helper processes
This patch makes opac_utf8.t launch its own:
- zebrasrv process
- rebuild_zebra.pl (daemon mode)

It also takes care of killing them when finished. It sets a frecquency
of 5 seconds for the indexer, and waits 10 just in case before looking
for the indexed records.

To test:
- Just launch the tests.

Edit: fixes on the license text.

Regards
Tomas

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
0f44011336 Bug 13264: no need to test for MySQL
This patch removes the test for a running MySQL process.
It is already implied by successfuly loading C4::Context.

It also fixes the license text.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Zeno Tajoli
44ed6c37c5 Bug 13264: Test for utf-8 on authorised values input/display/delete
This test check utf-8 support on web intranet interface for authorized values.
It test input, search and delete of utf-8 values.
If all OK it destroy values inserted

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Zeno Tajoli
fb9eb5737b Bug 13264: Test for utf-8 on Opac search
This test need to setup zebraserver and background indexing.
You need to set also KOHA_INTRANET_URL and KOHA_OPAC_URL
in the user enviroment.

It imports sample records and retrieves them on hte OPAC through
Apache.

To run it: prove opac_utf8.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Zeno Tajoli
1ded4bfc55 Bug 13264: UNIMARC and MARC21 records to test UTF-8
The records shares enough chars to do the same search ('deuteros') to
find them and check the same utf-8 chars.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Mark Tompsett
e6dbae9dbf Bug 12868: Improving t/db_dependent/Member.t
The mock function of GetMemberAccountRecord did not properly
account for the undef case. This was corrected.

Then all 4 combinations of borrower number and card number being
defined or not were called to GetMemberDetail.

The problematic test case is where the borrower number is
undefined and the cardnumber is defined.

TEST PLAN
---------
1) Apply just this first patch.
2) prove -v t/db_dependent/Member.t
   -- This should fail!
3) Run koha QA test tools.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-10 16:16:51 -03:00
Jonathan Druart
fbfc109777 Bug 13378: Add a filter to search suggestions not linked to a fund
This patch adds a "None" option for the fund filter.

Test plan:
1/ Go on the suggestion search page
2/ Search suggestions not linked to a fund using the "None" option.
3/ Search all suggestions (linked or not to a fund) using the "Any" option.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-10 16:13:08 -03:00
Jonathan Druart
1c9275d5c5 Bug 12969: Fix typo
rrpgsti should be rrpgste

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 12:45:31 -03:00
Jonathan Druart
a19958ee2c Bug 12969: Add a subroutine to calculate VAT and prices
This patch adds a new subroutine populate_order_with_prices in the
C4::Acquisition module.

Its goal is to refactore the VAT and prices calculation into Koha.
All scripts will use this subroutine.

Test plan:
Verify that the prices in t/Prices.t are consistent with the values
listed in the file "Prices and VAT calculation - before" submit on bug
12964.
Verify that
  prove t/Prices.t
returns green

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 12:45:18 -03:00
d8eff67534 Bug 13496: add a method for the templates to print Koha version as desired
This patch introduces a simple template plugin function that returns
the Koha version number in different suitable formats.

It introduces unit tests for the new function. They are run with

To test:
- Apply the patch
- Run
  $ prove t/Koha_Template_Plugin_Koha.t
=> SUCCESS: the tests pass.
- Sign off :-D

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>
2015-01-04 11:24:07 -03:00
3e5ea11452 Bug 13167: (QA followup) regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 11:14:58 -03:00
e8f5312dc7 Bug 12896: (QA followup) use C4::Bookseller in t/db_dependent/Serials/Claims.t
As C4::Bookseller is no longer imported in C4::Acquisition the tests
fail because of an undefined function call.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 10:54:46 -03:00
Jonathan Druart
a93fd3fe06 Bug 12896: Remove 2 occurrences in comments
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Passes tests and QA script.
Full test report on the bug report.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 14:16:05 -03:00
Jonathan Druart
469f36d38f Bug 12896: Move the bookseller-related code into Koha::Acquisition::Bookseller
The C4::Acquisition module should be exploded in order to add
readability and maintainability to this part of the code.

This patch is a POC, it introduces a new Koha::Acquisition::Bookseller module and put in
it the code from GetBookSeller and GetBookSellerFromId.

Test plan:
1/ Create a bookseller, modify it.
2/ Add contacts for this bookseller
3/ Create an order, receive it, transfer it
4/ Launch the prove command on all unit tests modified by this patch and
verify that all pass.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 14:15:58 -03:00
Jonathan Druart
a43e6d26f6 Bug 13502: Add tests to highlight the problem
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 14:07:08 -03:00
Jonathan Druart
fb706f58b2 Bug 1861: Add 1 test to AddMember
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 12:14:03 -03:00
Mark Tompsett
7aec3a9aa4 Bug 13453: Koha.t daily quote tests assume sample data
By adding quotes 3 and 25 from the sample data, this test can
pass without having the sample quote data loaded.

TEST PLAN
---------
1) Ensure there is no quote id=3 or that it is NOT
   Abraham Lincoln.
2) prove t/db_dependent/Koha.t
   -- this should fail the daily quote test.
3) apply patch
4) prove t/db_dependent/Koha.t
   -- this should *NOT* fail the daily quote test.
5) run koha qa test tools

Followed test plan 1)-4). Without patch, daily quote test failed. With patch, test passed OK.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, leaves actual data unchanged.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-28 19:52:51 -03:00
7135364dd2 Bug 1861 [QA Followup] - Fix Check_Userid and unit tests
Check_Userid assumes that a borrowernumber will always be passed in
and thus fails to to return 0 for an already used userid when creating
a new patron.

Unit tests must now also me modified to no longer assume it is possible
to create multiple patrons with the same userid.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-28 19:50:49 -03:00
Mark Tompsett
9412b90599 Bug 13456: Serials/Claims.t expects no subscriptions
However, this is an unreasonable assumption for a system which
is in use (either lots of testing or production).

TEST PLAN
---------
1) Have a supplier with a late subscription.
2) prove t/db_dependent/Serials/Claims.t
   -- will fail
3) apply patch
4) prove t/db_dependent/Serials/Claims.t
   -- success
5) run koha qa test tools

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-19 17:32:28 -03:00
Mark Tompsett
d37dee3ddf Bug 13451: Holidays.t assumes default data
This patch removes that assumption by expressly setting data
to be default.

TEST PLAN
---------
1) Ensure that branch code is NOT 'MPL' in the
   repeatable_holidays table in your database.
2) Ensure that branch codes 'MPL' and 'CPL' do not exist
   in the branches table in your database.
3) prove t/db_dependent/Holidays.t
   -- this should bomb horribly.
4) Apply patch
5) prove t/db_dependent/Holidays.t
   -- all tests should succeed.
6) run koha qa tests

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass without holidays in the calendar.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-17 19:24:50 -03:00
Jonathan Druart
46e3f8169c Bug 12980: GetHistory does useless processing
GetHistory iterated on the orders to calculate the quantity and price.
These values are never used by the called.
It can be removed.

Test plan:
Verify there is no regression on acqui/histsearch.pl and
catalogue/detail.pl
Actually you just have to check that the total quantity and price are
not displayed on these views.

QA: note that 'count' and 'toggle' are never used in the template.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-03 11:42:48 -03:00
22d3ebdb27 Bug 12831: (RM followup) regression test
checkpw_ldap should return 0 if it is not an anonymous bind, and authentication
fails. This is better explained on the bug comments. This is just a regression
test for the revised functionality.

To test:
- Run
  $ prove t/db_dependent/Auth_with_ldap.t
=> FAIL: it fails because C4::Auth_with_ldap doesn't match the expected behaviour
- Apply the bugfix from Martin
- Run
  $ prove t/db_dependent/Auth_with_ldap.t
=> SUCCESS: tests now pass.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-27 14:45:11 -03:00
Jonathan Druart
3b6b8a4a1e Bug 13215: Fix GetLetterTemplates should return default templates if branchcode is not defined
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-27 11:42:26 -03:00
Jonathan Druart
6f599652b1 Bug 13215: The same letter code can be used for several libraries
This patch fixes a major issue introduced by the
commit 5c4fdcf Bug 11742: A letter code should be unique.

The interface should let the possibility to create a default template
letter and some specific ones, with the same letter code (letter.code).

The patches submitted on bug 11742 tried to fix an issue based on a
(very bad) assumption: letter.code should be considered as a primary key and
should be uniq.

This patch reintroduces this behavior.
Note that the interface will block a letter code used in different
module (this is consistent not to have the same letter code used for different
needs).

This patch is absolutely not perfect, it just tries to change as less
change as possible and to use new tested subroutines.

Test plan:
1/ Verify that the problem raised on bug 11742 does not appears anymore.
2/ Verify there are no regression on adding, editing, copying, deleting
letters.
3/ Verify you are allowed to create a default letter template with a letter
code and to reuse for a specific letter (i.e. for a given library).

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-27 11:42:14 -03:00
Jonathan Druart
b141e6d42a Bug 13332: Fix conflict between 5304 and 10860
These 2 bugs are in conflict.
The first one always join the issue table, the second one join on this
table too if the OnSiteCheckouts pref is enable.
So DBI raises an error if the pref is enabled (2 joins on the same
table).

This patch removes the conditional join.

Test plan:
Go on a detail record page with items and verify that items are list and
that the error no more appears in the log file.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Reproduced the problem, the patch fixes it, no noticeable regression found.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, items are visible again.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-26 11:25:04 -03:00
Jonathan Druart
f63aaf2242 Bug 13242: Remove warning if no parameter given
Without any parameter, dt_from_string should not raise a warning
message.

Test plan:
Verify that the test file t/DateUtils.t displays a warning:

  Use of uninitialized value $date_string in pattern match (m//) at
  Koha/DateUtils.pm line 58

if the change in dt_from_string is not applied (manually edit the file).

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-26 11:17:08 -03:00
9a386c7cdb Bug 12851: (QA followup) tests should not expect the <order> tag
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-25 16:05:24 -03:00
4c1ae53d86 Bug 13297 - Shelving location PROC does not work according to manual
According to the manual, "Items will stay in the PROC location until
they are checked in".

This is not the actual behavior. Right now items will only change from
PROC to CART, and that is only if InProcessingToShelvingCart is enabled.
Some libraries want to use the PROC to permanent location feature,
without using the CART.

Additionally, the location is only removed if using returns.pl, but
that is not what the manual says either. What if the library uses
SIP2 devices for handling returns? This should be taken into
account.

Test Plan:
1) Apply this patch
2) Set an item's current location to PROC, and it's permananet location
   to a different location.
3) Check the item in any way you wish
4) Note the shelving location is updated to the permanent location
5) prove t/db_dependent/Circulation/Returns.t

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

I tested this with items which had items.location set to 'PROC' and
items.permanent_location set to NULL, '', and a real value, and it
worked correctly in all cases. I tested with check-ins from returns.pl
and from the table of checkouts in circulation and the PROC location was
correctly removed in both cases.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-23 10:11:28 -03:00
Srdjan
c6b7275bfe Bug 5304: Use branch codes from the database rather than hardcoded CPL and MPL
http://bugs.koha-community.org/show_bug.cgi?id=5304
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No commit message
No test plan.

prove t/db_dependent/Items.t pass
No koha-qa errors

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-21 20:44:53 -03:00
5b71f3c5cd Bug 13281: t/ImportBatch.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:53:36 -03:00
0f92fbbb0c Bug 13279: t/Breeding.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:39:53 -03:00
7fdd7f560b Bug 13280: t/Circulation_barcodedecode.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:38:28 -03:00
e00cbe8091 Bug 13282: t/Message.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:38:02 -03:00
6c2cb7cec8 Bug 13283: t/Overdues.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:37:39 -03:00
1cec3e82dc Bug 13284: t/RotatingCollections.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:37:20 -03:00
95ce6945d8 Bug 13277: (QA followup) use t::lib::Mocks
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:12:03 -03:00
98fcda28ff Bug 13277: t/SuggestionEngine_AuthorityFile.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/SuggestionEngine_AuthorityFile.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/SuggestionEngine_AuthorityFile.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

Regards

Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Turned off MySQL and ran the tests before and after the patch.
Works as advertized.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:12:00 -03:00
b8a0eefc23 Bug 13278: (QA followup) use t::lib::Mocks
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:11:58 -03:00
48da54977a Bug 13278: t/Search.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/Search.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/Search.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

Regards

Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Turned off MySQL and ran the tests before and after the patch.
Works as advertised.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:11:54 -03:00
Katrin Fischer
bb186e09a6 Bug 13223: [QA Follow-up] Adding some unit tests for wrapper
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Trivially amended. Thanks, Katrin.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 13:28:28 -03:00
e2a169dc9d Bug 13242: Add a UT to t/DateUtils.t for testing DateTime bug
A bug in DateTime slow down drastically date parsing when the dates are in the
far distant future:

https://metacpan.org/pod/DateTime#Determining-the-Local-Time-Zone-Can-Be-Slow

This UT tests this situation which affects Koha::DateUtils function
dt_from_string() and output_pref().

TO TEST:
- Apply the patch containing the UT
- prove -v t/DateUtils.t
- You see that parsing a 9999-01-01 that take forever (ie more than 1s)
- Apply the patch containing the fix
- prove -v t/DateUtils.t
- No more complain.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described - check-ins are now much faster.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 11:32:32 -03:00
Jonathan Druart
752c8bf043 Bug 13276: use t::lib::Mocks::mock_dbh
To use this patch, patch from bug 13274 should be applied too.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 11:30:45 -03:00
206157beb1 Bug 13276: t/XSLT.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/XSLT.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/XSLT.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

Regards

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass without db connection for me now.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 11:30:41 -03:00
Jonathan Druart
428a744843 Bug 13274: Mock new_dbh in t::lib::Mocks
This patch suggests to create a routine to mock C4::Context::_new_dbh.

NOTE: Works the same with and without this secondary patch.
      koha-qa tests fine. Less cutting and pasting in the future.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 09:50:32 -03:00
340e23ece5 Bug 13274: t/00-load.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/00-load.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/00-load.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

NOTE: Even seems to grab more than expected, which is good.
      349 tests in master vs 364 in this branch = 16,
      but removed block is only 13 (lines 20-32).
      Also ran koha-qa test tool. :)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, tests passing now without database available.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 09:50:27 -03:00
348bca3dbb Bug 11401: (followup) make tests run on absent deps
The current code breaks if a dependency is missing. The evals are
rearranged so there's no error on missing dependency.

To reproduce:
- Have a dependency for t/NorwegianPatronDB.t removed
- Run
  $ prove t/NorwegianPatronDB.t
=> FAIL: You see an error similar to this (may vary depending on the lib you removed):

t/NorwegianPatronDB.t .. You tried to plan twice at t/NorwegianPatronDB.t line 37.

- Apply the patch
- Run
  $ prove t/NorwegianPatronDB.t
=> SUCCESS: Tests are skipped on missing lib

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 15:32:25 -03:00
Jonathan Druart
b969aa3fa3 Bug 11413: Fix field_numbers
This fix is a global fix for the MarcModificationTemplate feature.
Some unit tests were missing and some behaviors were wrong.
For instance, if you tried to update a non existent field, the script
crashed.

The following line was completely stupid:
    if $from_field ne $to_subfield

The field_number equals 1 if the user wants to update the first field
and 0 for all fields.

The field_numbers (note the s) variable contains the field numbers to
update. This array is filled if a condition exists (field exists or
field equals).

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 12:05:47 -03:00
Jonathan Druart
f76b5c8141 Bug 11413: Fix return for ModifyRecordWithTemplate
Make sure the ModifyRecordWithTemplate routine returns undef.

This patch also removes a warning if GetModificationTemplates is called
without parameter.

Verify
  prove t/db_dependent/MarcModificationTemplates.t
returns green.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 12:05:46 -03:00
Jonathan Druart
aa4777dbc9 Bug 11413: UT to show up the issue
These UT reflect this change:
- deletion of the field 245 if 245$a='Bad title'
- move of the 650 field to 651 if 650$9=499

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

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 12:05:42 -03:00
Jonathan Druart
6d2e5f58f2 Bug 11413: Change the field number logic
This patch series is a bugfix for the Marc modification templates tool.

Bug description:
If you want to do an action (delete/update/move/...) on a multivalued
field and if a condition is defined on the same field, it is highly
probable the resulted record will not be what you expect.

For example:
Deleting All (or the first) fields 650 if 245$a="Bad title" works with
the current code.
BUT if you want to delete All (or the first) fields 650 with a condition
on 650$9=42, and if at least one field matches the condition :
- if you have selected all, all fields 650 will be deleted, even the
  ones who do not match the condition.
- if you have selected first, the first 650 field will be deleted, even
  if it does not match the condition.
The expected behavior is to delete the fields matching the
condition (and not all the 650 fields).

What this patch does:
This patch introduces 2 changes in the logic of Koha::SimpleMARC.
The first change is a change of the prototypes for the 2 routines
field_exists and field_equals. Now they return the "field number" of the
matching fields.
The second change is the type of the "n" parameter for all routines
using it in Koha::SimpleMARC. Before this patch, the "n" parameter was a
boolean in most cases. If 0, the action was done on all fields, if 1
on the first one only. Now it is possible to specify the "field numbers"
(so the array of field numbers which is returned by field_exists or
field_equals) for all routines which had the n parameter.

Test plan for the patch series:
Note: This test plan describes a specific example, feel free to create
your own one.
0/ Define a marc modification template with the following action:
  Delete field 245 if 245$9 = 42
1/ choose and export a record with several 245 fields.
For ex:
  245
    $a The art of computer programming
    $c Donald E. Knuth.
    $9 41
  245
    $a Bad title
    $c Bad author
    $9 42
2/ import it using the Stage MARC for import tool.
3/ verify the imported record does not contain any 245 field.
4/ apply all the patches from this bug report
5/ do again steps 2 and 3
6/ verify the imported record contains only one 245 field, the one with
245$9=41
7/ verify the unit tests passed:
  prove t/SimpleMARC.t
  prove t/db_dependent/MarcModificationTemplates.t

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

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 12:05:40 -03:00
Magnus Enger
85255ef18f Bug 11401: QA followup - Make the tests pass
The configs in koha-conf.xml needed to be mocked. There was also
a problem with how the NorwegianPatronDBEndpoint syspref was
getting checked in the .pm.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 09:42:56 -03:00
Magnus Enger
290341d8db Bug 11401: Add support for Norwegian national library card
This patch makes it possible to sync patron data between Koha and the
Norwegian national patron database, in both directions.

In order to use this, the following information is necessary:
- a username/password from the Norwegian national database of libraries
  ("Base Bibliotek"), available to all Norwegian libraries
- a special key in order to decrypt and encrypt PIN-codes/passwords,
  which is only available to Norwegian library system vendors
- a norwegian library vendor username/password

See http://www.lanekortet.no/ for more information (in Norwegian).

While this is of course an implementation of a specific synchronization scheme
for borrower data, attempts have been made to prepare the ground for other sync
schemes that might be implemented later. Especially the structure of the new
borrower_sync table might be reviewed with an eye to how it might fit other
schemes.

To test:

Since the password and cryptographic key needed to use this functionality
is only available to Norwegian library system vendors, only regression testing
can be done on the submitted code. Suggested things to check:

- Apply the patch and make sure the database update is done. This should add
  the new "borrower_sync" table and five new systmpreferences under the
  "Patrons" > "Norwegian patron database" category:
  - NorwegianPatronDBEnable
  - NorwegianPatronDBEndpoint
  - NorwegianPatronDBUsername
  - NorwegianPatronDBPassword
  - NorwegianPatronDBSearchNLAfterLocalHit
- Check that patrons can be created, edited and deleted as usual, when
  NorwegianPatronDBEnable is set to "Disable"
- Check that the new tests in t/NorwegianPatronDB.pm run ok, e.g. on a
  gitified setup:
  $ sudo koha-shell -c "PERL5LIB=/path/to/kohaclone prove -v t/NorwegianPatronDB.t" instancename
- Check that all the other tests still run ok
- Check that the POD in the new files itroduced by this patch looks ok:
  - Koha/NorwegianPatronDB.pm
  - members/nl-search.pl
  - misc/cronjobs/nl-sync-from-koha.pl
  - misc/cronjobs/nl-sync-to-koha.pl
  - t/NorwegianPatronDB.t

Sponsored-by: Oslo Public Library

Update 2014-09-18:
- Rebase on master
- Split out changes to Koha::Schema
- Incorporate new way of authenticating with NL

Update 2014-10-21:
- Rebase on master
- Use Module::Load to load Koha::NorwegianPatronDB in non-NL-specific
  scripts and modules
- Fix the version number of Digest::SHA
- Fix a missing semicolon in kohastructure.sql

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 09:42:23 -03:00
900670bd3b Bug 13075: (followup) remove remaining warnings
There's no point creating a MARC record with undef subfields
for testing holds. This patch avoids that so no warnings are shown.

To test:
- Run
  $ prove t/db_dependent/Holds.t
=> FAIL: verify several warnings show
- Apply the patch
- Re-run
=> SUCCESS: no warnings showed.
- Sign off :-D

Regards

NOTE: Not noticable under Ubuntu 12.04 LTS, but verifiable under
      Debian Wheezy.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 09:35:50 -03:00
Mark Tompsett
878fa77c30 Bug 13075: Silence warnings and improve Charset testing.
Calls to C4/Charset.pm's NormalizeString function with an
undefined string were triggering warnings when running:
  prove -v t/db_dependent/Holds.t

Sadly, t/Charset.t was also lacking calls to NormalizeString.

TEST PLAN
---------
1) prove -v t/db_dependent/Holds.t
   -- This should generate the uninitialized string warnings.
      Make sure CPL and MPL are in your branches to save
      yourself from headaches due to expected data.
2) cat t/Charset.t
   -- note there are no function calls to NormalizeString.
      You can see other shortfalls in the tests beyond
      NormalizeString with: grep ^sub C4/Charset.pm
3) prove -v t/Charset.t
4) Apply patch
5) prove -v t/Charset.t
   -- Run as before with more tests.
6) cat t/Charset.t
   -- note there are now function calls to NormalizeString.
7) prove -v t/db_dependent/Holds.t
   -- Nice and clean run! :)
8) koha-qa.pl -v 2 -c 1
   -- all should be Ok.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 09:35:44 -03:00
9e07b59d5b Bug 11634 [QA Followup] - Make unit tests pass
* Allow on shelf holds needed to be enabled
* Added some error supression code for undefined string comparison

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 14:56:41 -03:00
c9816945fd Bug 11319: [QA follow-up] Add test message to MarcModificationTemplates.t
The last test (#74) did not print anything. It now does..

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 12:04:20 -03:00
Jonathan Druart
2de657d4ec Bug 11319: Add specific UT for nonexistent field/subfield
This patch only adds unit tests for the copy and move actions.
They test if the action does not create a field/subfield if the source
did not exist.

Also it adds a unit tests for the existing behavior (in order not to
lost it): we can use the '^' and the '$' character in regex for
substituing. For example: Copy 245$a to 245$a with the regex s/^/BEGIN /
This will add the string "BEGIN " at the beginning of the 245$a fields.

To test: prove t/SimpleMARC.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 12:04:17 -03:00
Jonathan Druart
041c247124 Bug 11319: Add UT for the fields management
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 12:04:14 -03:00
Jonathan Druart
c48639ee27 Bug 11319: Koha::SimpleMARC should take a hashref for parameters
In order to avoid a long list of parameters, it should be better to
pass all of them into a hashref.

This patch does not add or modify a behavior.

Test plan:
Verify the unit tests still pass
- prove t/SimpleMARC.t
- prove t/db_dependent/MarcModificationTemplates.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 12:04:12 -03:00
3b300146b2 Bug 11634 [QA Followup 3] - Found holds should be considered unavailable
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 11:27:42 -03:00
d77f6519f4 Bug 11634 [QA Followup] - Unit Tests
These new unit tests will fail due to the fact that Koha::Database
uses a separate dbh handle than C4::Context->dbh

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 11:27:34 -03:00
Olli-Antti Kivilahti
51f0a0b722 Bug 13116 - Make it possible to propagate errors from C4::Reserves::CanItemBeReserved() to the web-templates.
This patch changes the way CanBookBeReserved() and CanItemBeReserved() return error
messages and how they are dealt with in the templates. This change makes it possible
to distinguish between different types of reservation failure.

Currently only two types of errors are handled, all the way to the user, from the CanItemBeReserved():
-ageRestricted
-tooManyReserves which translates to maxreserves

 #############
 - TEST PLAN -
 #############
((-- AGE RESTRICTION --))
STAFF CLIENT
1. Find a Record with Items, update the MARC Subfield 521a to "PEGI 16".
2. Get a Borrower who is younger than 16 years.
3. Place a hold for the underage Borrower for the ageRestricted Record.
4. You get a notification, that placing a hold on ageRestricted material is
   forbidden. (previously you just got a notification about maximum amount of reserves reached)

((-- MAXIMUM RESERVES REACHED --))
0. Set the  maxreserves -syspref to 3 (or any low value)
STAFF CLIENT AND OPAC
1. Make a ton of reserves for one borrower.
2. Observe the notification about maximum reserves reached blocking your reservations.

((-- MULTIPLE HOLDS STAFF CLIENT --))
3. Observe the error notification "Cannot place hold on some items"

((-- MULTIPLE HOLDS OPAC --))
1. Make a search with many results, of which atleast one is age restricted to the current borrower.
2. Select few results and "Place hold" from to result summary header element.
       (Not individual results "Place hold")
3. Observe individual Biblios getting the "age restricted"-notification, where others can be
   reserved just fine.

Updated the unit tests to match the new method return values.
t/db_dependent/Holds.t & Reserves.t

Followed test plan. Works as expected and displays meaningful messages for the reason why placing a hold is not possible.

Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 11:23:41 -03:00
Jonathan Druart
299a8a6997 Bug 8218 : Add a maintenance script to sanitize biblio records
This patch adds:
- a new maintenance script batch_sanitize_records
- a new subroutine C4::Charset::SanitizeRecord
- new unit tests for the new subroutine

Test plan:
1/ prove t/db_dependent/Charset.t
2/ Create a record containing "&amp;amp;" (could be follow with as many
'amp;' as you want) in one of its fields and the same for the field
linked to biblioitems.url.
The url should not be sanitized, it may contain "&amp;".
3/ Launch the maintenance script with the -h parameter to see how to use
it.
4/ Launch the script using the different parameters:
 --filename=FILENAME
 --biblionumbers='XXX'
 --auto-search

The auto-search permits to sanitize all records containing "&amp;amp;" in
the marcxml field.

Use the verbose flag for testing.
Without the --confirm flag, nothing is done.

5/ Use the --confirm flag and verify in the biblioitems.marcxml field
that the record has been sanitized.

6/ Try the --reindex flag to reindex records which have been modified.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 15:38:36 -03:00
4f4eb98523 Bug 13113 [QA Followup] - Fix unit test
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 09:54:04 -03:00
Olli-Antti Kivilahti
7767f2e53b Bug 13113 - Prevent juvenile/children from reserving ageRestricted material
There is no reason for underage borrowers to reserve ageRestricted material and
then be denied it's check-out due to ageRestriction.

This patch prevents reserving material for borrowers not suitably aged.

 # # # # # #
 # A PRIORI #
 # # # # # #
BOTH THE STAFF CLIENT AND THE OPAC
1. Find a Record with Items, update the MARC Subfield 521a to "PEGI 16".
2. Get a Borrower who is younger than 16 years.
3. Place a hold for the underage Borrower for the ageRestricted Record.
4. You can reserve an ageRestricted Record with ease.
STAFF CLIENT ONLY
5. Check-in an Item from the ageRestricted Record and catch the reservation.
6. Check-out the ageRestricted Item for this underage Borrower.
7. You get a notification about being unable to check-out due to age restriction.
   How lame is that for a 12 year old?

 # # # # # # # #
 # A POSTERIORI #
 # # # # # # # #
STAFF CLIENT
1. Find a Record with Items, update the MARC Subfield 521a to "PEGI 16".
2. Get a Borrower who is younger than 16 years.
3. Check-out an ageRestricted Item for this underage Borrower.
4. You get a notification about having the maximum amount of reserves.
5. Place a hold for the underage Borrower for the ageRestricted Record.
6. You get a notification, that placing a hold on ageRestricted material is
   forbidden.

Includes Unit tests.

Followed test plan. Patch behaves as expected. (Note: Propagating error messages to template will be handled in Bug 13116 or 11999)

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 09:53:55 -03:00
Olli-Antti Kivilahti
ae7d5fd11b Bug 13106 - Encapsulate Circulation::GetAgeRestriction() and modify it to check borrowers age as well.
This patch moves the logic of deciding whether or not a borrower is old enough to access this material
to its own function GetAgeRestriction.

This makes it easier to use AgeRestriction elsewhere, like with placing holds.

This feature adds a new function C4::Members::SetAge() to make testing ages a lot easier.
A ton of Unit tests included.

C4::Circulate::CanBookBeIssued() fixed and issue with undefined $daysToAgeRestriction per Marc Véron's
suggestion.

Test plan:
(See comment #10 for screenshots about using age restriction)

1) Without patch

Configure Age Restricition (see Syspref AgeRestrictionMarker) and have a biblio record with e.g. PEGI 99 in age restriction field
Try to check out to a patron with age < 99
Check out should be blocked
Change entry in age restriction field to PEGI99
Check out schould now be blocked

2) With patch
Try checkouts again, behaviour should be th same.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 09:52:59 -03:00
561b474bc9 Bug 13230: t/Biblio.t should run without a DB
This patch makes t/Biblio.t mock the DB connexion setting
a void one. All tests in this file currently call the C4::Biblio
functions with invalid (absent) parameters, so they are expected to
raise warnings and return undef values.

If someone writes mocked tests for the rest of the functionality,
it is expected to mock the DB calls to match the desired scenario.

To test:
- Turn of MySQL
- Run
  $ prove t/Biblio.t
=> FAIL: Tests fail because of missing MySQL server
- Apply the patch
- Run
  $ prove t/Biblio.t
=> SUCCESS: Tests now pass
- Start MySQL
- Run
  $ prove t/Biblio.t
=> SUCCESS: Tests still pass
- Sign off

Regards
Tomas

Sponsored-by: The will to procrastinate
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Sponsored-by: Wanting the darn packages to build
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Sponsored-by: Not wanting to read in my maths book
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 09:43:31 -03:00
5b0b78c316 Bug 12264: [QA Follow-up] Fixing biblionumber/biblioitemnumber mixup
While testing the string change on 12264, I had this result:
DBD::mysql::st execute failed: Column 'biblioitemnumber' cannot be null at /usr/share/koha/testclone/C4/Items.pm line 2191.
DBD::mysql::st execute failed: Column 'biblioitemnumber' cannot be null at /usr/share/koha/testclone/C4/Items.pm line 2191.
    # Child (GetItemsInfo tests) exited without calling finalize()
not ok 4 - GetItemsInfo tests

This was caused by this line in the unit test:
 my $biblionumber = get_biblio();
This routine returns:
    return ($bibnum, $bibitemnum);
So instead of the bibnum the bibitemnum is saved in biblionumber.
In my test database bibnum and bibitemnum somehow got out of sync, revealing
this bug :)
The fix is just adding parentheses:
 my ( $biblionumber ) = get_biblio();

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-10 12:00:22 -03:00
Katrin Fischer
3740b2684c Bug 12264: Correct tiny typo in t/db_dependent/Items.t
One of the tests claims 'item-level_itypes is disabled'
when it should be 'item-level_itypes is enabled'.

Patch fixes this.

To test:
- run t/db_dependent/Items.t
- tests should all pass
- verify the last test reads 'enabled'
- look at the code and see it's true

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-10 12:00:22 -03:00
Jonathan Druart
a71b96295f Bug 12627: Fix default values
The default value for *by and *date fields is NULL.
But without this patch, the values are 0 or 0000-00-00.
It comes from the fact that the form set to an empty string the values
and DBIX::Class does not consider them as undefined.

This patch is very ugly, not sure how we can fix that.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
No regressions found, adding and editing suggestions from
OPAC and staff.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-07 15:17:10 -03:00
Yohann Dufour
1c2744a83f Bug 12627: SQLHelper replacement - C4::Suggestions
With this patch, the subroutines NewSuggestion and ModSuggestion use DBIx::Class instead of C4::SQLHelper.
Moreover, the tests and the .pl have been adapted.

Test plan:
1) Apply the patch.

2) Execute the unit tests by launching :
prove t/db_dependent/Suggestions.t

3) The result has to be a success without error or warning :
t/db_dependent/Suggestions.t .. ok
All tests successful.
Files=1, Tests=91,  2 wallclock secs ( 0.05 usr  0.01 sys +  1.65 cusr  0.09 csys =  1.80 CPU)
Result: PASS

4) Log in the intranet, create a suggestion and verify the created suggestion.

5) Edit a suggestion from the intranet and verify the suggestion is correctly modified.

6) Log in the OPAC and verify you can add a suggestion.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Test pass, suggestion created on staff and opac,
suggestion edited without problems, no koha-qa errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script:
Also tested:
- adding suggestion from staff and OPAC
- edit suggestion from staff
- deleting suggestion from OPAC
- changing to a normal status (email got created)
- changing to a custom status (SUGGEST_STATUS)
- display of custom status in OPAC

No problems found.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-07 15:17:00 -03:00
1cabaa32b4 Bug 8836: (RM followup) unit tests should use the new API
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-07 11:09:14 -03:00
fe1461bcd8 Bug 11425: (maniac followup) remove diag from tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-04 19:22:07 -03:00
612769c3e7 Bug 11425: (followup) fix number of tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-04 19:20:34 -03:00
643a9cd0ca Bug 11425 [QA Followup] - Fix number of unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2014-11-04 19:10:28 -03:00