koha.git
3 years agoBug 26133: Remove GetMarcHosts
Jonathan Druart [Tue, 4 Aug 2020 11:55:13 +0000 (13:55 +0200)]
Bug 26133: Remove GetMarcHosts

We removed the single occurrence of this subroutine in the previous
patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26133: Remove GetMarc* calls in detail.pl
Jonathan Druart [Tue, 4 Aug 2020 11:54:28 +0000 (13:54 +0200)]
Bug 26133: Remove GetMarc* calls in detail.pl

There are several calls in catalogue/detail.pl that can be removed:
GetMarcISBN, GetMarcAuthors, GetMarcSubjects, GetMarcSeries, GetMarcUrls and GetMarcHosts
They pass a variable to the template that is never used.

Test plan:
Confirm that this TT variable is never used.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26141: Remove duplicated code from search.pl
Jonathan Druart [Wed, 5 Aug 2020 07:57:56 +0000 (09:57 +0200)]
Bug 26141: Remove duplicated code from search.pl

commit 417553a9e47bf31f4cb785162e3dced856a2ac2a
  Bug 12478: starting to add search to staff client

This commit added code related to the itemtypes to the advanced search, but this code already existed.

The weird bit is:
$template->param(advancedsearchesloop => \@advancedsearchesloop);
my $types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes";
my $advancedsearchesloop = prepare_adv_search_types($types);
$template->param(advancedsearchesloop => $advancedsearchesloop);

We are passing twice advancedsearchesloop to the template.

Test plan (for QA):
Review the changes and confirm that we can safely remove this code

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26043: Fix random failure from Holds.t
Jonathan Druart [Wed, 22 Jul 2020 12:11:03 +0000 (14:11 +0200)]
Bug 26043: Fix random failure from Holds.t

 #   Failed test 'Test ModReserveMinusPriority()'
 #   at t/db_dependent/Holds.t line 202.
 #          got: undef
 #     expected: '1605'
 # Looks like you failed 1 test of 66.

It is coming from Koha::Patron->holds that is ordering by reservedate,
so "sometimes" they are ordered in reverse (at least it's my
understanding of the problem).

Test plan:
Run the test file several times (from 20 to 60x), it must never fail
with this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26138: Make Koha::Plugins->call return consistent value
Jonathan Druart [Wed, 5 Aug 2020 07:30:31 +0000 (09:30 +0200)]
Bug 26138: Make Koha::Plugins->call return consistent value

It must return an empty array in case the enable_plugins config flag is
disabled

Test plan:
Turn the config off in koha-conf
Start a search at the OPAC
Without this patch you got:
  Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661
With this patch applied you see the search result

Followed test plan - works as described.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25811: Try to fix the random failure caused by not finding id=login
Jonathan Druart [Mon, 3 Aug 2020 15:57:02 +0000 (17:57 +0200)]
Bug 25811: Try to fix the random failure caused by not finding id=login

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24610: Compiled CSS
Jonathan Druart [Mon, 3 Aug 2020 09:57:55 +0000 (11:57 +0200)]
Bug 24610: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24610: Let user switch between 'Pay' and 'Write off' mode
Julian Maurice [Fri, 7 Feb 2020 10:21:43 +0000 (11:21 +0100)]
Bug 24610: Let user switch between 'Pay' and 'Write off' mode

In patron's accounting section, under 'Make a payment' tab, you have the
choice between 'Pay' and 'Write off'. It takes you to another form, but
once there you cannot change mode. You have to click on Cancel,
re-select the lines you had selected (if you made a selection) and click
on the right button.

This patch adds link above the form to easily switch between the two
modes.

Also fixes a CSS bug to be able to use Bootstrap's nav pills inside
.statictabs

Test plan:
1. Create some manual invoices
2. Go to 'Make a payment' tab
3. Click on the 'Pay' button in a table row
4. Above the form you should see two links ('Pay' and 'Write off').
   Click on 'Write off', confirm the write off and verify that it did
   make a 'write off'.
5. Go to 'Make a payment' tab
6. Click on the 'Write off' button in a table row
7. Click 'Pay', confirm the pay and verify that it did make a 'pay'
8. Go to 'Make a payment' tab
9. Select some lines and click on 'Pay selected'
10. Click on 'Write off', confirm the 'write off' and verify that it did
    make a 'write off'
11. Go to 'Make a payment' tab
12. Select some lines and click on 'Write off selected'
13. Click on 'Pay', confirm the pay and verify that it did make a 'pay'

Signed-off-by: Christofer <christofer.zorn@ajaxlibrary.ca>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25762: Typo in linkitem.tt
Owen Leonard [Wed, 29 Jul 2020 12:21:29 +0000 (12:21 +0000)]
Bug 25762: Typo in linkitem.tt

This patch corrects the same typo in two different templates:

&rsquo; -> &rsaquo;

If you want to test beyond examining the patch, apply the patch
and go to Tools -> Rotating collections.

- Add an item to a rotating collection.
- In the browser's title bar (or the tab title if the title bar isn't
  shown) the separator between the rotating collection name and "Add or
  remove items" should be ">" instead of "`"
- Enable the EasyAnalyticalRecords system preference.
- View the detail page for a bibliographic record.
- From the "Edit" menu, choose "Link to host record"
- Check the title bar as you did previously.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26085: Add the copy, print and export DataTables buttons to lost items report
Owen Leonard [Wed, 29 Jul 2020 12:58:22 +0000 (12:58 +0000)]
Bug 26085: Add the copy, print and export DataTables buttons to lost items report

This patch removes the in-page DataTables DOM configuration option so
that the default option is used. This will allow all the standard
controls to appear, including copy/print/export.

Since the default DataTables information includes the number of results
in the table, the template markup showing this information is removed.

To test, apply the patch and go to Reports.

- Run the "Items lost" report using parameters which will return
  multiple results.
- On the results page confirm that the standard controls are present:
  Result count, search form, columns filter, export buttons.
- Confirm that the "Activate filters" feature works, and that selecting
  results activates the option to download a CSV using a CSV export
  profile.

  Note that the "Activate filters" feature doesn't play well with hidden
  columns. However this issue predates the patch.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26094: Add class to the "Suggest for purchase" button
Jonathan Druart [Thu, 30 Jul 2020 12:39:17 +0000 (14:39 +0200)]
Bug 26094: Add class to the "Suggest for purchase" button

Bug 14963 added a new "Suggest for purchase" button on the detail page
of bibliographic records at the OPAC.
This patch adds a specific CSS class to make it reachable easily

Like others button in this action list

Test plan:
Go to the detail page of a bibliographic record at the OPAc
Notice the new CSS class

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26004: Remove unused jQuery plugin jquery.hoverIntent.minified.js from the OPAC
Owen Leonard [Fri, 17 Jul 2020 13:20:45 +0000 (13:20 +0000)]
Bug 26004: Remove unused jQuery plugin jquery.hoverIntent.minified.js from the OPAC

The jQuery plugin jquery.hoverIntent.minified.js hasn't been used in
Koha in long time. This patch removes it from the OPAC.

To test, apply the patch and search for instances of "hoverIntent."
There should be none.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26011: Remove unused jQuery plugin jquery.metadata.min.js from the OPAC
Owen Leonard [Fri, 17 Jul 2020 18:09:30 +0000 (18:09 +0000)]
Bug 26011: Remove unused jQuery plugin jquery.metadata.min.js from the OPAC

The jQuery plugin jquery.metadata.min.js hasn't been used in
Koha in long time. This patch removes it from the OPAC.

To test, apply the patch and search for instances of "jquery.metadata."
There should be none.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25873: Ignore malformed data for Elasticsearch integer fields
Julian Maurice [Thu, 25 Jun 2020 07:25:41 +0000 (11:25 +0400)]
Bug 25873: Ignore malformed data for Elasticsearch integer fields

If we try to put malformed data into an integer field, Elasticsearch
rejects the whole document.
Setting 'ignore_malformed' to true allows to ignore malformed data and
process the other fields of the document normally

https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ignore-malformed.html

Test plan:
* Without the patch
  1. In search engine configuration, change the type of a text field to
  'Number' (for instance 'title')
  2. misc/search_tools/rebuild_elasticsearch.pl -d -b
  3. See that the index is empty (unless you have titles consisting only
  of digits)
* With the patch
  1. misc/search_tools/rebuild_elasticsearch.pl -d -b
  2. Now records are correctly indexed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26084: Clarify language on ConsiderOnSiteCheckoutsAsNormalCheckouts
Andrew Fuerste-Henry [Wed, 29 Jul 2020 15:58:42 +0000 (15:58 +0000)]
Bug 26084: Clarify language on ConsiderOnSiteCheckoutsAsNormalCheckouts

To test:
- apply patch
- confirm explanation reads as suggested

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26111: Add "Serials" (SER) to the reports dictionnary
Jonathan Druart [Fri, 31 Jul 2020 09:53:53 +0000 (11:53 +0200)]
Bug 26111: Add "Serials" (SER) to the reports dictionnary

It's missing in the template

Test plan:
Go go Home › Reports › Guided reports wizard › Dictionary
At step 2, notice that with this patch you have "Serials" in the
dropdown list (instead of an empty entry)

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26108: Only call the plugin hook if a return took place
Tomas Cohen Arazi [Fri, 31 Jul 2020 12:52:10 +0000 (09:52 -0300)]
Bug 26108: Only call the plugin hook if a return took place

This patch makes the hooks be called only if the checkin is effective
(i.e. if it is not rejected for some reason.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> FAIL: Tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26108: Regression tests
Tomas Cohen Arazi [Fri, 31 Jul 2020 12:47:56 +0000 (09:47 -0300)]
Bug 26108: Regression tests

The current implementation makes the assumption that if $issue is
defined, then it is the 'return' use case. This is correct, but
incomplete: after verifying that there's actually an issue, the return
can be rejected for various reasons.

This patch introduces a regression test for one of those situations
(which I consider enough for testing purposes) . It highlights that the
hook shouldn't be called if there hasn't been an actual checkin.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> FAIL: Tests fail because there's an unexpected warining printed by
the erroneous plugin call (i.e. there's been no return but the plugin is
called anyway).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25811: (follow-up) Debug - Paste the source of the page
Jonathan Druart [Fri, 31 Jul 2020 10:55:40 +0000 (12:55 +0200)]
Bug 25811: (follow-up) Debug - Paste the source of the page

Wide character in syswrite at /usr/share/perl5/File/Slurp.pm line 506.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25887: Keep library filter on the fund list view
Jonathan Druart [Thu, 30 Jul 2020 08:57:53 +0000 (10:57 +0200)]
Bug 25887: Keep library filter on the fund list view

The problem:
When filtering funds by library, the pull down for libraries resets to "empty" when the page is reloaded,
although the filter criteria is visible in the URL.

Test plan:
Create a fund for library A
Create a fund for library B
Go to the fund list view
=> All funds are listed
Select library A in the library filter, click "Go"
=> Funds for library A are listed
=> Library filter has "library A" selected
Edit fund for library B
=> The edit form has "library B" selected

Signed-off-by: Holly Cooper <hc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26093: Markup error after Bug 24279 creates formatting problem
Owen Leonard [Wed, 29 Jul 2020 20:01:24 +0000 (20:01 +0000)]
Bug 26093: Markup error after Bug 24279 creates formatting problem

This patch makes a few minor changes to the markup of the item detail
page in order for everything to be valid and styled correctly:

- Remove unnecessary and invalid <br clear="both"/>
- Move heading inside container so that floats clear correctly
- Change <span> tag back to <div> to enable the correct style.

To test, apply the patch and view the item details page for a title with
multiple items.

 - Each section starting with "Barcode" should be bordered above by a
   two-pixel gray line
 - The "statuses" section should be styled like the areas above and
   below, not as an ordered list.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25852: Add tests
Jonathan Druart [Thu, 30 Jul 2020 09:59:44 +0000 (11:59 +0200)]
Bug 25852: Add tests

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25852: Improve C4::Creators::Lib reliability under plack
Jonathan Druart [Thu, 30 Jul 2020 10:00:03 +0000 (12:00 +0200)]
Bug 25852: Improve C4::Creators::Lib reliability under plack

This is certainly a major issue that leads to many side-effects.
Under plack, the structure of the default values are not handled
correctly.
Package variables are used to store stuff like the "layout type". They
are complex structures (arrays of hashes) and returned without being
copied.
When the caller (the controller script) retrieve them then modify the
returned structures, it actually modifies the package's variables.

One of the issue is:
Create a new layout
The script retrieve a structure with all "selected" flags are set to 0
It select the first one as default (BAR as selected => 1)
The user creates the new layout and will selected BIBBAR (for instance)
If you then edit this new layout, the script will retrieve the
"label_types" and set "selected" for BIBBAR. However BAR is still
selected!
The UI receives 2 selected and display the first selected one that has
the selected option.

Test plan:
1. Create a layout type for Barcode/Biblio
2. Choose fields to print and size of font
3. Save
4. Edit existing Layout
=> Withtout this patch "Barcode" is the preselected option
=> With this patch applied, the correct "Barcode/Biblio" option is
selected

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26108: (bug 25855 follow-up) Call after_circ_action hook only if issue exists
Jonathan Druart [Fri, 31 Jul 2020 07:49:06 +0000 (09:49 +0200)]
Bug 26108: (bug 25855 follow-up) Call after_circ_action hook only if issue exists

AddReturn can be called on an item even if it's not checked out (to
trigger holds for instance).
The hook should (?) not be called in that situation

Test plan:
Confirm the above and that the following tests are now passing:
 t/db_dependent/SIP/Message.t
 t/db_dependent/Reserves.t
 t/db_dependent/Circulation/issue.t
 t/db_dependent/SIP/Transaction.t
 t/db_dependent/Circulation.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26083: Item editor defaults to lost
Kyle M Hall [Wed, 29 Jul 2020 17:03:57 +0000 (13:03 -0400)]
Bug 26083: Item editor defaults to lost

When editing an item via additem.pl, koha defaults to the first
available lost status, rather than defaulting to not-lost.

Test Plan:
1) Ensure you do not have a value ClaimReturnedLostValue
2) Edit an existing item that is not lost
3) Note the lost value is set even though it is not lost
4) Apply this patch
5) Edit a different item that is not lost
6) Note the lost value is not set!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26061: Compiled CSS
Jonathan Druart [Thu, 30 Jul 2020 15:40:28 +0000 (17:40 +0200)]
Bug 26061: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26061: Improve style of sidebar datepickers
Owen Leonard [Fri, 24 Jul 2020 15:59:42 +0000 (15:59 +0000)]
Bug 26061: Improve style of sidebar datepickers

This patch makes a small change to the staff interface CSS so that
datepicker form fields in sidebar forms don't force the datepicker icon
onto a second line.

The change uses the CSS calc() function to specify that form fields with
a .hasDatepicker class (dynamically added by jqueryUI) have a width of
100% minus 20 pixels, leaving room for the datepicker icon.

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

- View a page in the staff interface which has a datepicker field in a
  sidebar form and confirm that the icon stays on the same line as the
  firm field at varying browser widths. Examples:

  - Reports -> Saved SQL reports
  - Circulation -> Overdues
  - Acquisitions -> Late orders

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25953: Add ID to installed plugins table on plugins-home.pl
David Cook [Wed, 8 Jul 2020 12:36:46 +0000 (12:36 +0000)]
Bug 25953: Add ID to installed plugins table on plugins-home.pl

This patch adds a "installed_plugins" ID to the table
of installed plugins.

The idea is that it will ease styling and DOM mods through Javascript.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26070: DBRev 20.06.00.020
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000 (15:21 +0000)]
Bug 26070: DBRev 20.06.00.020

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26070: Remove GoogleIndicTransliteration system preference
Owen Leonard [Mon, 27 Jul 2020 19:16:07 +0000 (19:16 +0000)]
Bug 26070: Remove GoogleIndicTransliteration system preference

The Google Transliterate API was deprecated on May 26, 2011. This patch
removes the feature and associated system preference.

To test, apply the patch and run the database update process.

 - Go to Administration -> System preferences and search for
   'GoogleIndicTransliteration.' There should be no results.
 - Search the Koha codebase for references to
   'GoogleIndicTransliteration.' There should be no current references..

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22660: DBRev 20.06.00.019
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000 (15:21 +0000)]
Bug 22660: DBRev 20.06.00.019

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22660: (QA follow-up) Fix capitalization in system preference
Katrin Fischer [Wed, 29 Jul 2020 22:51:34 +0000 (22:51 +0000)]
Bug 22660: (QA follow-up) Fix capitalization in system preference

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22660: (follow-up) Re-word system preference description
Owen Leonard [Thu, 23 Jul 2020 18:20:51 +0000 (18:20 +0000)]
Bug 22660: (follow-up) Re-word system preference description

This patch rewords the system preference description to focus on the
generic description of the editor rather than the name of the plugin:

    tinymce: "a WYSIWYG editor (TinyMCE)"
    codemirror: "a text editor (CodeMirror)"

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22660: (follow-up) Improve asset handling, add linting
Owen Leonard [Thu, 23 Jul 2020 17:58:22 +0000 (17:58 +0000)]
Bug 22660: (follow-up) Improve asset handling, add linting

This patch makes some changes to the way assets are included based on
the value of the system preferece in order to minimize unnecessary
JavaScript includes.

The patch also adds HTML syntax-highlighting and linting like we have in
the system preferences editor.

Removed are two JS files which were not required.

To test, apply the patch and set the NewsToolEditor preference to
"CodeMirror."

 - Edit a news item and confirm that the contents of the
   editor show HTML syntax highlighting.
 - Test HTML linting by adding some malformed HTML (missing closing tag,
   for instance). The error should be highlighted.
 - Set the NewsToolEditor to "TinyMCE" and confirm that WYSIWYG editing
   still works correctly.

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

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22660: Add system pref to allow switching of editors in News Tool
Lucas Gass [Fri, 8 May 2020 22:57:40 +0000 (22:57 +0000)]
Bug 22660: Add system pref to allow switching of editors in News Tool

This patch adds a system preference called 'NewsToolEditor' which allows for the choice between TinyMCE and CodeMirror in the News Feature.

TEST PLAN:
1. Apply patch and run updatedatabase
2. Go to Tools > News and make a new entry or edit an existing News item.
3. When you initially load you should gte the TinyMCE editor (WYSIWYG)
4. Search for the NewsToolEditor system preference and switch to CodeMirror.
5. Reload your News item and now you should see the CodeMirror editor.
6. Try saving content with both and maki sure it works.
7. Try adding some different HTML tags in CodeMirror mode, saving, and making sure it looks right when you switch back to TinyMCE

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25968: Make logs sort by date descending as a default
Owen Leonard [Fri, 10 Jul 2020 13:19:14 +0000 (13:19 +0000)]
Bug 25968: Make logs sort by date descending as a default

This patch adds DataTables with columns configuration to the log viewer.
The table of log entries is now sorted by default by date descending.

To test, apply the patch and go to Administration -> Table settings.

 - Expand the "Tools" section and confirm that there is a section for
   "logviewer."
 - Go to Tools -> Log viewer.
 - Perform a search which will return multiple results.
 - Confirm that the results are sorted by date descending.
 - Test that the table controls work correctly: Paging, columns, export.
 - Return to the Table settings administration page and test that
   changes to those settings are correctly reflected in the log viewer
   table.

Signed-off-by: barbara <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch: Fix indentation in .yml to match other entries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Compiled CSS
Jonathan Druart [Thu, 30 Jul 2020 15:40:18 +0000 (17:40 +0200)]
Bug 22087: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Add missing filters
Jonathan Druart [Mon, 27 Jul 2020 13:37:21 +0000 (15:37 +0200)]
Bug 22087: Add missing filters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Move the email into the list
Jonathan Druart [Tue, 7 Apr 2020 10:40:26 +0000 (12:40 +0200)]
Bug 22087: Move the email into the list

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Remove padding on li's
Jonathan Druart [Tue, 7 Apr 2020 10:40:24 +0000 (12:40 +0200)]
Bug 22087: Remove padding on li's

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Prevent variable names colision
Jonathan Druart [Tue, 7 Apr 2020 10:01:05 +0000 (12:01 +0200)]
Bug 22087: Prevent variable names colision

We should not use PROCESS:
http://www.template-toolkit.org/docs/manual/Directives.html

" The PROCESS directive is slightly faster than INCLUDE because it
avoids the need to localise (i.e. copy) the variable stash before
processing the template. "

The 'patron' variable is reused by patron-title.inc

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Add a no_line_break parameter to prevent new lines
Jonathan Druart [Mon, 6 Apr 2020 14:25:34 +0000 (16:25 +0200)]
Bug 22087: Add a no_line_break parameter to prevent new lines

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Add space between zipcode and country
Jonathan Druart [Mon, 6 Apr 2020 14:14:04 +0000 (16:14 +0200)]
Bug 22087: Add space between zipcode and country

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22087: Use include file to display patrons address in search result
Jonathan Druart [Mon, 6 Apr 2020 14:00:13 +0000 (16:00 +0200)]
Bug 22087: Use include file to display patrons address in search result

In order to display the city and country in the patron search result, we
need to use the member-display-address-style include file, to satisfy
AddressFormat.

Test plan:
Modify some patrons and fill the different address info
Search for them and notice that the city, zipcode and country are now
displayed.
Modify the value of AddressFormat and confirm that the display is
modified according to its value

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26060: Compiled CSS
Jonathan Druart [Thu, 30 Jul 2020 15:40:02 +0000 (17:40 +0200)]
Bug 26060: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26060: Replace staff interface table sort icons with SVG
Owen Leonard [Fri, 24 Jul 2020 14:07:29 +0000 (14:07 +0000)]
Bug 26060: Replace staff interface table sort icons with SVG

This patch modifies the staff interface CSS to convert table sorting
icons from PNG to SVG. These icons are added via background-image
data-urls, so only the SCSS file is modified.

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

 - Clear your browser cache if necessary
 - View any DataTable in the staff interface, for instance when checking
   out to a patron with existing checkouts, the catalog detail page for
   a title with holdings, the table of saved reports.
 - Confirm that the sorting icons in the table headers look correct in
   each state: Sorted ascending, sorted descending, and unsorted.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25982: OPAC shelves RSS link output is xml
Didier Gautheron [Sun, 12 Jul 2020 12:09:15 +0000 (14:09 +0200)]
Bug 25982: OPAC shelves RSS link output is xml

Output rss feed as text/xml

Test plan:
1) have books entered
2) log in create a list
3) add books to list
4) display list in OPAC
5) click the RSS link button.
   -- output is displayed as html text
6) apply patch
7) repeat steps 4&5
   -- output is displayed as xml tree

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js
Owen Leonard [Thu, 18 Jun 2020 13:10:35 +0000 (13:10 +0000)]
Bug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js

This patch adds the necessary JavaScript includes to the OPAC to
enable translation of strings in JavaScript. It also updates the
translation of cart-related strings by removing the strings from
opac-bottom.inc and putting them in basket.js where they are used.

To test, apply the patch and test that the correct strings are
translatable. In this example I'm testing fr-FR:

 - Update a translation:

   > cd misc/translator
   > perl translate update fr-FR

 - Open the corresponding .po file for the strings pulled from
   JavaScript  e.g.  misc/translator/po/fr-FR-messages-js.po
 - Locate strings pulled from bootstrap/js/basket.js for
   translation, e.g.:

   #: koha-tmpl/opac-tmpl/bootstrap/js/basket.js:89
   msgid "Your cart is currently empty"
   msgstr ""

 - Edit the "msgstr" string however you want (it's just for testing)
 - Install the updated translation:

   > perl translate install fr-FR

In the OPAC, switch to the language you're testing. Confirm that your
translated string appears. In the above example, by clicking the "Cart"
icon in the header when there are no items in the cart.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21268: Don't remove 0 allocated funds from fund list
Jonathan Druart [Tue, 28 Jul 2020 07:23:35 +0000 (09:23 +0200)]
Bug 21268: Don't remove 0 allocated funds from fund list

If a fund is created with a amount of 0, it will not appear in the fund
list (when a new order is created for instance).
0 allocated funds can be used to track donations and other situations
where there is not an expected amount for the year.

Test plan:
0. Do not apply the patch
1. Create 1 active and 1 inactive budgets
2. Create some funds for each budgets, with amount > 0 and amount == 0
3. Add orders to basket
=> Note that the funds with amount == 0 are not displayed
4. Apply the patch
5. Add orders to basket (using the different possible ways we have)
=> Note that the funds with amount == 0 are displayed

This change is applied to the different views of the acquisition module.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25499: Fix fund code column when closing a budget
Katrin Fischer [Fri, 22 May 2020 23:12:22 +0000 (01:12 +0200)]
Bug 25499: Fix fund code column when closing a budget

When closing a budget the fund code column in the table is
always empty. This is due to a TT variable not being correct.

To test:
- Create a budget and fund
- Order anything, leave basket open or not, but don't receive
- Duplicate your existing budget
- Close the first budget in order to move the pending orders
- Verify the fund code is not showing in the table
- Apply patch and reload the patch
- Verify fund codes are now showing correctly

Bonus: Changes the column heading Fund id to Fund ID.

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25920: Add liblocale-codes-perl package to fix ubuntu-stable (focal)
Mason James [Fri, 3 Jul 2020 11:42:02 +0000 (23:42 +1200)]
Bug 25920: Add liblocale-codes-perl package to fix ubuntu-stable (focal)

to test on ubuntu-20...

1/ install koha-common pkg
 $ sudo apt install koha-common

2/ confirm liblocale-codes-perl pkg is not installed :(
 $ apt-cache policy  liblocale-codes-perl | grep Installed
 Installed: (none)

3/ apply patch

4/ build and install new koha-common pkg

5/ confirm liblocale-codes-perl pkg is now installed :)
 $ apt-cache policy  liblocale-codes-perl | grep Installed
 Installed: 3.62-1

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26063: Use Koha::Plugins->call for some other hooks
Jonathan Druart [Wed, 29 Jul 2020 13:11:24 +0000 (15:11 +0200)]
Bug 26063: Use Koha::Plugins->call for some other hooks

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26063: Use Koha::Plugins->call for circulation hooks
Tomas Cohen Arazi [Fri, 24 Jul 2020 19:00:52 +0000 (16:00 -0300)]
Bug 26063: Use Koha::Plugins->call for circulation hooks

This patch gets rid of a helper method used for calling the plugin
hooks.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21468: (QA follow-up) Simplify payload
Tomas Cohen Arazi [Thu, 23 Jul 2020 14:52:57 +0000 (11:52 -0300)]
Bug 21468: (QA follow-up) Simplify payload

This patch simplifies the payload as suggested on bug 25855. It also
keeps some specific params that cannot be deduced from the passed
checkout object, (e.g. if it is an onsite checkout).

Tests are cleared and added for this special exceptions.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21468: (QA follow-up) Enhance tests
Tomas Cohen Arazi [Wed, 15 Jul 2020 05:26:20 +0000 (02:26 -0300)]
Bug 21468: (QA follow-up) Enhance tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21468: Add 'checkin' action for _after_circ_actions
Martin Renvoize [Mon, 6 Jul 2020 12:46:47 +0000 (13:46 +0100)]
Bug 21468: Add 'checkin' action for _after_circ_actions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21468: Unit tests for AddReturn
Martin Renvoize [Mon, 6 Jul 2020 12:46:15 +0000 (13:46 +0100)]
Bug 21468: Unit tests for AddReturn

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21468: Add 'checkout' action for _after_circ_actions
Martin Renvoize [Mon, 6 Jul 2020 08:44:11 +0000 (09:44 +0100)]
Bug 21468: Add 'checkout' action for _after_circ_actions

This patch adds a call to _after_circ_actions into AddIssue and passes
an appropriate payload for plugins to utilise after issuing items.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21468: Unit tests for AddIssue
Martin Renvoize [Mon, 6 Jul 2020 10:43:25 +0000 (11:43 +0100)]
Bug 21468: Unit tests for AddIssue

This patch adds a unit test for the addition of a call to the
_after_circ_action hook in AddIssue.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24031: (QA follow-up) Add tests for the AddReserve intervention
Tomas Cohen Arazi [Fri, 24 Jul 2020 18:42:17 +0000 (15:42 -0300)]
Bug 24031: (QA follow-up) Add tests for the AddReserve intervention

This patch adds tests for AddReserve

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24031: Add hook to test plugin with unit test
Kyle M Hall [Fri, 17 Jul 2020 15:32:57 +0000 (11:32 -0400)]
Bug 24031: Add hook to test plugin with unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24031: Add safety checks in Koha::Plugins::call
Julian Maurice [Fri, 22 May 2020 10:29:11 +0000 (12:29 +0200)]
Bug 24031: Add safety checks in Koha::Plugins::call

- Check that the plugin has the method before calling it
- Call the method in an eval block to prevent fatal errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24031: Remove check for syspref UseKohaPlugins
Julian Maurice [Fri, 22 May 2020 10:28:17 +0000 (12:28 +0200)]
Bug 24031: Remove check for syspref UseKohaPlugins

UseKohaPlugins has been removed by bug 20415

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24031: Fix warnings
Kyle M Hall [Thu, 21 Nov 2019 13:08:38 +0000 (08:08 -0500)]
Bug 24031: Fix warnings

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24031: Add plugin hook after_hold_create
Julian Maurice [Wed, 13 Nov 2019 10:11:54 +0000 (11:11 +0100)]
Bug 24031: Add plugin hook after_hold_create

It is called after a hold has been placed

Test plan:
1. Write a plugin that implements only after_hold_create (see
   `perldoc Koha::Plugins` for implementation details). Install it and
   enable it
2. Place a hold and verify that your plugin method has been called with
   the right parameters

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25855: (QA follow-up) Simplify payload
Tomas Cohen Arazi [Thu, 23 Jul 2020 14:00:11 +0000 (11:00 -0300)]
Bug 25855: (QA follow-up) Simplify payload

This patch makes the hook be passed the Koha::Checkout object instead
of a hand-crafted list of attributes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25855: (QA follow-up) Generalize hook and simplify tests
Tomas Cohen Arazi [Fri, 3 Jul 2020 13:26:06 +0000 (10:26 -0300)]
Bug 25855: (QA follow-up) Generalize hook and simplify tests

This patch generalizes the hook so it can be used by other circulation
actions.

Tests are also simplified by mocking some of the (extensive) plugin
hooks.

To test:
1. Repeat the test plan on the original patch
=> SUCCESS: All good
2. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25855: Add a post_renewal_action plugin hook
Tomas Cohen Arazi [Tue, 23 Jun 2020 19:23:06 +0000 (16:23 -0300)]
Bug 25855: Add a post_renewal_action plugin hook

This patch adds a new hook to notify plugins about renewal actions. To
test it:

1. Apply the unit tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> FAIL: The tests expect some warnings to show, and they don't (i.e.
        the sample plugin hook is not being called).
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The hook is being called on renewal!
5. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25855: Unit tests
Tomas Cohen Arazi [Tue, 23 Jun 2020 19:18:54 +0000 (16:18 -0300)]
Bug 25855: Unit tests

This patch adds tests fr a new circulation hook for plugins.
In this case the post_renewal_action hook,

The tests add the hook to the Test plugin, and verify that all the
required parameters are passed for the plugin hook to use them.
It relies on throwing an exception that is to be caught.

Sponsored-by: ByWater Solutions
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25961: Add hooks for plugins to inject variables to OPAC XSLT
Tomas Cohen Arazi [Wed, 8 Jul 2020 19:54:51 +0000 (16:54 -0300)]
Bug 25961: Add hooks for plugins to inject variables to OPAC XSLT

This patch adds the following plugin hooks:
- opac_results_xslt_variables
- opac_detail_xslt_variables

This hooks will inject variables returned by the plugin in the form of a
hashref, into the ones that are passed to the XSLT processing code.

To test:
1. Apply the 'DO NOT PUSH' commit
2. Install the Kitchensink plugin
3. Restart all
4. Search biblios in the OPAC
=> SUCCESS: A text is injected in front of the biblio title
5. Enter the detail page of any of the results
=> SUCCESS: A text is injected in front of the biblio title
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: DBRev 20.06.00.018
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000 (15:21 +0000)]
Bug 24157: DBRev 20.06.00.018

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: Handle the case where logged in user does not have edit_invoices
Jonathan Druart [Fri, 24 Jul 2020 11:03:31 +0000 (13:03 +0200)]
Bug 24157: Handle the case where logged in user does not have edit_invoices

This patch make possible the reopening and merging of invoices even if
the logged in user does not have the edit_invoices permission

I don't think it really makes sense but at least it's now possible.

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: (follow-up) New permission - delete_invoices
Jonathan Druart [Tue, 21 Jul 2020 09:09:50 +0000 (11:09 +0200)]
Bug 24157: (follow-up) New permission - delete_invoices

Hide the "Delete" invoice link if necessary on
/cgi-bin/koha/acqui/invoice.pl?invoiceid=X

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: New permission - merge_invoices
Jonathan Druart [Tue, 21 Jul 2020 09:03:07 +0000 (11:03 +0200)]
Bug 24157: New permission - merge_invoices

Add a new permission to merge invoices

Test plan:
- Remove the new permission "merge_invoices" for a given patron,
use it to log in into Koha
- Create 2 invoices, try to merge them
=> There is no way to merge it
- Add the permission
=> Now you can merge the invoices

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: (follow-up) Conditionally show controls to reopen and close invoice
Owen Leonard [Fri, 6 Mar 2020 19:13:35 +0000 (19:13 +0000)]
Bug 24157: (follow-up) Conditionally show controls to reopen and close invoice

This follow-up makes minor changes to the template so that the checkbox
for reopening or closing an invoice are not displayed when the user
doens't have the correct permissions.

To test, apply the patch and try the process of viewing or editing an
invoice as a user with these various permissions:

 - edit_invoices ON
 - edit_invoices OFF
 - reopen_closed_invoices ON
 - reopen_closed_invoices OFF

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: New permission - delete_baskets
Jonathan Druart [Wed, 11 Dec 2019 15:39:36 +0000 (16:39 +0100)]
Bug 24157: New permission - delete_baskets

Add a new permission to delete acquisition baskets

Test plan:
- Remove the new permission "delete_basket" for a given patron,
use it to log in into Koha
- Create basket, try to delete it
=> There is no way to delete it
- Add the permission
=> Now you can delete the basket

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: New permission - delete_invoices
Jonathan Druart [Wed, 11 Dec 2019 15:37:46 +0000 (16:37 +0100)]
Bug 24157: New permission - delete_invoices

Add a new permission to delete invoices

Test plan:
- Remove the new permission "delete_invoices" for a given patron,
use it to log in into Koha
- Create an invoice, try to delete it
=> There is no way to delete it
- Add the permission
=> Now you can delete the invoice

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: Add new method Acq::Invoice::Adjustement->fund
Jonathan Druart [Fri, 13 Dec 2019 16:37:36 +0000 (17:37 +0100)]
Bug 24157: Add new method Acq::Invoice::Adjustement->fund

Moving to its own commit in case we want to cherry-pick or move it to
its own bug report.

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: New permission - edit_invoices
Jonathan Druart [Tue, 10 Dec 2019 20:05:40 +0000 (21:05 +0100)]
Bug 24157: New permission - edit_invoices

Add a new permission to edit invoices

Test plan:
- Remove the new permission "edit_invoices" for a given patron,
use it to log in into Koha
- Create an invoice, edit it (click "detail")
=> You can see the detail of the invoice, but cannot edit it. It's a read-only view.
- Add the permission
=> The form is back and you can modify the invoices and save the changes.
Also, you are able to create adjustments.

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24157: New permission - reopen_closed_invoices
Jonathan Druart [Tue, 10 Dec 2019 19:03:28 +0000 (20:03 +0100)]
Bug 24157: New permission - reopen_closed_invoices

New permission to reopen a closed invoice.

Test plan:
- Remove the new permission "reopen_closed_invoices" for a given patron,
use it to log in into Koha
- Create an invoice, close it
=> You are not able to reopen the invoice
- Add the permission
=> You are able to reopen the invoice

Sponsored-by: Galway-Mayo Institute of Technology
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25709: DBRev 20.06.00.017
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000 (15:21 +0000)]
Bug 25709: DBRev 20.06.00.017

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25709: Rename systempreference to NotesToHide
Nick Clemens [Mon, 6 Jul 2020 17:56:35 +0000 (17:56 +0000)]
Bug 25709: Rename systempreference to NotesToHide

In an effort to use more inclusive language we have added a new coding guideline:
https://wiki.koha-community.org/wiki/Coding_Guidelines#TERM3:_Inclusive_Language

This patchset renames a syspref to be clearer and follow the guideline

To test:
1 - Apply patch and updatedatabase
2 - git grep NotesBlacklist
3 - Note all remaining occurrences are translations, db updates, and release notes
4 - Add a field (e.g. '520' ) to the NotesToHide systempreference
5 - View a record with a 520 field on the opac
6 - Confirm the field does not show in the 'Title notes' tab

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25811: Debug - Paste the source of the page
Jonathan Druart [Mon, 27 Jul 2020 12:59:59 +0000 (14:59 +0200)]
Bug 25811: Debug - Paste the source of the page

I am really struggling finding the problem here.
Posting the source of the page may help.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23086: Search for collection is broken
Kyle M Hall [Wed, 18 Sep 2019 14:28:33 +0000 (10:28 -0400)]
Bug 23086: Search for collection is broken

It appears that we are quoting the ccode values deep in the search code.
Under ICU chains this breaks searching by limits

To recreate
 1 - Setup Koha using Zebra and icuchains
 2 - Add ccode to AdvancedSearchTypes
 3 - In koha-conf.xml set zebra debug level to include request
  <zebra_loglevels>none,fatal,warn,request,info</zebra_loglevels>
 4 - Set some items into different ccodes
 5 - On opac perform a search for:
    ccode:NFIC
 6 - It works
 7 - tail -n 50 /var/log/koha/kohadev/zebra-output.log
 8 - Note search request like:
    Search biblios OK 26 1 1+0 RPN @attrset Bib-1 @attr 1=8009 NFIC
 9 - On opac go to advanced search, select Collection, and limit to smae code a s above
10 - No results
11 - Check the zebra-output.log:
    Search biblios OK 0 1 1+0 RPN @attrset Bib-1 @attr 1=8009 'NFIC'
12 - Apply patch
13 - Restart all
14 - Repeat search by collection limit
15 - Success!
16 - Check the zebra-output.log:
    Search biblios OK 0 1 1+0 RPN @attrset Bib-1 @attr 1=8009 NFIC
17 - Add a new ccode value: N)N
18 - Set some items to that ccode
19 - Confirm searching by that ccode works

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23086: Unit test
Nick Clemens [Wed, 15 Jul 2020 15:33:18 +0000 (15:33 +0000)]
Bug 23086: Unit test

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25940: Check for reserve_id before Dopop
Lucas Gass [Mon, 6 Jul 2020 20:38:42 +0000 (20:38 +0000)]
Bug 25940: Check for reserve_id before Dopop

TEST PLAN:
1. Have an item belonging to a different branch and check it in.
2. When the modal pops up hit 'Yes, print slip' or 'Print slip' if  AutomaticItemReturn is set to 'don't'
3. The first print dialog should appear with a URL like '/cgi-bin/koha/circ/transfer-slip.pl?transferitem=18&&branchcode=CPL&op=slip'
4. Close that print dialog and you will immediately see another one that says 'No slip template found'.
5. Notice the URL of the second pop-up is:  /cgi-bin/koha/circ/hold-transfer-slip.pl?reserve_id=
6. There is no reserve id so the template is not found.
7. Apply patch
8. Repeat 1-6
9. You should no longer have two print dialogs

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25724: Do not call ModReserveStatus when completing transfer
Nick Clemens [Fri, 12 Jun 2020 10:51:36 +0000 (10:51 +0000)]
Bug 25724: Do not call ModReserveStatus when completing transfer

I can not see how this code is useful here. It checks for a reserve with priority 0 and found = NULL
That is not a status that should occur when filling a transfer. Either the found is 'T' if we are transferring due
to the hold, or the hold was placed after the transfer was initiated, and so the priority is not 0

Additional, AddReturn checks for reserves later and asks the staff to confirm waiting status.

ModReserveStatus also calls CartToShelf regardless of what happens here.

To test:
1 - Set  UpdateItemLocationOnCheckin  to:
    _ALL_: CART
2 - SetAutomaticItemReturn = Do
3 - Check an item in at a different branch than it's homebranch to create a transfer
4 - Check the item in at it's homebranch
5 - View the item details page
6 - Item is not in CART location
7 - Apply patch
8 - Repeat
9 - Item is in CART location after completion of transfer

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25724: Unit tests
Nick Clemens [Fri, 12 Jun 2020 11:11:26 +0000 (11:11 +0000)]
Bug 25724: Unit tests

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24279: Disable editing lost status in items editor if item is a return claim
Kyle M Hall [Fri, 24 Jul 2020 11:26:14 +0000 (07:26 -0400)]
Bug 24279: Disable editing lost status in items editor if item is a return claim

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24279: Disable lost status select if item has a return claim
Kyle M Hall [Tue, 26 May 2020 11:27:28 +0000 (07:27 -0400)]
Bug 24279: Disable lost status select if item has a return claim

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24279: Display the tip in the title of the option
Jonathan Druart [Thu, 7 May 2020 10:33:17 +0000 (12:33 +0200)]
Bug 24279: Display the tip in the title of the option

This patch tells select2 to retrieve the title attribute from the
original option node.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24279: (QA follow-up) Show values disabled with tooltips
Kyle M Hall [Thu, 23 Apr 2020 13:04:25 +0000 (09:04 -0400)]
Bug 24279: (QA follow-up) Show values disabled with tooltips

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24279: Claims Returned does not work when set from additem.pl
Kyle M Hall [Mon, 30 Dec 2019 13:04:29 +0000 (08:04 -0500)]
Bug 24279: Claims Returned does not work when set from additem.pl

Test Plan:
1) Configure Claimes Returned
2) Apply this patch
3) Go to additem.pl for that item
4) Note the claims returned lost status does not show in the lost status pulldown

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24279: Claims Returned does not work when set from moredetail.pl
Kyle M Hall [Mon, 30 Dec 2019 12:51:23 +0000 (07:51 -0500)]
Bug 24279: Claims Returned does not work when set from moredetail.pl

Test Plan:
1) Configure Claimes Returned
2) Apply this patch
3) Go to moredetail.pl for that item
4) Note the claims returned lost status does not show in the lost status pulldown

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25729: Prevent Charges/Fees.t to fail on slow server
Jonathan Druart [Mon, 27 Jul 2020 13:15:44 +0000 (15:15 +0200)]
Bug 25729: Prevent Charges/Fees.t to fail on slow server

We must use t::lib::Dates::compare to compare dates

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoCompiled CSS (OPAC)
Jonathan Druart [Mon, 27 Jul 2020 08:12:35 +0000 (10:12 +0200)]
Compiled CSS (OPAC)

This RM task has not been done when it was needed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25889: Increase performance of debian/list-deps script
Mason James [Mon, 29 Jun 2020 01:40:36 +0000 (13:40 +1200)]
Bug 25889: Increase performance of debian/list-deps script

to test... (on a i7-2600 vm with 8 cores)

1/ run script, note execution time
    $ time ./debian/update-control
    real    8m5.000s

2/ copy old file
    $ cp ./debian/control control.old

3/ apply patch

4/ run updated script, note execution time is smaller
    $ time ./debian/update-control
    real    2m14.000s

5/ copy new file
    $ cp ./debian/control control.new

6/ confirm old and new control files are identical
    $ diff control.old control.new | wc -l
    0

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26033: Use pic.infini.fr instead of framapic
Jonathan Druart [Tue, 21 Jul 2020 10:36:17 +0000 (12:36 +0200)]
Bug 26033: Use pic.infini.fr instead of framapic

https://framapic.org/ is closing
"""
Framapic will be closing its doors on Tuesday, January 12, 2021. You will find a similar service on this page.
Uploading images is now disabled, but you can still retrieve your images on the My images page.
"""

https://framablog.org/2019/09/26/lets-de-frama-tify-the-internet/
https://framablog.org/2020/03/03/10-bonnes-raisons-de-fermer-certains-services-framasoft-la-5e-est-un-peu-bizarre/
(French)

We can still use another service. However we may think about hosting the
service ourself!

Test plan:
Modify a selenium script to make it fail (for instance modify the path
for a find_element call)
Run it
Confirm that the screenshot has been uploaded correctly and that the
link works

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26016: Fix capitalization for "MARC Preview"
Katrin Fischer [Fri, 17 Jul 2020 23:36:24 +0000 (23:36 +0000)]
Bug 26016: Fix capitalization for "MARC Preview"

To test:
- Go to any record in the staff catalog
- Check the display for the 'MARC Preview' link
- Apply patch
- It should have changed to 'MARC preview'

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 20799: (QA follow-up) Move syspref check
Martin Renvoize [Wed, 22 Jul 2020 09:09:29 +0000 (10:09 +0100)]
Bug 20799: (QA follow-up) Move syspref check

This patch moves the syspref check into the controller to save a DB
query if the module is not enabled.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
JD - amended patch: removing trailing parenthesis in the IF statement

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>