Bug 14224: Make strings translatable

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 <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2017-02-01 16:38:37 +01:00 committed by Kyle M Hall
parent a7df1afe60
commit 88852ffbb0
2 changed files with 11 additions and 18 deletions

View file

@ -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 = "<p>Your note about " + title + " has been saved and sent to the library.</p>";
message = "<p>" + _("Your note about %s has been saved and sent to the library.").format(title) + "</p>";
message += "<p style=\"font-style:italic;\">" + data.note + "</p>";
$self.hide();
} else if(data.status == 'removed') {
$("#notesaved").removeClass("alert-error");
$("#notesaved").addClass("alert-info");
$noteinput.data('origvalue', "");
$noteinput.val("");
message = "<p>Your note about " + title + " was removed.</p>";
message = "<p>" + _("Your note about %s was removed.").format(title) + "</p>";
$self.hide();
} else {
$("#notesaved").removeClass("alert-info");
$("#notesaved").addClass("alert-error");
message = "<p>Your note about " + title + " could not be saved.</p>" +
"<p style=\"font-weight:bold;\">" + data.error + "</p>";
message = "<p>" + _("Your note about %s could not be saved.").format(title) + "</p>";
message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
}
message += "<p style=\"font-style:italic;\">" + data.note + "</p>";
$("#notesaved").html(message);
})
.fail(function(data) {
$("#notesaved").removeClass("alert-info");
$("#notesaved").addClass("alert-error");
var message = "<p>Your note about " + title + " could not be saved.</p>" +
"<p style=\"font-weight:bold;\">Ajax request has failed.</p>";
var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
$("#notesaved").html(message);
})
.always(function() {

View file

@ -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