koha.git
7 years agoBug 18432 : Follow up - Updating to use they/them
Chris Cormack [Tue, 18 Apr 2017 21:32:59 +0000 (09:32 +1200)]
Bug 18432 : Follow up - Updating to use they/them

Updating to use they/them and skipping the ones changed to 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 18432: code comments assume male gender
phette23 [Thu, 13 Apr 2017 21:26:07 +0000 (14:26 -0700)]
Bug 18432: code comments assume male gender

Comments throughout the Koha codebase assume that
all librarians or borrowers are male by using the
pronoun 'he' universally. This patch changes to
'he or she' / 'him or hers'.

Testing plan:

- ensuring modifying tests still pass:
+ C4/SIP/t/06patron_enable.t
+ t/db_dependent/Circulation.t
+ t/db_dependent/Koha/Patrons.t
+ t/db_dependent/Reserves.t

Sponsored-By: California College of the Arts
No code changes detected.
Signed-off-by: Marc Véron <veron@veron.ch>
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 18429 - Receiving an item should update the datelastseen
Nick Clemens [Thu, 13 Apr 2017 13:55:15 +0000 (09:55 -0400)]
Bug 18429 - Receiving an item should update the datelastseen

To test:
0 - Ensure AcqCreateItem is set to 'placing an order'
1 - Order some items, note entrydate and datelastseen match
2 - Alter those dates to be earlier than today (or wait some days)
3 - Recieve the item and note datelast seen not updated
4 - Apply patch
5 - Repeat 1-3
6 - Date last seen should be updated.

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Works as expected.
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18420: Fix HoldFulfillmentPolicy.t and Passwordrecovery.t
Marcel de Rooy [Fri, 14 Apr 2017 10:46:13 +0000 (12:46 +0200)]
Bug 18420: Fix HoldFulfillmentPolicy.t and Passwordrecovery.t

We are going out of scope here, but these tests need a branch/item.

Test plan:
Run the adjusted tests.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18420: Replace hardcoded EUR in OrderUsers.t
Marcel de Rooy [Thu, 13 Apr 2017 07:02:55 +0000 (09:02 +0200)]
Bug 18420: Replace hardcoded EUR in OrderUsers.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18420: Do not use 'S' as patron category code in other tests
Jonathan Druart [Tue, 11 Apr 2017 10:48:54 +0000 (07:48 -0300)]
Bug 18420: Do not use 'S' as patron category code in other tests

Test plan:
prove all these tests, they must all pass

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18420: Use TestBuilder to create a patron category in Suggestions.t
Jonathan Druart [Tue, 11 Apr 2017 10:33:32 +0000 (07:33 -0300)]
Bug 18420: Use TestBuilder to create a patron category in Suggestions.t

No need to do it that way, let's use TestBuilder.

Test plan:
  prove t/db_dependent/Suggestions.t
should still return green

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18420: Fix Members.t when no patron category 'S' exists
Jonathan Druart [Wed, 12 Apr 2017 14:10:57 +0000 (11:10 -0300)]
Bug 18420: Fix Members.t when no patron category 'S' exists

No need to create Staff users here.

Test plan:
  prove t/db_dependent/Members.t
should return green, even if no categories.categorycode 'S' exists

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18420: Fix Passwordrecovery.t when no patron category 'S' exists
Jonathan Druart [Wed, 12 Apr 2017 14:06:43 +0000 (11:06 -0300)]
Bug 18420: Fix Passwordrecovery.t when no patron category 'S' exists

No need to create Staff users here.

Test plan:
  prove t/db_dependent/Passwordrecovery.t
should return green, even if no categories.categorycode 'S' exists

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18420: Fix Budgets.t when no patron category 'S' exists
Jonathan Druart [Wed, 12 Apr 2017 14:03:10 +0000 (11:03 -0300)]
Bug 18420: Fix Budgets.t when no patron category 'S' exists

No need to create Staff users here.

Test plan:
  prove t/db_dependent/Budgets.t
should return green, even if no categories.categorycode 'S' exists

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18335 - Check in: Make patron info in hold messages obey syspref AddressFormat
Marc Véron [Sun, 26 Mar 2017 15:26:22 +0000 (17:26 +0200)]
Bug 18335 - Check in: Make patron info in hold messages obey syspref AddressFormat

When checking in, information about patrons with a hold always display
in an US style. Address information should opey the system preference
AddressFormat

To reproduce:
- Set syspref AddressFormat to German style
- Check out an item to a patron A
- Put a hold on this item for patron B
- Check in item using the Check in field in page header
- Result: In message 'Hold found', address does not display in German
  style

To test:
- Apply patch
- Repeat steps above
- Verify that address displays as expected

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 18460: Fix undefined itemtype warning in Serials.t
Tomas Cohen Arazi [Wed, 19 Apr 2017 15:15:46 +0000 (12:15 -0300)]
Bug 18460: Fix undefined itemtype warning in Serials.t

This patch makes the test create an itemtype, and use it for the created item so there's no warning.

To test:
- Run:
  $ prove t/db_dependent/Serials.t
=> FAIL: item-level_itypes set but no itemtype set... warning raised
- Apply the patch
- Run:
  $ prove t/db_dependent/Serials.t
=> SUCCESS: Tests pass and no warning is raised
- Sign off :-D

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 12021 - SIP2 checkin should alert on transfer and use CT for return branch
Benjamin Rokseth [Tue, 1 Apr 2014 12:07:59 +0000 (14:07 +0200)]
Bug 12021 - SIP2 checkin should alert on transfer and use CT for return branch

This small patch corrects the SIP2 checkin response if branch transfer is needed.
It depends on bug 7981 and also removes an obsolete alert check in SIP2.

Test plan:
 - apply bug 7981
 - make sure syspref AutomaticItemReturn is false
 - check 'Return policy' in 'Default checkout, hold and return policy'
 - make a SIP2 checkout and checkin from a branch different than item's home branch.
 - verify that SIP2 response gives alert CV04 (=send to different branch)
 - also verify that response field CT gives correct branch according to 'Return policy'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Followed test plan, works as expected
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18423 - Followup - enable Add child button for institutional borrowers
Nick Clemens [Tue, 18 Apr 2017 18:03:37 +0000 (14:03 -0400)]
Bug 18423 - Followup - enable Add child button for institutional borrowers

If they can have guarantors and we shwo the button on one page I think
we should in fact show it on all.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18423 - Add 'Add child' button to files, housebound, and deletemem pages
Nick Clemens [Tue, 18 Apr 2017 17:53:54 +0000 (13:53 -0400)]
Bug 18423 - Add 'Add child' button to files, housebound, and deletemem pages

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18423 Follow-up - Add 'Add child' button to statistics tab
Nick Clemens [Mon, 17 Apr 2017 16:32:56 +0000 (12:32 -0400)]
Bug 18423 Follow-up - Add 'Add child' button to statistics tab

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 18423 follow up - fix display off add child on members/notices.pl
Nick Clemens [Wed, 12 Apr 2017 15:32:11 +0000 (11:32 -0400)]
Bug 18423 follow up - fix display off add child on members/notices.pl

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 18423 - Add child button not always appearing - problem in template variable
Nick Clemens [Wed, 12 Apr 2017 14:23:56 +0000 (10:23 -0400)]
Bug 18423 - Add child button not always appearing - problem in template variable

This patch removes the retrieval of the syspref borrowerRelationship
from the scripts and moves it to a check using the Template Toolkit
plugin

To test:
1 - Apply patch
2 - Ensure 'Add child' button displays appropriately on all member pages.

Tested 3 pateches together, 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 17911: Message and timeout mismatch
Mark Tompsett [Mon, 16 Jan 2017 04:26:33 +0000 (23:26 -0500)]
Bug 17911: Message and timeout mismatch

The installation step 3 has a meta refresh of 10 seconds,
but the message says 5 seconds. People could get impatient.

TEST PLAN
---------
1) Fresh install
   -- notice the discrepancy on the web installation.
2) drop and create the DB
3) apply the patch
4) run the web install
   -- notice it refreshes faster (5 seconds vs 10 seconds)
5) run koha qa test tools

Works as intended and passes qa test tool
 OK koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt
  OK    forbidden patterns
  OK     git manipulation
  OK      spelling
  OK   tt_valid
  OK    valid_template

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 17814: koha-plack --stop should make sure that Plack really stop
pongtawat [Mon, 26 Dec 2016 10:50:50 +0000 (17:50 +0700)]
Bug 17814: koha-plack --stop should make sure that Plack really stop

koha-plack --stop doesn't ensure that Plack was really stopped before
returning

So in case that koha-plack --stop was quickly follows by koha-plack
--start (e.g. logrotate), it could leave Plack in stop state. This is
due to koha-plack --start think that Plack was already started, while it
actually is being stopped.

For me I think this is the cause why I got random Plack stop when
logrotate is run.

It should be similar to the case of Zebra in Bug #16885, and the
solution might be the same: adding "--retry=TERM/30/KILL/5;" to
start-stop-daemon command.

TEST PLAN
---------
1) Login to staff client and do something that will hold connection for
a long time, e.g. a batch import or a slow report.
2) sudo koha-plack --stop mykoha
3) ps aux | grep plack   <-- a Plack process will still running work in
1)
4) wait for 1) to finish and all Plack processes exit
5) sudo koha-plack --start mykoha
6) apply the patch
7) repeat step 1)-2)
8) ps aux | grep plack   <-- There should be no Plack process running
now
9) Note that work in step 1) might get terminated midway. Since we force
Plack to stop after some wait.

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 17502: Add info when throwing the exception
Jonathan Druart [Wed, 19 Apr 2017 18:34:17 +0000 (15:34 -0300)]
Bug 17502: Add info when throwing the exception

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17502: Throw some exceptions in output_pref
Marcel de Rooy [Thu, 23 Mar 2017 08:35:57 +0000 (09:35 +0100)]
Bug 17502: Throw some exceptions in output_pref

Test plan:
Run the adjusted t/DateUtils.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
NOTE: This patch is amended in QA. The exceptions are moved from a separate
module to the general section of Exceptions.pm.

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 17502: Add type check to output_pref
Marcel de Rooy [Thu, 27 Oct 2016 07:11:03 +0000 (09:11 +0200)]
Bug 17502: Add type check to output_pref

This patch makes the following changes:
[1] In Koha/DateUtils.pm, sub output_pref:
    Add a test if $dt is really a DateTime before calling method ymd.
    Preventing a crash like:
    Can't locate object method "ymd" via package "dateonly".
    See also BZ 17502/15822.
[2] Adds a few unit tests in t/DateUtils.t.

Test plan:
[1] Run the adjusted unit test t/DateUtils.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 18364: [Follow-up] Also add an environment variable to prevent locking
Marcel de Rooy [Thu, 20 Apr 2017 10:52:47 +0000 (12:52 +0200)]
Bug 18364: [Follow-up] Also add an environment variable to prevent locking

The test in SendCirculationAlert is extended by adding an env var
called KOHA_NO_TABLE_LOCKS. If this var is set to a true value,
the table locking is skipped too.

This is useful when running a test without prove. The variable could be
set in a shell profile.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18364: Do not LOCK/UNLOCK tables from tests
Jonathan Druart [Fri, 31 Mar 2017 16:43:38 +0000 (13:43 -0300)]
Bug 18364: Do not LOCK/UNLOCK tables from tests

From the MySQL doc:
"LOCK TABLES is not transaction-safe and implicitly commits any active transaction before attempting to lock the tables."
If the LOCK/UNLOCK statements are executed from tests, the current transaction will be committed.
To avoid that we need to guess if this code is execute from testsa or not (yes it is a bit hacky)

Better ideas are welcome!

Another fix would have been to revert
  commit be156d9ad9e5bcfadab34d44f90e04fd61e256ad
  Bug 15854: Use a READ and WRITE LOCK on message_queue
but theorically a race is still possible.

Existing tests seem to be safe, to test this patch you will need new
tests from bug 17964.
Test plan:
  prove t/db_dependent/Letters/TemplateToolkit.t
twice, and notice that changes have been comitted.

Signed-off-by: Nick Clemens <nick@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 18439 - Resend button for notices being hidden by CSS and never unhidden
Nick Clemens [Mon, 17 Apr 2017 17:22:24 +0000 (13:22 -0400)]
Bug 18439 - Resend button for notices being hidden by CSS and never unhidden

Current jQuery is not unhiding resend button, this patch adds an id
and a toggle command

To test:
1 - Enable EnhancedMessagingPreferences
2 - Find a patron with sent or failed messages
3 - Note you can expand message, but not resend
4 - Apply patch
5 - Note that on expanding message a 'Resend' button appears
6 - Ensure resend button operates as expected

Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18001 - LocalHoldsPriority can cause multiple holds queue lines for same hold...
Kyle M Hall [Thu, 26 Jan 2017 14:31:35 +0000 (14:31 +0000)]
Bug 18001 - LocalHoldsPriority can cause multiple holds queue lines for same hold request

If LocalHoldsPriority is enabled, and a record level request has more
than one item that could fill that hold, there is a possibility that a
holds queue row will be generated for the request for each of the
available items!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18001 - Unit Test
Kyle M Hall [Tue, 18 Apr 2017 11:38:42 +0000 (07:38 -0400)]
Bug 18001 - Unit Test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: Re-add the use Koha in orderreceive
Jonathan Druart [Thu, 20 Apr 2017 12:56:09 +0000 (09:56 -0300)]
Bug 17835: Re-add the use Koha in orderreceive

It is still used for getitemtypeinfo, at least.

7 years agoBug 18372 - transits are not created at check in despite user responsing Yes to the...
Owen Leonard [Tue, 11 Apr 2017 16:45:40 +0000 (16:45 +0000)]
Bug 18372 - transits are not created at check in despite user responsing Yes to the prompt

If the AutomaticItemReturn system preference is set to "Don't" and you
check in an item which belongs to another library, a dialog will ask you
if you want to transfer. This patch corrects a bug to enable the "Yes"
buttons to work, triggering the transfer.

To test, apply the patch and check in an item which belongs to another
library. In the dialog, click the 'Yes' button and confirm that the item
has been made 'in transit' to the correct library.

Perform the same test with the 'Yes, print slip' and 'No' buttons and
confirm they are working correctly.

Since this patch changes the behavior of many other popups triggered
from this template, test other operations which trigger a 'print slip'
option like:

- Checking in an item which is part of a rotating collection
- Checking in an item which is on hold for a patron

Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: (followup) Make TestBuilder skip views
Tomas Cohen Arazi [Wed, 19 Apr 2017 14:19:26 +0000 (11:19 -0300)]
Bug 17835: (followup) Make TestBuilder skip views

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
7 years agoBug 18321: Correctly calculate switch_onsite_checkout
Jonathan Druart [Fri, 31 Mar 2017 03:24:09 +0000 (00:24 -0300)]
Bug 18321: Correctly calculate switch_onsite_checkout

Silly error here, the $switch_onsite_checkout is not correctly
calculated, it should not only be set to the value of the syspref, but
meet all the conditions.

Test plan:
Set a circ rule with number of on-site checkout = 2 and number of
checkouts = 2.
Switch on both ConsiderOnSiteCheckoutsAsNormalCheckouts and SwitchOnSiteCheckouts

Do a regular checkout
Do another regular checkout
At this point you have reach the maximum number of checkouts allowed.
Not try another one.
=> Without this patch you will not get the warning
=> With this patch you will see 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 18321: Add tests
Jonathan Druart [Fri, 31 Mar 2017 03:23:19 +0000 (00:23 -0300)]
Bug 18321: Add tests

Clean a bit existing tests by adding default values and add a test to
highlight the issue.

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 17835: [QA Follow-up] Fix opac-search.pl
Marcel de Rooy [Fri, 14 Apr 2017 06:58:30 +0000 (08:58 +0200)]
Bug 17835: [QA Follow-up] Fix opac-search.pl

Resolves:
Global symbol "$itemtypes_nocategory" requires explicit package name.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested the added line with a debug statement. See itemtype facets in the
search results.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: Mock language pref value
Jonathan Druart [Thu, 9 Feb 2017 08:15:29 +0000 (09:15 +0100)]
Bug 17835: Mock language pref value

That way if prefs contain other languages, the test will still pass.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: Add an additional LEFT JOIN condition using DBIx::Class
Jonathan Druart [Tue, 3 Jan 2017 12:35:46 +0000 (13:35 +0100)]
Bug 17835: Add an additional LEFT JOIN condition using DBIx::Class

The previous query was wrong. If an item type did not contain the
translation in the interface's language, the ->search_with_localization
did not return it at all.

What we need is definitely to add a second condition on the join.

For reference:
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Relationship/Base.pm#condition
https://blog.afoolishmanifesto.com/posts/dbix-class-parameterized-relationships/

That sounds hacky but seems to be the DBIx::Class path to follow.

Bug 17835: follow-up

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: Remove the subroutine GetItemTypes
Jonathan Druart [Tue, 3 Jan 2017 10:36:25 +0000 (11:36 +0100)]
Bug 17835: Remove the subroutine GetItemTypes

At this point the subroutine is no longer in used.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: Replace GetItemTypes with Koha::ItemTypes
Jonathan Druart [Tue, 3 Jan 2017 10:05:15 +0000 (11:05 +0100)]
Bug 17835: Replace GetItemTypes with Koha::ItemTypes

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: Do not reselect translated_description if comes from search_with_localization
Jonathan Druart [Tue, 3 Jan 2017 08:22:48 +0000 (09:22 +0100)]
Bug 17835: Do not reselect translated_description if comes from search_with_localization

If the Koha::ItemType object has been instanciated from a call to
Koha::ItemTypes->search_with_localization, we already have the
translated_description value. So there is no need to fetch it again from
the DB. This is what this trick does: if the translated_description
column exist in the DBIx::Class result source's column list, that means
the value has already been retrieved.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17835: Create a ItemtypeLocalization view
Jonathan Druart [Mon, 2 Jan 2017 16:29:32 +0000 (17:29 +0100)]
Bug 17835: Create a ItemtypeLocalization view

To properly move C4::Koha::GetItemTypes to Koha::ItemTypes we need
DBIx::Class to make a join on the localization table to retrieve the
possible translated description of the item types.
To do so there are 2 possibilities. The first one would have been to
rename the localization table to something like itemtype_localization.
That way we could have had a relationship between
itemtype_localization.code and itemtypes.itemtype
That would have meant to create one table per "entity" (here an entity
is itemtype) we allow the translability. There are pros and cons for
this choice, so I opt for another solution.
The other solution is to create a view on top of this localization
table. With this new view we can define the missing relationship.

That sounds like a quite clean solution and easy to implement.
Once we have this relationship, the
Koha::ItemTypes->search_with_localization will join on this view an
return the same result as GetItemTypes( style => 'array' ).
To replace
    GetItemtypes( style => 'hash' )
which is the default behavior of this subroutine, we can do something like:
    my $itemtypes = Koha::ItemTypes->search_with_localization;
    my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };

This patchset must not introduce big changes but it changes certain
behaviors (which were wrong) in some scripts. Indeed sometimes the
descriptions of the item types were not the translated ones. Moreover it
happens that the item types displayed in a dropdown list were not
ordered by translated description, but by description of code
(itemtypes.itemtype value). These 2 behaviors are what we expect.

Test plan:
Bugs will be hard to catch since these patches change a lot of file, it
will be easier to read the diff and catch possible typos or logic
errors.
However signoffers can focus on modified files and the item types
values.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17821 - due date in intranet search results should use TT date plugin
Fridolin Somers [Wed, 28 Dec 2016 14:08:42 +0000 (15:08 +0100)]
Bug 17821 - due date in intranet search results should use TT date plugin

Intranet search results displays due date from item onloan.
This should use the TT date plugin.

Test plan :
- set syspref dateformat not on yyyy-mm-dd, for example dd/mm/yyyy
- checkout an item
- at intranet, perform a search where you see the item
=> You must see : "date due : dd/mm/yyyy"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 12930: Web installer does not show login errors
Alex Buckley [Sat, 8 Apr 2017 23:18:23 +0000 (23:18 +0000)]
Bug 12930: Web installer does not show login errors

Implemented invalid_username_or_password template
variable being handed to Auth.tt. Removed indentation
changes and modification to return value of checkpw

Test plan:
See comment #2

Alternative test plan:
- Clear session cookies or close / open your browser
- Go to  [MY SERVER]/cgi-bin/koha/installer/install.pl
- Verify that message appears if wrong username/pw provided
- Verify that you can log in with databas administrator account

Tested with alternative test plan, works as expected. Title and
description in commit message adapted.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18373: Re-add UpgradeBackup.pm
Jonathan Druart [Mon, 3 Apr 2017 15:50:27 +0000 (12:50 -0300)]
Bug 18373: Re-add UpgradeBackup.pm

Bug 18028 removed the install_misc directory but
install_misc/UpgradeBackup.pm was still used by the 'upgrade' rule of
make.

Other files from install_misc were useless to it may be better not to
reintroduce this directory with only 1 file.

Test plan:
`make`
`sudo make install`
`make upgrade`

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 14537 - DBRev 16.12.00.024
Kyle M Hall [Thu, 13 Apr 2017 13:14:24 +0000 (09:14 -0400)]
Bug 14537 - DBRev 16.12.00.024

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14537: [QA Follow-up] Remove one overdues residue in pref description
Marcel de Rooy [Fri, 7 Apr 2017 09:14:38 +0000 (11:14 +0200)]
Bug 14537: [QA Follow-up] Remove one overdues residue in pref description

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14537: Renaming OverdueNoticeBcc to NoticeBcc
Aleisha Amohia [Wed, 5 Apr 2017 04:19:18 +0000 (04:19 +0000)]
Bug 14537: Renaming OverdueNoticeBcc to NoticeBcc

To test:
1) Apply patch and update database
2) Run 'git grep "OverdueNoticeBcc"' and confirm there are no other
instances

Sponsored-by: Catalyst IT
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988 - DBRev 16.12.00.023
Kyle M Hall [Thu, 13 Apr 2017 13:09:05 +0000 (09:09 -0400)]
Bug 9988 - DBRev 16.12.00.023

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: [QA Follow-up] Satisfy QA issues
Marcel de Rooy [Tue, 11 Apr 2017 12:58:41 +0000 (14:58 +0200)]
Bug 9988: [QA Follow-up] Satisfy QA issues

[1] See comment102. Moved sub reporting_tag_xml to MergeRequest.pm.
    Adjusted t/db_dependent/Koha/Authorities.t accordingly.
    This resolves the C3 inconsistent hierarchy errors.
[2] Removed empty POD section Instance Methods from MergeRequests.
    This resolves the POD error in comment102 point 2.
[3] Include a tag 100 for UNIMARC in reporting_tag_xml to resolve an error
    on encoding in MARC::File::XML. Subtest for oldmarc and subtest for
    reporting_tag_xml adjusted accordingly.

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 9988: Add the cronjob and print an upgrade message
Marcel de Rooy [Thu, 23 Feb 2017 11:23:36 +0000 (12:23 +0100)]
Bug 9988: Add the cronjob and print an upgrade message

The Debian cron file and the misc crontab example are updated.
A message is printed when upgrading.

Note: At this moment the merge cron job is run once a day. This is imo a
good starting point. The load for this job greatly depends on the value of
pref AuthorityMergeLimit. Of course you can schedule the job more often,
and if this need is felt more globally, we can adjust it later.

Test plan:
[1] Run the dbrev and see the message.
[2] Read the changes to the cron files.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Refactor the cron script
Marcel de Rooy [Wed, 22 Feb 2017 15:51:58 +0000 (16:51 +0100)]
Bug 9988: Refactor the cron script

The cron job is moved from migration tools to cronjobs. And renamed to
a plural form. The script is now based on Koha objects. It does no longer
include the code to merge one record. This can be done via the interface,
and will be added to a maintenance script on bug 18071. Should not be part
of this cron job.

Adding a cron_cleanup method to MergeRequests; this method is called from
the cron script to reset older entries still marked in progress and to
also remove old processed entries. Tested in a separate unit test.

Test plan:
[1] Run t/db_dependent/Authorities/MergeRequests.t
[2] Set AuthorityMergeLimit to 0. (All merges are postponed.)
[3] Modify an authority linked to a few records.
[4] Delete an authority linked to a few records with batch delete tool.
[5] And select two auth records with linked records.
    Merge these two records with authority/merge.pl.
    Note: Do not select Default. See also bug 17380.
[6] Check the need_merge_authorities table for inserted records.
[7] Run misc/cronjobs/merge_authorities.pl -b and inspect the linked
    records and the record status in need_merge_authorities.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Few subtle changes for postponed merge
Marcel de Rooy [Thu, 23 Feb 2017 11:46:52 +0000 (12:46 +0100)]
Bug 9988: Few subtle changes for postponed merge

The fails in the previous test showed that we need the first three
changes here. Some final polishing in points 4 to 6.

[1] Sub merge: Refine the condition for initializing $tags_new.
    A postponed 'modify'-merge (A to B) makes that $authtypefrom is not
    defined when running merge later. When crossing the type boundary, we
    need a new field too.
[2] Sub merge: Add condition for an empty @record_to array.
    This indicates also that a field should be removed, since we should
    otherwise only add a $9 subfield.
[3] Sub merge: Adjust initializing @record_from.
    This change is tested by verifying a cleared subfield in the test.
[4] DelAuthority: Adding a skipmerge parameter to allow the call from
    authorities/merge.pl to skip an unneeded merge.
    This also prevents that the 'delete-merge' would precede the
    'modify-merge' under a hypothetical race condition.
[5] DelAuthority: There is actually no need to call GetAuthority.
    The subfields of the old record are not relevant in this case.
[6] Added a few POD lines to merge.
[7] Removed a trailing space in a comment line in merge.

Test plan:
[1] Run t/db_dependent/Authorities/Merge.t.
    The last subtest should no longer fail now.
[2] See test plan of next patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Add a subtest for specific postponed merge issues
Marcel de Rooy [Thu, 23 Feb 2017 11:46:52 +0000 (12:46 +0100)]
Bug 9988: Add a subtest for specific postponed merge issues

This subtest shows that we need a few little tweaks to make merge
work in some specific postponed merge situations.

Test plan:
[1] Run t/db_dependent/Authorities/Merge.t.
    The last subtest should fail.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Remove further references to dontmerge
Marcel de Rooy [Wed, 22 Feb 2017 09:53:03 +0000 (10:53 +0100)]
Bug 9988: Remove further references to dontmerge

[1] The preference was sent to HEA. We can now send both AuthorityMergeMode
    as well as AuthorityMergeLimit.
[2] A comment in authorities/merge.pl is removed. Note that a subsequent
    patch will modify and test the cron job.
[3] Script misc/batchRebuildItemsTables.pl temporarily enabled dontmerge.
    This is equivalent to setting the mergelimit to zero.
    The function defnonull is no longer needed. (If the pref was NULL,
    we restore that value. Sub merge won't mind.)

Test plan:
[1] Run t/db_dependent/UsageStats.t
[2] Run misc/batchRebuildItemsTables.pl -t
    This just ensures you it still compiles; the changes speak for itself.
[3] Now git grep on dontmerge.
    You should only find hits in atomicupdate and misc/translator/po.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Check the merge limit in sub merge
Marcel de Rooy [Tue, 21 Feb 2017 10:54:23 +0000 (11:54 +0100)]
Bug 9988: Check the merge limit in sub merge

At this point, we are replacing dontmerge functionality by the new
AuthorityMergeLimit logic. Instead of doing this check before calling
merge, we just call merge and check it there. In order to let the cron
job do the larger (postponed) merges, we add a parameter override_limit.

A subtest is added in Merge.t to test the 'postponed merge' feature. Since
merge now also calls get_usage_count, an additional mock is added. All
references to dontmerge are removed.

In merge two lines, initializing $dbh and $counteditbiblios, are moved.
The dontmerge test in DelAuthority and ModAuthority is removed. Since this
did not leave much in ModAuthority, I fixed the whitespace on the remaining
lines rightaway (yes, I know).
A minimal set of changes is applied to the cron script; it will get further
attention on a next patch.

Test plan:
[1] Run t/db_dependent/Authorities/Merge.t
[2] Set AuthorityMergeLimit to 2. Modify an authority with two linked
    biblios. Check that the merge was done immediately.
[3] Now modify an authority with more than 2 linked records.
    Verify that the merge was postponed; a record must be inserted in
    the need_merge_authorities table.
[4] Testing of the merge cron job is *postponed* to a next patch.
    Note: I tested a modification, but the script just needs more
    attention.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Remove the Zebra code from sub merge
Marcel de Rooy [Tue, 21 Feb 2017 08:22:59 +0000 (09:22 +0100)]
Bug 9988: Remove the Zebra code from sub merge

Since we can now call linked_biblionumbers, we can now remove all Zebra
related code from merge. We also add a parameter biblionumbers; we use it
in the test now, but it may be handy too later in the maintenance script
when we want to trigger a merge for specific biblionumber(s). See bug
report 18071.

All mocks for ZOOM, Context::Zconn, Search::new_record_for_zebra in the
merge test can now be replaced by one mock for linked_biblionumbers. Note
that we test the biblionumbers parameter in the last subtest without that
mock.

Remove unused vars $countunmodifiedbiblio, $counterrors from merge.
Renamed zebrarecords to linkedrecords in the Merge test.

Test plan:
[1] Run t/db_dependent/Authorities/Merge.t
[2] Modify an authority record. Check the linked biblio records.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Merge should have a parameter hash
Marcel de Rooy [Tue, 21 Feb 2017 07:39:24 +0000 (08:39 +0100)]
Bug 9988: Merge should have a parameter hash

We will need a few additional parameters for merge later on. This patch
puts the original parameters in a parameter hash.
For the same reason DelAuthority gets a parameter hash here.

Note: We remove the second parameter from the DelAuthority call in
authorities/authorities-home.pl here. It was not used and could have
presented problems in the future.

Test plan:
[1] Run t/db_dependent/AuthoritiesMarc.t.
[2] Run t/db_dependent/Authorities/Merge.t.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Add get_usage_count and linked_biblionumbers to Koha::Authority
Marcel de Rooy [Wed, 15 Feb 2017 14:48:17 +0000 (15:48 +0100)]
Bug 9988: Add get_usage_count and linked_biblionumbers to Koha::Authority

When replacing the Zebra code in sub merge, we actually need CountUsage
as well as the results it gets from SearchEngine.

In order to get count and/or results, we now create:

[1] instance methods get_usage_count and linked_biblionumbers in
    Koha::Authority,
[2] class methods of the same name in Koha::Authorities.

The instance method calls the class method. The class method can be used
for deleted authority records, and in 'legacy calls' before refactoring.

Note: On BZ 18149 we will replace all CountUsage calls.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Add extract_biblionumber to Koha/SearchEngine
Marcel de Rooy [Wed, 15 Feb 2017 14:48:17 +0000 (15:48 +0100)]
Bug 9988: Add extract_biblionumber to Koha/SearchEngine

When we will replace the Zebra code in sub merge, we will call SearchEngine
to pass records and we need a routine to extract a biblionumber from
a search result record. A record from Zebra still must be converted to
MARC::Record. This is no longer needed for a ElasticSearch record.

Test plan:
Run t/db_dependent/Koha/SearchEngine/Search.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Add Koha objects for table need_merge_authorities
Marcel de Rooy [Sun, 1 Jan 2017 10:50:44 +0000 (11:50 +0100)]
Bug 9988: Add Koha objects for table need_merge_authorities

This patch adds two Koha objects: MergeRequest(s).
MergeRequest has a new method and an oldmarc method.
A class method reporting_tag_xml is added to MergeRequests.pm.
All new routines are tested in Authorities.t.

Removes a few unneeded modules from Koha::Authority.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: DBIx schema changes for need_merge_authorities
Marcel de Rooy [Tue, 14 Feb 2017 08:07:27 +0000 (09:07 +0100)]
Bug 9988: DBIx schema changes for need_merge_authorities

As generated by misc/devel/update_dbix_class_files.pl.
No test plan.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Table revision for need_merge_authorities
Marcel de Rooy [Tue, 14 Feb 2017 07:42:04 +0000 (08:42 +0100)]
Bug 9988: Table revision for need_merge_authorities

In order to let merge do exactly the same when called from the merge
cron job, we need three additional fields in the table. The use of these
fields will be explained in a follow-up.

Test plan:
Run the dbrev (updatestructure step in webinstaller).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Also tested running kohastructure.sql for this table.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 9988: Database revision for AuthorityMergeLimit
Marcel de Rooy [Tue, 10 Jan 2017 10:39:31 +0000 (11:39 +0100)]
Bug 9988: Database revision for AuthorityMergeLimit

Introduce the new preference and remove dontmerge.
If dontmerge was enabled, the new pref will be set to zero and we will
print a message about raising this value now.

Test plan:
Run the database revision or a new install.
In case of an upgrade, check the new pref value. Should be 0 when
dontmerge was enabled, otherwise 50.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Also tested sysprefs.sql on a new database.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18394: Add an option to item search to export a barcodes file
Julian Maurice [Wed, 5 Apr 2017 13:37:35 +0000 (15:37 +0200)]
Bug 18394: Add an option to item search to export a barcodes file

Test plan:
1. Go to item search (/cgi-bin/koha/catalogue/itemsearch.pl)
2. Fill the form with whatever you want
3. Leave the 'Output' option to 'Screen' and click 'Search'
4. Verify that the search still works
5. Click on 'Edit search' and set 'Output' to 'Barcodes file', click 'Search'
6. You should be able to download a 'barcodes.txt' file, open it and compare it
   to the previous search results
7. Now click on the 'Export results to barcodes file' button above the results,
   you should have the same result as in step 5
8. Verify that the CSV export still works

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 18394: Remove useless code from item search
Julian Maurice [Thu, 6 Apr 2017 12:26:08 +0000 (14:26 +0200)]
Bug 18394: Remove useless code from item search

The item search was originally designed to work even with JS disabled.
Since bug 15111, the staff interface does not work at all without JS, so some
parts of this code are useless and should be removed

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 18375: Better readability of patron category table for zero ages and fees
Marc Véron [Tue, 4 Apr 2017 11:03:04 +0000 (13:03 +0200)]
Bug 18375: Better readability of patron category table for zero ages and fees

In patron category table, this patch displays zero / empty values for ages and
fees with '-' for better readability

To test:
- Go to Home > Administration > Patron categories
- Verify that you have 0 years and/or only years in Age required and Uper age limit colums
- Verify that you have Enrollment and Hold fees of 0.00
- Apply patch
- Verify that such values are replaced by - to enhance table readability

Signed-off-by: Luke Honiss <luke.honiss@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 18274: C4::Items - Remove GetItemStatus
Jonathan Druart [Wed, 15 Mar 2017 16:10:16 +0000 (13:10 -0300)]
Bug 18274: C4::Items - Remove GetItemStatus

This subroutine is no longer in used.
It was previously call from serials/serials-recieve.pl, which was not used and has been removed by
    commit 65b7ad030cd5cd0e3148fbbd1496d31b5cf149f7
    Bug 13423: Remove unused serials-recieve

Test plan:
  git grep GetItemStatus
should not return any used calls (only 1 occurrence in release notes)

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18208: [QA Follow-up] Get count from Koha::Items
Marcel de Rooy [Fri, 7 Apr 2017 09:56:52 +0000 (11:56 +0200)]
Bug 18208: [QA Follow-up] Get count from Koha::Items

Removes the loop by moving the onloan test to the query.

Test plan:
Run the test again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18208: Add RecordProcessor filter to inject not onloan count to MARC records
Tomas Cohen Arazi [Fri, 3 Mar 2017 18:30:22 +0000 (15:30 -0300)]
Bug 18208: Add RecordProcessor filter to inject not onloan count to MARC records

This patch adds a new filter for MARC records to be used with
Koha::RecordProcessor. It's purpose is to inject the information about
items not-onloan in a fixed subfield, 999$x.

To test:
- Apply the patch
- Run:
  $ prove t/db_dependent/Koha/Filter/EmbedItemsAvailability.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater Solutions
Followed test plan, test passes OK
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17737: [QA Follow-up] Remove unused reservedfor variable
Marcel de Rooy [Fri, 3 Feb 2017 10:49:30 +0000 (11:49 +0100)]
Bug 17737: [QA Follow-up] Remove unused reservedfor variable

The changes in this patch set obsolete this variable.
Remove confusing comment about reserve via host record.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17737: Rename holds_placed_before_today with current_holds
Jonathan Druart [Mon, 9 Jan 2017 08:13:11 +0000 (09:13 +0100)]
Bug 17737: Rename holds_placed_before_today with current_holds

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17737: Remove C4::Reserves::GetReservesFromItemnumber
Jonathan Druart [Wed, 7 Dec 2016 13:04:17 +0000 (14:04 +0100)]
Bug 17737: Remove C4::Reserves::GetReservesFromItemnumber

At this point, there should not be any occurrences of
GetReservesFromItemnumber anymore.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17737: Replace GetReservesFromItemnumber with Koha::Item->get_holds_placed_before...
Jonathan Druart [Wed, 7 Dec 2016 12:50:46 +0000 (13:50 +0100)]
Bug 17737: Replace GetReservesFromItemnumber with Koha::Item->get_holds_placed_before_today

On the same way of Koha::Biblio->get_holds,
Koha::Biblio->get_holds_placed_before_today and Koha::Patron->get_holds,
this new subroutin will permit to retrieve the holds placed on a
specific item.
Note that at the moment we do not need a Koha::Item->get_holds method:
we do not want to display future holds placed in the future.

Test plan:
I would suggest to test this patch with patches from bug 17736 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: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18388 - Standardize serials volume information displaying
Alex Arnaud [Wed, 5 Apr 2017 15:01:53 +0000 (15:01 +0000)]
Bug 18388 - Standardize serials volume information displaying

OPAC: Home > Details for (serial)
Compared information in tab 'Holdings' col 'Vol info' with
same information in staff client. With patch it's the same.
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 17872: Fix small error in GetBudgetHierarchy and one of its calls
Marcel de Rooy [Tue, 10 Jan 2017 09:03:36 +0000 (10:03 +0100)]
Bug 17872: Fix small error in GetBudgetHierarchy and one of its calls

In aqbudgetperiods.pl a commented line is removed that contains a
wrong userenv hash key. Should be branch instead of branchcode.

In aqbudgets GetBudgetHierarchy is called with the same wrong userenv
hash key. Should be userenv->{branch}.
This made another bug visible: if you call GetBudgetHierarchy with a
branch and without owner, the where clause should take into account
that the branchcode can be empty (not null).

Test plan:
[1] Run Budgets.t
[2] Run aqbudgets.pl from Administration
[3] Add the show_mine=1 parameter in the URL
[4] Change owner of one of the funds and repeat step 2 and 3.

t/Budgets.t returns green. 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 14932: Do not call can_edit_subscription with an empty value
Jonathan Druart [Tue, 11 Apr 2017 13:31:49 +0000 (10:31 -0300)]
Bug 14932: Do not call can_edit_subscription with an empty value

ref($sub) eq 'ARRAY' should always be true, what we want is to call
can_edit_subscription if there is at least 1 serial for this
subscription.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 14932 - serials/serials-collection.pl-page is very slow. GetFullSubscription...
Olli-Antti Kivilahti [Thu, 1 Oct 2015 12:23:23 +0000 (15:23 +0300)]
Bug 14932 - serials/serials-collection.pl-page is very slow. GetFullSubscription* checks permission for each serial!

Currently we have subscriptions with 300+ serials received.
It takes a lot of time to show serials-collection.pl (~20s).
This is especially troublesome when receiving serials, since after receival we get redirected to that page.

We no longer can receive daily serials in the allotted timeframe.

This quick and dirty fix prevents checking the subscription editing for each serial, but instead checks it for the first serial only.

This reduced page load time by ~18s

TEST PLAN:
1. Receive ~300 serials (or just a bunch :)  )
2. Observe the gradual slowing of the receival action.

AFTER THIS PATCH:
1. Receive ~300 serials more (or just a bunch)
2. Observe a significant performance improvement.

Signed-off-by: Paul POULAIN <paul.poulain@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 18395: (bug 14610 followup) Remove article requests methods from Koha::Patrons
Jonathan Druart [Wed, 5 Apr 2017 01:30:19 +0000 (22:30 -0300)]
Bug 18395: (bug 14610 followup) Remove article requests methods from Koha::Patrons

There is something very wrong with the new subroutines, they have been added to both Koha::Patron and Koha::Patrons:

% git grep 'sub article_request' Koha/Patron*.pm
Koha/Patron.pm:sub article_requests {
Koha/Patron.pm:sub article_requests_current {
Koha/Patron.pm:sub article_requests_finished {
Koha/Patrons.pm:sub article_requests {
Koha/Patrons.pm:sub article_requests_current {
Koha/Patrons.pm:sub article_requests_finished {

The ones in Koha::Patrons are wrong

Test plan:
  prove t/db_dependent/ArticleRequests.t
should still return green

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18121: Replace opac_news.new with opac_news.content in notices templates
Jonathan Druart [Wed, 15 Feb 2017 08:39:23 +0000 (08:39 +0000)]
Bug 18121: Replace opac_news.new with opac_news.content in notices templates

Bug 17960 replaces opac_news.new with opac_news.content, we can replace
the content of the notices' templates automatically.

Test plan:
Checkout a commit prior to bug 17960. Install a new DB with sample data.
You should have notices with <<opac_news.new>>

Switch to a branch with this patch, on top of master

Execute the updatedatabase.pl sript
=> The notices with opac_news.new should have been replaced with
opac_news.content

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18349: [QA Follow-up] Add four missing error messages
Marcel de Rooy [Fri, 7 Apr 2017 08:13:00 +0000 (10:13 +0200)]
Bug 18349: [QA Follow-up] Add four missing error messages

The error codes come from CanBookBeIssued.
The warnings speak for themselves. Note that the GNA message is similar
to the one used in opac-user.tt (gonenoaddress is translated to the patron
as contact information not up-to-date).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18349: Remove useless info in alert message
Jonathan Druart [Fri, 31 Mar 2017 16:25:13 +0000 (13:25 -0300)]
Bug 18349: Remove useless info in alert message

Empty tags should be removed, and message id
Note that not all error codes are covered here.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18349: If a confirmation is required, consider as blocker
Jonathan Druart [Fri, 31 Mar 2017 16:22:05 +0000 (13:22 -0300)]
Bug 18349: If a confirmation is required, consider as blocker

Only RENEW_ISSUE should not be considered as blocker, others should.
Note that this code is not robust and the whole script as well as the
return of CanBookBeIssued should be rewrittent completely.
We need a small patch to easy backport to stable releases

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18349: $borrower is a hashref
Jonathan Druart [Fri, 31 Mar 2017 00:51:28 +0000 (21:51 -0300)]
Bug 18349: $borrower is a hashref

I guess this code was never called before...

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18349: SCO - Do not trust the confirmed flag
Jonathan Druart [Wed, 29 Mar 2017 21:25:40 +0000 (18:25 -0300)]
Bug 18349: SCO - Do not trust the confirmed flag

The "confirmed" flag is used to know if that user confirmed a situation
that needs a confirmation.
But if the issue/renew is impossible the CanBookBeIssued and the
'impossible flags' should be checked.

Otherwise a patron can checkout and renew bypassing the circulation
rules (Understand 'no limit' here...)

Test plan:
Want to renew?
Checkin $barcode, then
/cgi-bin/koha/sco/sco-main.pl?patronid=$cardnumber&barcode=$barcode&confirmed=1&op=checkout

Want to bypass the checkin?
Same url...

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18413: Fix Letters.t (following bug 17866)
Marcel de Rooy [Tue, 11 Apr 2017 12:15:54 +0000 (14:15 +0200)]
Bug 18413: Fix Letters.t (following bug 17866)

SendAlert now needs a userenv to find branch email and the fallback
of KohaAdminEmailAddress if the branch mail is not filled.

Test plan:
Run t/db_dependent/Letters.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 17309 - Renewing and HomeOrHoldingBranch syspref
David Kuhn [Thu, 15 Dec 2016 00:02:26 +0000 (16:02 -0800)]
Bug 17309 - Renewing and HomeOrHoldingBranch syspref

The AddRenewal subroutine currently uses the circulation rules for the branch
stored in the Issues table (which is the holding branch) when calculating the new due date.

This patch replaces using the branch from the Issues table with the branch
specified by the HomeOrHoldingBranch syspref.

To test:
1. Set up 2 branches, Branch1 and Branch2
2. Set up a loan rule in Branch1 for DVDs with a 21 day loan period and a
   21 day renewal period.
3. Set up a loan rule in Branch2 for DVDs with a 14 day loan period and a
   14 day renewal period.
4. Checkout a DVD belonging to Branch1 while logged into Branch2. It will
   receive the correct 21 day loan period.
5. Renewing the same DVD while logged into either Branch1 or Branch2
   will give a 14 day due date, rather than 21 days.
6. Checkout a DVD belonging to Branch2 while logged into Branch1. It will
   receive the correct 14 day loan period.
7. Renewing the same DVD while logged into either Branch1 or Branch2
   will give a 21 day due date, rather than 14 days.
8. Apply the patch and repeat steps 4-7. The correct due date should be given
   when the item is renewed, regardless of where it is checked out or renewed.

This update removes reassignment of $branch variable.

Signed-off-by: Cédric Vita <cedric.vita@dracenie.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18093: Koha::Objects->get_column should not return a DBIC object
Jonathan Druart [Wed, 15 Mar 2017 21:58:55 +0000 (18:58 -0300)]
Bug 18093: Koha::Objects->get_column should not return a DBIC object

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18093: Add Koha::Objects->get_column
Jonathan Druart [Fri, 10 Feb 2017 08:45:26 +0000 (09:45 +0100)]
Bug 18093: Add Koha::Objects->get_column

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

Followed test plan, result as expected
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17866: [QA Follow-up] Change wording of db revision
Marcel de Rooy [Mon, 3 Apr 2017 07:21:37 +0000 (09:21 +0200)]
Bug 17866: [QA Follow-up] Change wording of db revision

As Katrin noted on the report, we should not limit the db rev message to
the serial claims only. Applies to acquisision claims too.
Note: Strictly speaking, we could also mention the new ACQORDER notice,
but this will not yet be widely used.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 18368 - DBversion 16.12.00.022 not set by updatedatabase.pl
Marc Véron [Sun, 2 Apr 2017 16:59:52 +0000 (18:59 +0200)]
Bug 18368 - DBversion 16.12.00.022 not set by updatedatabase.pl

Updating to 16.12.00.22 puts the upgrade process in an endless loop because DBversione is not set by updatedatabase.pl
Missing line:  SetVersion( $DBversion )

This patch inserts the line as appropriate.

To test:
- Apply patch
- Verify code change makes sense
- Verify that upgrade smoothly runs through

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 agoFix number of tests in Circulation.t
Jonathan Druart [Fri, 31 Mar 2017 19:12:48 +0000 (16:12 -0300)]
Fix number of tests in Circulation.t

7 years agoBug 17825: (followup) Remove unused function AttributeTypeExists
Tomas Cohen Arazi [Thu, 29 Dec 2016 14:40:57 +0000 (11:40 -0300)]
Bug 17825: (followup) Remove unused function AttributeTypeExists

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 17825: Remove the use of AttributeTypeExists from opac-user.pl
Tomas Cohen Arazi [Thu, 29 Dec 2016 14:32:27 +0000 (11:32 -0300)]
Bug 17825: Remove the use of AttributeTypeExists from opac-user.pl

With the introducion of Koha::Object-based
Koha::Patron::Attribute::Type(s) there's no need for using this
function.

This patch replaces it with a regular ->search + ->count call.

To test:
- Have a user with checkouts logged into the OPAC on the opac-user.pl
page
- Set the SHOW_BCODE attribute to 'no' on the staff interface for the
user.
- Reload opac-user.pl
=> SUCCESS: The barcode is not shown for checked out items.
- Set the SHOW_BCODE atttribute to 'yes' on the staff interface for the
user.
- Reload opac-user.pl
=> SUCCESS: The barcode is shown for checked out items.
- Delete the Patron attribute type SHOW_BCODE
- Reload opac-user.pl
=> SUCCESS: No barcode is shown for checked out items
- Sign off :-D

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 17828: return $self to be consistent
Jonathan Druart [Wed, 29 Mar 2017 19:39:36 +0000 (16:39 -0300)]
Bug 17828: return $self to be consistent

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17828: Use Koha::Patron::Attributes instead of _resultset
Jonathan Druart [Tue, 28 Mar 2017 14:39:09 +0000 (11:39 -0300)]
Bug 17828: Use Koha::Patron::Attributes instead of _resultset

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17828: (QA followup) Add ->type and reuse it
Tomas Cohen Arazi [Mon, 27 Mar 2017 15:47:14 +0000 (12:47 -0300)]
Bug 17828: (QA followup) Add ->type and reuse it

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 17828: (followup) Add Test::Exception as dependency
Tomas Cohen Arazi [Thu, 23 Mar 2017 15:07:49 +0000 (12:07 -0300)]
Bug 17828: (followup) Add Test::Exception as dependency

Test::Exception is available on Jessie and already installed when
koha-common gets installed

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 17828: Overload Koha::Patron::Attribute->store to check for unique_id and repeatable
Tomas Cohen Arazi [Fri, 30 Dec 2016 14:12:32 +0000 (11:12 -0300)]
Bug 17828: Overload Koha::Patron::Attribute->store to check for unique_id and repeatable

This patch introduces a Koha::Patron::Attribute->store method that does
the required check for the corresponding Koha::Patron::Attribute::Type
and raises an exception if trying to store more than one unique
attribute code/value combination, and another exception for
non-repeatable attribute types being stored while already existing on
the DB.

This patch introduces exception definitions for that purpose.

To test:
- Apply the unit tests patches
- Run:
  $ prove t/db_dependent/Koha/Patron/Attributes.t
=> FAIL: Tests fail
- Apply this patch
- Run:
  $ prove t/db_dependent/Koha/Patron/Attributes.t
=> SUCCESS: Tests pass!
- Sign off :-D

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 17828: Unit tests for Koha::Patron::Attribute->store
Tomas Cohen Arazi [Fri, 30 Dec 2016 14:10:33 +0000 (11:10 -0300)]
Bug 17828: Unit tests for Koha::Patron::Attribute->store

Unit tests for an overloaded Koha::Patron::Attribute->store that
checks attribute type's uniqueness property and raises an exception
conveniently.

It also tests for repeatable attribute type's property.

Test plan on the implementing patch.

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 17014: Simplify some code
Jonathan Druart [Tue, 21 Mar 2017 19:55:37 +0000 (16:55 -0300)]
Bug 17014: Simplify some code

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
7 years agoBug 17014 - Remove more event attributes from patron templates
Owen Leonard [Mon, 1 Aug 2016 16:33:24 +0000 (12:33 -0400)]
Bug 17014 - Remove more event attributes from patron templates

There are many patron-related templates which still use event attributes
to define events. This patch updates these templates so that events are
defined in JavaScript.

To test apply the patch and check out to a patron.

- From the Print menu in the toolbar, choose "Print summary." The patron
  summary page should open and the print dialog should be automatically
  triggered.

- From the Print menu in the toolbar, choose "Print slip." The patron
  slip page should open and the print dialog should be automatically
  triggered.

- From the Print menu in the toolbar, choose "Print quick slip." The
  patron quick slip page should open and the print dialog should be
  automatically triggered.

- Click the patron's "Fines" tab in the left-hand sidebar and then
  choose the "Account" tab.
  -- Click the "Print" button for an account payment (the link should
     point to printfeercpt.pl). A print receipt page should open and
     the print dialog should be automatically triggered.
  -- Follow the same procedure for a transaction which is not an account
     payment (the link should point to printinvoice.pl).

- Click the "Create manual invoice" tab.
  -- Select one of the "type" choices. Doing so should automatically
     populate the "Description" field with the corresponding code.
  -- If necessary, define one or more values for the MANUAL_INV
     authorized value and confirm that those invoice types work as well.

- From the patron's "Pay fines" tab, click the "Pay amount" button. In
  the "collect from patron" field, enter any combination of letters,
  numbers, and symbols. When you tab away from that field your text
  should be reformatted to currency format.

- From the patrons home page, change the filter in the left-hand sidebar
  and submit it. The correct results should be returned.

Signed-off-by: EricGosselin <eric.gosselin.5@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>