From 88852ffbb0de4a3b06df50921d555cec9b525957 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=utf8 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 Signed-off-by: Kyle M Hall --- .../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 3b652d5cc9..f2607965f6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -953,9 +953,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(); @@ -986,30 +986,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 5a103d73e2..2e25b36799 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.39.5