From bcaac2d90798e41f19deb61194b1fbada108edb7 Mon Sep 17 00:00:00 2001 From: Julian Maurice 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 | 6 +++++- .../prog/en/includes/members-toolbar.inc | 2 +- .../intranet-tmpl/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 | 19 +++++++++---------- 7 files changed, 19 insertions(+), 27 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 1071f4f..f5315ce 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -552,7 +552,10 @@ $template->param( branchname => GetBranchName($borrower->{'branchcode'}), printer => $printer, printername => $printer, - was_renewed => $query->param('was_renewed') ? 1 : 0, + firstname => $borrower->{'firstname'}, + surname => $borrower->{'surname'}, + showname => $borrower->{'showname'}, + category_type => $borrower->{'category_type'}, expiry => format_date($borrower->{'dateexpiry'}), roadtype => $roadtype, amountold => $amountold, @@ -579,6 +582,7 @@ $template->param( if ($stickyduedate) { $session->param( 'stickyduedate', $duedatespec ); } +$session->flush; my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 70edbc0..fbd9bf7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -107,7 +107,7 @@ function update_child() { function confirm_reregistration() { var is_confirmed = window.confirm(_("Are you sure you want to renew this patron's registration?")); if (is_confirmed) { - window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&cardnumber=[% cardnumber %]&desintation=[% destination %]&reregistration=y'; + window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&cardnumber=[% cardnumber %]&destination=[% destination %]&reregistration=y'; } } function export_barcodes() { 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 0521d9c..a914cc6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -150,6 +150,7 @@ $(document).ready(function() { [% IF ( borrowernumber ) %] [% INCLUDE 'members-toolbar.inc' %] [% END %] +[% INCLUDE 'messages.inc' %] -[% IF ( was_renewed ) %]
Patron's account has been renewed until [% expiry %]
[% END %] - [% IF additional_materials %]
Note about the accompanying materials:
[% 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 b46424e..04b6609 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 @@ -76,11 +76,7 @@
  • Category: [% description %] ([% categorycode %])
  • Registration date: [% dateenrolled %]
  • Expiration date: - [% IF ( was_renewed ) %] - [% dateexpiry %] - [% ELSE %] - [% dateexpiry %] - [% END %] + [% dateexpiry %]
  • Library: [% branchname %]
  • 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 e3ca832..f3c6380 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -162,12 +162,11 @@ function validate1(date) {
    [% END %]
    + [% INCLUDE 'messages.inc' %] [% IF ( unknowuser ) %]
    This patron does not exist.
    [% ELSE %] - [% IF ( was_renewed ) %]
    Patron's account has been renewed until [% dateexpiry %]
    [% END %] - [% IF ( flagged ) %]
      @@ -344,11 +343,7 @@ function validate1(date) {
    • Registration date: [% dateenrolled %]
    • Expiration date: - [% IF ( was_renewed ) %] - [% dateexpiry %] - [% ELSE %] - [% dateexpiry %] - [% END %] + [% dateexpiry %]
    • Library: [% branchname %]
    • diff --git a/members/moremember.pl b/members/moremember.pl index 6a5adcc..f783bf8 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -347,7 +347,6 @@ $template->param( borrowernumber => $borrowernumber, othernames => $data->{'othernames'}, categoryname => $data->{'description'}, - was_renewed => $input->param('was_renewed') ? 1 : 0, branch => $branch, todaysdate => C4::Dates->today(), totalprice => sprintf("%.2f", $totalprice), diff --git a/members/setstatus.pl b/members/setstatus.pl index d91c189..03988c4 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; @@ -54,16 +57,12 @@ if ( $reregistration eq 'y' ) { $sth->finish; } +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"){ - if($dateexpiry){ - print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$cardnumber&was_renewed=1"); - } else { - print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$cardnumber"); - } + print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$cardnumber"); } 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