Bug 14324 - "Add Child" button missing on moremember.pl
Summary: "Add Child" button missing on moremember.pl
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Barton Chittenden
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-03 17:32 UTC by Barton Chittenden
Modified: 2016-12-05 21:22 UTC (History)
8 users (show)

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


Attachments
Bug 14324: Set "adultborrower" regardless of guarantor status. (943 bytes, patch)
2015-06-18 21:12 UTC, Barton Chittenden
Details | Diff | Splinter Review
Attachment to Bug 14324 - "Add Child" button missing on moremember.pl (995 bytes, patch)
2015-06-19 21:18 UTC, Barton Chittenden
Details | Diff | Splinter Review
Bug 14324: Set "adultborrower" regardless of guarantor status. (1.03 KB, patch)
2015-06-23 08:42 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14324: Display "Add Child" for Organisations on circ/circulation.pl (1.48 KB, patch)
2015-06-23 08:42 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15324: Do not display 'Waiting holds:" if no holds are waiting (2.32 KB, patch)
2015-12-08 15:34 UTC, Marc Véron
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2015-06-03 17:32:08 UTC
The code which adds the "Add child" button is in koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc

at line 151:

149     [% IF ( CAN_user_borrowers ) %]
150         [% IF ( adultborrower AND activeBorrowerRelationship ) %]
151             <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C"><i class="icon-plus"></i> Add child</a>
152         [% END %]
153         [% IF ( CAN_user_borrowers ) %]
154             <a id="changepassword" class="btn btn-small" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]"><i class="icon-lock"></i> Change password</a>
155         [% END %]
156         <a id="duplicate" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;category_type=[% category_type %]"><i class="icon-copy"></i>Duplicate</a>
157     [% END %]

I added code to dump CAN_user_borrowers, adultborrower and activeBorrowerRelationship, and found that adultborrower was not set, even for a borrower whose borrower's category type is 'A'.

'adultborrower' is set in moremember.pl at line 192, but *only if $count returned by GetGuarantees is not 0*.

172 my ( $count, $guarantees ) = GetGuarantees( $data->{'borrowernumber'} );
173 if ( $count ) {
174     $template->param( isguarantee => 1 );
175 
176     # FIXME
177     # It looks like the $i is only being returned to handle walking through
178     # the array, which is probably better done as a foreach loop.
179     #
180     my @guaranteedata;
181     for ( my $i = 0 ; $i < $count ; $i++ ) {
182         push(@guaranteedata,
183             {
184                 borrowernumber => $guarantees->[$i]->{'borrowernumber'},
185                 cardnumber     => $guarantees->[$i]->{'cardnumber'},
186                 name           => $guarantees->[$i]->{'firstname'} . " "
187                                 . $guarantees->[$i]->{'surname'}
188             }
189         );
190     }
191     $template->param( guaranteeloop => \@guaranteedata );
192     ( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
193 }

In other words, you can't add children unless you already have children.
Comment 1 Barton Chittenden 2015-06-18 21:12:55 UTC Comment hidden (obsolete)
Comment 2 Barton Chittenden 2015-06-19 21:00:25 UTC
Test plan:

1) Start with an instance of Koha that has borrowers of category type 'A' (Adult) and 'S' (Staff) defined.
2) Search for an adult borrower who has no Guarantees (Children).
3) Navigate to members/moremember.pl -- note that the 'Add Child' button does not appear on the toolbar.
4) Apply the patch
5) Navigate to members/moremember.pl again. The 'Add Child' button should appear.

The 'Add Child' button should appear for category type 'A' (Adult) and 'I' (Institution/Organization).
Comment 3 Barton Chittenden 2015-06-19 21:18:37 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-06-22 16:14:58 UTC
Barton,

Please detail, it seems to work here.

The adultborrower flag is set in circ/circulation if the category_type is 'A':

423     $template->param( adultborrower => 1 )
424       if ( $borrower->{'category_type'} eq 'A' );
Comment 5 Barton Chittenden 2015-06-22 17:10:15 UTC
Jonathan,

The "Add Child" button is not missing in circ/circulation, only in members/moremember.pl.

In members/moremember.pl, the adult borrower flag was only being set if the patron had guarantees (i.e. children for parents, professional members for Institutions), and this was causing the 'Add Child' button not to appear on moremember.pl for any adult patrons who did not have children defined.
Comment 6 Jonathan Druart 2015-06-23 08:34:49 UTC
(In reply to Barton Chittenden from comment #5)
> Jonathan,
> 
> The "Add Child" button is not missing in circ/circulation, only in
> members/moremember.pl.

Oops, sorry about that.
I will test again.
Comment 7 Jonathan Druart 2015-06-23 08:42:14 UTC
Created attachment 40510 [details] [review]
Bug 14324: Set "adultborrower" regardless of guarantor status.

Signed-off-by: Jason Robb - SEKLS (jrobb@sekls.org)

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Comment 8 Jonathan Druart 2015-06-23 08:42:19 UTC
Created attachment 40511 [details] [review]
Bug 14324: Display "Add Child" for Organisations on circ/circulation.pl

On moremember, the button is displayed for Organisations.
To be consistent, it should be displayed on the circulation page too.

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Comment 9 Tomás Cohen Arazi 2015-06-23 13:22:47 UTC
Patches pushed to master.

Thanks Barton and Jonathan!
Comment 10 Chris Cormack 2015-07-12 22:53:55 UTC
Pushed to 3.20.x will be in 3.20.2
Comment 11 Liz Rea 2015-07-20 22:13:33 UTC
Pushed to 3.18.x will be in 3.18.09
Comment 12 Mason James 2015-07-25 13:02:02 UTC
Pushed to 3.16.x, will be in 3.16.13
Comment 13 Marc Véron 2015-12-08 15:34:07 UTC Comment hidden (obsolete)
Comment 14 Marc Véron 2015-12-08 15:37:14 UTC
Comment on attachment 45498 [details] [review]
Bug 15324: Do not display 'Waiting holds:" if no holds are waiting

Sorry, wrong bug number...