Commit graph

1171 commits

Author SHA1 Message Date
099e2fe2b7 Bug 7806: Fix remaining occurrences of 0000-00-00
We should remove all SQL queries that contain 0000-00-00 and finally
assume we do not longer have such value in our DB (for date type)

We already dealt with such values in previous update DB entries.
The 2 added by this one haven't been replaced already.

The code will now assume that either a valid date exist, or NULL/undef.

Test plan:
QA review is needed and test of the different places where code is
modified.

Not sure about the change from reports/issues_avg_stats.pl

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-03-01 11:16:42 +01:00
e9195d166e Bug 27454: Pass the arrayref
Otherwise you mess with the following hash elements :)

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>
2021-02-08 14:56:00 +01:00
0821a5890d Bug 27454: Add sorting of patron attributes
This patch adds sorting on class code for the patrons attributes forms
on the memberentry page.

Test plan
1) Create a couple of different patron attributes
2) Go to the patron add page
3) Note the order in which the patron attributes load at the bottom of
   the page.
4) Reload the page and note the order of those attribues may change (if
   it doesn't, try reloading again.. it's random)
5) Apply the patch
6) Reload the page a few times and confirm the attributes are now
   ordered.
7) Signoff

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>
2021-02-08 14:56:00 +01:00
08396d4b2f Bug 27420: Use object accessor for $attr_type->class()
We introduced a bug in the patron attribute forms with bug 5161.

Test plan
1/ Create two PA_CLASS authorized values
2/ Create two corresponding patron attribute types referencing the above
classes.
3/ Edit a patron, both attributes should appear within their own
fieldsets at the bottom of the member entry form.
4/ Set a value for the first of the two patron attributes and save
5/ Edit the patron again, note that the first attribute no longer
resides within it's own fieldset
6/ Apply the patch
7/ Edit the patron again, note that the first attribute now resides
inside it's own fieldset again
8/ Signoff

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-01-19 15:31:55 +01:00
Joonas Kylmälä
08c34b33e4 Bug 27144: Fix syntax error that prevents deleting patrons
To test:
 1) In staff interface open up a patron record
 2) Click More -> Delete, and then "Yes, delete"
 3) Notice 500 error
 4) Apply patch
 5) Notice error is now gone when deleting

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-04 15:26:49 +01:00
381d46341c 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>
2020-11-10 15:00:14 +01:00
9c709b871f 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>
2020-11-10 15:00:14 +01:00
Julian Maurice
8d2259b674 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>
2020-11-10 15:00:09 +01:00
114e851f8f 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>
2020-11-06 15:40:00 +01:00
24804aa4c6 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>
2020-11-06 15:39:59 +01:00
1e37d9c5f7 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>
2020-11-06 09:40:25 +01:00
c1af56eb54 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>
2020-11-06 09:40:25 +01:00
42c0475a94 Bug 26915: Fix FinePaymentAutoPopup behaviour
The behaviour of the syspref FinePaymentAutoPopup is broken, the popup
explodes with
    Can't call method "unblessed" on an undefined value at /home/vagrant/kohaclone/members/printfeercpt.pl line 64

It has been broken by
  commit a2449a81be
  Bug 23051: (follow-up) Add renewal feedback and move code to subroutines and test
which modified the return value of Koha::Account->pay (from $payment_id
to a hashref)

Test plan:
- To test activate FinePaymentAutoPopup
- Create a manual fee
- Write it off using the write off button on the account line (not below table)
=> Without the patch you get the error
=> With the patch applied the popup is correctly displayed

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>
2020-11-05 15:24:20 +01:00
Julian Maurice
96cc447045 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>
2020-10-15 12:56:30 +02:00
308f52d764 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>
2020-10-15 12:56:14 +02:00
d4a54196f5 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>
2020-10-15 11:20:40 +02:00
89716a78e9 Bug 26269: Fix variable name mismatch for cash_register in paycollect
It appears that through various rebases the variable names in the form
and the controller script have become mismatched.  This patch corrects
the situation and clarifies their intended use.

Test plan:
1/ Turn on cash registers in sysprefs
2/ Define at least 2 cash registers in Admin
3/ Create a manual invoice on a patron
4/ Pay off half of your fee, selecting the first register
5/ Pay off the remaining fee, selecting the second register
6/ Query accountlines.register_id for your two payments
8/ Confirm the two accountlines.register_id's do not match (thus the
passed variable was used)

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

Signed-off-by: Jessie Zairo <jzairo@bywatersolutions.com>

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-18 10:38:04 +02:00
Agustin Moyano
5848da810e Bug 23816: Add minimum password length and require strong password overrides by category
This patch adds the capability to override minPasswordLenth and RequireStrongPassword settings by category

To test:
1. koha-shell kohadev
2. koha-mysql kohadev

3. drop database koha_kohadev;
4. create database koha_kohadev;

5. go to admin page and start webinstaller. There continue the steps until onboarding.
6. reach step 3 of onboarding and create a new administrator patron
CHECH => Password control woks as normal (Minimum length 3 and strong required)

7. finish Koha installation and enter admin with your new administrator
8. set minPasswordLength to 3 and RequireStrongPassword to “Don’t require”
9. Create a new category (CAT2 from now on.. CAT1 is the category you made in onboarding process) and set minimum password length to 8 and require strong password
10. Create two new patrons, one with CAT1(patron1) and one with CAT2 (patron2)
CHECK => In both cases, try different combinations of length and strength. For patron1 the only requirement is to have 3 letters, but for patron2 the minimum length will be 8 and will require strong password.
CHECK => Try changing patron category before saving. Password requirements will change with category change.

11. Edit CAT1 and set minimum password length to 5
12. Go to patron1 details page, and change password.
CHECH => Now password minimum length is 5, but still it doesn’t require strong password

13. Edit CAT1, leave blank minimum password length and set require strong password to yes.
14. Go to patron1 details page, and change password.
CHECH => Password minimum length is back to 3, but now strong password is required

15. Set minimum password length in CAT2 to 12.
16. Go to patron2 details page, and click to fill a random generated password
CHECK => generated password should be 12 characters length

17. Set PatronSelfRegistration to Allow in admin settings
18. Go to OPAC and fill self registration from.
CHECK => Play with patron category. For each change in category, password requirements are modified.
CHECK => Set CAT1 as patron category, set ‘aA1’ as password (or another valid password for CAT1) and before hitting submit button, change to CAT2. Form should enter invalid state, and CAT2 password requirements should be displayed as error in password input.

19. Create a patron for CAT1 and another for CAT2, leaving password blank
CHECK => For CAT1’s patron, generated password length is 8 (minimum length for generated passwords), but for CAT2’s patron should be 12

20. In admin set PatronSelfRegistrationVerifyByEmail to require
21. Fill self registration form again with CAT2 as category
CHECK => Password requirements works as previous case.
22. Leave password blank and click submit

23. select * from message_queue;
24. Copy the link in the message and paste it in OPAC
CHECH => Generated password is 12 characters long. (Copy user id for next steps)

25. In admin set OpacResetPassword to Allow
26. Go back to OPAC, reload and click on “Forgot password?” link
27. Paste user id and click submit
28. Repeat steps 23 and 24
CHECK => Info message says “Your password must contain at least 12 characters, including UPPERCASE, lowercase and numbers.”
CHECK => enter an invalid password and you’ll get the same message in warning.

29. Login OPAC with the last user and your newly created password
30. Go to “Change your password” option
CHECK => Info message says “Your password must contain at least 12 characters, including UPPERCASE, lowercase and numbers.”
CHECK => enter an invalid password and you’ll get the same message in below “New password” input.

31. prove t/db_dependent/AuthUtils.t t/db_dependent/Koha/Patron/Category.t

32. Sign off

Sponsored-by: Northeast Kansas Library - NEKLS

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-09 15:39:52 +02:00
638786e719 Bug 24663: Remove authnotrequired if set to 0
It defaults to 0 in get_template_and_user

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-03 10:40:35 +02:00
9524c1d761 Bug 23634: (follow-up) Prevent updates on POST
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-02 15:40:55 +02:00
087af360cc Bug 23634: Prevent non-superlibrarians from editing superlibarian emails
This patchset prevents a non-superlibrarian user from editing a
superlibrarians email address via memberentry.  This is to prevent a
privilege escalation vulnerability whereby a user could update a
superlibrarians contact details to match their own and then request a
password reset via the OPAC.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-02 15:40:55 +02:00
c9887a8753 Bug 26076: (QA Follow up) Prevent error by using a fresh resultset
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-24 10:12:49 +02:00
6441296903 Bug 26076: Sum the amount due in the database query instead of a loop in Perl
This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE

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

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-24 10:12:49 +02:00
883e86a571 Bug 6725: Make patron duplicate matching flexible
This patch adds a new system preference PatronDuplicateMatchingAddFields
to list the patron's attributes to use for deduplication.
The default value is surname, firstname and dateofbirth to keep existing
behaviour.

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

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

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-18 17:39:48 +02:00
484061a44e Bug 22393: (follow-up) Corrections for QA feedback
We correct the behviour of 'amount' being passed back to the template
and add a work around for the existance of deleted_items alongside a FK
to items in the accountlines table.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-18 17:39:48 +02:00
0d19d9fa44 Bug 22393: Remove last remaining use of C4::Accounts::manualinvoice
This patch re-arranges the manualinvoice controller script to clarify
code flow, replaces the last call to C4::Accounts::manualinvoice with a
call to Koha::Accounts->add_debit wrapped in a try catch block and also
adds a check on passed barcodes when the invoice type is 'LOST' so it
can link the subsequently created accountline to the item and issue.

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-18 17:39:48 +02:00
David Roberts
66e70c9201 Bug 25364: Add "Other" to the gender options in a patron record
This patch adds "Other" as an option, and also changes the wording of
"None specified" slightly.

To test:

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

Correct typos in previous commit

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-18 17:39:48 +02:00
75e25c9d38 Bug 21345: Patron records with attached files not obvious from patron details view
This patch adds a section to the patron details page for listing files
which have been attached to the patron record.

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

- If necessary, attach some files to a patron record by viewing a patron
  record and choosing "Files" from the sidebar menu.
- View the detail page (moremember.pl) for a patron who has files
  attached.
- You should see a new section under "Alternative contact" with the
  heading "Files."
  - Test the "Manage" button to make sure it takes you to that patron's
    files.
  - Confirm that all the attached files are listed.
  - Confirm that the links to each file work correctly.

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

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>

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

JD amended patch: replace a html filter with uri

Bug 21345: (follow-up) Hide files information if EnableBorrowerFiles is disabled

This patch wraps the new patron file information in a check for the
EnableBorrowerFiles system preference.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-13 07:55:44 +02:00
810972db7a Bug 22844: Make the attribute mandatory when editing a patron
Note: I am not confident with this patch, I think it's not polished. I
will not have time to improve it to make it ready for 19.05.00
1. Conflict with bug 20443 (which would have make this change way much
easier!)
2. It does not work :) You will be able to submit the memberentry form
even if the patron attribute is marked as mandatory (??)
3. What about the OPAC?
4. What about repeatable fields? We certainly will need JS code here
5. What about the "Quick add" feature? (I had trouble in the past to not
introduce regression when we played with this template...)

Do not forget to run updatedatabase.pl and regenerate DBIC schema if you
want to play with this patchset.

Signed-off-by: David Nind <david@davidnind.com>

Bug 22844: (follow-up) Make the attribute mandatory when editing a patron

Previous patch forgot the most important, adding the required attribute
to the select/textarea

Signed-off-by: David Nind <david@davidnind.com>

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-07-20 16:08:22 +02:00
2cc3d05d26 Bug 15400: Display date of birth and age more consistantly
Test plan:
0) Apply the patch
1) Go to all of these pages
    Patron detail
    Other patron pages - look on the left side (circ-menu)
    Patron search
    Guarantor search ( go to child patron -> edit -> in guarantor
        section click "Set to patron"
    Search through "Check out" (in the header)

2) Confirm that does show date of birth and date consistantly,
    try it on patrons with and without date of birth set to find
    possible reggressions

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

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

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

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

Signed-off-by: Michal Denar <black23@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-06-29 12:37:02 +02:00
Petro Vashchuk
029f41a667 Bug 25322: fix for not selected "relationship" defaults to father
When a user creates a patron's guarantor on /cgi-bin/koha/members/memberentry.pl but doesn't select the relationship from a dropdown, the relationship defaults to first value, which in default sysprefs is "father". This may or may not be correct as this is not a conscious choice from the user.

The solution is to make the "Relationship" field mandatory when there is no empty entry in the system preferences, always starting with an empty option but not allowing the user to save an empty entry.
And if there is an empty option in sysprefs, it allows to save empty, as well as makes it default choice.

To reproduce with default system preferences:
    1) Create a new patron who is assumed to have a guarantor or modify the existing one.
    2) Under "Guarantor Information" click on "Search to add" button. After performing the search, select a user to act as guarantor. Don't use the dropdown menu to select a relationship. Save your changes.
    3) Observe that relationship is set as "father".
    4) Apply the patch.
    5) Repeat steps 1 and 2.
    6) Observe that it doesn't allow you to save the form until you pick a relationship type.

To reproduce with empty entry added to system preferences:
    1) Add an empty entry to borrowerRelationship at /cgi-bin/koha/admin/preferences.pl?tab=patrons in Patron relationships section (example: "|father|mother").
    2) Create a new patron who is assumed to have a guarantor or modify the existing one.
    3) Under "Guarantor Information" click on "Search to add" button. After performing the search, select a user to act as guarantor. Don't use the dropdown menu to select a relationship. Save your changes.
    4) Observe that relationship is set as "father".
    5) Apply the patch.
    6) Repeat steps 1, 2 and 3.
    7) Observe when you save the empty entry it does set the relationship as empty.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-06-29 12:37:02 +02:00
Katrin Fischer
21cde7bd2f Bug 10910: (follow-up) Move the suggestions note with the other non-blocking notes
To test:
- Add a credit to the patron's account
- Make sure they got a pending suggestion
- Try to delete
- Verify you notes for both as list items

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-06-15 11:53:36 +02:00
85c1537bd7 Bug 10910: Add a warning when deleting a patron with pending suggestions
Test plan:
From the OPAC, add a suggestion
From the staff interface, try to delete the patron who created the
suggestion
=> You get a warning message

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-06-15 11:53:36 +02:00
bbac95d9fb Bug 25526: Equality matching is case sensative
TEST PLAN:
1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3. Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value
   greater than or equal to 2.00." The $2.00 is the amount that is
   attempted to write off (the amount less than the amount owed).
5. Apply patch
6. Again try to writeoff an amount less than the amount owed.
7. You should be able to write it off.
8. Try paying an amount more than owed, you should still get an
   error. You shouldn't be able to write off more than the amount.
9. Follow the above steps via 'Pay selected' as aposed to 'Writeoff
   selected'.
10. You should not be able to 'Tender' less than the amount you have
    'Paid'.
11. Disable Javascript and run through all the above steps. You should
    still be blocked where relevant.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-06-15 10:29:34 +02:00
185d88bac6 Bug 20443: (follow-up) Remove C4::Members::AttributeTypes 2020-05-07 17:05:32 +02:00
b3e3067731
Bug 25311: Better error handling when updating a patron
Same as the precedent patch for patron's modification

Test plan is identical but with an existing patron

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-05-04 08:38:46 +01:00
580e6fabff
Bug 25311: Better error handling when creating a patron
This is still not ideal but brings a bit of enhancement.

One possible problem is that the patron creation will fail if the
streetnumber field is too long (borrowers.streetnumber is varchar(10).

Test plan:
0. Don't apply this patch
1. Create a new patron with a streetnumber longer than 10 characters
2. Save
=> The patron has not been created and the app explodes
The error is about extended_attributes and not meaningful
Can't call method "extended_attributes" on an undefined value at /kohadevbox/koha/members/memberentry.pl line 560
3. Apply the patch
4. Repeat 1. and 2
=> You get a warning on the interface and you still see the creation
form
5. Check the logs
=> The error is meaningful
"Data too long for column 'streetnumber'"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-05-04 08:38:35 +01:00
866c6850e0
Bug 5161: Keep patron's attributes on warning/duplicate
When a patron is added or modified and a warning appears (duplicate,
inconsistent data, etc.) the form lost the patron's attributes.

Test plan:
Create some attribute types for patrons
Create a new patron, use an userid that already exists and fill the attributes
=> You get a warning and the attributes are kept
Modify the userid and save again
Edit the same patron
Modify the attributes, as well as the userid (to get the duplicate warning)
=> You get a warning and the attributes are kept with the modified
values
Modify the userid and save again
=> The new values are saved
Edit the attributes from the detail page (so not with the full edit form)
Modify them and save
=> The new values are saved

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-27 11:28:46 +01:00
ca46310b26
Bug 22534: (RM follow-up) Remove errant hidden file
An nfs share file got commited by mistake :(

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 11:08:32 +01:00
6ac037f817
Bug 24840: Replace DateTime->now with dt_from_string
We should use Koha::DateUtils instead of Date::Time directly

This patch simplay replaces calls to now() with a call to dt_from_string()
which does effectively the same thing.

Probably reading the code and verifying changes is sufficient but...

To test:
1 - confirm the files all compile
2 - confirm all tests pass
3 - confirm Koha still works

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-08 11:54:23 +01:00
dd0d2fa1c9
Bug 22534: Added syspref for defining what guarantee fields are pre filled
Librarians should be able to define what sections in member entryfields in 'Main address',
'Contact' and 'Alternate contact' in member entry form for guarantee's are pre-filled from guarantor's record

The 'Guarantor surname, 'Guarantor first name' and 'relationship' fields
in the 'Contact' section should not be filled from guarantor patron
record as those fields are intended for guarantor's without patron
records in Koha.

Test plan:
1. On an adult patron's record (which has all fields filled out in the
'Main address', 'Contact' (Except for 'Guarantor surname', 'Guarantor
first name', and 'relationship'), 'Alternate address', and 'Alternate contact') select 'Add guarantee'

2. Observe:

* Fields in 'Main address' are all automatically pre-filled
from guarantor record

* Fields in 'Contact' (except 'Guarantor surname', 'Guarantor firstname'
and 'relationship') are all automatically pre-filled from guarantor
record

* Fields in 'Alternate address' (except for Contact note) are pre-filled from guarantor record

* None of the fields in 'Alternate contact' are pre-filled from guarantor

4. Apply patch

5. Run database updates
cd installer/data/mysql
sudo koha-shell <instancename>
./updatedatabase.pl

6. Restart plack:
sudo koha-plack --restart <instancename>

7. Go to Administration > Global system preferences and search for the
new PrefillGuaranteeField system preference

8. Observe this syspref contains checkboxes and the following are
selected by default:
Contact - Primary email
Contact - Primary phone
Main address - Address
Main address - City
Main address - Country
Main address - State
Main address - ZIP/Postal code
Main address - street number

Please note: 'Contact - Guarantor surname', 'Contact - Guarantor first
name', Contact - relationship' are not in PrefillGuaranteeField syspref
as they are for non Koha patrons and so should not be pre-filled from a Koha
patron.

9. Repeat step 1 and observe the following fields are prefilled from guarantor:
In Main address section -
streetnumber
address
city
state
zipcode/postal code
country

In Contact section -
Primary phone
Primary email

10. In the PrefillGuaranteeField syspref click '[Select all]' checkboxes

11. Repeat step 1 and observe all fields in 'Main address', 'Contact'
(except Guarantor surname, Guarantor first name, and relationship),
Alternate address and Alterate contact are filled from guarantor record.

i.e. The values in guarantor's 'Alternate address' fields fill the
guarantee's 'Alternate address' fields

12. Change a few of the prefilled field values and 'Save' and observe your changes
have been saved in addition to the unaltered pre-filled values in other
fields

13. Amend PrefillGuarantee field syspref to have no checkboxes selected

14. Repeat step 1 and observe none of the fields in Main address,
Contact, Alternate address and Alternate contact are pre-filled

15. Run tests:
sudo koha-shell <instancename>
prove xt
prove t

Sponsored-by: Waitaki Distict Council, NZ
Signed-off-by: Sally <sally.healey@cheshiresharedservices.go.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-06 10:44:23 +01:00
47f9ec9446
Bug 24476: Allow patrons to opt out of auto-renewal
To test:
1 - Verify on staff side that patron can be edited to opt in our out of auto renewal
2 - Check out some items to a patron opted in to auto renewal
3 - Ensure the items are checked out and set to autorenew
4 - Login on the opac at the patron
5 - Verify items cannot be renewed as scheduled for auto-renewal
6 - On staff side, opt patron out of auto renewal
7 - Verify on opac items are no longer marked for auto renewal
8 - Run the auto renewal cron job, items are not renewed
9 - Set 'no renewal before' to a setting that would prevent renewal
10 - Verify that opting patron in or out of auto renewal changes only the reason items cannot be renewed
11 - Set 'no renewal before' to a setting that would allow for renewal
12 - Verify that opting patron in/out changes their ability to renew
13 - Verify that when opted out cron does not renew
14 - Verify that when opted in the item is auto renewed
15 - Reset the due date, opt out, verify manual renewal succeeds

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-24 11:23:47 +00:00
fc430529c1
Bug 20443: Fix creation of new patron with attributes
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:49:23 +00:00
7e1be8d385
Bug 20443: Use search_with_library_limits for attribute types
Dealt with that previously in the module during the rebase.
It conflicted with bug 23281.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:49:22 +00:00
e37bfe3e4b
Bug 20443: Remove extended_attributes_code_value_arrayref AND C4::Members::Attributes
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:49:22 +00:00
37e634bb5b
Bug 20443: Remove C4::Members::AttributeTypes
We do no longer need this package, we can use
Koha::Patron::Attribute::Types directly instead.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:44:41 +00:00
f1d210019b
Bug 20443: Move C4::Members::AttributeTypes::GetAttributeTypes to Koha::Patron::Attribute::Types
We can then now start to move methods from C4::Members::AttributeTypes
as well.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:44:35 +00:00
5dd44a8f08
Bug 20443: Remove CheckUniqueness
There is already a method in Koha::Patron::Attribute to check the
uniqueness constraint, let us it to replace CheckUniqueness

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:44:30 +00:00
ccfc6572f7
Bug 20443: Remove UpdateBorrowerAttribute and SetBorrowerAttributes
This patch replace Koha::Patron->get_extended_attributes with
->extended_attributes
It's now a getter a setter method.

It permits to replace UpdateBorrowerAttribute and use
create_related from DBIx::Class

Notes:
* We face the same variable names difference than in a previous patch
(value vs attribute)

Bug 20443: Remove SetBorrowerAttributes

squash  + RM get_extended_attributes

 RM get_extended_attributes

SQUASH Bug 20443: Remove UpdateBorrowerAttribute and SetBorrowerAttribute

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:44:16 +00:00
9707167a48
Bug 20443: Move GetBorrowerAttributes to Koha::Patron->extended_attributes
The GetBorrowerAttributes subroutine return the attributes for a given
patron.

Using get_extended_attributes we can acchieve it easily. The problematic
here is to restore the method's name (value vs attribute,
value_description vs description of the authorised value, as well as
display_checkout that should not be a method of Attribute, but
Attribute::Type instead)

value_description was used when the attribute types were attached to an
authorised value category. To avoid the necessary test in template and
controller there is now a $attribute->description method that will
display either the attribute's value OR the value of the authorised
value when needed. We should certainly use this one from few other
places.

Notes:
* This patch rename Koha::Patron->attributes with Koha::Patron->get_extended_attributes.
It will be renamed with Koha::Patron->extended_attributes in ones of the next
patches when it will become a setter as well.
* GetBorrowerAttributes did not care about the library limits, we still
do not
* The opac_only flag was not used outside of test, we drop it off.
* To maintain the existing behavior we add a default order-by clause to
the search method [code, attribute]
* From C4::Letters::_parseletter we always display the staff description
of the AV, There is now a FIXME to warn about it
* FIXMEs are not regressions, existing behaviors must be kept
* TODO add a new check to bug 21010 to search for inconsistencies in
patron's attributes attached to non-existent authorised values
* One test has been updated in Modifications.t, order_by is now
by default set to ['code', 'attribute']

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 13:39:25 +00:00
20b38829ce
Bug 23808: (follow-up) Object methods can be used directly, no need for unblessed
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-20 15:25:41 +00:00
6fc82e008c
Bug 23808: Pre-fill guarantor fields when adding guarantee to guarantor
Bug 14570 removed the guarantor pre-fill functionality when selecting
'Add guarantee' to an Adult patron. This is because guarantor
information would now only display if (1) the patron record exists
(which it won't when first adding guarantee to guarantor record) and (2)
if there is already a guarantor added to a guarantee

This patchfix will pre-fill guarantor fields and address fields (so the guarantee
has the same address as the guarantor) if no relationship (existing
guarantor data exists) and a guarantor_id is handed to memberenty.pl in
URL when clicking 'Add guarantee' button on Adults patron record.

Test plan:
1. Add adult patron make sure to fill in their 'Main address' details
2. Select 'Add guarantee'
3. Observe no details of the adult patron are displaying in the
   'Guarantor information' section or 'Main address' sections of memberentry.pl
4. Select 'Search to add', search for your adult patron and choose
  'Select' to add them as guarantor
5. Fill out rest of memberentry.pl and 'Save'
6. Observe adult is showing as the guarantor
7. Apply patch
8. Run tests:
   sudo koha-shell <instancename>
   prove xt
   prove t
9. Confirm tests pass
10. Return to your adult patron
11. Select 'Add guarantee'
12. Observe in 'Guarantor information' and 'Main address' sections of
    memberentry.pl are pre-filled with the 'patron #' (borrowernumber),
    surname, firstname and street number, address, address2 (if you
    filled that in on adults account), city
13. Fill out the rest of memberenty.pl and save and confirm your adult
    patron is showing as the guarantor and the pre-filled address details
    have been saved and are showing
14. Repeat steps 10,11 and 12 and in the 'Guarantor information' select
    'Search to add' and add another adult as guarantor
15. Fill out the rest of memberentry.pl and 'Save' and notice with this
    patch applied you can still add multiple guarantors successfully

Sponsored-by: South Taranaki District Council, NZ
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-20 15:20:47 +00:00
Andrew Isherwood
a2449a81be
Bug 23051: (follow-up) Add renewal feedback and move code to subroutines and test
Rebasing was a nightmare, so I'm squashing the sign off follow-ups to
ease the pain with any future rebases

Includes:

Bug 23051: (follow-up) Refactor renewal code
As per Nick's first point in comment #20, the code that tests for
renewability and renews items has been refactored into it's own
function.

Bug 23051: (follow-up) Provide feedback
For renewals that fail when a fine is being paid off, this patch causes
any errors to be passed back to the template for display.
Addresses the second point in Nick's comment #20

Bug 23051: (follow-up) Fix unit tests
As raised by Nick in comment #35

Bug 23051: (follow-up) Fix/improve feedback
This follow up patch addresses the following parts of Nick's feedback in
comment #35:
- it would be nice to get feedback on what was successfully renewed as well
- In general I think I would prefer to see 'ok' and 'not_ok' returned as
a single 'renewal_results' array
- There is no listing of errors if I use the 'pay' button on an
individual fine

Bug 23051: (follow-up) Refactor methods
This follow up patch addresses the following parts of Nick's feedback in
comment #35:
- I don't really like that the functions are internal functions and then
exported
- I think the pref description should highlight that if 'RenewalPeriodBase'
is set to due date, there may be doubled charges

Bug 23051: (follow-up) Add SIP summary
This follow up patch addresses the following parts of Nick's feedback in
comment #35:
- Ideally SIP would get feedback in a screen message

Bug 23051: (follow-up) Renewing in OPAC
This follow up patch addresses the following parts of Nick's feedback in
comment #35:
- I am also not sure about the code path if a patron paid fines on the
opac (via paypal etc.) but renewals are not allowed on the opac.

We've introduced the syspref RenewAccruingItemInOpac (default is off)
which, when enabled, will cause items attached to fines that are paid
off in the OPAC (via payment plugins), to be automatically renewed.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-06 10:03:34 +00:00
87ff988393
Bug 24081: Add discount action to boraccount
This patch adds the ability to apply discounts to existing patron
charges from the boraccount page.

Test plan
1/ Carry out some accounting actions that end up with debts on the
patron record. (Add a manual invoice for example)
2/ Note a new 'Apply discount' action button on the unpaid debt
3/ Paid debts do not display the action button
4/ Click the button
5/ Enter an amount into the resulting modal and click confirm
6/ Confirm that the outstanding debt has been reduced by the amount you
specified.
7/ Confirm that a new 'Discount' line appears on the patrons account
8/ Confirm that in the 'details' view of the debt that the discount line
was used against the debt to create the reduction.
9/ Signoff

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-04 14:46:22 +00:00
Nazlı Çetin
d296876626
Bug 21879: Code cleaning in printinvoice.pl
Coming from
  commit 51aa6db46c
  Bug 12001: Move GetMemberAccountRecords to the Koha namespace

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-26 20:42:56 +00:00
7d8b96803f
Bug 24545: Fix license statements
Bug 9978 should have fixed them all, but some were missing.
We want all the license statements part of Koha to be identical, and
using the GPLv3 statement.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:31:26 +00:00
0d91f9e72b
Bug 22359: Prevent undercollection at the server
This patch adds some additional handling to prevent undercollection of
fees at the server side.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-21 15:39:41 +00:00
Julian Maurice
50a733f09c
Bug 17702: Add UI to manage account credit types
It is the same as for debit types.

It adds a new column `archived` in table `account_credit_types` that has
the same purpose than `account_debit_types.archived`

Test plan:
0. Apply patch && run updatedatabase && update_dbix_class_files
1. Go to Admin » Credit types
2. Add a new credit type, give it a code and a description and check
   'Can be manually added'
3. Go to a patron's accounting section, 'Create manual credit' tab
4. Verify that the new credit type appears
5. Return to Admin » Credit types and archive the credit type
6. Verify that the new credit type is not available anymore in 'Create
   manual credit'
7. Restore the credit type and verify that it is available again
8. Create a manual credit with the new credit type
9. Go to Reports » Cash register and make sure you can find the
   transaction by filtering on transaction type
10. Edit the new credit type and set some library limitations, make sure
    that the credit type doesn't appear if you're connected to a library
    you didn't selected, and that it appears if you're connected to a
    library you selected.

Note to QA team:
The change in Koha/Account.pm, I added it because otherwise Koha died
when adding a manual credit with a custom type.
In that case, offset type will default to 'Manual Credit'. I'm not sure
if that is the best thing to do. I'm open to suggestions :)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-20 14:46:33 +00:00
Julian Maurice
24154f2ec9
Bug 14898: Add button at manual invoice to redirect to pay tab
Test plan:
1. Create manual invoice for any patron and click on "Save", you should
   be redirected to Account tab
2. Create manual invoice for any patron and click on "Save and pay", you
   should be redirected to Account tab

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-20 09:04:27 +00:00
ae53caa681
Bug 22868: Move suggestions_manage subperm out of acquisition perm
Bug 11911 replaced the permission of suggestions.pl (create a purchase
suggestion) from catalogue => 1 to acquisition => 'suggestions_manage'.
However we have a lot of acquisition scripts that have lax permissions
(acquisition => '*' which means any sub permissions of acquisition is
enough).

That causes problem when a circulation staff can create purchase
suggestions but not access acquisition information.

One solution is to move the suggestions_manage subpermission out of the
acquisition permission and create a new suggestion permission.

Test plan:
0. Setup
* Create a patron with several permission (and full acquisition
permission)
* Create another patron with several permission, and suggestions_manage
permission
* Create another patron without the suggestions_manage permission
1. Apply the patch and execute the update database entry
2. Note that the third patron you create still does not have
suggestions_manage
3. Confirm that you can create a purchase suggestion if you have
suggestions_manage, but cannot access acquisition pages if you do not
have any subpermissions of the acquisition permission

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-30 08:27:00 +00:00
Julian Maurice
0e73e723ef
Bug 19809: Re-allow to call Koha::Objects::find in list context
and remove 'scalar' keyword in calls where it's not needed.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-23 10:27:28 +00:00
94ba314d58
Bug 24008: Remove minus sign when displaying credit value
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-20 14:03:52 +00:00
e6e039c7c7
Bug 24008: Display a warning message when deleting a patron with outstanding credits
So far nothing is displayed if a librarian removes patron with
outstanding credits.
Note that outstanding debits blocks the deletion.

Test plan:
- Create a patron with outstanding credit
- Create a patron with outstanding debits
- Delete the 2 patrons
=> With credit - You get a warning but do not block the deletion
=> With debits - You get a warning message that blocks the deletion

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-20 14:03:52 +00:00
eaee34f47a
Bug 24018: Remove die "Not logged in"
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-20 14:03:49 +00:00
454d4745b7
Bug 23354: (follow-up) Make display of debit types configurable
This patch adds a the ability to define where a debit type will be
available as a option for use.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-13 14:05:14 +00:00
199d2c56b7
Bug 23442: Add refund option to patron account page
This enhancement adds a refined workflow to allow librarians
to refund payments to patrons and record these refunds on the
patrons account.

The use case is that a patron has paid for something before
then performing an action that may require some level of refund
to be actioned.  Perhaps they are returning a lost and paid for
book.

Test plan:
1) Undertake a series of transactions that result in a debit
   accountline being partially or fully paid off.
2) Note that a new 'Issue refund' button appears next to a
   debit (but only if your user has the refund permission or
   is a superlibrarian)
3) Click the 'Issue refund' button and a modal should appear
   pre-populated with the amount - amountoutstanding.
4) You should be able to edit the amount you wish to refund,
   record the refund or cancel.
5) Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-10 08:41:18 +00:00
8610368725
Bug 24080: Add payout option to patron account page
This enhancement adds a refined workflow to allow librarians to pay out
money to patrons and record these payouts on the patrons account.

The use case is that a patron has somehow accrued credit, through a
refund perhaps, and the library wants to be able to physically hand over
some money to balance the patrons account.

Test plan:
1) Undertake a series of transactions that result in some outstanding
   credit on a patrons account.
2) Note that a new 'Issue payout' button appears next to a credit with
   an outstanding balance (but only if your user has the payout
   permission or is a superlibrarian)
3) Click the 'Issue payout' button and a modal should appear
   pre-populated with the amountoutstanding.
4) You should be able to edit the amount you wish to payout, make
   payment or cancel.
5) Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-03 16:35:45 +00:00
7f6f4f3c68
Bug 24113: guarantor info lost when a duplicate is found
When a patron is created with a guarantor but a duplicate is found (or any other warnings I guess) the guarantor's info are lost.

This patch improves on previous functionality by retaining the select guarantor relationship as well.

Test Plan:
1) Create a new child with a name already used, add a guarantor
2) Attempt to save, no the guarantor is not shown when the editor is redisplayed
3) Apply this patch
4) Restart all the things!
5) Repeat 1
6) Note the guarantor is retained and the relationship is as well!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-27 07:51:04 +00:00
fc7da400ac
Bug 24100: (bug 23788 follow-up) Capitalization correction
Correct the capitalization of the class name introduced in bug 23788.

Test plan:
1) Prior to patch attempt to 'pay off selected' - Note a server error
2) Apply patch
3) Attempt to 'pay off selected' - Note it now works as expected.
4) Signoff

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-25 17:03:41 +00:00
d23e50f0b2
Bug 23822: Fix deletion of patrons with credit
There are bugs in both master and 19.05, but different.

Anyway we should have this check to make sure a negative value will have
the same behavior: trigger the confirmation message (instead of a blank
page).

If we want to reject the deletion of a patron with credit we should
handle it on a separate bug report (behavior change)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-13 16:23:04 +00:00
5ef116c58d
Bug 23788: Recalculate ammount due for selected accountlines
Individual fees cannot be overpaid of over-written off, but it's possible to 'overpay' a writeoff of selected fees.

Test Plan:
1) Create 3 fees
2) Pick 2 and choose "Write off selected"
3) Write off more than the total amount of those fees
4) Apply this patch set
5) Restart all the things!
6) Try again, you should no longer be able to!

Signed-off-by: Sean McGarvey <seanm@pascolibraries.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-11 10:32:45 +00:00
4975e8b958
Bug 23788: Rename $select_lines to $selected_lines
Signed-off-by: Sean McGarvey <seanm@pascolibraries.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-11 10:32:41 +00:00
059788e736
Bug 23788: Rename $select to $selected_accts
Signed-off-by: Sean McGarvey <seanm@pascolibraries.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-11 10:32:35 +00:00
d51aeb7f9b
Bug 23806: FinePaymentAutoPopup does not trigger pop-up for writeoff by "Write off" button
Test Plan:
1) Enable reciept popups for payments and writeoffs
2) Test the "Write off" button, no popup
3) Apply this patch
4) Restart all the things!
5) Test again, you should get the popup!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Sean McGarvey <seanm@pascolibraries.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-07 13:26:29 +00:00
Katrin Fischer
cd3ef03e76
Bug 21939: Fix permissions for holds history tab
The tab will show when the staff user has edit_borrowers
permission, but the page itself will not be accessible.
This patch fixes the page permissions to allow access
with the edit_borrowers permission as suggested by the
comments on the original bug report.

To test:
- Create a staff user with only "edit_borrowers" permission
  from the borrowers module
- Try to access the holds history tab from any patron account
- Verify you are blocked
- Apply patch
- Try again and verify the page is accessible now
- Repeat with superlibrarian and full borrowers permission.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-07 13:22:03 +00:00
291f03fe65
Bug 14697: Enhance the return claims feature
This adds a "Claims returned" feature that extends and enhances the claims returned lost status.
To use this feature, a new LOST status to represent an item claimed as returned needs to be created.
The value of this LOST authorised value should be set in the new syspref ClaimReturnedLostValue.
Setting this system preference turns on the feature.

Once the feature is enabled, you should be able to mark checked out items as return claims from the
checkout and patron details pages, and also modify them from the new claims tab on those pages.

Returning a claimed item will notify the librarian that the item in question has a claim on it.

Setting the ClaimReturnedWarningThreshold will add an alert to make librarians aware that this
patron has many return claims on the patron's record.

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim

Sponsored-by: North Central Regional Library System
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-31 12:04:21 +00:00
Magnus Enger
c98c1994ea
Bug 22706: Add plugin hooks for Norwegian national patron database
The main point of this patch is to make it possible to integrate Koha
with the Norwegian national patron database (NNPDB). Code for this was
earlier introduced in Bug 11401 and removed again in Bug 21068.

To test this is mainly a question of spotting regressions, it should
still be possible to set and change a password in all possible ways:
- Setting a password for a new user
- Changing a password in the staff client
- Changing a password in the OPAC
If these work as expected, everything should be OK.

A nice side effect of this work is that it will allow for plugins that
validate passwords. I have created a tiny plugin that enforces PIN
codes of 4 digits. (Yeah, I know, those are the worst passwords, but
some libraries do require them.) It is published here:
https://github.com/Libriotech/koha-plugin-pin
To test this way, install the plugin and try to change the password
of an exsisting user to something that is not a 4 digit PIN. You
should get an error that says "The password was rejected by a plugin".

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Updated 2019-10-23:
- Moved the plugin checks to before the call to $self->SUPER::store to
  make sure patrons are not saved if the password fails a plugin check
- Made the plugin checks in set_password respect skip_validation while
  retaining the functionality for NNPDB

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-29 12:19:49 +00:00
12568a20db
Bug 23805: Update mancredit to use the new credit types
Test plan
Ensure the manual credit page continues to work as it did before this
patchset.

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-24 17:35:21 +01:00
5fbf423e94
Bug 23805: Update 'W' to 'WRITEOFF' for consistency
Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-24 17:35:20 +01:00
6bfd41eb0a
Bug 23805: Update 'Pay' to 'PAYMENT' for consistency
Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-24 17:35:20 +01:00
aec46d0c3c
Bug 23049: (QA follow-up) Correction for missed archived filter
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-24 17:25:15 +01:00
d661141890
Bug 23049: Update existing code to use debit_type
* Update C4::Accounts::chargelostitem
* Update C4::Accounts::manualinvoice
* Update C4::Circulation::_FixOverduesOnReturn
* Update C4::Circulation::_FixAccountForLostAndReturned
* Update C4::Overdues::UpdateFine
* Update C4::Overdues::GetFine
* Update C4::Overdues::GetOverduesForBranch
* Update Koha::Account->pay
* Update Koha::Account->add_debit
* Update Koha::Account->non_issues_charges
* Update Koha::Account::Line->apply
* Update Koha::Account::Line->adjust
* Update controller scripts
* Update reports scripts
* Update tests

Test Plan
1) Run the test suit and ensure everything still passes
2) Test reports/cash_register_stats still works
3) Test that adding manual invoices still works
4) Test that making payments still works
5) Test that lost item fee handling still works
6) Test that invoice printing still works
7) Test that the sco still works

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-24 17:24:15 +01:00
f48a467fbc
Bug 23049: Update maninvoice to reference debit types
Test plan:
1) Naviage to a patron record and select the accounts > manual invoice
   tab
2) Add some manual invoices and confirm they are working as expected
3) Signoff

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-24 17:24:06 +01:00
ae075fded2
Bug 17140: Make rounding syspref controlled
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-11 10:52:44 +01:00
Blou
c2df905bfe
Bug 17140: fix rounding errors when paying fines
Whenever a fine (accountlines in DB) has a precision longer than two floating points, it becomes very hard for a user to clear it.
Ex: 1.035 will be displayed as 1.04 or 1.03 depending on the screen.  But entering any of those value in Pay Fine will not clear it.
The user has no way to know the exact value to enter.

This fix makes sure that the intent of the user is met, by matching the EXACT needed sum when the difference is less than 0.01.

TEST
1) Create a 1.035 fine
  - Go to a Patron screen
  - Fines tab on the left
  - Create manual invoice
2) go to Pay fines, click Pay amount on bottom left.
3) It will show 1.03 as Total, and as Collect from patron.  Click confirm.
4) An error message will appear.
5) Apply patch, do again.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-11 10:52:35 +01:00
Katrin Fischer
30627be138
Bug 23697: (QA follow-up) Rename PatronAutocompletion to PatronAutoComplete
Just a find and replace on the changed system preference name.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-08 14:51:12 +01:00
Matthias Meusburger
e5bf671357
Bug 23697: (follow-up) Add autocompletion search in patron module
- Rename CircAutocompl system preference to PatronAutocompletion
 - Take this system preference into consideration for patron search

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-08 14:51:04 +01:00
1feb110d05
Bug 23507: Add ability to show change given on auto-popup fee receipt from FinePaymentAutoPopup
Some libraries would like to show the amount of change given on print reciepts triggered by FinePaymentAutoPopup
so the patron can verify he or she has recieved the correct amount of change.

1) Apply this patch
2) Edit ACCOUNT_CREDIT slip and add "[% IF change_given %]<h1>CHANGE: [% change_given %]</h1>[% END %]" at the top
3) Enable FinePaymentAutoPopup
4) Make a payment
5) Note the change given is shown on the popup receipt
6) Note the change given is *not* shown on subsequent prints of the same receipt using the "print" button for the payment

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Hasina Akhte <hasinaa@pascolibraries.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-08 14:47:39 +01:00
Dobrica Pavlinusic
43d999cc7c
Bug 23723: using exit inside eval to stop sending output to browser doesn't work under plack
When fixing Bug 23589 Theodoros Theodoropoulos noticed that we are sending
headers and html after pdf output to browser.

Using exit inside eval block doesn't stop plack from generating
headers and html page after exit since CGI::Compile will catch
exit but doesn't stop emiting output. Example is:

eval {
	warn "in eval";
	exit;
};
warn "after eval";

Under CGI, this would print just "in eval", but under plack we get both lines
and thus generate additional header and html after we already sent pdf data.

Signed-off-by: Theodoros Theodoropoulos <theod@lib.auth.gr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-07 12:21:30 +01:00
57a93704c0
Bug 23321: (follow-up) Require cash registers for payments
This follow-up catches the case where no cash registers have been
defined for the current branch and as such payments cannot be processed.

Test plan:
1) Ensure you have 'UseCashRegisters' set to 'Do'
2) Attempt to make a payment for a fee whilst logged into a branch that
   has not yet had cash registers configured.
3) Note that you are shown a warning and cannot proceed.
4) Signoff

Sponsored-by: PTFS Europe
Sponsored-by: Cheshire Libraries Shared Services

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-09-23 11:39:22 +01:00
1a740fda1e
Bug 23321: Add cash register support to paycollect
This patch ties in the cash registers system to the paycollect payment
pages in the staff client.

Test plan:
1) Add some manual fees to a test patron
2) Select some fees to pay off
3) Note the addition of a select box for selecting your cash register
   upon payment.
4) Set a branch default cash register for the current branch
5) Repeat step 3 and note that the pre-selected cash register is the one
   set in step 4.
6) Unset the branch default cash register for the current branch
7) Repeat step 3 and note that there is no cash register pre-selected
8) Set 'UseCashRegisters' to 'Do not'
9) Repeat step 3 and note that there is no longer an option to select a
   cash register
10) Signoff

Sponsored-by: PTFS Europe
Sponsored-by: Cheshire Libraries Shared Services

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-09-23 11:39:22 +01:00
9247a33f86
Bug 23321: Add cash register permission
Sponsored-by: PTFS Europe
Sponsored-by: Cheshire Libraries Shared Services

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-09-23 11:39:21 +01:00
3ab5d3b125
Bug 14570: Remove wrong parameter in add_guarantor call
This patch just removes an unused parameter.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-08-20 16:06:06 +01:00
Agustin Moyano
53b3ebe9d0
Bug 14570: (follow-up) fix qa FAIL tests
Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-08-20 16:05:14 +01:00
109334102f
Bug 14570: Make it possible to add multiple guarantors to a record
This patch adds the ability to set an unlimited number of guarantors
for a given patron. As before, each guarantor may be linked to another
Koha patron, and all the behavior that applies to a given guarantor
remains the same.

Test Plan:
 1) Apply this patch
 2) Run updatedatabase.pl
 3) Find some patrons with guarantors, verify the still have their guarantor
 4) Test adding and removing guarantors on a patron record, both Koha users and not
 5) Verify the "Add child" button works
 6) Verify NoIssuesChargeGuarantees still works
 7) Verify tools/cleanborrowers.pl will not delete a guarantor
 8) Verify the guarantors are displayed on moremember.pl
 9) Verify the guarantor is removed by members/update-child.pl
10) Verify the guarantor is removed by misc/cronjobs/j2a.pl
11) Verify import patrons converts guarantor_id, relationship, contactfirstname,
  and contactsurname into a guarantor
12) prove t/Patron.t
13) prove t/db_dependent/Circulation.t
14) prove t/db_dependent/Circulation/NoIssuesChargeGuarantees.t
15) prove t/db_dependent/Items.t
16) prove t/db_dependent/Koha/Patrons.t
17) prove t/db_dependent/Members.t
18) prove t/db_dependent/Patron/Relationships.t

Signed-off-by: Kim Peine <kmpeine@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-08-20 16:04:48 +01:00
1bc1642b94
Bug 23228: Add option to automatically display payment receipt for printing after making a payment
Some libraries would like an auto-popup after making a payment so librarians don't have
to navigate to the accounts page, locate the new payment, then click the print button.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Make a payment, note no difference in behavior
4) Enable the new syspref FinePaymentAutoPopup
5) Make a payment, note the popup for the payment receipt

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-08-08 15:27:11 +01:00
Emmi
07af7b228f
Bug 23219: Cancel patrons holds when patron delete
Currently deleting a patron deletes all their holds and leaves
no record to the "old_reserves" table.

 Steps to reproduce:
- Create a patron
- Add holds for patron
- Holds are recorded to "reserves" table
- Delete patron
- Confirm delete
=>Patron and all holds are deleted and no record of holds is
left in "old_reserves" table

This patch displays alert text notifying user that deleting patron
cancels all their holds. Holds are cancelled instead of deleting them.
This patch also writes stringified datetime to holds cancel log instead
of whole datetime object.

To test:
- Apply this patch
- Create a patron
- Add holds for patron
- Holds are recorded to "reserves" table
- Delete patron
- Alert text of holds is displayed
- Confirm patron delete
=> Patron is deleted, their holds are cancelled and moved to
"old_reserves" table

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nadine Pierre <nadine.pierre@inLibro.com>
Signed-off-by: Arthur Bousquet <arthur.bousquet@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-15 12:48:36 +01:00
17a71b9900
Bug 21027: Fix checkout statistics if 1+ of the fields is not defined
TEST

- Use a patron who hasn't checked out items before
- Set  StatisticsFields to itype|ccode
- Check out some items without location
- Verify that statistics stable shows the correct number of checkouts
- Check out one item with a location or just change one of your checked out items
- Verify the total is still correct
- Change  StatisticsFields to location|itype|ccode
- Verify the total has changed now - it's only 1 (the one with a location)

Apply the patch and try again

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-15 12:25:15 +01:00
fa390ca232
Bug 23199: Koha::Patron->store must check 'uppercasesurname' syspref
Test plan:
1/ set uppercasesurname to 'Do'
2/ register a new patron using the REST API with lowercase surname
3/ verify the surname is not saved in uppercase
4/ apply patch
5/ repeat 2
6/ verify the surname now is saved to uppercase

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-05 08:43:44 +01:00
0f83de1669
Bug 21801: (follow-up) Use ->account
This patch is a minor refactoring, that reuses the $account object we
already get from $patron, instead of creating new ones all over the
place. Code gets simpler to read too.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-04 13:56:31 +01:00
9bdd6a0990
Bug 21801: Make paycollect.pl pass library_id when calling ->pay
This patch makes paycollect store the branchcode of the current library
when payments are done.

- Try all the possible options, specially selecting things to pay for (not
using the individual buttons).
- Check on the DB, that the  accountlines for the patron you're playin
with have the branchcode stored correctly in all cases:
  $ sudo koha-mysql kohadev
  > SELECT * FROM accountlines WHERE borrowernumber=<the_bn>;
=> SUCCESS: Things are as expected
- SIgn off :-D

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-04 13:56:24 +01:00
29da30e1d4
Bug 17492: (RM follow-up) Use more specific method name
Changed the method introduced into Koha::Patron from is_category_valid
to the more specific is_valid_age to clarify it's intent to future
developers.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-01 16:06:42 +01:00
Radek Šiman
e30f09af91
Bug 17492: Add a warning about age being of-limits and a button to update it
This patch adds a warning if a patron's age is out of limits if an assigned category.
It also adds a button allowing to change the category.

Test plan:
1) Apply patch
2) Create a patron and assign him a category having age limits set
3) Change patron's age to be older/younger than category's limits
4) At "Check out" and "Details" tabs you should see a warning with a
button allowing to change the category, eg.:
 - http://prntscr.com/cz7ch3
 - http://prntscr.com/cz7em4
 - http://prntscr.com/cz7dj1
5) Set a valid category according to patron's age
6) Warning should disappear
7) Perform similar test again, but instead of changing the age change
the limits of a category
8) During tests verify "Change category" button everytime opens "Modify
patron" page:
  http://prntscr.com/cz7g5q
9) Ensure that left-side panel is always on its expected place
10) Remove patron's date of birth and test that all categories are
allowed now
11) Run automated tests: prove t/db_dependent/Koha/Patron.t

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-01 15:20:00 +01:00
8947d5939f
Bug 23082: Fatal error editing a restricted patron
In members/memberentry.pl we have to explicitely remove the template's
params that are not patron's attributes.

Certainly caused by
  commit 1bb6cec902
  Bug 20287: Fix update of patrons, clean the data before ->store

Test plan:
Create a restriction for a patron
Edit patron's details
Remove the restriction
=> Without this patch you get "No property remove_debarment for
Koha::Patron"
=> With this patch applied the restriction is removed

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-06-25 16:49:16 +01:00
Pasi Kallinen
f3358e97c8
Bug 22910: Do not copy unique patron attributes to duplicated patron
When creating a new patron by duplicating another, all of the patron
attributes are also copied into the form. Some of those value may be
unique, so don't copy those.

1) Create patron attribute types, one with "unique identifier", one without.
2) Create or a patron so it has values in both of those attributes.
3) Duplicate the patron
4) The edit form should retain the values from the "original" patron.
5) Apply patch.
6) Duplicate the patron - this time the attributes with unique values
   are cleared.

Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-06-06 16:03:26 +01:00
3034c02826 Bug 22724: Check permissions in the script before displaying template
Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-05-30 10:09:06 +00:00
ef44634a8d Bug 21312: Show lockout on Patrons form
Just what the title says :)
Specifically: moremember.pl

Test plan:
Check if you see the locked message on the patron form for an account
that has been locked. (Either login_attempts<0 or >FailedLoginAttempts)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jose-Mario Monteiro-Santos <jose-mario.monteiro-santos@inLibro.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-05-10 18:01:36 +00:00
a308dbcffd Bug 22809: Move "INVOICE" from template to a slip
Just as bug 22761 moves the "Fee receipt" to the ACCOUNT_CREDIT slip, we need to move the "INVOICE" to an ACCOUNT_DEBIT slip.

Test Plan:
1) Apply this patch set
2) Restart all the things
3) Use the "print" button beside a *fee*
4) You should not see any difference from before the patches were applied

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-05-10 14:39:39 +00:00
74bc51523a Bug 22761: Add ability to use print version of ACCOUNT_CREDIT slip
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-05-10 14:11:32 +00:00
9fff134de6 Bug 21757: (folow-up) Restore patron brief detail page
Test plan
1) Try to create patron with same name/datefobirth to trigger the
duplicate patron check
2) Click on "View existing record" link on "Duplicate patron record?"
alert message
3) You should see the patron data, but withou toolbar, menu, and so on.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-29 12:12:40 +00:00
dd4877706a Bug 21757: Clenup of moremember.pl and its templates
This patch:
  - removes unused templates
  - use objects as much as possible
  - remove many template params

Test plan:
1) Apply the patch
2) Play with patron detail page and try to broke it anyhow ;)
- messaging preferences
- enhanced attributes
- guarantors and guarantees
- fines
- messages
- checkouts
- overdues
- use different date formats, price formats and address formats
- ... there is many thinks you could try with this one page ;)

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-29 12:12:40 +00:00
Kris Sinnaeve
086a0007d2 Bug 22139: Fields of ACCTDETAILS email not populating
To test:
* Make sure AutoEmailOpacUser is set to "send"
* Create a new patron with a username and password, and an email address
* In Kohadevbox, check the mail (usually you can type "mail" and go down
to the last message) - these do not go into the message queue and they
are processed immediately.
notice that the email does not have
<<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>

Apply this patch, restart the things, retest as above.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-18 09:56:43 +00:00
ea7245631e Bug 21013: Missing itemtype for checkut makes patron summary print explode
This patch moves retrieval of the item type description from the script
to the template using the ItemTypes template plugin.

To test, apply the patch and locate an item which is checked out to
someone. Modify the database record for that item to remove the item
type (items.itype).

View the print summary for the patron who has that item checked out. The
page should display correctly. Checked-out items which have an item type
should show that item type description correctly.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-10 20:09:50 +00:00
9ec4d86636 Bug 22600: Add 'interface' to accountlines
This patch adds the 'interface' field to the accountlines table and
updates all Koha::Object routines and calls to use it.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-10 19:43:11 +00:00
3c69e084d7 Bug 12159: (QA follow-up) Remove double use module
Speaks for itself.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-28 13:05:22 +00:00
4fe300dec1 Bug 12159: Fix getting extended patron attributes for circ-menu
Changes:
- Replace getting preference ExtendedPatronAttributes by Koha.Preference
in templates
- Add Koha::Patron->attributes for getting patrons extended attributes
- Use this method in circ-menu.inc
- Remove getting attributes from members perl scripts

Test plan:
0) Apply the patch
1) Add some patron attributes type - with free text, authorised value,
    limited by libraries...
2) Add some values to this attributes for some patrons
3) Go through as many patron pages as you can and confirm that
attributes are shown at side panel when they shoul and are not shown
when they should not be shown

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Removed Koha/Schema/Result/BorrowerAttribute.pm
[EDIT] Added missing semicolon on L114 in Koha/Patron/Attribute.pm

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-28 13:05:22 +00:00
Andrew Isherwood
17e72b2b1c Bug 18589: (follow-up) Remove redundant-ness
Following feedback from Josef via IRC, removing redundant code

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-22 20:21:47 +00:00
Andrew Isherwood
daac852c04 Bug 18589: Show ILLs as part of patron profile
This patch moves the display of a patron's ILL requests to be inline in
the Patron Profile page, as per all other patron information.

It includes a substantial refactor of
koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt in that it
moves the display of the illlist table (which is populated by an API
request) into it's own separate include file. It also moves the
datatable related Javascript for this table into it's own JS file. Doing
this allows us to reuse both in both the new members/ill-requests.tt
template and the pre-existing ill/ill-requests.tt template.

To test:
1) Ensure ILL is enabled and your user has sufficient permissions
2) Ensure your user has some ILL requests
3) Navigate to the user's patron profile page
4) Click on the "Interlibrary loans" tab
5) Observe that the requests table is displayed inline
6) Observe that only your user's requests are displayed

Signed-off-by: Niamh.Walker-Headon@it-tallaght.ie

This is essentially a reimplementation of attachment 84796 to take into
account all changes that had happened beneath this bug and also to
ensure JS strings are translatable.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-22 20:21:46 +00:00
Liz Rea
478f2392ce Bug 22533: Fix manual invoices from patron accounting
To test:
Attempt to create a manual fine from the patron accounting page, it
should fail.
Apply this patch, restart the things
Attempt to create a manual fine from the patron accounting page, it
should succeed.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-22 18:57:00 +00:00
6e3da5397e Bug 21683: Remove accountlines.accountno
Test plan:
1) Play with fines, should work OK
2) Try to print receipts on fines - prinfeercpt.pl, printinvoice.pl
3) git grep getnextacctno -> no occurences
4) git grep accountno should return only:
  installer/data/mysql/atomicupdate/bug_21683_remove_column_accountno.perl
  installer/data/mysql/update22to30.pl
  misc/release_notes/release_notes_3_10_0.txt
  misc/release_notes/release_notes_3_22_0.txt
5) prove
  t/db_dependent/Accounts.t
  t/db_dependent/ILSDI_Services.t
  t/db_dependent/Stats.t
  t/db_dependent/Koha/Account.t

Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-21 18:19:22 +00:00
7c38f63d85 Bug 19489: (QA follow-up) Revert changes in printinvoice
It would be change behaviour, libraries are often using POS printers and
wider table could make a problem for them and break theirs workflow.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-11 12:45:58 +00:00
9e6d6f4e7c Bug 19489: (QA follow-up) Remove passing issue_id in pay form
This is not needed

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-11 12:45:58 +00:00
Nazlı Çetin
add47bf472 Bug 19489: Change method name issue --> checkout
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-11 12:45:58 +00:00
Nazlı Çetin
6338bf19a8 Bug 19489: Detailed Description of charges in Patron accounting
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-11 12:45:58 +00:00
Katrin Fischer
3c2cc8da26 Bug 22120: Add price formattig to patron summary print
The patron summary print lists the replacement prices
and rental charges of items and totals them. With this
patch they will be formatted according to the
CurrencyFormat system preference.

To test:
- Find or create a patron with some checkouts
- Make sure some items have replacement price set
  and some have a rental charge
- "Print summary" from the account in staff
- Verify that charges and prices in the checkouts
  table are formatted correctly
- Toggle CurrencyFormat to different settings

Signed-off-by: helene hickey <hickeyhe@wgc.school.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-11 18:30:10 +00:00
0f83ac98c7 Bug 22253: Check we actually need to update the password
This patch makes memberentry.pl check if password needs to be updated
before attempting to call set_password. Above this there's a check that
won't raise any errors if no password is passed, or the default string (****) is received.

So we could reach that line of code with no password, but the code
wouldn't check that.

To test:
- In master, edit any patron without changing the password
=> FAIL: It raises an exception
- Apply this patch
- Edit the patron withtout changing the password
=> SUCCESS: Edit successful
- Edit the patron, changing the password
- Try to login with the new password
=> SUCCESS: The password got changed correctly
- Sigh off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-04 13:44:29 +00:00
0e7b449ca8 Bug 22134: (follow-up) Simplify check for expired patron
This patch move the check for "is_expired" to the template and removes
unnecessary code from the script.

The page now correctly handles messages for patrons who are about to
expire, as defined in the NotifyBorrowerDeparture preference.

To test, apply the patch and locate a patron record which is expired.

 - On the patron detail page (members/moremember.pl) you should see a
   message at the top of the page.
 - In the body of the page, next to the expiration date information, you
   should see similar message and links.

Select a patron who will expire within the period defined in
NotifyBorrowerDeparture.

 - On the patron detail page you should see a message at the top of the page.
 - In the body of the page, next to the expiration date information, you
   should see similar message and links.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>

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

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-28 14:51:41 +00:00
e193254e35 Bug 22134: Add account expiration information to patron details
This patch modifies the patron detail template in the staff client so
that when a patron's registration is expired a message shows at the top
of the page along with the same "Renew" and "Edit" links which appear on
the checkout page. Links are also shown next the the expiration date in
the body of the page.

This patch also corrects the capitalization of the "Edit Details" link
on circulation.tt.

To test, apply the patch and locate a patron record which is expired.

 - On the patron detail page (members/moremember.pl) you should see a
   message at the top of the page.
 - In the body of the page, next to the expiration date information, you
   should see similar message and links.
 - On the patron's checkout page the "Edit details" link in the
   expiration message should have correct capitalization.

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>

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

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-28 14:51:41 +00:00
094a1cb070 Bug 22066: Record library_id for manual credits
On creating manual credits, the (newly introduced) branchcode should be
set now. This trivial patch makes it work.

To test:
- Create a manual credit for a known patron
- Using MySQL check the result:
  $ sudo mysql
  > SELECT * FROM accountlines WHERE borrowernumber=<known_id>;
=> FAIL: The created accountline row has NULL for the branchcode
- Apply this patch
- Create a manual credit for the patron
- Run:
  > SELECT * FROM accountlines WHERE borrowernumber=<known_id>;
=> SUCCESS: branchcode is set correctly
-Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-28 13:06:26 +00:00
b990b953b3 Bug 21993: Display a user-friendly message when the CSRF token is wrong
Instead of dying!

Test plan:
Assuming you have a patron with borrowernumber=51 and another one that
can be deleted with borrowernumber=42

- authorities-home.pl
 * Delete an authority record
 * hit /cgi-bin/koha/authorities/authorities-home.pl?op=delete

- basket/sendbasket.pl
 * Send a basket to someone
 * hit /cgi-bin/koha/basket/sendbasket.pl?email_add=1

- members/apikeys.pl
  * Generate and delete an API key for a patron
  * hit /cgi-bin/koha/members/apikeys.pl?patron_id=51&op=delete

- members/deletemem.pl
  * Delete a patron
  * hit /cgi-bin/koha/members/deletemem.pl?member=42&op=delete_confirmed

- members/mancredit.pl
  * Add a manual credit
  * hit /cgi-bin/koha/members/mancredit.pl?borrowernumber=51&add=1

- members/maninvoice.pl
  * Add a manual invoice
  * hit /cgi-bin/koha/members/maninvoice.pl?borrowernumber=51&add=1

- members/member-flags.pl
  * Change permissions for a patron
  * hit /cgi-bin/koha/members/member-flags.pl?member=51&newflags=1

- members/member-password.pl
  * Change the password for a patron (from the staff interface)
  * hit /cgi-bin/koha/members/member-password.pl?member=51&newpassword=aA1

- members/memberentry.pl
  * Edit some patron's info
  * hit /cgi-bin/koha/members/memberentry.pl?borrowernumber=51&op=save

- members/paycollect.pl
  * Pay an individual fine
  * hit something like /cgi-bin/koha/members/paycollect.pl?borrowernumber=51&pay_individual=1&accounttype=L&amount=1.00&amountoutstanding=1.00&accountlines_id=157&paid=1
  You may need to edit some values

- tools/import_borrowers.pl
  * Import some patrons
  * hit /cgi-bin/koha/tools/import_borrowers.pl?uploadborrowers=1

- tools/picture-upload.pl
  * Upload an image for a patron
  * You will need to edit the html content
  hit Home › Tools › Upload patron images
  then locate the csrf_token input and modify its value

Note for QA:
- Opac is not done as blocking_errors.inc does not exist for this
interface
- ill/ill-requests.pl
I did not manage to replace this occurrence

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-25 20:38:32 +00:00
c425a003fd Bug 22048: Use set_password in memberentry.pl
To test:
- Verify that changing the password and userid of a patron by globally
editing they works,

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-25 20:15:29 +00:00
abea0ea9d2 Bug 22048: Use set_password in member-password.pl
This patch makes member-password.pl use $patron->set_password instead of
update_password. The side effect is that setting password and userid
become separate steps in the code.

For the password all the initial checks are the same, but password
strength is checked on calling set_password and an exception is thrown.
So instead of checking the password quality, we just wait for exceptions
and behave the same as before.

Bonus: you will notice I reused the initially fetched $patron object.
Things get simpler :-D

To test:
- Verify that changing the password / userid for a patron works as usual

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-25 20:15:28 +00:00
0693052bfc Bug 21915: Call reconcile_balance on manual credit creation
This patch makes the manual credit creation step call
Koha::Account::reconcile_balance when the AccountAutoReconcile syspref
is set.

To test:
- Apply the patch
- Have some outstanding debits
- Create a manual credit
=> SUCCESS: Same behaviour as always
- Set AccountAutoReconcile
- Create a manual credit
=> SUCCESS: Reconcillation happened
- Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-04 03:13:40 +00:00
0c43fa326a Bug 21915: Call reconcile_balance on manual invoice creation
This patch makes the manual invoice creation step call
Koha::Account::reconcile_balance when the AccountAutoReconcile syspref
is set.

To test:
- Apply the patch
- Have some outstanding credit
- Create a manual invoice
=> SUCCESS: Same behaviour as always
- Set AccountAutoReconcile
- Create a manual invoice
=> SUCCESS: Reconcillation happened
- Sign off :-D

Sponsored-by: ByWater 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: Nick Clemens <nick@bywatersolutions.com>
2019-01-04 03:13:40 +00:00
d561273ef8 Bug 21986: Do not escape quotation marks when cataloguing
In several places we escape quotation marks using
  $value =~ s/"/&quot;/g;
All the occurrences are wrong and must be removed.
Most of them are leftover of bug 11638 (Remove HTML from
addbiblio.pl), which removes the construction of html from pl scripts.

The problem has been highlighted by bug 13618, I did not track down why
the issue did not exist before (?)

Test plan:
0/ Use strings with quotation marks, like:
'Fiddle tune history : "bad" tunes'
You can also use other html characters to make the tests more complete,
like 'Fiddle tune history : <"bad" tunes>'
1/ authorities/authorities.pl
a. Edit an authority filling different fields with quotation marks
b. Edit it again
=> The display (inputs' values) is wrong, if you save the escaped quotes
will be inserted
2/ cataloguing/addbiblio.pl
Same editing a bibliographic record
3/ cataloguing/additem.pl
Same editing items
4/ members/memberentry.pl
Edit a patron's record and fill some fields with quotation marks
+ fields borrowernotes and opacnotes
=> The quotes are inserted directly in DB (escape is done before the
insert!)
5/ opac/opac-review.pl
For QA only: $js_ok_review is never used
6/ tools/batchMod.pl
For QA only: $value is always undefined at that point

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

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-12-14 13:33:28 +00:00
a3036b4760 Bug 18805: Add ability to use up account credits
This patch introduces a new button in the 'Pay fines' tab  on the
patron's account page. This button, labeled 'Normalize account' is only
displayed when outstanding credits are available, that could be used to
pay up existing debts.

When clicking the button, the Koha::Account::normalize_balance method
(bug 21896) is used for the purpose.

To test:
- Apply this patch (on top of 21896)
- On a patron's 'Fines' tab, create a 'manual invoice' (maybe more than
  one)
- Go to the 'Pay fines' tab
=> SUCCESS: No 'Apply credits' button is displayed.
- On the 'create manual credit' tab, create a couple credits.
- Go to the 'Pay fines'
=> SUCCESS: 'Apply credits' button is displayed
- Click on 'Apply credits'
=> SUCCESS: Outstanding credits have been used to pay up debts.
- Play with different options (credit excedes debts and vice-versa, they
        match, etc)
=> SUCCESS: They all work as expected
- Sign off :-D

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-11-29 18:47:15 +00:00
449116857e Bug 21649: Pass guarantee info to template when adding child
To test:
1 - Find an adult patron
2 - Click 'Add child'
3 - Note address/phone info does not carry over
4 - Apply patch
5 - Repeat
6 - Note information populates

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Todd <tgoatley@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
It works, but the code is ugly and hard to maintain.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-11-26 12:33:52 +00:00
1e5e9f5e80 Bug 20629: (QA follow-up) Remove actions_col
The actions_col template param requires a DB search, only to display the
'Actions' column header vs. an empty string. But there will always be
buttons in there, that were added *after*.
It made sense when only the 'Reverse' button was displayed, but now both
'Print' and 'Details' are displayed anyway.

This patch removes it for good :-D

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-11-06 16:32:42 +00:00
146f1ca3a6 Bug 20629: Rename reverse_col to actions_col
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-11-06 16:32:42 +00:00
Mark Tompsett
b6c8f9f7ef Bug 20629: (follow-up) fix reverse_col value
Before this patch the Void button didn't appear.
After this patch the Void button appears on payments.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-11-06 16:32:42 +00:00
9f112ff75c Bug 20629: Pass accountline objects to template instead of hashref
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-11-06 16:32:41 +00:00
fb15a96310 Bug 20629: Remove ability to 'reverse' payments
Test Plan:
1) Apply this patch
2) Note all references to reversing payments have been removed
3) Note ability to void payments remains unchanged

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-11-06 16:32:34 +00:00
a90502043f Bug 21702: (follow-up) Simplify checks and use standard fallback behaviour
This patch acknowledges the fact that some checks here are done in a way
that is not standard these days. This checks are originally done
multiple times in different ways. output_and_exit_if_error should be
used.

This implies a minor behaviour change: if the passed (in the URL)
borrowernumber doesn't exist, it sends the user to a 'Patron doesn't
exist page' instead of the circulation page for the borrowernumber.

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

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-10-31 13:15:01 +00:00
466e292639 Bug 21702: Make mancredit.pl use the patron id for the staff user
I think unsafe SQL modes and the fact that manager_id has no FK allowed this to go unnoticed. But now we catch it!

To test:
- On a patron, try adding a new manual credit of any type
=> FAIL: It fails telling the userid of the logged user is not a valid integer!
- Apply this patch
- Try adding a manual credit of any type
=> SUCCESS: Manual credit added!
- Sign off!

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

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-10-31 13:15:01 +00:00
Katrin Fischer
184c44ee31 Bug 21167: Fix price formatting on printed fee invoice and receipt
The prices were not formatted correctly on the printed receipts
for fines and payments in the patron account.

This patch introduces the use of the Price TT plugin to those
templates.

Also:
- Fixes a few capitalization errors
- Removes spaces in front of :
- Updates accounttype-to-description list to the one used
  in other templats as a lot of values were missing (Credit etc.)

To test:
- Create several fines, use some .00 and some with other values
- Pay some fines
- Create a manual credit
- Use print button for all of those (credit, fee, payment)
- Verify that:
  - prices ending in .00 are displayed without the decimal part
  - instead of Credit only C is shown in the description
- Apply patch
- Print invoices and receipts again
- Verify that:
  - prices are now formatted according to CurrencyFormat system
    preference, decimal part always included
  - verify that correct description for Credit is shown

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-09-28 19:41:36 +00:00
270a408949 Bug 21397: Mark "Routing list" tab as active when selected
/members/routing-lists.pl?borrowernumber=5 show the different tab of the
menu but "Routing lists" is not displayed as the selected one (active).

"routinglistview" must be set and passed to the template

Test plan:
Enable the RoutingSerials pref
and hit /members/routing-lists.pl?borrowernumber=42

The "Routing lists" tab must be selected/active

Followed test plan and tab now shows as active.
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-09-26 16:18:16 +00:00
0fd329724b Bug 20656: Don't print lines that have no balance on print summary
To test:
1 - Add at least two fines to a patron
2 - Pay off one of them
3 - Print summary - all 3 lines show
4 - Apply patch
5 - Print summary - only line with balance shows

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-09-20 13:45:28 +00:00
2b1b168ec4 Bug 21183: Replace C4::Items::GetItemnumberFromBarcode calls
C4::Items::GetItemnumberFromBarcode calls can be replaced with
  Koha::Items->find({ barcode => $barcode });

We should make sure the barcode existed in DB and so that ->find
returns an object. Note that most of the time we just wanted to know if
the barcode existed.
The changes are very simple, the only one that need attention is
the one in batchMod.pl. It is basically reusing what we did on
bug 21141.

Test plan:
Use the batch item modification/deletion tools to modify/delete items
from their barcode (using the textarea or a file)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-08-30 13:40:35 +00:00
7c05f4fbe4 Bug 21068: Remove NorwegianPatronDB related code
Bug 11401 introduced code to support Norwegian national library card.
This code is too specific to be part of Koha as it, it should be a
plugin instead.
Moreover nobody uses it, but a modified version (see comment 3).

Test plan:
Add/edit/delete patron and make sure there are no regressions introduced
by these patches

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-08-30 13:40:29 +00:00
644de1c4e7 Bug 21222: (bug 20226 follow-up) Fix patron creation
Since bug 20226 you cannot longer creation a patron, memberentry.pl will
explode with
Template process failed: undef error - DBIC result _type  isn't of the
_type Category at /home/vagrant/kohaclone/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc
line 22.

The problem is that "patron" is actually defined and the test in
str/members-menu.inc does not work as expected.

It comes from
  commit 7b1d08df0f
  Bug 19936: Replace Generate_Userid - Update the occurrences
where I needed $patron to be defined in order to use Koha::Patron->generate_userid
on an blessed object.
But this was actually wrong, as it could have side-effects.

Test plan:
Create a new patron
Edit it
Retest bug 19936 and make sure the userid is generated correctly in the
different situations

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-08-16 13:19:54 +00:00