View | Details | Raw Unified | Return to bug 14224
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-10 / +8 lines)
Lines 925-933 Using this account is not recommended because some parts of Koha will not functi Link Here
925
925
926
                    if(origvalue != value) {
926
                    if(origvalue != value) {
927
                        if(origvalue != "")
927
                        if(origvalue != "")
928
                            $btn_save.text('Submit changes');
928
                            $btn_save.text(_("Submit changes"));
929
                        else
929
                        else
930
                            $btn_save.text('Submit note');
930
                            $btn_save.text(_("Submit note"));
931
                        $btn_save.show();
931
                        $btn_save.show();
932
                    } else {
932
                    } else {
933
                        $btn_save.hide();
933
                        $btn_save.hide();
Lines 958-987 Using this account is not recommended because some parts of Koha will not functi Link Here
958
                            $("#notesaved").addClass("alert-info");
958
                            $("#notesaved").addClass("alert-info");
959
                            $noteinput.data('origvalue', data.note);
959
                            $noteinput.data('origvalue', data.note);
960
                            $noteinput.val(data.note);
960
                            $noteinput.val(data.note);
961
                            message = "<p>Your note about " + title + " has been saved and sent to the library.</p>";
961
                            message = "<p>" + _("Your note about %s has been saved and sent to the library.").format(title) + "</p>";
962
                            message += "<p style=\"font-style:italic;\">" + data.note + "</p>";
962
                            $self.hide();
963
                            $self.hide();
963
                        } else if(data.status == 'removed') {
964
                        } else if(data.status == 'removed') {
964
                            $("#notesaved").removeClass("alert-error");
965
                            $("#notesaved").removeClass("alert-error");
965
                            $("#notesaved").addClass("alert-info");
966
                            $("#notesaved").addClass("alert-info");
966
                            $noteinput.data('origvalue', "");
967
                            $noteinput.data('origvalue', "");
967
                            $noteinput.val("");
968
                            $noteinput.val("");
968
                            message = "<p>Your note about " + title + " was removed.</p>";
969
                            message = "<p>" + _("Your note about %s was removed.").format(title) + "</p>";
969
                            $self.hide();
970
                            $self.hide();
970
                        } else {
971
                        } else {
971
                            $("#notesaved").removeClass("alert-info");
972
                            $("#notesaved").removeClass("alert-info");
972
                            $("#notesaved").addClass("alert-error");
973
                            $("#notesaved").addClass("alert-error");
973
                            message = "<p>Your note about " + title + " could not be saved.</p>" +
974
                            message =  "<p>" + _("Your note about %s could not be saved.").format(title) + "</p>";
974
                                      "<p style=\"font-weight:bold;\">" + data.error + "</p>";
975
                            message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
975
                        }
976
                        }
976
977
                        message += "<p style=\"font-style:italic;\">" + data.note + "</p>";
978
                        $("#notesaved").html(message);
977
                        $("#notesaved").html(message);
979
                    })
978
                    })
980
                    .fail(function(data) {
979
                    .fail(function(data) {
981
                        $("#notesaved").removeClass("alert-info");
980
                        $("#notesaved").removeClass("alert-info");
982
                        $("#notesaved").addClass("alert-error");
981
                        $("#notesaved").addClass("alert-error");
983
                        var message = "<p>Your note about " + title + " could not be saved.</p>" +
982
                        var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
984
                                      "<p style=\"font-weight:bold;\">Ajax request has failed.</p>";
985
                        $("#notesaved").html(message);
983
                        $("#notesaved").html(message);
986
                    })
984
                    })
987
                    .always(function() {
985
                    .always(function() {
(-)a/opac/svc/patron_notes (-9 / +3 lines)
Lines 56-62 if ($is_ajax) { Link Here
56
        my $issue_id = $query->param('issue_id');
56
        my $issue_id = $query->param('issue_id');
57
        my $clean_note = $scrubber->scrub($note);
57
        my $clean_note = $scrubber->scrub($note);
58
        my $status = "saved";
58
        my $status = "saved";
59
        my $error = "";
60
        my ($member, $issue);
59
        my ($member, $issue);
61
60
62
        my ( $template, $borrowernumber, $cookie ) = C4::Auth::get_template_and_user({
61
        my ( $template, $borrowernumber, $cookie ) = C4::Auth::get_template_and_user({
Lines 72-85 if ($is_ajax) { Link Here
72
            $issue = Koha::Checkouts->find($issue_id);
71
            $issue = Koha::Checkouts->find($issue_id);
73
            if ( $issue->borrowernumber != $borrowernumber ) {
72
            if ( $issue->borrowernumber != $borrowernumber ) {
74
                $status = "fail";
73
                $status = "fail";
75
                $error = "Invalid issue id!";
76
            }
74
            }
77
        } else {
78
            $status = "fail";
79
            $error = "Invalid issue id!";
80
        }
75
        }
81
76
82
        if ( (not $error) && $issue->set({ notedate => dt_from_string(), note => $clean_note })->store ) {
77
        if ( $issue ) {
78
            $issue->set({ notedate => dt_from_string(), note => $clean_note })->store;
83
            if($clean_note) { # only send email if note not empty
79
            if($clean_note) { # only send email if note not empty
84
                my $branch = Koha::Libraries->find( $issue->branchcode );
80
                my $branch = Koha::Libraries->find( $issue->branchcode );
85
                my $biblio = GetBiblioFromItemNumber($issue->itemnumber);
81
                my $biblio = GetBiblioFromItemNumber($issue->itemnumber);
Lines 98-107 if ($is_ajax) { Link Here
98
            }
94
            }
99
        } else {
95
        } else {
100
            $status = "fail";
96
            $status = "fail";
101
            $error = "Perhaps the item has already been checked in?";
102
        }
97
        }
103
98
104
        my $response = "{\"status\": \"$status\", \"note\": \"$clean_note\", \"issue_id\": \"$issue_id\", \"error\": \"$error\"}";
99
        my $response = "{\"status\": \"$status\", \"note\": \"$clean_note\", \"issue_id\": \"$issue_id\"}";
105
        output_with_http_headers($query, undef, $response, 'js');
100
        output_with_http_headers($query, undef, $response, 'js');
106
        exit;
101
        exit;
107
    } # END Issue Note
102
    } # END Issue Note
108
- 

Return to bug 14224