2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
module.exports =
|
|
|
|
{
|
2017-04-05 14:06:07 +00:00
|
|
|
check: function (conn, hash, callback)
|
2016-09-26 09:28:47 +00:00
|
|
|
{
|
2017-04-05 14:06:07 +00:00
|
|
|
this.hash = hash;
|
2017-03-17 12:42:10 +00:00
|
|
|
conn.execQuery ('CALL basketCheck ()',
|
2016-09-26 09:28:47 +00:00
|
|
|
this._onBasketCheck.bind (this, callback));
|
|
|
|
}
|
|
|
|
|
|
|
|
,_onBasketCheck: function (callback, resultSet)
|
|
|
|
{
|
|
|
|
var status = resultSet.fetchValue ();
|
2017-04-05 14:06:07 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
if (!status)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var isOk = status == 'UPDATED' || status == 'OK';
|
|
|
|
|
|
|
|
if (status == 'UPDATED')
|
2016-10-20 16:37:28 +00:00
|
|
|
Htk.Toast.showWarning (_('Order items updated'));
|
2016-09-26 09:28:47 +00:00
|
|
|
if (callback)
|
|
|
|
callback (isOk);
|
|
|
|
if (!isOk)
|
2017-04-05 14:06:07 +00:00
|
|
|
this.hash.setAll ({'form': 'ecomerce/checkout'});
|
2016-09-26 09:28:47 +00:00
|
|
|
}
|
|
|
|
};
|