Bugzilla – Attachment 182692 Details for
Bug 39180
Handle and report exception at checkout/checkin due to missing guarantor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39180: Add a warning on patron missing guaranor
Bug-39180-Add-a-warning-on-patron-missing-guaranor.patch (text/plain), 4.67 KB, created by
Nick Clemens (kidclamp)
on 2025-05-21 14:28:53 UTC
(
hide
)
Description:
Bug 39180: Add a warning on patron missing guaranor
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-05-21 14:28:53 UTC
Size:
4.67 KB
patch
obsolete
>From e4d1ea8e1c74c316f36fcb6de4fcc342603962c4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 21 May 2025 11:42:51 +0000 >Subject: [PATCH] Bug 39180: Add a warning on patron missing guaranor > >To test: >1 - Create a patron in a category that can be a guarantee and do not assign any guarantor >2 - Create a patron in a 'Child' account type and do not assign a guarantor >3 - Enable system preference 'ChildNeedsGuarantor' >4 - View 'Check out' and 'Details' tabs for both patrons, note there is no warning >5 - Apply patch >6 - Repeat 4, note warning on all pages >7 - Add a patron gaurantor on the child - repeat 4 - warning is gone >8 - Add non-patron guarantor information to other patron - repeat 4 - warning is gone >--- > circ/circulation.pl | 10 +++++++++- > .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 4 ++++ > .../prog/en/modules/members/moremember.tt | 4 ++++ > members/moremember.pl | 10 +++++++++- > 4 files changed, 26 insertions(+), 2 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 5d432b4f809..9e99d819522 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 f6cddb1d60f..1ca767f7295 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 @@ > <div class="alert alert-warning">This is the anonymous patron, so circulation is disabled.</div> > [% END %] > >+ [% IF missing_guarantor %] >+ <div class="alert alert-warning">System preference 'ChildNeedsGuarantor' is enabled and this patron does not have a guarantor.</div> >+ [% END %] >+ > [% IF ( NEEDSCONFIRMATION ) %] > <div id="circ_needsconfirmation" class="alert alert-warning audio-alert-action focus" tabindex="-1"> > [% 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 f1fdb915376..958df0ee1f8 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 @@ > <div class="alert alert-warning">This is the anonymous patron.</div> > [% END %] > >+ [% IF missing_guarantor %] >+ <div class="alert alert-warning">System preference 'ChildNeedsGuarantor' is enabled and this patron does not have a guarantor.</div> >+ [% END %] >+ > [% IF ( error ) %] > <div class="alert alert-warning"> > [% IF ( error == 'CANT_DELETE_STAFF' ) %] >diff --git a/members/moremember.pl b/members/moremember.pl >index 2c7a32b88b2..d285993322e 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; > > if ( $patron->borrowernumber eq C4::Context->preference("AnonymousPatron") ) { > $template->param( is_anonymous => 1 ); >@@ -116,6 +117,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 } ); > >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39180
:
181941
|
182691
|
182692
|
182693
|
183084
|
183085
|
183086