Bugzilla – Attachment 48418 Details for
Bug 11904
Proposal for a uniform way to send messages to user interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11904: Example usage of new module Koha::Messages
Bug-11904-Example-usage-of-new-module-KohaMessages.patch (text/plain), 6.85 KB, created by
Julian Maurice
on 2016-02-27 16:03:36 UTC
(
hide
)
Description:
Bug 11904: Example usage of new module Koha::Messages
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2016-02-27 16:03:36 UTC
Size:
6.85 KB
patch
obsolete
>From efeef2e843bab2d080fa6874f8cb1b5db036d5d6 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 20 Feb 2014 23:56:04 +0100 >Subject: [PATCH] Bug 11904: Example usage of new module Koha::Messages > >Test plan: >1/ Go to members/moremember.pl >2/ Click on "More" -> "Renew patron" and confirm >3/ A message should appear "Patron's account has been renewed until ..." >4/ In a shell, go to misc/translator and run > ./translate create fr-FR (or ./translate update fr-FR) > ./translate install fr-FR > (you can use your own language of course) >5/ Edit po/fr-FR-messages.po and translate the string "Patron's account > has been renewed until ..." >6/ In staff interface change language to French and renew patron once >again. >7/ The translated message should appear. >--- > circ/circulation.pl | 3 ++- > .../prog/en/modules/circ/circulation.tt | 3 +-- > .../prog/en/modules/members/moremember-brief.tt | 6 +----- > .../prog/en/modules/members/moremember.tt | 9 ++------- > members/moremember.pl | 1 - > members/setstatus.pl | 22 +++++++++++----------- > 6 files changed, 17 insertions(+), 27 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index ea07e29..0499944 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -600,7 +600,6 @@ $template->param( > branchname => GetBranchName($borrower->{'branchcode'}), > printer => $printer, > printername => $printer, >- was_renewed => $query->param('was_renewed') ? 1 : 0, > expiry => $borrower->{'dateexpiry'}, > roadtype => $roadtype, > amountold => $amountold, >@@ -625,6 +624,8 @@ $template->param( > relatives_borrowernumbers => \@relatives, > ); > >+$session->flush; >+ > my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); > $template->param( picture => 1 ) if $picture; > >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 5038e47..cdb49bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -152,6 +152,7 @@ $(document).ready(function() { > [% IF ( borrowernumber ) %] > [% INCLUDE 'members-toolbar.inc' %] > [% END %] >+[% INCLUDE 'messages.inc' %] > > <!-- INITIAL BLOC : PARAMETERS & BORROWER INFO --> > <div style="display: none;" id="add_message_form"> >@@ -191,8 +192,6 @@ $(document).ready(function() { > </form> > </div> > >-[% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% expiry | $KohaDates %]</div>[% END %] >- > [% IF additional_materials %] > <div id="materials" class="dialog message">Note about the accompanying materials: <br /> > [% additional_materials %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >index 34367d8..673bb51 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >@@ -73,11 +73,7 @@ > <li><span class="label">Category: </span>[% description %] ([% categorycode %])</li> > <li><span class="label">Registration date: </span>[% dateenrolled | $KohaDates %]</li> > <li><span class="label">Expiration date: </span> >- [% IF ( was_renewed ) %] >- <strong class="reregistrinfo">[% dateexpiry | $KohaDates %]</strong> >- [% ELSE %] >- [% dateexpiry | $KohaDates %] >- [% END %] >+ [% dateexpiry | $KohaDates %] > </li> > <li><span class="label">Library: </span>[% branchname %]</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 adaedb5..b519906 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -164,12 +164,11 @@ function validate1(date) { > </div> > [% END %] > <div class="yui-g"> >+ [% INCLUDE 'messages.inc' %] > > [% IF ( unknowuser ) %] > <div class="dialog message">This patron does not exist.</div> > [% ELSE %] >- [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %] >- > [% IF ( flagged ) %] > <div id="circmessages" class="circmessage attention"> > <ul> >@@ -342,11 +341,7 @@ function validate1(date) { > <li><span class="label">Registration date: </span>[% dateenrolled | $KohaDates %]</li> > > <li><span class="label">Expiration date: </span> >- [% IF ( was_renewed ) %] >- <strong class="reregistrinfo">[% dateexpiry | $KohaDates %]</strong> >- [% ELSE %] >- [% dateexpiry | $KohaDates %] >- [% END %] >+ [% dateexpiry | $KohaDates %] > </li> > > <li><span class="label">Library: </span>[% branchname %]</li> >diff --git a/members/moremember.pl b/members/moremember.pl >index e233b46..e1d8aef 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -340,7 +340,6 @@ $template->param( > borrowernumber => $borrowernumber, > othernames => $data->{'othernames'}, > categoryname => $data->{'description'}, >- was_renewed => $input->param('was_renewed') ? 1 : 0, > branch => $branch, > todaysdate => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), > totalprice => sprintf("%.2f", $totalprice), >diff --git a/members/setstatus.pl b/members/setstatus.pl >index 69849aa..5ef4b6b 100755 >--- a/members/setstatus.pl >+++ b/members/setstatus.pl >@@ -31,6 +31,9 @@ use C4::Context; > use C4::Members; > use C4::Auth; > >+use Koha::I18N; >+use Koha::Messages; >+use Koha::DateUtils; > > my $input = new CGI; > >@@ -53,16 +56,13 @@ if ( $reregistration eq 'y' ) { > $sth->finish; > } > >-if($destination eq "circ"){ >- if($dateexpiry){ >- print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber&was_renewed=1"); >- } else { >- print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); >- } >+if ($dateexpiry) { >+ $dateexpiry = output_pref({dt => dt_from_string($dateexpiry, 'iso'), dateonly => 1}); >+ messages_set(gettext("Patron's account has been renewed until %1", $dateexpiry)); >+} >+ >+if ($destination eq "circ") { >+ print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); > } else { >- if($dateexpiry){ >- print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber&was_renewed=1"); >- } else { >- print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); >- } >+ print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); > } >-- >1.9.1
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 11904
:
25910
|
25911
|
25912
|
27940
|
27941
|
27942
|
29545
|
29546
|
29547
|
29552
|
29553
|
29554
|
30579
|
30580
|
30581
|
38522
|
38523
|
38524
|
40960
|
40961
|
40962
|
48415
|
48416
|
48417
|
48418
|
49059
|
49060
|
49061
|
49263
|
49264
|
49265