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

(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-44 / +60 lines)
Lines 110-133 $(document).ready(function() { Link Here
110
                exempt_fine:    $("#exemptfine").is(':checked')
110
                exempt_fine:    $("#exemptfine").is(':checked')
111
            };
111
            };
112
112
113
            $.post( "/cgi-bin/koha/svc/checkin", params, function( data ) {
113
            $.post({
114
                id = "#checkin_" + data.itemnumber;
114
                url: "/cgi-bin/koha/svc/checkin",
115
115
                data: params,
116
                content = "";
116
                success: function( data ) {
117
                if ( data.returned ) {
117
                    id = "#checkin_" + data.itemnumber;
118
                    content = __("Checked in");
118
119
                    $(id).parent().parent().addClass('ok');
119
                    content = "";
120
                    $('#date_due_' + data.itemnumber).html( __("Checked in") );
120
                    if ( data.returned ) {
121
                    if ( data.patronnote != null ) {
121
                        content = __("Checked in");
122
                        $('.patron_note_' + data.itemnumber).html( __("Patron note") + ": " + data.patronnote);
122
                        $(id).parent().parent().addClass('ok');
123
                        $('#date_due_' + data.itemnumber).html( __("Checked in") );
124
                        if ( data.patronnote != null ) {
125
                            $('.patron_note_' + data.itemnumber).html( __("Patron note") + ": " + data.patronnote);
126
                        }
127
                    } else {
128
                        content = __("Unable to check in");
129
                        $(id).parent().parent().addClass('warn');
123
                    }
130
                    }
124
                } else {
125
                    content = __("Unable to check in");
126
                    $(id).parent().parent().addClass('warn');
127
                }
128
131
129
                $(id).replaceWith( content );
132
                    $(id).replaceWith( content );
130
            }, "json")
133
                },
134
                dataType: "json",
135
                async: false,
136
            });
131
        });
137
        });
132
138
133
        $(".confirm:checked:visible").each(function() {
139
        $(".confirm:checked:visible").each(function() {
Lines 170-205 $(document).ready(function() { Link Here
170
                params.date_due = dueDate
176
                params.date_due = dueDate
171
            }
177
            }
172
178
173
            $.post( "/cgi-bin/koha/svc/renew", params, function( data ) {
179
            $.post({
174
                var id = "#renew_" + data.itemnumber;
180
                url: "/cgi-bin/koha/svc/renew",
175
181
                data: params,
176
                var content = "";
182
                success: function( data ) {
177
                if ( data.renew_okay ) {
183
                    var id = "#renew_" + data.itemnumber;
178
                    content = __("Renewed, due:") + " " + data.date_due;
184
                    console.log( data);
179
                    $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
185
                    console.log( data.renew_okay);
180
                } else {
186
                    console.log( data.itemnumber);
181
                    content = __("Renew failed:") + " ";
187
182
                    if ( data.error == "no_checkout" ) {
188
                    var content = "";
183
                        content += __("not checked out");
189
                    if ( data.renew_okay ) {
184
                    } else if ( data.error == "too_many" ) {
190
                        content = __("Renewed, due:") + " " + data.date_due;
185
                        content += __("too many renewals");
191
                        $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
186
                    } else if ( data.error == "too_unseen" ) {
187
                        content += __("too many consecutive renewals without being seen by the library");
188
                    } else if ( data.error == "on_reserve" ) {
189
                        content += __("on hold");
190
                    } else if ( data.error == "restriction" ) {
191
                        content += __("Not allowed: patron restricted");
192
                    } else if ( data.error == "overdue" ) {
193
                        content += __("Not allowed: overdue");
194
                    } else if ( data.error ) {
195
                        content += data.error;
196
                    } else {
192
                    } else {
197
                        content += __("reason unknown");
193
                        content = __("Renew failed:") + " ";
194
                        if ( data.error == "no_checkout" ) {
195
                            content += __("not checked out");
196
                        } else if ( data.error == "too_many" ) {
197
                            content += __("too many renewals");
198
                        } else if ( data.error == "too_unseen" ) {
199
                            content += __("too many consecutive renewals without being seen by the library");
200
                        } else if ( data.error == "on_reserve" ) {
201
                            content += __("on hold");
202
                        } else if ( data.error == "restriction" ) {
203
                            content += __("Not allowed: patron restricted");
204
                        } else if ( data.error == "overdue" ) {
205
                            content += __("Not allowed: overdue");
206
                        } else if ( data.error ) {
207
                            content += data.error;
208
                        } else {
209
                            content += __("reason unknown");
210
                        }
198
                    }
211
                    }
199
                }
212
                    console.log(content);
213
                    console.log(id);
200
214
201
                $(id).replaceWith( content );
215
                    $(id).replaceWith( content );
202
            }, "json")
216
            },
217
            dataType: "json",
218
            async: false,
219
            });
203
        });
220
        });
204
221
205
        // Refocus on barcode field if it exists
222
        // Refocus on barcode field if it exists
206
- 

Return to bug 26208