fix: empty cashbox conditional
This commit is contained in:
parent
616d2d2915
commit
f16be1d263
2 changed files with 4 additions and 28 deletions
|
|
@ -142,7 +142,7 @@ function emptyCashInBills (rec) {
|
|||
function setCassetteBills (rec) {
|
||||
return db.oneOrNone(`SELECT cashbox FROM devices WHERE device_id=$1 LIMIT 1`, [rec.deviceId])
|
||||
.then(oldCashboxValue => {
|
||||
if (_.isNil(oldCashboxValue) || rec.cashbox === oldCashboxValue) {
|
||||
if (_.isNil(oldCashboxValue) || rec.cashbox === oldCashboxValue.cashbox) {
|
||||
const sql = 'UPDATE devices SET cashbox=$1, cassette1=$2, cassette2=$3, cassette3=$4, cassette4=$5 WHERE device_id=$6'
|
||||
return db.none(sql, [rec.cashbox, rec.cassettes[0], rec.cassettes[1], rec.cassettes[2], rec.cassettes[3], rec.deviceId])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue