Commit graph

1341 commits

Author SHA1 Message Date
10820de380 Bug 14640: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 11:00:17 -03:00
ae5ee62d59 Bug 7634: Add tests
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@unc.edu.ar>
2015-09-16 10:56:07 -03:00
704aed77ea Bug 7634: Make the tests pass
This patch just fixed a master bug, if your database already has some
items.homebranch set to CPL

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@unc.edu.ar>
2015-09-16 10:56:07 -03:00
224b1c7976 Bug 6756: Fix bad behaviors if AnonymousPatron is not defined
There are at least 2 wrong behaviors if the AnonymousPatron pref is not
defined (0 or empty string).
1/ If you use the clean borrower tools, you will get a successful
message when the nothing happened (the history has not been anonymised).
2/ At the OPAC, if a patron ask for delete his reading history, he will
get an error message "The deletion of your reading history failed,
because there is a problem with the configuration of this feature.
Please help to fix the system by informing your libr    ary of this
error". IMO this should not happen, the history should be anonymised.

With this patch, the old_issues.borrowernumber field will be set to NULL
if the AnonymousPatron pref if not defined.

Test plan:
1/ Fill the pref with "" or 0
2/ At the OPAC, go on the privacy tab and click on the "Immedia deletion" button.
You should get a green and friendly message. Confirm that the history
has been anonymised.
3/ Use the "Batch patron anonymization" tools (tools/cleanborrowers.pl)
to anonymize the checkout history.
Confirm that a) it works and b) you get a message.

Try again with AnonymousPatron set to a valid patron. You should not see
any changes with the current behaviors.

NOTE: This patch tweaks C4/Circulation.pm and provides tests.
      applying just this, and running prove success. Reverting just
      C4/Circulation.pm fails, as expected.
      Tested OPAC stuff with both patches applied.

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@unc.edu.ar>
2015-09-16 10:55:42 -03:00
72d9c28bbf Bug 13622: [QA Follow-up] Add unit test descriptions
This report adds a few unit tests for datonly flag in notices.
This patch adds (very trivial) unit test descriptions.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:49:54 -03:00
Jonathan Druart
cef7cd40ce Bug 13622: Display a datetime without time in a notice
For some needs, a librarian would like to display a datetime or
timestamp field without the time.

This patch adds filter logic in the notice/letter parsing process.

Test plan:
1/ Defined a notice using a datetime or timestamp DB field
(biblio.timestamp for instance).
2/ Generate the notice
3/ Verify that the letter is generated with the time
4/ Use the "dateonly" filter like:
  <<your_table.your_field | dateonly>>
  <<biblio.timestamp | dateonly>>
5/ Generate the notice
6/ Confirm the the letter is generated without the time for this field.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>

Updated the count of tests to 64 for t/db_dependent/Letters.t to pass
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:49:54 -03:00
Jonathan Druart
f062542978 Bug 14197: TestBuilder - Remove the error on starting the transaction
DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1560.
DBIx::Class::Storage::DBI::txn_rollback(): Storage transaction_depth 0 does not match false AutoCommit of DBI::db=HASH(0xa429648), attempting ROLLBACK anyway at t/lib/TestBuilder.pm line 363

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:40:35 -03:00
Jonathan Druart
0b6460b191 Bug 14197: Remove the warning on destroying TestBuilder objects
This module will be called by db_dependent tests, which already create a
transaction.
TestBuilder creates a new one (which is certainly useless) and the
rollback does not do anything.

To see the warning see patches on bug 14045.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:40:35 -03:00
9f8f33e351 Bug 8723: Update the reserves table for item-level holds
If an item is moved from a biblio to another, the holds should be
updated too.

See discussion on the bug report for more information.

Test plan:
1/ Place a item-level hold on biblio1
2/ Move the item to biblio2
3/ Confirm that the hold still exists and point to the biblio2

This patch should not change the existing behavior for bib-level holds.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:39:02 -03:00
cb4ce631c3 Bug 8723: Cover the existing behavior
This patch cover the MoveItemFromBiblio subroutine

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:39:01 -03:00
Katrin Fischer
f704fbebd8 Bug 14782: Add tests
Run:
perl t/db_dependent/Utils/Datatables_Members.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:36:40 -03:00
8b710d62d1 Bug 14801: Fix Reserves.t
Fix the following errors:
not ok 59 - Bug 14464 - No fines at beginning
ok 60 - Bug 14464 - 1st reserve correctly created
not ok 61 - Bug 14464 - No fines after cancelling reserve with no charge configured
ok 62 - Bug 14464 - 2nd reserve correctly created
not ok 63 - Bug 14464 - No fines after cancelling reserve with no charge desired

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended the x==0 test with !x || x==0 to include 0.00 and prevent warn.
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-16 10:19:38 -03:00
Mark Tompsett
cc2452df23 Bug 12357: Following whitespace failures on koha qa test tools.
TEST PLAN
---------
1) Apply all patches before this.
2) run koha qa test tools
   -- whitespace failures
3) Apply this patch
4) run koha qa test tools
   -- no whitespace failures.

NOTE: More tabs were fixed than required, to also clean up a little indenting.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Koha-qa tools now happy

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 13:59:07 -03:00
d997b0b1f0 Bug 12357: [QA Followup] - Unit Test
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
This works with next patch

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 13:58:49 -03:00
ea92a92f53 Bug 14470: Do not allow renew for on-site checkouts
At the opac, the renew checkbox should not be displayed if it's an
on-site checkout (same on the intranet).

On the way, this patch adds a specific message to the intranet if the
librarian try to renew an on-site checkout.
Indeed before this patch a renew was allowed if the barcode was scanned.

Test plan:
1/ Create an on-site checkout for a patron
2/ Confirm that the checkbox 'renew' is not displayed on the checkout
list tables
3/ At the OPAC, the renew should not be allowed (no checkbox)
4/ Try to check the item out to the same patron, confirm that you get a
specifig message to inform you the renew is not allowed for on-site
checkouts.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Changed 'issue' to 'item' in the error message.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 12:07:37 -03:00
40fc2a99c1 Bug 14639: (QA followup) make schema mandatory
This patch makes the 'schema' param mandatory. It is passed in every
call on the current codebase, so it makes no harm now, but makes
the code less error-prone.

Tests for this situation are added to t/Koha_MetadataRecord.t (schema
param is omitted and new() returns undef and a carped warning).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 12:06:21 -03:00
7587e7c752 Bug 14639: (regression tests) Extend Koha::MetadataRecord to handle serialization format and record id
In order to use Koha::MetadataRecord as a container for moving records
around it is important to let it carry the serialization format
of the record object it was built with, so it is easier and cheaper to
make decisions about records.

This patch introduces regression tests for the changes to be made.
The 'format' param is introduced, and also sets default values:
  schema => 'marc21'
  format => 'MARC'

A new (optional) 'id' param is added so the record carries its own id outside
of it.

The default behaviour is preserved, and no changes are needed in places
Koha::MetadataRecord is used.
->new also returns undef if no record is passed, and raises a carped warning.

To test:
- Apply this test patch
- Run the new tests
  $ prove t/Koha_MetadataRecord.t
=> FAIL: Tests shoud fail as the changes are not implemented on Koha::MetadataRecord

Edit: made serialization format be upper-case to match what is used on Koha::Filter's

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 12:06:21 -03:00
48e3e1ab27 Bug 14702: Unit tests for GetReserveFee and ChargeReservesFee
Test plan:
Run the test: t/db_dependent/Reserves/GetReserveFee.t

Signed-off-by: Joonas Kylmala <j.kylmala@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 12:04:49 -03:00
80abbe1fa3 Bug 14602: Fix failing t/Creators.t test
to test..

1/ run t/Creators.t test from git repo, get a FAIL

2/ apply patch

3/ repeat step 1, get a PASS

mason@xen1:~/g/k/3.16.x$ sudo  koha-shell -c 'export PERL5LIB=/home/mason/g/k/3.16.x ; cd /home/mason/g/k/3.16.x ;  prove -v  t/Creators.t' k316x1
t/Creators.t ..
1..16
ok 1 - use C4::Creators;
ok 2 - use C4::Creators::PDF;
ok 3 - testing new() works
ok 4 - testing pdf file created
ok 5 - testing Add() works
ok 6 - testing Bookmark() works
ok 7 - testing Compress() works
ok 8 - testing Font() works
ok 9 - testing FontSize() is set to 12 by default
ok 10 - testing FontSize() can be set to a different value
ok 11 - testing Page() works
ok 12 - testing StrWidth() returns correct point width
ok 13 - testing Text() writes from a given x-value
ok 14 - testing Text() writes to the correct x-value
ok 15 - testing End() works
ok 16 - test file /tmp/4YjPQDExeS created OK
ok
All tests successful.
Files=1, Tests=16,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.48 cusr  0.05 csys =  0.57 CPU)
Result: PASS

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 11:39:47 -03:00
Jonathan Druart
f189696bb7 Bug 14098: Implement the copy_and_replace action for MTT
This patch implements the copy and replace action for the marc
modification templates.
Instead of copying a field/subfield, it will erase the destination
fields/subfields.

Test plan:
Find it yourself.
Compare the differences between the copy and the copy_and_replace
actions.
The easier way to test is to 1/ create a complete record, 2/create some
modification templates and 3/ use the batch record modification with the
"preview" function.

QA note: I kept the same tests as "copy" and, if no change were
expected, I noted them "(same as copy)", to be sure this new action won't
introduce regression on these tests.

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@theke.io>
2015-09-07 11:17:13 -03:00
Jonathan Druart
8c132e956e Bug 14098: FIX Copy a subfield should not update the original field
There is an inconsistency in the copy action:

Given the following control sample:

  245    _aThe art of computer programming
         _cDonald E. Knuth.
  300    _aA_exists
         _bB_exists

If we apply action (a) Copy the whole field 245 to 300, we get:

  245    _aThe art of computer programming
         _cDonald E. Knuth.
  300    _aA_exists
         _bB_exists
  300    _aThe art of computer programming
         _cDonald E. Knuth.

If we apply action (b) Copy the subfield 245$a to 300$a, we get:

  245    _aThe art of computer programming
         _cDonald E. Knuth.
  300    _aThe art of computer programming
         _bB_exists

In (a) the field is copied but in (b) the subfield is erased.

We should be consistent and don't erase the destination field.

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@theke.io>
2015-09-07 11:17:12 -03:00
Tomas Cohen Arazi
efe3d17acc Bug 14651: (regression test) fallback to bib-level if itype is undef
Koha::Item->effective_itemtype should fallback to biblio-level itemtype
even if item-level item types are set, in the case the item has no itemtype
set (bad migration, bad old code).

To test:
- Run
  $ prove t/db_dependent/Items.t
=> FAIL: Koha::Item->effective_itemtype doesn't work properly

Edit: Added a test for a warning when falling back as per QA request
and because it made a lot of sense :-D

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 11:14:19 -03:00
7bad40dcc2 Bug 14717: Prevent 0000-00-00 on updating a patron
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 10:49:49 -03:00
1accce3870 Bug 14526: Add some unit tests for MoveReserve
The change in MoveReserve from the previous patch begs for a test.
Here we add some to Reserves.t.
In all six tests we place a hold, move it and check the reserves again.
Depending on the status of ConfirmFutureHolds, and the reservedate the
hold should be moved or not.

Test plan:
Run the unit test.
Bonus: If you run Reserves.t by applying this patch but without the first
patch that changed MoveReserve, tests 60 and 61 should fail:
    not ok 60 - MoveReserve filled future hold now
    not ok 61 - MoveReserve filled future waiting hold now
This may further illustrate the need of the first patch.

Signed-off-by: Joonas Kylmälä <j.kylmala@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-02 14:53:42 -03:00
Katrin Fischer
c4a4581a50 Bug 13972: Follow-up - Add unit tests for changed parts of SendAlerts
To test:
- prove t/db_dependent/Letters.t

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

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-02 14:41:41 -03:00
6e0b61e2ac Bug 11247: Improve tests
This patch makes the tests non dependent on the DB and test the 3 marc
flavours.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-02 14:36:33 -03:00
d1335a766d Bug 11247: Add a simple unit test for TransformHtmlToXml
The unit test is db dependent (as Jonathan correctly remarked),
since the sub checks a preference.

Test plan:
Run t/db_dependent/Biblio/TransformHtmlToXml.t

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-02 14:36:33 -03:00
9f0170668c Bug 14337: Add 2 more tests to be complete
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-28 10:42:33 -03:00
a2844a8a5c Bug 14337: Fix conflict with bug 9809
The reserves.constrainttype does not exist anymore, it has been removed
by bug 9809.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-28 10:42:33 -03:00
991a8181b2 Bug 14337: Add Unit Tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-28 10:41:35 -03:00
bf67f19ffb Bug 13697: (QA followup) Add Unit Test 2015-08-28 09:52:01 -03:00
ca341f6840 Bug 11190: sitemap.pl -- Generate a Catalog sitemap
Add a script sitemap.pl to process all biblio records from a Koha
instance and generate Sitemap files complying with this protocol as
described on http://sitemaps.org. The goal of this script is to be able
to provide to search engines direct access to biblio records. It avoid
leaving search engine browsing Koha OPAC and so generating a lot of
traffic, and workload, for a bad result.

Thanks Magnus for testing, and helping to improve the script design.

[2015.04.16] Switch from Moose to Moo.

[2015.08.20] Add complete (more) UT.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
All options to the script work as expected and the output looks
good. Nice enhancement!

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

I signed-of my own patch after fixing various QA errors.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended patch: replace tabs with spaces.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-26 11:05:24 -03:00
34c11ee8ee Bug 12632: (regression tests) Unit Tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-26 10:42:04 -03:00
031a3196a4 Bug 9809: [QA Follow-up] Remove constrainttype from 14464 tests
Some additional unit tests of bug 14464 still included a constraint
in the AddReserve calls.

Test plan:
Run Reserves.t

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-26 10:26:56 -03:00
76f16b1b42 Bug 9809: Update unit tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-26 10:26:29 -03:00
Tomas Cohen Arazi
e2ad507500 Bug 14693: Contract.t should generate dates based on current date
The current test for still-active contracts fails because it was written
with fixed dates, which already passed :-D

This patch calculates the current date, and uses it to generate a future
one, so the tests serve their purpose no matter what the current date is.

To test:
- Run:
  $ prove t/db_dependent/Contract.t
=> FAIL: activeonly compares contractenddate with now(), and fails
         because a fixed 2015-07-31 is writteng on the test data
- Apply the patch
- Run:
  $ prove t/db_dependent/Contract.t
=> SUCCESS: the sample data has been calculated using the current date
            and the tests pass.
- Sign off :-D

Edit: added missing use DateTime::Duration,

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-21 10:43:38 -03:00
Jesse Weaver
4ce29452ad Bug 14464: (QA followup) add unit tests
This followup adds several tests to t/db_dependent/Reserves.t.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-21 09:20:22 -03:00
406098b20b Bug 14646: (regression test) Koha::RecordProcessor only accepts one filter at a time
This patch introduces new tests to t/RecordProcessor.t so it tests for
creating processors with more than one filter. It does so by running

    my $processor = new Koha::RecordProcessor({
                            filters => ['Null','Dummy']
                        });

and testing the results.

To test:
- Apply the patch
- Run:
  $ prove t/RecordProcessor.t
=> FAIL: tests related to multiple filters fail.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-20 13:44:15 -03:00
4a738888ad Bug 11229: Make the tests pass even if issues exist in the DB
This is not introduced by the previous patches of this patchset.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-18 13:18:21 -03:00
Tomas Cohen Arazi
a145b43785 Bug 11229: (regression tests) makepayment and makepartialpayment should log correctly
This patch introduces tests for makepayment and makepartialpayment to check
they are correctly logging to the statistics table.

To test:
- Run
  $ prove t/db_dependent/Accounts.t
=> FAIL: tests fail because statistics are not correctly logged.

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-18 13:18:21 -03:00
Jonathan Druart
dcb5bf00aa Bug 13853: (follow-up) unit tests
Specify the reference, we should receive Koha::Object.

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-11 14:49:03 -03:00
ae82953138 Bug 13853: (QA followup) Add unit tests for branch getting methods
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-11 14:48:45 -03:00
Jonathan Druart
7135bae0bb Bug 13853: Add tests for is_waiting
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-11 14:48:44 -03:00
f081063d72 Bug 13030: Show waiting hold expiration date for waiting holds on circulation.pl
We should show the date a waiting hold is set to expire for each hold in
the list of waiting holds in circulation.pl

Test Plan:
1) Apply this patch
2) Find a waiting hold for a patron, browser to circulation.pl
   for that patron
3) Set system preference ReservesMaxPickUpDelay to 5
4) Refresh circulation.pl, note the waiting holds now display a
   "waiting until" part with the waiting date plus 5 days
5) Set system preference ReservesMaxPickUpDelay to 0 ( or empty
   string )
6) Refresh circulation.pl, note the waiting hols no longer have a
   "waiting until" line.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Followed test plan successfully. Automated tests successful.

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

Signed-off-by: Cathi Wiggins <CWIGGINS@ci.arcadia.ca.us>

Signed-off-by: Megan Wianecki <mwianecki@mplmain.mtpl.org>

Bug 13030 [QA Followup] - Fix unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-11 14:47:22 -03:00
7f797b3244 Bug 6874: [QA Follow-up] Last adjustments for future developments
This patch does:

[1] Some trivial template changes. Modified some comments (POD lines).
[2] Converted plugin to new style.
[3] Table updates: renames id to hashvalue, adds a autoincrement id,
    adds filesize, timestamp, owner and category.
    RM: This db rev is in a separate sql file in atomicupdate.
[4] Code references to computed hash renamed to hashvalue instead of id.
[5] Removed some code pertaining to exposing upload dir structure. The user
    now may choose a category; the uploader takes care of storage.
    The list of upload categories is now taken from authorised values; this
    might become a separate table in the future. (If there are none,
    the upload process creates one default fallback.)
    We can add e.g. permissions later, subdir structure, etc. (So dir will
    not necessarily be category anymore.)

Test plan:
[1] Run the db revision.
[2] Upload new file. Check the record in the table. Delete it again; check.
[3] Run t/db../UploadedFiles.t.
[4] Run t/db../FrameworkPlugins.t -incl cataloguing/value_builder/upload.pl

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:23:36 -03:00
d7cdb6e15e Bug 6874: [QA Follow-up] Adjustments for opac-retrieve
Adds httpheaders sub to UploadedFiles; this will be extended on a new
report. (Idea is to add configurable headers for file extensions.)
Trivial unit test added.
Small cosmetic changes to opac-retrieve-file.

Test plan:
Run test UploadedFiles.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:23:36 -03:00
Mark Tompsett
b113318bb2 Bug 6874: Catch warnings for clean tests.
I hate noisy tests, so I cleaned them up.

MEGA TEST PLAN
--------------
git checkout -b bug_6874 origin/master
git bz apply 6874
-- yes, it should all apply smoothly.
I intentionally restored an old backup from a couple months ago to force the upgrade.
staff client:
-- upgrade
-- login
Koha administration
MARC Bibliographic framework
MARC structure (for BKS)
Search for 856
Subfields
Edit (for u)
Other options
Plugin: upload.pl
Save changes
Search the catalog tab
{choose a word, any word. I used fancy, because I knew we had a cookbook}
click first link
Edit
Edit record
8 (that's the tab name)
click the name for 856
scroll down to u and click the plugin icon
-- Correctly got a configuration error message.

At a command prompt:
vi ~/koha-dev/etc/koha-conf.xml
/enable_plug
-- add in:
<upload_path>{appropriate path. I used /home/mtompset/uploads}</upload_path>
:wq
mkdir {appropriate path used}
-- I even added some subdirectories
sudo chown -R -v www-data.www-data {appropriate path used}

Back in staff client:
click the plugin icon again
-- this time an upload screen pops up
click the 'Upload file' button
-- message about no file or destination
browse for a file, select one
click the 'Upload file' button
-- message about no destination
click the 'Cancel' button
click the plugin icon
click a destination radio button
click the 'Upload file' button
-- message about no file
browse for a file, select one
click the 'Upload file' button
-- message about success
click the 'close' button.
-- the text box has been filled in with a nice URL
click the plugin icon
click cancel
click the plugin icon
click delete
-- the test box should be blanked, and a success message given
click Close
-- reupload a file properly
click the plugin icon
click delete
click upload file
browse for a file, select a destination, click upload file
click close on success message
click 'Clone this subfield'
click the second plugin icon
click delete
click close
click the first plugin icon
-- Nice error message about a URL which points to nothing.
click cancel
In the second 856$u type in a URL (eg. www.google.com)
click the second plugin icon
-- this jumps immediately to the upload screen, but does not give an error message, because the URL does not have opac-retrieve-file in it.
click save (we need to save the bibliographic record)

In OPAC:
search for the same word (I used fancy)
find the entry you just updated with links
click the two links. The dangling entry should give you a 500 error, and the other link should work just fine.
get back to the detail page

In staff client:
edit
edit record
8
change the 856$u to a valid file in the first link.
save

In OPAC:
refresh the detail page, and click the first link again
this time it should get downloaded nicely.

From a command line:
prove -v t/db_dependent/UploadedFiles.t
perldoc C4::Biblio
perldoc C4::UploadedFiles

One more round of tests tomorrow, and this should be ready. :)

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

Tested on top of 5010

Followed mostly mega test plan, seems to work :)
Can upload, delete, modify, etc
Test runs Ok
No koha-qa errors

I view this as valuable addition, dangling since 2011!
As with 5010, I consider this can be pushed (for 3.22)
and we can fix anything wrong later.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:23:36 -03:00
Mark Tompsett
64079ccaa3 Bug 6874: kohastructure.sql, jquery.js, refocus, and more
Two problems were discovered while doing a fresh install
of Koha. These problems in the kohastructure.sql file are
addressed with this patch.

Clicking the plug-in icon should cause the popup window
to refocus.  This adds the refocus code to the upload.pl file.

The path to the jquery.js script was wrong in the
upload_delete_file.tt file. Changed [% themelang %] to
[% interface %].

If a user clones 856$u after uploading a file, deletes the file,
and then clicks the plugin icon on the first 856$u, this will go
immediately to the upload screen with an informative error
message.

After some validation was added, it was extended to include
other cases. This serves to patch 6874 to a state where sign
off should be possible.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:45 -03:00
094092b111 Bug 6874: (QA followup) Attach files to bibliographic records
* Renames uploadPath to upload_path to follow the standard naming
  conventions in koha-conf which use underscores rather than camel case
* Remove reference to intranet-tmpl and replace with [% interface %]
  required to pass qa

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:13 -03:00
Julian Maurice
9f0546f003 Bug 6874: Move uploadPath syspref to koha-conf.xml
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:06 -03:00