Bugzilla – Attachment 71303 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.63 KB, created by
Jonathan Druart
on 2018-02-07 18:36:28 UTC
(
hide
)
Description:
Bug 18789: Use Koha::Patron->image from the templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-02-07 18:36:28 UTC
Size:
18.63 KB
patch
obsolete
>From 5b7ce7c895b980e3f2871d961fa21a48fac6d7d1 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) >--- > 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 e30145888d..98928a20ee 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -609,7 +609,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 2b29bfcb9e..dce95f1daf 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 3847adbc2a..c2de0ced78 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -73,7 +73,7 @@ $(document).ready(function() { > ], > "bPaginate": false > })); >- [% IF ( picture ) %] >+ [% IF ( patron.image ) %] > // new YAHOO.widget.Button("delpicture"); // FIXME: formatting mismatch between YUI and normal button > $('#delpicture').click(function(){ > return confirm(_("Are you sure you want to delete this patron image? This cannot be undone.")); >@@ -282,7 +282,7 @@ function validate1(date) { > [% 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 %] >@@ -303,7 +303,7 @@ function validate1(date) { > <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> >@@ -393,7 +393,7 @@ function validate1(date) { > <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> >@@ -486,10 +486,10 @@ function validate1(date) { > <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> >diff --git a/members/boraccount.pl b/members/boraccount.pl >index 01faba4a94..40b2591548 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -99,8 +99,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 d8dece32f7..d076470864 100755 >--- a/members/deletemem.pl >+++ b/members/deletemem.pl >@@ -109,7 +109,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 bd425684f9..db74cfcd1c 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 e7ca1d3a7c..c2060aac08 100755 >--- a/members/files.pl >+++ b/members/files.pl >@@ -115,7 +115,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 c659d0c14e..0e52085193 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 aaaa8afa84..c5434b0599 100755 >--- a/members/mancredit.pl >+++ b/members/mancredit.pl >@@ -87,7 +87,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 5f4e667dd9..6b1a59bdab 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -115,7 +115,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 f7fe9852e1..20a48e4b02 100755 >--- a/members/member-flags.pl >+++ b/members/member-flags.pl >@@ -19,7 +19,6 @@ use Koha::Patron::Categories; > use Koha::Patrons; > > use C4::Output; >-use Koha::Patron::Images; > use Koha::Token; > > my $input = new CGI; >@@ -190,7 +189,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 724381add4..0cb63ad270 100755 >--- a/members/member-password.pl >+++ b/members/member-password.pl >@@ -104,8 +104,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 c598fe6d99..cf996fdba3 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -54,7 +54,6 @@ use C4::Members::Attributes qw(GetBorrowerAttributes); > use Koha::AuthorisedValues; > use Koha::CsvProfiles; > use Koha::Patron::Debarments qw(GetDebarments); >-use Koha::Patron::Images; > use Module::Load; > if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber ); >@@ -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 81c5603b23..535dcb71cb 100755 >--- a/members/notices.pl >+++ b/members/notices.pl >@@ -52,8 +52,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 2d169bfe88..6f50e9b799 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -41,7 +41,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; >@@ -141,8 +140,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 11d0903fed..b2b193114c 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -28,7 +28,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; >@@ -201,9 +200,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 4cf89ca29f..15c39d60f4 100755 >--- a/members/printfeercpt.pl >+++ b/members/printfeercpt.pl >@@ -117,8 +117,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 7dcf38856f..dc7f347a02 100755 >--- a/members/printinvoice.pl >+++ b/members/printinvoice.pl >@@ -117,8 +117,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 74ca8f7bb1..026ab89209 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 4e13a8344b..6894796826 100755 >--- a/members/readingrec.pl >+++ b/members/readingrec.pl >@@ -105,8 +105,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 91c124b985..9605c3771a 100755 >--- a/members/routing-lists.pl >+++ b/members/routing-lists.pl >@@ -89,6 +89,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 c268f0ef7f..98c157e404 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.11.0
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