Bug 23224 - Inconsistent behaviour between memberentry.pl and the update-child.pl when updating child patron to Adult
Summary: Inconsistent behaviour between memberentry.pl and the update-child.pl when up...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Hayley Pelham
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 12949
  Show dependency treegraph
 
Reported: 2019-06-26 23:52 UTC by Alex Buckley
Modified: 2020-11-30 21:45 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 23224: Fix inconsistent behaviour of memberentry.pl (2.78 KB, patch)
2019-06-27 00:11 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 23224: Fix inconsistent behaviour of memberentry.pl (2.73 KB, patch)
2019-06-27 01:13 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 23224: Fix inconsistent behaviour of memberentry.pl (2.85 KB, patch)
2019-06-27 01:58 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 23224: Fix inconsistent behaviour of memberentry.pl (3.33 KB, patch)
2019-06-27 02:31 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 23224: Fix inconsistent behaviour of memberentry.pl (3.38 KB, patch)
2019-06-28 15:52 UTC, Liz Rea (ByWater)
Details | Diff | Splinter Review
Bug 23224: Fix inconsistent behaviour of memberentry.pl (3.39 KB, patch)
2019-06-28 15:55 UTC, Liz Rea (ByWater)
Details | Diff | Splinter Review
Bug 23224: Fix inconsistent behaviour of memberentry.pl (3.44 KB, patch)
2019-06-28 18:46 UTC, Nadine Pierre
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buckley 2019-06-26 23:52:09 UTC
There are two ways you can update a child patron to a Adult/Staff/Professional/Organisation patron category. These are using: 

* child-update.pl
* memberentry.pl

- Behaviour of child-update.pl:

Currently when you click on the 'Update child to adult patron' dropdown option on the members/moremember.pl page the update-child.pl window appears. After selecting and submitting that form the guarantorid value for the borrower is set to 0. 

- Behaviour of memberentry.pl: 

When using the 'Edit' option which loads the memberentry.pl when you change the borrowers category from Child to a Adult/Staff/Professional/Organisation categorycode and then submit the guarantorid is not altered (not set to 0) and is displayed on the patrons summary page as guarantor. 

What is the problem?

This is inconsistent behavior, memberentry.pl should set the guarantorid value to 0 when you update the borrowers categorycode to an Adult/Staff/Professional/Organisation patron categorycode, so it behaves the same as child-update.pl

Currently Koha master does not allow adults to have a guarantor (until the patches on Bug 12446 - https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12446) are pushed to master, and so this bug letting non-child patron categories having a guarantor should be fixed.
Comment 1 Alex Buckley 2019-06-27 00:11:57 UTC
Created attachment 91038 [details] [review]
Bug 23224: Fix inconsistent behaviour of memberentry.pl

When editing a child patron (in memberentry.pl) and changing their
patron category to a non-child patron category Koha does not set the
guarantorid to 0.

This means we end up with non-child patrons with guarantors, which is
currently not allowed by Koha.

Whereas the behaviour in child-update.pl (which can be accessed from a
patrons summary page by clicking 'More'->Update child to adult
patron') sets the borrowers guarantorid value to 0. This is the correct
behaiviour and is what memberentry.pl should be doing. This patch fixes
that.

Test plan:
See how memberentry.pl currently behaves
1. Create a adult patron and select 'Add child' and create the child
record.

2. Enter the Koha MySQL terminal and select the guarantorid value for
the child record you just created:

SELECT guarantorid FROM borrowers WHERE userid=<username>;

3. Notice the guarantorid is set to the adult patrons borrowernumber

4. On the child record select 'Edit' and in the memberentry.pl page
change the category to any non-child patron category (for example
'Patron') and save

5. Repeat step 2 and notice the guarantorid value has not changed

----

See how child-update.pl currently behaves

6. Repeat steps 1-3 and on the child record select More > Update child
to adult patron

7. In the child-update.pl window that loads select any patron category and save

8. Repeat step 2 and notice the guarantorid is now 0

----

See how the patch fixes the behaviour of memberentry.pl

9. Apply patch

10. Repeat steps 1-5 and notice the guarantorid is now 0

Sponsored-By: Brimbank Library, Australia
Comment 2 Alex Buckley 2019-06-27 01:13:17 UTC
Created attachment 91041 [details] [review]
Bug 23224: Fix inconsistent behaviour of memberentry.pl

When editing a child patron (in memberentry.pl) and changing their
patron category to a non-child patron category Koha does not set the
guarantorid to 0.

This means we end up with non-child patrons with guarantors, which is
currently not allowed by Koha.

Whereas the behaviour in child-update.pl (which can be accessed from a
patrons summary page by clicking 'More'->Update child to adult
patron') sets the borrowers guarantorid value to 0. This is the correct
behaiviour and is what memberentry.pl should be doing. This patch fixes
that.

Test plan:
See how memberentry.pl currently behaves
1. Create a adult patron and select 'Add child' and create the child
record.

2. Enter the Koha MySQL terminal and select the guarantorid value for
the child record you just created:

SELECT guarantorid FROM borrowers WHERE userid=<username>;

3. Notice the guarantorid is set to the adult patrons borrowernumber

4. On the child record select 'Edit' and in the memberentry.pl page
change the category to any non-child patron category (for example
'Patron') and save

5. Repeat step 2 and notice the guarantorid value has not changed

----

See how child-update.pl currently behaves

6. Repeat steps 1-3 and on the child record select More > Update child
to adult patron

7. In the child-update.pl window that loads select any patron category and save

8. Repeat step 2 and notice the guarantorid is now 0

----

See how the patch fixes the behaviour of memberentry.pl

9. Apply patch

10. Repeat steps 1-5 and notice the guarantorid is now empty

Sponsored-By: Brimbank Library, Australia
Comment 3 Alex Buckley 2019-06-27 01:58:46 UTC
Created attachment 91042 [details] [review]
Bug 23224: Fix inconsistent behaviour of memberentry.pl

When editing a child patron (in memberentry.pl) and changing their
patron category to a non-child patron category Koha does not set the
guarantorid to 0.

This means we end up with non-child patrons with guarantors, which is
currently not allowed by Koha.

Whereas the behaviour in child-update.pl (which can be accessed from a
patrons summary page by clicking 'More'->Update child to adult
patron') sets the borrowers guarantorid value to 0. This is the correct
behaiviour and is what memberentry.pl should be doing. This patch fixes
that.

Test plan:
See how memberentry.pl currently behaves
1. Create a adult patron and select 'Add child' and create the child
record.

2. Enter the Koha MySQL terminal and select the guarantorid value for
the child record you just created:

SELECT guarantorid FROM borrowers WHERE userid=<username>;

3. Notice the guarantorid is set to the adult patrons borrowernumber

4. On the child record select 'Edit' and in the memberentry.pl page
change the category to any non-child patron category (for example
'Patron') and save

5. Repeat step 2 and notice the guarantorid value has not changed

----

See how child-update.pl currently behaves

6. Repeat steps 1-3 and on the child record select More > Update child
to adult patron

7. In the child-update.pl window that loads select any patron category and save

8. Repeat step 2 and notice the guarantorid is now 0

----

See how the patch fixes the behaviour of memberentry.pl

9. Apply patch

10. Repeat steps 1-5 and notice the guarantorid is now empty

Sponsored-By: Brimbank Library, Australia
Comment 4 Alex Buckley 2019-06-27 02:31:50 UTC
Created attachment 91043 [details] [review]
Bug 23224: Fix inconsistent behaviour of memberentry.pl

When editing a child patron (in memberentry.pl) and changing their
patron category to a non-child patron category Koha does not set the
guarantorid to 0.

This means we end up with non-child/non-professional patrons with guarantors, which is
currently not allowed by Koha.

Whereas the behaviour in child-update.pl (which can be accessed from a
patrons summary page by clicking 'More'->Update child to adult
patron') sets the borrowers guarantorid value to 0. This is the correct
behaiviour and is what memberentry.pl should be doing. This patch fixes
that.

Test plan:
See how memberentry.pl currently behaves
1. Create a adult patron and select 'Add child' and create the child
record.

2. Enter the Koha MySQL terminal and select the guarantorid value for
the child record you just created:

SELECT guarantorid FROM borrowers WHERE userid=<username>;

3. Notice the guarantorid is set to the adult patrons borrowernumber

4. On the child record select 'Edit' and in the memberentry.pl page
change the category to any non-child/non-professional patron category (for example
'Patron') and save

5. Repeat step 2 and notice the guarantorid value has not changed

----

See how child-update.pl currently behaves

6. Repeat steps 1-3 and on the child record select More > Update child
to adult patron

7. In the child-update.pl window that loads select any patron category and save

8. Repeat step 2 and notice the guarantorid is now 0

----

See how the patch fixes the behaviour of memberentry.pl

9. Apply patch

10. Repeat steps 1-5 and notice the guarantorid is now empty

----

Confirm the guarantorid is not removed when editing a patrons category
to a patron category with the category type of 'professional' as in Koha
professional patron categories can have guarantors

11. Repeat steps 1-3 and select 'Edit' on the childs record and change
the patron category to a 'professional' patron category and then save

12. Check the database and confirm that the guarantorid is unchanged

Sponsored-By: Brimbank Library, Australia
Comment 5 Alex Buckley 2019-06-27 02:33:25 UTC
Made a change to the patch so if you change from a 'child' to 'professional' patron category in memberentry.pl the guarantorid is not removed as Koha currently lets patron categories with the category type of 'professional' also have a guarantor.
Comment 6 Liz Rea (ByWater) 2019-06-28 15:52:57 UTC
Created attachment 91109 [details] [review]
Bug 23224: Fix inconsistent behaviour of memberentry.pl

When editing a child patron (in memberentry.pl) and changing their
patron category to a non-child patron category Koha does not set the
guarantorid to 0.

This means we end up with non-child/non-professional patrons with guarantors, which is
currently not allowed by Koha.

Whereas the behaviour in child-update.pl (which can be accessed from a
patrons summary page by clicking 'More'->Update child to adult
patron') sets the borrowers guarantorid value to 0. This is the correct
behaiviour and is what memberentry.pl should be doing. This patch fixes
that.

Test plan:
See how memberentry.pl currently behaves
1. Create a adult patron and select 'Add child' and create the child
record.

2. Enter the Koha MySQL terminal and select the guarantorid value for
the child record you just created:

SELECT guarantorid FROM borrowers WHERE userid=<username>;

3. Notice the guarantorid is set to the adult patrons borrowernumber

4. On the child record select 'Edit' and in the memberentry.pl page
change the category to any non-child/non-professional patron category (for example
'Patron') and save

5. Repeat step 2 and notice the guarantorid value has not changed

----

See how child-update.pl currently behaves

6. Repeat steps 1-3 and on the child record select More > Update child
to adult patron

7. In the child-update.pl window that loads select any patron category and save

8. Repeat step 2 and notice the guarantorid is now 0

----

See how the patch fixes the behaviour of memberentry.pl

9. Apply patch

10. Repeat steps 1-5 and notice the guarantorid is now empty

----

Confirm the guarantorid is not removed when editing a patrons category
to a patron category with the category type of 'professional' as in Koha
professional patron categories can have guarantors

11. Repeat steps 1-3 and select 'Edit' on the childs record and change
the patron category to a 'professional' patron category and then save

12. Check the database and confirm that the guarantorid is unchanged

Sponsored-By: Brimbank Library, Australia

Signed-off-by: John Doe <you@example.com>
Comment 7 Liz Rea 2019-06-28 15:53:32 UTC
oh ffs. Let me fix that signoff line.
Comment 8 Liz Rea (ByWater) 2019-06-28 15:55:13 UTC
Created attachment 91110 [details] [review]
Bug 23224: Fix inconsistent behaviour of memberentry.pl

When editing a child patron (in memberentry.pl) and changing their
patron category to a non-child patron category Koha does not set the
guarantorid to 0.

This means we end up with non-child/non-professional patrons with guarantors, which is
currently not allowed by Koha.

Whereas the behaviour in child-update.pl (which can be accessed from a
patrons summary page by clicking 'More'->Update child to adult
patron') sets the borrowers guarantorid value to 0. This is the correct
behaiviour and is what memberentry.pl should be doing. This patch fixes
that.

Test plan:
See how memberentry.pl currently behaves
1. Create a adult patron and select 'Add child' and create the child
record.

2. Enter the Koha MySQL terminal and select the guarantorid value for
the child record you just created:

SELECT guarantorid FROM borrowers WHERE userid=<username>;

3. Notice the guarantorid is set to the adult patrons borrowernumber

4. On the child record select 'Edit' and in the memberentry.pl page
change the category to any non-child/non-professional patron category (for example
'Patron') and save

5. Repeat step 2 and notice the guarantorid value has not changed

----

See how child-update.pl currently behaves

6. Repeat steps 1-3 and on the child record select More > Update child
to adult patron

7. In the child-update.pl window that loads select any patron category and save

8. Repeat step 2 and notice the guarantorid is now 0

----

See how the patch fixes the behaviour of memberentry.pl

9. Apply patch

10. Repeat steps 1-5 and notice the guarantorid is now empty

----

Confirm the guarantorid is not removed when editing a patrons category
to a patron category with the category type of 'professional' as in Koha
professional patron categories can have guarantors

11. Repeat steps 1-3 and select 'Edit' on the childs record and change
the patron category to a 'professional' patron category and then save

12. Check the database and confirm that the guarantorid is unchanged

Sponsored-By: Brimbank Library, Australia
Signed-off-by: Liz Rea <liz@bywatersolutions.com>
Comment 9 Nadine Pierre 2019-06-28 18:46:35 UTC
Created attachment 91115 [details] [review]
Bug 23224: Fix inconsistent behaviour of memberentry.pl

When editing a child patron (in memberentry.pl) and changing their
patron category to a non-child patron category Koha does not set the
guarantorid to 0.

This means we end up with non-child/non-professional patrons with guarantors, which is
currently not allowed by Koha.

Whereas the behaviour in child-update.pl (which can be accessed from a
patrons summary page by clicking 'More'->Update child to adult
patron') sets the borrowers guarantorid value to 0. This is the correct
behaiviour and is what memberentry.pl should be doing. This patch fixes
that.

Test plan:
See how memberentry.pl currently behaves
1. Create a adult patron and select 'Add child' and create the child
record.

2. Enter the Koha MySQL terminal and select the guarantorid value for
the child record you just created:

SELECT guarantorid FROM borrowers WHERE userid=<username>;

3. Notice the guarantorid is set to the adult patrons borrowernumber

4. On the child record select 'Edit' and in the memberentry.pl page
change the category to any non-child/non-professional patron category (for example
'Patron') and save

5. Repeat step 2 and notice the guarantorid value has not changed

----

See how child-update.pl currently behaves

6. Repeat steps 1-3 and on the child record select More > Update child
to adult patron

7. In the child-update.pl window that loads select any patron category and save

8. Repeat step 2 and notice the guarantorid is now 0

----

See how the patch fixes the behaviour of memberentry.pl

9. Apply patch

10. Repeat steps 1-5 and notice the guarantorid is now empty

----

Confirm the guarantorid is not removed when editing a patrons category
to a patron category with the category type of 'professional' as in Koha
professional patron categories can have guarantors

11. Repeat steps 1-3 and select 'Edit' on the childs record and change
the patron category to a 'professional' patron category and then save

12. Check the database and confirm that the guarantorid is unchanged

Sponsored-By: Brimbank Library, Australia
Signed-off-by: Liz Rea <liz@bywatersolutions.com>

Signed-off-by: Nadine Pierre <nadine.pierre@inLibro.com>
Comment 10 Katrin Fischer 2019-10-03 08:41:18 UTC
I am sorry, but I've managed to make this explode :(

1) Searched for a child patron 
2) Added a guarantor
3) Edit patron
4) Switch patron category to "Patron" (Adult)
5) No property guarantorid for Koha::Patron at /usr/share/perl5/Exception/Class/Base.pm line 88
Comment 11 Aleisha Amohia 2020-03-26 21:00:25 UTC
I believe this patch is no longer required - in master, guarantors and guarantees are stored in borrower_relationships in the database. the relationship information is deleted when changing from child patron to adult patron using memberentry.pl and child-update.pl. Closing bug report