1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-30 04:13:01 +00:00

Fix some errors on JS string interpolation

This commit is contained in:
Yohann D'ANELLO 2020-11-15 23:37:36 +01:00
parent 2682e9a610
commit 23243e09bb

View File

@ -305,25 +305,25 @@ $('#btn_transfer').click(function () {
const newBalance = source.note.balance - source.quantity * dest.quantity * amount const newBalance = source.note.balance - source.quantity * dest.quantity * amount
if (newBalance <= -5000) { if (newBalance <= -5000) {
addMsg(interpolate(gettext('Warning, the transaction of %s from the note %s to the note %s succeed, but the emitter note %s is very negative.'), addMsg(interpolate(gettext('Warning, the transaction of %s from the note %s to the note %s succeed, but the emitter note %s is very negative.'),
[pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name]), 'danger', 10000) [pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name, source.name]), 'danger', 10000)
reset() reset()
return return
} else if (newBalance < 0) { } else if (newBalance < 0) {
addMsg(interpolate(gettext('Warning, the transaction of %s from the note %s to the note %s succeed, but the emitter note %s is negative.'), addMsg(interpolate(gettext('Warning, the transaction of %s from the note %s to the note %s succeed, but the emitter note %s is negative.'),
[pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name]), 'danger', 10000) [pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name, source.name]), 'danger', 10000)
reset() reset()
return return
} }
} }
addMsg(interpolate(gettext('Transfer of %s from %s to %s succeed!'), addMsg(interpolate(gettext('Transfer of %s from %s to %s succeed!'),
[pretty_money((source.quantity * dest.quantity * amount), source.name, dest.name)]), 'success', 10000) [pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name]), 'success', 10000)
reset() reset()
}).fail(function (err) { // do it again but valid = false }).fail(function (err) { // do it again but valid = false
const errObj = JSON.parse(err.responseText) const errObj = JSON.parse(err.responseText)
if (errObj.non_field_errors) { if (errObj.non_field_errors) {
addMsg(interpolate(gettext('Transfer of %s from %s to %s failed: %s'), addMsg(interpolate(gettext('Transfer of %s from %s to %s failed: %s'),
[pretty_money(source.quantity * dest.quantity * amount), source.name, + dest.name, errObj.non_field_errors]), 'danger') [pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name, errObj.non_field_errors]), 'danger')
LOCK = false LOCK = false
return return
} }