Bugzilla – Attachment 71715 Details for
Bug 18789
Send a Koha::Patron object to the templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18789: Use Koha::Patron->image from the templates
Bug-18789-Use-KohaPatron-image-from-the-templates.patch (text/plain), 18.41 KB, created by
Josef Moravec
on 2018-02-16 11:12:40 UTC
(
hide
)
Description:
Bug 18789: Use Koha::Patron->image from the templates
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-02-16 11:12:40 UTC
Size:
18.41 KB
patch
obsolete
>From 800b259ef9e0dc1d993ba4a62547ea4a2f9efd4d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 1 Jun 2017 13:29:45 -0300 >Subject: [PATCH] Bug 18789: Use Koha::Patron->image from the templates > >Now that we have the 'patron' variable in all our templates, we can call >Koha::Patron->image and do the check from the templates. > >Test plan: >On the different pages of the patron module, you should see the default >image if there is no image attached or the one that has been attached >(see pref patronimages) > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > circ/circulation.pl | 1 - > koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc | 4 ++-- > .../intranet-tmpl/prog/en/modules/members/moremember.tt | 12 ++++++------ > members/boraccount.pl | 2 -- > members/deletemem.pl | 1 - > members/discharge.pl | 2 -- > members/files.pl | 1 - > members/housebound.pl | 4 +--- > members/mancredit.pl | 1 - > members/maninvoice.pl | 1 - > members/member-flags.pl | 2 -- > members/member-password.pl | 2 -- > members/moremember.pl | 5 ----- > members/notices.pl | 2 -- > members/pay.pl | 3 --- > members/paycollect.pl | 4 ---- > members/printfeercpt.pl | 2 -- > members/printinvoice.pl | 2 -- > members/purchase-suggestions.pl | 2 -- > members/readingrec.pl | 2 -- > members/routing-lists.pl | 2 -- > members/statistics.pl | 2 -- > 22 files changed, 9 insertions(+), 50 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index aa98f9a..5657bfb 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -619,7 +619,6 @@ if ( $patron ) { > categoryname => $patron->category->description, > expiry => $patron->dateexpiry, > is_child => ( $patron->category->category_type eq 'C' ), >- picture => ( $patron->image ? 1 : 0 ), > ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >index 2b29bfc..dce95f1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >@@ -7,7 +7,7 @@ > <![endif]--> > <ul class="patronbriefinfo"> > [% IF ( patronimages ) %] >- [% IF ( picture ) %] >+ [% IF ( patron.image ) %] > <li> > <img src="/cgi-bin/koha/members/patronimage.pl?borrowernumber=[% patron.borrowernumber | uri %]" id="patronimage" alt="[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])" /> > </li> >@@ -97,7 +97,7 @@ > [% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&modules=MEMBERS&modules=circulation&object=[% patron.borrowernumber %]&src=circ">Modification log</a></li> > [% END %] > [% IF CAN_user_borrowers_edit_borrowers %] >- [% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% patron.borrowernumber %]">Notices</a></li> >+ [% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% patron.borrowernumber %]">Notices</a></li> > [% END %] > [% IF CAN_user_borrowers_edit_borrowers %] > [% IF ( statisticsview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/statistics.pl?borrowernumber=[% patron.borrowernumber %]">Statistics</a></li> >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 e1af48d..44cdb94 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -186,7 +186,7 @@ > [% IF ( CAN_user_tools_batch_upload_patron_images ) %] > <form method="post" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data"> > <fieldset class="brief"> >- [% IF ( picture ) %] >+ [% IF ( patron.image ) %] > <legend>Manage patron image</legend> > <div class="hint">To update the image for [% patron.title | html %] [% patron.surname | html %], select a new image file and click 'Upload.' <br />Click the 'Delete' button to remove the current image. > [% ELSE %] >@@ -207,7 +207,7 @@ > <input type="hidden" name="csrf_token" value="[% csrf_token %]" /> > <input type="submit" value="Upload" class="submit" /> > <input name="op" type="hidden" value="Upload" /> >- [% IF ( picture ) %]<a id="delpicture" href="/cgi-bin/koha/tools/picture-upload.pl?op=Delete&borrowernumber=[% patron.borrowernumber %]&csrf_token=[% csrf_token %]" class="delete">Delete</a>[% END %] >+ [% IF ( patron.image ) %]<a id="delpicture" href="/cgi-bin/koha/tools/picture-upload.pl?op=Delete&borrowernumber=[% patron.borrowernumber %]&csrf_token=[% csrf_token %]" class="delete">Delete</a>[% END %] > </fieldset> > </fieldset> > </form> >@@ -297,7 +297,7 @@ > <li><span class="label">Borrowernumber: </span> [% patron.borrowernumber %]</li> > <li><span class="label">Category: </span>[% patron.category.description %] ([% patron.categorycode %])</li> > <li><span class="label">Registration date: </span>[% patron.dateenrolled | $KohaDates %]</li> >- >+ > <li><span class="label">Expiration date: </span> > [% IF ( was_renewed ) %] > <strong class="reregistrinfo">[% patron.dateexpiry | $KohaDates %]</strong> >@@ -390,10 +390,10 @@ > <li><span class="label">First name: </span>[% patron.altcontactfirstname | html %]</li> > <li><span class="label">Address: </span>[% patron.altcontactaddress1 | html %]</li> > <li><span class="label">Address 2: </span>[% patron.altcontactaddress2 | html %]</li> >- <li><span class="label">City: </span>[% patron.altcontactaddress3 | html %]</li> >+ <li><span class="label">City: </span>[% patron.altcontactaddress3 | html %]</li> > [% IF ( patron.altcontactstate ) %]<li><span class="label">State: </span>[% patron.altcontactstate | html %]</li>[% END %] > <li><span class="label">ZIP/Postal code: </span>[% patron.altcontactzipcode | html %]</li> >- [% IF ( patron.altcontactcountry ) %]<li><span class="label">Country: </span>[% patron.altcontactcountry | html %]</li>[% END %] >+ [% IF ( patron.altcontactcountry ) %]<li><span class="label">Country: </span>[% patron.altcontactcountry | html %]</li>[% END %] > [% IF ( patron.altcontactphone ) %]<li><span class="label">Phone: </span><a href="tel:[% patron.altcontactphone | url %]">[% patron.altcontactphone | html %]</a></li>[% END %] > </ol></div> > </div> >@@ -606,7 +606,7 @@ > ], > "bPaginate": false > })); >- [% IF ( picture ) %] >+ [% IF ( patron.image ) %] > $('#delpicture').click(function(){ > return confirm(_("Are you sure you want to delete this patron image? This cannot be undone.")); > }); >diff --git a/members/boraccount.pl b/members/boraccount.pl >index c07239a..f4bf63f 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -98,8 +98,6 @@ foreach my $accountline ( @{$accts}) { > > $template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ ); > >-$template->param( picture => 1 ) if $patron->image; >- > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($borrowernumber); > $template->param( >diff --git a/members/deletemem.pl b/members/deletemem.pl >index c67586f..ec5abe1 100755 >--- a/members/deletemem.pl >+++ b/members/deletemem.pl >@@ -108,7 +108,6 @@ my $op = $input->param('op') || 'delete_confirm'; > my $dbh = C4::Context->dbh; > my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member); > if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_guarantor or $deletelocal == 0) { >- $template->param( picture => 1 ) if $patron->image; > > $template->param( adultborrower => 1 ) if $patron->category->category_type =~ /^(A|I)$/; > >diff --git a/members/discharge.pl b/members/discharge.pl >index bd42568..db74cfc 100755 >--- a/members/discharge.pl >+++ b/members/discharge.pl >@@ -103,8 +103,6 @@ my @validated_discharges = Koha::Patron::Discharge::get_validated({ > borrowernumber => $borrowernumber, > }); > >-$template->param( picture => 1 ) if $patron->image; >- > $template->param( > patron => $patron, > can_be_discharged => $can_be_discharged, >diff --git a/members/files.pl b/members/files.pl >index 8a1f66d..4fc42fc 100755 >--- a/members/files.pl >+++ b/members/files.pl >@@ -114,7 +114,6 @@ else { > ); > } > >- $template->param( picture => 1 ) if $patron->image; > > $template->param( adultborrower => 1 ) > if ( $patron_category->category_type eq 'A' || $patron_category->category_type eq 'I' ); >diff --git a/members/housebound.pl b/members/housebound.pl >index c659d0c..0e52085 100755 >--- a/members/housebound.pl >+++ b/members/housebound.pl >@@ -62,9 +62,8 @@ my $patron = Koha::Patrons->find($borrowernumber); > output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); > > # Get supporting cast >-my ( $branch, $category, $houseboundprofile, $visit, $patron_image ); >+my ( $branch, $category, $houseboundprofile, $visit ); > if ( $patron ) { # FIXME This test is not needed - output_and_exit_if_error handles it >- $patron_image = $patron->image; > $category = Koha::Patron::Categories->new->find($patron->categorycode); > $houseboundprofile = $patron->housebound_profile; > } >@@ -170,7 +169,6 @@ if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) { > > $template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); > $template->param( >- picture => $patron_image, > housebound_profile => $houseboundprofile, > visit => $houseboundvisit, > messages => \@messages, >diff --git a/members/mancredit.pl b/members/mancredit.pl >index ac6df22..fe7c24b 100755 >--- a/members/mancredit.pl >+++ b/members/mancredit.pl >@@ -86,7 +86,6 @@ if ($add){ > } > > $template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ ); >- $template->param( picture => 1 ) if $patron->image; > > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($borrowernumber); >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 117a7ae..2271164 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -114,7 +114,6 @@ if ($add){ > } > > $template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ ); >- $template->param( picture => 1 ) if $patron->image; > > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($borrowernumber); >diff --git a/members/member-flags.pl b/members/member-flags.pl >index be9dc08..bc6237e 100755 >--- a/members/member-flags.pl >+++ b/members/member-flags.pl >@@ -18,7 +18,6 @@ use Koha::Patron::Categories; > use Koha::Patrons; > > use C4::Output; >-use Koha::Patron::Images; > use Koha::Token; > > my $input = new CGI; >@@ -189,7 +188,6 @@ if ($input->param('newflags')) { > } > > $template->param( adultborrower => 1 ) if ( $category_type =~ /^(A|I)$/ ); >- $template->param( picture => 1 ) if $patron->image; > > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); >diff --git a/members/member-password.pl b/members/member-password.pl >index 3d72349..6a07825 100755 >--- a/members/member-password.pl >+++ b/members/member-password.pl >@@ -103,8 +103,6 @@ if ( $category_type eq 'C') { > > $template->param( adultborrower => 1 ) if ( $category_type =~ /^(A|I)$/ ); > >-$template->param( picture => 1 ) if $patron->image; >- > if ( C4::Context->preference('ExtendedPatronAttributes') ) { > my $attributes = GetBorrowerAttributes( $bor->{'borrowernumber'} ); > $template->param( >diff --git a/members/moremember.pl b/members/moremember.pl >index 888fe91..be981f9 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -53,7 +53,6 @@ use C4::Members::Attributes qw(GetBorrowerAttributes); > use Koha::AuthorisedValues; > use Koha::CsvProfiles; > use Koha::Patron::Debarments qw(GetDebarments); >-use Koha::Patron::Images; > use Koha::Patron::Messages; > use Module::Load; > if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >@@ -275,10 +274,6 @@ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen > } > } > >-# check to see if patron's image exists in the database >-# basically this gives us a template var to condition the display of >-# patronimage related interface on >-$template->param( picture => 1 ) if $patron->image; > # Generate CSRF token for upload and delete image buttons > $template->param( > csrf_token => Koha::Token->new->generate_csrf({ session_id => $input->cookie('CGISESSID'),}), >diff --git a/members/notices.pl b/members/notices.pl >index 4537138..0541fd8 100755 >--- a/members/notices.pl >+++ b/members/notices.pl >@@ -51,8 +51,6 @@ my ($template, $loggedinuser, $cookie) > my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"; > output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); > >-$template->param( picture => 1 ) if $patron->image; >- > # Allow resending of messages in Notices tab > my $op = $input->param('op') || q{}; > if ( $op eq 'resend_notice' ) { >diff --git a/members/pay.pl b/members/pay.pl >index cb61231..c42c631 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -40,7 +40,6 @@ use C4::Koha; > use C4::Overdues; > use C4::Members::Attributes qw(GetBorrowerAttributes); > use Koha::Patrons; >-use Koha::Patron::Images; > > use Koha::Patron::Categories; > use URI::Escape; >@@ -140,8 +139,6 @@ sub add_accounts_to_template { > } > borrower_add_additional_fields($patron->unblessed); > >- my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber}); >- $template->param( picture => 1 ) if $patron_image; > $template->param( > patron => $patron, > accounts => \@accounts, >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 9a14284..5d8d994 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -27,7 +27,6 @@ use C4::Members; > use C4::Members::Attributes qw(GetBorrowerAttributes); > use C4::Accounts; > use C4::Koha; >-use Koha::Patron::Images; > use Koha::Patrons; > use Koha::Account; > use Koha::Token; >@@ -200,9 +199,6 @@ sub borrower_add_additional_fields { > $b_ref->{adultborrower} = 1; > } > >- my $patron_image = Koha::Patron::Images->find($b_ref->{borrowernumber}); >- $template->param( picture => 1 ) if $patron_image; >- > if (C4::Context->preference('ExtendedPatronAttributes')) { > $b_ref->{extendedattributes} = GetBorrowerAttributes($b_ref->{borrowernumber}); > } >diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl >index 36a0aa4..8979ae6 100755 >--- a/members/printfeercpt.pl >+++ b/members/printfeercpt.pl >@@ -116,8 +116,6 @@ for (my $i=0;$i<$numaccts;$i++){ > > $template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); > >-$template->param( picture => 1 ) if $patron->image; >- > $template->param( > patron => $patron, > finesview => 1, >diff --git a/members/printinvoice.pl b/members/printinvoice.pl >index d553713..7b110e9 100755 >--- a/members/printinvoice.pl >+++ b/members/printinvoice.pl >@@ -116,8 +116,6 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) { > > $template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); > >-$template->param( picture => 1 ) if $patron->image; >- > $template->param( > patron => $patron, > finesview => 1, >diff --git a/members/purchase-suggestions.pl b/members/purchase-suggestions.pl >index 74ca8f7..026ab89 100755 >--- a/members/purchase-suggestions.pl >+++ b/members/purchase-suggestions.pl >@@ -60,8 +60,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { > ); > } > >-$template->param( picture => 1 ) if $patron->image; >- > my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } ); > > $template->param( suggestions => $suggestions ); >diff --git a/members/readingrec.pl b/members/readingrec.pl >index 295a43c..327c573 100755 >--- a/members/readingrec.pl >+++ b/members/readingrec.pl >@@ -104,8 +104,6 @@ if (! $limit){ > $limit = 'full'; > } > >-$template->param( picture => 1 ) if $patron->image; >- > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($patron->borrowernumber); > $template->param( >diff --git a/members/routing-lists.pl b/members/routing-lists.pl >index 28d4d1c..ff2de51 100755 >--- a/members/routing-lists.pl >+++ b/members/routing-lists.pl >@@ -88,6 +88,4 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { > ); > } > >-$template->param( picture => 1 ) if $patron and $patron->image; >- > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/members/statistics.pl b/members/statistics.pl >index c268f0e..98c157e 100755 >--- a/members/statistics.pl >+++ b/members/statistics.pl >@@ -84,8 +84,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { > ); > } > >-$template->param( picture => 1 ) if $patron->image; >- > $template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); > > $template->param( >-- >2.1.4
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 18789
:
64211
|
64212
|
64213
|
64214
|
64215
|
64216
|
64218
|
64219
|
64221
|
64229
|
71301
|
71302
|
71303
|
71304
|
71305
|
71306
|
71307
|
71308
|
71309
|
71310
|
71311
|
71485
|
71486
|
71487
|
71488
|
71489
|
71490
|
71491
|
71492
|
71493
|
71494
|
71495
|
71496
|
71679
|
71680
|
71681
|
71682
|
71683
|
71684
|
71685
|
71686
|
71687
|
71688
|
71689
|
71690
|
71691
|
71713
|
71714
| 71715 |
71716
|
71717
|
71718
|
71719
|
71720
|
71721
|
71722
|
71723
|
71724
|
71725
|
71726
|
71727
|
71728
|
71729
|
71730
|
71731
|
71732
|
71733
|
71734
|
71735
|
71736
|
71827
|
71838
|
71841
|
73293
|
73890
|
75237