Bug 10240: (follow-up) don't delete transactions if auth fails
When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
9db23b8483
commit
cbf7e3b11b
|
|
@ -111,16 +111,26 @@ function synchronize() {
|
|||
$('#upload-transactions').click(function () {
|
||||
$('.loading-overlay div').text(_("Uploading transactions, please wait..."));
|
||||
$('.loading-overlay').show();
|
||||
var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction);
|
||||
uploadIter.done(function() {
|
||||
$.indexedDB("koha").transaction(["transactions"]).then(function(){
|
||||
}, function(err, e){
|
||||
}, function(transaction){
|
||||
transaction.objectStore("transactions").clear();
|
||||
});
|
||||
$('.loading-overlay').hide();
|
||||
kohadb.saveSetting("dirty", false);
|
||||
$('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/cgi-bin/koha/offline_circ/service.pl",
|
||||
}).done(function (data) {
|
||||
if (data) {
|
||||
$('.loading-overlay').hide();
|
||||
alert(_("Please log in to Koha and try again. (Error: '" + data + "')"));
|
||||
} else {
|
||||
var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction);
|
||||
uploadIter.done(function() {
|
||||
$.indexedDB("koha").transaction(["transactions"]).then(function(){
|
||||
}, function(err, e){
|
||||
}, function(transaction){
|
||||
transaction.objectStore("transactions").clear();
|
||||
});
|
||||
$('.loading-overlay').hide();
|
||||
kohadb.saveSetting("dirty", false);
|
||||
$('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue