koha.git
3 years agoBug 25727: (follow-up) Use CSS specificity rather than !important
Owen Leonard [Wed, 17 Jun 2020 16:34:50 +0000]
Bug 25727: (follow-up) Use CSS specificity rather than !important

This patch adds specificty to the CSS which controls the "invalid"
appearance of a Select2 dropdown so that the use of "!important" can be
avoided. The patch also puts this style into our custom select2 CSS file
so that it is located with other Select2 style changes.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.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 25727: Fix highlight of a missing field
Jonathan Druart [Sat, 13 Jun 2020 13:03:50 +0000]
Bug 25727: Fix highlight of a missing field

In the previous version of Select2 we had only 1 'a' tag that was
visible, next to the invisible select.

Now we have a 3 nested span elt, the last one (with a role=combobox
attribute) is the one we want to style.

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 25727: Fix default values
Jonathan Druart [Sat, 13 Jun 2020 12:08:11 +0000]
Bug 25727: Fix default values

The way we defined the default values does not longer work (?)
Using
  $.fn.select2.defaults.set
instead of
  jQuery.extend($.fn.select2.defaults, {
fixes the problem.

It restores the allowClear setting.

There is a change in the behavior here, the selection opens when the
clear button is clicked. That is coming from a change in Select2
apparently. We may want to hack something to restore the precedent
behaviour.

This patch also removes the redefinition of the width. It seems that the
issue that this code was trying to correct is now fixed.

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 25727: Adjust translations
Jonathan Druart [Sat, 13 Jun 2020 11:32:56 +0000]
Bug 25727: Adjust translations

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 25727: Upgrade the Select2 JS lib to version 4
Jonathan Druart [Sun, 7 Jun 2020 10:23:04 +0000]
Bug 25727: Upgrade the Select2 JS lib to version 4

In order to benefit from the last feature of Select we should upgrade to the version 4.
For instance it adds the ability to dynamically create new entries

https://select2.org/tagging

Test plan:
Confirm that there is no visible regression on dropdown list with select2
Like edit a bibliographic records, and the items.

Sponsored-by: Orex Digital

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 26150: Remove the use of jquery.checkboxes plugin from inventory page
Owen Leonard [Wed, 5 Aug 2020 17:00:26 +0000]
Bug 26150: Remove the use of jquery.checkboxes plugin from inventory page

This patch removes the use of the jquery.checkboxes plugin from the
inventory page and replaces it with custom JS.

To test, apply the patch and go to Tools -> Inventory.

 - Submit the form with some selections which will return results on the
   following page. I filtered by library.
 - On the page showing results, test that the "Select all" and "Clear
   all" links work correctly.

Signed-off-by: Brandon J <brandon.jimenez@inLibro.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 26157: Hide expected DBI warnings from tests
Jonathan Druart [Thu, 6 Aug 2020 11:11:50 +0000]
Bug 26157: Hide expected DBI warnings from tests

We must redirect them to /dev/null if we know they will appear.

Test plan:
prove the different test files and confirm that the output is clean when
this patch is applied

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 21539: addorderiso2709.pl forces librarian to select a ccode and notforloan code...
Kyle M Hall [Wed, 10 Oct 2018 15:13:37 +0000]
Bug 21539: addorderiso2709.pl forces librarian to select a ccode and notforloan code when using MarcItemFieldsToOrder

There is no reason that MarcItemFieldsToOrder should force librarians
to select a ccode and notforloan value for each item.
They are both optional fields.
As with location, the first value should be an empty 'none' option.

Test Plan:
1) Set up MarcItemFieldsToOrder, do *not* set mappings for ccode and notforloan
2) Add an order record to a basket that uses MarcItemFieldsToOrder
3) Note you must choose a ccode and nfl value
4) Apply this patch
5) Reload the page
6) Note you no longer have to select values for ccode and notforloan

Signed-off-by: Daniel Gaghan <daniel.gaghan@pueblolibrary.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 26189: Compiled CSS
Jonathan Druart [Mon, 24 Aug 2020 09:06:39 +0000]
Bug 26189: Compiled CSS

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

3 years agoBug 26189: Improve styling of datatables within fieldsets
Martin Renvoize [Wed, 12 Aug 2020 12:58:58 +0000]
Bug 26189: Improve styling of datatables within fieldsets

Unset label width restriction: The label width restriction within
fieldsets causes issues for the datatables header. Unsetting it
explicitly here resolves the line wrapping issues :)

Reset margins for datatables found inside fieldsets such that the
datatable properly utilises the available space and restore the
default datatable label font weights.

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 25791: Remove win.print()
Lucas Gass [Wed, 15 Jul 2020 22:28:07 +0000]
Bug 25791: Remove win.print()

Test plan:
1) Turn on system preference SelfCheckReceiptPrompt
2) Check out item via /cgi-bin/koha/sco/sco-main.pl
3) Click "Finish"
4) Click 'Print receipt and end session'
5) Notice two print dialog boxes right on top of each other
6) Apply patch
7) Repeat steps 1 - 4
8) Should only get a single print dialog.
9) Test in FF/Chrome and make sure behavior is consistent

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 25903: Add unit tests
Kyle M Hall [Thu, 20 Aug 2020 11:56:12 +0000]
Bug 25903: Add unit tests

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

3 years agoBug 25903: Sending a SIP patron information request with a summary field flag in...
Kyle M Hall [Tue, 30 Jun 2020 18:37:21 +0000]
Bug 25903: Sending a SIP patron information request with a summary field flag in indexes 6-9 will crash server

The 'summary' field in the patron information request specifies if detail information should be send for holds,
overdues, fines, etc. The field is 10 characters in length (0-9). However, the SIP2 spec only defines indexes 0
though 5, leave 6 though 9 undefined. Some ILSs specify behavior for these undefined indexes. Apparently the
7th field is often used to request 'Fees', as opposed to 'Fines' in some ILS. Some software that integrate via
SIP try both the 5th and 7th indexes to ensure they get all fines and fees.

The problem is that Koha's SIP server crashes if any 'summary' index beyond 5 is flagged. We should simply
ignore flags beyond 5 and act as if no flags were sent.

Test Plan:
1) Enable SIP for your instance
2) Send a patron information request with a summary flag in any index beyond 5.
   i.e.: 6300120200617    124846      Y   AOMIDAY|AA21030050054321
3) Note the SIP server just closes the connection without a response
4) Apply this patch
5) Restart the SIP server
6) Send the same request
7) Note you get back the patron information response!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jeff Gaines <jgaine@arlingtonva.us>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

3 years agoBug 26076: (QA Follow up) Prevent error by using a fresh resultset
Kyle M Hall [Thu, 30 Jul 2020 13:35:38 +0000]
Bug 26076: (QA Follow up) Prevent error by using a fresh resultset

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 26076: Sum the amount due in the database query instead of a loop in Perl
Kyle M Hall [Tue, 28 Jul 2020 16:49:35 +0000]
Bug 26076: Sum the amount due in the database query instead of a loop in Perl

This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Verify that "Write off selected" functions as usual

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 26270: Fix ThingISBN after a change in behaviour
Jonathan Druart [Fri, 21 Aug 2020 12:00:51 +0000]
Bug 26270: Fix ThingISBN after a change in behaviour

This is just a guess! One of our tests is failing since today and we
don't modify anything in this area.
My guess is that the service is now returning the normalized version of
the ISBN

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 24683: IsAvailableForItemLevelRequest sub description expanded
Andrew Nugged [Sun, 19 Jul 2020 21:16:51 +0000]
Bug 24683: IsAvailableForItemLevelRequest sub description expanded

Signed-off-by: Agustin Moyano <agustinmoyano@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 24683: whole test formatted by 'perltidy'
Andrew Nugged [Sun, 19 Jul 2020 21:15:37 +0000]
Bug 24683: whole test formatted by 'perltidy'

This is complementary patch using styling from
bundled /xt/perltidyrc file

Almost no code change except a few long constant strings
broken to parts by concatenation.

Signed-off-by: Agustin Moyano <agustinmoyano@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 24683: Fix for take smart rules into account in "if all unavailable"
Andrew Nugged [Sun, 19 Jul 2020 21:20:56 +0000]
Bug 24683: Fix for take smart rules into account in "if all unavailable"

Inside of ItemsAnyAvailableAndNotRestricted was no effect from main set
of smart rules (per record and other limits): i.e. call to
"CanItemBeReserved" was absent totally.

Because of this there was a bug: for example none of two items were
allowed to be held when first was allowed by one smart rule, BUT on loan,
and second was disallowed by another smart rule (for example,
0 "Holds per record"),

i.e. in this case both items unavailable: so on-shelf holds setting
"allow hold if all unavailable" should allow to hold first one, and not
the second one. But it was that both wasn't allowed to be held.

Solution: call to sub "CanItemBeReserved" added so it checked for
"...->{status} ne 'OK'" so now if item restricted by smart rule it also
accounted as "unavailable" and "AnyAvailavble" not counts it.

How to reproduce:

1. Add 2 smart rules (/cgi-bin/koha/admin/smart-rules.pl) with "on shelf
   holds": "if all unavailable" for all rules, no "item level holds", and
   set "holds per record" to 2 for "books" and "0" for "computer files".

2. Create only 2 items for one biblio, but different types, "book"
   and "computer file". For example in misc4dev env:
   /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additem

3. Check out that item of type "book" to some person, for example,
   in misc4dev:
   /cgi-bin/koha/circ/circulation.pl?borrowernumber=2&barcode=3999900000001

4. Open reserve/request, for example, for item 1 and patron 1 in misc4dev
   env (/cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1)

5. It does not allow to hold, both red crossed, but computer file says
   "Exceeded max holds per record" because of "0" limit set on step 1.

6. Apply the patch.

7. Reload page on step 5 and see that "book" will be available for hold,
   but "computer file" still will be red-crossed "Exceeded max holds
   per record", now that's correct because both items unavailable:
   one because on load, another because of "0" limit for computer files.

8. Check-in book from step 3 so it will be returned to the library,

9. Reload page on step 5 and see that again no any holds available,
   but it's now also correct: "book" now returned but "on shelf holds"
   set to "if all unavailable".

Signed-off-by: Agustin Moyano <agustinmoyano@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 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted
Andrew Nugged [Fri, 17 Jul 2020 11:59:19 +0000]
Bug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted

Add cut-off shortcut (return from inside the loop) when first
"Any Available And Not Restricted" item found, because one is
enough for "Any".

Testing: no change visible for code behavior/results,
it is just faster because won't loop over the whole set.

Signed-off-by: Agustin Moyano <agustinmoyano@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 24683: Subroutine name changed (fix), no code logic changed This is the intermedi...
Andrew Nugged [Fri, 5 Jun 2020 06:59:48 +0000]
Bug 24683: Subroutine name changed (fix), no code logic changed This is the intermediate refactor: renamed subroutine only.

Naming mistake came because this sub is used to detect if anything
available for hold, but it used in "if ANY UNAVAILABLE rule", so actually
results of this sub negated (see below "return" in the code).

In details:

when previous refactor was done, name for subroutine was chosen
wrongly in "opposite" direction from what it actually does:

it was named "ItemsAnyAvailableForHold", but this subroutine gave
truth (1) if at least one of the items available on shelf, not lost,
not on loan, not held, and not restricted by smart rules and damaged
status. So, if this sub says that item is still "available", this
actually PREVENTS item from hold in parent sub (see negated return):

    sub IsAvailableForItemLevelRequest {
        ...
        my $any_available = ItemsAnyAvailableAndNotRestricted...
        return $any_available ? 0 : 1;
             # ^^^ if any available and not restricted - we don't allow
             #     on-shelf holds
        ...

I.e. like it named now: "ItemsAnyAvailableAndNotRestricted".

Small aside fix: white space for '&&' inside brackets added to join
operation by priority visually.

Testing plan not needed: all places where sub used it just renamed.
More: all this places/code was introduced in one older commit so there
is also no overlaps or other calls/uses for this subroutine.

Signed-off-by: Agustin Moyano <agustinmoyano@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 26023: Properly secure the cashup and refund actions
Martin Renvoize [Tue, 4 Aug 2020 14:02:03 +0000]
Bug 26023: Properly secure the cashup and refund actions

The cash register summary page for cash management is available for users
with the 'anonymous_refund' or 'cashup' permission and the actions available
are appropriately displayed.

However, the actions are not yet correctly tested for at the server and
so a user may force submit to accomplish the action.

Signed-off-by: Nick Clemens <nick@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 26023: Properly secure the cashup action for libraries
Martin Renvoize [Mon, 20 Jul 2020 08:44:05 +0000]
Bug 26023: Properly secure the cashup action for libraries

The libraries summary page for cash management is available for users
wit the 'anonymous_refund' permission to allow them to navigate to
alternate cash registers and search for the prior transaction to refund.

However, currently the cashup option appears, and is not blocked at the
server, for all user who may access the page. It should be blocked for
those users without the 'cashup' permission.

Signed-off-by: Nick Clemens <nick@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 26253: (bug 22857 follow-up) Remove duplicated mana_config in etc/koha-conf.xml
Jonathan Druart [Thu, 20 Aug 2020 08:10:14 +0000]
Bug 26253: (bug 22857 follow-up) Remove duplicated mana_config in etc/koha-conf.xml

It was there already but not at the same place!

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.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 26031: Add diagnostic to search_utf8.t
Jonathan Druart [Fri, 21 Aug 2020 08:06:57 +0000]
Bug 26031: Add diagnostic to search_utf8.t

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

3 years agoBug 25811: Add debug info to authentication.t
Jonathan Druart [Fri, 21 Aug 2020 08:49:42 +0000]
Bug 25811: Add debug info to authentication.t

Trying to know if the logged in patron is the one we are expecting to
(well, we are not expecting anybody to be logged in at this point!)

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

3 years agoBug 19036: (follow-up) Test credits should be credits
Martin Renvoize [Thu, 20 Aug 2020 11:52:09 +0000]
Bug 19036: (follow-up) Test credits should be credits

A series of accountlines added to mock credits were being added with a
debit_type_code instead of a valid credit_type_code and so were being
mis-identified by the new credit numbering code trigger in the store
routine.

This patch updates the test to correctly identify the credits as credits

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

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

3 years agoBug 18501: Don't use paidfor for DB fields not mapped with a MARC field
Jonathan Druart [Fri, 21 Aug 2020 10:02:07 +0000]
Bug 18501: Don't use paidfor for DB fields not mapped with a MARC field

On "Bug 25964: Prevent data loss when editing items from a MARC record"
we picked paidfor as an example, but it has a specific behaviour and is
now handled in Koha::Item->store.
Let's pick another one, new_status

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

3 years agoBug 18501: (follow-up) Use t::lib::Dates::compare in tests
Martin Renvoize [Fri, 21 Aug 2020 09:21:35 +0000]
Bug 18501: (follow-up) Use t::lib::Dates::compare in tests

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

3 years agoBug 18501: (follow-up) Add fallback to ItemHomeBranch
Martin Renvoize [Thu, 20 Aug 2020 13:02:35 +0000]
Bug 18501: (follow-up) Add fallback to ItemHomeBranch

When 'RefundLostOnReturnControl' is set to 'CheckinLibrary' but
return_branch is passed as undefined we should fallback to
'ItemHomeBranch' before falling back to the default rule.

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

3 years agoBug 18501: (follow-up) Do not rely on userenv->{branchcode}
Martin Renvoize [Thu, 20 Aug 2020 12:28:41 +0000]
Bug 18501: (follow-up) Do not rely on userenv->{branchcode}

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

3 years agoBug 18501: (follow-up) Test undefined userenv behaviour
Martin Renvoize [Thu, 20 Aug 2020 13:28:46 +0000]
Bug 18501: (follow-up) Test undefined userenv behaviour

This patch adds a test to ensure that the 'Koha::Item->store' method
will function when the userenv is not set

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

3 years agoBug 18501: (follow-up) Remove duplicate test
Martin Renvoize [Thu, 20 Aug 2020 11:38:23 +0000]
Bug 18501: (follow-up) Remove duplicate test

The ModItem test found in t/db_dependent/Items.t was a duplciate (but
slightly less functional) for the test we introduced for the *_on
trigger functionality in t/db_dependent/Koha/Items.t::store

The failure was a missing C4::Context mock, but the logical fix is to
simply remove the duplicate test.

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

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

3 years agoBug 18501: Fix QA issues
Jonathan Druart [Thu, 20 Aug 2020 09:49:08 +0000]
Bug 18501: Fix QA issues

 FAIL   Koha/Item.pm
   FAIL   critic
                # Variables::ProhibitConditionalDeclarations: Got 1 violation(s).
   FAIL   spelling
                 Retreive ==> Retrieve
                 appropriatly ==> appropriately
                 somehwere ==> somewhere

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

3 years agoBug 18501: (QA follow-up) Fix regressions highlighted by unit tests
Martin Renvoize [Fri, 14 Aug 2020 16:18:12 +0000]
Bug 18501: (QA follow-up) Fix regressions highlighted by unit tests

The migration of unit tests in the preceeding patch highlighted a few
regressions which are dealt with here.

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

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

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

3 years agoBug 18501: (QA follow-up) Migrate and update unit tests
Martin Renvoize [Fri, 14 Aug 2020 16:16:04 +0000]
Bug 18501: (QA follow-up) Migrate and update unit tests

This patch moves the _FixAccountForLostAndFound tests from Circulation.t
to Koha/Items.t and updates then to call an item store as aposed to the
now removed _FixAccountForLostAndFound method.

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

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

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

3 years agoBug 18501: (QA follow-up) Remove FIXME + Track issue_id
Martin Renvoize [Fri, 14 Aug 2020 10:53:59 +0000]
Bug 18501: (QA follow-up) Remove FIXME + Track issue_id

We correct some compilation errors here by updating the transfered
_FixAccountForLostAndFound method to use $self references.  We add
issue_id tracking so that future reports can clearly see how a refund
relates to the original charge and finally we remove a FIXME as I agree
that the 'discard_changes' call is not required.

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

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

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

3 years agoBug 18501: Adjust condition for flagging an item found
Jonathan Druart [Fri, 14 Aug 2020 08:51:39 +0000]
Bug 18501: Adjust condition for flagging an item found

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

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

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

3 years agoBug 18501: set the is_refunded flag as internal var
Jonathan Druart [Fri, 14 Aug 2020 08:48:00 +0000]
Bug 18501: set the is_refunded flag as internal var

After discussion with Martin we decided that it could be the correct way

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

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

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

3 years agoBug 18501: wip - need to know it has been refunded
Jonathan Druart [Fri, 14 Aug 2020 07:56:41 +0000]
Bug 18501: wip - need to know it has been refunded

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

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

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

3 years agoBug 18501: but.. what was the meaning of holdingbranch here?
Jonathan Druart [Thu, 13 Aug 2020 16:42:56 +0000]
Bug 18501: but.. what was the meaning of holdingbranch here?

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

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

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

3 years agoBug 18501: Add _set_found_trigger
Jonathan Druart [Thu, 13 Aug 2020 16:42:01 +0000]
Bug 18501: Add _set_found_trigger

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

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

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

3 years agoBug 18501: Auto refund if mark as found from cataloguing
Jonathan Druart [Mon, 10 Aug 2020 14:51:11 +0000]
Bug 18501: Auto refund if mark as found from cataloguing

If an item is marked as found (ie. not itemlost) we need to refund the
patron.

Test plan:
Mark an item as lost to create a fee for the patron
Mark it as found from the cataloguing module and confirm that the patron
is refunded

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

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

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

3 years agoBug 18501: Remove the borrowernumber parameter
Jonathan Druart [Wed, 12 Aug 2020 13:45:24 +0000]
Bug 18501: Remove the borrowernumber parameter

It was not used

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

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

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

3 years agoBug 18501: Prepare the ground
Jonathan Druart [Mon, 10 Aug 2020 14:39:08 +0000]
Bug 18501: Prepare the ground

This code was duplicated and we are going to need it.

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

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

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

3 years agoBug 18501: (QA follow-up) Add test of *_on functionality
Martin Renvoize [Tue, 18 Aug 2020 12:26:29 +0000]
Bug 18501: (QA follow-up) Add test of *_on functionality

This patch adds a test for the *_on trigger functionality to ensure
matching behaviour before and after the triggers change.

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

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

3 years agoBug 19036: DBRev 20.06.00.026
Jonathan Druart [Thu, 20 Aug 2020 10:27:33 +0000]
Bug 19036: DBRev 20.06.00.026

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

3 years agoBug 19036: (follow-up) Improve test output
Martin Renvoize [Wed, 19 Aug 2020 11:17:32 +0000]
Bug 19036: (follow-up) Improve test output

This patch adds proper detail to the test output for the newly
introduced AutoCreditNumber feature and fixes the final test by adding
the 'interface' and 'amount' parameters to the Koha::Account::Line being
created so that we reach the Exception we are trying to catch and don't
die early.

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

3 years agoBug 19036: Add missing test
Jonathan Druart [Tue, 18 Aug 2020 15:37:45 +0000]
Bug 19036: Add missing test

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

3 years agoBug 19036: (QA follow-up) Add credit_number handling to POS
Martin Renvoize [Thu, 6 Aug 2020 11:28:48 +0000]
Bug 19036: (QA follow-up) Add credit_number handling to POS

This patch adds the display of 'credit_number' as a replacement for the
internal 'accountlines_id' as the transaction identifier on the
register summary page when using cash registers.

Test plan
1/ Enable 'UseCashRegisters'
2/ Enable 'EnablePointOfSale'
3/ Enable at least one 'Debit type' to allow 'sale'
4/ Add at least one 'Cash register'
5/ Enable 'AutoCreditNumber'
6/ 'Enable automatic generation of credit number' for the 'Purchase'
credit type
7/ Pay for an item via the Point of Sale page
8/ Navigate to the 'register' page to display the purchase details
9/ Confirm that the 'Transaction' is listed with a number of the form
specified in the 'AutoCreditNumber' preference
10/ Refund an item from this screen
11/ Note that the 'accountlines_id' is used for this refund as we did
not specify the 'Refund' credit type to use the 'AutoCreditNumber'
system
12/ Signoff

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 19036: (QA follow-up) Fix 'out-by-one' error on table
Martin Renvoize [Thu, 6 Aug 2020 10:34:35 +0000]
Bug 19036: (QA follow-up) Fix 'out-by-one' error on table

This patch fixes the total row where the column count was out by one.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 19036: (QA follow-up) Fix test plan
Martin Renvoize [Fri, 10 Jul 2020 10:31:33 +0000]
Bug 19036: (QA follow-up) Fix test plan

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 19036: DBIC Schema Updates
Martin Renvoize [Thu, 25 Jun 2020 09:43:03 +0000]
Bug 19036: DBIC Schema Updates

Dumped schema updates + manual addition of boolean flags

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 19036: (QA follow-up) Use Koha::DateUtils
Martin Renvoize [Thu, 25 Jun 2020 09:16:45 +0000]
Bug 19036: (QA follow-up) Use Koha::DateUtils

This patch replaced raw DateTime->now calls with dt_from_string from
Koha::DateUtils

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 19036: Add ability to enable credit number for only some credit types
Julian Maurice [Tue, 24 Mar 2020 09:14:03 +0000]
Bug 19036: Add ability to enable credit number for only some credit types

This feature is disabled by default for all credit types. To enable it
you have to set the syspref AutoCreditNumber to the value of your choice
and then enable the feature for each credit type you want.
System credit types can be modified too (but only this particular field
can be modified)

Also, throw an exception when the feature is enabled and a value for
credit_number has already been set

Updated test plan:
Test plan:
0. Apply patch, run updatedatabase and update_dbix_class_files
1. Go to Admin » Column settings, and uncheck the 'hidden' box for
   column credit_number in table account-fines. It will be easier for
   testing
2. Create a manual credit for a borrower. Verify in Transactions tab
   that this credit has no number generated
3. In Admin » Credit types:
  a. edit the FORGIVEN type and enable credit number generation
  b. create a new type A, check "can be manually added" and "enable
     credit number"
  c. create a new type B, check "can be manually added". Do NOT enable
     credit number
4. Change syspref 'AutoCreditNumber' to 'incremental'
5. Create more manual credits with types CREDIT and B, and verify that
   the numbers are not generated
6. Create more manual credits with types FORGIVEN and A, and verify that
   the numbers generated are 1, 2, 3, ...
7. Change syspref 'AutoCreditNumber' to 'annual'
8. Create more manual credits with types CREDIT and B, and verify that
   the numbers are not generated
9. Create more manual credits with types FORGIVEN and A, and verify that
   the numbers generated are '2020-0001', '2020-0002', ...
10. Change syspref to 'AutoCreditNumber' to 'branchyyyymmincr'
11. Create more manual credits with types CREDIT and B, and verify that
    the numbers are not generated
12. Create more manual credits with types FORGIVEN and A, and verify
    that the numbers generated are 'BRANCHA2020020001',
    'BRANCHA2020020002', ... (assuming you are connected to library
    BRANCHA, and it's February 2020)
13. Set library to another one, say BRANCHB
14. Create more manual credits with types FORGIVEN and A, and verify
    that the numbers generated are 'BRANCHB2020020001',
    'BRANCHB2020020002', ...
15. Edit the letter ACCOUNT_CREDIT, and add [% account.credit_number %]
    somewhere. Go back to Transactions tab and click on 'Print' for one
    line that has a credit number. Make sure the number is there.
16. prove t/db_dependent/Koha/Account.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 19036: Add ability to auto generate a number for account credits
Julian Maurice [Thu, 20 Feb 2020 09:02:38 +0000]
Bug 19036: Add ability to auto generate a number for account credits

In some areas it's required to sequentially number payment slips /
receipts.

This patch adds a database column accountlines.credit_number and a
system preference AutoCreditNumber to control how this number will be
generated.  The following options are available:

- Do not automatically generate credit numbers.
  This is the current behaviour and the default syspref value.

- Automatically generate credit numbers in the form <year>-0001 (annual)

- Automatically generate credit numbers in the form
  <branchcode>yyyymm0001 (branchyyyymmincr)
  where <branchcode> is the branch where the user (staff member) is
  logged in

- Automatically generate credit numbers in the form 1, 2, 3
  (incremental)

It also adds a column (hidden by default) in the table under
Transactions tab to display this number.

Test plan:
0. Apply patch, run updatedatabase and update_dbix_class_files
1. Go to Admin » Column settings, and uncheck the 'hidden' box for
   column credit_number in table account-fines. It will be easier for
   testing
2. Create a manual credit for a borrower. Verify in Transactions tab
   that this credit has no number generated
3. Change syspref 'AutoCreditNumber' to 'incremental'
4. Create more manual credits, and verify that the numbers generated are
   1, 2, 3, ...
5. Change syspref 'AutoCreditNumber' to 'annual'
6. Create more manual credits, and verify that the numbers generated are
   '2020-0001', '2020-0002', ...
7. Change syspref to 'AutoCreditNumber' to 'branchyyyymmincr'
8. Create more manual credits, and verify that the numbers generated are
   'BRANCHA2020020001', 'BRANCHA2020020002', ... (assuming you are
   connected to library BRANCHA, and it's February 2020)
9. Set library to another one, say BRANCHB
10. Create more manual credits, and verify that the numbers generated are
    'BRANCHB2020020001', 'BRANCHB2020020002', ...
11. Edit the letter ACCOUNT_CREDIT, and add [% account.credit_number %]
    somewhere. Go back to Transactions tab and click on 'Print' for one
    line that has a credit number. Make sure the number is there.
12. prove t/db_dependent/Koha/Account.t

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 25242: Compiled CSS
Jonathan Druart [Thu, 20 Aug 2020 10:27:05 +0000]
Bug 25242: Compiled CSS

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

3 years agoBug 25242: (QA follow-up) Remove deprecated break-word
Martin Renvoize [Wed, 19 Aug 2020 07:36:03 +0000]
Bug 25242: (QA follow-up) Remove deprecated break-word

It appears break-word is now deprecated in Firefox and instead all
browsers now support break-all as the definitive.

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

3 years agoBug 25242: (QA follow-up) Colwidth on results table
Martin Renvoize [Tue, 18 Aug 2020 09:35:59 +0000]
Bug 25242: (QA follow-up) Colwidth on results table

Prior to this patch, the column width on the opac-results table were not
fixed or calculated by a datatable; As such when we introduced the
'table-layout: fixed' property all columns were given equal share of the
table, which resulted in most cases in a three way split between a
checkbox, an empty cell and the actual content.

This patch sets the width for the selectcol to '1ch' for the single
character checkbox and updates the second columns class to 'numcol' as
it is not used for selection but rather result numbering and sets a
fixed width of '4ch' allowing for results upto 3 digits (plus the
period) to display correctly without wrapping.

Test plan
1/ Apply the patches and run the yarn build process to update the .css
2/ Perform a search and varify that the results table looks reasonable
3/ Disable OPACHiddenItems and perform a search again.
4/ Confirm the table looks reasonable still
5/ Signoff

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

3 years agoBug 25242: Improve column wrapping and overflow for tables
Martin Renvoize [Thu, 6 Aug 2020 12:29:54 +0000]
Bug 25242: Improve column wrapping and overflow for tables

This patch attempts to improve the column wrapping and prevent
datatabels from overlapping with other content on high zoom levels/low
width screen sizes.

Test plan
1/ Build the OPAC CSS from the updated SCSS
2/ Navigate to various tables in the OPAC (Holds table is a good one)
and 'play' with various window sizes and zoom levels.
3/ The table should not overlap with right navigation content
4/ Signoff

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 25430: Use label-default for 0
Jonathan Druart [Tue, 18 Aug 2020 14:44:34 +0000]
Bug 25430: Use label-default for 0

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

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

3 years agoBug 25430: Improve the styling of the claims returned tab
Kyle M Hall [Fri, 8 May 2020 17:15:40 +0000]
Bug 25430: Improve the styling of the claims returned tab

It has been suggested that it would be useful to add title attributes to the different numbers on the return claims tab in the checkouts and patron details pages. In addition, color coding them ( and removing the slash ) will make the numbers easier to read.

Test Plan:
1) Set up return claims for your system
2) Apply this patch
3) View the claims tab for someone with not claims, and someone with claims
4) Note the resolved claims are green and have a "tooltip" when hovered over
5) Note the unresolved claims are green if 0, and yellow if not 0, and
   also have a "tooltip"

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

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

3 years agoBug 25626: Fix untranslatable strings on the 'OPAC problem reports' admin
Jonathan Druart [Mon, 1 Jun 2020 08:19:05 +0000]
Bug 25626: Fix untranslatable strings on the 'OPAC problem reports' admin

The 'Sent to' and 'Status' column values were not translatable.

Test plan:
Translate the interface
Report some problems at the OPAC
Go to the admin page and notice that all the columns are now translated

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

3 years agoBug 26082: Call store on new items to update itemnumber
Colin Campbell [Wed, 29 Jul 2020 12:23:14 +0000]
Bug 26082: Call store on new items to update itemnumber

Need to add call to store to Koha::Item->new so that itemnumber
is returned - otherwise is not defined and causes an error
Bug is a side-effect of Bug 23463 as this was implicitly
done in AddItem

Also set biblioitemnumber explicitly for item adds this also
used to be done explicitly but can now cause an FK error

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

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

3 years agoBug 26251: Remove unused routines from svc/split_callnumbers
Marcel de Rooy [Wed, 19 Aug 2020 11:46:16 +0000]
Bug 26251: Remove unused routines from svc/split_callnumbers

This is just a copy and paste from svc/localization

Test plan:
Read the code.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

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

3 years agoBug 26039: Focus and Scroll to ShelfBrowser on load
Martin Renvoize [Thu, 13 Aug 2020 12:17:59 +0000]
Bug 26039: Focus and Scroll to ShelfBrowser on load

When the shelf browser link is clicked we perform a full page reload
which results in a reset in the context. We should immediately focus the
shelf browser and scroll to that region to highlight the change of
content.

Test plan
1/ Enable shelf browser
2/ Search for an item in the open and navigate to the detail page
3/ Click the 'Browse shelf' link
4/ Note that upon page reload the screen scrolls to the 'Browsing...'
location of the screen.
5/ Note that the 'Browsing...' title is  'focused'
6/ Signoff.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: correctly align JS code

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

3 years agoBug 25605: Replace NULL values with '' when downloading a report as a tab separated...
Didier Gautheron [Tue, 26 May 2020 11:31:31 +0000]
Bug 25605: Replace NULL values with '' when downloading a report as a tab separated text

Test plan :
    1- Create a new report : select * from items;
    2- Run it
    3- Download the report as a tab separated text
    4- There's a lot of 'use of uninitialized value in join or string at ...koha/reports/guided_reports.pl line xxx.'
    in plack-error.log
    5- Apply patch
    6- Restart all
    7- Redo 2 and 3
    8- No more warning.
    9- diff both downloaded files, they must be the same.

Signed-off-by: Marco Abi-Ramia <marco.abi-ramia@inlibro.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 26134: (bug 23463 follow-up) Fix add to basket from staged file
Jonathan Druart [Thu, 6 Aug 2020 10:50:36 +0000]
Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file

There is a ->store call missing when we attempt to create a new item.

Test plan:
- set at least one value in MARCItemFieldsToOrder
- add to a basket via staged file with at least one value matching your MARCItemFields mappings
- set required fields for your order and click Save
=> Without this patch you got:
receive error: "DBIx::Class::Storage::DBI::_dbh_execute(): Column 'itemnumber' cannot be null at /kohadevbox/koha/Koha/Acquisition/Order.pm line 113
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77"
=> With this patch applied the order has been created successfully

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 26153: Remove the use of jquery.checkboxes plugin from items lost report
Owen Leonard [Wed, 5 Aug 2020 18:24:08 +0000]
Bug 26153: Remove the use of jquery.checkboxes plugin from items lost report

This patch removes the use of the jquery.checkboxes plugin from the
lost items report page and replaces it with custom JS.

To test, apply the patch and go to Reports -> Lost items.

- Run the report with parameters which will return multiple results.
- On the results page Create a CSV export profile if there's none.
- On the results page test the "Select all" and "Clear all"
  links at the top of the results. The controls should work correctly.

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.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 26234: Teach our KohaTable constructor the specific th classes
Jonathan Druart [Tue, 18 Aug 2020 09:59:24 +0000]
Bug 26234: Teach our KohaTable constructor the specific th classes

We have different classes we can use to set specific behaviours on
table columns: title-string, string-sort, anti-the and NoSort.
We should not need to pass them to the DataTable constructor, we could
teach it that we always want to apply them.

It will avoid bug like bug 26233

The goal is to define them in a centralised place
(columns_settings.inc) then only use the class on the th

Test plan:
Different behaviour and tables must be tested to confirm it works
correctly. Focus must be put on table when aoColumnsDefs is passed from
the template and confirm that this will add more info to aoColumnsDefs
and not remove the existing ones.

Note that this only work when KohaTable is used.

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 26239: Do not format large negative numbers
Nick Clemens [Tue, 18 Aug 2020 16:41:09 +0000]
Bug 26239: Do not format large negative numbers

At several places we got the following error if we use numbers too big
for Number::Format
Template process failed: undef error - round() overflow. Try smaller
precision or use Math::BigFloat at /home/koha/src/Koha/Number/Price.pm line 44

It make the app explodes.
The goal here is to handle these errors gracefully and easily.

We fixed it for positive numbers in bug 15770, but we neglected the case of negative numbers

Test plan:
- Add a manual credit to a patron of 100000000000000
- ISE!
- Apply patch
- Restart all the things

Works perfectly.

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 26162: Don't fall into an infinite loop
Jonathan Druart [Wed, 19 Aug 2020 05:19:09 +0000]
Bug 26162: Don't fall into an infinite loop

If something went wrong we do want to stop the script!

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

3 years agoBug 6725: (follow-up) Make patron duplicate matching flexible
Jonathan Druart [Tue, 18 Aug 2020 16:29:04 +0000]
Bug 6725: (follow-up) Make patron duplicate matching flexible

oops...

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

3 years agoBug 25906: Compiled CSS (late)
Jonathan Druart [Tue, 18 Aug 2020 15:43:29 +0000]
Bug 25906: Compiled CSS (late)

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

3 years agoBug 25945: Description of AuthoritySeparator is misleading
Caroline Cyr La Rose [Tue, 7 Jul 2020 20:01:58 +0000]
Bug 25945: Description of AuthoritySeparator is misleading

This patch changes the description of the AuthoritySeparator system preference

To test:
1. Apply patch
2. Go to Administration > Global system preferences > Cataloging and locate the
AuthoritySeparator preference
3. Read the description and make sure it makes sense and that there are no typos
or grammatical errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 26086: Add 'cron' to log viewer interface options
Nick Clemens [Wed, 29 Jul 2020 13:49:03 +0000]
Bug 26086: Add 'cron' to log viewer interface options

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Bug 26086: (follow-up) Be consistent with space in cron job

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

3 years agoBug 6725: DBRev 20.06.00.025
Jonathan Druart [Tue, 18 Aug 2020 15:40:44 +0000]
Bug 6725: DBRev 20.06.00.025

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

3 years agoBug 6725: (QA follow-up) Slightly rephrase PatronDuplicateMatchingAddFields
Katrin Fischer [Sat, 15 Aug 2020 02:48:20 +0000]
Bug 6725: (QA follow-up) Slightly rephrase PatronDuplicateMatchingAddFields

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 6725: Make patron duplicate matching flexible
Jonathan Druart [Wed, 5 Aug 2020 10:20:08 +0000]
Bug 6725: Make patron duplicate matching flexible

This patch adds a new system preference PatronDuplicateMatchingAddFields
to list the patron's attributes to use for deduplication.
The default value is surname, firstname and dateofbirth to keep existing
behaviour.

Test plan:
0. Apply the patch and execute the update DB entry
1. Create a new patron with surname, firstname
2. Create another patron with the same surname, firstname values
=> Confirm you get the duplicate warning
3. Modify the syspref to edit the list of attributes used to dedup
4. Repeat 1 and 2 with different values and confirm that you get the
behaviours you expect

Note: This is only impacting the add patron form from the UI, not the
import patrons tool.

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 16748: Add the ability to define due date in batch checkout
Jonathan Druart [Tue, 4 Aug 2020 14:55:56 +0000]
Bug 16748: Add the ability to define due date in batch checkout

This patch allows the librarian to pick the due date when batch checkout

Test plan:
Batch checkout using a hard due date
=> Notice that the due date is taken into account
Batch checkout the same barcodes with a different due date, to trigger the confirmation step
=> Notice that the due date is taken into account for the renewals

Signed-off-by: Henry Bolshaw <bolshawh@parliament.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 20469: Add item status to staff article request form
Marcel de Rooy [Mon, 26 Mar 2018 11:20:53 +0000]
Bug 20469: Add item status to staff article request form

The template checks if an item is checked out, on hold (waiting or
transit), not for loan. (Note: This can be extended in the future
in a general include as we have at opac side.)

Test plan:
[1] Place an article request on an item on loan. Verify status on form.
[2] Place an article request on a waiting item. Check status again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

[EDIT] Simplified on 2020-07-27
Removed Koha::Item->is_waiting_or_transit.
Use Koha::Item->itemtype to check notforloan on itemtype level.
Adjusted commit message accordingly.

Additional test:
[3] Place an article request on a not for loan item. Check status.

NOTE: Not for loan is informational too. It does not say that this item
is not available for an article request. Depends on local situation.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 20469: Remove effective parameter
Marcel de Rooy [Mon, 27 Jul 2020 13:34:21 +0000]
Bug 20469: Remove effective parameter

Test plan:
Run test Koha/Item.t again

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 20469: Add Koha::Item->itemtype
Marcel de Rooy [Mon, 27 Jul 2020 12:31:14 +0000]
Bug 20469: Add Koha::Item->itemtype

Also needed to add a missing rollback to preceding subtest.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 22393: (QA follow-up) Typos and Filters
Martin Renvoize [Fri, 10 Jul 2020 16:39:53 +0000]
Bug 22393: (QA follow-up) Typos and Filters

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 22393: (follow-up) Corrections for QA feedback
Martin Renvoize [Tue, 21 Apr 2020 14:54:45 +0000]
Bug 22393: (follow-up) Corrections for QA feedback

We correct the behviour of 'amount' being passed back to the template
and add a work around for the existance of deleted_items alongside a FK
to items in the accountlines table.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 22393: Remove last remaining use of C4::Accounts::manualinvoice
Martin Renvoize [Mon, 10 Feb 2020 14:55:13 +0000]
Bug 22393: Remove last remaining use of C4::Accounts::manualinvoice

This patch re-arranges the manualinvoice controller script to clarify
code flow, replaces the last call to C4::Accounts::manualinvoice with a
call to Koha::Accounts->add_debit wrapped in a try catch block and also
adds a check on passed barcodes when the invoice type is 'LOST' so it
can link the subsequently created accountline to the item and issue.

Test plan
1/ Add a manual invoice (without entering a barcode)
2/ Add a manual invoice with a valid barcode (Not a LOST type)
3/ Add a manual invoice with a valid, but old, barcode (Not a LOST type)
4/ Add a manual invoice with an invalid barcode, note that an error is
displayed
5/ Add a manual invoice with type 'LOST' and a valid barcode for a
checkout your user has had checked out
6/ Add a manual invoice with type 'LOST' and a valid barcode, but not
one that will match a checkout for your user. Note an error is displayed
7/ When errors are displayed, note the form contains data from the
previous submission so you can just correct the error rather than
re-enter all data.
8/ Signoff

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 24884: Remove 'New list' button in 'Public lists' tab if OpacAllowPublicListCreat...
Owen Leonard [Mon, 17 Aug 2020 16:57:54 +0000]
Bug 24884: Remove 'New list' button in 'Public lists' tab if OpacAllowPublicListCreation is disabled

This patch adds a check on the OpacAllowPublicListCreation system
preference to the OPAC lists template so that if public list creation is
disabled the "New list" button doesn't appear under the "Public lists"
tab.

To test, apply the patch and confirm that the virtualshelves preference
is enabled.

- With the OpacAllowPublicListCreation system preference enabled, go to
  the OPAC and view the lists page.
  - If you are logged in you should see a "New list" link under both the
    "Your lists" tab and the "Public lists" tab.
  - If you are not logged in you should see "Log in to create a new
    list" on both pages.
- View the page with OpacAllowPublicListCreation disabled.
  - If you are logged in you should see a "New list" link under only the
    "Your lists" tab.
  - If you are not logged in you should see the "Log in" link only under
    the "Your lists" tab.

Works perfectly!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.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 25114: Remove duplicated logic from GetLoanLength()
Lari Taskula [Sat, 11 Apr 2020 19:48:48 +0000]
Bug 25114: Remove duplicated logic from GetLoanLength()

Remove duplicated logic for searching circulation rules.

This can be replaced with get_effective_rules().

To test:
1. prove t/db_dependent/Circulation/GetHardDueDate.t

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 25364: Undo change to 'None specified'
Katrin Fischer [Sat, 15 Aug 2020 18:53:25 +0000]
Bug 25364: Undo change to 'None specified'

As this has been a little controversial, this patch undoes
the change to "None specified / Prefer not to say" to be
"None specified" again as before this patch set.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 25364: Add "Other" to the gender options in a patron record
David Roberts [Mon, 4 May 2020 02:29:14 +0000]
Bug 25364: Add "Other" to the gender options in a patron record

This patch adds "Other" as an option, and also changes the wording of
"None specified" slightly.

To test:

1) Apply the patch
2) Check that there is an "Other" radio button in the patron record, and
that the wording of "None specified" has changed to "None specified /
Prefer not to say".
3) Check that you can save changes to the gender of this patron record,
both on create and modify.
4) Check that these changes also work in the Opac Self-Registration
functionality.

Correct typos in previous commit

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>

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

3 years agoBug 25654: Make the contact and non-patron guarantor sections separate on patron...
Owen Leonard [Fri, 26 Jun 2020 20:12:58 +0000]
Bug 25654: Make the contact and non-patron guarantor sections separate on patron entry form

This patch reverses what I think was an unintended change made by Bug
14570 in which the non-patron guarantor fields are shown for all patron
types (not just child patrons) and  grouped with the patron contact fields.

This patch creates a new "Non-patron guarantor" fieldset to show along
with "Patron guarantor" when adding or editing child patrons.

To test, apply the patch check that the  BorrowerUnwantedField system
preference does not contain contactname, contactfirstname,
or relationship.

 - Open an adult patron for editing. You should see no guarantor-related
   fields.
 - Open a child patron for editing. There should be two guarantor
   sections: "Patron guarantor" and "Non-patron guarantor."
   - Test that adding patron guarantors and non-patron guarantors works
     correctly.
   - Add "contactname|contactfirstname|relationship" to the
     BorrowerUnwantedField system preference.
   - Reload the child patron entry form. The non-patron guarantor
     section should now be hidden.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.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 25694: Add ability to delete a Marc Modification Template when viewing
Owen Leonard [Mon, 27 Jul 2020 14:39:22 +0000]
Bug 25694: Add ability to delete a Marc Modification Template when viewing

This patch adds a "delete template" button to the MARC modification
templates "Edit actions" view.

To test, apply the patch and go to Tools -> MARC modification templates.

 - On the main MARC modification templates page the toolbar should have
   only one button: "New template."
 - Click the "Edit actions" button for an existing template.
 - On the "Actions for..." view there should be three buttons, "New
   template," "New action," and "Delete template."
   - Test that the "Delete template" button works correctly.

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 25832: Add DataTables to MARC subfield structure admin page for authorities
Owen Leonard [Tue, 23 Jun 2020 11:52:20 +0000]
Bug 25832: Add DataTables to MARC subfield structure admin page for authorities

This patch adds DataTables sorting and filtering to the table of
subfields shown on the Authority MARC subfield structure administration
page.

To test, apply the patch and go to Administration -> Authority types.

 - From the 'Actions' menu, select 'MARC structure.'
 - From the 'Actions' menu, select the 'Subfields' link for a tag
   with multiple subfields.
   - On the page showing all the subfields for the tag, confirm that
     the table is sorted by default by subfield and that sorting works
     correctly.
   - Confirm that the search form at the top of the table works.

Signed-off-by: Katrin <katrin.fischer@bsz-bw.de>

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

3 years agoBug 25867: DBRev 20.06.00.024
Jonathan Druart [Tue, 18 Aug 2020 13:50:32 +0000]
Bug 25867: DBRev 20.06.00.024

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

3 years agoBug 25867: Database update for changing existing frameworks
Katrin Fischer [Fri, 14 Aug 2020 13:17:01 +0000]
Bug 25867: Database update for changing existing frameworks

This updates the descriptions for 952$a und $b in all existing
frameworks, if the English description hasn't been changed since
installing Koha.

To test:
- Look at your item edit form or on the MARC tab
  for the descriptions shown for $a and $b for any framework
- Note the descriptons say '... location'
- Change one or more using the frameworks.
- Run the database update
- Verify only the unchanged ones have been updated

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

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

3 years agoBug 25867: Label "Current location" as "Current library" and "Permanent location...
Katrin Fischer [Sat, 18 Jul 2020 01:43:02 +0000]
Bug 25867: Label "Current location" as "Current library" and "Permanent location" as "Home library"

There is some confusion between the different locations and
libraries appearing in the GUI.

holdingbranch is sometimes labeled as current location
homebranch is sometimes labeled as permanent location

The patch fixes these occurences in various files:
- Item search form, results and export options
- MARC frameworks for en, fr-Fr, nb-NO, and pl-PL
- Holds awaiting pickup report
- Item display on order receive screen (create items on receive)
- OPAC system preference: OPACResultsLibrary
- Staff and OPAC detail pages
- Lost items report
- Rotating collections

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 26065: Move translatable strings out of marc_modification_templates.tt and into...
Owen Leonard [Sat, 25 Jul 2020 15:10:24 +0000]
Bug 26065: Move translatable strings out of marc_modification_templates.tt and into marc_modification_templates.js

This patch removes the <script> block in the MARC modification
templates template in which strings are defined for translation
purposes.

Strings are now in place in the JavaScript file and wrapped in the new
__() function.

To test, apply the patch and clear your browser cache if necessary.

- Perform some actions which will trigger translated strings, for
  example:
  - Create a new template
  - Add an action to the template and then delete it.
    - The confirmation should appear correctly
  - Add an action. Select "Copy" as the operation and click "Add action"
    without filling in any fields.
    - You should see a message, "Both subfield values should be filled
      or empty"

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

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

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js for
  translation, e.g.:

  msgid "Both subfield values should be filled or empty."
  msgstr ""

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

> perl translate install fr-FR

- Switch to your newly translated language in the staff client and
  repeat the test plan above. The translated string should appear.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 25778: Fix var scope in koha-plack for PERL5LIB and KOHA_HOME
David Cook [Fri, 14 Aug 2020 01:49:40 +0000]
Bug 25778: Fix var scope in koha-plack for PERL5LIB and KOHA_HOME

Currently, if a koha-plack is given multiple instances, it will create
duplicate $KOHA_HOME/installer and $KOHA_HOME/installer/lib entries
in PERL5LIB as these changes are done at the global rather than local level.

This issue can only be seen in non-dev Koha, since dev Koha installs
rewrite PERL5LIB.

This patch localizes PERL5LIB to each instance.

To test dev installs:
0. cp debian/scripts/koha-plack /usr/sbin/koha-plack
1. koha-plack --restart kohadev
2. Note that nothing breaks

To test non-dev installs:
0. Don't replace /usr/sbin/koha-plack yet
1. Create multiple non-dev installs with plack enabled and running
2. Set up one of these non-dev installs so you can use the web
UI (that is beyong the scope of this test plan)
3. koha-plack --restart test1 test2 test3
4. For test3, go to /cgi-bin/koha/about.pl
5. Note that there are duplicate /usr/share/koha/installer
and /usr/share/koha/lib/installer entries in PERL5LIB
6. cp debian/scripts/koha-plack /usr/sbin/koha-plack
7. koha-plack --restart test1 test2 test3
8. For test3, go to /cgi-bin/koha/about.pl
9. Note that there are no duplicates entries in PERL5LIB

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

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

3 years agoBug 26194: (follow-up) Default to current branch
Martin Renvoize [Wed, 12 Aug 2020 15:07:05 +0000]
Bug 26194: (follow-up) Default to current branch

When adding a new register, it would be helpful to default to the
current logged in branch.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

3 years agoBug 26194: Add link to cash register management from message about missing registers
Owen Leonard [Tue, 11 Aug 2020 19:33:41 +0000]
Bug 26194: Add link to cash register management from message about missing registers

In places where the interface warns the user about missing cash
registers we should provide users with permission a direct link to the
cash register management page.

To test, apply the patch and enable the UseCashRegisters and
EnablePointOfSale preferences.

If necessary, go to Administration -> Cash registers and remove any cash
registers for your library.

 - Log in to the staff interface as a user with "manage_cash_registers"
   permission.
 - Locate a patron who has outstanding fines.
 - Under Accounting -> Make a payment, click the "Pay" button next to a
   fine.
 - The page should show the message about missing cash registers with a
   button which take you directly to the "Add new cash register" form.
 - Perform the same check by selecting the checkbox next to a fine and
   clicking the "Pay amount" button and the "Pay selected" button.
 - Test the message shown at:
   - Tools -> Cashup registers.
   - Point of sale -> Register details
   - Point of sale -> Library details
 - Perform the same tests when logged in as a user without permission to
   manage cash registers. The messages shown in the previous steps
   should omit the button linking to cash register management.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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