diff --git a/circ/circulation.pl b/circ/circulation.pl index e7732bfdc7..376f12ef89 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -713,12 +713,20 @@ my $view = my @relatives; if ($patron) { - if ( my @guarantors = $patron->guarantor_relationships()->guarantors->as_list ) { + my @guarantors = $patron->guarantor_relationships()->guarantors->as_list; + if ( scalar @guarantors ) { push( @relatives, $_->id ) for @guarantors; push( @relatives, $_->id ) for $patron->siblings->as_list; } else { push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees->as_list; } + if ( C4::Context->preference('ChildNeedsGuarantor') + and ( $patron->is_child or $patron->category->can_be_guarantee ) + and $patron->contactname eq "" + and !@guarantors ) + { + $template->param( missing_guarantor => 1 ); + } } my $relatives_issues_count = Koha::Database->new()->schema()->resultset('Issue')->count( { borrowernumber => \@relatives } ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index bc64754edb..87dbcd360e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -96,6 +96,9 @@ [% IF alert.RETURNED_FROM_ANOTHER %]
Item was checked out to [% INCLUDE 'patron-title.inc' patron = alert.RETURNED_FROM_ANOTHER.patron %] and was returned automatically.
[% END %] + [% IF missing_guarantor %] +
System preference 'ChildNeedsGuarantor' is enabled and this patron does not have a guarantor.
+ [% END %] [% IF alert.BOOKED %]
Item is booked by this user
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index f72f254ea4..8065bc6fb1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -61,6 +61,9 @@ [% IF ( error ) %]
+ [% IF missing_guarantor %] +
System preference 'ChildNeedsGuarantor' is enabled and this patron does not have a guarantor.
+ [% END %] [% IF ( error == 'CANT_DELETE_STAFF' ) %]

Unable to delete staff user

Insufficient privileges.

diff --git a/members/moremember.pl b/members/moremember.pl index 773bc4190d..cfd91802be 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -74,7 +74,8 @@ my $patron = Koha::Patrons->find( $borrowernumber ); my $logged_in_user = Koha::Patrons->find( $loggedinuser ); output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); -my $category_type = $patron->category->category_type; +my $category = $patron->category; +my $category_type = $category->category_type; if ( $patron->borrowernumber eq C4::Context->preference("AnonymousPatron") ) { $template->param( is_anonymous => 1 ); @@ -117,6 +118,13 @@ $template->param( guarantor_relationships => $guarantor_relationships, guarantees => \@guarantees, ); +if ( C4::Context->preference('ChildNeedsGuarantor') + and ( $patron->is_child or $category->can_be_guarantee ) + and $patron->contactname eq "" + and !@guarantors ) +{ + $template->param( missing_guarantor => 1 ); +} my $relatives_issues_count = Koha::Checkouts->count({ borrowernumber => \@relatives });