Description
Owen Leonard
2020-07-07 17:00:33 UTC
I can't think of a reason why you would want to leave this empty - if the patron has a guarantor then they automatically must have some sort of relationship with the guarantee, even if it isn't a familial one. (In reply to David Roberts from comment #1) > I can't think of a reason why you would want to leave this empty It's not unreasonable to think that a library might not want to or care about storing the relationship information. But the bottom line is that the system preference can be empty so we should expect that it might be empty. Peter, can you take a look at this one please? He's in different timezone so I'll take initiative in communication here - yes, we'll (me too to understand and mentoring) take over this today/tomorrow. Created attachment 107469 [details] [review] Bug 25946: borrowerRelationship can be empty When borrowerRelationship is empty in system preferences, Relationship dropdown is not required and we accept empty value. Also fixes bug that didn't let you to pick empty value even when you specified that it should be possible in system preferences but in the end of the string (i.e. "|father|mother" worked, but "father|mother|" don't). To reproduce (borrowerRelationship can be empty): 1) Go to system preferences and make borrowerRelationship empty. 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. Try to save your changes. 4) Observe that relationship field is required in order to save but you can't actually choose anything as it doesn't contain anything. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it allows you to save the form now. To reproduce (can't choose empty value bug): 1) Go to system preferences and set borrowerRelationship exactly to "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. 4) Observe that there's no option to leave relationship field empty. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it has empty option that you can choose and save the form. Mentored-by: Andrew Nugged <nugged@gmail.com> Sorry, couldn't get this one to work - it fails at step 7 below: To reproduce (borrowerRelationship can be empty): 5) Apply the patch. 6) Repeat steps above. 7) Observe that it allows you to save the form now. Invalid relationship passed, '' is not defined. at /usr/share/perl5/Exception/Class/Base.pm line 88 Created attachment 108048 [details] [review] Bug 25946: borrowerRelationship can be empty When borrowerRelationship is empty in system preferences, Relationship dropdown is not required and we accept empty value. Also fixes bug that didn't let you to pick empty value even when you specified that it should be possible in system preferences but in the end of the string (i.e. "|father|mother" worked, but "father|mother|" don't). To reproduce (borrowerRelationship can be empty): 1) Go to system preferences and make borrowerRelationship empty. 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. Try to save your changes. 4) Observe that relationship field is required in order to save but you can't actually choose anything as it doesn't contain anything. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it allows you to save the form now. To reproduce (can't choose empty value bug): 1) Go to system preferences and set borrowerRelationship exactly to "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. 4) Observe that there's no option to leave relationship field empty. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it has empty option that you can choose and save the form. Mentored-by: Andrew Nugged <nugged@gmail.com> Hi Andrew,
you write:
> When borrowerRelationship is empty in system preferences, Relationship
dropdown is not required and we accept empty value.
I think that's correct. But when I leave the preference empty and try to add a guarantor the pull down still shows with only an empty entry. I feel like we should remove it in this case.
Created attachment 118991 [details] [review] Bug 25946: borrowerRelationship can be empty Do not split the config using comma. From syspref description of borrowerRelationship preference: > Guarantors can be the following of those they guarantee: > (input multiple choices separated by |). Leave empty to deactivate. As it doesn't mention comma at all, I removed ',' from split. Of course if comma is actually a viable way to split separate choices, I can obsolete this patch and append to the syspref description that it also can be separated by comma. Created attachment 118992 [details] [review] Bug 25946: borrowerRelationship can be empty When borrowerRelationship is empty in system preferences, Relationship dropdown is not required and we accept empty value. Also fixes bug that didn't let you to pick empty value even when you specified that it should be possible in system preferences but in the end of the string (i.e. "|father|mother" worked, but "father|mother|" don't). To reproduce (borrowerRelationship can be empty): 1) Go to system preferences and make borrowerRelationship empty. 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. Try to save your changes. 4) Observe that relationship field is required in order to save but you can't actually choose anything as it doesn't contain anything. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it allows you to save the form now. To reproduce (can't choose empty value bug): 1) Go to system preferences and set borrowerRelationship exactly to "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. 4) Observe that there's no option to leave relationship field empty. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it has empty option that you can choose and save the form. Mentored-by: Andrew Nugged <nugged@gmail.com> Created attachment 118993 [details] [review] Bug 25946: borrowerRelationship can be empty Do not show the empty dropdown with no options if borrowerRelationship is disabled (empty) in the syspref. To reproduce: 1) Go to system preferences and disable borrowerRelationship. 2) Create a new patron or modify the existing one. 3) Under "Guarantor Information" click on "Search to add" button. After performing the search, select different patron to act as guarantor. 4) Observe that there's empty dropdown for the relation type. 5) Apply the patch. 6) Repeat steps above. 7) Observe that dropdown is no longer there. Created attachment 118997 [details] [review] Bug 25946: borrowerRelationship can be empty Do not split the config using comma. From syspref description of borrowerRelationship preference: > Guarantors can be the following of those they guarantee: > (input multiple choices separated by |). Leave empty to deactivate. As it doesn't mention comma at all, I removed ',' from split. Of course if comma is actually a viable way to split separate choices, I can obsolete this patch and append to the syspref description that it also can be separated by comma. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 118998 [details] [review] Bug 25946: borrowerRelationship can be empty When borrowerRelationship is empty in system preferences, Relationship dropdown is not required and we accept empty value. Also fixes bug that didn't let you to pick empty value even when you specified that it should be possible in system preferences but in the end of the string (i.e. "|father|mother" worked, but "father|mother|" don't). To reproduce (borrowerRelationship can be empty): 1) Go to system preferences and make borrowerRelationship empty. 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. Try to save your changes. 4) Observe that relationship field is required in order to save but you can't actually choose anything as it doesn't contain anything. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it allows you to save the form now. To reproduce (can't choose empty value bug): 1) Go to system preferences and set borrowerRelationship exactly to "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. 4) Observe that there's no option to leave relationship field empty. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it has empty option that you can choose and save the form. Mentored-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 118999 [details] [review] Bug 25946: borrowerRelationship can be empty Do not show the empty dropdown with no options if borrowerRelationship is disabled (empty) in the syspref. To reproduce: 1) Go to system preferences and disable borrowerRelationship. 2) Create a new patron or modify the existing one. 3) Under "Guarantor Information" click on "Search to add" button. After performing the search, select different patron to act as guarantor. 4) Observe that there's empty dropdown for the relation type. 5) Apply the patch. 6) Repeat steps above. 7) Observe that dropdown is no longer there. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 119011 [details] [review] Bug 25946: borrowerRelationship can be empty Do not split the config using comma. From syspref description of borrowerRelationship preference: > Guarantors can be the following of those they guarantee: > (input multiple choices separated by |). Leave empty to deactivate. As it doesn't mention comma at all, I removed ',' from split. Of course if comma is actually a viable way to split separate choices, I can obsolete this patch and append to the syspref description that it also can be separated by comma. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 119012 [details] [review] Bug 25946: borrowerRelationship can be empty When borrowerRelationship is empty in system preferences, Relationship dropdown is not required and we accept empty value. Also fixes bug that didn't let you to pick empty value even when you specified that it should be possible in system preferences but in the end of the string (i.e. "|father|mother" worked, but "father|mother|" don't). To reproduce (borrowerRelationship can be empty): 1) Go to system preferences and make borrowerRelationship empty. 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. Try to save your changes. 4) Observe that relationship field is required in order to save but you can't actually choose anything as it doesn't contain anything. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it allows you to save the form now. To reproduce (can't choose empty value bug): 1) Go to system preferences and set borrowerRelationship exactly to "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. 4) Observe that there's no option to leave relationship field empty. 5) Apply the patch. 6) Repeat steps above. 7) Observe that it has empty option that you can choose and save the form. Mentored-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 119013 [details] [review] Bug 25946: borrowerRelationship can be empty Do not show the empty dropdown with no options if borrowerRelationship is disabled (empty) in the syspref. To reproduce: 1) Go to system preferences and disable borrowerRelationship. 2) Create a new patron or modify the existing one. 3) Under "Guarantor Information" click on "Search to add" button. After performing the search, select different patron to act as guarantor. 4) Observe that there's empty dropdown for the relation type. 5) Apply the patch. 6) Repeat steps above. 7) Observe that dropdown is no longer there. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 119015 [details] [review] Bug 25946: (QA follow-up) Add Unit tests Add a unit test for the empty relationship availability. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Works well, passes QA script.. I added some unit tests. Passing QA Pushed to master for 21.05, thanks to everybody involved! Pushed to 20.11.x for 20.11.05 Doesn't apply cleanly to 20.05. Please rebase for backport. (In reply to Andrew Fuerste-Henry from comment #22) > Doesn't apply cleanly to 20.05. Please rebase for backport. Is this going to be backported? (In reply to Christopher Brannon from comment #23) > (In reply to Andrew Fuerste-Henry from comment #22) > > Doesn't apply cleanly to 20.05. Please rebase for backport. > > Is this going to be backported? This isn't going to be backported any further, no. It's in what are now oldstable and oldoldstable. (In reply to Andrew Fuerste-Henry from comment #24) > (In reply to Christopher Brannon from comment #23) > > (In reply to Andrew Fuerste-Henry from comment #22) > > > Doesn't apply cleanly to 20.05. Please rebase for backport. > > > > Is this going to be backported? > > This isn't going to be backported any further, no. It's in what are now > oldstable and oldoldstable Got it. Thanks. |