Commit graph

4010 commits

Author SHA1 Message Date
6b9b7d8e77 Bug 27196: Don't explode if item that is waiting if checked in by SIP
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-26 17:58:40 +01:00
c596f450d9 Bug 24398: Fix 500 when viewing a single news item at the OPAC
Test plan:
0. Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
1. Open the OPAC main page and click on an individual news item
Without this patch you get an ugly 500
    Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
With this patch applied you see the news with the author's info

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-26 17:58:38 +01:00
69c01ee0f2 Bug 27117: Only place_holds permission is needed to adjust pickup locations
The GET /pickup_locations route is requesting the whole reserveforothers
permission whereas only the subpermission place_holds is needed.

Test plan:
0. Don't apply this patch
1. Set the subpermission place_holds but modify_holds_priority
2. Edit a hold and click the pickup library dropdown list
3. You get a JS alert and log displays
  GET /api/v1/app.pl/api/v1/holds/5/pickup_locations
  403 Forbidden
4. Apply this patch
5. Reload the page, click the dropdown list, modify the pickup location
and save
=> Success!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-21 10:07:49 +01:00
1ea55acd0c Bug 26921: Don't generate an invalid custom cover image if the url cannot be generated
In case a custom cover image url is used to generate the cover image of
bibliographic records, we should not build one if the record does not
have the necessary data.

For instance if you have
CustomCoverImagesURL set to https://covers.openlibrary.org/b/isbn/{isbn}-M.jpb
and a biblio does not have the isbn defined, we should not generate and
empty image (empty or invalid src)

Test plan:
0.
Set CustomCoverImagesURL to https://covers.openlibrary.org/b/isbn/{isbn}-M.jpb
Enable CustomCoverImages and OPACCustomCoverImages
To highlight the issue you should disable LocalCoverImages and OPACLocalCoverImages.
1. Make sure you have some of your bibliographic records with a valid
isbn
2. Make sure you have at least 1 bibliographic record without an isbn
set
3. Visit the search result and detail views (OPAC and staff interfaces)
=> Without this patch you should see a "Cover image" link, and an empty
block/div on the detail page
=> With this patch applied you should only see images when the url can
be generated

Note that the problem will persist if the isbn is not valid (ie. no
image is generated)

Sponsored-by: Orex Digital
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-21 10:07:48 +01:00
c913bd7d69 Bug 27205: Check valid pickup location on POST /holds
This patch adds a check for valid pickup location to the POST /holds
route. A 400 code is returned if the supplied pickup library is not
valid.

To test:
1. Apply this patch
2. Run;
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-21 10:07:45 +01:00
1bfe7ea16e Bug 27205: Check valid pickup location on PUT /holds/:hold_id
This patch adds a test for valid pickup locations when updating a hold
through the API.

Tests are adjusted to reflect this change.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-21 10:07:45 +01:00
865a1dab5c Bug 27209: (follow-up) Add ->is_pickup_location_valid
This patch simply refactors the pickup location check into a method that
can be called on its own. Tests are added, and the tests for
->set_pickup_location should pass unmodified.

To test:
1. Apply the first two patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: tests pass
3. Apply this refactoring patch
4. Notice the tests are similar, but check for boolean output
5. Repeat 2
=> SUCCESS: New tests pass, set_pickup_location() behavior unchanged.
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-21 10:07:45 +01:00
295787223e Bug 27209: Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-21 10:07:44 +01:00
de4d6983ab Bug 26634: Remove GetHoldRule subroutine in C4::Reserves
This routine is only used internally and incorrectly overrides
the precedence of holds rules - it should be removed

This patch removes the routine, adjusts tests, and adds test to
confirm correct precedence is followed

To test:
1 - At the All Libraries level, create a circ rule for a specific patron category and a specific item type that only allows 1 hold
2 - At the branch-specific level for Branch A, create an All/All rule that allows 2 holds
3 - confirm ReservesControll is set to patron's library
4 - find a patron from Branch A of the category for which you made your rule
5 - find two bibs with items of the itype got which you made your rule
6 - place a hold on one bib. success!
7 - try to place a hold on the second bib. you're told you cannot because the patron is only allowed 1 hold
8 - apply patch, restart services
9 - try to place your second hold again, success!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-21 10:07:38 +01:00
3126ae3443 Bug 27166: Unit tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-14 14:17:35 +01:00
a37ba7903d Bug 12430: Fix Search.t failure
t/db_dependent/Search.t ..
    #   Failed test 'buildQuery should keep 0 value'
    #   at t/db_dependent/Search.t line 669.
    #          got: 'su,phr=(rk=(0)) '
    #     expected: 'su,phr=0(rk=(0)) '

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-09 10:52:17 +01:00
48e74cebed Bug 12430: Fix selenium/regressions.t failure
Test failed with
    # Looks like you planned 4 tests but ran 3.
t/db_dependent/selenium/regressions.t .. 2/5
 #   Failed test 'OPAC - Remove from cart'
 #   at t/db_dependent/selenium/regressions.t line 109.
Error while executing command: clickElement: An unknown server-side error occurred while processing the command.: Element is not clickable at point (583.7000122070312, 14). Other element would receive the click: <a class="page-link" href="/cgi-bin/koha/opac-search.pl?idx=kw&amp;q=d&amp;offset=420&amp;sort_by=relevance_dsc&amp;count=20" aria-label="Go to the last page"></a>

https://pic.infini.fr//Qhq7pLBq/jT9wZ7F1
The remove from basket link for the biblio 3 is hidden by the floating
toolbar.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-04 17:05:34 +01:00
fc1158389f Bug 16067: Remove FastMmap
It is known to be broken, we should remove its implementation

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-04 15:40:58 +01:00
b3b3781ea3 Bug 27003: Item creation log must be done after the item is created
Otherwise we don't have its itemnumber yet!

Test plan:
Add and modify an item and confirm that the action logs are created
correctly

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-04 15:26:52 +01:00
442802d776 Bug 27079: Unit tests
Add a unit test to check for floating point errors in UpdateFine
relating to catching matching CalcFine amounts compared to DB amount
values.

Test plan
1/ Run the unit test and confirm it fails
2/ Apply the second patch in the series
3/ Run the unit test and confirm it passes

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-27 09:37:10 +01:00
a8b89fe66a Bug 26518: (QA follow-up) Expect warnings, don't supress them
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-25 15:18:17 +01:00
1519050205 Bug 26518: Hide expected DBI warnings
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-25 15:18:17 +01:00
a1e9453f1d Bug 26518: Use Koha::Biblio[item] in AddBiblio
Bug 26518: Does not return from the catch block

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-25 15:18:17 +01:00
9d8523ed2b Bug 26922: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 15:44:20 +01:00
926ad3c1a6 Bug 25514: Try to fix random failure from REST/Plugin/Objects.t
It's causing a "Premature connection close" error

https://docs.mojolicious.org/Mojolicious/Guides/FAQ#What-does-Premature-connection-close-mean

This is just a guess but maybe it would help to have the Test::Mojo
object initiated just before the get?

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 10:37:13 +01:00
05085ddc61 Bug 27062: Fix pickup_location tests when existing libraries exist
If there are existing libraries in the DB, the tests will fail.

There were several changes related to those tests recently, this bug report is a follow-up for them.

bug 26984, bug 27002 and bug 26963.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 10:34:54 +01:00
3376a94400 Bug 27007: Don't call GetMarcSubfieldStructure with unsafe in tests
It does not feel correct to call GetMarcSubfieldStructure with the unsafe flag set in tests:
   my $mss = C4::Biblio::GetMarcSubfieldStructure( '', { unsafe => 1 } );

Some tests are failing is run twice

Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314.
[x~10]
Use of uninitialized value $code_wanted in string eq at /usr/share/perl5/MARC/Field.pm line 314.

    #   Failed test 'Value is mapped correctly for column biblionumber'
    #   at t/db_dependent/Koha/Item.t line 115.
    #          got: undef
    #     expected: '483'
[etc.]

Test plan:
Run the tests twice, without the patch it fails, with the patch it
passes

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 10:34:54 +01:00
59e4b03d73 Bug 26984: (follow-up) Don't delete patrons and checkouts in Objects.t
Rather than counting all and assuriing we get 10, we can count all, add 10, and ensure the numbers still match

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 08:16:02 +01:00
a25b651cf2 Bug 26984: Make tests pass if AnonymousPatron is set
There is only 1 place where it can be tricky to not remove them as we
want exactly 10 patrons to be present in the DB

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 08:16:02 +01:00
ba04deb9c3 Bug 26031: Remove the failing tests and the diag
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 08:16:02 +01:00
b4ffaeaec1 Bug 26031: Remove 4 failing tests from t/db_dependent/www/search_utf8.t
to test...
1/ apply patch
2/ run test
3/ observe PASS

root@kohadevbox:/kohadevbox/koha# export KOHA_INTRANET_URL="http://kohadev-intra.myDNSname.org:8081"
root@kohadevbox:/kohadevbox/koha# export KOHA_OPAC_URL="http://kohadev.myDNSname.org:8080"
root@kohadevbox:/kohadevbox/koha# prove -v  ./t/db_dependent/www/search_utf8.t
1..87
ok 1 - connect to intranet
ok 2 - login to staff interface
ok 3 - load main page
ok 4 - open tools module
ok 5 - go to stage MARC
ok 6 - uploaded file
ok 7 - upload succeeded
ok 8 - reopen stage MARC page
ok 9 - stage MARC
ok 10 - have job ID
ok 11 - job was completed
ok 12 - reopen stage MARC page at end of upload
ok 13 - stage MARC
ok 14 - view batch
ok 15 - imported records into catalog
ok 16 - got search on intranet
ok 17 - got search on intranet
ok 18 - Base is like "(?^u:search.pl\?advsearch=1&idx=kw&q=%CE%91%CE%B8%CE%AE%CE%BD%CE%B1)"
ok 19 - UTF-8 are multi-byte. Good
ok 20 - UTF-8 chars are correctly present. Good
ok 21 - got opac
ok 22 - got opac
ok 23 - Base is like "(?^u:opac-search.pl\?(idx=&)?q=%CE%91%CE%B8%CE%AE%CE%BD%CE%B1)"
ok 24 - Base does not contain an idx
ok 25 - UTF-8 are multi-byte. Good
ok 26 - UTF-8 chars are correctly present. Good
ok 27 - view and clean batch
ok 28 - biblio on intranet
ok 29 - biblio deleted
ok 30 - connect to intranet
ok 31 - login to staff interface
ok 32 - load main page
ok 33 - open tools module
ok 34 - go to stage MARC
ok 35 - uploaded file
ok 36 - upload succeeded
ok 37 - reopen stage MARC page
ok 38 - stage MARC
ok 39 - have job ID
ok 40 - job was completed
ok 41 - reopen stage MARC page at end of upload
ok 42 - stage MARC
ok 43 - view batch
ok 44 - imported records into catalog
ok 45 - got search on intranet
ok 46 - got search on intranet
ok 47 - Base is like "(?^u:search.pl\?advsearch=1&idx=kw&q=Ram%C3%B2n)"
ok 48 - UTF-8 are multi-byte. Good
ok 49 - UTF-8 chars are correctly present. Good
ok 50 - got opac
ok 51 - got opac
ok 52 - Base is like "(?^u:opac-search.pl\?(idx=&)?q=Ram%C3%B2n)"
ok 53 - Base does not contain an idx
ok 54 - UTF-8 are multi-byte. Good
ok 55 - UTF-8 chars are correctly present. Good
ok 56 - view and clean batch
ok 57 - biblio on intranet
ok 58 - biblio deleted
ok 59 - connect to intranet
ok 60 - login to staff interface
ok 61 - load main page
ok 62 - open tools module
ok 63 - go to stage MARC
ok 64 - uploaded file
ok 65 - upload succeeded
ok 66 - reopen stage MARC page
ok 67 - stage MARC
ok 68 - have job ID
ok 69 - job was completed
ok 70 - reopen stage MARC page at end of upload
ok 71 - stage MARC
ok 72 - view batch
ok 73 - imported records into catalog
ok 74 - got search on intranet
ok 75 - got search on intranet
ok 76 - Base is like "(?^u:search.pl\?advsearch=1&idx=kw&q=%F0%A0%BB%BAtomasito%F0%A0%BB%BA)"
ok 77 - UTF-8 are multi-byte. Good
ok 78 - UTF-8 chars are correctly present. Good
ok 79 - got opac
ok 80 - got opac
ok 81 - Base is like "(?^u:opac-search.pl\?(idx=&)?q=%F0%A0%BB%BAtomasito%F0%A0%BB%BA)"
ok 82 - Base does not contain an idx
ok 83 - UTF-8 are multi-byte. Good
ok 84 - UTF-8 chars are correctly present. Good
ok 85 - view and clean batch
ok 86 - biblio on intranet
ok 87 - biblio deleted
ok
All tests successful.
Files=1, Tests=87, 127 wallclock secs ( 0.06 usr  0.02 sys +  3.00 cusr  0.99 csys =  4.07 CPU)
Result: PASS

real    2m6.709s
user    0m3.124s
sys     0m1.032s

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 08:16:02 +01:00
d4a15b27b8 Bug 25313: (QA follow-up) DelAuthority tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-18 12:03:03 +01:00
7abee7fd69 Bug 25313: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-18 12:03:03 +01:00
8a955f9a0a Bug 26903: Unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-17 11:51:25 +01:00
6bbd13ba03 Bug 26988: (QA follow-up) Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-17 10:37:35 +01:00
9935c0bdbf Bug 27002: Update callers for changed return
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-16 14:25:21 +01:00
e1400890ec Bug 26516: Don't accept incorrect values for copyrightdate/publicationyear
The previous patch rejects incorrect values when saving to the db specifically for copyrightdate
An error is thrown for the int conversion when it fails

Rather than catching things when saving we can fix the value when generated, simply returning null when parsing
the record

To test:
1 - Add a new record to Koha making sure data is valid except 260$c:
    198-
2 - Save the record
3 - It fails
4 - Apply this patch
5 - Restart all the thigns
6 - Repeat
7 - Success!

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-16 14:25:21 +01:00
a386954b8b Bug 27021: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-16 13:46:51 +01:00
Joonas Kylmälä
a408fcc0b6 Bug 27012: Add test for C4::Reserves::MergeHolds
This does a basic check whether a hold gets moved to another biblio
when MergeHolds() is called.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-16 13:45:07 +01:00
75456ba973 Bug 26988: Make ->patron prefetchable
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:11 +01:00
b6deb941dc Bug 26963: Ignore existing libraries
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:11 +01:00
e61bcc270e Bug 26963: (QA follow-up) Fix up tests and cover case of undefined ccode
While this technically shouldn't happen, if a library creates itemtype limits, then flips the pref, those rules are still in the db until a ccode rule is saved.

To be extra safe, when checking for rules of one type, we should make sure the other type is undef - i.e. if looking for ccode rules, we should confirm the itype is undef for those rules

Additionally, we shouldn't set the barcode now that we are not deleting all items, so we use copynumber for our item identification field as it doesn't need to be unique in the DB

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:11 +01:00
04a4a34d6e Bug 26963: (QA follow-up) Update mocked return of pickup_locations
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:11 +01:00
7b09e86a8d Bug 26963: (QA follow-up) Don't delete existing data before tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:11 +01:00
b6a7a3c8a8 Bug 26963: (QA follow-up) Migrate unit tests into pickup_location
We wrote unit tests for _can_pickup_locations as part of this patchset,
but then I inlined the method whilst golfing. This patch moves those
tests into the existing pickup_locations test so we more thoroughly
cover the case where branch transfer limits are in play.

NOTE: The tests all assume that all items have an effective_itemtype and
ccode. I'm pretty sure items all have a type at this point, but I'm less
sure we enforce collection codes?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:11 +01:00
7179a29fea Bug 26963: (QA follow-up) Convert to ResultSets
This patch removes the previously introduced private method by
converting the arrayref returns to ResultSets appropriately and inlining
the filter search queries.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:11 +01:00
5b06c361d6 Bug 26963: (follow-up) Change subroutine name for QA tools
It didn't like the ending _at

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:10 +01:00
db1865ba34 Bug 26963: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-13 14:20:10 +01:00
64ee6f0b2b Bug 26948: Regression tests
We already mock the send_or_die method from Email::Stuffer; This patch
updates that mock to extract the internal representation of the email
encoded message and looks for a known double encoded representation of a
character in the sample body.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-12 17:09:52 +01:00
Andrew Isherwood
552ea4e9d2 Bug 24083: (QA follow-up) Fix failing tests
This commit fixes the failing tests mentioned by Jonathan in comment

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-12 16:51:57 +01:00
cdbc04f69d Bug 22818: Fix TestBuilder.t
t/db_dependent/TestBuilder.t .. 12/13
 #   Failed test 'build_object() tests'
 #   at t/db_dependent/TestBuilder.t line 429.
Can't locate object method "_new_from_dbic" via package "Koha::MessageAttribute" (perhaps you forgot to load "Koha::MessageAttribute"?) at /kohadevbox/koha/Koha/Objects.pm line 98.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-11 18:03:17 +01:00
Andrew Isherwood
6e311a1be1 Bug 24083: (follow-up) Squashed follow ups
This squashed commit fixes:
-  a small error in the checkouts related JS

- GetRenewCount now returns 6 values when a call to it succeeds, a
failed call should also return the same number of values. This commit
adds these additional values.

- Some changes in issue.t had broken the tests for unseen renewals (the
unseen tests were using variables that had been moved out of the tests'
scope).

- Also now using Koha::CirculationRules::set_rules to set circ rules
rather than using SQL queries.

- Fixed expected number of return values from GetRenewCount

- Moved unseen tests in issue.t to the bottom of the file to remove the
risk of interference with other test circ rules.

- There was a real mess in C4/Circulation.pm due to a bad rebase back in
February. Frankly it's a wonder anything worked at all. This commit
fixes that problem and reinstates the correct patch for
C4/Circulation.pm

- Somehow I'd never noticed this before but the columns in smart-rules.tt
were misaligned when UnseenRenewals was turned off. This was due to the
display of a <td> not being conditional when it should have been. This
is now fixed.

- This commit also fixes items 1 & 2 descibed by Katrin in comment #74 ->
comment #76.

- Fixed missing check for too_unseen in opac-user.tt, this test did used
to exist but got lost during sizeable rebase a few weeks ago :-(
- Added test for too_unseen to all AUTO_RENEWAL notice templates apart
from de-DE (as previously requested by Katrin)

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-11 16:09:58 +01:00
Andrew Isherwood
bbfdc72303 Bug 24083: (follow-up) Respond to QA feedback
This patch implements changes requested by Katrin in QA feedback
(comment #38):

- Fix QA script failures
- Fix alter table column order mismatch
- Use new convention for JS strings
- Fix terminology

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-11 16:09:58 +01:00
Andrew Isherwood
b2110746d4 Bug 24083: Add unit tests
This patch adds unit tests for unseen renewals

Signed-off-by: Sally Healey <sally.Healey@cheshirewestandchester.gov.uk>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-11 16:09:58 +01:00
Agustin Moyano
6853a2d7f6 Bug 23019: (follow-up) Fix test permissions and API definition bugs
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-11 15:55:49 +01:00