]> git.koha-community.org Git - koha.git/log
koha.git
8 years agoBug 17417 [Revised] Correct invalid markup around news on the staff client home page
Owen Leonard [Mon, 10 Oct 2016 12:10:29 +0000 (08:10 -0400)]
Bug 17417 [Revised] Correct invalid markup around news on the staff client home page

This patch fixes two minor errors in the markup around displaying news
on the staff client home page: Adding a missing "class" attribute, and
changing the container around news items from <p> to <div> (because news
items might contain <p> and nesting them is incorrect).

To test, apply the patch and view the staff client home page with news
items showing. Validate the page and confirm that there are no errors.

Signed-off-by: Marc <veron@veron.ch>
Revision for QA removes an extra </div> from elsewhere in the template
to make the validator return no errors.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16935 - launch export_records.pl with deleted_barcodes param fails
Fridolin Somers [Wed, 24 Aug 2016 09:44:55 +0000 (11:44 +0200)]
Bug 16935 - launch export_records.pl with deleted_barcodes param fails

When launching misc/export_records.pl with this command line :

 misc/export_records.pl --date=`date +%d/%m/%Y` --deleted_barcodes --filename=/tmp/koha.mrc

You get this error message :

DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 4 [for Statement " (
            SELECT DISTINCT barcode
            FROM deleteditems
            WHERE deleteditems.biblionumber = ?
        "] at misc/export_records.pl line 189.

This is because of a '(' after 'q|', looks like a typo.
Also, this patch removes useless var $q.

Test plan :
- Delete an item with barcode
- Without patch, run : misc/export_records.pl --date=`date +%d/%m/%Y` --deleted_barcodes --filename=/tmp/koha.mrc
=> You get dirty MySQL
- Without patch, run the same command
=> No error and the file is generated

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598 - DBRev 16.06.00.039
Kyle M Hall [Fri, 28 Oct 2016 11:30:38 +0000 (11:30 +0000)]
Bug 14598 - DBRev 16.06.00.039

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: [QA Follow-up] Small changes
Marcel de Rooy [Fri, 28 Oct 2016 07:54:20 +0000 (09:54 +0200)]
Bug 14598: [QA Follow-up] Small changes

[1] Renames the dbrev version to XXX; adding a my for $sth, although
    not strictly necessary it feels better.
[2] Circulation.t stumbles over:
    Undefined subroutine &C4::Circulation::GetItem called at ... line 1283.
    Somehow this is related to use_ok instead of a regular use.
    Worked around this by require_ok and adding a regular use.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: Fix warning from effective_itemtype
Jonathan Druart [Thu, 7 Apr 2016 11:03:49 +0000 (12:03 +0100)]
Bug 14598: Fix warning from effective_itemtype

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: (QA followup) use deleted{items|biblioitems} during upgrade
Tomas Cohen Arazi [Wed, 6 Apr 2016 14:34:26 +0000 (11:34 -0300)]
Bug 14598: (QA followup) use deleted{items|biblioitems} during upgrade

If the 'statistics' table contains circulation information about items
that are no longer on the DB it will raise a warning. This patch
makes the updatedatabase.pl script use the deleteditems and deletedbiblioitems
tables to get information for those items on the statistics table.

To reproduce:
- Have your sample DB contain some circulation data on the statistics table
- Make sure some of them have NULL itemtype:
> UPDATE statistics SET itemtype = NULL WHERE type='return';
- Check the upgrade query catches them:
> SELECT s.itemnumber, i.itype, b.itemtype FROM  ( SELECT DISTINCT itemnumber    FROM statistics    WHERE ( type = "return" OR type = "localuse" ) AND itemtype IS NULL ) s  LEFT JOIN  ( SELECT itemnumber,biblionumber, itype      FROM items    UNION    SELECT itemnumber,biblionumber, itype      FROM deleteditems ) i  ON (s.itemnumber=i.itemnumber)  LEFT JOIN  ( SELECT biblionumber, itemtype      FROM biblioitems    UNION    SELECT biblionumber, itemtype      FROM deletedbiblioitems ) b  ON (i.biblionumber=b.biblionumber);
+------------+-------+----------+
| itemnumber | itype | itemtype |
+------------+-------+----------+
|        732 | BK    | BK       |
|        731 | BK    | BK       |
+------------+-------+----------+
2 rows in set (0.00 sec)

- Delete the items, and some biblio too.
- Re-run the query
=> SUCCESS: Same results
- Go reset to NULL the itemtypes
> UPDATE statistics SET itemtype = NULL WHERE type='return';
- Run the updatedatabase.pl script:
 $ sudo koha-shell koahdev ; cd kohaclone
 $ perl installer/data/mysql/updatedatabase.pl
=> SUCCESS: No warnings

Note: It is possible that on production sites, if the sysadmin is cleaning the
deleted{items|biblioitems|biblio} tables, there will be warnings. This is expected
as they need to know some data lacks information.

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: (followup) Remove unused and non-existent C4::ItemType include
Tomas Cohen Arazi [Fri, 1 Apr 2016 15:25:39 +0000 (12:25 -0300)]
Bug 14598: (followup) Remove unused and non-existent C4::ItemType include

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598 [QA Followup] - Update localuse statistics also
Kyle M Hall [Tue, 19 Jan 2016 14:34:20 +0000 (14:34 +0000)]
Bug 14598 [QA Followup] - Update localuse statistics also

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598 [QA Followup] - Make unit test pass
Kyle M Hall [Tue, 12 Jan 2016 16:04:55 +0000 (16:04 +0000)]
Bug 14598 [QA Followup] - Make unit test pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598 [QA Followup] - Correct the behavior of GetItem
Kyle M Hall [Fri, 18 Dec 2015 14:59:02 +0000 (14:59 +0000)]
Bug 14598 [QA Followup] - Correct the behavior of GetItem

Currently GetItem sets itemtype to the biblio itemtype if no item level
itemtype exists. Instead, it should only do this if item_level-itypes
is not set.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598 [QA Followup] - Only fetch bib data if needed
Kyle M Hall [Fri, 20 Nov 2015 14:23:22 +0000 (14:23 +0000)]
Bug 14598 [QA Followup] - Only fetch bib data if needed

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598 - QA Followup touching CanBookBeIssued subroutine
Brendan A Gallagher [Thu, 19 Nov 2015 21:13:05 +0000 (21:13 +0000)]
Bug 14598 - QA Followup touching CanBookBeIssued subroutine

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: (DB update) fix NULL itemtypes in statistics on 'return' rows
Tomas Cohen Arazi [Tue, 1 Sep 2015 14:52:17 +0000 (11:52 -0300)]
Bug 14598: (DB update) fix NULL itemtypes in statistics on 'return' rows

This patch introduces an updatedatabase.pl entry that takes care of
updating existing statistics rows.

It does so by looping on the statistics rows, collecting itemnumber occurences
that are have NULL itemtypes.
It then chooses the right itemtype following what is proposed on bug 14651, and
then updates the rows in statistics using the calculated itemtype.

Regards

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: (QA followup) Don't die on bad barcode
Kyle M Hall [Mon, 27 Jul 2015 15:16:56 +0000 (11:16 -0400)]
Bug 14598: (QA followup) Don't die on bad barcode

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: Make C4::Circulation::AddReturn store the right itemtype
Tomas Cohen Arazi [Mon, 27 Jul 2015 14:40:38 +0000 (11:40 -0300)]
Bug 14598: Make C4::Circulation::AddReturn store the right itemtype

This patch makes C4::Circulation::AddReturn correctly store the itemtype
on the 'statistics' table.

To reproduce:
- Checkout master.
- Make a checkout.
- Check the 'statistics' table and notice the itemtype is correctly set
  > SELECT * FROM statistics;
- Check the item in.
- Check the 'statistics' table and notice the itemtype is not set
  > SELECT * FROM statistics WHERE type="return";
=> FAIL: itemtype is set to NULL

To test:
- Apply the regression tests patch
- Run the tests:
  $ prove t/db_dependent/Circulation/Returns.t
=> FAIL: Tests fail
- Apply this patch
- Run the regression tests:
  $ prove t/db_dependent/Circulation/Returns.t
=> SUCCESS: Tests now pass.
- Repeat the 'To reproduce' steps
=> SUCCESS: itemtype is now correctly set (in real life)
- Happily sign off :-D

Sponsored-by: Universidad Empresarial Siglo 21
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14598: (regression tests) AddReturn should store itemtype on 'statistics' table
Tomas Cohen Arazi [Sun, 26 Jul 2015 05:05:16 +0000 (02:05 -0300)]
Bug 14598: (regression tests) AddReturn should store itemtype on 'statistics' table

This patch adds tests for C4::Circulation::AddReturn(). Both tests are wrapped
inside a subtest, and look for AddReturn storing the right itemtype on the
'statistics' table.

Note: It also refactors the file a bit, to avoid side effects. And uses TestBuilder
to make it independent on already-present db data. It also removes warnings by mocking
C4::Context::userenv

To test:
- Apply the patch
- Run the tests:
  $ prove t/db_dependent/Circulation/Returns.t
=> FAIL: Tests fail bacause AddReturn is not storing the itemtype
- Sign off :-D

Sponsored-by: Universidad Empresarial Siglo 21
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17376 - rebuild_zebra.pl in daemon mode no database access kills the process
Fridolin Somers [Thu, 29 Sep 2016 14:19:48 +0000 (16:19 +0200)]
Bug 17376 - rebuild_zebra.pl in daemon mode no database access kills the process

When running rebuild_zebra.pl in daemon mode, a while loop runs the script for ever.
But if something crashes inside the rebuild process, the all daemon crashes.
For example when it can not access database.
This problem may be temporary so daemon should keep running.

This patch add eval around the rebuild process to allow a run to fail without killing the daemon.
Also moves the DB handler get inside daemon loop because it is broken is DB stoppes.

This is a big issue for indexer running in a systemd service.

Test plan :
- run rebuild_zebra.pl in daemon mode :
/home/koha/src/misc/migration_tools/rebuild_zebra.pl -daemon -z -a -b -x --sleep 30
- stop the database
- wait a minute
=> you see an error on database connexion
=> the daemon is still running
- restart the database
- test the indexer by creating a new record (wait for a minute)

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17495: Fix 'method selected not covered by test' in reports/issues_stats.pl
Jonathan Druart [Tue, 25 Oct 2016 07:16:56 +0000 (09:16 +0200)]
Bug 17495: Fix 'method selected not covered by test' in reports/issues_stats.pl

If you access reports/issues_stats.pl, you will get
Template process failed: undef error - The method selected is not
covered by tests! at /home/vagrant/kohaclone/C4/Templates.pm line 121
http://localhost:8081/cgi-bin/koha/reports/reports-home.pl

Bug 15407 sent objects to the template and the selected method is not
defined.
The bug had been highlighted by bug 17425 which dies instead of hides the error.

Not that the "selected" code was not needed, the different elements of
the page never select a specific value.

Test plan:
Apply this patch and confirm that the error is no longuer displayed.

Reproduced. Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14874 - DBRev 16.06.00.038
Kyle M Hall [Thu, 27 Oct 2016 14:02:19 +0000 (14:02 +0000)]
Bug 14874 - DBRev 16.06.00.038

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14874: Set default DefaultPatronSearchFields
Jonathan Druart [Tue, 4 Oct 2016 11:57:13 +0000 (12:57 +0100)]
Bug 14874: Set default DefaultPatronSearchFields

just in case...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14874 - Add ability to search for patrons by date of birth from checkout and...
Nick Clemens [Sun, 15 May 2016 14:44:48 +0000 (10:44 -0400)]
Bug 14874 - Add ability to search for patrons by date of birth from checkout and patron quick searches

This patch adds a new syspef 'DefaultPatronSearchFields' which defines
the fields that should be used when searching for a patron if none are
defined.

To test:
1 - Aply patch, updatedatabase
2 - Ensure patron search has not changed
3 - Add dateofbirth to new pref
4 - Ensure things work wll
5 - Experiment with adding and removing other fields from borrowers
table
6 - prove t/db_dependent/Utils/Datatables_Members.t

Tested together with followup. Works as described.
Signed-off-by: Marc Véron <veron@veron.ch>
Bug 14874 (QA Followup)

    Fix atomicupdate file name

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17375: Search by dateofbirth - handle invalid dates
Jonathan Druart [Tue, 4 Oct 2016 10:55:25 +0000 (11:55 +0100)]
Bug 17375: Search by dateofbirth - handle invalid dates

Prevent internal software error when searching patron with invalid birth date

To reproduce:

- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and
  enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'

To test:
- Apply patch
- Repeat steps above
- In both cases, you should get "No results"

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Lucio Moraes <lmoraes@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17375: Search by dateofbirth - Add tests
Jonathan Druart [Tue, 4 Oct 2016 10:55:02 +0000 (11:55 +0100)]
Bug 17375: Search by dateofbirth - Add tests

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>
8 years agoBug 14610 - DBRev 16.06.00.037
Kyle M Hall [Wed, 26 Oct 2016 12:21:58 +0000 (12:21 +0000)]
Bug 14610 - DBRev 16.06.00.037

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610: Follow-up 2
Katrin Fischer [Wed, 26 Oct 2016 11:32:40 +0000 (13:32 +0200)]
Bug 14610: Follow-up 2

- Fixes typo "Recieve" in the sample notices
- Adds new notices to it-IT installer
- Turns off feature for existing installations, leaves it
  on for new installations
- Fixes typo "cancelation"
- Fixes ids in <body> of new pages
- Adds/fixes classes in th elements of tables

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 - Follow-up
Katrin Fischer [Fri, 21 Oct 2016 02:17:58 +0000 (02:17 +0000)]
Bug 14610 - Follow-up

Patch fixes some smaller problems:

- Adds new notices to the it-IT installer (xt/sample_notices.t)
- Renames one of the classes used in the table to avoid double up
- Fixes POD of Bilbio.pm by removing a doubled up line

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 - Update Schema files
Kyle M Hall [Mon, 24 Oct 2016 13:57:10 +0000 (13:57 +0000)]
Bug 14610 - Update Schema files

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 [QA Followup] - Fix publishercode issue
Kyle M Hall [Tue, 11 Oct 2016 08:46:14 +0000 (08:46 +0000)]
Bug 14610 [QA Followup] - Fix publishercode issue

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 [QA Followup] - Add classes to table headers
Kyle M Hall [Tue, 11 Oct 2016 08:15:37 +0000 (08:15 +0000)]
Bug 14610 [QA Followup] - Add classes to table headers

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 [QA Followup] - Add notices to all language files
Kyle M Hall [Tue, 11 Oct 2016 08:12:27 +0000 (08:12 +0000)]
Bug 14610 [QA Followup] - Add notices to all language files

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 [QA Followup] - Implement staff patron tab
Kyle M Hall [Wed, 14 Sep 2016 13:39:19 +0000 (13:39 +0000)]
Bug 14610 [QA Followup] - Implement staff patron tab

Also fixes a few other minor issues

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 - Update opac.css via less
Kyle M Hall [Mon, 16 May 2016 11:21:28 +0000 (11:21 +0000)]
Bug 14610 - Update opac.css via less

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 - Add unit tests
Kyle M Hall [Wed, 7 Oct 2015 16:26:37 +0000 (12:26 -0400)]
Bug 14610 - Add unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jennifer Schmidt <jschmidt@switchinc.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 - Add and update scripts
Kyle M Hall [Wed, 7 Oct 2015 16:26:14 +0000 (12:26 -0400)]
Bug 14610 - Add and update scripts

Signed-off-by: Jennifer Schmidt <jschmidt@switchinc.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 - Add and update modules
Kyle M Hall [Wed, 7 Oct 2015 16:23:24 +0000 (12:23 -0400)]
Bug 14610 - Add and update modules

Signed-off-by: Jennifer Schmidt <jschmidt@switchinc.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14610 - Add ability to place article requests in Koha - Update database
Kyle M Hall [Wed, 7 Oct 2015 16:22:12 +0000 (12:22 -0400)]
Bug 14610 - Add ability to place article requests in Koha - Update database

Article Requests are somewhat similar to holds, but are not requests for
an item to check out. Instead, article requests are requests for a
photocopy of a particular section of a book ( most often ). This is very
common in academic libraries where researchers may request a copy of a
single article found in a journal.

This patch set adds the ability to place article requests in Koha. It
allows the control of what can be requested via the circulation rules.
Since article requests of electronic resources are not outside the realm
of possibility, the feature will check not only the items for
requstability, but the record itself as well ( i.e. both items.itype and
biblio.itemtype ).

Article requests can be placed for patrons from the opac and staff
intranet and can be viewed in most areas where holds are viewed ( e.g.
patron details, record details, etc ).

There is a script to view article requests in progress within the
circulation module. Article requests can be Open ( i.e. new ), In
Processing, Completed, or Canceled. The status of a given request can be
updated from this script.

Test Plan:
1) Apply the patch set
2) Run updatedatabase.pl
3) Enable the system preference ArticleRequests
4) Set up some required fields in:
    ArticleRequestsMandatoryFields
    ArticleRequestsMandatoryFieldsItemsOnly
    ArticleRequestsMandatoryFieldsRecordOnly
5) Edit your circ rules, set article requests to 'yes' for something
6) Test the ability to add an article request from the opac ( required fields enforced )
7) Test the ability to add an article request from the staff interface ( required fields no enforced )
8) Note you can choose item level or record level requests
9) Change the rule to "record only"
10) Repeat 6 and 7
11) Note you cannot choose items
12) Change the rule to "item only"
13) Repeat 6 and 7
14) Note you must choose an item
15) Note that the 'new request' message is queued for each new request
16) Browse to /cgi-bin/koha/circ/article-requests.pl
17) Note requests are split by pickup branch
18) Test slip printing via the "Print slip" action
19) Process request vai "Process request" action
20) Note an email notice is queued for patron
21) Refresh /cgi-bin/koha/circ/article-requests.pl
22) Note request has moved to "processing" tab.
23) Complete request with "Complete request" action
24) Note message is queued for patron
25) Cancel a request, add cancelation note.
26) Note message is queued for patron

Signed-off-by: Jennifer Schmidt <jschmidt@switchinc.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16850: Adjust number of tests
Jonathan Druart [Mon, 24 Oct 2016 11:46:31 +0000 (11:46 +0000)]
Bug 16850: Adjust number of tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 14752 - Followup to fix error if barcode fields undefined
Nick Clemens [Wed, 19 Oct 2016 10:09:56 +0000 (10:09 +0000)]
Bug 14752 - Followup to fix error if barcode fields undefined

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670 - DBRev 16.06.00.036
Kyle M Hall [Fri, 21 Oct 2016 17:44:59 +0000 (17:44 +0000)]
Bug 5670 - DBRev 16.06.00.036

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Add a confirmation message on delete
Jonathan Druart [Mon, 17 Oct 2016 14:14:39 +0000 (15:14 +0100)]
Bug 5670: Add a confirmation message on delete

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Use the fa icon for the save button
Jonathan Druart [Mon, 17 Oct 2016 13:58:09 +0000 (14:58 +0100)]
Bug 5670: Use the fa icon for the save button

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Use Koha.Preference to retrieve syspref from templates
Jonathan Druart [Mon, 17 Oct 2016 13:49:48 +0000 (14:49 +0100)]
Bug 5670: Use Koha.Preference to retrieve syspref from templates

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Does not return 0 in Koha::Patron->housebound_* methods
Jonathan Druart [Mon, 17 Oct 2016 13:47:30 +0000 (14:47 +0100)]
Bug 5670: Does not return 0 in Koha::Patron->housebound_* methods

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Update constraint name to match with the one in updatedatabase
Jonathan Druart [Mon, 17 Oct 2016 13:47:02 +0000 (14:47 +0100)]
Bug 5670: Update constraint name to match with the one in updatedatabase

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [Followup] Add 'step 4' edit button.
Alex Sassmannshausen [Thu, 13 Oct 2016 10:37:50 +0000 (12:37 +0200)]
Bug 5670: [Followup] Add 'step 4' edit button.

* koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt:
  Place housebound role form inside the 'step 4' section.
* koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt:
  Add 'step 4' edit button for housebound role.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Add auth_val_cat to auth_val_cat.sql.
Alex Sassmannshausen [Thu, 13 Oct 2016 09:57:06 +0000 (11:57 +0200)]
Bug 5670: Add auth_val_cat to auth_val_cat.sql.

* installer/data/mysql/atomicupdate/housebound_tables.sql: Insert
  HSBND_FREQ in authorised value categories.
* installer/data/mysql/mandatory/auth_val_cat.sql: Add HSBND_FREQ.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoDO NOT PUSH: Moar Housebound Schema files.
Alex Sassmannshausen [Thu, 13 Oct 2016 08:05:46 +0000 (10:05 +0200)]
DO NOT PUSH: Moar Housebound Schema files.

* Koha/Schema/Result/Borrower.pm: New method.
* Koha/Schema/Result/HouseboundRole.pm: New file.

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

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] HouseboundRole CRUD from UI.
Alex Sassmannshausen [Wed, 12 Oct 2016 15:26:02 +0000 (17:26 +0200)]
Bug 5670: [QA Followup] HouseboundRole CRUD from UI.

* koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: Add
  HouseboundRole form.
* members/memberentry.pl: Handle HouseboundRole CRUD.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Display HouseboundRole info.
Alex Sassmannshausen [Wed, 12 Oct 2016 12:30:36 +0000 (14:30 +0200)]
Bug 5670: [QA Followup] Display HouseboundRole info.

* Koha/Patron.pm (housebound_role): New method.
* koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt: Add
  section for HouseboundRole information
* members/moremember.pl: Pass HouseboundRole info to template.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Correct housebound role search.
Alex Sassmannshausen [Mon, 10 Oct 2016 13:38:04 +0000 (15:38 +0200)]
Bug 5670: [QA Followup] Correct housebound role search.

* Koha/Patrons.pm (search_housebound_choosers)
  (search_housebound_deliverers): Use new table.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Create HouseboundRole objects.
Alex Sassmannshausen [Mon, 10 Oct 2016 13:31:19 +0000 (15:31 +0200)]
Bug 5670: [QA Followup] Create HouseboundRole objects.

* Koha/Patron/HouseboundRole.pm: New file.
* Koha/Patron/HouseboundRoles.pm: New file.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Create housebound roles table.
Alex Sassmannshausen [Mon, 10 Oct 2016 10:37:50 +0000 (12:37 +0200)]
Bug 5670: [QA Followup] Create housebound roles table.

* installer/data/mysql/atomicupdate/housebound_tables.sql (housebound_role):
  New table.
* installer/data/mysql/kohastructure.sql (housebound_role): New table.
* installer/data/mysql/en/mandatory/auth_values.sql: Remove HSBND_ROLE entries.
* installer/data/mysql/en/mandatory/patron_attributes.sql: Remove
  HSBND_ROLE entry.
* installer/data/mysql/en/mandatory/patron_attributes.txt: Remove
  explanatory text.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] More "required" messages.
Alex Sassmannshausen [Wed, 28 Sep 2016 14:54:53 +0000 (16:54 +0200)]
Bug 5670: [QA Followup] More "required" messages.

* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: Mark
  houseboundvisit fields as required.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Improve template style.
Alex Sassmannshausen [Wed, 28 Sep 2016 14:33:47 +0000 (16:33 +0200)]
Bug 5670: [QA Followup] Improve template style.

* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: Remove
  toggler class from form, improve look and layout of action buttons.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: remove useless call to ->new when ->search is enought
Jonathan Druart [Wed, 28 Sep 2016 09:21:44 +0000 (10:21 +0100)]
Bug 5670: remove useless call to ->new when ->search is enought

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: mv housebound_* to search_housebound_*
Jonathan Druart [Wed, 28 Sep 2016 09:17:46 +0000 (10:17 +0100)]
Bug 5670: mv housebound_* to search_housebound_*

I think it's better to prefix the subroutine names used to search with
'search_'.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Add the 'required' class to required fields
Jonathan Druart [Wed, 28 Sep 2016 09:17:24 +0000 (10:17 +0100)]
Bug 5670: Add the 'required' class to required fields

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Fix `div.patroninfo`.
Alex Sassmannshausen [Wed, 21 Sep 2016 15:17:25 +0000 (17:17 +0200)]
Bug 5670: [QA Followup] Fix `div.patroninfo`.

* members/housebound.pl: Provide full patron hash keys, extended patron
  attributes & picture to template.
* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt:
  Refactor to use new information.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Small QA fixes.
Alex Sassmannshausen [Mon, 19 Sep 2016 13:21:19 +0000 (15:21 +0200)]
Bug 5670: [QA Followup] Small QA fixes.

* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: Remove
  `console.log` invocations.
* members/housebound.pl ($houseboundvisits, $chooser, $deliverer):
  Remove unused variables.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Housebound link from patron edit.
Alex Sassmannshausen [Mon, 19 Sep 2016 12:18:27 +0000 (14:18 +0200)]
Bug 5670: [QA Followup] Housebound link from patron edit.

* koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc: Add a link
  to the housebound module view if it is switched on.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Avoid CGI::param in list context.
Alex Sassmannshausen [Mon, 19 Sep 2016 11:40:46 +0000 (13:40 +0200)]
Bug 5670: [QA Followup] Avoid CGI::param in list context.

* members/housebound.pl: Force `borrowernumber` to scalar context.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [QA Followup] Don't force ISO dates.
Alex Sassmannshausen [Mon, 19 Sep 2016 11:12:21 +0000 (13:12 +0200)]
Bug 5670: [QA Followup] Don't force ISO dates.

* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: Use
  ".datepicker" class for date input, use `$KohaDates` to filter our iso
  dates.
* members/housebound.pl: Use DateTime and Koha::DateUtils to parse
  incoming date to ISO format.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [Followup] Refactor .pl; error messages.
Alex Sassmannshausen [Thu, 8 Sep 2016 10:39:24 +0000 (12:39 +0200)]
Bug 5670: [Followup] Refactor .pl; error messages.

* members/housebound.pl: Refactor & store messages for encountered
  errors.
* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: Show
  messages.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: [Followup] Return Koha::Patron objects.
Alex Sassmannshausen [Thu, 8 Sep 2016 10:10:45 +0000 (12:10 +0200)]
Bug 5670: [Followup] Return Koha::Patron objects.

* Koha/Patron/HouseboundVisit.pm (chooser, deliverer): Use
  `_new_from_dbic` to return Koha::Patron objects.
* t/db_dependent/Patron/HouseboundVisits.t: Remove TODO section for this.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 5670: Housebound Readers Module
A. Sassmannshausen [Fri, 4 Apr 2014 09:55:07 +0000 (09:55 +0000)]
Bug 5670: Housebound Readers Module

New module to handle management of circulation to Housebound readers.

- Ability to create housebound profiles & scheduled visits for patrons.
- Ability to record users as Deliverers or Choosers (or both), using
  extended patron attributes.
- Ability to link choosers and deliverers to individual delivery runs.
- 'Delivery Frequencies' are customizable through authorised
  values ('HSBND_FREQ').

* koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc: add
  Housebound menu if appropriate.
* Koha/Patron.pm (housebound_profile): New method.
* Koha/Patrons.pm (housebound_choosers, housebound_deliverers): New
  methods.
* Koha/Patron/HouseboundProfile.pm: New File.
* Koha/Patron/HouseboundProfiles.pm: New File.
* Koha/Patron/HouseboundVisits.pm: New File.
* Koha/Patron/HouseboundVisit.pm: New File.
* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: New file.
* members/housebound.pl: New file.
* installer/data/mysql/kohastructure.sql: Add housebound_* tables.
* installer/data/mysql/sysprefs.sql: Add HouseboundModule syspref.
* koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref:
  Add HouseboundModule syspref.
* installer/data/mysql/atomicupdate/housebound_tables.sql: New file.
* t/db_dependent/Patron/Borrower_Housebound.t: New file.
* t/db_dependent/Patron/Borrower_HouseboundProfiles.t: New file.
* t/db_dependent/Patron/Borrower_HouseboundVisits.t: New file.

Test plan:
- Apply patch.
- Run atomic update script.
- Run Unit Tests (t/db_dependent/Patron/Housebound*)
- Optionally, add additional authorised values to 'HSBND_FREQ'.
- Switch on 'HouseboundModule' syspref.
- Ensure 'ExtendedPatronAttributes syspref is on.
- On patron pages, when editing, add some to the Housebound deliverer
  and chooser groups.
- On a patron page, the Housebound menu should now be present.
  - create housebound profile
    + ensure Frequency values seem pulled from 'HSBND_FREQ'.
  - create 'housebound visits' (deliveries)
    + ensure chooser/deliverer lists are populated with patrons that
      have the Chooser or Deliverer Attribute type.
  - edit visits.
  - delete visits.
- Switch off 'HouseboundModule'
  - the Housebound menu should disappear

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Bug 5670: [Followup] Rename test files.

* t/db_dependent/Patron/Borrower_Housebound.t: Rename to
  t/db_dependent/Patron/Housebound.t.
* t/db_dependent/Patron/Borrower_HouseboundProfiles.t: Rename to
  t/db_dependent/Patron/HouseboundProfiles.t.
* t/db_dependent/Patron/Borrower_HouseboundVisits.t: Rename to
  t/db_dependent/Patron/HouseboundVisits.t.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Bug 5670: [QA Followup] Fix category_type ref.

* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: Replace
  references to `category_type` with `categorycode`.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoDO NOT PUSH: Add Housebound Schema files.
Alex Sassmannshausen [Fri, 27 May 2016 12:08:23 +0000 (12:08 +0000)]
DO NOT PUSH: Add Housebound Schema files.

* Koha/Schema/Result/HouseboundProfile.pm: New file.
* Koha/Schema/Result/HouseboundVisit.pm: New file.

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

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
8 years agoBug 17425 [QA Followup] - Remove superfluous tests
Kyle M Hall [Fri, 21 Oct 2016 18:15:50 +0000 (18:15 +0000)]
Bug 17425 [QA Followup] - Remove superfluous tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17425: Add the Object::MethodNotCoveredByTests exception
Jonathan Druart [Thu, 13 Oct 2016 13:17:13 +0000 (14:17 +0100)]
Bug 17425: Add the Object::MethodNotCoveredByTests exception

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17425: Add Try::Tiny dependency
Tomas Cohen Arazi [Tue, 11 Oct 2016 11:33:24 +0000 (13:33 +0200)]
Bug 17425: Add Try::Tiny dependency

This patch just introduces Try::Tiny as a core Koha dependency.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17425: Make Koha::Object raise exceptions
Tomas Cohen Arazi [Tue, 11 Oct 2016 09:52:12 +0000 (11:52 +0200)]
Bug 17425: Make Koha::Object raise exceptions

This patch makes Koha::Object raise exceptions in the following
situations:
- When a non existent accessor is called
- When a non existent property is tried to be updated using ->set

On implementing this change, we introduce Koha::Exceptions::Object class
to contain all Koha::Object-specific exception definitions.

Unit tests for this change are introduced in
t/db_dependent/Koha/Objects.t

To test:
- Apply the patches on master
- Run:
  $ prove t/db_dependent/Koha/Objects.t
=> SUCCESS: Tests return green
- Sign off

Note: A followup introduces the dependency for Try::Tiny. It needs to be
present for running the tests.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17341: Enhance the report action button on guided_reports.pl
Josef Moravec [Mon, 26 Sep 2016 10:37:29 +0000 (12:37 +0200)]
Bug 17341: Enhance the report action button on guided_reports.pl

Test plan:
1) Apply the patch
2) Go to saved reports page
3) In the most right column of table you should see "Run" button with
   caret button, the first one should run the report, the second one
   should work asi menu trigger
4) Ensure that all report actions works as before

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>
8 years agoBug 17080 [QA Followup] - Fix number of tests
Kyle M Hall [Fri, 21 Oct 2016 17:34:16 +0000 (17:34 +0000)]
Bug 17080 [QA Followup] - Fix number of tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17080: categories.checkprevcheckout - use the default value defined in the DBIx...
Jonathan Druart [Mon, 8 Aug 2016 13:14:36 +0000 (14:14 +0100)]
Bug 17080: categories.checkprevcheckout - use the default value defined in the DBIx::Class schema

This patch reverts bug 17069

Test plan:
Create a new patron category

  prove t/db_dependent/Koha/Patron/Categories.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>
8 years agoBug 17080: borrowers.checkprevcheckout - use the default value defined in the DBIx...
Jonathan Druart [Mon, 8 Aug 2016 13:13:10 +0000 (14:13 +0100)]
Bug 17080: borrowers.checkprevcheckout - use the default value defined in the DBIx::Class schema

This line has been added by bug 16917 to define the default value of
borrowers.checkprevcheckout.
As this value is defined in the DBIx::Class schema, we should not have
to handle it here.

Test plan:
Confirm that this patch does not reintroduced the bug fixed by bug
16917.

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>
8 years agoBug 17080: borrowers table - use default values defined in the DBIx::Class schema
Jonathan Druart [Mon, 8 Aug 2016 13:14:03 +0000 (14:14 +0100)]
Bug 17080: borrowers table - use default values defined in the DBIx::Class schema

This patch basically just revert bug 16960 - Fix error on validating the
registration

This job is now done by the Koha::Object constructor, no need to clean
the hash before sending it to AddMember.

Test plan:
Make sure there is no regression on bug 16960 (validate a self registration).

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>
8 years agoBug 17080: Make C4::Members::AddMember uses Koha::Patron->store
Jonathan Druart [Mon, 8 Aug 2016 13:12:09 +0000 (14:12 +0100)]
Bug 17080: Make C4::Members::AddMember uses Koha::Patron->store

These calls have been added from commit e196f19 (Bug 12633: Remove SQLHelper
in C4::Members) which added a TODO:
"This patch replaced the calls to SQLHelper to use DBIX::Class.
TODO: Move them to Koha::Borrower."

This is now done by this patch: instead of calling DBIx::Class directly
we use Koha::Patron

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>
8 years agoBug 17080: Handle default values for NOT NULL columns from Koha::Object->new
Jonathan Druart [Mon, 8 Aug 2016 13:13:40 +0000 (14:13 +0100)]
Bug 17080: Handle default values for NOT NULL columns from Koha::Object->new

Recently we face the same issue on different modules after we moved them to the
Koha namespace using Koha::Object of using DBIx::Class directly.

1/ Koha::Patron::Modification on bug 16960 comment 14 and 15
2/ Koha::Patron::Category from bug 17069
3/ C4::Members::AddMember (which does not use Koha::Object) on bug 16917

If a DB column is defined as NOT NULL and has a default value, the DBIx::Class
$rs->update_or_insert method won't use the default value if the column name
has been passed to the constructor.

We do that almost everywhere as we retrieve the data from the HTML forms without
checking/cleaning them.

There are several ways to fix that:
1/ Continue to fix them case by case (what we did for the recent issues)
2/ Try to fix them globally (existing ones and the next ones)

This patch propose a global solution to avoid future issues of this kind.

The idea is not to pass the undefined values which cannot be nullable to the
DBIx::Class constructor.

Tested all patches together. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16965: Allow Koha::Objects->result_class
Jonathan Druart [Thu, 13 Oct 2016 12:39:09 +0000 (13:39 +0100)]
Bug 16965: Allow Koha::Objects->result_class

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16965: [Follow-up] Adjust get_object_class
Marcel de Rooy [Thu, 28 Jul 2016 12:28:43 +0000 (14:28 +0200)]
Bug 16965: [Follow-up] Adjust get_object_class

In many cases it should be possible to derive the Koha::Objects class
name from the DBIx result class name in a trivial manner.
If not, the DBIx result class should have a class method called
koha_objects_class providing that non-trivial name, such as Libraries
for Branch.

Note: We are only interested in the plural form here (Koha::Objects).

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

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16965: search_related returns an instanciated Koha::Objects-based object
Jonathan Druart [Mon, 25 Jul 2016 10:16:59 +0000 (11:16 +0100)]
Bug 16965: search_related returns an instanciated Koha::Objects-based object

Koha::Objects->search_related should return a Koha::Objects-based
object.
This search_related method should follow the same rules as the search
method, i.e. take into account what the caller want (scalar or list).
The problem here is that we do not know (in Koha::Objects) what is the
kind of objects we want to instanciate. To know it, this patch adds a
get_object_class, it will return the class of the object and the
resultset Koha::Object-based object.

The drawback of this method is that we will have to keep it up-to-date
every time we add a new Koha::Object class.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16965: Add Koha::Objects->search_related
Jonathan Druart [Fri, 22 Jul 2016 16:20:08 +0000 (17:20 +0100)]
Bug 16965: Add Koha::Objects->search_related

In order to search on relations, we need this new method.

Test plan:
Confirm that the changes in Objects.t make sense and that the tests
pass.

Tested all 3 patches together, followed test plan, result OK
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 15131 - DBRev 16.06.00.035
Kyle M Hall [Fri, 21 Oct 2016 17:28:42 +0000 (17:28 +0000)]
Bug 15131 - DBRev 16.06.00.035

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 15131: Add AllowItemsOnHoldCheckoutSCO to UsageStats
Jonathan Druart [Wed, 28 Sep 2016 12:37:05 +0000 (13:37 +0100)]
Bug 15131: Add AllowItemsOnHoldCheckoutSCO to UsageStats

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 15131: Make SCO use the new syspref.
Tomas Cohen Arazi [Mon, 11 Jul 2016 15:57:29 +0000 (12:57 -0300)]
Bug 15131: Make SCO use the new syspref.

This patch just makes SCO use the new syspref (AllowItemsOnHoldCheckoutSCO)
instead of the old one, thus making it configurable, separate from the
non-SCO syspref.

Sponsored-by: NEKLS
Signed-off-by: George <george@nekls.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 15131: Instroduce AllowItemsOnHoldCheckoutSCO syspref
Tomas Cohen Arazi [Mon, 11 Jul 2016 15:47:49 +0000 (12:47 -0300)]
Bug 15131: Instroduce AllowItemsOnHoldCheckoutSCO syspref

This patch introduces a new syspref AllowItemsOnHoldCheckoutSCO, so the current
AllowItemsOnHoldCheckout syspref can be decoupled for the SCO module, giving
the library more flexibility.

During upgrade, it gets its value from the original AllowItemsOnHoldCheckout syspref.

Sponsored-by: NEKLS
Signed-off-by: George <george@nekls.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17445: Move the params check after the authentication check
Jonathan Druart [Fri, 14 Oct 2016 13:26:58 +0000 (14:26 +0100)]
Bug 17445: Move the params check after the authentication check

If the user is not authorised to call this route, we would prefer to
raise a 403 instead of 400

Note that we wanted to submit tests for this change but the city code
does not let use do that (we are allowed to list/show cities even
without any permissions). The patrons.t is not complete enought and the
holds.t tests do not pass...

Tomas plans to submit tests but we reach the end of the hackfest ;)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17445: Just some refactoring
Jonathan Druart [Fri, 14 Oct 2016 13:23:20 +0000 (14:23 +0100)]
Bug 17445: Just some refactoring

The idea is to make the code more readable moving the code to its own
subroutine

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17445: Add 'malformed query' error response
Martin Renvoize [Fri, 14 Oct 2016 08:57:30 +0000 (08:57 +0000)]
Bug 17445: Add 'malformed query' error response

This patch adds to the x-mojo-around action code to give a meaningful
error given a bad query parameter in the query string for a request.

Test Plan
1) Submit an api request to an existing restful endpoint with no query
parameters
2) Confirm the correct response is being given
3) Submit an api request to an existing restful endpoint with an allowed
query parameter
4) Confimr the correct response is being given
5) Submit an api request to an existing restful endpoint with a
malformed query paramter
6) Note the 400 response code and helpful json api body

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17444: Enable exporting by time, not only date
Josef Moravec [Tue, 15 Dec 2015 11:07:38 +0000 (12:07 +0100)]
Bug 17444: Enable exporting by time, not only date

Test plan:
1) Apply the patch
2) Edit a biblio
3) run export_records.pl with date time few minutes in the past
for example: --format=xml --record-type=bibs --date="2016-10-14 10:00:05" --filename="koha.xml"
4) look in the file and cofirm that the right record was exported
5) Try the same but with time after the biblio was edited, it shouldn't be exported

Signed-off-by: radiuscz <radek.siman@centrum.cz>
Bug 17444: Follow-up, don't change the name of parameter "date"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16907: Make sure the log will be written only if the patron has been deleted
Jonathan Druart [Tue, 9 Aug 2016 09:17:18 +0000 (10:17 +0100)]
Bug 16907: Make sure the log will be written only if the patron has been deleted

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16907: Koha::Patrons - Move HandleDelBorrower to ->delete
Jonathan Druart [Mon, 11 Jul 2016 20:35:15 +0000 (21:35 +0100)]
Bug 16907: Koha::Patrons - Move HandleDelBorrower to ->delete

This job should be done each time patron data are deleted. It's better
to do it just before deleting the patron than assuming the caller did
the job by itself.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16907: Koha::Patrons - Move DelMember to ->delete
Jonathan Druart [Mon, 11 Jul 2016 20:18:56 +0000 (21:18 +0100)]
Bug 16907: Koha::Patrons - Move DelMember to ->delete

This patch moves the C4::Members::DelMember subroutine to the
Koha::Patron module.
The delete method must be overwritten to permit handling of patron's
holds.

Test plan:
(With the 2 patches applied)
1/ Create a patron with holds and owner of lists
2/ Delete patrons using the web interface:
 - More > Delete on a patron page
 - Batch patron deletion tools
3/ and the cronjob script
 - perl misc/cronjobs/delete_patrons.pl -c [more options]

The patron should have been moved to the deletedborrowers table, his/her
holds and lists should have been deleted.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16891: Move C4::Members::MoveMemberToDeleted to Koha::Patron->move_to_deleted
Jonathan Druart [Sat, 9 Jul 2016 15:03:11 +0000 (16:03 +0100)]
Bug 16891: Move C4::Members::MoveMemberToDeleted to Koha::Patron->move_to_deleted

This patch removes the C4::Members::MoveMemberToDeleted subroutine in
order to replace it with the Koha::Patron->move_to_deleted method.
Next after this change, we will move C4::Members::HandleDelBorrower and
C4::Members::DelMember to the same module to simplify the code in
members/deletemem.pl and misc/cronjobs/delete_patrons.pl

Test plan:
1/ Delete a patron from the staff interface and make sure (s)he has been moved to
the deletedborrowers table.
2/ Use the "Batch patron deletion" tool (tools/cleanborrowers.pl) to
remove patron. Make sure the "Permanently delete these patrons" and "Move
these patrons to the trash" options work as before
3/ Same as previously but using the cronjob
misc/cronjobs/delete_patrons.pl.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Tested the delete_patrons.pl script and cleanborrowers.pl too.
Tests (are relevant and) pass and the qa scripts are happy too :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
8 years agoBug 17318: Allow chosing fixed normalization routines
Tomas Cohen Arazi [Wed, 21 Sep 2016 14:40:09 +0000 (11:40 -0300)]
Bug 17318: Allow chosing fixed normalization routines

This patch changes the matching-rules.pl page, so it allows the user to choose
from the different hardcoded normalization routines. It is done using TT blocks
and the routine descriptions are translatable.

To test:
- Create some matching rule
- Have free text values on the 'Normalization rule' field
- Apply the patches
- Create a new routine
=> SUCCESS: You can now only choose between fixed option
- Save the rule
- Open it for editing
=> SUCCESS: Chosen rules are preserved
- Edit the original free-text including rule
=> SUCCESS: Rules fall back to 'None'
- Sign off :-D

TODO: A followup will add a warning about the current value and the fact that
      saving the matching rule will overwrite those, with 'none'.

Sponsored-by: FIT
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>
8 years agoBug 17318: Make C4::Matcher::_get_match_keys handle 'norms' param
Tomas Cohen Arazi [Mon, 19 Sep 2016 15:25:31 +0000 (12:25 -0300)]
Bug 17318: Make C4::Matcher::_get_match_keys handle 'norms' param

The current implementation doesn't care about that parameter, and applies
a default normalization rule that seems counter-productive (in general) for
its aleged purpose.

This patch makes it handle the following values for 'norms':

    - upper_case
    - lower_case
    - remove_spaces
    - legacy_default
    - none

They make it call the relevant Koha::Utils::Normalize routines. 'legacy_default'
is used only for backwards compatibility, but could be removed if there's consensus.

To test:
- Run:
  $ prove t/Matcher.t
=> FAIL: most _get_match_keys tests fail
- Apply the patch
- Run:
  $ prove t/Matcher.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: FIT
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>
8 years agoBug 17318: Unit tests
Tomas Cohen Arazi [Mon, 19 Sep 2016 15:17:41 +0000 (12:17 -0300)]
Bug 17318: Unit tests

The current C4::Matcher::_get_match_keys implementation doesn't take
normalization rules params into account. This patch makes Matcher.t test the
proposed behaviour for new hardcoded values, that match string normalization
routines introduced by Bu 17302.

Possible values are:
- upper_case
- lower_case
- remove_spaces
- legacy_default
- none

* 'legacy_default' is left (for now) to catch the current behaviour. So tests which
did not get a 'norm' param, now are passed 'legacy_default' and they still pass.

* 'none' means no normalization, of course

Note: on introducing 'none', a bug got highlighted, because the subfields traversal loop
was introducing an unneeded space. The tests from 17304 get adjusted to reflect this.

To test:
- Run:
  $ sudo koha-shell kohadev ; cd kohaclone
  $ prove t/Matcher.t
=> FAIL: The routine doesn't care about the norms param.

Sponsored-by: FIT
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>
8 years agoBug 17253: Fetch all the columns instead of only authorised_value
Jonathan Druart [Thu, 13 Oct 2016 10:09:54 +0000 (11:09 +0100)]
Bug 17253: Fetch all the columns instead of only authorised_value

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues
Jonathan Druart [Wed, 31 Aug 2016 09:55:25 +0000 (10:55 +0100)]
Bug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues

This patch replaces the call to C4::Koha::GetKohaAuthorisedValues with
Koha::AuthorisedValues->search_by_koha_field

Test plan:
AV descriptions should be displayed on the following pages:
- XSLT view - location and ccode
- Bibliographic detail, moredetail and OPAC pages - location, ccode, copynumber
- returns - location
- opac-basket - ccode, location
- The 3 reports: catalogue_stats.pl, issues_stats.pl and
  reserves_stats.pl - location, ccode

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17252 - Koha::AuthorisedValues - Remove GetAuthorisedValueByCode
Jonathan Druart [Tue, 30 Aug 2016 16:04:28 +0000 (17:04 +0100)]
Bug 17252 - Koha::AuthorisedValues - Remove GetAuthorisedValueByCode

The subroutine C4::Koha::GetAuthorisedValueByCode returned the
description (staff or opac) for a given authorised value.

Note that we may need a unique key to ->find instead of ->search.

Test plan:
- Checkin an item that cannot be checked in because it's lost, the
  message should display the AV description
- Generate a letter with borrowers.streettype equals an ROADTYPE AV, the
  description should be displayed.
- Edit a patron attribute type, the AV dropdown list should be
  displayed
- Create the PA_CLASS AV category (see bug 7154) and make sure it
  behaves as before when editing a patron
- The checkout list should display descriptions for LOC, LOST and
  DAMAGED

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 17251: Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesMapping
Jonathan Druart [Wed, 10 Aug 2016 11:29:57 +0000 (12:29 +0100)]
Bug 17251: Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesMapping

This subroutine was only used once in GetItemsForInventory.
It can be replaced with a quite simple search on AV join on
authorised_value_categories and marc_subfield_structures tables.

Note that the "interface" parameter was always set to "staff" and was
useless.

Test plan:
Play with the inventory and confirm that the AV descriptions are
correctly displayed.

The tests in t/db_dependent/Items/GetItemsForInventory.t cover this
change and should still pass.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>