From 874a99098c803b01d305ea9e842d90008f137cd1 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. Needs patches from bugs 8044 and 11848 for string translation --- circ/circulation.pl | 2 +- .../prog/en/includes/members-toolbar.inc | 2 +- .../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, 15 insertions(+), 27 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 91851d2..7899b43 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -709,7 +709,6 @@ $template->param( surname => $borrower->{'surname'}, showname => $borrower->{'showname'}, category_type => $borrower->{'category_type'}, - was_renewed => $query->param('was_renewed') ? 1 : 0, expiry => format_date($borrower->{'dateexpiry'}), categorycode => $borrower->{'categorycode'}, categoryname => $borrower->{description}, @@ -754,6 +753,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 caa2fbf..9404f97 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -69,7 +69,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 6805126..30408c1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -128,6 +128,7 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); [% 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 c9fb845..9799ccf 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 345c728..a2783bf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -182,12 +182,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 ) %]
      @@ -358,11 +357,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 d78cc1f..db5a9fd 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -429,7 +429,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 2c13401..4001746 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.7.10.4