From ed7235ece3037e5656436b144f8ab2edb702de07 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 1 Feb 2017 16:38:37 +0100 Subject: [PATCH] Bug 14224: Make strings translatable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The strings should be translatable. This patch also removes the error as it appears that we only have 1 error. To improve we could surround the store with an eval. Signed-off-by: Jonathan Druart Signed-off-by: Josef Moravec Signed-off-by: Marc VĂ©ron --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 18 ++++++++---------- opac/svc/patron_notes | 11 +++-------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 8f0cc94..8424536 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -925,9 +925,9 @@ Using this account is not recommended because some parts of Koha will not functi if(origvalue != value) { if(origvalue != "") - $btn_save.text('Submit changes'); + $btn_save.text(_("Submit changes")); else - $btn_save.text('Submit note'); + $btn_save.text(_("Submit note")); $btn_save.show(); } else { $btn_save.hide(); @@ -958,30 +958,28 @@ Using this account is not recommended because some parts of Koha will not functi $("#notesaved").addClass("alert-info"); $noteinput.data('origvalue', data.note); $noteinput.val(data.note); - message = "

Your note about " + title + " has been saved and sent to the library.

"; + message = "

" + _("Your note about %s has been saved and sent to the library.").format(title) + "

"; + message += "

" + data.note + "

"; $self.hide(); } else if(data.status == 'removed') { $("#notesaved").removeClass("alert-error"); $("#notesaved").addClass("alert-info"); $noteinput.data('origvalue', ""); $noteinput.val(""); - message = "

Your note about " + title + " was removed.

"; + message = "

" + _("Your note about %s was removed.").format(title) + "

"; $self.hide(); } else { $("#notesaved").removeClass("alert-info"); $("#notesaved").addClass("alert-error"); - message = "

Your note about " + title + " could not be saved.

" + - "

" + data.error + "

"; + message = "

" + _("Your note about %s could not be saved.").format(title) + "

"; + message += "

" + _("Something went wrong. The note has not been saved") + "

"; } - - message += "

" + data.note + "

"; $("#notesaved").html(message); }) .fail(function(data) { $("#notesaved").removeClass("alert-info"); $("#notesaved").addClass("alert-error"); - var message = "

Your note about " + title + " could not be saved.

" + - "

Ajax request has failed.

"; + var message = "

" + _("Something went wrong. The note has not been saved") + "

"; $("#notesaved").html(message); }) .always(function() { diff --git a/opac/svc/patron_notes b/opac/svc/patron_notes index 5a103d7..2e25b36 100755 --- a/opac/svc/patron_notes +++ b/opac/svc/patron_notes @@ -56,7 +56,6 @@ if ($is_ajax) { my $issue_id = $query->param('issue_id'); my $clean_note = $scrubber->scrub($note); my $status = "saved"; - my $error = ""; my ($member, $issue); my ( $template, $borrowernumber, $cookie ) = C4::Auth::get_template_and_user({ @@ -72,14 +71,11 @@ if ($is_ajax) { $issue = Koha::Checkouts->find($issue_id); if ( $issue->borrowernumber != $borrowernumber ) { $status = "fail"; - $error = "Invalid issue id!"; } - } else { - $status = "fail"; - $error = "Invalid issue id!"; } - if ( (not $error) && $issue->set({ notedate => dt_from_string(), note => $clean_note })->store ) { + if ( $issue ) { + $issue->set({ notedate => dt_from_string(), note => $clean_note })->store; if($clean_note) { # only send email if note not empty my $branch = Koha::Libraries->find( $issue->branchcode ); my $biblio = GetBiblioFromItemNumber($issue->itemnumber); @@ -98,10 +94,9 @@ if ($is_ajax) { } } else { $status = "fail"; - $error = "Perhaps the item has already been checked in?"; } - my $response = "{\"status\": \"$status\", \"note\": \"$clean_note\", \"issue_id\": \"$issue_id\", \"error\": \"$error\"}"; + my $response = "{\"status\": \"$status\", \"note\": \"$clean_note\", \"issue_id\": \"$issue_id\"}"; output_with_http_headers($query, undef, $response, 'js'); exit; } # END Issue Note -- 2.1.4