Commit graph

24731 commits

Author SHA1 Message Date
Julian Maurice
d074c77deb Bug 13799: Reword 'borrower' to 'patron'
Also, complete the Swagger definition of a patron

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:33 -03:00
Julian Maurice
7fe57de8e2 Bug 13799: Change 'required' value type from string to boolean
String is not accepted as a valid value in more recent versions of
Swagger2 module

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:33 -03:00
Julian Maurice
2cd6bce442 Bug 13799: Allow to set Mojolicious secret in $KOHA_CONF
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:33 -03:00
Julian Maurice
93a88eaaf6 Bug 13799: Change Mojolicious default mode to 'production'
This avoid getting a debug page when URL is wrong.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:33 -03:00
5533d65801 Bug 13799: (QA followup) make tests use random data
With the introduction of TestBuilder there's no need to
rely on existing data on the DB (the original patch relies
on categories and branches already existing).

This patch creates a random branch, category and two borrowers
with the fixed data that is needed for the tests. It adjusts
the tests to use the randomized data instead of the previously
fixed one.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The feature works as expected and all tests passes. koha-qa.pl too.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:33 -03:00
Julian Maurice
631694cd96 Bug 13799: Fix API unit tests
They were failing because of the now required 'borrowers' permission

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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:33 -03:00
Julian Maurice
63cb4b9d3e Bug 13799: Add missing license notices
Signed-off-by: Joonas Kylmälä <j.kylmala@gmail.com>
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:33 -03:00
Julian Maurice
b4c6ad6603 Bug 13799: Add cookie-based authentication to REST API
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:32 -03:00
Julian Maurice
c83cd77411 Bug 13799: RESTful API with Mojolicious and Swagger2
Actual routes are:
  /borrowers
    Return a list of all borrowers in Koha

  /borrowers/{borrowernumber}
    Return the borrower identified by {borrowernumber}
    (eg. /borrowers/1)

There is a test file you can run with:
  $ prove t/db_dependent/rest/borrowers.t

All API stuff is in /api/v1 (except Perl modules)
So we have:
  /api/v1/script.cgi     CGI script
  /api/v1/swagger.json   Swagger specification

Change both OPAC and Intranet VirtualHosts to access the API,
so we have:
  http://OPAC/api/v1/swagger.json   Swagger specification
  http://OPAC/api/v1/{path}         API endpoint
  http://INTRANET/api/v1/swagger.json   Swagger specification
  http://INTRANET/api/v1/{path}         API endpoint

Add a (disabled) virtual host in Apache configuration api.HOSTNAME,
so we have:
  http://api.HOSTNAME/api/v1/swagger.json   Swagger specification
  http://api.HOSTNAME/api/v1/{path}         API endpoint

Add 'unblessed' subroutines to both Koha::Objects and Koha::Object to be
able to pass it to Mojolicious

Test plan:
  1/ Install Perl modules Mojolicious and Swagger2
  2/ perl Makefile.PL
  3/ make && make install
  4/ Change etc/koha-httpd.conf and copy it to the right place if needed
  5/ Reload Apache
  6/ Check that http://(OPAC|INTRANET)/api/v1/borrowers and
     http://(OPAC|INTRANET)/api/v1/borrowers/{borrowernumber} works

Optionally, you could verify that http://(OPAC|INTRANET)/vX/borrowers
(where X is an integer greater than 1) returns a 404 error

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 13:47:32 -03:00
314f3e22d9 Bug 15014: Returns 0 if everything went fine
Be kind and return 0 if the sample file has been generated correctly.
Otherwise you are a bad guy and you make Plack returns an internal error
(exited nonzero: 1 at /home/vagrant/kohaclone/tools/import_borrowers.pl line 390.)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Works as expected
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Works as expected here too.
2015-11-04 13:32:01 -03:00
9708ffa1d3 Bug 12933: DBRev 3.21.00.050
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:45:51 -03:00
Katrin Fischer
3efbad2ce9 Bug 12933: (QA followup) Add missing notice templates and other small fixes
- Fixes page title of slip print window: Members > Patrons
- Fixes error message if no notice template is found
- Fixes a stray template variable that resulted in the
  borrower number showing in the 'Print' pull down
- Fixes xt/sample_notices.t by adding the sample notice to
  it-IT and es-ES

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
f668ca7dae Bug 12933: (QA followup) Rename GetOverdues to GetOverduesForPatron
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
1d2174d815 Bug 12933: (QA followup) Add Unit Tests
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
78db3adda2 Bug 12933: (QA followup) Rename parse_letter to parse_overdues_letter
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
492e524799 Bug 12933: Add new OVERDUES_SLIP letter
Signed-off-by: Amy Purvis <APurvis@galencollege.edu>
Signed-off-by: Laurie McKee <lmckee@littleelm.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
e6127b1bc0 Bug 12933: Add ability to print overdue slip from staff intranet
Some librarians would like to be able to print an overdues slip from the
staff intranet. This slip would be defined as the print transport
version of the ODUE slip.

Test Plan:
1) Apply this patch
2) Locate a patron with overdues
3) Define a print version of the OVERDUES_SLIP slip
4) Try Print > Print overdues

Signed-off-by: Amy Purvis <APurvis@galencollege.edu>
Signed-off-by: Laurie McKee <lmckee@littleelm.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
b8891b9275 Bug 15095: marc_modificacation_template_actions DB not consistent between fresh and updated DB
A review of the 3.20.00 + upgrade DB, compared to a fresh master install
highlighted an inconsistency on that table. This is mysqldbcompare's
output for it:

-   `action` enum('delete_field','update_field','move_field','copy_field','copy_and_replace_field') COLLATE utf8_unicode_ci DEFAULT NULL,
?                                                                        -------------------------                          ^^^^^^
+   `action` enum('delete_field','update_field','move_field','copy_field') COLLATE utf8_unicode_ci NOT NULL,

So one ENUM value is missing on fresh installs, and an upgraded one
yields a DEFAULT NULL configuration for the 'action' column.

To test:
1) have a v3.20.00 DB:
  > CREATE DATABASE koha_master_upgraded;
  $ git checkout v3.20.00
  $ mysql koha_master_upgraded < installer/data/mysql/kohastructure.sql
2) upgrade it to latest master by running:
  $ git checkout origin/master
  $ perl installer/data/mysql/updatedatabase.pl
3) Create a new DB
  > CREATE DATABASE koha_master_fresh;
  $ mysql koha_master_fresh < installer/data/mysql/kohastructure.sql
4) Run mysqldbcompare (you need mysql-utilities installed for that)
  $ mysqldbcompare --difftype=differ --server1=root@localhost \
                   --skip-data-check --skip-table-options \
                   --run-all-tests  koha_master_upgraded:koha_master_fresh
=> FAIL: You will notice the marc_modification_template_actions discrepancy
- Repeat from 1), but apply this patch on 2) before the upgrade.
=> SUCCESS: The DB's discrepancies are now irrelevant [1]
- Sign off :-D

[1] Only KEY definition order is 'wrong', but it is not relevant.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:28 -03:00
29e97b85f0 Bug 11431: DBRev 3.21.00.049
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:23 -03:00
a39910ecb6 Bug 11431: (QA followup) Make audio alerts sql top level
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:33:53 -03:00
Katrin Fischer
2f6d1e8240 Bug 11431: (QA followup) Typo in help file / variable name
Fixes the variable name to avoid a double-up that made it
impossible to turn off the sounds in general. If AudioAlerts
are turned off, they will only work on the audio administration
page now so you can set up and test the different sounds there.

Also fixes a little typo in the help file.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:33:44 -03:00
7091c6b274 Bug 11431: (QA followup) Add ability to edit audio alerts
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:10 -03:00
eead133e77 Bug 11431: (QA followup) Update help
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:10 -03:00
dc0c851fc9 Bug 11431: (QA followup) Always allow audio alerts for audio alerts editor page
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:10 -03:00
07ddb07341 Bug 11431: (QA followup) Fix alter precedences on delete
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:10 -03:00
e9ba2c5c53 Bug 11431: (QA followup) Hard code list of sounds for security
The sounds directory is no longer available for listing for security.
It is better and safer to hard code the list of sounds.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:10 -03:00
f0127ddb4d Bug 11431: (QA followup) Move AudioAlerts to a separate plugin
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:10 -03:00
3a4299327b Bug 11431: (QA followup) Simplify audio_alert_id to just id
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:10 -03:00
f143b31d1f Bug 11431: (QA followup) Unit Tests
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:33:03 -03:00
f73fdc9ebb Bug 11431: (QA followup) Fix js error
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:32:58 -03:00
386d36b3a3 Bug 11431: Update UsageStats.pm
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:32:58 -03:00
245e71cb06 Bug 11431: (QA followup) Fix POD
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:32:58 -03:00
b8dd899738 Bug 11431: (QA followup) Allow https in sound URLs
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:32:58 -03:00
220ff161e9 Bug 11431: Add additional sound options
This patch set replaces and extends Koha's current sound options.
This is implemented be removing the existing sound system, and
re-engineering using a table of selector/sound combinations such that
the highest precedence selector that is found in the DOM will trigger
and audio alert. The existing audio behaviors are implemented as a set
of default audio alerts.

Test Plan:
1) Apply this patch set
2) Run updatedatabase.pl
3) Enable the AudioAlerts system preference
4) Test existing sounds
5) Enter the new alerts editor in the admin section
6) Add a new audo alert with the following selector:
    "body:contains('Check in message')",
   choose any sound alert you wish, make sure it's not one of the 3
   sounds already used! Make this selector precedence 1
4) Browse to the checkins page, you should hear the default sound
5) Attempt to return an invalid barcode, you should hear your custom sound!

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:32:57 -03:00
7df384c17d Bug 11431: DBIC update schema
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:32:57 -03:00
5e4077ae91 Bug 11431: Add audio alerts to installer
http://bugs.koha-community.org/show_bug.cgi?id=11431
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-11-04 12:32:57 -03:00
88bf1a75db Bug 11431: Update database
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:32:57 -03:00
afc3db4d68 Bug 15081: (QA followup) Fix issue with Barcodes_ValueBuilder.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:32:57 -03:00
9d82253d0a Bug 15081: (followup) Make test files using TestBuilder handle their transactions
This trivial patch introduces the code needed on the test files so they handle
the DB transaction instead of relying on the (removed) transaction started/rolled back
by TestBuilder.

Tested all of the files before and after applying the patch, resultes are the same.
(Pass exept of t/db_dependent/Barcodes_ValueBuilder.t, this has the same error).
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:32:57 -03:00
00900e8a51 Bug 15081: Take transaction handling out from TestBuilder
This patch removes transaction handling code from TestBuilder.
It fixes the TestBuilder.t to handle the transaction on its own.

Verify that t/db_dependent/TestBuilder.t passes.

Followed test plan, TestBuilder.t passes
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:32:56 -03:00
3cab4d1efd Bug 14978: (RM followup) DBIx update
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:32:56 -03:00
93d93b3637 Bug 14805: Replace generic 'items' with the specific ones
Signed-off-by: Joonas Kylmälä <j.kylmala@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:13:32 -03:00
Joonas Kylmälä
67cb605872 Bug 14805: (follow-up) fix a bug in previous code and change msg string
Previously the code didn't work if there was only one batch available for selection.
This fixes that now. Also there was a bug with wrong string showing now it's
changed to a general one, "items". I choosed the string "items" because there was
difficulties adding the plural part of the word. One cannot add just s to the end
of the word batch like you can in the case of profile.

Sponsored-by: Vaara-kirjastot

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:13:32 -03:00
531bfc8568 Bug 14805: QA follow-up
This patches remove a trailing whitespace and simplify 2 parts of code.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:13:32 -03:00
Joonas Kylmälä
808ec53c14 Bug 14805: Allow the user to delete multiple batches
Allows the user to delete multiple patron card batches.

Test plan:

1. Add first some 20 batches
2. Go to the edit page of some X batch by first selecting from the
   batch list the batch you want to edit and then after that by clicking
   edit.
3. Delete one batch by selecting one batch and then clicking delete.
4. Select 0 batches and click delete, notice you cannot delete.
5. Select 0 batches and click edit, notice you cannot edit.
6. Select 2 batches and click edit, notice you cannot edit.
7. Apply patch
8. Check that steps from 2-6 work like they worked before.
   (and add more batches so that you have ~20 of them)
9. Select 2 batches and click delete. Make sure they are deleted.
10. Try to figure out some anomalies this patch might have caused.

Sponsored-by: Vaara-kirjastot

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: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:13:31 -03:00
Jonathan Druart
b9a22b3636 Bug 8438: Users can only claim for serials related to their branch.
Only superlibrarian users and users with superserials permission
can override this limitation.

This patch adds a new subroutine C4::Serials::can_claim_subscription.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

The upgrading of the DB was as required:
for each [PT/S] patron with the permission "claim_serials" ON,
the permission "superserials" became[/was kept to] ON.

Then, after having checked the DB upgrading, to test the currently
adding limitation:
> Users can only claim for serials related to their branch
, I reset 2 PT/S patrons-users to:
permission claim_serials: YES
permission superserials: NO
and I set the syspref "IndependendeBranches" to "Prevent".

For:
> Only superlibrarian users can override this limitation.
the S patron-user could list AND claim:
A) subscriptions of his own branch,
B) subscriptions of other branch,
C) subscriptions without branch.

For:
> Only users with superserials permission can override this limitation.
the PT patron-user could list:
A) subscriptions of his own branch,
B) subscriptions of other branch,
C) subscriptions without branch,
and could claim only:
A) subscriptions of his own branch,
C) subscriptions without branch.

NB: a subscription is selected to be claimed.

Then I set the syspref "IndependendeBranches" to "Don't prevent".
The behaviour was [exactly the same as in master] without the added
limitation.

On [S/PT] patrons, if permission claim_serials was NO, no Claims
link was available on Serials' page, either under "Prevent" or under
"Don't prevent".

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Added the results of Paola's testing to the commit message
as test plan.

Note to RM: Maybe we could add a note to the release notes, that
Koha now enforces superserials with independent branches better,
so people might have to adapt permissions in order to claim
for other branches.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:12:28 -03:00
Katrin Fischer
57ceda5672 Bug 8436: QA Follow-up: Add Library to result list
If we offer a library filter, we should also show the
library in the result list, so that search options
and result list match.

Otherwise, for libraries with multiple branches, there
is no way to see, which is the subscription of a
specific branch in the list.

- Add a Library column in the result list
- Rename branch to library in the template

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:11:47 -03:00
Katrin Fischer
2d22a30d6a Bug 8436: QA Follow-up: Activate branch filter, if IndependentBranches is off
The superserials permission is only in use in combination with
IndependentBranches - so it makes sense to also show the branch
filter when IndependentBranches is off.

Permission description:
 superserials Manage subscriptions from any branch
 (only applies when IndependentBranches is used)

Also adds a missing check for superlibraian.

Note: the duplicated permission check in the code is not really nice
- would be good to rewrite this to be more clean.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:11:47 -03:00
Julian Maurice
8a48209933 Bug 8436: Use C4::Context->IsSuperLibrarian()
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:11:47 -03:00
Jonathan Druart
da57aba894 Bug 8436: Replace GetBranches with GetBranchesLoop
The branch selection logic still exists in GetBranchesLoop, it should be
used here.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 11:11:47 -03:00