koha.git
7 years agoBug 18512: Add tests
Jonathan Druart [Tue, 2 May 2017 20:27:48 +0000 (17:27 -0300)]
Bug 18512: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not...
Nick Clemens [Fri, 28 Apr 2017 18:11:00 +0000 (14:11 -0400)]
Bug 18512 - GetAuthorisedValues.GetByCode Template plguin should return code (not empty string) if value not found

To test:
1 - Create or edit a borrower with info in Sort1 and Sort2 field, not
mapped to authorized values
2 - Note this info does not display on moremember.tt
3 - Apply patch
4 - Note value is passed through

Signed-off-by: Mark Tompsett <mtompset@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 18152: Add tests
Jonathan Druart [Wed, 3 May 2017 18:30:14 +0000 (15:30 -0300)]
Bug 18152: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18152 : fix unimarc label in SetMarcUnicodeFlag
Stephane Delaune [Wed, 22 Feb 2017 11:25:33 +0000 (12:25 +0100)]
Bug 18152 : fix unimarc label in SetMarcUnicodeFlag

The standard UNIMARC requires than the 9th character (starting from 0) in
labels must be blank (while it may be 'a' in marc21)

the problem is that C4::Charset::SetMarcUnicodeFlag (called in particular when
we import a record) always add 'a' char in the 9th label'pos whereas it should
do it just for MARC21 and NORMARC (not for UNIMARC) :

C4::Charset::SetMarcUnicodeFlag add 'a' char in the 9th label character for
MARC21 and NORMARC (it's normal), but just before doing this it call
"$marc_record->encoding('UTF-8')" which is a MARC::Record function which, when
called with 'UTF-8' parameter, do only one thing : add 'a' char in the 9th
label character

This patch only removes this incorrect function call, so, when we import a bib
record in UNIMARC : it no longer adds erroneous character (this does not change
anything for MARC21 and NORMARC because SetMarcUnicodeFlag explicitly adds 'a'
char in the 9th label for them)

Signed-off-by: Alex Buckley <alexbuckley@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 18442: Add a test
Jonathan Druart [Fri, 21 Apr 2017 21:44:05 +0000 (18:44 -0300)]
Bug 18442: Add a test

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 18442: Fix DB user loggin
Alex Buckley [Wed, 19 Apr 2017 23:29:28 +0000 (11:29 +1200)]
Bug 18442: Fix DB user loggin

Test plan:
1. Drop and recreate your db

2. Clear memcached

3. Go through the installer (to speed up this test plan install all
sample data so you dont have to create libraries, patron categories etc. later)

4. On the installer page login as the database user and notice that it
does not work on the first attempt ( you get 'Error: You do not have
permission to access this page')

5. Try logging in as database user for a second time and notice you are
logged in successfully this time

4. In staff interface create a patron account with superlibrarian permissions

5. Logout of the staff interface

6. Login as database user

7. Notice you cant log in. You get the 'Error:: You do not have permission to access this
page' error

8. Try a second attempt and notice you get the same error

9. Open the URL in a new tab and notice the staff interface appears
showing that you are logged in

10. log out and log back in as the superlibrarian user you created and
notice it works on first login attempt

11. Apply patch

12. Log out and try logging back in as database user and notice that you
can login successfully on first attempt

13. Repeat steps 1,2,3 and login as database user and notice the login
works on first attempt

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 18502: Make koha-shell set the right PERL5LIB on dev installs
Tomas Cohen Arazi [Thu, 27 Apr 2017 14:37:27 +0000 (11:37 -0300)]
Bug 18502: Make koha-shell set the right PERL5LIB on dev installs

Bug 16749 introduced a nice way to have flexible paths. During the discussion on how to do it, we moved from having it contain the path to the git dir to just a boolean. The 'koha-shell' script didn't get attention it seems, and it is broken on dev installs.

This was hidden by the fact that many of us run dev installs on kohadevbox, which sets a .bashrc file for de instance's user, containing the right path when opening the new shell.

This patch changes the logic so on a dev install, intranetdir is picked as the right path. This is how it is handled in koha-functions.sh

To test:
- On kohadevbox, run:
  $ sudo koha-shell kohadev -c "perl misc4dev/populate_db.pl"
=> FAIL: C4/Installer.pm not found on PERL5LIB error.
- Apply this patch
- Replace /usr/bin/koha-shell with debian/scripts/koha-shell
  $ sudo cp kohaclone/debian/scripts/koha-shell /usr/bin/koha-shell
- Run:
  $ sudo koha-shell kohadev -c "perl misc4dev/populate_db.pl"
=> SUCCESS: No warning about missing libs is raised.
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
7 years agoRevert "Bug 18179: Forbid list context calls for Koha::Objects->find"
Kyle M Hall [Fri, 28 Apr 2017 16:49:05 +0000 (12:49 -0400)]
Revert "Bug 18179: Forbid list context calls for Koha::Objects->find"

This reverts commit a1fcf1818c8d9f23d9c870e93c41c67a27faf603.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoRevert "Bug 18179: Update existing calls"
Kyle M Hall [Fri, 28 Apr 2017 16:48:56 +0000 (12:48 -0400)]
Revert "Bug 18179: Update existing calls"

This reverts commit 2a2b9739117e74232c9a7abde516b1c436d4bad3.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 16344 - DBRev 16.12.00.030
Kyle M Hall [Fri, 28 Apr 2017 13:28:33 +0000 (09:28 -0400)]
Bug 16344 - DBRev 16.12.00.030

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 16344 - Update Schema
Kyle M Hall [Thu, 27 Apr 2017 19:21:11 +0000 (19:21 +0000)]
Bug 16344 - Update Schema

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 16344: Fix alignment between top and bottom columns
Jonathan Druart [Tue, 26 Apr 2016 15:58:49 +0000 (16:58 +0100)]
Bug 16344: Fix alignment between top and bottom columns

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Janet McGowan <janet.mcgowan@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 16344: Add a circ rule to limit the auto renewals given a specific
Jonathan Druart [Mon, 25 Apr 2016 20:52:27 +0000 (21:52 +0100)]
Bug 16344: Add a circ rule to limit the auto renewals given a specific

This patch adds a new circulation rule (no_auto_renewal_after_hard_limit) to block/allow
auto renewals after a given date.
The idea is to stop renewals at a given date. That way the library will have
time to send overdues and get the books back before the students do on holiday.

Test plan:
0/ Execute the update DB entry
1/ Define a rule with no_auto_renewal_after_hard_limit set to tomorrow
2/ Modify the issues.issuedate, to simulate a checkout in the past:
    UPDATE issues
    SET issuedate = "yyyy-mm-dd hh:mm:ss"
    WHERE itemnumber = YOUR_ITEMNUMBER;
with issuedate = 2 days before for instance
3/ Execute the automatic renewals cronjob script (misc/cronjobs/automatic_renewals.pl)
Confirm that the issue has been renewed
4/ Modify the no_auto_renewal_after_hard_limit and set it to yesterday
5/ Execute the automatic renewals cronjob script (misc/cronjobs/automatic_renewals.pl)
Confirm that the issue has not been renewed

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Janet McGowan <janet.mcgowan@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224 - DBRev 16.12.00.029
Kyle M Hall [Thu, 27 Apr 2017 19:10:47 +0000 (19:10 +0000)]
Bug 14224 - DBRev 16.12.00.029

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14424: DBIC Schema changes
Jonathan Druart [Thu, 20 Apr 2017 16:46:35 +0000 (13:46 -0300)]
Bug 14424: DBIC Schema changes

https://bugs.koha-community.org/show_bug.cgi?id=14224

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Use encode_json instead of to_json
Jonathan Druart [Thu, 20 Apr 2017 16:42:02 +0000 (13:42 -0300)]
Bug 14224: Use encode_json instead of to_json

To handle unicode characters properly

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Check if the columns do not exist before creating them
Jonathan Druart [Wed, 1 Feb 2017 14:53:06 +0000 (15:53 +0100)]
Bug 14224: Check if the columns do not exist before creating them

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Improve escaped characters
Jonathan Druart [Wed, 1 Feb 2017 16:01:00 +0000 (17:01 +0100)]
Bug 14224: Improve escaped characters

To recreate the problem, submit a note like
  doh"doh

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Update Copyright
Jonathan Druart [Wed, 1 Feb 2017 15:56:46 +0000 (16:56 +0100)]
Bug 14224: Update Copyright

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Replace AllowIssueNotes with AllowCheckoutNotes
Jonathan Druart [Thu, 2 Feb 2017 10:37:54 +0000 (11:37 +0100)]
Bug 14224: Replace AllowIssueNotes with AllowCheckoutNotes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Make strings translatable
Jonathan Druart [Wed, 1 Feb 2017 15:38:37 +0000 (16:38 +0100)]
Bug 14224: Make strings translatable

The strings should be translatable.
This patch also removes the error as it appears that we only have 1
error.
To improve we could surround the store with an eval.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Fix prevent submit
Jonathan Druart [Thu, 2 Feb 2017 10:10:30 +0000 (11:10 +0100)]
Bug 14224: Fix prevent submit

That did not work, the form was submitted anyway

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Remove SQL query in svc script
Jonathan Druart [Thu, 2 Feb 2017 10:10:28 +0000 (11:10 +0100)]
Bug 14224: Remove SQL query in svc script

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Reintroduce previous copyright
Jonathan Druart [Thu, 2 Feb 2017 09:49:18 +0000 (10:49 +0100)]
Bug 14224: Reintroduce previous copyright

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Do not reintroduce GetItemIssue, it's dying
Jonathan Druart [Wed, 1 Feb 2017 14:56:34 +0000 (15:56 +0100)]
Bug 14224: Do not reintroduce GetItemIssue, it's dying

Bug 17680 is removing it.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14224: Allow patron notes about item shown at check in
Aleisha Amohia [Sun, 23 Aug 2015 16:22:50 +0000 (18:22 +0200)]
Bug 14224: Allow patron notes about item shown at check in

This patch adds a "Note" input field to checked out items in the "your summary"
section. The field allows patrons to write notes about the item checked out,
such as "this DVD is scratched", "the binding was torn", etc. The note will be
emailed to the library and displayed on item check in.

Patch adds two fields to the "issues" table - "note" and "notedate".
Patch adds syspref "AllowIssueNotes" - default off.

Test Plan:
1) Apply this patch
2) Update database
3) Rebuild schema
4) Turn on 'AllowIssueNote' syspref
5) Check out three different items to a borrower (may be easiest to check
    out to yourself)
6) Log in as that borrower (or yourself) on the OPAC side and go to your
summary
7) Confirm text field shows under Note column for all checkouts. Set a
note for each issue, confirm all save.
8) Check the message_queue in mysql for the entries for ALL THREE issue
notes.
9) Disable javascript in your browser
10) Refresh your summary page. Confirm that you can no longer edit the
notes in the text field. Click the 'Create/edit note' button and confirm
you are redirected to a new page.
11) Confirm that the correct title and author show for the note button
you clicked.
12) Set the note and click Submit -> confirm you are redirected
back to summary page and note is saved
13) Confirm there is a new entry in message_queue
14) Enable javascript and go back to the your checkouts page in the
staff client for the borrower you issued the items to
15) Check in TWO items
16) Confirm that the issue notes show under the "Date due" column for
the two items you checked in, and are accurate to the item (i.e. the
right issue note under the right item)
17) Go to circ/returns.pl and check in the final item using the barcode.
Confirm the issue note shows and the date is formatted correctly.

Sponsored-by: Region Halland
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marc Véron <veron@veron.ch>
7 years agoBug 18484 - opac-advsearch.tt missing closing div tag for .container-fluid
Owen Leonard [Mon, 24 Apr 2017 14:21:00 +0000 (14:21 +0000)]
Bug 18484 - opac-advsearch.tt missing closing div tag for .container-fluid

This patch corrects HTML validation errors by adding back a missing
</div> which was removed accidentally by Bug 9043 (2014!).

This patch also removes "border" attributes from <img> tags because the
attribute is obsolete.

To test, apply the patch and test the validity of the OPAC's advanced
search page. The only error should be one about 'Bad value
"api-server,"' which isn't really resolvable.

Signed-off-by: Barton Chittenden <barton@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 18402: Add the Koha::Item->checkout method
Jonathan Druart [Wed, 5 Apr 2017 19:42:35 +0000 (16:42 -0300)]
Bug 18402: Add the Koha::Item->checkout method

Return the current checkout for a given item.
Note it may not exist.

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

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 18401: Add new method Koha::Checkout->patron
Jonathan Druart [Wed, 5 Apr 2017 19:42:26 +0000 (16:42 -0300)]
Bug 18401: Add new method Koha::Checkout->patron

Return the patron related to a given checkout

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

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 18110 - DBRev 16.12.00.028
Kyle M Hall [Fri, 28 Apr 2017 12:53:00 +0000 (08:53 -0400)]
Bug 18110 - DBRev 16.12.00.028

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18110: Do not update value for existing installs
Jonathan Druart [Wed, 26 Apr 2017 18:41:35 +0000 (15:41 -0300)]
Bug 18110: Do not update value for existing installs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18110: Update addressFormat in atomicupdate
Baptiste Wojtkowski [Mon, 3 Apr 2017 13:40:44 +0000 (13:40 +0000)]
Bug 18110: Update addressFormat in atomicupdate

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 18110: Folllowup to fix alternative address and add missing class
Marc Véron [Tue, 28 Mar 2017 07:20:47 +0000 (09:20 +0200)]
Bug 18110: Folllowup to fix alternative address and add missing class

This patch fixes the display of alternative address (streetnumber, streettype
and address on same line, see comment #22, and it adds missing class
patronaddress1 to main address display.

To test:
- Create / edit a customer to have streetnumber, streettype and address in
  both main address and alternate address
- Switch syspref addressformat ot French style
- Verify that both main address and alternate address display as expected
  on patron's detail page (street number, street type and address on same
  line)

Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18110: Removed unwanted spaces
Baptiste Wojtkowski [Mon, 27 Mar 2017 07:32:06 +0000 (07:32 +0000)]
Bug 18110: Removed unwanted spaces

Signed-off-by: Aleisha Amohia <aleishaamohia@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 18110: Corrected display address format
Baptiste Wojtkowski [Fri, 24 Mar 2017 12:47:42 +0000 (12:47 +0000)]
Bug 18110: Corrected display address format

- minor changes on address format
- corrected member-password so that steetnumber is given to the template

Signed-off-by: Aleisha Amohia <aleishaamohia@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 18110: Add a field FR to the syspref AddressFormat
Baptiste Wojtkowski [Mon, 27 Feb 2017 09:32:24 +0000 (09:32 +0000)]
Bug 18110: Add a field FR to the syspref AddressFormat

Add a field FR to the syspref AddressFormat

Testplan
1 - Apply patch
2 - Check if there is a field FR in the syspref AddressFormat, enable it
3 - Create a new borrower and check the order of the fields for the address
4 - Check if it's address appears in a propper manner

27/02/17 : Fixed the display

Signed-off-by: Aleisha Amohia <aleishaamohia@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 12461 - DBRev 16.12.00.027
Kyle M Hall [Fri, 28 Apr 2017 12:46:59 +0000 (08:46 -0400)]
Bug 12461 - DBRev 16.12.00.027

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14143 - Patron cards: Crash (confusion between table names creator_templates...
Marc Véron [Mon, 4 May 2015 21:29:29 +0000 (23:29 +0200)]
Bug 14143 - Patron cards: Crash (confusion between table names creator_templates and club_template_enrollment_fields)

To reproduce:
Go to Home > Tools > Patron card creator
Click on 'Manage profiles'
Result:
Can't use string ("1") as an ARRAY ref while "strict refs" in use at /usr/share/kohaclone/C4/Creators/Lib.pm line 564.

Reason:
Select statment to get field 'template code' from table 'club_template_enrollment_fields' (!) instead of 'table creator_templates'.

To test:
Apply patch
Try to reproduce issue.

Amended because of typo (_ instead of -)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 12461 - (QA Followup)
Nick Clemens [Fri, 28 Apr 2017 10:43:44 +0000 (06:43 -0400)]
Bug 12461 - (QA Followup)

    Club enrollments should only list active enrollments
    Confirms should warn of cascading delete
    Branch limited clubs should only be available to members of that
    branch
    Fix breadcrumbs

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 12461 [QA Followup]
Kyle M Hall [Thu, 27 Apr 2017 12:24:29 +0000 (08:24 -0400)]
Bug 12461 [QA Followup]

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 12461 - Add patron clubs feature
Kyle M Hall [Fri, 23 May 2014 15:54:26 +0000 (11:54 -0400)]
Bug 12461 - Add patron clubs feature

This features would add the ability to create clubs which patrons may be
enrolled in. It would be particularly useful for tracking summer reading
programs, book clubs and other such clubs.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Ensure your staff user has the new 'Patron clubs' permissions
4) Under the tools menu, click the "Patron clubs" link
5) Create a new club template
   * Here you can add fields that can be filled out at the time
     a new club is created based on the template, or a new enrollment
     is created for a given club based on the template.
6) Create a new club based on that template
7) Attempt to enroll a patron in that club
8) Create a club with email required set
9) Attempt to enroll a patron without an email address in that club
10) Create a club that is enrollable from the OPAC
11) Attempt to enroll a patron in that club
12) Attempt to cancel a club enrollment from the OPAC
13) Attempt to cancel a club enrollment from the staff interface

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 17855: Simplify the onboarding tool
Jonathan Druart [Mon, 17 Apr 2017 18:42:35 +0000 (15:42 -0300)]
Bug 17855: Simplify the onboarding tool

This patch should not modify a lot the behaviours of the onboarding
tool.
Its goal is mainly to remove duplicated as well as useless (because
copy/pasted from existing script files) code.

It assumes that the onboarding tool will be done on an empty database
and will skip steps that are not needed. For instance if a library
already exists, the first step will be skipped.

One of the main problem was the lack of feedback messages sent to the
user when something wrong/ok happened.

Explanation on main changes:
1. Use checkauth first, then get_template_and_user
=> As we do not know the template to use, it's better to use checkauth
first to know if the user is logged in, then retrieve the template we
need, depending on the success or the failure of the action
2. Create a @messages variables
Pushing messages to this variable and handling the messages via an
include files (onboarding_messages.inc) simplify error handling. Note
that we could remove this include file if we merge all the
onboardingstepX.tt files altogether
3. Simplify creation of the admnistrator user
This patch removes some unecessary checks done on the user's info
(passwd to short, mandatory fields

Todo (minor): Add style to feedback messages

Signed-off-by: Alex Buckley <alexbuckley@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 17855: No need to resend the library list to the template
Jonathan Druart [Mon, 17 Apr 2017 15:18:31 +0000 (12:18 -0300)]
Bug 17855: No need to resend the library list to the template

This has been done at the beginning of the script

Signed-off-by: Alex Buckley <alexbuckley@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 17855: Redirect to the installer if installation process is not done yet
Jonathan Druart [Mon, 17 Apr 2017 15:16:17 +0000 (12:16 -0300)]
Bug 17855: Redirect to the installer if installation process is not done yet

Signed-off-by: Alex Buckley <alexbuckley@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 17855: Do not create a new dbh, get it from C4::Context->dbh
Jonathan Druart [Mon, 17 Apr 2017 15:13:45 +0000 (12:13 -0300)]
Bug 17855: Do not create a new dbh, get it from C4::Context->dbh

Signed-off-by: Alex Buckley <alexbuckley@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 17855: perltidy onboarding.pl
Jonathan Druart [Mon, 17 Apr 2017 15:05:21 +0000 (12:05 -0300)]
Bug 17855: perltidy onboarding.pl

Signed-off-by: Alex Buckley <alexbuckley@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 17855 - Followup patch following requests in comments 176 and 177
Alex Buckley [Sun, 9 Apr 2017 05:30:05 +0000 (05:30 +0000)]
Bug 17855 - Followup patch following requests in comments 176 and 177

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 17855 - Reverted back to original step 3 in the web installer so there is no...
Alex Buckley [Sat, 18 Mar 2017 18:19:17 +0000 (18:19 +0000)]
Bug 17855 - Reverted back to original step 3 in the web installer so there is no basic and advanced setup mode and consequently no need for SQL files to be moved to a 'default' directory for all languages.

Onboarding tool and the rest of the web installer still exists in this
commit

How I tested in my VM (Current master):
- Dropped database
- Recreated database
- Went through installer
- Language en, Marc21
- Installed mandatory data only
- Went through Onboarding tool
- After finishing, logged in as superlibrarian
  that was created by onboarding tool
Everything worked fine.

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 17855: Onboarding tool
Alex Buckley [Thu, 9 Feb 2017 16:32:29 +0000 (17:32 +0100)]
Bug 17855: Onboarding tool

Tested 3 patches together on current master
- Dropped database
- Recreated database
- Went through installer
- Language en, Marc21
- Installed mandatory data only
- Went through Onboarding tool
- After finishing, logged in as superlibrarian
  that was created by onboarding tool
Everything worked fine.

Signed-off-by: Marc Véron <veron@veron.ch>
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 13835: Popup with searches: results hidden by language menu in footer
Marc Véron [Fri, 21 Apr 2017 19:22:44 +0000 (21:22 +0200)]
Bug 13835: Popup with searches: results hidden by language menu in footer

Language menus in pop up windows are not necessary and can hide the contents
(especially search results) on a narrow screen.

For an example, see screenshot in comment #3

This patch allows to mark pop p menus not to display the language footer.

To test:

- Reproduce issue from comment #3
- Apply patch
- Try to reproduce issue from comment #3
  -> language menu should no longer display
- Verify that language menu is suppresed in 'Add to ist' as well
  (from catalog search results, select an item, Add to:...)

Note: There will be more pop-ups with unwnated language selector.
      That can be resolved in follow up bugs.

Followed test plan which worked as intended
Signed-off-by: Alex Buckley <alexbuckley@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 agoUpdate Italian installer sample files for 17.05
Zeno Tajoli [Wed, 19 Apr 2017 12:51:19 +0000 (14:51 +0200)]
Update Italian installer sample files for 17.05

Update and translate sample SQL file of the Italian installer.

To test:
- Start with an empty database
- Install it-IT
- Run the web installer in it-IT/Italian
- Verify all files, especially sample notices, sample_frequencies,
  sample_numberpatterns load without any problems.

https://bugs.koha-community.org/show_bug.cgi?id=18456

While applying I got a 3-way-merge. Verified in staff client places
mentioned above, notices, frequencies, sample_numberpatterns, HSBND_FREQ
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 18479 - Holds 'Placed on' column in opac-user.pl not sorting correctly
Owen Leonard [Mon, 24 Apr 2017 12:36:58 +0000 (12:36 +0000)]
Bug 18479 - Holds 'Placed on' column in opac-user.pl not sorting correctly

Two columns in the user's holds table in the OPAC do not sort correctly
because they are not marked up correctly to enable date sorting: 'Placed
on' and 'Expires on.' This patch corrects it.

This patch also removes a stray </td> which was causing validation
errors.

To test, apply the patch and log into the OPAC with an account which has
multiple holds with differnt hold dates and expiration dates. Confirm
that sorting on these columns works correctly.

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 18453: Remove exports_enabled in circulation_batch_checkouts.tt
Jonathan Druart [Wed, 19 Apr 2017 15:32:06 +0000 (12:32 -0300)]
Bug 18453: Remove exports_enabled in circulation_batch_checkouts.tt

This is a c/p from circulation.tt, this variable is not needed in this
template

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 18453: Hide the export column when needed
Jonathan Druart [Wed, 19 Apr 2017 15:29:26 +0000 (12:29 -0300)]
Bug 18453: Hide the export column when needed

If exports_enabled is equal to "0" it will be evaluated to true.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
7 years agoBug 17916 - "Delete MARC modification template" fails to actually delete it
Owen Leonard [Tue, 25 Apr 2017 13:15:13 +0000 (13:15 +0000)]
Bug 17916 - "Delete MARC modification template" fails to actually delete it

The MARC modification templates' 'Delete' button fails because the event
handler has a "preventDefault" but the outcome of the confirmation
function must return true or false.

This patch removes the "preventDefault" from the .delete_template click
handler as well as a redundant onclick attribute from the delete link
itself.

To test, apply the patch and go to Tools -> MARC modification templates.
Clicking the delete button for any existing template should work
correctly.

Followed test plan, worked as intended

Signed-off-by: Alex Buckley <alexbuckley@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 18419 - Broken patron-blank image in viewlog.tt
Owen Leonard [Tue, 25 Apr 2017 16:16:49 +0000 (16:16 +0000)]
Bug 18419 - Broken patron-blank image in viewlog.tt

Because of a variable name collision the blank patron image doesn't
display in viewlog.tt. This patch moves the image from the template to
the stylesheet to avoid this problem.

This patch also replaces the blank patron image PNG file with an SVG
file. SVG support is wide enough to begin using whereever possible.

This patch also removes some inline CSS from circ-menu.inc and puts it
in the global stylesheet.

To test, apply the patch and clear your browser cache if necessary.

- Enable the patronimages system preference.
- View a patron account which lacks a patron image. All views (details,
  fines, notices, etc) should show the "blank" patron image, including
  the modification log view.
- View a patron account which has a patron image and check that it still
  displays correctly in all views.

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 15738: Show rental fees on OPAC summary page
Aleisha Amohia [Thu, 5 Jan 2017 02:01:57 +0000 (02:01 +0000)]
Bug 15738: Show rental fees on OPAC summary page

This patch adds a few lines that check for a rental fee on an item. If
yes, it will show in brackets as a rental fee on the OPAC summary page.

To test:
1) Have a borrower with an overdue item accruing fines, a lost item and
an item with a rental fee. Confirm the Fines column on the OPAC summary
page now shows you what you may expect to see for each item.

Sponsored-by: Catalyst IT
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 18482 False duplicates detected on adding a batch from a stage file
Olivier Crouzet [Sat, 22 Apr 2017 16:20:48 +0000 (18:20 +0200)]
Bug 18482 False duplicates detected on adding a batch from a stage file

When adding a batch from a stage file with defaut matching on
title/author, if a duplicate is detected, all following records
treated in the batch are discarded from import even if they are not duplicates

Signed-off-by: Alex Buckley <alexbuckley@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 18179: Update existing calls
Jonathan Druart [Tue, 18 Apr 2017 16:50:36 +0000 (13:50 -0300)]
Bug 18179: Update existing calls

This patch updates the existing occurrences of ->find called in a list
context.
There are certainly others that are not easy to catch with git grep.
Test plan:
Confirm that the 4 modified scripts still works as expected.

We need this one ASAP in master to make sure we will not get other
side-effects of this kind and to catch possible uncaught occurrences
before the release.

Tested scripts changed by this patch, they work 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 18179: Forbid list context calls for Koha::Objects->find
Jonathan Druart [Tue, 18 Apr 2017 16:49:18 +0000 (13:49 -0300)]
Bug 18179: Forbid list context calls for Koha::Objects->find

Reading https://perlmaven.com/how-to-return-undef-from-a-function
this sound like the more correct behaviour.

Considering:
$template->param(
    stuff => Koha::Stuffs->find( $id ),
    foo   => 1,
);
without this patch, if the $id does not represent any rows in the DB,
stuff will be assigned to 'foo' and $foo will be undef in the template.
That can lead to very bad side-effects.

With this patch we make sure that it will never happen again.

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

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 18467: Handle orders with deleted biblio when viewing a basket
Jonathan Druart [Fri, 21 Apr 2017 16:05:47 +0000 (13:05 -0300)]
Bug 18467: Handle orders with deleted biblio when viewing a basket

If the bibliographic record of an order has been removed, $order->{bibionumber}
is undefined. We need to handle this specific case correctly.

To test:
1 - Create a basket
2 - Order a bib
3 - Cancel order and delete record
4 - You cannot view basket
5 - Apply patch
6 - View basket
7 - There should not be an error
r calling count on undefined bib in basket.pl if order cancelled and
record deleted

Followed test plan, works as intended

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18471 - Receiving order with unitprice greater than 1000 processing incorrectly
Kyle M Hall [Fri, 21 Apr 2017 14:10:37 +0000 (10:10 -0400)]
Bug 18471 - Receiving order with unitprice greater than 1000 processing incorrectly

Receiving orders process the comma as a decimal point
Invoices are displaying incorrectly when formatting total

Test Plan:
1. Open a basket
2. Place an order for an item with price > 1000, $4367.00 for example
3. Close basket
4. Receive order
5. Note on orderreceive.pl the price is populate as "4,367.00"
6. Receive/Save
7. Note the 'Actual Cost' is now $4.00, verify db contains 4 as well
8. Cancel receipt
9. Receive again, this time enter price as "4367"
10. Receive/save
11. Note actual cost is correct
12. Finish receiving
13. Note invoice reads total as $4.00
14. Check db. price in aqorders is correct but displaying incorrectly
15. Apply this patch
16. Repeat step2 1. 14, note errors are fixed

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18461: (bug 13757 follow-up) Do not mix decode_json and to_json
Jonathan Druart [Mon, 24 Apr 2017 16:53:00 +0000 (13:53 -0300)]
Bug 18461: (bug 13757 follow-up) Do not mix decode_json and to_json

Internal server error while approving OPAC-edited patron attributes
containing umlauts (äöü)

If a OPAC user enters text containing umlauts (äöü) in a patron atribute
and saves it, the Staff client will get an inernal server error in
members-update.pl (approving).

E.g. a text like 111ä222 leads to the following in plack error log:

malformed UTF-8 character in JSON string, at character offset 14

To test:
- Reproduce problem above
- Apply patch
- Verify that Home > Patron > Update records displays without error
and 'New value' displays properly
- Approve!

Also, run the tests:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/Koha/Patron/Modifications.t
=> FAIL: Tests explode due to encoding problems in JSON handling
- Apply the patch
- Run the tests again:
 k$ prove t/db_dependent/Koha/Patron/Modifications.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18461: Make tests break on wrong UTF8 data handilng
Tomas Cohen Arazi [Mon, 24 Apr 2017 18:45:17 +0000 (15:45 -0300)]
Bug 18461: Make tests break on wrong UTF8 data handilng

This patch makes the tests fail if extended attributes handling fails due to
wrong UTF-8 data handling.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/Koha/Patron/Modifications.t
=> FAIL: Tests explode

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18066: Remove warnings from translate script
Jonathan Druart [Mon, 24 Apr 2017 19:26:31 +0000 (16:26 -0300)]
Bug 18066: Remove warnings from translate script

This patch removes the following warnings:
Use of uninitialized value $pref_name in concatenation (.) or string at
LangInstaller.pm

7 years agoBug 18452: Correcting 'url' to say 'URL' in catalog detail
Aleisha Amohia [Wed, 19 Apr 2017 01:03:15 +0000 (01:03 +0000)]
Bug 18452: Correcting 'url' to say 'URL' in catalog detail

To test:
1) Edit a record, put a URL in 856u and hit save
2) Confirm that url shows as URL in OPAC and staff client

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 15815: Reword confirm message when removing patrons from card batch
Aleisha Amohia [Tue, 18 Apr 2017 23:18:31 +0000 (23:18 +0000)]
Bug 15815: Reword confirm message when removing patrons from card batch

This patch rewords the confirm message when removing patrons from a card
batch.
From: "Are you sure you want to remove card number(s):1 from this
batch?"
To: "Are you sure you want to remove the selected patron(s) from this
batch?"

To test:
1) Go to Tools -> Patron Card Creator -> Manage batches
2) Edit a batch
3) Select one or more patrons and click 'Remove selected patrons' (not
individual Delete buttons)
4) Confirm the message is worded better and easier to understand
5) Click OK and confirm the patrons are deleted as expected

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18466: article requests box outline in opac
phette23 [Fri, 21 Apr 2017 00:15:57 +0000 (17:15 -0700)]
Bug 18466: article requests box outline in opac

To test:
1) apply patch
2) ensure ArticleRequests is set to Enable
3) sign in as a user with no article requests on the OPAC side
4) click the 'article requests' tab & see the box & message

Sponsored-By: California College of the Arts
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 15702: Recommended Counter-patch
Mark Tompsett [Fri, 20 Jan 2017 02:13:47 +0000 (21:13 -0500)]
Bug 15702: Recommended Counter-patch

As per comment #7, this patch affects AddMember and ModMember.
The test plan should be the same as comment #6.
Secondary patch with tests still to come.

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 15702: Add test cases for modified code
Mark Tompsett [Fri, 21 Apr 2017 12:58:03 +0000 (08:58 -0400)]
Bug 15702: Add test cases for modified code

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 18457: Add tests
Jonathan Druart [Mon, 24 Apr 2017 17:16:34 +0000 (14:16 -0300)]
Bug 18457: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18457 - process_message_queue.pl will die if a patron has no sms_provider_id...
Kyle M Hall [Wed, 19 Apr 2017 13:52:38 +0000 (09:52 -0400)]
Bug 18457 - process_message_queue.pl will die if a patron has no sms_provider_id set but sms via email is enabled for that patron

If SMS via Email is enabled, and a patron has opted for SMS messages, but has not selected a service provider, the cronjob will die with the error
Can't call method "domain" on an undefined value at /usr/share/koha/lib/C4/Letters.pm line 1055.
This will cause all messages that come after the error to not be sent!

Test Plan:
1) Enable SMS via Email
2) Enable SMS for a patron, but don't set a provider
3) Perform an action that will trigger an sms message to go into
   the holds queue ( item due, item checkout, etc )
4) Run process_message_queue.pl, note the error
5) Apply the patch
4) Run process_message_queue.pl, no error this time!

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
7 years agoBug 18435 - Language entered in Materials Specified does not display when items are...
Nick Clemens [Fri, 14 Apr 2017 17:07:39 +0000 (13:07 -0400)]
Bug 18435 - Language entered in Materials Specified does not display when items are checked out and checked in

This problem stems from bug 17642, if items.materials is not linked to
an authorized value the contents are being tossed out. We shuold display
them instead

To test:
1 - Ensure items.materials 952$3 is not mapped to an authorized value
2 - Add a value to an item
3 - Check the item out, note the materials does not display
4 - Check the item in, note the materials does not display
5 - Apply patch
6 - Check the item out, note the materials does display
7 - Check the item in, note the materials does display

Followed test plan, message about material displays as expected
whil checking out and in.
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 18468 - When adding from a staged file order discounts are not passed into C4...
Nick Clemens [Fri, 21 Apr 2017 01:36:44 +0000 (21:36 -0400)]
Bug 18468 - When adding from a staged file order discounts are not passed into C4::Acquisitions::populate_order_with_prices

To test:
1 - Setup a vendor with a discount
2 - Stage a file
3 - Create a basket
4 - Order from staged file
5 - Add a price but no discount
6 - Save order
7 - Note ecost is not discounted
8 - Apply patch
9 - Repeate 2-6
10 - Note ecost is discounted

Signed-off-by: Alex Buckley <alexbuckley@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 18409: Make the controller for holds use Koha::Holds
Tomas Cohen Arazi [Fri, 21 Apr 2017 23:34:00 +0000 (20:34 -0300)]
Bug 18409: Make the controller for holds use Koha::Holds

Recently, there's been a major fix on the REST api swagger spec,
which involved fixing boolean values so they are actually booleans
and Koha::Object was extended to handle that.
While the swagger spec for this endpoint got fixed, such is not the case
with the implementation (the controller class).

This patch fixes this situation by:
- Specifying boolean properties as boolean in the schema file
- Fixes the controller so it returns Koha::Hold objects instead of the
  hashref returned by GetReserve, which is wrong.
- Better (than empty) descriptions are added to 'suspend',
  'suspend_until' and 'lowestPriority' on the spec.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail, mostly due to error 500 results.
- Apply this patch
- Run:
 k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
- Sign off :-D

This can also be tested using any interface for REST apis.

Note: This endpoint lacks several of the new guidelines and is not
complete (there's no GET for single holds, etc). It is also missing
exception handling. There are probably
other bug reports for that, just thought it was worth mentioning.

Followed test plan and this patch worked as intended
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18300: [QA Follow-up] Fix return value inconsistency
Marcel de Rooy [Mon, 3 Apr 2017 19:43:48 +0000 (21:43 +0200)]
Bug 18300: [QA Follow-up] Fix return value inconsistency

As noted on bug report 17669, the return values of delete (both singular
and plural), delete_missing and delete_temporary should be consistent.

Removed the if-construction around full_path. We do not need it; in the
very exceptional case that full_path would be empty, we should delete
the record since the file is missing.

Adjusted POD and unit tests accordingly.

Test plan:
Run t/db_dependent/Upload.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: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18300: Delete missing upload records
Marcel de Rooy [Sun, 19 Mar 2017 16:25:01 +0000 (17:25 +0100)]
Bug 18300: Delete missing upload records

If you deleted files from the upload directories manually, or you rebooted
with files in the temporary upload folder, or for some other reason have
records without a file, you may want to cleanup your records in the
uploaded_files table.

This patch adds the method delete_missing to Koha::UploadedFiles. It also
supports a keep_record parameter to do a dry run (count the missing files
first).

Also, we add an option --uploads-missing to cleanup_database. If you add
the flag 1 after this option, you will delete missing files. If you add the
flag 0 or only use the option, you will count missing files.

A subtest is added to Upload.t for delete_missing tests.

Test plan:
[1] Run t/db_dependent/Upload.t
[2] Upload a file and delete the file manually.
[3] Run cleanup_database.pl --uploads-missing
    It should report at least one missing file now.
    Check that the record has not been deleted.
[4] Run cleanup_database.pl --uploads-missing 1
    It should report that it removed at least one file.
    Check that the record is gone.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18182: Fix Koha::RefundLostItemFeeRules
Jonathan Druart [Wed, 12 Apr 2017 18:20:10 +0000 (15:20 -0300)]
Bug 18182: Fix Koha::RefundLostItemFeeRules

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 18182: Tests all Koha::Objects-based modules
Jonathan Druart [Wed, 12 Apr 2017 18:19:33 +0000 (15:19 -0300)]
Bug 18182: Tests all Koha::Objects-based modules

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Added test description on line 387.
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 18182: [QA Follow-up] Fix a few typos, consistent rollback
Marcel de Rooy [Fri, 31 Mar 2017 11:32:55 +0000 (13:32 +0200)]
Bug 18182: [QA Follow-up] Fix a few typos, consistent rollback

Since we here only use one rollback and this test does not care, it is
more consistent to keep that pattern.
Additionally, promoting two globals to our.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 18182: Make TestBuilder capable of returning Koha::Object
Tomas Cohen Arazi [Tue, 28 Feb 2017 12:08:38 +0000 (09:08 -0300)]
Bug 18182: Make TestBuilder capable of returning Koha::Object

This patch adds a new method to t::lib::TestBuilder so it can return
Koha::Object-derived objects. The new method is called ->build_object
and requires the plural of the target class to be passed.

'class' is a mandatory param, and a warning is raised and undef is
returned if absent.

It accepts 'value' as the original ->build() method, and that is passed as-is
to ->build().

To test:
- Apply the patches
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/TestBuilder.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 18459: Add the Koha::Item->biblioitem method
Julian Maurice [Wed, 19 Apr 2017 15:01:54 +0000 (17:01 +0200)]
Bug 18459: Add the Koha::Item->biblioitem method

Test plan:
  prove t/db_dependent/Koha/Items.t

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 18448: Fix a few db_dependent tests
Marcel de Rooy [Sun, 16 Apr 2017 16:50:58 +0000 (18:50 +0200)]
Bug 18448: Fix a few db_dependent tests

Tests in db_dependent may expect a Koha database, but should not rely on
hardcoded categories, currencies, branch codes, etc.

This patch fixes a bunch of those. But this is a continuous project. We also
need QA to closely watch new edits.

Accounts.t: hardcoded category PT replaced
Acquisition/OrderFromSubscription.t: hardcoded USD
Acquisition/StandingOrders.t: same
ArticleRequests.t: create itemtype, branch and category for testing
AuthorisedValues.t: remove $dbh, add two test branches
AuthoritiesMarc.t: add hardcoded GEOGR_NAME authtype
Bookseller.t: add test currency
Koha.t: add test itemtype instead of hardcoded BK
UsageStats.t: add test branch and category

Test plan:
Run the adjusted tests.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
All tests successful (see comment #9)
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 18427 - DBRev 16.12.00.026
Kyle M Hall [Fri, 21 Apr 2017 18:03:42 +0000 (14:03 -0400)]
Bug 18427 - DBRev 16.12.00.026

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18427: Add a primary key to serialitems
Marcel de Rooy [Thu, 13 Apr 2017 11:34:36 +0000 (13:34 +0200)]
Bug 18427: Add a primary key to serialitems

We drop the unique index serialitemsidx and add a primary key consisting
of itemnumber just as the unique key did.

Test plan:
Run the db revision.
Apply bug 18182. The TestBuilder.t should no longer fail on serialitems.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 18427: DBIx schema changes
Marcel de Rooy [Thu, 13 Apr 2017 11:53:37 +0000 (13:53 +0200)]
Bug 18427: DBIx schema changes

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 17669 - DBRev 16.12.00.025
Kyle M Hall [Fri, 21 Apr 2017 17:59:52 +0000 (13:59 -0400)]
Bug 17669 - DBRev 16.12.00.025

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17669: Remove warning 'variable $kohaobj masks earlier declaration in same scope'
Jonathan Druart [Thu, 20 Apr 2017 04:10:14 +0000 (01:10 -0300)]
Bug 17669: Remove warning 'variable $kohaobj masks earlier declaration in same scope'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17669: [QA Follow-up] More consistency in return values of delete
Marcel de Rooy [Mon, 3 Apr 2017 17:14:52 +0000 (19:14 +0200)]
Bug 17669: [QA Follow-up] More consistency in return values of delete

See Bugzilla comment36 (QA request).

Koha::UploadedFile->delete
Returns 1, 0E0 or -1 (unknown).

Koha::UploadedFiles->delete and delete_temporary
Returns number of deleted records, 0E0 or -1.

POD lines are corrected accordingly. Unit tests adjusted too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Added a note that Koha::Object->delete itself is not completely consistent
with Koha::Objects->delete (DBIx). The singular may return 1 when it
gets 0E0 from DBIx, while the plural one may return 0E0. But should be
handled somewhere else.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17669: [QA Follow-up] Allow zero in temp-uploads-days
Marcel de Rooy [Fri, 31 Mar 2017 06:31:10 +0000 (08:31 +0200)]
Bug 17669: [QA Follow-up] Allow zero in temp-uploads-days

As requested by QA on comment33.
If the pref is 0 or the overriding command line parameter is 0, all
temporary files will be deleted. But if the pref is NULL or empty string,
we will not delete files.

Also adjusted the description of the preference in this regard.

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 17669: [QA Follow-up] Rename --temp-uploads-override parameter
Marcel de Rooy [Thu, 30 Mar 2017 06:51:17 +0000 (08:51 +0200)]
Bug 17669: [QA Follow-up] Rename --temp-uploads-override parameter

As requested by QA on comment25.

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 17669: [QA Follow-up] Rename preference by removing underscores
Marcel de Rooy [Thu, 30 Mar 2017 06:42:38 +0000 (08:42 +0200)]
Bug 17669: [QA Follow-up] Rename preference by removing underscores

Requested by QA on comment25.
Result of:
git grep -l Upload_PurgeTemporaryFiles_Days | xargs sed -i -e "s/Upload_PurgeTemporaryFiles_Days/UploadPurgeTemporaryFilesDays/g"

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 17669: Add new switch to crontab example and debian daily cron file
Marcel de Rooy [Wed, 14 Dec 2016 12:46:06 +0000 (13:46 +0100)]
Bug 17669: Add new switch to crontab example and debian daily cron file

The new switch for deleting temporary uploads in cleanup_database can
be added to cron.

Note: Since the option --temp-uploads does only purge temporary uploads
when triggered by the preference Upload_PurgeTemporaryFiles_Days, it can
be safely added here.

Test plan:
There is actually nothing to test here if you followed the preceding test
plans. Just verify that the switch is inserted ocrrectly.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17669: Incorporate the changes in cleanup_database
Marcel de Rooy [Tue, 13 Dec 2016 15:44:26 +0000 (16:44 +0100)]
Bug 17669: Incorporate the changes in cleanup_database

Two command line options are added:
[1] -temp-uploads to indicate that you want to purge these uploads,
[2] -temp-uploads-override DAYS to (optionally) tell that you want to
    override the corresponding pref value.

Test plan:
[1] Check the modified usage statement.
[2] If needed, backup your temporary uploads :)
    In case you do not have one, add a temporary one with Tools/Upload.
    Note: Do not choose an upload category.
[3] Set pref to 0, and run cleanup_database with only --temp-uploads.
    No files should be deleted.
[4] Check number of "old" temp uploads. Set pref to nonzero value.
    Verify that the oldest are gone (depending on the value chosen).
[5] Set pref to 0 again.
    If all uploads are gone now, add a new one with Tools/Upload.
    Run cleanup_database with --temp-uploads --temp-uploads-override -1
    All temporary files are gone.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17669: Add delete_temporary method with unit tests
Marcel de Rooy [Tue, 13 Dec 2016 13:04:29 +0000 (14:04 +0100)]
Bug 17669: Add delete_temporary method with unit tests

Test plan:
Run t/db_dependent/Upload.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17669: Small change to sub delete
Marcel de Rooy [Mon, 20 Mar 2017 07:43:32 +0000 (08:43 +0100)]
Bug 17669: Small change to sub delete

Instead of looping through _resultset here and wrapping the results,
we should use a Koha::Objects instance. Since the method may be called
as a class method, we create an instance if needed.

Test plan:
Run t/db_dependent/Upload.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17669: Introduce new preference for purging temp uploads
Marcel de Rooy [Tue, 13 Dec 2016 13:03:27 +0000 (14:03 +0100)]
Bug 17669: Introduce new preference for purging temp uploads

The new preference is: Upload_PurgeTemporaryFiles_Days.
It controls if the cron job will delete temporary uploaded files and if so,
how many days should have passed before doing so.

Since the default value is empty, it will not start deleting these uploads
until you change the pref. No behavior change. But the dbrev will print a
message if you already have temporary uploads.

Test plan:
[1] Check Administration, Preferences, Tools for the new pref.
[2] Run the db rev.
    If you have temporary uploads, check the reported count.
[3] Bonus: Run sysprefs.sql in a safe environment.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17964: Replace next with last
Jonathan Druart [Fri, 24 Mar 2017 01:13:17 +0000 (22:13 -0300)]
Bug 17964: Replace next with last

We certainly always want to retrieve the last row of a given search.
If it not sufficient we will need to rethink this code.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17964: [QA Follow-up] Test descriptions, typo
Marcel de Rooy [Fri, 24 Mar 2017 08:05:44 +0000 (09:05 +0100)]
Bug 17964: [QA Follow-up] Test descriptions, typo

Typo: have been checkin => checked.
And five test descriptions ;)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17964: Support date formatting
Jonathan Druart [Sat, 21 Jan 2017 15:02:50 +0000 (16:02 +0100)]
Bug 17964: Support date formatting

Using the KohaDates plugin will allow us to format dates as we want,
using the same filters as the ones defined in the KohaDates TT plugin.

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>