]> git.koha-community.org Git - koha.git/log
koha.git
3 years agoBug 23916: (follow-up) Fix unit test
Andrew Isherwood [Fri, 23 Oct 2020 10:55:44 +0000 (11:55 +0100)]
Bug 23916: (follow-up) Fix unit test

This commit responds to the comment made by Katrin in comment #73. I
have removed the lines cited as causing the contraint violation. The
were added in the original iteration of the bug patches and, despite
spending time trying to get to the bottom of it, I cannot figure out
why. There are no changes in the patchset relating to Koha/Patron.pm and
removing the lines does not cause any of the tests in files that *are*
affected by this patchset to fail. I do not know why these lines were
ever added in the first place, unfortunately I did not add comments
explaining (lesson learned)!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Rebase unit tests
Andrew Isherwood [Mon, 19 Oct 2020 11:55:18 +0000 (12:55 +0100)]
Bug 23916: (follow-up) Rebase unit tests

This commit is a response to Katrin's comments in comment #62:

- Fixed merge conflict

It also fixes a test which now fails due to an upstream change in
C4::Circulation

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Fix terminology, use patron-title and make column consistent...
Andrew Isherwood [Mon, 12 Oct 2020 09:28:33 +0000 (10:28 +0100)]
Bug 23916: (follow-up) Fix terminology, use patron-title and make column consistent in issues and old_issues

This commit makes the changes suggested by Katrin in comment #50:

- Changed syspref from RecordIssuer to RecordStaffUserOnCheckout
- Changed terminology from "issue" to "check out" and variations
- Fixed name display to use patron-title.inc
- Made issuer column DEFAULT NULL consistently between issues and
old_issues and between the DB update and kohastructure.sql

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Don't anonymise issuer and don't update action_logs on upgrade
Andrew Isherwood [Thu, 24 Sep 2020 12:55:55 +0000 (13:55 +0100)]
Bug 23916: (follow-up) Don't anonymise issuer and don't update action_logs on upgrade

This commit implements the two suggestions made by Nick in comment #41:

- Removes the attempted retrospective addition of issuers to old issues.
It was not particularly reliable, it also is not appropriate if the user
does not wish to make use of this functionality

- Removes the conversion of a NULL issuer to the anonymous borrowernumber when
anonymising checkouts

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Fix column name collision
Andrew Isherwood [Mon, 18 Nov 2019 12:30:27 +0000 (12:30 +0000)]
Bug 23916: (follow-up) Fix column name collision

Seems that joining 'borrowers' into the query run in
C4::Members::GetAllIssues caused a column name collision, which blatted
the retrieval of issues.branchcode. So we now are being a bit more
specific in what is coming from where in the query.

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Add unit tests
Andrew Isherwood [Thu, 31 Oct 2019 14:26:18 +0000 (14:26 +0000)]
Bug 23916: Add unit tests

This patch adds unit tests for the new functions

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Anonymise 'issuer' when required
Andrew Isherwood [Thu, 31 Oct 2019 10:45:41 +0000 (10:45 +0000)]
Bug 23916: Anonymise 'issuer' when required

This patch adds the anonymisation of 'old_issues.issuer' alongside the
existing anonymisation of 'old_issues.borrowernumber'

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Record and display item issuer
Andrew Isherwood [Mon, 2 Mar 2020 11:04:59 +0000 (11:04 +0000)]
Bug 23916: Record and display item issuer

This patch adds the recording and display of the item issuer. This
behaviour is governed by the RecordIssuer syspref, if disabled (the
default), no recording or display of issuer will take place.

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Add "RecordIssuer" syspref
Andrew Isherwood [Thu, 31 Oct 2019 10:22:24 +0000 (10:22 +0000)]
Bug 23916: Add "RecordIssuer" syspref

This patch adds the "RecordIssuer" syspref, which is disabled by default

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Add issues.issuer column and FK
Andrew Isherwood [Thu, 31 Oct 2019 10:08:42 +0000 (10:08 +0000)]
Bug 23916: Add issues.issuer column and FK

This patch adds the issues.issuer column which is a foreign key to
borrowers.borrowernumber

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26697: Make account.inc consistent between staff and opac
Martin Renvoize [Fri, 16 Oct 2020 14:57:30 +0000 (15:57 +0100)]
Bug 26697: Make account.inc consistent between staff and opac

Test plan - Regression
1/ Login to the OPAC as a user with various account charges and payments.
2/ Navigate to the 'Your charges' page.
3/ Compare the display of the table before and after applying the
patchset. They should match.

Test plan - Sync
1/ Compare koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc with
koha-tmpl/opac-tmpl/bootstrap/en/includes/accounts.inc.
2/ They files should match after the patch is applied.

Test plan - Translation
1) ./translate update fr-CA
2) Open fr-CA-opac-bootstrap.po and translated this part

msgid ""
"%s %s %sPayment %sWriteoff %sForgiven %sCredit %sLost item fee refund "
"%sRefund %s%s %s %s %s %sAccount creation fee %sAccount renewal fee
%sLost "
"item %sManual fee %sNew card %sFine %sLost item processing fee %sRental
fee "
"%sDaily rental fee %sRenewal of rental item %sRenewal of daily rental
item "
"%sHold fee %sHold waiting too long %s%s %s %s %s "

3) ./translate install fr-CA
4) Login to the OPAC as a patron with various charges
5) Check 'My charges' (in fr-CA) to confirm the translations have been
   picked up.

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 24603: DBRev 20.06.00.064
Jonathan Druart [Tue, 10 Nov 2020 13:32:09 +0000 (13:32 +0000)]
Bug 24603: DBRev 20.06.00.064

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: Simplify tests using TestBuilder
Jonathan Druart [Thu, 5 Nov 2020 13:40:29 +0000 (14:40 +0100)]
Bug 24603: Simplify tests using TestBuilder

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: Adjust permissions for cancel-charge.pl
Jonathan Druart [Thu, 5 Nov 2020 13:39:53 +0000 (14:39 +0100)]
Bug 24603: Adjust permissions for cancel-charge.pl

members/cancel-charge.pl should have the same permissions check than boraccount
(borrowers => edit_borrowers was missing)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: (QA follow-up) Add translation to OPAC
Martin Renvoize [Fri, 16 Oct 2020 15:23:10 +0000 (16:23 +0100)]
Bug 24603: (QA follow-up) Add translation to OPAC

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: (QA follow-up) Make the new credit type translatable and shorten descripti...
Katrin Fischer [Mon, 5 Oct 2020 13:24:40 +0000 (13:24 +0000)]
Bug 24603: (QA follow-up) Make the new credit type translatable and shorten description a bit

Adding the new offset type and credit type to the include so it can be translated.

Also suggest shortening the db description a bit.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=24063

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: (follow-up) Update to double entry accounting
Martin Renvoize [Fri, 10 Jul 2020 13:49:35 +0000 (14:49 +0100)]
Bug 24603: (follow-up) Update to double entry accounting

This patch updates the logic to create a cancellation accountline and
apply it to the charge line so we correction record the transaction in
terms of double entry accounting standards.

Test plan:
1. Go to a patron's accounting section
2. Create a manual invoice
3. In Transactions tab, you should see a 'Cancel charge' button. Click
   on it. It should now be marked as cancelled
4. A cancellation line should be associated with the original charge.
5. Create another manual invoice
6. Pay it (partially or fully)
7. Notice that the 'Cancel charge' button is not available
8. Void the payment
9. 'Cancel charge' button is available again. Click on it and verify
   that it still works
10. prove t/db_dependent/Koha/Account/Lines.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=24063

Bug 24603: Fix number of unit tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=24063

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: Allow to cancel charges in patron accounting
Julian Maurice [Thu, 6 Feb 2020 13:13:44 +0000 (14:13 +0100)]
Bug 24603: Allow to cancel charges in patron accounting

There is already a button to void a payment. It should be possible to
cancel a charge too.

This patch adds a button in patron's accounting section (Transactions
tab) that allow to cancel charges.
Charges that have been fully or partially paid cannot be cancelled.

It also fixes Koha::Account::Line::is_credit by looking at
credit_type_code instead of amount (amount can be 0 for voided payments)

It also fixes the tests for Koha::Account::Line::void when database does
not contain the borrowernumber 51 (the default in
t::lib::Mocks::mock_userenv)

Test plan:
1. Go to a patron's accounting section
2. Create a manual invoice
3. In Transactions tab, you should see a 'Cancel charge' button. Click
   on it. It should now be marked as cancelled
4. Create another manual invoice
5. Pay it (partially or fully)
6. Notice that the 'Cancel charge' button is not available
7. Void the payment
8. 'Cancel charge' button is available again. Click on it and verify
   that it still works
9. prove t/db_dependent/Koha/Account/Lines.t

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 26904: OPAC password recovery allows regexp in email
Fridolin Somers [Tue, 3 Nov 2020 08:19:34 +0000 (09:19 +0100)]
Bug 26904: OPAC password recovery allows regexp in email

When using OPAC password recovery form, opac/opac-password-recovery.pl :
if one provides correct login and an email, there is a check that this email is one of patron's.

This check uses RegExp with case insensitive :
  if ( $email && !( any { /^$email$/i } @emails ) )

This is a security issue since one can simply enter '.*'.
Severity is normal because the login must be a correct.

I propose to use simple string compare with lowercase to be case insensitive.

Test plan :
1) Don't apply patch
2) Enable system preference 'OpacResetPassword'
3) Go to 'OPAC > Log in to your account > Forgot your password?'
4) Enter an existing userid or cardnumber and '.*' in 'Email'
5) The password recovery is created ! (check table 'borrower_password_recovery')
6) Apply patch
7) Enter an existing userid or cardnumber and '.*' in 'Email'
8) You get the message 'No account was found with the provided information.'
9) Enter an existing userid or cardnumber and in 'Email' the corresponding email but with different case
10) The password recovery is created (check table 'borrower_password_recovery')

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26971: Remove obsolete test file translatable-templates.t
Jonathan Druart [Mon, 9 Nov 2020 10:20:43 +0000 (11:20 +0100)]
Bug 26971: Remove obsolete test file translatable-templates.t

After bug 25067 we found that this test file is failing with

 #   Failed test 'opac_bootstrap templates are translatable'
 #   at xt/author/translatable-templates.t line 91.
 # Unknown action specified.

The original patches forgot to update this file.
However when we tried to adjust it, we found that those tests are never working.

Tried on 18.11.00 with a very ugly modified intranet-main.tt, the test was still passing.

No idea how we can make it display warnings and so hard to fix the expected behaviour.

I decided to remove it for now and see later if we need an updated test for the translate script.

See also 25067 comment 84

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24665: (QA follow-up) Add tests for 'selected'
Martin Renvoize [Fri, 6 Nov 2020 16:27:47 +0000 (16:27 +0000)]
Bug 24665: (QA follow-up) Add tests for 'selected'

Add a unit test to prove the 'selected' param passed to
Koha::Template::Plugin::Registers is adhered to.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Mock UseCashRegister in tests
Martin Renvoize [Fri, 6 Nov 2020 16:19:15 +0000 (16:19 +0000)]
Bug 24786: (QA follow-up) Mock UseCashRegister in tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25067: Fix perlcritic errors
Jonathan Druart [Fri, 6 Nov 2020 16:06:44 +0000 (17:06 +0100)]
Bug 25067: Fix perlcritic errors

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: Fix Script_cron.t and t/Koha/Script.t
Jonathan Druart [Fri, 6 Nov 2020 16:03:33 +0000 (17:03 +0100)]
Bug 24786: Fix Script_cron.t and t/Koha/Script.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25067: Adjust paths in tests
Jonathan Druart [Fri, 6 Nov 2020 15:59:40 +0000 (16:59 +0100)]
Bug 25067: Adjust paths in tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26627: (QA follow-up) Remove barcode input by id
Kyle M Hall [Thu, 5 Nov 2020 11:40:42 +0000 (06:40 -0500)]
Bug 26627: (QA follow-up) Remove barcode input by id

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14866: DBRev 20.06.00.063
Jonathan Druart [Fri, 6 Nov 2020 12:03:17 +0000 (12:03 +0000)]
Bug 14866: DBRev 20.06.00.063

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14866: Trivial code simplification
Jonathan Druart [Tue, 3 Nov 2020 15:57:52 +0000 (16:57 +0100)]
Bug 14866: Trivial code simplification

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14866: (QA follow-up) Add hint to system preferences
Katrin Fischer [Thu, 22 Oct 2020 12:15:51 +0000 (12:15 +0000)]
Bug 14866: (QA follow-up) Add hint to system preferences

Adds a hint about the new configuration option to the existing
system preference sectoin.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14866: Make high holds work with different item types
Aleisha Amohia [Mon, 20 Apr 2020 14:31:27 +0000 (14:31 +0000)]
Bug 14866: Make high holds work with different item types

To test:
1) Apply patch, update database, restart services
2) Enable decreaseLoanHighHolds sysprefs if not already active
3) Go to circulation rules and set a value under 'Decrease loan holds
(day)' that is DIFFERENT from decreaseLoanHighHoldsDuration
4) Check out an item with holds and confirm that the value from the rule
is used instead of the system preference
5) Confirm tests pass before and after the patch
t/db_dependent/DecreaseLoanHighHolds.t

Sponsored-by: Catalyst IT
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
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 23091: DBRev 20.06.00.062
Jonathan Druart [Fri, 6 Nov 2020 12:03:17 +0000 (12:03 +0000)]
Bug 23091: DBRev 20.06.00.062

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: (QA follow-up) POD fixes
Tomas Cohen Arazi [Mon, 19 Oct 2020 11:47:50 +0000 (08:47 -0300)]
Bug 23091: (QA follow-up) POD fixes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Simplify tests by turning off AccountAutoReconcile
Tomas Cohen Arazi [Fri, 16 Oct 2020 19:51:07 +0000 (16:51 -0300)]
Bug 23091: Simplify tests by turning off AccountAutoReconcile

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Add tests for \->credits and \->debits
Tomas Cohen Arazi [Fri, 16 Oct 2020 19:30:49 +0000 (16:30 -0300)]
Bug 23091: Add tests for \->credits and \->debits

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Unit Tests
Martin Renvoize [Wed, 15 Jul 2020 10:23:38 +0000 (11:23 +0100)]
Bug 23091: Unit Tests

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Move _Restore to Koha::Item store trigger
Martin Renvoize [Thu, 3 Sep 2020 16:12:47 +0000 (17:12 +0100)]
Bug 23091: Move _Restore to Koha::Item store trigger

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Add template handling for new messages
Martin Renvoize [Fri, 5 Jun 2020 08:19:48 +0000 (09:19 +0100)]
Bug 23091: Add template handling for new messages

This patch adds handling for the display of the two new messages added
by this patchset in the returns screen.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Make relations more explicit
Martin Renvoize [Tue, 14 Jul 2020 12:59:06 +0000 (13:59 +0100)]
Bug 23091: Make relations more explicit

This patch simply makes the queries built for the ->debits and ->credits
relations in Koha::Account::Line more explicit.

Test plan
1/ Ensure tests continue to pass
2/ Run tests with DBIC_TRACE=1 DBIC_TRACE_PROFILE=console and note that
the related queries not include 'credit.' and 'debit.' as appropriate.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Add tests for _RestoreOverdueForLostAndFound
Martin Renvoize [Mon, 13 Jul 2020 14:51:24 +0000 (15:51 +0100)]
Bug 23091: Add tests for _RestoreOverdueForLostAndFound

This patch adds unit tests for the newly introduced
_RestoreOverdueForLostAndFound method in C4::Circulation.

Test plan
1/ Read the new tests added to t/db_dependent/Circuation.t to ensure
they make sense
2/ Run the tests and verify they pass
3/ Signoff

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Add handling for new lostreturn rules
Martin Renvoize [Wed, 23 Oct 2019 10:32:28 +0000 (11:32 +0100)]
Bug 23091: Add handling for new lostreturn rules

This patch adds handing for the new values available for the lostreturn
policy settings.

* undef - Do nothing, leave fees and fines as they were at the point of
  lose.
* refund - Refund the lost item fee only
* charge - Refund the lost item fee and charge a fresh overdue fine
  dated for a return on the date the item is 'found'
* restore - Refund the lost item fee and restore the original overdue
  fine (dated for a 'return' on the date the item was 'lost'

Test plan
1/ apply patch
2/ updatedatabase, restart_all
3/ verify finesmode and CalculateFinesOnReturn and WhenLostChargeReplacementFee are on
4/ verify WhenLostForgiveFine is set to "Forgive"
5/ verify circ rules include fines
6/ set Default lost item fee refund on return policy to "Refund lost item charge"
7/ create 4 overdue checkouts that will incur fines
8/ run fines.pl
9/ confirm 4 items checked out with accruing fines
10/ confirm all 4 items have a replacement price

Item 1
11/ mark the first item lost
12/ verify that fine is gone and lost fee has been charged
13/ check item in
14/ verify that lost fee is gone and overdue charge has not returned

Item 2
15/ set Default lost item fee refund on return policy to "Refund lost item charge and charge new overdue fine"
16/ mark second item lost
17/ verify that fine is gone and lost fee has been charged
18/ check item in
19/ verify that lost fee is gone and a new overdue charge has been made

Item 3
20/ set Default lost item fee refund on return policy to "Refund lost item charge and restore overdue fine"
21/ mark third item lost
22/ verify that fine is gone and lost fee has been charged
23/ check item in
24/ verify that lost fee is gone and the old overdue charge has been restored

Item 4
25/ set Default lost item fee refund on return policy to "Leave lost item charge"
26/ mark fourth item lost
27/ verify that fine is gone and lost fee has been charged
28/ check item in
29/ verify that lost fee remains and the overdue charge is still gone

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Update unit test
Martin Renvoize [Wed, 3 Jun 2020 15:25:31 +0000 (16:25 +0100)]
Bug 23091: Update unit test

This patch updates the unit test for get_lostreturn_policy to reflect
the rule_name and return code changes.

Test plan:
1/ Read the code changes in t/db_dependant/Koha/CirculationRules and
t/db_dependant/Koha/IssuingRules and confirm they make sense.
2/ Run the updated tests and ensure they pass.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23091: Database update
Martin Renvoize [Wed, 3 Jun 2020 15:01:39 +0000 (16:01 +0100)]
Bug 23091: Database update

This patch updates the 'refund' circulation rule to be called
'lostreturn' and populates the value with 'refund' where appropriate.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24412: DBRev 20.06.00.061
Jonathan Druart [Fri, 6 Nov 2020 12:03:17 +0000 (12:03 +0000)]
Bug 24412: DBRev 20.06.00.061

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24412: DBIC schema changes
Jonathan Druart [Fri, 6 Nov 2020 11:01:11 +0000 (12:01 +0100)]
Bug 24412: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24412: (follow-up) prevent js injection
Nicolas Legrand [Thu, 5 Nov 2020 13:52:02 +0000 (14:52 +0100)]
Bug 24412: (follow-up) prevent js injection

Some js variables are not properly escaped and can be executed if
containing javascript.

1. have some waiting reserve attached to a desk
2. change this desk name to : <script>alert("❤");</script>
3. go to user's checkout page (circulation.pl) and click on the
Hold(s) tab
4. you should see some popup with a ❤ in it.
5. apply patch and refresh page
6. now you should see the desk name printed properly in the page:
<script>alert("❤");</script>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24412: (follow-up) prevent request.pl from failing
Nicolas Legrand [Thu, 5 Nov 2020 13:10:09 +0000 (14:10 +0100)]
Bug 24412: (follow-up) prevent request.pl from failing

When no desk is defined request.pl returns an internal server
error. Check a desk is defined before asking for reservation deskname.

Plan test:

1. log in with a library with no desk
2. check in a reserved book so it'll be switch to “waiting reserve”
3. go to the book notice and click the Holds tab (request.pl page)
4. boum
5. apply patch, restart plack
6. refresh page
7. now loading properly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24412: (QA follow-up) Change CASCADE DELETE to SET NULL
Martin Renvoize [Fri, 23 Oct 2020 14:46:03 +0000 (15:46 +0100)]
Bug 24412: (QA follow-up) Change CASCADE DELETE to SET NULL

I don't believe waiting reserves should be removed if a desk is deleted,
we should instead simply unset the desk.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24412: (follow-up) prevent error in svc/holds
Nicolas Legrand [Thu, 22 Oct 2020 16:17:47 +0000 (18:17 +0200)]
Bug 24412: (follow-up) prevent error in svc/holds

don't fail if a hold has no desk attached.

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 24412: (follow-up) bad desk printing
Nicolas Legrand [Thu, 22 Oct 2020 11:31:15 +0000 (13:31 +0200)]
Bug 24412: (follow-up) bad desk printing

forgot to update two pages when I wrote Hold->desk to replace
Desks.GetName.

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 24412: (follow-up) qa-tools
Nicolas Legrand [Wed, 21 Oct 2020 11:29:00 +0000 (13:29 +0200)]
Bug 24412: (follow-up) qa-tools

fix obvious problems:

    1. qa -c 8 -v 2
    2. should be green

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 24412: (follow-up) tests
Nicolas Legrand [Wed, 21 Oct 2020 10:10:19 +0000 (12:10 +0200)]
Bug 24412: (follow-up) tests

Add some test for Koha::Hold->desk and Koha::Hold->set_waiting.

Test plan:

    1. prove t/db_dependent/Koha/Holds.t
    2. should be green!

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 24412: Attach waiting reserve to desk
Nicolas Legrand [Mon, 13 Jan 2020 16:56:41 +0000 (17:56 +0100)]
Bug 24412: Attach waiting reserve to desk

When an item is checked in and marked 'Waiting' or already 'Waiting'
and there is a desk attached to the session, the item is marked
waiting at the current desk of the current library.

The information is displayed on the OPAC and on the intranet. The
patron can then know at which desk he can retrieve his document.

Desk Management (Bug 13881) is now useful.

Test plan :

1. apply Bug 24201
2. $KOHA_PATH/installer/data/mysql/updatedatabase.pl
3. Check out some document to someone
4. make another one reserve this document
5. check in the document
6. you can see the document is attach to the current library
7. create some desks and attach one to your session (see Bug 13881 and
Bug 24201)
8. cancel the preceding reserve and redo steps 3 to 5
9. you should see the document is waiting at the current library and
current desk on:
  a. the intranet document request page
  b. the intranet borrower holds tab
  c. the item list where the document is listed on the bibliographic
    details
  d. the borrower's OPAC holds tab.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 24412: (follow-up) QA

Following Josef Moravec QA comments :

- rewrite Koha::Hold->desk according to Object Oriented Koha
Guidelines and use it to fetch desk name in various templates
- remove unused Desks.GetName
- Check for columns existence in db update

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 24412: (follow-up) QA: useless change

Maybe it was a relic of something usefull... anyway
not anymore.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 24412: (follow-up) Fix POD

Koha::Desk and not Koha::Library...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24412: kohastructure and atomic update
Nicolas Legrand [Mon, 13 Jan 2020 16:55:46 +0000 (17:55 +0100)]
Bug 24412: kohastructure and atomic update

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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 24633: (follow-up) Tweak sample plugin targets
Tomas Cohen Arazi [Tue, 20 Oct 2020 17:36:22 +0000 (14:36 -0300)]
Bug 24633: (follow-up) Tweak sample plugin targets

Sponsored-by: Theke Solutions
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 24633: Add support for gitlab searching of plugins
Tomas Cohen Arazi [Tue, 20 Oct 2020 17:29:38 +0000 (14:29 -0300)]
Bug 24633: Add support for gitlab searching of plugins

This patch adds the option to add Gitlab repositories to look for
Koha plugins. As with Github, plugin projects need to be named
koha-plugin-* and the release file needs to be named with the .kpz
extension.

To test:
1. Apply this patchset
2. Check either koha-conf.xml or koha-conf.site.xml.in for sample
   configurations of gitlab targets.
3. Tweak your koha-conf.xml accordingly. You could have:

 <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>gitlab</service>
     </repo>
     <repo>
         <name>PTFS Europe</name>
         <org_name>ptfs-europe</org_name>
         <service>github</service>
     </repo>
  </plugin_repos>

4. Flush memcached and restart plack:
   $ flush_memcached
   $ koha-plack --restart kohadev
5. Open the plugins page, search for anything, like 'gobi' or 'a'
=> SUCCESS: You get Theke results!
6. Pick a gitlab plugin for install
=> SUCCESS: It is installed!
7. Sign off :-D

Sponsored-by: Theke Solutions
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 24665: (QA follow-up) Fix selection default
Martin Renvoize [Fri, 6 Nov 2020 12:48:28 +0000 (12:48 +0000)]
Bug 24665: (QA follow-up) Fix selection default

This patch updates the html_helper for the cash register selection block
to remove the 'empty option' such that it can be correclty set for each
select case and updates all existing cases where we used the process
block previously to include the relevant blank option '-- Select an
option --', '-- None --', 'Library default' and finally the new '-- All
--' options introduced with this bug.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24665: Add support for filtering by cash register
Martin Renvoize [Tue, 21 Jul 2020 13:54:09 +0000 (14:54 +0100)]
Bug 24665: Add support for filtering by cash register

This patch makes it possible to filter on cash register
on the cash register statistics page.

To test:
- Activate UseCashRegisters
- Create a cash register or more to use
- Create some manual fees and fines
- Pay some of them off
- Go to Tools > Cash register statistics
- Test if the new filter for cash registers works as it should

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 24786: (QA follow-up) Ensure tests pass with existing data
Martin Renvoize [Fri, 6 Nov 2020 14:42:42 +0000 (14:42 +0000)]
Bug 24786: (QA follow-up) Ensure tests pass with existing data

The tests for Koha::Template::Plugin::Registers assumed that no
registers were pre-set in the database. This patch updates the test to
ignore pre-existing data or take it into account in totals.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Reset beenSubmitted on validation failure
Martin Renvoize [Fri, 6 Nov 2020 14:04:49 +0000 (14:04 +0000)]
Bug 24786: (QA follow-up) Reset beenSubmitted on validation failure

When the form submision fails due to validation errors we need to also
reset the preventFormDoubleSubmit state to allow for a second submission
with corrected form fields.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Do not use 'hidden' attribute
Martin Renvoize [Fri, 6 Nov 2020 11:51:30 +0000 (11:51 +0000)]
Bug 24786: (QA follow-up) Do not use 'hidden' attribute

The hidden attribute for loading an element hidden is known to have
issues and inconsistencies accross browsers.

This patch instead updates the relevent input options to use an inline
style of 'display: none' to hide the elements on page load and then
.show, .hide for subsquent changes linked to the library branch picker
change.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Hide archived registers
Martin Renvoize [Fri, 6 Nov 2020 10:55:13 +0000 (10:55 +0000)]
Bug 24786: (QA follow-up) Hide archived registers

This patch hides archived registers from the list when useing the
Registers template plugin.  It also includes a check for
UseCashRegisters so that if the preference is disabled after some
registers have been defined then the plugin will no longer return the
list regardless.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Handle no defined registers
Martin Renvoize [Fri, 6 Nov 2020 10:53:56 +0000 (10:53 +0000)]
Bug 24786: (QA follow-up) Handle no defined registers

This patch hides the register selection option from the login page if no
registers have yet been defined on the system.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Remove trailing space in classes
Martin Renvoize [Wed, 4 Nov 2020 12:53:59 +0000 (12:53 +0000)]
Bug 24786: (QA follow-up) Remove trailing space in classes

The trailing space after branch in the class attribute for the register
select options cause issues in the 'hasClass' javascript selector

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) String fix
Martin Renvoize [Wed, 4 Nov 2020 11:52:06 +0000 (11:52 +0000)]
Bug 24786: (QA follow-up) String fix

This patch updates 'Branch default' to 'Library default' on the login
page to match the coding terminology guidelines.

We also update the table heading on the cash registers management page
to match the terminology above for clarity.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Unit tests for Registers plugin
Martin Renvoize [Thu, 15 Oct 2020 16:03:04 +0000 (17:03 +0100)]
Bug 24786: (QA follow-up) Unit tests for Registers plugin

To test:
1. Run the new unit test: t/db_dependent/Koha/Template/Plugin/Registers.t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Add validation to paycollect
Martin Renvoize [Thu, 15 Oct 2020 12:41:16 +0000 (13:41 +0100)]
Bug 24786: (QA follow-up) Add validation to paycollect

This patch adds conditional validation to the cash register field on
paycollect such that if 'CASH' is selected as the payment type and cash
registers are enabled, then a cash register will be required.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Fix Registers Plugin
Martin Renvoize [Wed, 14 Oct 2020 12:42:32 +0000 (13:42 +0100)]
Bug 24786: (QA follow-up) Fix Registers Plugin

For the QA script we do not set a userenv, so we result in a failure due
to a lack of checking for userenv prior to using it.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) Make QA script happy with html_helpers
Martin Renvoize [Wed, 14 Oct 2020 12:08:45 +0000 (13:08 +0100)]
Bug 24786: (QA follow-up) Make QA script happy with html_helpers

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: (QA follow-up) POD Fixes
Martin Renvoize [Wed, 14 Oct 2020 12:01:38 +0000 (13:01 +0100)]
Bug 24786: (QA follow-up) POD Fixes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24786: Add validation to point of sale
Martin Renvoize [Fri, 2 Oct 2020 09:19:14 +0000 (10:19 +0100)]
Bug 24786: Add validation to point of sale

The Point of Sale page relied upon serverside validation prior to this
patch; As such with the introduction of the ability to select '--None--'
at the session register level (to require the librarian to pick their
register for every transaction) we could result in a server error page.

This patch introduced clientside validation to add checks for both the
'collected' and 'registerid' form fields.

Test plan:
1/ Select a branch with cash registers available
2/ Select the '--None--' option for the session cash register
3/ Navigate to the point of sale page
4/ Attempt to make a sale without having picked your cash register
5/ Note that the submission was prevented and the fiedl is highlighted
as required in red.
6/ Signoff

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 24786: Default to 'branch default' on auth.
Martin Renvoize [Tue, 11 Aug 2020 13:24:19 +0000 (14:24 +0100)]
Bug 24786: Default to 'branch default' on auth.

If no branch is selected (i.e. 'My library') then we should default to
'branch default' if one is defined for the users library at login.

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 24786: (follow-up) Cache the register_name in the session
Martin Renvoize [Tue, 4 Aug 2020 12:27:06 +0000 (13:27 +0100)]
Bug 24786: (follow-up) Cache the register_name in the session

This leads to one DB hit less per page load in the staff client when
cash registers are enabled.

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 24786: Update borroaccount to use session register
Martin Renvoize [Tue, 21 Jul 2020 09:52:49 +0000 (10:52 +0100)]
Bug 24786: Update borroaccount to use session register

This patch adds handling to allow for the use of the session cash
register by default if it has been set, otherwise it defaults to '--
None --' and requires the end user to select the register to proceed
with the refund or payout action.

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 24786: Update paycollect to use session register
Martin Renvoize [Tue, 21 Jul 2020 09:30:09 +0000 (10:30 +0100)]
Bug 24786: Update paycollect to use session register

This patch adds handling to allow for the use of the session cash
register by default if it has been set, otherwise it defaults to '--
None --' and requires the end user to select the register to proceed
with the payment.

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 24786: Update point of sale to use session register
Martin Renvoize [Tue, 21 Jul 2020 12:08:18 +0000 (13:08 +0100)]
Bug 24786: Update point of sale to use session register

This patch adds handling to allow for the use of the session cash
register by default if it has been set, otherwise it defaults to '--
None --' and requires the end user to select the register to proceed
with the sale.

Test plan
1/ Enable cash registers via the 'UseCashRegisters' system preference
2/ Enable point of sale via the 'EnablePointOfSale' system preference
3/ Navigate to the point of sale page
4/ Note that if you are logged in at a branch with no cash registers yet
defined, then an alert should appear
5/ Note that when you are logged in at a branch with cash regsiters
defined, but without a cash register associated with your session then
the cash 'Cash register' select box is populated with '-- None --' and
you are required to select a register prior to submission
6/ Note that upon selection, the '-- None --' option is disabled
7/ Note that when you have a register associated with your session then
the 'Cash register' select box is pre-populated with that register.
8/ Signoff

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 24786: Allow selection of cash register at login
Martin Renvoize [Tue, 21 Jul 2020 12:37:16 +0000 (13:37 +0100)]
Bug 24786: Allow selection of cash register at login

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 24786: Allow setting a register for the session
Martin Renvoize [Mon, 20 Jul 2020 15:14:17 +0000 (16:14 +0100)]
Bug 24786: Allow setting a register for the session

This patch adds the ability to set a register for the current session
from the 'set library' page.

Upon entering the page, the current selection will be displayed.
Changing the branch will trigger the register select list to update to
display only those registers associated with the updated branch and will
automatically select either 'no register' or the 'branch default'
register.  The user can then override that selection to choose a
different register for the session.

Test plan
1/ Enable cash registers with the 'UseCashRegisters' system preference
2/ Select the 'Set library' option from the top right menu
3/ Note that you can now select a cash register from the subsequent page
4/ Change the branch and note that the cash register selection is
updated to reflect the change
5/ Note that the 'branch default' register is auto-selected upon branch
selection if one has been defined, otherwise '-- None --' is selected
6/ You can then alter the selection before submitting the form
7/ Once submitted note that you are returned to the page you were on
prior to attempting to change the library and register
8/ Note the present of the register name next to the library name at the
top of the screen.
9/ Signoff

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 25067: Move the tests to db_dependent
Jonathan Druart [Fri, 6 Nov 2020 14:30:39 +0000 (15:30 +0100)]
Bug 25067: Move the tests to db_dependent

To not break the package workflow

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25067: (QA follow-up) Add +x on test files
Katrin Fischer [Sun, 4 Oct 2020 18:07:08 +0000 (18:07 +0000)]
Bug 25067: (QA follow-up) Add +x on test files

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25067: Move PO file manipulation code into gulp tasks
Julian Maurice [Sun, 29 Mar 2020 12:56:20 +0000 (14:56 +0200)]
Bug 25067: Move PO file manipulation code into gulp tasks

misc/translator/translate was doing three different things:
- extract translatable strings
- create or update PO files
- install translated templates

This patch separates responsibilities by moving the string extraction
code into several 'xgettext-like' scripts and adds gulp tasks to
automate string extraction and PO files update

This has several benefits:

- gulp runs tasks in parallel, so it's a lot faster (updating all PO
  files is at least 10 times faster with my 4-cores CPU)

- there is no need for $KOHA_CONF to be defined
  LangInstaller.pm relied on $KOHA_CONF to get the different paths
  needed. I'm not sure why, since string extraction and PO update should
  work on source files, not installed files

- string extraction code can be more easily tested

This patch also brings a couple of fixes and improvements:

- TT string extraction (strings wrapped in [% t(...) %]) was done with
  Template::Parser and PPI, which was extremely slow, and had some
  problems (see bug 24797).
  This is now done with Locale::XGettext::TT2 (new dependency) which is
  a lot faster, and fixes bug 24797

- Fix header in 4 PO files

For backward compatibility, 'create' and 'update' commands of
misc/translator/translate can still be used and will execute the
corresponding gulp task

Test plan:
1. Run `yarn install` and install Locale::XGettext::TT2
2. Run `gulp po:update`
3. Verify the contents of updated PO files
4. Run `cd misc/translator && ./translate install <lang>`
5. Verify that all (templates, sysprefs, xslt, installer files) is
   correctly translated
6. Run `gulp po:create --lang <lang>` and verify that it created all PO
   files for that language
7. Run `prove t/misc/translator`

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Need to install yarn & gulp, no 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 26727: (follow-up) More markup corrections
Owen Leonard [Tue, 3 Nov 2020 18:00:57 +0000 (18:00 +0000)]
Bug 26727: (follow-up) More markup corrections

This patch makes more markup changes to the templates previously
modified in order to try to arrive at some agreeable solutions.

- In the value_builder EXAMPLE template, the <p> is unnecessary and is
  removed. Also removed is the script "type" attribute and obsolete
  CDATA markers.
- In the article request template an unnecessary <p> is removed.
- In the merge patrons template the submit button is now in a <fieldset
  class="action"> as is consistent with other forms.
- In the MARC modifications template I've added <div>s around each
  "line" in the form to add the line break, along with some CSS to add
  margins.
- The submit button is now inside a <fieldset class="action"> and the
  "Cancel" link now has the "cancel" class.

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 26727: Fix <p/> appearing in the templates
Katrin Fischer [Sun, 18 Oct 2020 16:30:24 +0000 (16:30 +0000)]
Bug 26727: Fix <p/> appearing in the templates

The self-closing p is not valid in HTML5:

Error: Self-closing syntax (/>) used on a non-void HTML element.
Ignoring the slash and treating as a start tag.

To test:

1)
- Activate Article requests
- Search for a record to place an article request on in staff
- Look up the patron
- Verify the article request form looks ok
2)
- Search for a list of patrons
- Check 2 patrons and merge them using the button above the list
- Verify the distance between the button and the table looks ok
3)
- Create a new MARC modification template
- Create a new action
- Verify the distances between the first and second line of form
  elements looks ok
4)
- Place a hold in staff
- Click on the Suspend link in the holds table (not below)
- Verify the modal looks ok

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 14708: (QA follow-up) Add tests
Tomas Cohen Arazi [Thu, 5 Nov 2020 14:53:43 +0000 (11:53 -0300)]
Bug 14708: (QA follow-up) Add tests

This patch adds tests for the change. It also simplifies the delete()
method structure a bit. It fixes the error 500 the tests were raising.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass! The new behaviour (code 403) is tested!
4. 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 14708: (QA follow-up) Use try/catch blocks when calling delete() on a patron
Kyle M Hall [Tue, 3 Nov 2020 13:55:04 +0000 (08:55 -0500)]
Bug 14708: (QA follow-up) Use try/catch blocks when calling delete() on a patron

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14708: (QA follow-up) Throw exception when deleting anonymous borrower
Kyle M Hall [Mon, 2 Nov 2020 13:11:58 +0000 (08:11 -0500)]
Bug 14708: (QA follow-up) Throw exception when deleting anonymous borrower

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14708: Don't allow merging of other patron records into Anonymous Patron
Kyle M Hall [Wed, 29 Apr 2020 11:22:26 +0000 (07:22 -0400)]
Bug 14708: Don't allow merging of other patron records into Anonymous Patron

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 14708: Don't allow merging of Anonymous Patron into other patron records
Kyle M Hall [Wed, 15 Apr 2020 17:48:09 +0000 (13:48 -0400)]
Bug 14708: Don't allow merging of Anonymous Patron into other patron records

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 14708: Skip AnonymousPatron in GetBorrowersToExpunge
Kyle M Hall [Wed, 15 Apr 2020 17:31:59 +0000 (13:31 -0400)]
Bug 14708: Skip AnonymousPatron in GetBorrowersToExpunge

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 14708: Prevent deletion of Anonymous Patron at Koha::Patron::delete
Kyle M Hall [Wed, 15 Apr 2020 16:48:02 +0000 (12:48 -0400)]
Bug 14708: Prevent deletion of Anonymous Patron at Koha::Patron::delete

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 14708: Enforce restriction in delete_patrons.pl
Kyle M Hall [Wed, 27 Feb 2019 17:00:03 +0000 (12:00 -0500)]
Bug 14708: Enforce restriction in delete_patrons.pl

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 14708: The patron set as the anonymous patron should not be deletable.
Kyle M Hall [Wed, 27 Feb 2019 11:59:08 +0000 (06:59 -0500)]
Bug 14708: The patron set as the anonymous patron should not be deletable.

Right now it's possible to delete the anonymous patron at any time. When this happens the system will break just as if anonymouspatron was unset but patrons still have an "always anonymize" privacy setting.

This issue occurs more frequently than one would expect.

We should make it so that the patron set in AnonymousPatron is not deletable.

Test Plan:
1) Apply this patch
2) Set a patron to by AnonymousPatron
3) Attempt to delete that patron from the members toolbar
4) Note the error message!

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
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 16696: Fix search_utf8.t
Jonathan Druart [Thu, 5 Nov 2020 15:27:29 +0000 (16:27 +0100)]
Bug 16696: Fix search_utf8.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25334: DBRev 20.06.00.060
Jonathan Druart [Thu, 5 Nov 2020 11:07:01 +0000 (11:07 +0000)]
Bug 25334: DBRev 20.06.00.060

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25334: MTT is itiva not talkingtech
Jonathan Druart [Thu, 5 Nov 2020 13:12:56 +0000 (14:12 +0100)]
Bug 25334: MTT is itiva not talkingtech

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25334: (QA follow-up) Update overduerules.tt
Kyle M Hall [Tue, 3 Nov 2020 18:21:24 +0000 (13:21 -0500)]
Bug 25334: (QA follow-up) Update overduerules.tt

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25334: (QA follow-up) Update opac messaging
Kyle M Hall [Tue, 3 Nov 2020 18:13:28 +0000 (18:13 +0000)]
Bug 25334: (QA follow-up) Update opac messaging

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25334: Add generic 'phone' message transport type
Kyle M Hall [Thu, 30 Apr 2020 17:35:48 +0000 (13:35 -0400)]
Bug 25334: Add generic 'phone' message transport type

As bug 25333 changed the 'phone' transport type to 'talkingtech', we can
now re-add 'phone' as a transport type again, and allow it to behave and
support the same notices as the email transport type.

Test Plan;
1) Apply this patch
2) Run updatedatabase
3) Restart all the things!
4) Disable TalkingTechItivaPhoneNotificationi if enabled
5) Enable new PhoneNotification system preference
6) Go to a patron's messaging preferences, not you can select the
   'phone' option for all the same notices as the 'email' option
7) Enable the phone option for all the message types
8) Browser to the Notices and slips editor
9) Add a phone notice version for each notice you wish to test
10) Test some notices ( CHECKIN, CHECKOUT, etc )
11) Notices should show in the patron's messages as 'phone' notices

Signed-off-by: Christopher Zorn <Christofer.Zorn@ajaxlibrary.ca>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25650: Add location and itype descriptions in ILS-DI GetRecords
Julian Maurice [Tue, 2 Jun 2020 07:27:02 +0000 (11:27 +0400)]
Bug 25650: Add location and itype descriptions in ILS-DI GetRecords

Test plan:
1. Create a record with an item, and set the item's shelving location
and itemtype.
2. Go to
http://<OPAC>/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=<biblionumber>
3. Check that there is <itype_description> and <location_description>
and that their value is correct.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26148: OpenLibrary "Preview" link target is unclear to patrons
Owen Leonard [Mon, 2 Nov 2020 18:13:04 +0000 (18:13 +0000)]
Bug 26148: OpenLibrary "Preview" link target is unclear to patrons

This patch makes changes to the display of the Open Library "read" links
in the OPAC search results and detail page. The link is now grouped with
other details about the record ("Publisher," "Location(s)," etc. On the
detail page, the "Preview" link will no longer appear under the cover
image.

The label is changed to "Found in Open Library," and the link now opens
the Open Library reader in a new window.

The patch also changes the Open Library button image links so that they
use https and makes it so that the "Found in Open Library" information
is hidden until the availability information has loaded.

To test, apply the patch and enable the OpenLibrarySearch system
preference.

 - Perform a search in the OPAC which will return results found in Open
   Library, e.g. "poetry" in the sample data.
 - Confirm that the "Read now" images from Open Library appear on some
   search results.
 - View the detail page for one of these titles.
 - Confirm that the "Read now" button appears in the same format on the
   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 26172: Compiled CSS
Jonathan Druart [Thu, 5 Nov 2020 11:06:33 +0000 (12:06 +0100)]
Bug 26172: Compiled CSS

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