2016-09-26 09:28:47 +00:00
|
|
|
|
2019-05-21 14:16:27 +00:00
|
|
|
module.exports = {
|
2022-05-30 01:30:33 +00:00
|
|
|
check: function(conn, hash, callback) {
|
|
|
|
this.hash = hash;
|
2019-05-21 14:16:27 +00:00
|
|
|
conn.execQuery('CALL myBasket_check',
|
|
|
|
this._onBasketCheck.bind(this, callback));
|
|
|
|
},
|
2016-09-26 09:28:47 +00:00
|
|
|
|
2019-05-21 14:16:27 +00:00
|
|
|
_onBasketCheck: function(callback, resultSet) {
|
|
|
|
var status = resultSet.fetchValue();
|
2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
if (!status)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var isOk = status == 'UPDATED' || status == 'OK';
|
|
|
|
|
|
|
|
if (status == 'UPDATED')
|
2019-05-21 14:16:27 +00:00
|
|
|
Htk.Toast.showWarning(_('Order items updated'));
|
2016-09-26 09:28:47 +00:00
|
|
|
if (callback)
|
2019-05-21 14:16:27 +00:00
|
|
|
callback(isOk);
|
2016-09-26 09:28:47 +00:00
|
|
|
if (!isOk)
|
2022-05-30 01:30:33 +00:00
|
|
|
this.hash.setAll({form: 'ecomerce/checkout'});
|
2016-09-26 09:28:47 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|