]> git.koha-community.org Git - koha.git/log
koha.git
4 years agoBug 23975: Add ability to search and install plugins from GitHub
Kyle M Hall [Tue, 5 Nov 2019 17:31:04 +0000 (12:31 -0500)]
Bug 23975: Add ability to search and install plugins from GitHub

It would be nice to be able to search and install plugins directly from GitHub ( and GitLab if possible ). This would make it easier to verify the authenticity of plugins and make discovering new plugins easier as well as making installation of plugins simpler.

Test Plan:
1) Apply this patch
2) Add the new block for plugin_repos to your koha-conf.xml
3) Restart all the things!
4) Browse to the plugins home page
5) Try searching for 'patrons' in the new search box
6) Verify you get results!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24615: Make object.search helper also order by embedded columns
Agustin Moyano [Sat, 8 Feb 2020 02:54:14 +0000 (23:54 -0300)]
Bug 24615: Make object.search helper also order by embedded columns

With this patch REST API request can order results by embedded columns.

Full path to the column must be given for it to work.
For example: If you are on biblio endpoint and you want to order by holding patron's card number you could

> GET /biblio/1?_order_by=item.holds.cardnumber HTTP/1.1
> x-koha-embed: item.holds

To test:
1. apply this patch
2. prove t/db_dependent/Koha/REST/Plugin/Objects.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24502: (follow-up) Add all 3 query parameters in api definition
Agustin Moyano [Thu, 30 Jan 2020 19:20:42 +0000 (19:20 +0000)]
Bug 24502: (follow-up) Add all 3 query parameters in api definition

This patch adds api definition for body, query or header parameters.

To use them include:

* "$ref": "../parameters.json#/q_body" for body parameter.
* "$ref": "../parameters.json#/q_param" for query parameter.
* "$ref": "../parameters.json#/q_header" for header parameter.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24502: object.search also filter by prefetched columns
Agustin Moyano [Sat, 25 Jan 2020 02:59:32 +0000 (23:59 -0300)]
Bug 24502: object.search also filter by prefetched columns

This patch adds the possibility to object.search helper, to also filter by prefetched columns.

In order to dynamically add filter parameters, they must be coded as json and placed in the body of the request, coded as string in 'q' query parameter or as string in 'x-koha-query' header.

The coded json, is in fact dbix syntax.

To test:
1. apply this patch
2. prove t/Koha/REST/Plugin/Query.t t/db_dependent/Koha/REST/Plugin/Objects.t
3. Sign off

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17532: Make koha-shell propagate the error code
Jonathan Druart [Thu, 13 Feb 2020 11:03:36 +0000 (12:03 +0100)]
Bug 17532: Make koha-shell propagate the error code

Context: I am trying to make koha-misc4dev stop when something wrong happens.
Basically we do not want the process to continue of the DB has not been populated correctly.
It will make the errors easier to catch.

The issue: Say a script that will return an error (die in perl for an easy example),
koha-shell will not return the 255 error code, but 0 instead.
The caller cannot know something wrong happened

The solution is to propagate the error and make koha-shell return the same error code
as the command it executed

An example:
=== t.pl ===
die('something wrong');

% perl t.pl;echo $?
something wrong at t.pl line 1.
255

% sudo koha-shell kohadev -p -c 'perl xxx.pl' ; echo $?
something wrong at xxx.pl line 1.
0

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Tested it with
  $ sudo debian/scripts/koha-shell kohadev -c 'exit 8'
  $ echo $?
  8
The unpatched version returns 0 (forgets about the error code).

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24735: DBRev 19.12.00.032
Martin Renvoize [Mon, 2 Mar 2020 11:15:04 +0000 (11:15 +0000)]
Bug 24735: DBRev 19.12.00.032

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24735: Remove more code from tests
Jonathan Druart [Wed, 26 Feb 2020 14:59:02 +0000 (15:59 +0100)]
Bug 24735: Remove more code from tests

That was use by QP tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24735: Remove QueryParser-related code
Jonathan Druart [Wed, 26 Feb 2020 12:28:27 +0000 (13:28 +0100)]
Bug 24735: Remove QueryParser-related code

At the last development meeting we have voted to remove the
QueryParser-related code
https://wiki.koha-community.org/wiki/Development_IRC_meeting_19_February_2020

Hea tells us that it has not been adopted, and the code/bug tracker that
it is not really usable as it. As nobody is willing to work on it, we
decided to remove it instead.

Test plan:
 % prove t/db_dependent/Search.t
must return green

See commits from bug 9239 and confirm that the code is removed in this
patch.

Also play with the search on the UI and confirm that you do not see
obvious regressions

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15377: (QA follow-up) Fix capitalization and column heading
Katrin Fischer [Sat, 29 Feb 2020 23:33:19 +0000 (00:33 +0100)]
Bug 15377: (QA follow-up) Fix capitalization and column heading

Checked Out -> Checked out
Circulation -> Status (matching other pages with this information)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15377: Allow removal of 'checked out' items from course reserves
Rogan Hamby [Tue, 14 Jan 2020 19:38:36 +0000 (14:38 -0500)]
Bug 15377: Allow removal of 'checked out' items from course reserves

1) removes the restriction of not allowing a reserve to be removed if it is onloan
2) adds a column to the display that says with the item is checked out or available based on the onloan flag

testplan: add an item to course reserves, check the item out, check that the Ciruclation column changes to Checked Out and that you can remove it

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Hannah Olsen <holsen@duncanville.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24664: Add missing *-messages-js.po
Bernardo Gonzalez Kriegel [Fri, 14 Feb 2020 14:33:44 +0000 (11:33 -0300)]
Bug 24664: Add missing *-messages-js.po

If you try to update some language translation files
translate script will complain of missing *-messajes-js.po
file.

This patch adds those missing files

To test:
1) Go to misc translation
2) Update some language, eg- fr-FR
Check error
/usr/bin/msgmerge: error while opening "/.../misc/translator/po/es-ES-messages-js.po" for reading: No such file or directory
3) Apply this patch
4) Repeat 2), no error message

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24193: Add CodeMirror linting of JavaScript, CSS, HTML, and YAML
Owen Leonard [Mon, 9 Dec 2019 18:17:34 +0000 (18:17 +0000)]
Bug 24193: Add CodeMirror linting of JavaScript, CSS, HTML, and YAML
system preferences

This patch adds CodeMirror plugins for linting JS, CSS, HTML, and YAML.
When invalid data is entered in a linted CodeMirror editor an icon is
displayed in the editor's "gutter." Hovering over the icon displays the
error message.

This patch renames the minified CodeMirror JS file to match convention
but the version is unchanged.

To test, apply the patch and go to Administration -> System preferences.

Test preferences of each type and confirm that each type of CodeMirror
editor shows an error indicator if you entry invalid data. Valid data
should trigger no error indicator.

 - HTML: e.g.  OpacMainUserBlock,  opacheader. Enter invalid HTML, for
   example "<h1>Hello <h2>World</h2>."
   Example valid HTML: "<h1>Hello world</h1>"
 - JavaScript: e.g. OpacUserJS, IntranetUserJS. Example bad JS,
   "alert("Success!');"
   Example valid JS: "alert("Success!");"
 - CSS: e.g.  IntranetUserCSS, SCOUserCSS. Example bad CSS,
   "p { color blue }"
   Example valid CSS, "p { color: blue; }"
 - YAML: e.g. OpacHiddenItems. Example bad YAML:
   "one: two, three: four"
   Example valid YAML:
   "one: two
    three: four"

Also test that other CodeMirror instances still work correctly without
linting: The advanced MARC editor, SQL reports editing.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17016: (follow-up) Clear with 0.00 instead of blank (Use Price)
Jonathan Druart [Mon, 2 Mar 2020 10:32:34 +0000 (11:32 +0100)]
Bug 17016: (follow-up) Clear with 0.00 instead of blank (Use Price)

Using Price, to formatted it correctly if needed
So far it will not do anything as 'on_editing => 1' we keep 0.00, but it
must be improved later (when we will handle that)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17016: Clear with 0.00 instead of blank
Jonathan Druart [Tue, 25 Feb 2020 10:54:45 +0000 (11:54 +0100)]
Bug 17016: Clear with 0.00 instead of blank

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17016: (follow-up) Removing unnecessary code
Aleisha Amohia [Tue, 25 Feb 2020 04:19:05 +0000 (04:19 +0000)]
Bug 17016: (follow-up) Removing unnecessary code

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17016: Button to clear all fields in budget planning
Aleisha Amohia [Tue, 2 Aug 2016 05:47:28 +0000 (05:47 +0000)]
Bug 17016: Button to clear all fields in budget planning

Currently there is no way to undo the 'auto-fill'. This
patch adds a 'clear' option that resets the row.

To test:
1) Go to Admin --> Budgets
2) Click a budget
3) Click Planning -> any option
4) Test the Auto-fill button to see what it does
5) Apply patch and refresh page
6) Should now be a Clear button
7) Auto-fill the row then click Clear button. Confirm it clears all
fields and sets the fund remaining back to the original amount and
styles.
8) Add another fund and confirm that this still works with multiple
funds.

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21746: Remove NO_LIBRARY_SET
Jonathan Druart [Fri, 14 Feb 2020 11:36:54 +0000 (12:36 +0100)]
Bug 21746: Remove NO_LIBRARY_SET

NO_LIBRARY_SET was used when the DB user was logged in. Since bug 20489
it's not longer possible. We could remove the code.

One occurrence left in C4::InstallAuth as there is no (real) logged in user yet.

Test plan:
* Install Koha to make sure NO_LIBRARY_SET is not needed during the
install process
* Login into Koha
* Make sure the your library's name is displayed correctly in the header
* Set another library
* Confirm that the library's name is updated

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No problem during install, nor changing library.
Fixed (pre-existing) tab in circ/branchtransfers.pl
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24390: (QA follow-up) Fix capitalization and simplyfy code a bit
Katrin Fischer [Sat, 29 Feb 2020 20:57:09 +0000 (21:57 +0100)]
Bug 24390: (QA follow-up) Fix capitalization and simplyfy code a bit

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24390: Add item total to rotating collections
Lucas Gass [Thu, 9 Jan 2020 17:07:59 +0000 (17:07 +0000)]
Bug 24390: Add item total to rotating collections

Displays the number of items in a rotating collection.

TEST PLAN:
1. Set up some rotating collections and add some items to them.
2. No good way to see how many total items are in a given collection.
3. Apply patch
4. Look at collections again and you should see 'Total Items: X'
5. Make sure it is counting the total number of items correctly.

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23547: Add column configuration to course reserves table in the OPAC
Lucas Gass [Wed, 19 Feb 2020 18:25:48 +0000 (18:25 +0000)]
Bug 23547: Add column configuration to course reserves table in the OPAC

This patch adds opac-course-reserves to the column config tool
TEST PLAN:
1. Have some course reserves and go look at opac-course-reserves.pl
2. See all the unconfigurable columns
3. Apply patch
4. Browse to column config > OPAC > course_reserves_table
5. Try hiding each column and make sure the correct column is hidden on opac-course-reserves.pl

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24617: Add number to Descriptions in catalogue detail view
Marcel de Rooy [Mon, 24 Feb 2020 14:05:23 +0000 (14:05 +0000)]
Bug 24617: Add number to Descriptions in catalogue detail view

Same change as in bug 24530 for OPAC.
Only much easier. No trouble from Syndetics.

Test plan:
Add or remove a few notes from the MARC record (tag 500 etc).
Verify the number is correct on the detail page.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested the else part for 'notes' with a [% SET notes = 'test' %] in tt file.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24732: Set DumpTemplateVars Dumper options for Indent and Sort
Nick Clemens [Tue, 25 Feb 2020 18:51:41 +0000 (18:51 +0000)]
Bug 24732: Set DumpTemplateVars Dumper options for Indent and Sort

To test:
1 - Enable sysprefs
    DumpTemplateVarsOpac
    DumpTemplateVarsIntranet
2 - View some pages on staff client and opac
3 - View the page source
4 - See a large mass of comments including the page vars at the top of the source
5 - Refresh page and note order of vars changes
6 - Apply patch
7 - View page source on some pages and note things are much easier to read
8 - Refresh page and note variable order does not change

Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24757: Add more tests
Jonathan Druart [Fri, 28 Feb 2020 16:14:25 +0000 (17:14 +0100)]
Bug 24757: Add more tests

Now we want to make sure we are not missing another situation.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24757: Leap day failing tests - Fix the tests!
Jonathan Druart [Fri, 28 Feb 2020 15:57:56 +0000 (16:57 +0100)]
Bug 24757: Leap day failing tests - Fix the tests!

The same day was returned, for a different subtraction.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24757: Leap day failing tests - refactoring
Jonathan Druart [Fri, 28 Feb 2020 15:47:57 +0000 (16:47 +0100)]
Bug 24757: Leap day failing tests - refactoring

Refactore the tests to add more of them after we fixed the failing ones.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24757: Leap day failing tests - It's like we are on 2020-02-28
Jonathan Druart [Fri, 28 Feb 2020 14:59:36 +0000 (15:59 +0100)]
Bug 24757: Leap day failing tests - It's like we are on 2020-02-28

Those tests were failing on 2020-02-28, next day was a leap day.
Let's fake time and recreate the failure

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22273: DBRev 19.12.00.031
Martin Renvoize [Mon, 2 Mar 2020 09:45:47 +0000 (09:45 +0000)]
Bug 22273: DBRev 19.12.00.031

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22273: Modify Koha::ArticleRequest->store to fill created_on
Marcel de Rooy [Wed, 18 Dec 2019 13:49:59 +0000 (13:49 +0000)]
Bug 22273: Modify Koha::ArticleRequest->store to fill created_on

For a new record, store should fill created_on.
The database will always update the timestamp updated_on.
Since open also calls SUPER::store, we do not need to call it twice.

Test plan:
[1] Run t/db_dependent/ArticleRequests.t
[2] In the interface, add two article requests. Change the status of one
    to PROCESSING. Check created_on and updated_on in the article_requests
    table. The changed request should have updated_on > created_on.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
[1] Tests pass
ok 12 - New article request has created_on date set
ok 13 - New article request has updated_on date set

[2] Work as described.
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22273: Database revision for table article_requests
Marcel de Rooy [Wed, 18 Dec 2019 14:35:50 +0000 (14:35 +0000)]
Bug 22273: Database revision for table article_requests

Column created_on should not be updated. It is filled once by the
store method of Koha::ArticleRequest.
Column updated_on should be a timestamp, updated by the database.

Note: Although higher versions of MySQL and MariaDB support two timestamps
(NOT NULL) in one table, I kept on the safe side by allowing NULL on the
created_on column.

@RM: Don't forget to run DBIx update.

Test plan:
Run new install or upgrade.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22273: Replace typo opan by opac in POD
Marcel de Rooy [Wed, 18 Dec 2019 13:39:57 +0000 (13:39 +0000)]
Bug 22273: Replace typo opan by opac in POD

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17464: Order deny,allow / Deny from all was deprecated in Apache 2.4 and is now...
David Cook [Mon, 13 Jan 2020 06:05:17 +0000 (17:05 +1100)]
Bug 17464: Order deny,allow / Deny from all was deprecated in Apache 2.4 and is now a hard error

Patch change Apache access control from 2.2 to 2.4 directives.

Test plan:
0. Apply patch
1. Build Koha from source
2. Copy or symlink koha-dev/etc/koha-httpd.conf into your relevant
Apache directory.
3. Reload Apache
4. Note a lack of syntax errors regarding the "Order" directive

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23488: Line wrapping doesn't always respect word order in Patron card creator
Maryse Simard [Wed, 21 Aug 2019 21:20:16 +0000 (17:20 -0400)]
Bug 23488: Line wrapping doesn't always respect word order in Patron card creator

When wrapping long lines of text, the line is divided by removing each
word from the end of the line and putting it in a new one until the line
is the right width. When the word to be removed appears multiple time
in the line, it is not the last occurrence that is removed.

This patch changes the regular expression used to remove the part of
the text that is wrapped to a new line, making sure it removes it at
the end of the text.

Test plan:

1. Go to Tools > Patron card creator

2. Have a card template and a card batch
    -> If needs be, you can create them by using
       New > Card template or New > Card batch

3. Create a layout and use one text field containing a long text with
    at least one word which is repeated a minimum of 2 times
    (preferably towrdds the end of the text, since it has to be picked
    as one of the words to appear in the new line). You can use this:

        one two three one two three one two three one two three
        one two three one two three one two three one two three ...

4. Go to Manage > Card batches and export a batch

5. Choose the layout set up in 3.

6. Click the Export button and open the resulting pdf file

7. Notice all the repeated word have been grouped
    -> For this example : all of the ones appear first, followed by
       all the twos and only then the threes.

8. Apply patch

9. Repeat step 4 through 7
    => this time the order of the words has not changed!

Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com>
Signed-off-by: William Frazilien <william.frazilien@inlibro.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23753: Add missing humanMsg library to pages using background job JavaScript
Owen Leonard [Fri, 28 Feb 2020 16:48:37 +0000 (16:48 +0000)]
Bug 23753: Add missing humanMsg library to pages using background job JavaScript

The JavaScript used to process background uploads calls the humanMsg
library under some circumstances. There are several templates which use
background-job-progressbar.js which don't include the humanMsg assets.
This patch corrects those templates.

Note: upload-images.tt has been modified to remove the inclusion of
background-job-progressbar.js because it was unused.

To test, apply the patch and test the following processes which include
background job processing:

 - Batch item modification -- the background job is triggered when you
   submit your changes
 - Batch record modification -- the background job is triggered when you
   submit your changes
 - Stage MARC for import -- the background job is triggered when you
   click the "Sage for import" button after uploading a file
 - Staged MARC management -- the background job is triggered when you
   click "Import this batch into the catalog"

In each case the process should complete correctly. If you would like to
test the error message handling provided by the humanMsg library you can
deliberately introduce an error into the JavaScript. After applying the
patch you can modify js/background-job-progressbar.js to alter line 63
from:

   url: f.action,

...to:

   url: f.action + "foo",

Perform the same tests and confirm that you see an error message. Don't
forget to undo your changes to background-job-progressbar.js before
signing off.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23536: Remove obsolete category markup from patron entry
Owen Leonard [Fri, 28 Feb 2020 15:00:40 +0000 (15:00 +0000)]
Bug 23536: Remove obsolete category markup from patron entry

This patch removes some obsolete markup from the patron entry template
(memberentrygen.tt). The old markup was necessary in a long-gone version
of Koha where it was possible to add patrons using built-in categories
instead of defining your own.

To test, apply the patch and test the process of adding or editing
patrons. You should see the patron category displayed correctly in the
page title, breadcrumbs, and main heading.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23534: Use patron-title.inc on patron entry page
Owen Leonard [Fri, 28 Feb 2020 14:53:53 +0000 (14:53 +0000)]
Bug 23534: Use patron-title.inc on patron entry page

There are a few instances where we can simplify the patron entry
template by using the patron-title include file instead of outputting
patron name variables one by one. This patch does so in the page title,
page breadcrumbs, and page heading.

To test, apply the patch and edit a patron record. The page title,
breadcrumbs, and main heading should all look correct.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24725: (QA follow-up) Add missing spaces between elements on claims tab
Katrin Fischer [Mon, 24 Feb 2020 17:01:19 +0000 (17:01 +0000)]
Bug 24725: (QA follow-up) Add missing spaces between elements on claims tab

There was a missing space between the title and the barcode.
Also added a space between title and author.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24725: Remove ES template literals in checkouts.js
Jonathan Druart [Tue, 25 Feb 2020 13:40:06 +0000 (14:40 +0100)]
Bug 24725: Remove ES template literals in checkouts.js

From Julian on bug 24661 comment 6:
"""
It looks like xgettext does not like ES6 template literals.

https://savannah.gnu.org/bugs/?50920

From what I understand, support for template literals was added in gettext 0.20 (still not packaged in debian) but is still buggy in latest released version 0.20.1 and a fix is present in master.
"""

We should not use backticks ` in .js file, it breaks xgettext.

To replicate:
kohadev-koha@e1f3025cca60:/kohadevbox/koha/misc/translator$ perl translate update es-ES
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:569: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:858: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:904: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:911: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:1095: warning: RegExp literal terminated too early
/usr/bin/msgmerge: error while opening "/kohadevbox/koha/misc/translator/po/es-ES-messages-js.po" for reading: No such file or directory

(last error 'No such file or directory' is not related to this).

Test plan:
Make sure nothing is broken on the claims table
Confirm that the errors do not longer appear on `perl translate update LANG`

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24727: (bug 14697 follow-up) Replace link on title to bib detail page
Jonathan Druart [Tue, 25 Feb 2020 13:17:27 +0000 (14:17 +0100)]
Bug 24727: (bug 14697 follow-up) Replace link on title to bib detail page

903                               let title = `<a
class="return-claim-title strong"
href="/cgi-bin/koha/circ/request-rcticle.pl?biblionumber=[%
rc.checkout.item.biblionumber | html %]">

At first it seems like a typo:
request-rcticle.pl vs request-acticle.pl

But actually it does not make sense to link to request-article, we want
(I think) to link to the bibliographic record detail page.

Test plan:
- Have something in the claim table (cf bug 14697)
- Click on the title of the bibliographic record

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24734: Fix paths in LangInstaller.pm for JS files
Julian Maurice [Wed, 26 Feb 2020 19:09:52 +0000 (20:09 +0100)]
Bug 24734: Fix paths in LangInstaller.pm for JS files

Use intrahtdocs and opachtdocs in order to get the correct paths for all
kind of installations

Test plan:
1. With a dev install, run ./translator create/update/install xx-XX and
   verify that there is no error message
2. With a standard install, run ./translator create/update/install xx-XX
   and verify that there is no error message

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested for dev/single/standard installs, no errors,
just a (normal) warn from po2json.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24736: (QA follow-up) Change tooltip wording
Katrin Fischer [Sat, 29 Feb 2020 09:49:46 +0000 (10:49 +0100)]
Bug 24736: (QA follow-up) Change tooltip wording

Suggesting a change of the tooltip wording to read:

There are no enrollments for this club yet

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24736: Disable "Enrollments" link if nobody enrolled to the club yet
Jonathan Druart [Wed, 26 Feb 2020 16:46:49 +0000 (17:46 +0100)]
Bug 24736: Disable "Enrollments" link if nobody enrolled to the club yet

The link is disabled but it's possible to click and access the page
anyway.

Test plan:
- Create a new club template
- Create a new club
- Click the Actions > Enrollments link
=> Without this patch you can access the page
=> With this patch applied you cannot, and a tooltip explains why (feel
free to suggest another wording)
- Add a new patron to this club (from /cgi-bin/koha/opac-user.pl#opac-user-clubs)
- Notice that the action link is not enabled and click takes you to the
list of enrollments

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24747: Corrects on-screen instructions in branch transfer limits
Andrew Fuerste-Henry [Thu, 27 Feb 2020 20:09:02 +0000 (14:09 -0600)]
Bug 24747: Corrects on-screen instructions in branch transfer limits

To test:
1- go to cgi-bin/koha/admin/branch_transfer_limits.pl
2- see wording "Check the boxes for the libraries you accept to checkin items from"
3- apply patch
4- see wording "Check the boxes for the libraries you allow your items to be transferred to"

To verify new wording accuractely describes behavior:
1- Set UseBranchTransferLimits set to Enforce using itemtype
2- Confirm circ rules allow holds
3- Confirm hold policy by item type allows holds
4- Confirm all branches are valid pickup locations in branch setup
5- In Branch Transfer Limits, set dropdown to Branch A, select itemtype Book, disable all transfers so Branch A does not accept books from any other branch
6- Find a patron from Branch A
7- Find a book from Branch B
8- On the intranet, successfully place hold on item for patron for pickup at branch A
9- Cancel hold
10- Log into opac as patron
11- Successfully place hold on item for pickup at Branch A
12- Cancel hold
13- In Branch Transfer Limits, set dropdown to Branch A, select itemtype Book, ENABLE all transfers so Branch A DOES accept books from any other branch
14- In Branch Transfer Limits, set dropdown to Branch B, select itemtype Book, disable all transfers so Branch B does not accept books from any other branch
15- On the intranet, try to place a hold on item for patron, confirm Branch B is your only pickup option
16- On the OPAC, log in as patron, try to place a hold on item, confirm Branch B is your only pickup option

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24746: Duplicate id in opacheader markup
Owen Leonard [Thu, 27 Feb 2020 02:06:34 +0000 (02:06 +0000)]
Bug 24746: Duplicate id in opacheader markup

This patch removes '<div id="opacheader">' from masthead.inc
because the same markup is generated by koha_news_block.

To reproduce the bug, make sure there is an opacheader news block
defined. Add this to the OPACUserCSS system preference:

View the main page of the OPAC. You should see two blue borders around
the opacheader content.

Apply the patch and reload the OPAC page. There should now be only one
blue border.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested whith OPACUserCSS -> #opacheader { border: 1px solid blue; padding: 1px; }
don't know the intended value but works :)

Work as described following test plan, no errors.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 13327: Compiled CSS
Martin Renvoize [Mon, 2 Mar 2020 09:27:54 +0000 (09:27 +0000)]
Bug 13327: Compiled CSS

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 13327: (follow-up) Correct CSS and XSL errors
Owen Leonard [Wed, 19 Feb 2020 13:47:11 +0000 (13:47 +0000)]
Bug 13327: (follow-up) Correct CSS and XSL errors

This patch adds back the CSS changes which seem to have been lost in a
rebase somewhere. The patch also corrects a bad copy/paste in the XSL
file which led to a 404 error.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 13327: OPACPopupAuthorsSearch doesn't work with XSLT views
Owen Leonard [Mon, 12 Aug 2019 11:38:57 +0000 (11:38 +0000)]
Bug 13327: OPACPopupAuthorsSearch doesn't work with XSLT views

This patch reimplements the OPACPopupAuthorsSearch feature so that it
will work in the XSLT view.

To test, apply the patch and rebuild the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

 - View the detail page for a bibliographic record in the OPAC.
   Test under the following conditions:

 - OPACPopupAuthorsSearch ENABLED, OPACXSLTDetailsDisplay "default"
 - OPACPopupAuthorsSearch ENABLED, OPACXSLTDetailsDisplay empty
 - OPACPopupAuthorsSearch DISABLED, OPACXSLTDetailsDisplay "default"
 - OPACPopupAuthorsSearch DISABLED, OPACXSLTDetailsDisplay empty

In each of these cases, test the detail page's listing of additional
authors/contributors and subjects. Test records which have both multiple
contributors or subjects and which have only one author or subject.

When OPACPopupAuthorsSearch is turned on, verify that the author/subject
selection modal appears and that your selections are correctly combined
to build a search string.

Note that OPACPopupAuthorsSearch feature has a problem with terms
containing parentheses. The issue predates this patch.

Also note that the QA tools will give a false positive about Bootstrap
button styles. This rule only applies to the staff client.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24756: Show the warnings on Jenkins
Marcel de Rooy [Mon, 2 Mar 2020 09:00:57 +0000 (09:00 +0000)]
Bug 24756: Show the warnings on Jenkins

Temporary measure to see which warnings Jenkins got while we cannot
reproduce them ourselves on D8, D9 and D10.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24739: Perform IPv6 tests only if Net::Netmask is correct version
David Cook [Fri, 28 Feb 2020 00:17:58 +0000 (00:17 +0000)]
Bug 24739: Perform IPv6 tests only if Net::Netmask is correct version

Test plan:
0. Apply patch
1. Set up Koha on stretch (e.g. koha/koha-testing:master)
2. perl t/Koha/Middlware/RealIP.t
3. Observe the following:
Subtest: IPv6 support
    ok 1 - Warn on IPv6 koha_trusted_proxies
    ok 2 - Unable to parse IPv6 address for trusted proxy, so ignore the X-Forwarded-For header
    1..2
ok 13 - IPv6 support

4. Set up Koha on buster (e.g. koha/koha-testing:master-buster)
5. perl t/Koha/Middlware/RealIP.t
6. Observe the following:
Subtest: IPv6 support
    ok 1 - Trust proxy (2001:db8:1234:5678:abcd:1234:abcd:1234) using IPv6 CIDR notation, so use the X-Forwarded-For header for the remote address
    1..1
ok 13 - IPv6 support

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24739: Skip tests when IPv6 support is found
Martin Renvoize [Thu, 27 Feb 2020 09:16:12 +0000 (09:16 +0000)]
Bug 24739: Skip tests when IPv6 support is found

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24753: Change Koha/Middlware to Koha/Middleware in test name
David Cook [Fri, 28 Feb 2020 00:28:02 +0000 (00:28 +0000)]
Bug 24753: Change Koha/Middlware to Koha/Middleware in test name

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24756: Fix failing tests by removing temporary filenames
Marcel de Rooy [Fri, 28 Feb 2020 11:13:16 +0000 (11:13 +0000)]
Bug 24756: Fix failing tests by removing temporary filenames

In order to resolve the random failure, that might be caused by reusing
filenames in File::Temp and caching xslt code, this patch replaces the
temporary file by using the code parameter.

Note: Since XSLT uses a digest based on the passed code fragment, we will
exclude collisions here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24756: Fix D8 and U18 failures for Koha/XSLT/Security.t
Marcel de Rooy [Fri, 28 Feb 2020 08:20:43 +0000 (08:20 +0000)]
Bug 24756: Fix D8 and U18 failures for Koha/XSLT/Security.t

Instead of warning_like, we eventually catch multiple warnings and look
if we catch one specific warn and not catch another specific one.

Test plan:
Run t/db_dependent/Koha/XSLT/Security.t on D8, D9, D10 or U18.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Passes on D8 and D9 for me.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21879: Code cleaning in printinvoice.pl
Nazlı Çetin [Fri, 21 Feb 2020 14:33:42 +0000 (14:33 +0000)]
Bug 21879: Code cleaning in printinvoice.pl

Coming from
  commit 51aa6db46c604aa202a3d8f8e5028557480efbd5
  Bug 12001: Move GetMemberAccountRecords to the Koha namespace

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24680: Fix end_date returned from api/v1/holds/{hold_id}/suspension endpoint
Ere Maijala [Wed, 19 Feb 2020 09:45:04 +0000 (11:45 +0200)]
Bug 24680: Fix end_date returned from api/v1/holds/{hold_id}/suspension endpoint

Before this patch the response would return current date as the suspension end date for a hold that is suspended with no end date.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24680: Fix PUT api/v1/holds/{hold_id} to work also when priority is not provided
Ere Maijala [Wed, 19 Feb 2020 09:43:08 +0000 (11:43 +0200)]
Bug 24680: Fix PUT api/v1/holds/{hold_id} to work also when priority is not provided

Before this fix the endpoint would accept the request but fail to actually update the hold if the request does not contain a priority parameter.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24733: created_by param should be an arrayref
Nick Clemens [Wed, 26 Feb 2020 03:16:26 +0000 (03:16 +0000)]
Bug 24733: created_by param should be an arrayref

We allow for the user to add multiple users to this field, and the
search function expects and array. We have been treating it as a scalar

TO test:
1 - Have an open basket in acquisitions
2 - Add to basket - from an existing order (copy)
3 - Enter a name in the 'Basket created by' field and select a user
4 - Hit search
5 - ISE (Can't use string ("1") as an ARRAY ref while "strict refs" in use at /usr/share/koha/lib/C4/Acquisition.pm line 2482.)
6 - Apply patch
7 - Repeat 1-4
8 - Success!
9 - Test with mutiple 'created by' entries as well

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24294: (QA follow-up) Add rollback and 008 default test
Marcel de Rooy [Tue, 25 Feb 2020 13:40:52 +0000 (13:40 +0000)]
Bug 24294: (QA follow-up) Add rollback and 008 default test

Default for 008 was not tested yet.
Only wondering if we should insert default values only when we meet an
undefined value. Or should we also add if we meet an empty string? Is the
latter not more realistic in MARC?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24294: Add default value support for control fields in ACQ framework
Jonathan Druart [Thu, 2 Jan 2020 11:09:27 +0000 (12:09 +0100)]
Bug 24294: Add default value support for control fields in ACQ framework

When trying to add an order using the ACQ framework with a 008@ tag,
Koha explodes:

Control fields (generally, just tags below 010) do not have subfields,
use data() at /home/vagrant/kohaclone/C4/Acquisition.pm line 3272.

Test plan:
Set a default value for a control field in the ACQ framework
Turn on UseACQFrameworkForBiblioRecords
Create a new order from a new record
The default value should be displayed
Save
=> No crash

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24605: (QA follow-up) Fix unencoded series link in staff interface
Katrin Fischer [Sun, 23 Feb 2020 21:25:00 +0000 (21:25 +0000)]
Bug 24605: (QA follow-up) Fix unencoded series link in staff interface

Same change as the first patch, but for the staff detail page.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24605: Fix unencoded series link
Nick Clemens [Thu, 6 Feb 2020 17:45:07 +0000 (17:45 +0000)]
Bug 24605: Fix unencoded series link

To test:
1 - Add an 830 to a record with a volume subfield separated by a semicolon
    830$aThe series ;$vvol 8.
2 - View the record in the opac
3 - Click the series link, no results
4 - View the link url - the semicolon is not encoded
5 - Apply patch
6 - link works
7 - URL is corrrectly encoded

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: (RM follow-up) Correction to copyright statement
Martin Renvoize [Tue, 25 Feb 2020 14:35:04 +0000 (14:35 +0000)]
Bug 23290: (RM follow-up) Correction to copyright statement

We have updated our copyright statements now ;)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24661: (RM follow-up) Check lang is defined
Martin Renvoize [Tue, 25 Feb 2020 14:26:57 +0000 (14:26 +0000)]
Bug 24661: (RM follow-up) Check lang is defined

This adds a check that the lang variable is defined before testing
against it. In normal operation this is likely a no-op, but it is
required for compiling templates during QA.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22522: Fix several REST API tests
Ere Maijala [Fri, 7 Feb 2020 11:49:46 +0000 (13:49 +0200)]
Bug 22522: Fix several REST API tests

Fixes among others the invalid use of json_has() which caused broken tests to pass with older Mojolicious versions.

Signed-off-by: Mason James <mason@kohaaloha.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22522: Fix route typo
Mason James [Tue, 4 Feb 2020 04:20:27 +0000 (17:20 +1300)]
Bug 22522: Fix route typo

Signed-off-by: Mason James <mason@kohaaloha.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22522: Add support for current Mojolicious and related packages
Ere Maijala [Wed, 29 Jan 2020 11:24:15 +0000 (13:24 +0200)]
Bug 22522: Add support for current Mojolicious and related packages

This patch allows tests to succeed with the following versions:
JSON::Validator 3.18
Mojolicious 8.32
Mojolicious::Plugin::OpenAPI 2.21

Also Mojolicious::Plugin::OpenAPI version 1.17 and later 1.x versions now work.

Calling valid_input in under() would cause ' Use of uninitialized value $_[2] ' in more recent OpenAPI plugins, so that was changed too. As far as I can see this does not affect authorization.

Signed-off-by: Mason James <mason@kohaaloha.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: (QA follow-up) Rename option to expand_entities_unsafe
Marcel de Rooy [Mon, 27 Jan 2020 14:06:36 +0000 (14:06 +0000)]
Bug 23290: (QA follow-up) Rename option to expand_entities_unsafe

When you enable options marked as unsafe, we hope that you know what
you are doing. You should, while having access to koha-conf.xml.

Test plan:
Verify that Security.t still passes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: (follow-up) Replace warning_like by warnings_like
Marcel de Rooy [Fri, 17 Jan 2020 10:30:16 +0000 (10:30 +0000)]
Bug 23290: (follow-up) Replace warning_like by warnings_like

Security.t does not pass anymore ;)
Due to bug 23290 the tests now trigger an additional runtime error that
we should also catch to let the tests pass again.

Test plan:
Run t/db_dependent/Koha/XSLT/Security.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: Add test for write_net
David Cook [Tue, 19 Nov 2019 13:56:30 +0000 (13:56 +0000)]
Bug 23290: Add test for write_net

Test plan:
Run t/db_dependent/Koha/XSLT/Security.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: Add test Koha/XSLT/Security.t
Marcel de Rooy [Fri, 15 Nov 2019 13:19:50 +0000 (13:19 +0000)]
Bug 23290: Add test Koha/XSLT/Security.t

Test plan:
Run it!

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: (follow-up) Disable expand_entities unless explicitly enabled
Marcel de Rooy [Fri, 17 Jan 2020 11:01:14 +0000 (11:01 +0000)]
Bug 23290: (follow-up) Disable expand_entities unless explicitly enabled

This follow-up refines the change made in the former patch.

See also
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838097
https://rt.cpan.org/Public/Bug/Display.html?id=118032

We do not want to depend now on the exact LibXML version, so we will
disable expand_entities unless it is explicitly enabled via the config
variable koha_xslt_security. (Allowing us to test if bad things will be
caught.)

The options key is now always added to the Security object.
The return from set_parser_options has been removed to allow disabling when
there is no koha-conf entry (which probably is the normal situation).

Test plan:
[1] Test the first example patch with and without the other patches (excl.
    the second example). Toggle expand_entities in koha-conf. Restart
    Plack and flush the cache each time. Evaluate results with the
    commit message of first example.
[2] Test both example patches with/without other patches.
    Toggle expand_entities. Restart etc. Evaluate results with commit
    message of second example (check tmp/breached.txt).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: Allow enabling expand_entities
Marcel de Rooy [Fri, 15 Nov 2019 12:41:32 +0000 (12:41 +0000)]
Bug 23290: Allow enabling expand_entities

Since libxml2 disables it now by default, we need to enable it for testing.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: Apply the changes in Security to Base now
Marcel de Rooy [Fri, 15 Nov 2019 11:04:53 +0000 (11:04 +0000)]
Bug 23290: Apply the changes in Security to Base now

Until now Base did not yet use Security. The security lines are removed
from Base here by calls to Security.
A new test must be added still.

Test plan:
Ensure that t/db_dependent/XSLT_Handler.t still passes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: Introduce Koha::XSLT::Security
Marcel de Rooy [Fri, 15 Nov 2019 10:59:40 +0000 (10:59 +0000)]
Bug 23290: Introduce Koha::XSLT::Security

Also adds a temporary stub for Koha::XSLT_Handler referring to Base.
This will be removed later.

Test plan:
Run t/db_dependent/XSLT_Handler.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: Rename XSLT_Handler
Marcel de Rooy [Fri, 15 Nov 2019 10:55:50 +0000 (10:55 +0000)]
Bug 23290: Rename XSLT_Handler

This is just a git move. Cannot be tested. (Easier for QA.)
The next patch adjusts paths etc. in the module.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23290: XSLT system preferences allow administrators to exploit XML and XSLT vulne...
David Cook [Thu, 23 May 2019 06:53:57 +0000 (16:53 +1000)]
Bug 23290: XSLT system preferences allow administrators to exploit XML and XSLT vulnerabilities

The problem is that administrators can provide XSLTs that
can read from the server and network and write to the server. The

This patch prevents the Koha::XSLT_Handler from running
XSLT stylesheets that call actions such as read_file, write_file,
read_net, and write_net as documented at
https://metacpan.org/pod/XML::LibXSLT#XML::LibXSLT::Security

(Previous tests suggested issues with XML external entities
causing read file like vulnerabilities but these were not
reproducible)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23777: (follow-up) Use To.json in results.tt
Jonathan Druart [Tue, 25 Feb 2020 11:00:28 +0000 (12:00 +0100)]
Bug 23777: (follow-up) Use To.json in results.tt

 Wrong copy/paste here!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24545: (follow-up) Fix license statements
Jonathan Druart [Mon, 24 Feb 2020 14:30:12 +0000 (15:30 +0100)]
Bug 24545: (follow-up) Fix license statements

Oops, missing # here!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24545: Fix newly added files
Jonathan Druart [Mon, 24 Feb 2020 13:05:09 +0000 (14:05 +0100)]
Bug 24545: Fix newly added files

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24545: (follow-up) Fix license statements
Jonathan Druart [Mon, 3 Feb 2020 09:46:26 +0000 (10:46 +0100)]
Bug 24545: (follow-up) Fix license statements

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24545: Fix find-license-problems.t to catch future wrong license statements
Jonathan Druart [Fri, 31 Jan 2020 13:43:39 +0000 (14:43 +0100)]
Bug 24545: Fix find-license-problems.t to catch future wrong license statements

File adjust to run tests and be executed on all our codebase.

Test plan:
- Apply this patch without the other one
- run the tests
=> Several failures
- apply the other patch
- run the tests
=> Should pass now

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24545: Fix license statements
Jonathan Druart [Fri, 31 Jan 2020 13:07:20 +0000 (14:07 +0100)]
Bug 24545: Fix license statements

Bug 9978 should have fixed them all, but some were missing.
We want all the license statements part of Koha to be identical, and
using the GPLv3 statement.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: DBRev 19.12.00.030
Martin Renvoize [Mon, 24 Feb 2020 13:30:13 +0000 (13:30 +0000)]
Bug 22880: DBRev 19.12.00.030

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: (QA follow-up) Replace use by require
Marcel de Rooy [Mon, 24 Feb 2020 12:12:58 +0000 (12:12 +0000)]
Bug 22880: (QA follow-up) Replace use by require

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: (QA follow-up) Pass lang instead of news_lang in masthead
Marcel de Rooy [Mon, 24 Feb 2020 12:00:33 +0000 (12:00 +0000)]
Bug 22880: (QA follow-up) Pass lang instead of news_lang in masthead

Might be a rebase problem. Not sure if I look at the third patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: (QA follow-up) Remove opacheader from C4::Auth
Marcel de Rooy [Mon, 24 Feb 2020 11:55:34 +0000 (11:55 +0000)]
Bug 22880: (QA follow-up) Remove opacheader from C4::Auth

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: (QA follow-up) Fix "koha_news_block: not found"
Marcel de Rooy [Fri, 21 Feb 2020 10:05:22 +0000 (10:05 +0000)]
Bug 22880: (QA follow-up) Fix "koha_news_block: not found"

To make qa tools happy again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: (follow-up) Process all installed languages, not just enabled
Owen Leonard [Thu, 12 Dec 2019 13:30:43 +0000 (13:30 +0000)]
Bug 22880: (follow-up) Process all installed languages, not just enabled

This patch changes the database update so that the system preference is
copied to news items in all installed languages, not just those enabled
in the OPAC.

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: Use placeholders
Jonathan Druart [Tue, 11 Jun 2019 14:31:07 +0000 (09:31 -0500)]
Bug 22880: Use placeholders

Always.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: (follow-up) Define OpacHeader variable for conditional
Owen Leonard [Wed, 4 Sep 2019 17:42:02 +0000 (17:42 +0000)]
Bug 22880: (follow-up) Define OpacHeader variable for conditional

This follow-up uses the updates introduced by Bug 23253 as a model for
improving the display of opacheader. Adding the OpacHeader variable
allows the template to check for its existence and display some
container markup around opacheader if it exists. This will help ease the
transition for libraries who depend on the #opacheader id for styling.

To test, apply the patch and test the OPAC with an 'opacheader' item
defined. The content should be displayed on the page inside '<div
id="opacheader"></div>.'

Delete the 'opacheader' news item and reload the OPAC page. There should
no longer be an #opacheader div.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: (follow-up) Loose ends: Better DB update, global inclusion, etc.
Owen Leonard [Wed, 11 Dec 2019 13:42:09 +0000 (13:42 +0000)]
Bug 22880: (follow-up) Loose ends: Better DB update, global inclusion, etc.

This patch makes a number of improvements and ties up some loose ends
where the old system preference usage wasn't getting replaced.

 - Removes news-specific code for defining the language of news
   items queried for the OPAC home page. An identical language variable
   is already defined globally.

   Previous to this patch an 'opacheader' news item would only appear on
   the OPAC home page. Now it should appear on all OPAC pages.

 - Changes the database update so that 'opacheader' news
   items will be inserted with a default title, matching the interface's
   requirement that the title field be populated.

 - The database update will also now insert the old opacheader system
   preference contents into the news item for all active languages as
   defined in the 'opaclanguages' system preference. This helps match
   the previous behavior in which the opacheader contents were the same
   for all languages.

 - Adds support for the new opacheader news item to the self checkout,
   self check-in, and OPAC maintenance pages.

 - Updates sysprefs.t which was using the opacheader preference to test
   on. I've changed it to use URLLinkText instead.

 - Removes the addition of the opacheader system preference from the
   installation SQL file.

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22880: Convert opacheader system preference to news block
Owen Leonard [Thu, 9 May 2019 13:52:30 +0000 (13:52 +0000)]
Bug 22880: Convert opacheader system preference to news block

This patch builds on Bug 22318 to move the opacheader system preference
into the Koha news system, making it possible to have language- and
library-specific content.

It extends the original patch by adding an option to the template plugin
specifying whether the content title should be shown (probably should be
a flag in opac_news). It also adds a wrapper div with the content
location as the ID (e.g. 'opacheader'). This will make it slightly more
backwards-compatible with CSS customizations.

To test you should have some content in the opacheader system
preference. Apply the patch and run the database update process.

 - Go to the OPAC and confirm that the content which was previously in
   the opacheader system preference now displays correctly where it was
   before.
 - In the staff client, go to Tools -> News and verify that the content
   from opacheader is now stored in a news item with the location
   'opacheader_en.'
 - Go to Administration -> System preferences and confirm that the
   opacheader preference has been removed.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24291: Update the item type form text for library limitation field
David Nind [Sat, 25 Jan 2020 11:01:52 +0000 (11:01 +0000)]
Bug 24291: Update the item type form text for library limitation field

Bug 15497 introduced the ability to limit item types by library.
However, the text next to the 'Library limitation' selection field on
the item type form mentions authorized values and is confusing.

The current text reads: "Select 'All libraries' if this authorized value
must be displayed all the time. Otherwise select libraries you want to
associate with this value."

This patch updates the text on the item type add or edit form for the
'Library limitation' field to something more understandable.

To test:
1) Apply the patch
2) Go to Administration > Basic parameters > Item types
3) Click 'Edit' for any item type
4) The text next to the 'Library limitation' field should now show
"Select 'All libraries' if all libraries use this item type. Otherwise,
select the specific libraries that use this item type."
5) Sign off

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24356: Make objects.search prefetch embedded relations
Agustin Moyano [Tue, 21 Jan 2020 15:39:49 +0000 (12:39 -0300)]
Bug 24356: Make objects.search prefetch embedded relations

This patch makes the Koha::Object(s) derived classes expose information
about prefetch-able relations. This is then used by a new helper to
generate the prefetch information for the DBIC query.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object* \
           t/db_dependent/Koha/REST/Plugin/Objects.t \
           t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24356: prefetch_whitelist tests
Tomas Cohen Arazi [Tue, 21 Jan 2020 18:46:53 +0000 (15:46 -0300)]
Bug 24356: prefetch_whitelist tests

This patch adds tests for the introduced methods.

To test:
1. Run the tests :-D
=> SUCCESS: They pass!
2. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24211: Compress/uncompress translation files
Bernardo Gonzalez Kriegel [Wed, 11 Dec 2019 00:02:41 +0000 (21:02 -0300)]
Bug 24211: Compress/uncompress translation files

This patch adds the ability to compress/uncompress
translations files.

On update/install the files are uncompressed first

The only gain is to use less space.

To test:
1) Apply the patch
2) Go to misc/translator
3) Try it
   $ ./translate compress fr-FR (check po/*.gz)
   $ ./translate uncompress fr-FR ( check normal files)
4) Try again with verbose mode
   $ ./translate compress fr-FR -v (list compressed files)
   $ ./translate uncompress fr-FR -v (list uncompressed files)
5) Try update compressed files
   $ ./translate compress fr-FR
   $ ./translate update fr-FR (result is uncompressed)
6) Try install compressed files
   $ ./translate compress fr-FR
   $ ./translate install fr-FR
7) Try compress all
   $ ./translate compress  (add '-v' for verbose output)
8) Try uncompress all
   $ ./translate uncompress  (add '-v' for verbose output)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24629: SIP patron items contains an array of hashes
Nick Clemens [Fri, 21 Feb 2020 12:28:30 +0000 (12:28 +0000)]
Bug 24629: SIP patron items contains an array of hashes

$patron->{items} contains the borrowers checkouts as an array of hashes
{ barcode => $item->barcode }

When printing to log we assumed these were only barcodes

This patch pushes the current checkout as a hash and maps the values retrieved to a string

To test:
1 - Enable SIP debug mode
2 - Perform multiple checkouts for a patron
3 - Note the messages like:
    koha koha_sip_koha[13575]: ILS::Checkout: patron 123 has checked out HASH(0x55a5b187f858), HASH(0x55a5b1896ad0), HASH(0x55a5b18a6cf0), 7826832
4 - Apply patch
5 - Restart all the things
6 - Do some checkouts via SIP
6 - Messages should now have barcodes

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24629: SIP log - Display barcode instead of hash
Jonathan Druart [Wed, 12 Feb 2020 09:22:29 +0000 (10:22 +0100)]
Bug 24629: SIP log - Display barcode instead of hash

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24693: Move GD from recommends to requires in cpanfile
Julian Maurice [Thu, 20 Feb 2020 07:29:37 +0000 (08:29 +0100)]
Bug 24693: Move GD from recommends to requires in cpanfile

Without it, catalogue/detail.pl dies (and probably other scripts too)

Test plan:
1. Uninstall GD, reload starman
2. Go to catalogue/detail.pl. Confirm that it dies
3. Reinstall GD, reload starman
4. Go to catalogue/detail.pl. Confirm that it work normally

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24114: (QA follow-up) Fix counts for lock, anonymize and delete
Marcel de Rooy [Fri, 29 Nov 2019 09:45:48 +0000 (09:45 +0000)]
Bug 24114: (QA follow-up) Fix counts for lock, anonymize and delete

Since these operations impact on the resultset, the counts should be
saved before.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24114: (follow-up) Resolve warning on non-numeric subtraction
Marcel de Rooy [Fri, 29 Nov 2019 09:17:19 +0000 (09:17 +0000)]
Bug 24114: (follow-up) Resolve warning on non-numeric subtraction

Argument "" isn't numeric in subtraction (-) at /usr/share/koha/Koha/Patrons.pm line 290.

Coming from an empty or undefined FailedLoginAttempts.

Test plan:
Verify that Koha/Patrons.t still passes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>