koha.git
3 years agoBug 26766: Correct selection of title during OPAC note confirmation
Owen Leonard [Wed, 21 Oct 2020 17:15:30 +0000 (17:15 +0000)]
Bug 26766: Correct selection of title during OPAC note confirmation

This patch modifies the JavaScript in opac-user.tt which executes when
the user submits a checkout note. The script tries to grab the
checkout's title from an earlier cell in the table row so that it can
display it in the confirmation message.

Before start ratings were enabled on this page, the title of each
checked-out item was the only HTML inside this table cell, so it was
necessary only to grab the HTML contents of the <td>. Now that star
ratings might be displayed as well we must make the selection more
specific.

To test, apply the patch and enable both the  OpacStarRatings and
AllowCheckoutNotes preferences.

 - Log in to the OPAC as a user with checkouts.
 - On the "Your summary" page, fill out and submit the "Note" field for
   one of your checkouts.
 - In the confirmation message, confirm that the correct title
   information is displayed as a link to the bibliographic detail page.

Signed-off-by: David Nind <david@davidnind.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 26762: Modify template logic in opac-reserves.tt to avoid error
Owen Leonard [Wed, 21 Oct 2020 11:57:26 +0000 (11:57 +0000)]
Bug 26762: Modify template logic in opac-reserves.tt to avoid error

This patch makes a change to the OPAC hold template to prevent certain
cases where the output is invalid.

To reproduce, perform a search in the OPAC which will return some titles
which can be placed on hold and some which cannot.

 - Select all results (some holdable, some not)
 - Click the "Place hold" link
 - On the "Confirm holds" page the layout will be broken after the
   first instance of the message "There are no items that can be placed
   on hold."

To test, apply the patch and repeat the process above. After the patch
has been applied the "confirm holds" page should look correct.
Validating the HTML source should return no errors.

Signed-off-by: David Nind <david@davidnind.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 26756: Fix quotes showing behind some system preference descriptions
Owen Leonard [Tue, 20 Oct 2020 16:04:11 +0000 (16:04 +0000)]
Bug 26756: Fix quotes showing behind some system preference descriptions

This patch adds matching quotes to two OPAC preference descriptions
which were missing them.

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

- Open the "OPAC" tab.
- Check the descriptions of these preferences:
  - AllowPatronToSetCheckoutsVisibilityForGuarantor
  - AllowPatronToSetFinesVisibilityForGuarantor

There should be no trailing quotation mark.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26619: Cart - The "Print" button is only translated when you are in "More details...
Owen Leonard [Tue, 20 Oct 2020 11:22:07 +0000 (11:22 +0000)]
Bug 26619: Cart - The "Print" button is only translated when you are in "More details" mode

This patch adds the "Print" string to datatables.js so that it can be
picked up for translation.

To test, apply the patch and add some items to the cart in the OPAC.

- Open the cart. You should see a button labeled "Print."
- The print button should work correctly.

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,
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/opac-tmpl/bootstrap/js/datatables.js for translation:

  msgid "Print"
  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 OPAC and
  repeat the test plan above. The translated strings should appear.

Signed-off-by: David Nind <david@davidnind.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 25353: Correct eslint errors in additems.js
Owen Leonard [Mon, 19 Oct 2020 18:32:18 +0000 (18:32 +0000)]
Bug 25353: Correct eslint errors in additems.js

This patch makes minor changes to additem.js to correct errors
highlighted by eslint:

- Consistent indentation
- Notation of global and exported variables and functions
- Consistent use of the "var" declaration for all new variables
- Remove variables from function calls which aren't used

To test, apply the patch and use your preferred eslint-enabled tool to
check for errors. There should be none.

If you don't have eslint integrated in your development environment you
could use the online ESLint demo at https://eslint.org/demo.

The demo isn't configured to assume a browser environment with jQuery
present, so you'll have to modify the top line after pasting the
contents of additem.js:

/* global $ alert window __ */

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26526: Relabel checkout note column in OPAC
Katrin Fischer [Sat, 17 Oct 2020 15:08:59 +0000 (15:08 +0000)]
Bug 26526: Relabel checkout note column in OPAC

When checkout notes are active, there is currently a new
column labelled 'Note' in the checkouts table in OPAC.
When a note is added, this is sent to the library. For
the user it's not clear from the label, that these notes
are not personal, but for reporting to the library.
The new label "Report a problem" aims to make this clearer.

To test:
- Turn on AllowCheckoutNotes system preference
- Check out some items to your account
- Go to the OPAC
- Look at the list of checkouts
- Apply patch
- Reload the page and check the checkouts table again
- Verify the heading has changed from "Notes" to "Report a problem"
- Hover over the heading with your cursor to see some more info

Bonus: Patch adds an id "checkout-notes" to the header cell, that
will make it easier for libraries to change text or style if needed.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18050: DBRev 20.06.00.055
Jonathan Druart [Sun, 25 Oct 2020 23:12:15 +0000 (23:12 +0000)]
Bug 18050: DBRev 20.06.00.055

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18050: (QA follow-up) Adjust conditions and make use of message text
Katrin Fischer [Mon, 5 Oct 2020 06:17:34 +0000 (06:17 +0000)]
Bug 18050: (QA follow-up) Adjust conditions and make use of message text

- When we run into invalid data, we use Augustin's suggested solution
  and copy the data into a separate table, setting the budget_period_id to
  NULL.
- We amend the output using the new $message.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18050: (follow-up) Force adding FK constraint
Agustin Moyano [Fri, 9 Oct 2020 18:14:26 +0000 (15:14 -0300)]
Bug 18050: (follow-up) Force adding FK constraint

When there are inconsistent budget_period_id in aqbudgets this patch
creates the table _bug_18050_aqbudgets with the original data, then sets
the column to null and warns the user that there is inconsistent data.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18050: Add relation alias to schema
Katrin Fischer [Sun, 13 Sep 2020 23:31:52 +0000 (23:31 +0000)]
Bug 18050: Add relation alias to schema

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18050: DBIC schema changes
Katrin Fischer [Sun, 13 Sep 2020 23:30:22 +0000 (23:30 +0000)]
Bug 18050: DBIC schema changes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18050: Add FK constraint on aqbudgets.budget_period_id
Katrin Fischer [Sun, 13 Sep 2020 22:42:27 +0000 (22:42 +0000)]
Bug 18050: Add FK constraint on aqbudgets.budget_period_id

This adds a FK constraint on aqbudgets.budget_period_id so that
a fund cannot be added with an invalid aqbudget.budget_period_id.

We should not have funds that belong to no budget. In case we have, the
update will be skipped and a note displayed.

Part1:
- Before applying the patch
- Make sure you have a budget with some funds linked to it
- You will have to change one of the funds to link to an invalid
  budget with SQL:
  UPDATE aqbudgets SET budget_period_id = 999 WHERE budget_id = max(budget_id);
- Apply patch
- Run updatedatabase - verify that you see the hint about 1 existing fund with invalid budget.
- Repair your fund with SQL
  UPDATE aqbudgets SET budget_period_id = ... WHERE budget_id = max(budget_id);
  (... needs to be your existing budget_period_id)
- Run updatedatabase again - verify it runs successfully now.
- If you try to change the budget_period_id to a non-existing now with SQL, you will
  get a database error. The new FK doesn't permit it.
Part 2:
- Start fresh with the web installer, verify there are no errors on
  creating the database tables

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24972: Remove de-DE installer data
Jonathan Druart [Mon, 12 Oct 2020 09:48:12 +0000 (11:48 +0200)]
Bug 24972: Remove de-DE installer data

With installer data in YAML format and it's translations,
there are no need for localized installer files.

This patch removes de-DE installer files.

1) Apply the patch
2) Translate to de-DE
   cd misc/translator
   ./translate update de-DE
   ./translate install de-DE
3) Do a clean install using de-DE,
   check no problems during install
4) Verify MARC21 frameworks, they must
   be translated

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26673: Remove #!/usr/bin/env perl from .pm modules too
David Cook [Wed, 14 Oct 2020 22:53:24 +0000 (22:53 +0000)]
Bug 26673: Remove #!/usr/bin/env perl from .pm modules too

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 26673: Remove shebangs from Perl modules
Jonathan Druart [Wed, 14 Oct 2020 09:24:33 +0000 (11:24 +0200)]
Bug 26673: Remove shebangs from Perl modules

It's not needed.

Signed-off-by: David Cook <dcook@prosentient.com.au>
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 26749: Correct dropdown markup in OPAC cart
Owen Leonard [Tue, 20 Oct 2020 11:58:49 +0000 (11:58 +0000)]
Bug 26749: Correct dropdown markup in OPAC cart

This patch corrects the markup of the "Download" dropdown menu in the
OPAc cart. It was not updated during the upgrade to Bootstrap 4.

To test, apply the patch and perform a catalog search in the OPAC.

- Add some titles to the cart.
- Open the cart and test the "Download" menu button.
- The menu should display correctly, and the menu items should work to
  download the correct files.

Signed-off-by: Lucas Gass <lucas@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 26719: Replace MSG_NO_RECORD_SELECTED with translatable string
Owen Leonard [Fri, 16 Oct 2020 18:08:44 +0000 (18:08 +0000)]
Bug 26719: Replace MSG_NO_RECORD_SELECTED with translatable string

This patch cleans up some loose ends left by Bug 25351, replacing
instances where the undefined variable MSG_NO_RECORD_SELECTED is used.

To test, apply the patch and perform a catalog search in the OPAC.

- On the search results page, without checking any checkboxes, use the
  "Select titles to..." menu to try to add to cart and add to a list. In
  each case you should get a "No item was selected" message.
- View a list which contains one or more titles. Click the "Remove
  from list" link. You should get a "No item was selected" link.

Other instances have been corrected even though they will only be
triggered if something has broken. For instance, toolbar items in the
cart window which are disabled shouldn't register the click that might
trigger the error. And selecting an item for an item-level hold
shouldn't ever give a warning because at least one radio button should
always be selected.

Signed-off-by: David Nind <david@davidnind.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 26678: Remove incorrect include file from table of transfers
Owen Leonard [Wed, 21 Oct 2020 03:34:17 +0000 (03:34 +0000)]
Bug 26678: Remove incorrect include file from table of transfers

This patch removes a mistakenly-added include file from the transfer
template which was resulting in a menu being shown in the wrong place.

To test, apply the patch and go to Circulation -> Transfer.

- Submit an item for transfer.
- In the table of transferred items you should see the title of the
  item linked to the bibliographic details page.

Signed-off-by: David Nind <david@davidnind.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 26810: Restore OpacCustomSearch news display
Nick Clemens [Sat, 24 Oct 2020 00:33:32 +0000 (00:33 +0000)]
Bug 26810: Restore OpacCustomSearch news display

To test:
1 - Define a new opac news entry for OpacCustomSearch
2 - Browse opac, notice the standard search bar is displayed
3 - Apply patch
4 - Note new search bar displays on refresh

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 26784: Silence warns about comparing undefined values for MARC modification templates
Nick Clemens [Thu, 22 Oct 2020 12:36:13 +0000 (12:36 +0000)]
Bug 26784: Silence warns about comparing undefined values for MARC modification templates

This patch simply checks if conditionals are defined before comparing

We don't need to check actions because you cannot save an action without an action :-)

To test:
1 - Define several actions for a MARC modification template
2 - Ensure you have actions with no conditionals
3 - Tail the intranet logs
4 - Browse to Tools->MARC modification templates
5 - Click 'Edit actions' for the template you setup above
6 - Note warns like:
    [2020/10/22 12:30:18] [WARN] Use of uninitialized value in string eq at /kohadevbox/koha/tools/marc_modification_templates.pl line 127.
7 - Apply patch
8 - Restart all the things
9 - Edit actions again and note no more warns

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26781: Check for subfield defined rather than truth
Nick Clemens [Thu, 22 Oct 2020 10:59:17 +0000 (10:59 +0000)]
Bug 26781: Check for subfield defined rather than truth

To recreate:
 1 - Have a record with 100$0 defined
 2 - Define a Marc Modification template:
    Delete field 100$0
 3 - Perform Batch record modification, enter the record above in the list of records
 4 - Preview the MARC
 5 - Note the entire 100 field has been deleted, don't modify the record
 6 - Apply patch
 7 - Restart all the things
 8 - Test the modification again
 9 - This time the preview confirms only the subfield 0 deleted
10 - Modify the record
11 - Confirm the record is correctly updated

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch: Fix typo ony vs only

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26747: Show 'Always available' if title always available in overdrive
Nick Clemens [Tue, 20 Oct 2020 10:23:25 +0000 (10:23 +0000)]
Bug 26747: Show 'Always available' if title always available in overdrive

To test:
1 - Have a developer account for overdrive, or library credentials
    https://developer.overdrive.com/
2 - Enter info into 'Overdrive' sysprefs and enable overdrive
3 - Search for 'house' in the opac
4 - Click the overdrive link
5 - Note some titles in the collection show 999999 copies available
6 - Apply patch
7 - Note they now say 'Always available'

Signed-off-by: Lucas Gass <lucas@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 25596: DBRev 20.06.00.054
Jonathan Druart [Sun, 25 Oct 2020 23:12:15 +0000 (23:12 +0000)]
Bug 25596: DBRev 20.06.00.054

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25596: Identify overpayment refunds for translation
Martin Renvoize [Wed, 9 Sep 2020 13:34:34 +0000 (14:34 +0100)]
Bug 25596: Identify overpayment refunds for translation

This patch ensures we can uniquely identify automatic overpayment refund
credits from the accountlines by introducing a new account credit type
and adding appropriate translations for the new code.

Test plan
1/ You'll need an overpayment refund to start...
1a/ Issue yourself and item and set the date due early enough
to create an overdue fine for at least 2 days worth of overdue fines
1b/ Run the fines.pl script to add the fines
1c/ As a patron, pay off the accruing fine
1d/ Return the item ensuring you backdate it at least a day
1e/ Check that there is an 'Overpayment refund' credit on the patrons
account.
2/ Check that the overpayment string is translatable (i.e. it appears in
the accounts include file)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26627: Print and confirming a hold can cause an infinite loop
Kyle M Hall [Wed, 7 Oct 2020 15:01:02 +0000 (11:01 -0400)]
Bug 26627: Print and confirming a hold can cause an infinite loop

Test plan:
1) Place a hold for pickup at library A
2) Confirm the hold and print slip
3) Checkin the item again
4) Confirm the hold and print slip
5) The modal returns, do it again
6) Apply this patch
7) Reload the page
8) Repeat steps 1-3
9) No loop!

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26601: Add utf8 encoding to text output of overdue_notices.pl
Mark Hofstetter [Mon, 19 Oct 2020 17:28:19 +0000 (17:28 +0000)]
Bug 26601: Add utf8 encoding to text output of overdue_notices.pl

This patch sets the UTF8 encoding for output of overdue_notices.pl when
outputting to txt.

To test:
0/ Check out an item with due date yesterday (use specify due date)
1/ Create ODUE text with utf8 encoded characters, chinese characters, umlauts etc
   <url>/cgi-bin/koha/tools/letter.pl?op=add_form&module=circulation&code=ODUE
2/ Run
   perl overdue_notices.pl -text ./
3/ Verify encoding in the generated text file is incorrect
4/ Apply patch and repeat 2/
3/ Confirm text now inludes properly encoded characters

Sponsored-by: Styrian State Library
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
With German umlauts on my system the editor still showed the
characters correctly (probably guessing the right encoding).
Using Chinese made the problem visible.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26686: Fix sorting of "updated on" and "time created" on notices tab
Katrin Fischer [Tue, 20 Oct 2020 16:55:37 +0000 (16:55 +0000)]
Bug 26686: Fix sorting of "updated on" and "time created" on notices tab

In the patron's account in the staff interface there is a tab
'Notices' that shows all notices sent out to a patron. The
updated on column would not sort at all, but there was also some
markup missing for the time created column.

To test:
- Make sure you have a patron account with some notices, ideally
  with different times and dates
- Verify that the updated on column doesn't sort at all
- Apply patch
- Verify both date columns now sort correctly for different
  DateFormat settings

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26666: (QA follow-up) Add 'USE raw' in template
Julian Maurice [Fri, 16 Oct 2020 07:56:07 +0000 (09:56 +0200)]
Bug 26666: (QA follow-up) Add 'USE raw' in template

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26666: Fix line breaks in addresses displayed with AddressFormat French or German
Katrin Fischer [Fri, 16 Oct 2020 00:00:16 +0000 (02:00 +0200)]
Bug 26666: Fix line breaks in addresses displayed with AddressFormat French or German

When Addressformat is set to French or German the addresses on the Details
tab will display <br /> in plain text. This is because a TT variable is used
for adding line breaks that is either set to <br /> or "". Then this variable is
escaped with the html filter... so we see the HTML tag uninterpreted.
Switching to $raw for this specific case.

To test:
- Go to any patron account,
- Fill in the various address fields
- Switch the AddressFormat system preference to different settings
- Verify the false display for French and German on the Details tab and
  in the brief info on the left side in the patron account
- Apply patch
- Repeat testing
- All AddressFormats should now display correctly

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 6819: Hide individual cancel order links when order line has been received
Katrin Fischer [Sun, 18 Oct 2020 22:53:53 +0000 (22:53 +0000)]
Bug 6819: Hide individual cancel order links when order line has been received

This is to prevent mistakes - a received order should not be
cancelled, but 'undo receive' needs to be done first for things
to turn out correctly.

To test:
- Create a basket with at least 2 orders
- Close basket
- Receive one of your orders at least
- Go back to the basket
- Reopen basket
- The cancel links should only show on the "not received" orders

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26445: Fix "back to result" link of the search result browser
Jonathan Druart [Thu, 15 Oct 2020 08:47:55 +0000 (10:47 +0200)]
Bug 26445: Fix "back to result" link of the search result browser

Not sure what was the expected behaviour, I am suggesting the following
one:
If you are browsing and you click "back to result", you will be
redirected to the page where the record appear on the search result
list.

Say you search for "something" that returns 10 page (20 results per
page)
Click on first result first page
Click back to result
=> You see the first page with the first result at the top

Click on second page, 3rd result
Click back to result
=> You see the second page with the biblio you clicked at the 3rd
position

Click on second page, 3rd result
Click next/previous
Click back to result
=> You see the page where you last result were.

I think the existing expected behaviour was to have the result you
clicked at the first position of the result page, but I am not sure it
really makes sense.

Hope this makes sense however!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21811: Add JS confirmation when receiving - at least 1 item to receive
Jonathan Druart [Fri, 31 Jul 2020 08:21:27 +0000 (10:21 +0200)]
Bug 21811: Add JS confirmation when receiving - at least 1 item to receive

When receiving, the "receive items" form should not be submitted if no
items are going to be received

Test plan:
Create an order, close the basket, receive some items
On the "receive items" form, do not select item (if items are created
when placing the order) and submit the form
=> You must get a JS alert that prevent the form to be submitted
Select at least one item, submit again
=> Now it's submitted

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26613: Fix it-IT unimarc_framework.sql installer file
John Fawcett [Mon, 12 Oct 2020 09:18:30 +0000 (11:18 +0200)]
Bug 26613: Fix it-IT unimarc_framework.sql installer file

This is really an installation issue, though at the
time of installation it did not result in any error.

During cataloguing in the items menu the "Type of item or material"
is not constrained by the itemtypes authorised_values (as it is for 942c records).

I have added the itemtypes to the installer sql in unimarc_framework.sql
as well as adding the description of this field for OPAC, which had been left empty.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26612: Error during web install for it-IT translation
John Fawcett [Mon, 12 Oct 2020 11:06:40 +0000 (13:06 +0200)]
Bug 26612: Error during web install for it-IT translation

Patch changes some of the values in the sql statement that inserts 307a
unimarc row into the marc_subfield_structure which created an SQL error
on installation.

The fields changed are:
- isurl now 0 instead of NULL,
- hidden now -5 instead of NULL,
- seealso empty string instead of NULL,
- link empty string instead of NULL.

These field values are now similar to the ones inserted for 306a or 308a.
The value that caused the SQL error was using NULL for hidden (due to
the NOT NULL constraint in the table definition).

I have tested the install with this change and found no issues.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26569: DBRev 20.06.00.053
Jonathan Druart [Sun, 25 Oct 2020 23:12:14 +0000 (23:12 +0000)]
Bug 26569: DBRev 20.06.00.053

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26569: Use gender neutral pronouns in system prefernece explanations
Andrew Fuerste-Henry [Wed, 30 Sep 2020 13:14:12 +0000 (13:14 +0000)]
Bug 26569: Use gender neutral pronouns in system prefernece explanations

To test:
1 - perform query "select variable,explanation from systempreferences where explanation like '% his %';"
2 - find 6 sysprefs with gendered pronouns used in explanations
3 - apply patch, reset_all
4 - repeat query
5 - no more gendered pronouns!

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 8437: Exclude export.pl from plack
Nick Clemens [Thu, 3 Sep 2020 16:23:04 +0000 (16:23 +0000)]
Bug 8437: Exclude export.pl from plack

When attempting to download large files from Koha plack can timeout

Excluding the script from plack is a simple fix until we have a more permanent fix for this
issue.

To test:
1 - Try to export your entire DB from Tools->Export
2 - If big enough, it fails
3 - Apply patch, copy changes to /etc/koha/apache-shared-intranet-plack.conf
4 - Restart all the things
5 - Repeat export, it succeeds

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26752: Convert OPAC list download modal to dropdown
Owen Leonard [Tue, 20 Oct 2020 13:40:04 +0000 (13:40 +0000)]
Bug 26752: Convert OPAC list download modal to dropdown

This patch modifies the OPAC list page so that download options are
shown in a dropdown menu instead of a modal dialog. This solves a bug
introduced by the Bootstrap 4 upgrade and makes it consistent with the
cart interface.

To test, apply the patch and view the contents of a list in the OPAC
which has multiple items on it.

 - In the toolbar at the top of the list contents table the "Download"
   button should now be a dropdown menu.
 - Selecting any of the download options should trigger a download
   prompt.
 - Test with and without some CSV profiles which have been
   configured for use in the OPAC

Signed-off-by: Julian Maurice <julian.maurice@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 23432: (QA follow-up) Add a unit test
Nick Clemens [Sat, 24 Oct 2020 23:53:21 +0000 (23:53 +0000)]
Bug 23432: (QA follow-up) Add a unit test

prove -v t/db_dependent/StockRotationItems.t

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23432: Replace 'die' with 'warn'
Martin Renvoize [Wed, 23 Sep 2020 11:28:22 +0000 (12:28 +0100)]
Bug 23432: Replace 'die' with 'warn'

This patch simply replaced the die statement with a warn such that the
cron script may continue to rotate other items even if this item cannot
be properly rotated due to corrupt data.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26232: Empty smart rule fine grace period
Didier Gautheron [Tue, 18 Aug 2020 05:40:50 +0000 (07:40 +0200)]
Bug 26232: Empty smart rule fine grace period

Staff can create smart rules with empty (undefined) fine grace period.
In Overdues.pm undefined firstremind means 0, do the same in Circulation.pm.

To test:
1. Apply these patches
2. Run:
   kshell
   prove t/db_dependent/Circulation.t

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26232: Test for empty smart rule fine grace period
Didier Gautheron [Tue, 18 Aug 2020 05:39:53 +0000 (07:39 +0200)]
Bug 26232: Test for empty smart rule fine grace period

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26750: Deleted items not indexed
Björn Nylén [Tue, 20 Oct 2020 12:11:16 +0000 (14:11 +0200)]
Bug 26750: Deleted items not indexed

After deleting an item it is still searchable in the index. Similar to bug 26507 where record is reindexed before the database is changed.

To test:
1. Delete an item
2. Search the barcode in the main search box. You'll find the original record but wiht hte deleted item missing.
3. Apply patch.
4. Repeat steps 1-2 (with another item). No record should be found.

Note to test you have to have the indexer running, not the cron job, and it
needs to be running fast so that the index is updated before the delete
takes place

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26751: Fix fatal exception if only one repo defined
Tomas Cohen Arazi [Tue, 20 Oct 2020 17:40:50 +0000 (14:40 -0300)]
Bug 26751: Fix fatal exception if only one repo defined

This patch fixes this nasty problem with how XML is parsed: if more than
one entry is found, repo => [] is generated. If only one, repo => {}.

To test:
1. Have more than one entries in the plugins_repo entry:

<plugin_repos>
    <repo>
        <name>ByWater Solutions</name>
        <org_name>bywatersolutions</org_name>
        <service>github</service>
    </repo>
    <repo>
        <name>Theke Solutions</name>
        <org_name>thekesolutions</org_name>
        <service>github</service>
    </repo>
    <repo>
        <name>PTFS Europe</name>
        <org_name>ptfs-europe</org_name>
        <service>github</service>
    </repo>
 </plugin_repos>

2. Search for plugins
=> SUCCESS: Searching works!
3. Leave only one entry
4. Restart all to refresh things
5. Try searching for plugins
=> FAIL: Fatal error
6. Apply this patch
7. Repeat 5
=> SUCCESS: It doesn't explode anymore!
8. 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 26735: Overdrive login modal broken in the OPAC
Owen Leonard [Mon, 19 Oct 2020 10:57:25 +0000 (10:57 +0000)]
Bug 26735: Overdrive login modal broken in the OPAC

This patch makes corrections to the markup for the Overdrive login modal
in the OPAC. It hadn't been updated during the upgrade to Bootstrap 4.

To test, apply the patch and enable the system
preferences required for Overdrive integration.

- Log in to the OPAC.
- On the "Your summary" page open the "OverDrive Account" tab.
- Click the "Log in to your OverDrive account" link.
- The modal should appear and look correct.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26581: Only reindex records once per checkin
Martin Renvoize [Fri, 16 Oct 2020 14:04:31 +0000 (15:04 +0100)]
Bug 26581: Only reindex records once per checkin

This patch simply passes skip_record_index calls to Koha:Item:store
for all the changes done in AddReturn.

Testing is really verifiying that items are still correctly indexed at the end

For both search engines
To test:
1 - Find or create a record with multipel items
2 - Populate both:
     UpdateItemLocationOnCheckin
     UpdateNotForLoanStatusOnCheckin
3 - Confirm that checking in an item correctly updates the item status in search results
4 - Test with items issued, and items not issued
5 - Test when generating a transfer (checkin at different branch)
6 - Test when item was marked lost
7 - Test when filling transfer

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26581: Unit tests
Nick Clemens [Wed, 30 Sep 2020 16:51:28 +0000 (16:51 +0000)]
Bug 26581: Unit tests

These tests cover the changes to ensure the AddReturn calls index_records once
per call and that other calls pass the skip_record_index parameter correctly

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25549: Add error reporting to plugins-home
Martin Renvoize [Wed, 7 Oct 2020 15:37:06 +0000 (16:37 +0100)]
Bug 25549: Add error reporting to plugins-home

This patch adds handling for the newly introduced 'errors' option in
GetPlugins and reports erroroneos plugins to the user.

To test:
1 - Enable plugins in the koha-conf
2 - Install the kitchen sink plugin
3 - Your staff client should be orange now :-)
4 - The plugin should display as installed in the table at
    tools/plugins.
5 - edit the plugin module
    /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm
6 - Add a line to break compilation, like:
    this won't compile
7 - Restart all
8 - Your Koha is not broken, but is no longer orange (The plugin is not
    loading).
9 - The plugin should display as unable to load in the table at
    tools/plugins.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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 25549: Remove plugin methods for broken plugins
Nick Clemens [Wed, 20 May 2020 11:12:12 +0000 (11:12 +0000)]
Bug 25549: Remove plugin methods for broken plugins

To test:
 1 - Enable plugins in the koha-conf
 2 - Install the kitchen sink plugin
 3 - Your staff client should be orange now :-)
 4 - edit the plugin module
     /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm
 5 - Add a line to break compilation, like:
     this won't compile
 6 - Restart all
 7 - Your koha is now broken
 8 - kshell
 9 - perl misc/devel/install_plugins.pl
10 - Restart all
11 - Koha remains broken
12 - Apply patch
13 - kshell
14 - perl misc/devel/install_plugins.pl
15 - Koha now works!
16 - Koha is not orange because the plugin methods are removed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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 23828: Elasticsearch - Preserve record order when combining subfield in mappings
Nick Clemens [Wed, 16 Sep 2020 11:31:54 +0000 (11:31 +0000)]
Bug 23828: Elasticsearch - Preserve record order when combining subfield in mappings

Currently if you combine subfields in the marc mappings the subfields are indexed in the order
listed in the mapping.

i.e. 650(avxyz) in mapping

and in record:
650 $aHeading $zGeosubdiv $vFormsubdiv

is indexed as:
Heading Formsubdiv Geosubdiv

We should preserve the order and index as:
Heading Geosubdiv Formsubdiv

We can use built in function in Marc::Field to achieve this

To test:
 1 - It is easy to find examples of this using authorities
 2 - Find or create a record with subfields order azv
     e.g. 150$aActresses$zUnited states$vBiography
 3 - Add or have a second authority
     e.g. 150$aActresses$vPortraits
 4 - Set an authorities mapping for 'Heading' to 150(abgvxyz)
     find at:
     Administration->Search engine configuration (Elasticsearch)->Authorities tab
 5 - Index the records in Elasticsearch
     perl misc/search_tools/rebuild_elaticsearch.pl -a -ai 1691 -ai 1692
 6 - View the first record in the ES index
     curl es:9200/koha_kohadev_authorities/data/1692?pretty
 7 - Note 'Heading' field is ordered as in the mapping
 8 - Search authorities for 'contains' "act"
 9 - Note the records sort incorrectly
10 - Apply patches
11 - perl misc/search_tools/rebuild_elaticsearch.pl -a -ai 1692
12 - curl es:9200/koha_kohadev_authorities/data/1692?pretty
13 - Note the order is now preserved
14 - Search authorities for 'contains' "act"
15 - Note the records sort correctly

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch: Fix
   FAIL   spelling
     combind ==> combined

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23828: Unit tests
Nick Clemens [Wed, 16 Sep 2020 11:31:48 +0000 (11:31 +0000)]
Bug 23828: Unit tests

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Bug 23828: (follow-up) fix unit test merge

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 23828: (QA follow-up) Fix number of tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26496: Add op field to Budget Planning
David Cook [Mon, 21 Sep 2020 02:02:27 +0000 (02:02 +0000)]
Bug 26496: Add op field to Budget Planning

Without this patch, it's impossible to save a budget plan.

With this patch, it is possible to save a budget plan.

Test:
1. Apply patch
2. Modify a budget (e.g. http://localhost:8081/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form&budget_period_id=1)
3. Unlock the budget if necessary by unticking "Lock budget" and click "Save"
4. Go to a budget (e.g. http://localhost:8081/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=1)
5. Click "Planning" and "Plan by libraries"
6. Click "Auto-fill row" on the first line
7. Click "Save"
8. Note that results are saved and shown on the newly loaded page

To verify this patch is necessary, do the test plan without applying the patch.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23376: If a single item is returned we cannot count
Nick Clemens [Thu, 15 Oct 2020 14:45:00 +0000 (14:45 +0000)]
Bug 23376: If a single item is returned we cannot count

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26515: Don't need to call safe_to_delete
Jonathan Druart [Thu, 15 Oct 2020 13:17:46 +0000 (15:17 +0200)]
Bug 26515: Don't need to call safe_to_delete

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26580: Remove unused C4::Acquisition::DelBasket function
Tomas Cohen Arazi [Wed, 30 Sep 2020 15:03:41 +0000 (12:03 -0300)]
Bug 26580: Remove unused C4::Acquisition::DelBasket function

Bug 26577 removed the only use of it.

To test:
1. Apply this patch
2. Run:
   $ git grep DelBasket
=> SUCCESS: Only finds references to DelBasketGroup
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 26579: Remove unused C4::Acquisition::DelOrder function
Tomas Cohen Arazi [Wed, 30 Sep 2020 14:47:03 +0000 (11:47 -0300)]
Bug 26579: Remove unused C4::Acquisition::DelOrder function

This patch removes an unused function, its tests, and adjusts other test
files that relied on it by replacing it with $order->cancel calls.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Acquisition.t \
           t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t \
           t/db_dependent/Acquisition/close_reopen_basket.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.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 26577: Make basket.pl and cancelorder.pl use ->cancel
Tomas Cohen Arazi [Wed, 30 Sep 2020 14:14:37 +0000 (11:14 -0300)]
Bug 26577: Make basket.pl and cancelorder.pl use ->cancel

This patch makes the mentioned controller scripts use the new
$order->cancel method instead of DelOrder.

To test:
1. Apply this patches
2. Have a basket with some orders
3. Play with cancelling orders and removing baskets
=> SUCCESS: No behaviour change!
=> SUCCESS: No errors!
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26515: (QA follow-up) Preserve original behaviour
Tomas Cohen Arazi [Thu, 15 Oct 2020 12:37:56 +0000 (09:37 -0300)]
Bug 26515: (QA follow-up) Preserve original behaviour

This patch removes the use of $self->items->safe_delete, as we don't
want to change the current behaviour (i.e. delete what can be deleted)
As safe_delete would rollback entirely, there was a behaviour change.

Now items are deleted in a loop that catches any problem and reports it
using the new ->add_message mechanism. The $item object is added to the
message payload so it doesn't need to be queried by the caller for
providing UI feedback.

Tests are augmented accordingly,

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Acquisition/Order.t
=> SUCCESS: Tests pass!
3. 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 26515: Better feedback on errors
Tomas Cohen Arazi [Fri, 9 Oct 2020 20:01:29 +0000 (17:01 -0300)]
Bug 26515: Better feedback on errors

This patch makes the possible causes of biblio removal failure to be
specified on the passed error message. This way the UI could render
better reports on the situation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26515: Remove branchcode from mock_userenv
Jonathan Druart [Thu, 8 Oct 2020 10:16:49 +0000 (12:16 +0200)]
Bug 26515: Remove branchcode from mock_userenv

It's the default behaviour of mock_userenv

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26515: (follow-up) Do not count self when checking orders
Tomas Cohen Arazi [Wed, 30 Sep 2020 14:06:34 +0000 (11:06 -0300)]
Bug 26515: (follow-up) Do not count self when checking orders

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26515: Add Koha::Acquisition::Order->cancel
Tomas Cohen Arazi [Wed, 23 Sep 2020 14:36:21 +0000 (11:36 -0300)]
Bug 26515: Add Koha::Acquisition::Order->cancel

This patch introduces an OO replacement for DelOrder. It does the same
thing. It doesn't die when trying to delete items or biblio. It sets an
error message on the order object so the caller knows what happened.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Acquisition/Order.t
=> SUCCESS: Tests pass!
3. Read the tests carefully to understand how they cover all use cases.
4- Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26515: Unit tests
Tomas Cohen Arazi [Wed, 23 Sep 2020 14:35:53 +0000 (11:35 -0300)]
Bug 26515: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26555: (QA follow-up) Add a 'payload' attribute for carrying useful things
Tomas Cohen Arazi [Thu, 15 Oct 2020 12:35:43 +0000 (09:35 -0300)]
Bug 26555: (QA follow-up) Add a 'payload' attribute for carrying useful things

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26555: Make sure _messages is always initialized
Tomas Cohen Arazi [Wed, 30 Sep 2020 12:42:18 +0000 (09:42 -0300)]
Bug 26555: Make sure _messages is always initialized

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26555: Add ->messages and ->add_message to Koha::Object
Tomas Cohen Arazi [Mon, 28 Sep 2020 13:49:24 +0000 (10:49 -0300)]
Bug 26555: Add ->messages and ->add_message to Koha::Object

This patch adds a way to make Koha::Object-derived classes to carry
messages around. This targets non-fatal errors, or around action flags
for the caller, to avoid complex exception handling on the controllers when
it is not expected to be fatal.

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26555: Add Koha::Object::Message
Tomas Cohen Arazi [Mon, 28 Sep 2020 13:23:50 +0000 (10:23 -0300)]
Bug 26555: Add Koha::Object::Message

This patch introduces a tiny class for encapsulating execution messages in
Koha::Object derived classes.

To test:
1. Apply this patch
2. Run;
   $ kshell
  k$ prove t/Koha/Object/Message.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25460: Remove swp file
Jonathan Druart [Thu, 15 Oct 2020 12:00:20 +0000 (14:00 +0200)]
Bug 25460: Remove swp file

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25898: Fix new occurrences
Jonathan Druart [Thu, 15 Oct 2020 11:56:41 +0000 (13:56 +0200)]
Bug 25898: Fix new occurrences

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26534: Compiled CSS
Jonathan Druart [Thu, 15 Oct 2020 10:53:06 +0000 (12:53 +0200)]
Bug 26534: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18170: Use GetDescriptionByKohaField
Martin Renvoize [Thu, 1 Oct 2020 13:14:13 +0000 (14:14 +0100)]
Bug 18170: Use GetDescriptionByKohaField

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18170: Show damaged status in table of checkins
Katrin Fischer [Thu, 24 Sep 2020 21:29:10 +0000 (21:29 +0000)]
Bug 18170: Show damaged status in table of checkins

This copies the display of the damaged status from the holds and
checkouts pages in staff.

To test:
- Apply patch
- Check out some items, some damaged, others not
- Verify the damaged status is displayed below the due date
  in the table of checkouts
- Check the items in from the checkin page
- Verify the damaged status displays in the table of checkins

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.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 25460: DBRev 20.06.00.052
Jonathan Druart [Thu, 15 Oct 2020 10:53:25 +0000 (10:53 +0000)]
Bug 25460: DBRev 20.06.00.052

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25460: (QA follow-up) Remove stray quote from system preference description
Katrin Fischer [Mon, 5 Oct 2020 00:38:47 +0000 (00:38 +0000)]
Bug 25460: (QA follow-up) Remove stray quote from system preference description

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25460: (QA follow-up) Readd ending punctuation to sys pref description
Katrin Fischer [Mon, 5 Oct 2020 00:28:57 +0000 (00:28 +0000)]
Bug 25460: (QA follow-up) Readd ending punctuation to sys pref description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25460: Add unit test for change to C4::OAI::Sets->UpdateOAISetsBiblio()
Alex Buckley [Thu, 24 Sep 2020 10:54:17 +0000 (10:54 +0000)]
Bug 25460: Add unit test for change to C4::OAI::Sets->UpdateOAISetsBiblio()

Test plan:

1. Run unit test:
sudo koha-shell <instancename>
prove t/db_dependent/OAI/Sets.t

2. All tests should pass

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch: Put tests inside a subtest, and perltidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25460: Update OAI sets when adding/editing/deleting item records
Alex Buckley [Tue, 12 May 2020 02:57:20 +0000 (02:57 +0000)]
Bug 25460: Update OAI sets when adding/editing/deleting item records

Also adds syspref to optionally choose to embed item information in record when adding/editing bibliographic and item records.

Test plan:
1. Enable OAI-PMH and OAI-PMH:AutoUpdateSets sysprefs
2. Create a biblio record with 1 item with CCODE of NFIC
3. In Administration > OAI Sets configuration create a set and define
the mapping:
Field: 952, Subfield: 8, Operator: is equal to,  Value: FIC

4. Run the build_oai_sets.pl script:
 cd misc/migration_tools
 sudo koha-shell <instancename>
 ./build_oai_sets.pl -i

5. Check what items are in the OAI set:
sudo koha-mysql <instancename>
select * from oai_sets_biblios;

6. Observe your bib from step 2 is not in the set
7. [ITEM EDIT] Edit the item to have CCODE of FIC repeat step 5 and observe biblio is still not in OAI set
8. [ITEM ADD] Add a new item with CCODE of FIC and repeat step 5 and observe biblio
still not in OAI set
9. [ITEM DELETE] Delete one of your 2 items and repeat step 5 and observe biblio still
not in OAI set

10. Apply patch, update database and restart plack (instruction below on
the latter 2 actions):

cd installer/data/mysql
sudo koha-shell <instancename>
./updatedatabase.pl
sudo koha-plack --restart <instancename>

11. Enable new syspref OAI-PMH:AutoUpdateSetsEmbedItemData
12. [ITEM ADD] Repeat step 8 and observe biblio is now in the OAI set
13. [ITEM EDIT] Edit both items to have a CCODE of NFIC and repeat step 5 and
observe bib now not in set
14. [ITEM EDIT] Edit one of the items to have CCODE of FIC and repeat step 5
and observe bib now in set
15. [ITEM DELETE] Delete all items off bib and repeat step 5 and observe bib
no longer in set

Sponsored-By: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.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 25898: (follow-up) POD
Tomas Cohen Arazi [Wed, 7 Oct 2020 17:33:19 +0000 (14:33 -0300)]
Bug 25898: (follow-up) POD

Our docs shouldn't suggest indirect object notation is accepted or
encouraged.

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 25898: Prohibit indirect object notation
Julian Maurice [Mon, 29 Jun 2020 17:07:54 +0000 (21:07 +0400)]
Bug 25898: Prohibit indirect object notation

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 26534: Use IF ELSE directly on h5 opening tag
Fridolin Somers [Wed, 30 Sep 2020 09:00:58 +0000 (11:00 +0200)]
Bug 26534: Use IF ELSE directly on h5 opening tag

Signed-off-by: David Nind <david@davidnind.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 26534: Replace 'grade' by 'is-patron' and 'patron-type'
Fridolin Somers [Wed, 30 Sep 2020 08:07:26 +0000 (10:07 +0200)]
Bug 26534: Replace 'grade' by 'is-patron' and 'patron-type'

Signed-off-by: David Nind <david@davidnind.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 26534: (follow-up) Only center when using patronimages
Martin Renvoize [Fri, 25 Sep 2020 11:48:30 +0000 (12:48 +0100)]
Bug 26534: (follow-up) Only center when using patronimages

I felt the change to always center the user title worked well when
patronimages was enabled, but not so well when it was not (it looked
strange without a background for non-staff users).

Signed-off-by: David Nind <david@davidnind.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 26534: (QA follow-up) Fix CSS declaration
Martin Renvoize [Fri, 25 Sep 2020 11:31:57 +0000 (12:31 +0100)]
Bug 26534: (QA follow-up) Fix CSS declaration

Signed-off-by: David Nind <david@davidnind.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 26534: Add Font Awesome icon only for staff patrons
Fridolin Somers [Fri, 25 Sep 2020 07:43:54 +0000 (09:43 +0200)]
Bug 26534: Add Font Awesome icon only for staff patrons

In patron pages it would help to see an icon indicating that this is a staff patron (having permission to access staff interface).
This may avoid wrong patron deletion or permission mistakes.
I propose the shield Font Awesome icon and a grey background

Patch also shows patron name and cardnumber aligned center instead of right.
Patch adds to 'patroninfo' div a class 'staffgrade' or 'normalgrade' to
allow more styling depending on patron beeing staff or not.

Test plan:
Compare display between a patron having staff interface access and one without permissions.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.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 26621: Adjust docs/contributors.yaml accordingly
Jonathan Druart [Wed, 7 Oct 2020 12:20:32 +0000 (14:20 +0200)]
Bug 26621: Adjust docs/contributors.yaml accordingly

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 26621: Adjust .mailmap to reduce the number of invalid authors
Jonathan Druart [Tue, 6 Oct 2020 15:56:16 +0000 (17:56 +0200)]
Bug 26621: Adjust .mailmap to reduce the number of invalid authors

This file is a nightmare, really. We should simplify it and order it correctly.
Letting it here for now, I'd like to run the gitstats command on it to double check the output.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD: Amended patch: remove dup occurrences for Brendan

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26643: (QA follow-up) Fix typo in message
Katrin Fischer [Sun, 4 Oct 2020 16:54:37 +0000 (16:54 +0000)]
Bug 26643: (QA follow-up) Fix typo in message

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26643: Notify librarian of completed transfers
Martin Renvoize [Fri, 9 Oct 2020 12:08:45 +0000 (13:08 +0100)]
Bug 26643: Notify librarian of completed transfers

It came to light that it's not clear to all users that a checkin results
in the completion of a transfer if one exists for the item being checked
in.  This patch adds such a notification to the error messages loop to
highlight that the item has been recieved from it's sending brnach.

To test
1/ Setup a transfer from branch A to branch B
2/ Check the item in at branch B
3/ Note that a new message appears in the 'Check in message' alert box
saying "Item recieved from branch A"
4/ Signoff

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 26617: Update INSTALL file to include koha-testing-docker and Gitlab links
David Cook [Tue, 6 Oct 2020 06:43:11 +0000 (06:43 +0000)]
Bug 26617: Update INSTALL file to include koha-testing-docker and Gitlab links

Test plan:
1. View the INSTALL file in a text editor
2. The INSTALL file should reference koha-testing-docker and KohaDevBox
using Gitlab links

Signed-off-by: David Nind <david@davidnind.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 26536: Assignment fix
Martin Renvoize [Fri, 2 Oct 2020 15:17:39 +0000 (16:17 +0100)]
Bug 26536: Assignment fix

Whilst working on this bug I found a weird inconsistent variable assignment line

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD: Amended commit message: fix bug number
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26536: WRITEOFF not writeoff
Martin Renvoize [Fri, 2 Oct 2020 15:09:54 +0000 (16:09 +0100)]
Bug 26536: WRITEOFF not writeoff

There is inconsistency in variable case between the controller script
and the template. This patch corrects those inconsistencies.

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 26536: Fix incorrectly scoped variable
Martin Renvoize [Mon, 5 Oct 2020 08:08:24 +0000 (09:08 +0100)]
Bug 26536: Fix incorrectly scoped variable

During work on bug 26076 a variable scope mistake was made when
reverting the logic to use distinct queries for selected accountlines.

This patch restores the script scope of the varaible by removing the
superflous 'my' declaration.

Test plan
1/ Add a set of manual invoices
2/ Select a subset of those manual invoices to 'Writeoff selected'
3/ Confirm that only those selected invoices have been written off.

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 26595: Remove password from the smtp_server API object
Tomas Cohen Arazi [Wed, 14 Oct 2020 13:04:24 +0000 (10:04 -0300)]
Bug 26595: Remove password from the smtp_server API object

This patch makes the SMTP server objects do not include the password for
API representation. If we need the password itself, we can add a route
to retrieve it with specific permissions.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26595: Embed the whole smtp_server object
Jonathan Druart [Wed, 14 Oct 2020 12:12:44 +0000 (14:12 +0200)]
Bug 26595: Embed the whole smtp_server object

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26595: Add the option to hide the SMTP server column
Tomas Cohen Arazi [Thu, 1 Oct 2020 15:13:48 +0000 (12:13 -0300)]
Bug 26595: Add the option to hide the SMTP server column

This patch adds

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 26595: Add SMTP server column to libraries table
Tomas Cohen Arazi [Thu, 1 Oct 2020 15:10:39 +0000 (12:10 -0300)]
Bug 26595: Add SMTP server column to libraries table

This patch makes the libraries datatable render the assigned SMTP server
on each row. 'Default' will be rendered when the system default is
detected. A link to the SMTP server config will be rendered when a real
SMTP server is assigned.

To test:
1. Apply this patches, reload al the things
2. Visit the libraries table
=> SUCCESS: There's an SMTP server column displaying the right thing
3. Assign an SMTP server to a library
=> SUCCESS: The table displays the server name as a link
=> SUCCESS: The link correctly points to the SMTP server config page
4. Sign off

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 26595: Add smtp_server_info embed option to /libraries
Tomas Cohen Arazi [Thu, 1 Oct 2020 15:07:38 +0000 (12:07 -0300)]
Bug 26595: Add smtp_server_info embed option to /libraries

This patch simply adds the option to embed the return value from
Koha::Library->smtp_server_info on the libraries GET actions.

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 26595: Add Koha::Library->smtp_server_info
Tomas Cohen Arazi [Thu, 1 Oct 2020 15:06:13 +0000 (12:06 -0300)]
Bug 26595: Add Koha::Library->smtp_server_info

This patch adds a method for retrieving brief information about the
linked (or not) SMTP server for embedding on API requests.

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

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 17084: Automatic debian/control updates (master)
Mason James [Wed, 14 Oct 2020 05:51:29 +0000 (18:51 +1300)]
Bug 17084: Automatic debian/control updates (master)

built from c12ede4 on debian 9

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23895: Fix check_sysprefs.t
Jonathan Druart [Wed, 14 Oct 2020 13:52:29 +0000 (15:52 +0200)]
Bug 23895: Fix check_sysprefs.t

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