diff --git a/circ/circulation.pl b/circ/circulation.pl index 52871d12b9..22f0050a64 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -720,12 +720,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 f6cddb1d60..1ca767f729 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -134,6 +134,10 @@
This is the anonymous patron, so circulation is disabled.
[% END %] + [% IF missing_guarantor %] +
System preference 'ChildNeedsGuarantor' is enabled and this patron does not have a guarantor.
+ [% END %] + [% IF ( NEEDSCONFIRMATION ) %]
[% IF CAN_user_circulate_force_checkout or ADDITIONAL_MATERIALS %] 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 83f4b8893b..cdb10f8e48 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -54,6 +54,10 @@
This is the anonymous patron.
[% END %] + [% IF missing_guarantor %] +
System preference 'ChildNeedsGuarantor' is enabled and this patron does not have a guarantor.
+ [% END %] + [% IF ( error ) %]
[% IF ( error == 'CANT_DELETE_STAFF' ) %] diff --git a/members/moremember.pl b/members/moremember.pl index 49b87e97d6..d4ac893ffd 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -76,7 +76,8 @@ output_and_exit_if_error( { 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; for (qw(gonenoaddress lost borrowernotes is_debarred)) { $patron->$_ and $template->param( flagged => 1 ) and last; @@ -112,6 +113,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 } );