This commit is contained in:
parent
ac6851bf4a
commit
4729dda5f6
|
@ -31,6 +31,8 @@ export default {
|
|||
name: `${components.vnTextfield}[name="name"]`,
|
||||
taxNumber: `${components.vnTextfield}[name="fi"]`,
|
||||
socialName: `${components.vnTextfield}[name="socialName"]`,
|
||||
street: `${components.vnTextfield}[name="street"]`,
|
||||
city: `${components.vnTextfield}[name="city"]`,
|
||||
userName: `${components.vnTextfield}[name="userName"]`,
|
||||
email: `${components.vnTextfield}[name="email"]`,
|
||||
salesPersonAutocomplete: `vn-autocomplete[field="$ctrl.client.salesPersonFk"]`,
|
||||
|
|
|
@ -52,6 +52,8 @@ describe('Client create path', () => {
|
|||
const result = await nightmare
|
||||
.write(selectors.createClientView.name, 'Carol Danvers')
|
||||
.write(selectors.createClientView.socialName, 'AVG tax')
|
||||
.write(selectors.createClientView.street, 'Many places')
|
||||
.write(selectors.createClientView.city, 'Silla')
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.write(selectors.createClientView.email, 'incorrect email format')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
|
|
|
@ -37,5 +37,7 @@
|
|||
"Barcode must be unique": "Barcode must be unique",
|
||||
"You don't have enough privileges to do that": "You don't have enough privileges to do that",
|
||||
"You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client",
|
||||
"can't be blank": "can't be blank"
|
||||
"can't be blank": "can't be blank",
|
||||
"Street cannot be empty": "Street cannot be empty",
|
||||
"City cannot be empty": "City cannot be empty"
|
||||
}
|
|
@ -68,5 +68,9 @@
|
|||
"Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
|
||||
"ORDER_EMPTY": "Cesta vacía",
|
||||
"You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
|
||||
"You can't create a ticket for a client that has a debt": "No puedes crear un ticket para un client con deuda"
|
||||
"You can't create a ticket for a client that has a debt": "No puedes crear un ticket para un client con deuda",
|
||||
"NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
|
||||
"Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
|
||||
"Street cannot be empty": "Street cannot be empty",
|
||||
"City cannot be empty": "City cannot be empty"
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
},
|
||||
"vn": {
|
||||
"connector": "vn-mysql",
|
||||
"timezone": "local",
|
||||
"database": "vn",
|
||||
"debug": false,
|
||||
"host": "localhost",
|
||||
|
@ -13,6 +12,7 @@
|
|||
"password": "root",
|
||||
"multipleStatements": true,
|
||||
"connectTimeout": 20000,
|
||||
"acquireTimeout": 20000
|
||||
"acquireTimeout": 20000,
|
||||
"dateStrings": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
module.exports = function(Self) {
|
||||
Self.remoteMethod('createDefaultAddress', {
|
||||
description: 'Creates both client and its web account',
|
||||
accepts: {
|
||||
arg: 'data',
|
||||
type: 'object',
|
||||
http: {source: 'body'}
|
||||
},
|
||||
returns: {
|
||||
root: true,
|
||||
type: 'Object'
|
||||
},
|
||||
http: {
|
||||
verb: 'post',
|
||||
path: '/createDefaultAddress'
|
||||
}
|
||||
});
|
||||
|
||||
Self.createDefaultAddress = async data => {
|
||||
const Address = Self.app.models.Address;
|
||||
const Client = Self.app.models.Client;
|
||||
const transaction = await Address.beginTransaction({});
|
||||
|
||||
try {
|
||||
let address = data.address;
|
||||
let newAddress = await Address.create(address, {transaction});
|
||||
let client = await Client.findById(address.clientFk, {transaction});
|
||||
|
||||
if (data.isDefaultAddress) {
|
||||
await client.updateAttributes({
|
||||
defaultAddressFk: newAddress.id
|
||||
}, {transaction});
|
||||
}
|
||||
|
||||
await transaction.commit();
|
||||
return newAddress;
|
||||
} catch (e) {
|
||||
await transaction.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -0,0 +1,35 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
fdescribe('Address createDefaultAddress', () => {
|
||||
let address;
|
||||
let client;
|
||||
|
||||
afterAll(async() => {
|
||||
await client.updateAttributes({defaultAddressFk: 1});
|
||||
await address.destroy();
|
||||
});
|
||||
|
||||
it('should verify that client defaultAddressFk is untainted', async() => {
|
||||
client = await app.models.Client.findById(101);
|
||||
|
||||
expect(client.defaultAddressFk).toEqual(1);
|
||||
});
|
||||
|
||||
it('should create a new address and set as a client default address', async() => {
|
||||
let data = {
|
||||
address: {
|
||||
clientFk: 101,
|
||||
nickname: 'My address',
|
||||
street: 'Wall Street',
|
||||
city: 'New York',
|
||||
|
||||
},
|
||||
isDefaultAddress: true
|
||||
};
|
||||
|
||||
address = await app.models.Address.createDefaultAddress(data);
|
||||
client = await app.models.Client.findById(101);
|
||||
|
||||
expect(client.defaultAddressFk).toEqual(address.id);
|
||||
});
|
||||
});
|
|
@ -23,13 +23,13 @@ module.exports = function(Self) {
|
|||
email: firstEmail,
|
||||
password: parseInt(Math.random() * 100000000000000)
|
||||
};
|
||||
let Account = Self.app.models.Account;
|
||||
|
||||
let transaction = await Account.beginTransaction({});
|
||||
const Account = Self.app.models.Account;
|
||||
const Address = Self.app.models.Address;
|
||||
const transaction = await Account.beginTransaction({});
|
||||
|
||||
try {
|
||||
let account = await Account.create(user, {transaction});
|
||||
let client = {
|
||||
let client = await Self.create({
|
||||
id: account.id,
|
||||
name: data.name,
|
||||
fi: data.fi,
|
||||
|
@ -42,10 +42,26 @@ module.exports = function(Self) {
|
|||
provinceFk: data.provinceFk,
|
||||
countryFk: data.countryFk,
|
||||
isEqualizated: data.isEqualizated
|
||||
};
|
||||
newClient = await Self.create(client);
|
||||
}, {transaction});
|
||||
|
||||
|
||||
let address = await Address.create({
|
||||
clientFk: client.id,
|
||||
nickname: client.name,
|
||||
city: client.city,
|
||||
street: client.street,
|
||||
postalCode: client.postcode,
|
||||
provinceFk: client.provinceFk,
|
||||
isEqualizated: client.isEqualizated,
|
||||
isActive: true
|
||||
}, {transaction});
|
||||
|
||||
await client.updateAttributes({
|
||||
defaultAddressFk: address.id
|
||||
}, {transaction});
|
||||
|
||||
await transaction.commit();
|
||||
return newClient;
|
||||
return client;
|
||||
} catch (e) {
|
||||
await transaction.rollback();
|
||||
throw e;
|
||||
|
|
|
@ -3,14 +3,6 @@ const app = require('vn-loopback/server/server');
|
|||
describe('Client Create', () => {
|
||||
const clientName = 'Wade';
|
||||
const AccountName = 'Deadpool';
|
||||
/* beforeAll(async() => {
|
||||
let address = await app.models.Address.findOne({where: {nickname: clientName}});
|
||||
let client = await app.models.Client.findOne({where: {name: clientName}});
|
||||
let account = await app.models.Account.findOne({where: {name: AccountName}});
|
||||
await app.models.Address.destroyById(address.id);
|
||||
await app.models.Client.destroyById(client.id);
|
||||
await app.models.Account.destroyById(account.id);
|
||||
}); */
|
||||
|
||||
afterAll(async() => {
|
||||
let address = await app.models.Address.findOne({where: {nickname: clientName}});
|
||||
|
|
|
@ -78,9 +78,8 @@ module.exports = Self => {
|
|||
}
|
||||
},
|
||||
{
|
||||
relation: 'addresses',
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
where: {isDefaultAddress: true},
|
||||
fields: ['nickname', 'street', 'city', 'postalCode']
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,13 +3,8 @@ let getFinalState = require('vn-loopback/util/hook').getFinalState;
|
|||
let isMultiple = require('vn-loopback/util/hook').isMultiple;
|
||||
|
||||
module.exports = Self => {
|
||||
Self.validate('isDefaultAddress', isActive,
|
||||
{message: 'Unable to default a disabled consignee'}
|
||||
);
|
||||
|
||||
function isActive(err) {
|
||||
if (!this.isActive && this.isDefaultAddress) err();
|
||||
}
|
||||
// Methods
|
||||
require('../methods/address/createDefaultAddress')(Self);
|
||||
|
||||
Self.validateAsync('isEqualizated', cannotHaveET, {
|
||||
message: 'Cannot check Equalization Tax in this NIF/CIF'
|
||||
|
@ -50,31 +45,26 @@ module.exports = Self => {
|
|||
// Helpers
|
||||
|
||||
Self.observe('before save', async function(ctx) {
|
||||
const Client = Self.app.models.Client;
|
||||
|
||||
if (isMultiple(ctx)) return;
|
||||
|
||||
let transaction = {};
|
||||
if (ctx.options && ctx.options.transaction)
|
||||
transaction = ctx.options.transaction;
|
||||
|
||||
let changes = ctx.data || ctx.instance;
|
||||
let finalState = getFinalState(ctx);
|
||||
|
||||
if (changes.isActive == false && finalState.isDefaultAddress)
|
||||
const client = await Client.findById(finalState.clientFk, {
|
||||
fields: ['isEqualizated', 'defaultAddressFk']
|
||||
}, {transaction});
|
||||
|
||||
if (changes.isActive == false && client.defaultAddressFk === finalState.id)
|
||||
throw new UserError('The default consignee can not be unchecked');
|
||||
|
||||
if (changes.isDefaultAddress == true && finalState.isActive != false) {
|
||||
let filter = {
|
||||
clientFk: finalState.clientFk,
|
||||
isDefaultAddress: {neq: false}
|
||||
};
|
||||
await Self.updateAll(filter, {isDefaultAddress: false});
|
||||
}
|
||||
|
||||
if (ctx.isNewInstance == true) {
|
||||
let filter = {
|
||||
where: {
|
||||
id: ctx.instance.clientFk
|
||||
},
|
||||
fields: ['isEqualizated']
|
||||
};
|
||||
let findOneResponse = await Self.app.models.Client.findOne(filter);
|
||||
ctx.instance.isEqualizated = findOneResponse.isEqualizated;
|
||||
}
|
||||
// Propagate client isEqualizated to all addresses
|
||||
if (ctx.isNewInstance == true)
|
||||
ctx.instance.isEqualizated = client.isEqualizated;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -42,9 +42,6 @@
|
|||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isDefaultAddress": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"longitude": {
|
||||
"type": "Number"
|
||||
},
|
||||
|
|
|
@ -21,6 +21,14 @@ module.exports = Self => {
|
|||
|
||||
// Validations
|
||||
|
||||
Self.validatesPresenceOf('street', {
|
||||
message: 'Street cannot be empty'
|
||||
});
|
||||
|
||||
Self.validatesPresenceOf('city', {
|
||||
message: 'City cannot be empty'
|
||||
});
|
||||
|
||||
Self.validatesUniquenessOf('fi', {
|
||||
message: 'TIN must be unique'
|
||||
});
|
||||
|
@ -124,6 +132,19 @@ module.exports = Self => {
|
|||
done();
|
||||
}
|
||||
|
||||
Self.validateAsync('defaultAddressFk', isActive,
|
||||
{message: 'Unable to default a disabled consignee'}
|
||||
);
|
||||
|
||||
async function isActive(err, done) {
|
||||
if (!this.defaultAddressFk)
|
||||
return done();
|
||||
|
||||
const address = await Self.app.models.Address.findById(this.defaultAddressFk);
|
||||
if (address && !address.isActive) err();
|
||||
done();
|
||||
}
|
||||
|
||||
Self.observe('before save', async function(ctx) {
|
||||
let changes = ctx.data || ctx.instance;
|
||||
let orgData = ctx.currentInstance;
|
||||
|
|
|
@ -31,10 +31,12 @@
|
|||
"type": "string"
|
||||
},
|
||||
"street": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
|
@ -114,7 +116,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
"type": "Date"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
url="/client/api/Addresses"
|
||||
url="/client/api/Addresses/createDefaultAddress"
|
||||
id-field="id"
|
||||
data="$ctrl.address"
|
||||
data="$ctrl.data"
|
||||
save="post"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="watcher.submitGo('client.card.address.index')" compact>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" compact>
|
||||
<vn-card pad-large>
|
||||
<vn-horizontal pad-small-v>
|
||||
<vn-check vn-one label="Default" field="$ctrl.address.isDefaultAddress"></vn-check>
|
||||
<vn-check vn-one label="Default" field="$ctrl.data.isDefaultAddress"></vn-check>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Consignee" field="$ctrl.address.nickname" vn-focus></vn-textfield>
|
||||
|
|
|
@ -1,16 +1,35 @@
|
|||
import ngModule from '../../module';
|
||||
|
||||
export default class Controller {
|
||||
constructor($state) {
|
||||
this.address = {
|
||||
clientFk: parseInt($state.params.id),
|
||||
isActive: true
|
||||
constructor($scope, $state) {
|
||||
this.$scope = $scope;
|
||||
this.$state = $state;
|
||||
this.data = {
|
||||
address: {
|
||||
clientFk: parseInt($state.params.id),
|
||||
isActive: true
|
||||
},
|
||||
isDefaultAddress: false
|
||||
};
|
||||
this.address = this.data.address;
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$scope.watcher.submit().then(res => {
|
||||
if (res.data && this.data.isDefaultAddress)
|
||||
this.client.defaultAddressFk = res.data.id;
|
||||
|
||||
this.$state.go('client.card.address.index');
|
||||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$state'];
|
||||
|
||||
Controller.$inject = ['$scope', '$state'];
|
||||
|
||||
ngModule.component('vnClientAddressCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
client: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import './index';
|
||||
import watcher from 'core/mocks/watcher';
|
||||
|
||||
describe('Client', () => {
|
||||
describe('Component vnClientAddressCreate', () => {
|
||||
|
@ -13,11 +14,40 @@ describe('Client', () => {
|
|||
$state = _$state_;
|
||||
$state.params.id = '1234';
|
||||
controller = $componentController('vnClientAddressCreate', {$state});
|
||||
controller.$scope.watcher = watcher;
|
||||
controller.$scope.watcher.submit = () => {
|
||||
return {
|
||||
then: callback => {
|
||||
callback({data: {id: 124}});
|
||||
}
|
||||
};
|
||||
};
|
||||
controller.client = {id: 101, defaultAddressFk: 121};
|
||||
}));
|
||||
|
||||
it('should define and set address property', () => {
|
||||
expect(controller.address.clientFk).toBe(1234);
|
||||
expect(controller.address.isActive).toBe(true);
|
||||
expect(controller.data.address.clientFk).toBe(1234);
|
||||
expect(controller.data.address.isActive).toBe(true);
|
||||
});
|
||||
|
||||
describe('onSubmit()', () => {
|
||||
it('should perform a PATCH and not set value to defaultAddressFk property', () => {
|
||||
spyOn(controller.$state, 'go');
|
||||
controller.data.isDefaultAddress = false;
|
||||
controller.onSubmit();
|
||||
|
||||
expect(controller.client.defaultAddressFk).toEqual(121);
|
||||
expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index');
|
||||
});
|
||||
|
||||
it('should perform a PATCH and set a value to defaultAddressFk property', () => {
|
||||
spyOn(controller.$state, 'go');
|
||||
controller.data.isDefaultAddress = true;
|
||||
controller.onSubmit();
|
||||
|
||||
expect(controller.client.defaultAddressFk).toEqual(124);
|
||||
expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,24 +3,27 @@
|
|||
url="/client/api/Addresses"
|
||||
filter="::$ctrl.filter"
|
||||
link="{clientFk: $ctrl.$stateParams.id}"
|
||||
data="addresses"
|
||||
data="$ctrl.addresses"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<div compact>
|
||||
<vn-card pad-large>
|
||||
<vn-horizontal
|
||||
ng-repeat="address in addresses"
|
||||
ng-repeat="address in $ctrl.addresses"
|
||||
class="pad-medium-top"
|
||||
style="align-items: center;">
|
||||
<vn-one
|
||||
border-radius
|
||||
class="pad-small border-solid"
|
||||
ng-class="{'item-hightlight': address.isDefaultAddress, 'item-disabled': !address.isActive && !address.isDefaultAddress}">
|
||||
ng-class="{
|
||||
'item-hightlight': $ctrl.isDefaultAddress(address),
|
||||
'item-disabled': !address.isActive && !$ctrl.isDefaultAddress(address)
|
||||
}">
|
||||
<vn-horizontal style="align-items: center;">
|
||||
<vn-none pad-medium-h>
|
||||
<vn-icon-button
|
||||
icon="star"
|
||||
ng-if="address.isDefaultAddress">
|
||||
ng-if="$ctrl.isDefaultAddress(address)">
|
||||
</vn-icon-button>
|
||||
<vn-icon-button
|
||||
ng-if="!address.isActive"
|
||||
|
@ -28,7 +31,7 @@
|
|||
vn-tooltip="Active first to set as default">
|
||||
</vn-icon-button>
|
||||
<vn-icon-button
|
||||
ng-if="address.isActive && !address.isDefaultAddress"
|
||||
ng-if="address.isActive && !$ctrl.isDefaultAddress(address)"
|
||||
icon="star_border"
|
||||
vn-tooltip="Set as default"
|
||||
ng-click="$ctrl.setDefault(address)">
|
||||
|
|
|
@ -9,22 +9,60 @@ class Controller {
|
|||
include: {
|
||||
observations: 'observationType'
|
||||
},
|
||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC']
|
||||
order: ['isActive DESC', 'nickname ASC']
|
||||
};
|
||||
}
|
||||
|
||||
get client() {
|
||||
return this._client;
|
||||
}
|
||||
|
||||
set client(value) {
|
||||
this._client = value;
|
||||
this.sortAddresses();
|
||||
}
|
||||
|
||||
get addresses() {
|
||||
return this._addresses;
|
||||
}
|
||||
|
||||
set addresses(value) {
|
||||
this._addresses = value;
|
||||
this.sortAddresses();
|
||||
}
|
||||
|
||||
setDefault(address) {
|
||||
if (address.isActive) {
|
||||
let params = {isDefaultAddress: true};
|
||||
this.$http.patch(`/client/api/Addresses/${address.id}`, params).then(
|
||||
() => this.$scope.model.refresh()
|
||||
);
|
||||
}
|
||||
let query = `/client/api/Clients/${this.$stateParams.id}`;
|
||||
let params = {defaultAddressFk: address.id};
|
||||
this.$http.patch(query, params).then(res => {
|
||||
if (res.data) {
|
||||
this.client.defaultAddressFk = res.data.defaultAddressFk;
|
||||
this.sortAddresses();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isDefaultAddress(address) {
|
||||
if (!this.client) return;
|
||||
return this.client.defaultAddressFk === address.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort address by default address
|
||||
*/
|
||||
sortAddresses() {
|
||||
if (!this.client || !this.addresses) return;
|
||||
this.$scope.model.data = this.addresses.sort((a, b) => {
|
||||
return this.isDefaultAddress(b) - this.isDefaultAddress(a);
|
||||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$http', '$scope', '$stateParams'];
|
||||
|
||||
ngModule.component('vnClientAddressIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
client: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,36 +1,69 @@
|
|||
import './index';
|
||||
import crudModel from 'core/mocks/crud-model';
|
||||
|
||||
describe('Client', () => {
|
||||
describe('Component vnClientAddressIndex', () => {
|
||||
let controller;
|
||||
let $scope;
|
||||
let $state;
|
||||
let $stateParams;
|
||||
let $httpBackend;
|
||||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
||||
$state = _$state_;
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => {
|
||||
$stateParams = _$stateParams_;
|
||||
$stateParams.id = 1;
|
||||
$httpBackend = _$httpBackend_;
|
||||
$scope = $rootScope.$new();
|
||||
$scope.model = {
|
||||
refresh: () => {}
|
||||
};
|
||||
controller = $componentController('vnClientAddressIndex', {$state, $scope});
|
||||
controller = $componentController('vnClientAddressIndex', {$stateParams, $scope});
|
||||
controller.client = {id: 101, defaultAddressFk: 121};
|
||||
controller.$scope.model = crudModel;
|
||||
}));
|
||||
|
||||
describe('setDefault()', () => {
|
||||
it('should perform a PATCH if the address is active and call the refresh method', () => {
|
||||
spyOn($scope.model, 'refresh');
|
||||
it('should perform a PATCH and set a value to defaultAddressFk property', () => {
|
||||
spyOn(controller, 'sortAddresses');
|
||||
let address = {id: 1};
|
||||
let data = {defaultAddressFk: address.id};
|
||||
let expectedResult = {defaultAddressFk: address.id};
|
||||
|
||||
let address = {id: 1, isActive: true};
|
||||
|
||||
$httpBackend.when('PATCH', `/client/api/Addresses/1`).respond(200);
|
||||
$httpBackend.expect('PATCH', `/client/api/Addresses/1`);
|
||||
$httpBackend.when('PATCH', `/client/api/Clients/1`, data).respond(200, expectedResult);
|
||||
$httpBackend.expect('PATCH', `/client/api/Clients/1`, data);
|
||||
controller.setDefault(address);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect($scope.model.refresh).toHaveBeenCalledWith();
|
||||
expect(controller.client.defaultAddressFk).toEqual(1);
|
||||
expect(controller.sortAddresses).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isDefaultAddress()', () => {
|
||||
it('should return true if a passed address is the current default one', () => {
|
||||
let address = {id: 121};
|
||||
let result = controller.isDefaultAddress(address);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return false if a passed address is the current default one', () => {
|
||||
let address = {id: 1};
|
||||
let result = controller.isDefaultAddress(address);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('sortAddresses()', () => {
|
||||
it('should return an array of addresses sorted by client defaultAddressFk', () => {
|
||||
controller.client.defaultAddressFk = 123;
|
||||
controller.addresses = [
|
||||
{id: 121, nickname: 'My address one'},
|
||||
{id: 122, nickname: 'My address two'},
|
||||
{id: 123, nickname: 'My address three'}];
|
||||
|
||||
controller.sortAddresses();
|
||||
|
||||
expect(controller.addresses[0].id).toEqual(123);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -102,7 +102,10 @@
|
|||
"url": "/create",
|
||||
"state": "client.card.address.create",
|
||||
"component": "vn-client-address-create",
|
||||
"description": "New address"
|
||||
"description": "New address",
|
||||
"params": {
|
||||
"client": "$ctrl.client"
|
||||
}
|
||||
}, {
|
||||
"url": "/:addressId/edit",
|
||||
"state": "client.card.address.edit",
|
||||
|
|
|
@ -124,13 +124,13 @@
|
|||
<vn-one>
|
||||
<h4 translate>Default address</h4>
|
||||
<vn-label-value label="Name"
|
||||
value="{{$ctrl.summary.addresses[0].nickname}}">
|
||||
value="{{$ctrl.summary.defaultAddress.nickname}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Street" ellipsize="false"
|
||||
value="{{$ctrl.summary.addresses[0].street}}">
|
||||
value="{{$ctrl.summary.defaultAddress.street}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="City"
|
||||
value="{{$ctrl.summary.addresses[0].city}}">
|
||||
value="{{$ctrl.summary.defaultAddress.city}}">
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
|
|
|
@ -29,11 +29,23 @@ class Controller {
|
|||
this.order.clientFk = value;
|
||||
|
||||
if (value) {
|
||||
let filter = {where: {clientFk: value, isDefaultAddress: true}};
|
||||
let filter = {
|
||||
include: {
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
fields: 'id'
|
||||
}
|
||||
},
|
||||
where: {id: value}
|
||||
};
|
||||
filter = encodeURIComponent(JSON.stringify(filter));
|
||||
let query = `/api/Addresses?filter=${filter}`;
|
||||
let query = `/api/Clients?filter=${filter}`;
|
||||
this.$http.get(query).then(res => {
|
||||
this.addressFk = res.data[0].id;
|
||||
if (res.data) {
|
||||
let client = res.data[0];
|
||||
let defaultAddress = client.defaultAddress;
|
||||
this.addressFk = defaultAddress.id;
|
||||
}
|
||||
});
|
||||
} else
|
||||
this.addressFk = null;
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
"description": "Identifier"
|
||||
},
|
||||
"shipped": {
|
||||
"type": "date",
|
||||
"type": "Date",
|
||||
"required": true
|
||||
},
|
||||
"landed": {
|
||||
"type": "date"
|
||||
"type": "Date"
|
||||
},
|
||||
"nickname": {
|
||||
"type": "String"
|
||||
|
@ -32,7 +32,7 @@
|
|||
"type": "Number"
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
"type": "Date"
|
||||
},
|
||||
"isDeleted": {
|
||||
"type": "boolean"
|
||||
|
|
|
@ -32,11 +32,23 @@ class Controller {
|
|||
this.ticket.clientFk = value;
|
||||
|
||||
if (value) {
|
||||
let filter = {where: {clientFk: value, isDefaultAddress: true}};
|
||||
let filter = {
|
||||
include: {
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
fields: 'id'
|
||||
}
|
||||
},
|
||||
where: {id: value}
|
||||
};
|
||||
filter = encodeURIComponent(JSON.stringify(filter));
|
||||
let query = `/api/Addresses?filter=${filter}`;
|
||||
let query = `/api/Clients?filter=${filter}`;
|
||||
this.$http.get(query).then(res => {
|
||||
this.addressFk = res.data[0].id;
|
||||
if (res.data) {
|
||||
let client = res.data[0];
|
||||
let defaultAddress = client.defaultAddress;
|
||||
this.addressFk = defaultAddress.id;
|
||||
}
|
||||
});
|
||||
} else
|
||||
this.addressFk = null;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
DROP TRIGGER IF EXISTS vn2008.ConsignatariosAfterUpdate;
|
||||
USE vn2008;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosAfterUpdate` AFTER UPDATE ON `Consignatarios` FOR EACH ROW
|
||||
BEGIN
|
||||
|
||||
-- Recargos de equivalencia distintos implican facturacion por consignatario
|
||||
IF NEW.isEqualizated != OLD.isEqualizated THEN
|
||||
|
||||
IF
|
||||
(SELECT COUNT(*) FROM
|
||||
(
|
||||
SELECT DISTINCT (isEqualizated = FALSE) as Equ
|
||||
FROM Consignatarios
|
||||
WHERE Id_Cliente = NEW.Id_Cliente
|
||||
) t1
|
||||
) > 1
|
||||
|
||||
THEN
|
||||
|
||||
UPDATE Clientes
|
||||
SET invoiceByAddress = TRUE
|
||||
WHERE Id_Cliente = NEW.Id_Cliente;
|
||||
|
||||
END IF;
|
||||
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
USE vn;
|
|
@ -0,0 +1,25 @@
|
|||
DROP TRIGGER IF EXISTS vn2008.ConsignatariosBeforeInsert;
|
||||
USE vn2008;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosBeforeInsert`
|
||||
BEFORE INSERT ON `vn2008`.`Consignatarios`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vIsEqualizated BOOLEAN;
|
||||
|
||||
CALL pbx.phoneIsValid (NEW.telefono);
|
||||
CALL pbx.phoneIsValid (NEW.movil);
|
||||
|
||||
IF NEW.isEqualizated IS NULL THEN
|
||||
SELECT RE
|
||||
INTO vIsEqualizated
|
||||
FROM Clientes
|
||||
WHERE Id_Cliente = NEW.Id_Cliente;
|
||||
|
||||
SET NEW.isEqualizated = vIsEqualizated;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
USE vn;
|
|
@ -0,0 +1,14 @@
|
|||
DROP TRIGGER IF EXISTS vn2008.ConsignatariosBeforeUpdate;
|
||||
USE vn2008;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosBeforeUpdate`
|
||||
BEFORE UPDATE ON `vn2008`.`Consignatarios`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL pbx.phoneIsValid (NEW.telefono);
|
||||
CALL pbx.phoneIsValid (NEW.movil);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
USE vn;
|
|
@ -0,0 +1 @@
|
|||
DROP TRIGGER vn2008.ClientesAfterInsert;
|
|
@ -0,0 +1,19 @@
|
|||
DROP TRIGGER IF EXISTS vn2008.ClientesAfterUpdate;
|
||||
USE vn2008;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ClientesAfterUpdate`
|
||||
AFTER UPDATE ON `Clientes`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF NEW.default_address AND (NEW.default_address != OLD.default_address) THEN
|
||||
UPDATE Consignatarios SET predeterminada = FALSE
|
||||
WHERE Id_cliente = NEW.Id_cliente;
|
||||
|
||||
UPDATE Consignatarios SET predeterminada = TRUE
|
||||
WHERE Id_consigna = NEW.default_address;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
USE vn;
|
|
@ -0,0 +1,9 @@
|
|||
/* Script de migración consignatarios.
|
||||
Ejecución únicamente en producción */
|
||||
|
||||
/* USE vn;
|
||||
|
||||
UPDATE vn.client c
|
||||
JOIN vn.address a ON a.clientFk = c.id AND a.isDefaultAddress
|
||||
SET c.defaultAddressFk = a.id
|
||||
WHERE c.defaultAddressFk IS NULL */
|
|
@ -209,38 +209,65 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
|
|||
( 103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
( 104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH));
|
||||
|
||||
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`)
|
||||
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`)
|
||||
VALUES
|
||||
(101, 'address 01', 'Somewhere in Thailand', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(102, 'address 02', 'Somewhere in Poland', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(103, 'address 03', 'Somewhere in Japan', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(104, 'address 04', 'Somewhere in Spain', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(105, 'address 05', 'Somewhere in Potugal', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(106, 'address 06', 'Somewhere in UK', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(107, 'address 07', 'Somewhere in Valencia', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(108, 'address 08', 'Somewhere in Silla', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(109, 'address 09', 'Somewhere in London', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(110, 'address 10', 'Somewhere in Algemesi', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(111, 'address 11', 'Somewhere in Carlet', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(112, 'address 12', 'Somewhere in Campanar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(113, 'address 13', 'Somewhere in Malilla', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(114, 'address 14', 'Somewhere in France', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(115, 'address 15', 'Somewhere in Birmingham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(116, 'address 16', 'Somewhere in Scotland', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(117, 'address 17', 'Somewhere in nowhere', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(118, 'address 18', 'Somewhere over the rainbow', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(119, 'address 19', 'Somewhere in Alberic', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(120, 'address 20', 'Somewhere in Montortal', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0),
|
||||
(121, 'address 21', 'the bat cave', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 101, 2, NULL, NULL, 0),
|
||||
(122, 'address 22', 'NY roofs', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 102, 2, NULL, NULL, 0),
|
||||
(123, 'address 23', 'The phone box', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 103, 2, NULL, NULL, 0),
|
||||
(124, 'address 24', 'Stark tower', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 104, 2, NULL, NULL, 0),
|
||||
(125, 'address 25', 'The plastic cell', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 105, 2, NULL, NULL, 0),
|
||||
(126, 'address 26', 'Many places', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 106, 2, NULL, NULL, 0),
|
||||
(127, 'address 27', 'Your pocket', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 107, 2, NULL, NULL, 0),
|
||||
(128, 'address 28', 'Cerebro', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 108, 2, NULL, NULL, 0),
|
||||
(129, 'address 29', 'Luke Cages Bar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 110, 2, NULL, NULL, 0),
|
||||
(130, 'address 30', 'Non valid address', 'Silla', 46460, 1, 1111111111, 222222222, 0, 0, 101, 2, NULL, NULL, 0);
|
||||
(1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0),
|
||||
(2, 'Petter Parker', '20 Ingram Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 102, 2, NULL, NULL, 0),
|
||||
(3, 'Clark Kent', '344 Clinton Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 103, 2, NULL, NULL, 0),
|
||||
(4, 'Tony Stark', '10880 Malibu Point', 'Silla', 46460, 1, 1111111111, 222222222, 1, 104, 2, NULL, NULL, 0),
|
||||
(5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Silla', 46460, 1, 1111111111, 222222222, 1, 105, 2, NULL, NULL, 0),
|
||||
(6, 'DavidCharlesHaller', 'Evil hideout', 'Silla', 46460, 1, 1111111111, 222222222, 1, 106, 2, NULL, NULL, 0),
|
||||
(7, 'Hank Pym', 'Anthill', 'Silla', 46460, 1, 1111111111, 222222222, 1, 107, 2, NULL, NULL, 0),
|
||||
(8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1, 1111111111, 222222222, 1, 108, 2, NULL, NULL, 0),
|
||||
(9, 'Bruce Banner', 'Somewhere in New York', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(10, 'Jessica Jones', 'NYCC 2015 Poster', 'Silla', 46460, 1, 1111111111, 222222222, 1, 110, 2, NULL, NULL, 0),
|
||||
(11, 'Missing', 'The space', 'Silla', 46460, 1, 1111111111, 222222222, 1, 200, 2, NULL, NULL, 0),
|
||||
(12, 'Trash', 'New York city', 'Silla', 46460, 1, 1111111111, 222222222, 1, 400, 2, NULL, NULL, 0),
|
||||
(101, 'address 01', 'Somewhere in Thailand', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(102, 'address 02', 'Somewhere in Poland', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0),
|
||||
(103, 'address 03', 'Somewhere in Japan', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0),
|
||||
(104, 'address 04', 'Somewhere in Spain', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0),
|
||||
(105, 'address 05', 'Somewhere in Potugal', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0),
|
||||
(106, 'address 06', 'Somewhere in UK', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0),
|
||||
(107, 'address 07', 'Somewhere in Valencia', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0),
|
||||
(108, 'address 08', 'Somewhere in Silla', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0),
|
||||
(109, 'address 09', 'Somewhere in London', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(110, 'address 10', 'Somewhere in Algemesi', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(111, 'address 11', 'Somewhere in Carlet', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(112, 'address 12', 'Somewhere in Campanar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(113, 'address 13', 'Somewhere in Malilla', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(114, 'address 14', 'Somewhere in France', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(115, 'address 15', 'Somewhere in Birmingham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(116, 'address 16', 'Somewhere in Scotland', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(117, 'address 17', 'Somewhere in nowhere', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(118, 'address 18', 'Somewhere over the rainbow', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(119, 'address 19', 'Somewhere in Alberic', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(120, 'address 20', 'Somewhere in Montortal', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0),
|
||||
(121, 'address 21', 'the bat cave', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0),
|
||||
(122, 'address 22', 'NY roofs', 'Silla', 46460, 1, 1111111111, 222222222, 1, 102, 2, NULL, NULL, 0),
|
||||
(123, 'address 23', 'The phone box', 'Silla', 46460, 1, 1111111111, 222222222, 1, 103, 2, NULL, NULL, 0),
|
||||
(124, 'address 24', 'Stark tower', 'Silla', 46460, 1, 1111111111, 222222222, 1, 104, 2, NULL, NULL, 0),
|
||||
(125, 'address 25', 'The plastic cell', 'Silla', 46460, 1, 1111111111, 222222222, 1, 105, 2, NULL, NULL, 0),
|
||||
(126, 'address 26', 'Many places', 'Silla', 46460, 1, 1111111111, 222222222, 1, 106, 2, NULL, NULL, 0),
|
||||
(127, 'address 27', 'Your pocket', 'Silla', 46460, 1, 1111111111, 222222222, 1, 107, 2, NULL, NULL, 0),
|
||||
(128, 'address 28', 'Cerebro', 'Silla', 46460, 1, 1111111111, 222222222, 1, 108, 2, NULL, NULL, 0),
|
||||
(129, 'address 29', 'Luke Cages Bar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 110, 2, NULL, NULL, 0),
|
||||
(130, 'address 30', 'Non valid address', 'Silla', 46460, 1, 1111111111, 222222222, 0, 101, 2, NULL, NULL, 0),
|
||||
(131, 'Missing', 'The space', 'Silla', 46460, 1, 1111111111, 222222222, 1, 200, 2, NULL, NULL, 0),
|
||||
(132, 'Trash', 'New York city', 'Silla', 46460, 1, 1111111111, 222222222, 1, 400, 2, NULL, NULL, 0);
|
||||
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 1 WHERE id = 101;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 2 WHERE id = 102;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 3 WHERE id = 103;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 4 WHERE id = 104;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 5 WHERE id = 105;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 6 WHERE id = 106;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 7 WHERE id = 107;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 8 WHERE id = 108;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 9 WHERE id = 109;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 10 WHERE id = 110;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 11 WHERE id = 200;
|
||||
UPDATE `vn`.`client` SET defaultAddressFk = 12 WHERE id = 400;
|
||||
|
||||
INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`)
|
||||
VALUES
|
||||
|
|
Loading…
Reference in New Issue