koha.git
7 years agoBug 7143: Add Patricio Marrone to history.txt
Tomas Cohen Arazi [Tue, 14 Mar 2017 14:25:24 +0000 (11:25 -0300)]
Bug 7143: Add Patricio Marrone to history.txt

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18307 - Branchname is no longer displayed in subscription tab view
Marc Véron [Tue, 21 Mar 2017 13:52:51 +0000 (14:52 +0100)]
Bug 18307 - Branchname is no longer displayed in subscription tab view

This patch restores the branchname in OPAC subscription detail view.
Additionally, it adds the subscriptons count to the tab title to make
it consistent with the other tab titles.

To test:
- Search a subscription in OPAC catalog
- Go to Subscriptions tab (see screenshot in initial comment)
- Verify that library name does not display
- Apply patch
- Verify that library name displays properly in Subscriptons tab
- Verify that the tab title displays the subscriptions count
  e.g.: Subscriptions (2)

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18209: Add default, 'Actions' and fix case
Jonathan Druart [Thu, 9 Mar 2017 14:25:28 +0000 (11:25 -0300)]
Bug 18209: Add default, 'Actions' and fix case

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18209 - Patron's card manage.pl page is not fully translatable
Blou [Fri, 3 Mar 2017 21:13:40 +0000 (16:13 -0500)]
Bug 18209 - Patron's card manage.pl page is not fully translatable

The headers of the tables displayed in patroncards/manage.tt are hardcoded in the .pl and thus cannot be translated.

This simple fix reuse the translate_card_element tool already in the code to make the strings translatable.

Applied patch and verified that table headers on manage.pl display the same as before.
Signed-off-by: Marc Véron <veron@veron.ch>
Re-tested, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18219: Remove extra whitespace from returns.tt
Christopher Brannon [Tue, 7 Mar 2017 22:18:49 +0000 (22:18 +0000)]
Bug 18219: Remove extra whitespace from returns.tt

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18219: Remove duplicated code in returns.tt
Christopher Brannon [Tue, 7 Mar 2017 20:01:05 +0000 (20:01 +0000)]
Bug 18219: Remove duplicated code in returns.tt

Removed lines of code that were duplicated in bug 16530.
Fixes alignment of a few lines of code surrounding duplication.

Modifies returns.tt

To test:
1) Check in items that are not checked out.
2) Note duplicated problem message (i.e. "Not checked out.")
3) Apply patch.
4) Repeat step 1.
5) Note the problem message is no longer duplicated.

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17346: Make checkin column hidable
Christopher Brannon [Fri, 10 Mar 2017 19:54:05 +0000 (19:54 +0000)]
Bug 17346: Make checkin column hidable

To test:
1) Go to columns_settings.pl --> Circulation --> issues-table and note that you cannot change the settings for checkin.
2) Go to columns_settings.pl --> Patrons --> issues-table and note that you cannot change the settings for checkin.
3) Apply the patch.
4) Go to both tables again and note that you can now change the settings.

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17866 - DBRev 16.12.00.022
Kyle M Hall [Fri, 31 Mar 2017 13:22:37 +0000 (13:22 +0000)]
Bug 17866 - DBRev 16.12.00.022

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17866: [QA Follow-up] Reword message for missing email address
Marcel de Rooy [Thu, 23 Mar 2017 09:01:53 +0000 (10:01 +0100)]
Bug 17866: [QA Follow-up] Reword message for missing email address

See BZ, comment 14 from Jonathan.

In the exceptional case that branch email address and fallback, i.e.
preference KohaAdminEmailAddress, are both empty or not valid, the error
message should reflect that (of course :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Removed branch email and KohaAdminEmailAddress.
Followed the test plan of the first patch and saw the alert.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17866: [QA Follow-up] Add notification for changed sender address
Marcel de Rooy [Wed, 22 Mar 2017 15:50:33 +0000 (16:50 +0100)]
Bug 17866: [QA Follow-up] Add notification for changed sender address

See BZ, comment 6, requested by QA.

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: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17866: Change sender for serial claim notifications
Marcel de Rooy [Mon, 9 Jan 2017 14:10:56 +0000 (15:10 +0100)]
Bug 17866: Change sender for serial claim notifications

Currently, the From field uses the emailaddress of the staff client member
from the user context. This is exceptional in Koha. And might very well be,
as in our case, the cause of fraud detection warnings.
We should use branch email address or fallback to KohaAdminEmailAddress,
as we do (almost) everywhere else.

Test plan:
Go to subscription detail in Koha.
Go to Claims.
Select a missing issue and click Send notification.
Verify the sender address in the generated notification. (Make sure that
you receive this mail.)

Signed-off-by: Grace McKenzie <grace.mcky@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18019: [QA Follow-up] Also catch the delete from authorities detail
Marcel de Rooy [Thu, 30 Mar 2017 08:20:30 +0000 (10:20 +0200)]
Bug 18019: [QA Follow-up] Also catch the delete from authorities detail

Good catch from Jonathan. See comment11.
Authorities detail should pass a CSRF token to authorities-home when
deleting a record without linked biblios.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Passing the token with GET is not a good way to do, but nothing quick to
replace that.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18019: Add CSRF protection to authorities-home.pl (op==delete)
Marcel de Rooy [Tue, 7 Feb 2017 08:09:33 +0000 (09:09 +0100)]
Bug 18019: Add CSRF protection to authorities-home.pl (op==delete)

Without this patch, it is possible to delete authority records with URL
manipulation.
Like: /cgi-bin/koha/authorities/authorities-home.pl?op=delete&authid=[XXX]

Test plan:
[1] Go to Authorities. Search for some authorities (without links).
[2] Delete an authority. Should work.
[3] Apply patch.
[4] Construct an URL like above to delete another authority. Should fail.
    Under Plack this results in an internal server error, the log tells
    you: Wrong CSRF token.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Amended the test plan.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 12972 - Transfer slip and transfer message (blue box) can conflict
Nick Clemens [Fri, 3 Mar 2017 14:56:31 +0000 (14:56 +0000)]
Bug 12972 - Transfer slip and transfer message (blue box) can conflict

Instead of passing the homebranch to the slip, let's pass
TransferWaitingAt (the value we display)

To test:
1 - Check in an item that will initiate a transfer (hold or automatic
        item return)
2 - Note the transfer message and receipt match
3 - Remove the reason for transfer (bot don't cancel transfer)
    i.e. cancel hold or change homebranch of item to current library
4 - Check the item in again
5 - Note the message displays the transfer destination and the slip
shows the homebranch
6 - Apply patch
7 - Repeat 5 but note slip and message match
8 - Test any edge cases for correctness
9 - sign off

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 7728: [QA Follow-up] Fix POD whitespace
Marcel de Rooy [Fri, 17 Mar 2017 12:24:41 +0000 (13:24 +0100)]
Bug 7728: [QA Follow-up] Fix POD whitespace

Resolves complaints from qa tools.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 7728: QA fixes
Julian Maurice [Wed, 11 Jan 2017 13:51:43 +0000 (14:51 +0100)]
Bug 7728: QA fixes

- Remove useless comments
- Use Koha::Objects::find instead of Koha::Objects::search

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 7728: Adding unit test ReNewSubscription.t
Paul Poulain [Tue, 26 Jan 2016 14:03:21 +0000 (14:03 +0000)]
Bug 7728: Adding unit test ReNewSubscription.t

Test plan:
 * run without the patch, the test will fail
 * run with the patch, the test will pass

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 7728: Fix subs history end date consistency
Paul Poulain [Wed, 9 Dec 2015 10:25:43 +0000 (10:25 +0000)]
Bug 7728: Fix subs history end date consistency

Without this patch, there is an inconsistency in subscriptions:
 * a new subscription has no history end date set (as expected)
 * if you renew it, a date is set.

This patch removes the setting of the history end date during renewal

Test plan:
 * create a subscription, go to subscription-detail.pl page, tab "Summary". No History end date is set
 * renew the subscription => a date has been set
 * apply the patch
 * create another subscription
 * renew it => no history end date has been set
 * sign-off

Signed-off-by: beroud <isabelle.beroud@univ-lyon3.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18244: Patron card creator does not take in account fields with underscore (B_add...
Marc Véron [Fri, 10 Mar 2017 10:22:24 +0000 (11:22 +0100)]
Bug 18244: Patron card creator does not take in account fields with underscore (B_address etc.)

Fields with underscore like B_address do not print on patron cards.

To reproduce:
- Create patron card layout using fields with underscore in their name
  (e.g. <surname><B_address> )
- Print (export) patron card
- Verify that fields without underscore are replaced by their value,
  but fields with underscore do not replace but show the field name

To test:
- Apply patch
- Try to reproduce and verify that fields with underscore are replace
  as expected

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14535: Update the supplier filter too
Marcel de Rooy [Mon, 6 Feb 2017 09:29:44 +0000 (10:29 +0100)]
Bug 14535: Update the supplier filter too

The combobox on the left side of late orders is filled by sub
GetBooksellersWithLateOrders. The same change as in the first patch
must be made here to include suppliers with late orders without a
price.

Bonus: Sort the list.

Test plan:
[1] Run t/db_dependent/Bookseller.t.
[2] Go to late orders. Use the filter on suppliers.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14535: Late orders does not show orders with price = 0
Marcel de Rooy [Mon, 6 Feb 2017 09:04:57 +0000 (10:04 +0100)]
Bug 14535: Late orders does not show orders with price = 0

This patch removes the filter of unitpricesupplier <> 0 and
unitpricelib <> 0 from GetLateOrders as used in lateorders.pl.
This allows you to claim late orders without a price entered.

Test plan:
[1] Run t/db_dependent/Acquisition.t
[2] Check if you see an order with no price in lateorders.pl. (If needed,
    remove prices from a few orders.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17708 - DBRev 16.12.00.021
Kyle M Hall [Fri, 31 Mar 2017 12:38:21 +0000 (12:38 +0000)]
Bug 17708 - DBRev 16.12.00.021

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17708: Rename 'RENEW' with 'RENEWAL'
Jonathan Druart [Tue, 21 Mar 2017 19:03:11 +0000 (16:03 -0300)]
Bug 17708: Rename 'RENEW' with 'RENEWAL'

Sounds more appropriate and consistent with existing action logs.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17708: Fix use statements
Jonathan Druart [Tue, 21 Mar 2017 18:53:26 +0000 (15:53 -0300)]
Bug 17708: Fix use statements

For an unknown reason, the use_ok('Circulation') does not work as
intended (see 3660c451a36d).
With the new use of C4::Log, the trick does no longer work.
It does not make sense to add the use_ok('C4::Log') in Circulation.t,
removing it.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17708: Add the IGNORE clause
Jonathan Druart [Tue, 21 Mar 2017 19:00:19 +0000 (16:00 -0300)]
Bug 17708: Add the IGNORE clause

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17708: Added a logaction function in Addrenewal in order to send renew logs
Baptiste Wojtkowski [Wed, 8 Feb 2017 08:54:42 +0000 (08:54 +0000)]
Bug 17708: Added a logaction function in Addrenewal in order to send renew logs

20/02/17 : added the syspref RenewalLog
24/20/17 : added a test for the syspref Renewal Log

test plan
1 - Chose a Borrower and have him renewing an item
2 - Check the renew logs : they should be empty
3 - Apply patch and set the syspref RenewalLog to 1
4 - Have the Borrower renewing a new item
5 - Check the renew logs : there should be your renew

I called the function logaction, which is in charge of modifying the
logs, within the function which adds a new renewal at the list.

Signed-off-by: Julien Comte <julien.comte@u-psud.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 8548: Add datatable to circ overdue report, remove sortby filter
Aleisha Amohia [Tue, 14 Feb 2017 01:36:44 +0000 (01:36 +0000)]
Bug 8548: Add datatable to circ overdue report, remove sortby filter

This patch adds a datatable to the circ overdue report. Since the
datatable makes sorting easy, I've also removed the sort by filter on
the side.

To test:
1) Go to Circulation -> Overdues
2) Notice overdues report shows as datatable
3) Confirm sorting on all columns works
4) Test the Filters and confirm they all still work as expected

Sponsored-by: Catalyst IT
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17758 - SIP checkin does not handle holds correctly
Benjamin Rokseth [Tue, 13 Dec 2016 12:38:19 +0000 (13:38 +0100)]
Bug 17758 - SIP checkin does not handle holds correctly

This patch updates SIP checkin to use reserve_id as param, to fix regression
introduced by Bug 14695.

To test:

Given 1 patron and 1 biblio with two items attached:

1) create two record level holds on one biblio on same user
Using SIP client or telnet:
2) checkin item x on pickup branch, observe item is waiting and hold 1 is filled
3) checkin item y on pickup branch, observe item y now is waiting and x is available
4) apply this patch and repeat 1-3, now expected behaviour should be
   that both holds are filled and both items waiting

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18329 - Batch record deletion broken
Fridolin Somers [Fri, 24 Mar 2017 15:07:16 +0000 (16:07 +0100)]
Bug 18329 - Batch record deletion broken

Hie, Tools > Batch record deletion seems broken.
Any deletion returns error :
Bibliographic record YYY was not deleted. An error occurred. (The error was: {UNKNOWN}: DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1560. at /home/koha/src/C4/Biblio.pm line 3468 , see the Koha log file for more information).

Looks like it is because of Bug 18242 which added a transaction  in C4::Biblio::_koha_delete_biblio_metadata : $schema->txn_do.
The script batch_delete_records created a transaction with $dbh->{AutoCommit} = 0;

This patch fixes by using also Koha::Schema in batch_delete_records to manage transaction.
It also removes "$dbh->{RaiseError} = 1", this behavior is managed in Koha::Database.

Test plan :
 - Go to Staff interface : Tools > Batch record deletion
 - Enter a few existing biblionumbers
 - Click on "Continue"
 - Click on "Delete selected records"
=> Without patch you get a DB error
=> With patch you get confirmation message
 - Try to get the biblios to confirm they are deleted : /cgi-bin/koha/catalogue/detail.pl?biblionumber=xxx
 - Test with and without Plack

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 12913: [QA Follow-up] Reword 'change item status' and add zero status
Marcel de Rooy [Tue, 28 Mar 2017 14:39:25 +0000 (16:39 +0200)]
Bug 12913: [QA Follow-up] Reword 'change item status' and add zero status

The zero status should be added in @notforloans. It is a legitimate status
for available books. The zero status description can be translated in
the template.
The 'Change item status' is confusing. We mean that we saw a notforloan
status that we do not expect (read: does not exist in the table).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 12913 - wrong inventory results when notforloan filter is not used
Fridolin Somers [Fri, 12 Sep 2014 13:21:18 +0000 (15:21 +0200)]
Bug 12913 - wrong inventory results when notforloan filter is not used

In inventory tool, there is a test on scanned items notforloan value : if the value is not one of authorized values, the inventory results displays the problem "Change item status".
The bug is that if notforloan filter is not used, the notforloan values array is not filled and so all scanned items are marked with this problem.

Test plan :
- Check you have in default framework an item subfield mapped with items.notforloan and with an authorized value catergory, for example 'NOTFORLOAN'
- Check the authorized value category has at least value '0'
- Create a new value in this category, for example '9'
- Create a biblio with default framework
- Create an item with barcode='000AAA1', callnumber='ZZZAAA1' and notforloan=0
- Create an item with barcode='000AAA2', callnumber='ZZZAAA2' and notforloan=9
- Delete new value created above, for example '9'
- Create a file 'barecodes.txt' containing 2 lines '000AAA1' and '000AAA2'
- Go to inventory tool : /cgi-bin/koha/tools/inventory.pl
- Choose file in 'Barcode file'
- Enter item callnumber between 'ZZZ' and 'ZZZZ'
- Check 'Compare barcodes list to results'
- Submit
=> without patch, you get 2 results with problem 'Change item status' even for item with notforloan=0
=> with patch, you get 1 result with 'Change item status' on item with notforloan=9

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 6979 - Fix Already in a transaction error
Alex Arnaud [Tue, 15 Nov 2016 10:30:16 +0000 (10:30 +0000)]
Bug 6979 - Fix Already in a transaction error

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 6979 - Handle multiple branches in non-auth_by_bin
Alex Arnaud [Tue, 15 Nov 2016 10:02:05 +0000 (10:02 +0000)]
Bug 6979 - Handle multiple branches in non-auth_by_bin

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 6979 - Update tests
Alex Arnaud [Tue, 15 Nov 2016 09:46:52 +0000 (09:46 +0000)]
Bug 6979 - Update tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug #6979
= [Wed, 5 Oct 2011 20:47:21 +0000 (16:47 -0400)]
Bug #6979

I removed several lines of code in the checkpw_ldap subroutine where
LDAP authentication takes place, in the "else" part of the conditional
that checks for the auth_by_bind config parameter. I added several lines
to check whether the user can log in to LDAP using their DN and the
password supplied in the login form. If they are able to bind, login
contiues as normal and the LDAP attributes can be harvested as normal if
the update options are turned on. The routine that was in place was
failing because it was trying to check against a non-existent LDAP entry
attribute called 'userpassword'. Instead of checking against a
'userpassword' attribute, the routine really should be checking to make
sure the user can actually bind to LDAP. That's what I set up, and it is
a safer way to test authentication against LDAP.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560 - DBRev 16.12.00.020
Kyle M Hall [Fri, 31 Mar 2017 12:12:21 +0000 (12:12 +0000)]
Bug 17560 - DBRev 16.12.00.020

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560: Improve wordings
Jonathan Druart [Mon, 20 Mar 2017 14:10:44 +0000 (11:10 -0300)]
Bug 17560: Improve wordings

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended as per comment33 of Alex Sassmannshausen.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560: Improve strenght of hold existence test
Jonathan Druart [Fri, 10 Mar 2017 13:59:41 +0000 (10:59 -0300)]
Bug 17560: Improve strenght of hold existence test

This patch is a QA follow-up to fix several issues:
- 1 call to GetReserveFee was wrong in ModReserveFill
- Update DB entry was wrong and insufficient
- Add robustness to the tests in sco-main

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560: Add a message when a patron checking in using the self checkout
Jonathan Druart [Sun, 6 Nov 2016 19:41:47 +0000 (19:41 +0000)]
Bug 17560: Add a message when a patron checking in using the self checkout

Sponsored-by: Cheshire Libraries
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560: Update the wording when a patron places a hold at the OPAC
Jonathan Druart [Sun, 6 Nov 2016 18:55:22 +0000 (18:55 +0000)]
Bug 17560: Update the wording when a patron places a hold at the OPAC

Sponsored-by: Cheshire Libraries
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560: Hold fee placement at point of checkout
Jonathan Druart [Thu, 3 Nov 2016 16:12:38 +0000 (16:12 +0000)]
Bug 17560: Hold fee placement at point of checkout

Currently, Koha charges all patrons a hold fee in all circumstances, if
a hold fee is applicable to their patron category.
This is immediately applied at point of request.
However, it would be useful to let patrons make requests without a
charge
being incurred until they physically have the item in their hands and
checked out to their cards.

The hold fee will only be added to the account  as soon as the item is
checked out to the requesting patron.
With this scenario, we will be certain that patrons have the correct
item, and they are happy with what has been supplied.
It also means that patrons can place holds via the OPAC without reaching
the usage limit that has been selected.

Test plan:
0/ All the following steps must be done with a patron using a patron category with a hold fee
1/ Make sure that the existing options for HoldFeeMode work as before
2/ Select the third option "any time a hold is collected"
3/ Place a hold on an item
4/ Note that the patron has not been charged
5/ Check this item from the staff interface
6/ Note that the patron has been charged
7/ Place another hold
8/ Use the self checkout feature at the OPAC for the checkin
9/ Note that the patron has been charged and a message is displayed to
inform about the fee.

Sponsored-by: Cheshire Libraries
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560: Update current code
Jonathan Druart [Thu, 3 Nov 2016 13:20:17 +0000 (13:20 +0000)]
Bug 17560: Update current code

This patch updates the current code to make it works with the new
option's name of the syspref.
It also refactor the tests to make them more reusable and robust.

Sponsored-by: Cheshire Libraries
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17560: Add a third option to HoldFeeMode
Jonathan Druart [Thu, 3 Nov 2016 08:16:26 +0000 (08:16 +0000)]
Bug 17560: Add a third option to HoldFeeMode

This patch adds a new 'any_time_is_collected' option to the HoldFeeMode
syspref.
The existing 'always' option is renamed with 'any_time_is_placed''

Sponsored-by: Cheshire Libraries
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
7 years agoBug 17736: Fix typo ->new vs ->next
Jonathan Druart [Fri, 3 Feb 2017 09:45:13 +0000 (10:45 +0100)]
Bug 17736: Fix typo ->new vs ->next

while ->new is terrible, let's call that a typo...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
opac-detail works again !

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: [QA Follow-up] Script basket.pl is not Plack compliant
Marcel de Rooy [Fri, 6 Jan 2017 12:36:35 +0000 (13:36 +0100)]
Bug 17736: [QA Follow-up] Script basket.pl is not Plack compliant

Several warnings like:
Variable "$confirm_pref" is not available at /usr/share/koha/masterclone/acqui/basket.pl line 507.

Primarily caused by sub edi_close_and_order.

Easy fix.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: [QA Follow-up] We do not need GetItemHolds in acqui
Marcel de Rooy [Fri, 6 Jan 2017 12:22:07 +0000 (13:22 +0100)]
Bug 17736: [QA Follow-up] We do not need GetItemHolds in acqui

The solution of Jonathan can be applied in two other cases, effectively
making GetItemHolds obsolete.

Test plan:
[1] Git grep on GetItemHolds
[2] Add an order, place a hold, delete order.
[3] Add an order, receive, place hold, delete order.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: [QA Follow-up] Crashes in basket.pl and parcel.pl
Marcel de Rooy [Fri, 6 Jan 2017 11:21:56 +0000 (12:21 +0100)]
Bug 17736: [QA Follow-up] Crashes in basket.pl and parcel.pl

Crash in basket.pl:
Can't call method "holds" on an undefined value at /usr/share/koha/masterclone/acqui/basket.pl line 466.
Comes from a biblionumber == NULL in aqorders where I cancelled the order and deleted the biblio.

Crash in parcel.pl:
Can't call method "holds" on an undefined value at /usr/share/koha/masterclone/acqui/parcel.pl line 246.
Similar fix.

Trivial fixes indeed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: [QA Follow-up] Wrong biblionumber in acqui/parcel
Marcel de Rooy [Fri, 6 Jan 2017 11:03:27 +0000 (12:03 +0100)]
Bug 17736: [QA Follow-up] Wrong biblionumber in acqui/parcel

Trivial fix.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: [QA Follow-up] Solve warning from qa tools on Holds.t
Marcel de Rooy [Fri, 6 Jan 2017 10:45:17 +0000 (11:45 +0100)]
Bug 17736: [QA Follow-up] Solve warning from qa tools on Holds.t

FAIL   t/db_dependent/Holds.t
"my" variable $hold masks earlier declaration in same scope

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: [Follow-up] Resolve inherited AUTOLOAD for non-method errors
Marcel de Rooy [Fri, 6 Jan 2017 10:21:10 +0000 (11:21 +0100)]
Bug 17736: [Follow-up] Resolve inherited AUTOLOAD for non-method errors

Like:
Use of inherited AUTOLOAD for non-method Koha::Biblio::GetMarcBiblio() is deprecated at /usr/share/koha/masterclone/Koha/Biblio.pm line 60.
Use of inherited AUTOLOAD for non-method Koha::Biblio::GetRecordValue() is deprecated at /usr/share/koha/masterclone/Koha/Biblio.pm line 60.

Resolved by not importing them but fully qualifying them.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: [Follow-up] Rename to current_holds
Marcel de Rooy [Fri, 6 Jan 2017 09:48:48 +0000 (10:48 +0100)]
Bug 17736: [Follow-up] Rename to current_holds

It is not about when the hold was 'placed' but if the hold pertains to
the future or not.

Test plan:
[1] Git grep on holds_placed_before_today.
[2] Run t/db_dependent/Koha/Biblios.t
[3] Run t/db_dependent/Reserves.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: Remove C4::Reserves::GetReservesFromBiblionumber
Jonathan Druart [Wed, 7 Dec 2016 11:26:53 +0000 (12:26 +0100)]
Bug 17736: Remove C4::Reserves::GetReservesFromBiblionumber

At this point, there should not be any occurrences of
GetReservesFromBiblionumber left in the codebase

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: Replace GetReservesFromBiblionumber with Koha::Biblio->holds
Jonathan Druart [Wed, 7 Dec 2016 02:29:01 +0000 (02:29 +0000)]
Bug 17736: Replace GetReservesFromBiblionumber with Koha::Biblio->holds

The C4::Reserve::GetReservesFromBiblionumber took 3 parameters, the
biblionumber, an optional itemnumber and a "all_dates" flag.
If set, the subroutine returned all the holds placed on a given bibliographic
record, even the ones placed in the future. Almost all of the calls had this
flag set, they will be replaced with a call to Koha::Biblio->holds.

But 5 did not have it:
- C4::Biblio::DelBiblio
-tools/batch_delete_records.pl
=> These 2 were wrong, we want to retrieve the holds to cancel them
before deleting the record. We need to get all the holds, even the ones
placed in the future /!\ CHANGE IN THE BEHAVIOR

- acqui/parcel.pl
=> 1 call per item were made to this subroutine. They have been replaced
with only 1 call to the new method Koha::Biblios->holds_placed_before_today
Then we filter on the itemnumbers.
I think this is wrong: we need the number of holds to know if the record
can be deleted, so even if future holds exist, the deletion should not
be possible.

- serials/routing-preview.pl
- C4::ILSDI::Services::GetRecords
- C4::SIP::ILS::Item->new
=> Seems ok, we just one to display holds placed before today

Test plan:
I would suggest to test this patch with patches from bug 17737 and bug 17738,
to place different kind of holds (biblio and item level, future and
past).
Then do a whole workflow to detect bug, view a record, delete record,
order, place a hold on an item which has been ordered, etc.
The hold's informations should always be the same without or without
these patches.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17736: Add the Koha::Biblio->holds_placed_before_today method
Jonathan Druart [Wed, 7 Dec 2016 15:38:38 +0000 (16:38 +0100)]
Bug 17736: Add the Koha::Biblio->holds_placed_before_today method

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18173 - DBRev 16.12.00.019
Kyle M Hall [Fri, 31 Mar 2017 11:23:43 +0000 (11:23 +0000)]
Bug 18173 - DBRev 16.12.00.019

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18173: DBIx schema changes
Marcel de Rooy [Tue, 7 Mar 2017 13:26:51 +0000 (14:26 +0100)]
Bug 18173: DBIx schema changes

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18173: Remove DB field issues.return
Jonathan Druart [Mon, 27 Feb 2017 09:41:55 +0000 (09:41 +0000)]
Bug 18173: Remove DB field issues.return

The DB field issues.return has never really been used apparently.
I found the first occurrence of this field in
commit eac3a7b19a8aa7cda34aac396f5093c213a4aa5a
CommitDate: Mon Mar 12 22:43:47 2001 +0000
    Database definition file, checked into cvs to make keeping database
    current easier

Since I did not find any use of this field.
I guess it can be removed safely.

There is no proper test plan here. Just make sure this field has never
been used.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
I have not found any use of issues.return or old_issues.return. In
all my live instances the column is always NULL. Issuing and returning
seems to work as expected after the columns have been removed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18332: [QA Follow-up] Adjust slice call in last method
Marcel de Rooy [Fri, 31 Mar 2017 07:32:53 +0000 (09:32 +0200)]
Bug 18332: [QA Follow-up] Adjust slice call in last method

We should call slice in list context with the correct indexes.

Test plan:
Run t/db_dependent/Koha/Objects.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18332: Add the Koha::Objects->last method
Jonathan Druart [Fri, 24 Mar 2017 01:03:19 +0000 (22:03 -0300)]
Bug 18332: Add the Koha::Objects->last method

DBIx::Class does not provide such method, but it can be handy in some
cases.

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Test returned green.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15498 - DBRev 16.12.00.018
Kyle M Hall [Fri, 31 Mar 2017 11:19:50 +0000 (11:19 +0000)]
Bug 15498 - DBRev 16.12.00.018

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15498: [QA Follow-up] Additional changes
Marcel de Rooy [Fri, 17 Feb 2017 07:10:43 +0000 (08:10 +0100)]
Bug 15498: [QA Follow-up] Additional changes

Adds ExportRemoveFields to sysprefs.sql

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15498: Fix conflict with bug 17394
Jonathan Druart [Fri, 17 Feb 2017 10:13:32 +0000 (10:13 +0000)]
Bug 15498: Fix conflict with bug 17394

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15498: Fix show/hide csv profile list
Jonathan Druart [Wed, 2 Nov 2016 10:31:43 +0000 (10:31 +0000)]
Bug 15498: Fix show/hide csv profile list

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15498: Do not display sql csv profiles
Jonathan Druart [Wed, 2 Nov 2016 08:42:11 +0000 (08:42 +0000)]
Bug 15498: Do not display sql csv profiles

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15498: Add ExportCircHistory and remove ExportWithCsvProfile
Jonathan Druart [Wed, 6 Jan 2016 16:36:54 +0000 (16:36 +0000)]
Bug 15498: Add ExportCircHistory and remove ExportWithCsvProfile

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15498: Let the user choose the CSV profile to export circ history
Jonathan Druart [Wed, 2 Nov 2016 08:28:01 +0000 (08:28 +0000)]
Bug 15498: Let the user choose the CSV profile to export circ history

The way the export options are displayed at the bottom of the checkouts table
was not consistent.
Prior to this patch set, they are display if ExportRemoveFields or
ExportWithCsvProfile is set.
It does not make any sense, the user could want to export the checkouts in
iso2709 format without having to define a csv profile and fill the pref.

Moreover the behavior of this pref did not match its description: it's used as
a default CSV profile when exporting records from the export tools or the
command line.

This patch set adds a new pref ExportCircHistory and remove
ExportWithCsvProfile. The new pref is set if ExportWithCsvProfile or
ExportRemoveFields were set.
A new dropdown list with the CSV profile list will be displayed in the
export area, at the bottom of the checkouts table.

Note that now --csv_profile_id is mandatory for the export command line
(misc/export_records.pl) if the export format is csv.

Test plan:
0/ Do not execute the DB entry
1/ Clear both ExportWithCsvProfile and ExportRemoveFields prefs
2/ Execute the DB entry
3/ ExportCircHistory should not be set and the export options should not
be displayed at the bottom of the checkouts table.
4/ Remove the pref
  DELETE FROM systempreferences WHERE variable='ExportCircHistory';
and reinsert the previous one, with a value:
  INSERT INTO systempreferences (variable, value) VALUES
  ('ExportWithCsvProfile', 'something');
Execute the DB entry again
=> The now pref should be now set
5/ Export some checkouts using the CSV entry
6/ Note that the export tool and commandline script still work using the
csv format. You have to provide a --csv_profile_id option to make it
work.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17971 (QA Followup) Clarify comment
Nick Clemens [Wed, 29 Mar 2017 20:10:52 +0000 (16:10 -0400)]
Bug 17971 (QA Followup) Clarify comment

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17971: Add support for objects represented by fk
Jonathan Druart [Tue, 17 Jan 2017 15:18:54 +0000 (16:18 +0100)]
Bug 17971: Add support for objects represented by fk

For instance an issue is not fetch from its fk but using the fk
itemnumber.
We need to support them.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17971: TT syntax for notices - Add support for plurals
Jonathan Druart [Sat, 21 Jan 2017 13:26:27 +0000 (14:26 +0100)]
Bug 17971: TT syntax for notices - Add support for plurals

On of the awesome things we will be able to do with the TT syntax is the support of plurals.

For instance we will be able to send a list of items, checkouts, etc. to the notice template.
That way we will get rid of our custom syntax like <<items.content>> or <item></item> for instance.

The existing code already has the playground for that but it is not used.

Basically the idea is to add a "loops" key which can contain a list of
object to retrieve from the DB and send to the template.
For instance:
    loops => { overdues => [ $itemnumber_1, .., $itemnumber_N ] }

will send a variable "overdues" to the template. It will contain the
Koha::Checkout objects relative to the id passed.

There is one quite big inconvenient to this approach so far: since we
are still supporting the historical syntax, the objects can be fetch by
a script, then the script will send the id to GetPreparedLetter which
will refetch them.
This must be improved, but I suggest to do that later.

Test plan:
  prove t/db_dependent/Letters/TemplateToolkit.t
should return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17970: Fix GetPreparedLetter behavior if nothing to substitute
Jonathan Druart [Sat, 21 Jan 2017 13:13:49 +0000 (14:13 +0100)]
Bug 17970: Fix GetPreparedLetter behavior if nothing to substitute

From C4::Letters::GetPreparedLetter:

    my $tables = $params{tables};
    my $substitute = $params{substitute};

    $tables || $substitute || $repeat
       or carp( "ERROR: nothing to substitute - both 'tables' and 'substitute' are empty" ),
          return;

So if the parameter tables or substitute is passed but does not contain anything, it will not warn as expected.

Test plan:
1/ Apply the patch with tests
2/ Confirm that they do not pass
3/ Apply this patch
4/ Confirm that the tests now pass

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17970: Add tests to highlight the problem
Jonathan Druart [Sat, 21 Jan 2017 13:13:36 +0000 (14:13 +0100)]
Bug 17970: Add tests to highlight the problem

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17963: TT syntax for notices - Prove that AR_* are compatible
Jonathan Druart [Mon, 16 Jan 2017 13:46:12 +0000 (14:46 +0100)]
Bug 17963: TT syntax for notices - Prove that AR_* are compatible

Nothing new here since bug 17962, the AR_* notice messages are quite
simple. They send the article_request, patron, biblio, biblioitem, item and
library linked to the article request.

All the fields from these 6 tables should still be accessible using the
TT syntax.

Test plan:
Define TT notice templates for AR_PENDING, AR_PROCESSING, AR_COMPLETED
or AR_CANCELED.

You should manage to create a template to generate the same result as
the historical syntax.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18269: Move field mappings related code to Koha::FieldMapping[s]
Jonathan Druart [Mon, 13 Mar 2017 21:17:13 +0000 (18:17 -0300)]
Bug 18269: Move field mappings related code to Koha::FieldMapping[s]

The 3 subroutines GetFieldMapping, SetFieldMapping and
DeleteFieldMapping from the C4::Biblio module were only used from the
field mappings admin page.
They can easily replaced with new packages Koha::FieldMappings based on
Koha::Object[s]

Test plan:
Add and delete field mappings (admin/fieldmapping.pl, Home ›
Administration › Keyword to MARC mapping).
Add an existing mapping > Nothing should be added

Note that this page has not been rewritten and you will not get any
feedbacks, but it's not the goal of this page to improve it.

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18269: Add Koha::FieldMapping[s] packages
Jonathan Druart [Tue, 14 Mar 2017 21:10:08 +0000 (18:10 -0300)]
Bug 18269: Add Koha::FieldMapping[s] packages

Tested both patches together, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14146 - DBRev 16.12.00.017
Kyle M Hall [Fri, 31 Mar 2017 10:18:35 +0000 (10:18 +0000)]
Bug 14146 - DBRev 16.12.00.017

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14146: Add the new pref CumulativeRestrictionPeriods
Jonathan Druart [Mon, 12 Dec 2016 15:03:01 +0000 (16:03 +0100)]
Bug 14146: Add the new pref CumulativeRestrictionPeriods

Sponsored-by: Orex Digital
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14146: Clean a bit and make the code understandable
Jonathan Druart [Mon, 12 Dec 2016 15:04:07 +0000 (16:04 +0100)]
Bug 14146: Clean a bit and make the code understandable

The code was a bit weird and this patch cleans it a bit by renaming
variables and adding a variable.

Sponsored-by: Orex Digital
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14146: Add the ability to cumulate restriction periods
Jonathan Druart [Wed, 30 Nov 2016 19:33:44 +0000 (19:33 +0000)]
Bug 14146: Add the ability to cumulate restriction periods

At the moment the default behaviour is not to cumulate the restriction
periods but to apply the longest one.
This patch set creates a new syspref CumulativeRestrictionPeriods. If
on, the behaviour changes and the restriction periods are cumulated: the
days of the second restriction are added to the actual restriction
period.

We could add a new circulation rule instead of a syspref, but I am not
sure it's very useful to have such granularity for this behaviour (can
be changed if needed).

How it works:
Let's take 2 items, A and B.
A is returned with Na days late, and B Nb days late
The grace period is Ng and there is 1 day of suspension charge per day
of overdue
The suspension period is until day D = Na - Ng + Nb - Ng

I would have expected D = Na + Nb - Ng but it's how it worked before
this patch.

Test plan:
Create several overdue for a given patron
Do the checkins and confirm that the period are added if the pref is on.
If the pref is off, you should not get any changes in the existing behaviour.

Sponsored-by: Orex Digital
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14146: Add tests for AddReturn + CumulativeRestrictionPeriods
Jonathan Druart [Mon, 12 Dec 2016 15:04:42 +0000 (16:04 +0100)]
Bug 14146: Add tests for AddReturn + CumulativeRestrictionPeriods

Sponsored-by: Orex Digital
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17847: Remove C4::Koha::GetAuthvalueDropbox
Jonathan Druart [Wed, 4 Jan 2017 14:41:22 +0000 (15:41 +0100)]
Bug 17847: Remove C4::Koha::GetAuthvalueDropbox

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17847: Replace C4::Koha::GetAuthvalueDropbox with Koha::AuthorisedValues
Jonathan Druart [Wed, 4 Jan 2017 12:43:27 +0000 (13:43 +0100)]
Bug 17847: Replace C4::Koha::GetAuthvalueDropbox with Koha::AuthorisedValues

The C4::Koha::GetAuthvalueDropbox subroutine does the same job as
Koha::AuthorisedValues->search
We should then replace the different calls to this subroutine to finally
remove it.
There were 2 calls to this subroutine:
- from the AuthorisedValues TT plugin (called from av-build-dropbox.inc
and members/housebound.tt)
- from the acqui/ajax-getauthvaluedropbox.pl ajax script

To make sure that this patchset does not introduce regressions, we will have
to test that the TT plugin and the ajax script still behave as before.

Test plan:
1/ Test acqui/ajax-getauthvaluedropbox.pl
- Link a fund to an authorised value category
- Create a new order
=> When you select a fund linked to AV category, the sort1 (and/or
sort2, depending on what you set) should be replaced with a dropdown
list populated with the authorised values
2/ Test av-build-dropbox.inc
- Create some authorised values for Bsort1
- Edit a patron
=> The sort1 should be a dropdown list populated with the Bsort1 AV
3/ Test members/housebound.tt
- Enable the housebound module (pref HouseboundModule)
- On the patron detail page, click on the "Housebound" tab
=> The frequency dropdown list should be populated with the different
HSBND_FREQ AV

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17844: Replace C4::Koha::get_notforloan_label_of with Koha::AuthorisedValues
Jonathan Druart [Wed, 4 Jan 2017 10:38:34 +0000 (11:38 +0100)]
Bug 17844: Replace C4::Koha::get_notforloan_label_of with Koha::AuthorisedValues

This patch is more a bugfix than a refactoring.
Indeed the C4::Koha::get_notforloan_label_of behaviors were buggy:
1/ It does not display the opac description at the OPAC, but always the
staff description
2/ It does not care of the framework of the biblio, but retrieve the
first row of the marc_subfield_structure mapped with items.notforloan

These 2 bugs can easily be fixed using the
Koha::AuthorisedValues->search_by_koha_field

Steps to recreate the issues:
- Create 2 authorised value categories for not for loan (NFL1 and NFL2)
with the same values. Define a different description for the OPAC.
- Define link 952$7 to NFL1 for the default framework and to NFL2 for
the BK framework
- Create 2 bibliographic records (B1 using NFL1 and B2 using NFL2) with
2 items each (1 item should have a not for loan value)
- Go to the "Place a hold" view for this record.
- In the item list, you should see the not for loan value
=> The staff description of NFL1 will always be used, even for the OPAC

Test plan:
- Recreate the issues without this patchset
- Apply this patchset
- Recreate the steps to recreate the issues
=> The staff description of NFL2 should be displayed for the B2 item
=> The opac description of NFL2 should be displayed for the B2 item at
the OPAC

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17844: Remove C4::Koha::get_notforloan_label_of
Jonathan Druart [Wed, 4 Jan 2017 10:53:33 +0000 (11:53 +0100)]
Bug 17844: Remove C4::Koha::get_notforloan_label_of

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18258: (QA followup) Use Koha::Subscriptions
Tomas Cohen Arazi [Wed, 29 Mar 2017 17:50:22 +0000 (14:50 -0300)]
Bug 18258: (QA followup) Use Koha::Subscriptions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18258: Add the Koha::Biblio->subscriptions method
Jonathan Druart [Mon, 13 Mar 2017 18:27:06 +0000 (15:27 -0300)]
Bug 18258: Add the Koha::Biblio->subscriptions method

Test plan:
  prove t/db_dependent/Koha/Biblios.t
should return green

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18270: Do not fetch the MARC record when deleting an item
Jonathan Druart [Wed, 15 Mar 2017 12:30:19 +0000 (09:30 -0300)]
Bug 18270: Do not fetch the MARC record when deleting an item

$record is never used later, the call is superfluous.

Test plan:
Quick glance at the code should be enough

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18058: Allow borrower_message_preferences to be truncated
Jonathan Druart [Tue, 14 Feb 2017 14:39:48 +0000 (14:39 +0000)]
Bug 18058: Allow borrower_message_preferences to be truncated

borrower_message_preferences cannot be truncated because of the foreign.
DBMS fails with
  "Cannot truncate a table referenced in a foreign key constraint"

To avoid that we should remove the FK check and truncate the other table
as well.

I am wondering if we really need a truncate here
  DELETE FROM borrower_message_preferences;
should do the job, but leave it as it because of the param name.

Test plan
  perl misc/maintenance/borrowers-force-messaging-defaults --doit --truncate
Should no longer raise the error message

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18266: Fix internal error when paying fine for lost item without.. item
Jonathan Druart [Tue, 21 Mar 2017 15:24:28 +0000 (12:24 -0300)]
Bug 18266: Fix internal error when paying fine for lost item without.. item

If a fine is created for a lost item but the itemnumber is not supplied,
the system will return it.
The item should not be mark as returned if there is no item linked to
the fine.

Test plan:
1. Turn StoreLastBorrower on
2. Create a manual invoice for a lost item, do not supply a barcode
3. Pay the fines 'Pay fines > Pay'

=> Without this patch applied you get
Can't call method "last_returned_by" on an undefined value at
/home/marc/koha/C4/Circulation.pm line 2188.

=> With this patch applied, you must not get the error.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18124: Change the calls to generate and check CSRF tokens
Jonathan Druart [Wed, 15 Feb 2017 16:14:13 +0000 (17:14 +0100)]
Bug 18124: Change the calls to generate and check CSRF tokens

The parameter change in Koha::Token should be applied to the calling
scripts.

Test plan:
Confirm that the different forms of the scripts modified by this patch
still work correctly.

Test the problematic behavior:
Open 2 tabs with in same user's session, go on the edit patron page
(memberentry.pl).
Log out and log in from the other tab.
Submit the form
=> Wrong CSRF token should be raised

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18124: [Follow-up] Handle default parameters in a sub
Marcel de Rooy [Thu, 16 Feb 2017 10:59:12 +0000 (11:59 +0100)]
Bug 18124: [Follow-up] Handle default parameters in a sub

Adds a internal routine to handle default values for the parameters
id and secret.
Also adds a parameter session_id for generate_csrf and check_csrf. This
session parameter is combined with the id parameter when generating or
checking a token.

Test plan:
Run t/Token.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18124: Restrict CSRF token to user's session
Jonathan Druart [Wed, 15 Feb 2017 16:14:13 +0000 (17:14 +0100)]
Bug 18124: Restrict CSRF token to user's session

Currently the CSRF token generated is based on the borrowernumber, and
is valid across user's session.
We need to restrict the CSRF token to the current session.

With this patch the CSRF token is generated concatenating the id
(borrowernumber) and the CGISESSID cookie.

Test plan:
Run t/Token.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18312: Fix export unless a file is supplied
Jonathan Druart [Tue, 21 Mar 2017 13:52:42 +0000 (10:52 -0300)]
Bug 18312: Fix export unless a file is supplied

Bug 18087 breaks export unless a file is supplied.

Can't use an undefined value as a HASH reference at
/home/vagrant/kohaclone/tools/export.pl line 75.

Test plan:
Export records using a file of id that is not a valid file (not txt or
csv)
Export records using a valid file
Export records without supplying a file

=> The export should work or fail as expected.

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18144: Restore pieces of C4/Auth to make Google OpenID Connect work
Mark Tompsett [Mon, 20 Feb 2017 06:37:49 +0000 (01:37 -0500)]
Bug 18144: Restore pieces of C4/Auth to make Google OpenID Connect work

By restoring some pieces of logic, with the name changed from $persona
to $emailaddress, the openid will work again for OPAC logins.

See https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10988#c68
for an excellent test plan.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Did not test it, but trust in author and signoffer

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13757 - DBRev 16.12.00.016
Kyle M Hall [Fri, 24 Mar 2017 18:49:15 +0000 (18:49 +0000)]
Bug 13757 - DBRev 16.12.00.016

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13757: (QA followup) Filter out non-editable params before storing
Tomas Cohen Arazi [Wed, 22 Mar 2017 21:51:48 +0000 (18:51 -0300)]
Bug 13757: (QA followup) Filter out non-editable params before storing

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13757: (QA followup) Exclude empty attributes from rendering if non-editable
Tomas Cohen Arazi [Wed, 22 Mar 2017 19:22:53 +0000 (16:22 -0300)]
Bug 13757: (QA followup) Exclude empty attributes from rendering if non-editable

In self registration opac displayable (and not editable) attributes are
displayed as empty. This an empty value is passed to the template for
creating an empty input and it shouldn't when the attribute is not
editable.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13757: Attribute with value 0 should be stored
Tomas Cohen Arazi [Thu, 16 Feb 2017 19:02:48 +0000 (16:02 -0300)]
Bug 13757: Attribute with value 0 should be stored

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13757: (regression test) Attribute with value 0 should be stored
Tomas Cohen Arazi [Thu, 16 Feb 2017 19:02:22 +0000 (16:02 -0300)]
Bug 13757: (regression test) Attribute with value 0 should be stored

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13757: Better display for attr changes in members-update.pl
Tomas Cohen Arazi [Fri, 3 Feb 2017 18:22:57 +0000 (15:22 -0300)]
Bug 13757: Better display for attr changes in members-update.pl

This patch changes the way changed attributes are displayed for the
staff user to make the decision to approve (or not) the changes.

Regards

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 13757: Make K::P::Modifications->pending return K::P::Attribute
Tomas Cohen Arazi [Fri, 3 Feb 2017 18:22:37 +0000 (15:22 -0300)]
Bug 13757: Make K::P::Modifications->pending return K::P::Attribute

This patch makes Koha::Patron::Modifications->pending return
Koha::Patron:Attribute objects. They are not stored on the DB but only
live in memory on runtime.

members-update.pl is the only place this is used, and this way we have
all we need for better rendering the UI.

Tests are added for the changed API.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>