address data changes
This commit is contained in:
parent
b77395762c
commit
17143883f8
|
@ -11,7 +11,7 @@ module.exports = function(Self) {
|
|||
|
||||
function create(data, next) {
|
||||
if (data.isDefaultAddress) {
|
||||
removeAllDefault({id: data.clientFk}, next);
|
||||
removeAllDefault(data, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ module.exports = function(Self) {
|
|||
}
|
||||
|
||||
function removeAllDefault(client, next) {
|
||||
if (client && client.id)
|
||||
Self.updateAll({clientFk: client.id, isDefaultAddress: {neq: 0}}, {isDefaultAddress: false}, next);
|
||||
if (client && client.clientFk)
|
||||
Self.updateAll({clientFk: client.clientFk, isDefaultAddress: {neq: 0}}, {isDefaultAddress: false}, next);
|
||||
else
|
||||
next();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue