Merge branch 'dev' into test
This commit is contained in:
commit
d71d21fe41
|
@ -1,5 +1,4 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller {
|
||||||
constructor($translate) {
|
constructor($translate) {
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
vn-descriptor {
|
|
||||||
.descriptor-header{
|
|
||||||
background: rgb(255,171,64);
|
|
||||||
color: white;
|
|
||||||
text-align: center;
|
|
||||||
i {
|
|
||||||
font-size: 51px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -68,7 +68,7 @@
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
<vn-submit label="Save"></vn-submit>
|
<vn-submit label="Save" vn-acl="administrative"></vn-submit>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
</form>
|
</form>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {module} from '../module';
|
||||||
import Component from '../lib/component';
|
import Component from '../lib/component';
|
||||||
import copyObject from '../lib/copy';
|
import copyObject from '../lib/copy';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
import { log } from 'util';
|
||||||
|
|
||||||
class Autocomplete extends Component {
|
class Autocomplete extends Component {
|
||||||
constructor($element, $scope, $http, $timeout, $filter) {
|
constructor($element, $scope, $http, $timeout, $filter) {
|
||||||
|
@ -27,6 +28,8 @@ class Autocomplete extends Component {
|
||||||
this._multiField = [];
|
this._multiField = [];
|
||||||
this.readonly = true;
|
this.readonly = true;
|
||||||
this.removeLoadMore = false;
|
this.removeLoadMore = false;
|
||||||
|
this.form = null;
|
||||||
|
this.findForm = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get showDropDown() {
|
get showDropDown() {
|
||||||
|
@ -87,6 +90,7 @@ class Autocomplete extends Component {
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
this.setMultiField(value[this.valueField]);
|
this.setMultiField(value[this.valueField]);
|
||||||
}
|
}
|
||||||
|
this.setDirtyForm();
|
||||||
} else {
|
} else {
|
||||||
this.setValue(value);
|
this.setValue(value);
|
||||||
}
|
}
|
||||||
|
@ -284,6 +288,22 @@ class Autocomplete extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_parentForm() {
|
||||||
|
this.findForm = true;
|
||||||
|
let formScope = this.$scope;
|
||||||
|
while (formScope && !formScope.form && formScope.$id > 1) {
|
||||||
|
formScope = formScope.$parent;
|
||||||
|
}
|
||||||
|
this.form = formScope ? formScope.form || null : null;
|
||||||
|
}
|
||||||
|
setDirtyForm() {
|
||||||
|
if (!this.form && !this.findForm) {
|
||||||
|
this._parentForm();
|
||||||
|
}
|
||||||
|
if (this.form) {
|
||||||
|
this.form.$setDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
this.findMore = this.url && this.maxRow;
|
this.findMore = this.url && this.maxRow;
|
||||||
|
|
|
@ -12,7 +12,7 @@ function vnAcl(aclService, $timeout) {
|
||||||
function udateMaterial(input) {
|
function udateMaterial(input) {
|
||||||
if (input && input.className) {
|
if (input && input.className) {
|
||||||
let find = input.className.match(/mdl-[\w]+input/g);
|
let find = input.className.match(/mdl-[\w]+input/g);
|
||||||
if (find.length && find[0]) {
|
if (find && find.length && find[0]) {
|
||||||
let type = getMaterialType(find[0]);
|
let type = getMaterialType(find[0]);
|
||||||
if (type && input.parentNode[`Material${type}`] && input.parentNode[`Material${type}`].updateClasses_) {
|
if (type && input.parentNode[`Material${type}`] && input.parentNode[`Material${type}`].updateClasses_) {
|
||||||
input.parentNode[`Material${type}`].updateClasses_();
|
input.parentNode[`Material${type}`].updateClasses_();
|
||||||
|
|
|
@ -3,3 +3,4 @@ import './focus';
|
||||||
import './dialog';
|
import './dialog';
|
||||||
import './validation';
|
import './validation';
|
||||||
import './acl';
|
import './acl';
|
||||||
|
import './onErrorSrc';
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import {module} from '../module';
|
||||||
|
|
||||||
|
function onErrorSrc() {
|
||||||
|
return {
|
||||||
|
restrict: 'A',
|
||||||
|
link: (scope, element, attrs) => {
|
||||||
|
let imgError = '/static/images/no-image200x200.png';
|
||||||
|
element.bind('error', function() {
|
||||||
|
if (attrs.src != imgError) {
|
||||||
|
attrs.$set('src', imgError);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.directive('onErrorSrc', onErrorSrc);
|
|
@ -10,9 +10,10 @@ export default class App {
|
||||||
constructor($rootScope) {
|
constructor($rootScope) {
|
||||||
this.loaderStatus = 0;
|
this.loaderStatus = 0;
|
||||||
this.$rootScope = $rootScope;
|
this.$rootScope = $rootScope;
|
||||||
|
this.timeout = window.snackbarTimeout || 2000;
|
||||||
}
|
}
|
||||||
show(message) {
|
show(message) {
|
||||||
if (this.snackbar) this.snackbar.show({message: message});
|
if (this.snackbar) this.snackbar.show({message: message, timeout: this.timeout});
|
||||||
}
|
}
|
||||||
showMessage(message) {
|
showMessage(message) {
|
||||||
this.show(message);
|
this.show(message);
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
{
|
{
|
||||||
"url": "/list",
|
"url": "/list",
|
||||||
"state": "item.index",
|
"state": "item.index",
|
||||||
"component": "vn-item-list"
|
"component": "vn-item-list",
|
||||||
|
"acl": ["developer"]
|
||||||
}, {
|
}, {
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "item.create",
|
"state": "item.create",
|
||||||
|
@ -35,15 +36,70 @@
|
||||||
"icon": "folder"
|
"icon": "folder"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
"url" : "/image",
|
"url" : "/tags",
|
||||||
"state": "item.card.image",
|
"state": "item.card.tags",
|
||||||
"component": "vn-item-image",
|
"component": "vn-item-tags",
|
||||||
"params": {
|
"params": {
|
||||||
"item": "$ctrl.item"
|
"item": "$ctrl.item"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"description": "Images",
|
"description": "Tags",
|
||||||
"icon": "image"
|
"icon": "folder"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"url" : "/history",
|
||||||
|
"state": "item.card.history",
|
||||||
|
"component": "vn-item-history",
|
||||||
|
"params": {
|
||||||
|
"item": "$ctrl.item"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "History",
|
||||||
|
"icon": "folder"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"url" : "/niche",
|
||||||
|
"state": "item.card.niche",
|
||||||
|
"component": "vn-item-niche",
|
||||||
|
"params": {
|
||||||
|
"item": "$ctrl.item"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "Niche",
|
||||||
|
"icon": "folder"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"url" : "/botanical",
|
||||||
|
"state": "item.card.botanical",
|
||||||
|
"component": "vn-item-botanical",
|
||||||
|
"params": {
|
||||||
|
"item": "$ctrl.item"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "Botanical",
|
||||||
|
"icon": "folder"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"url" : "/picture",
|
||||||
|
"state": "item.card.picture",
|
||||||
|
"component": "vn-item-picture",
|
||||||
|
"params": {
|
||||||
|
"item": "$ctrl.item"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "Picture",
|
||||||
|
"icon": "folder"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"url" : "/barcode",
|
||||||
|
"state": "item.card.barcode",
|
||||||
|
"component": "vn-item-barcode",
|
||||||
|
"params": {
|
||||||
|
"item": "$ctrl.item"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "Barcode",
|
||||||
|
"icon": "folder"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vn-card>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title>Item barcode</vn-title>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,5 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnItemBarcode', {
|
||||||
|
template: require('./item-barcode.html')
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vn-card>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title>Botanical</vn-title>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,5 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnItemBotanical', {
|
||||||
|
template: require('./item-botanical.html')
|
||||||
|
});
|
|
@ -1,12 +1,7 @@
|
||||||
<vn-main-block>
|
<vn-main-block>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-auto class="left-block">
|
<vn-auto class="left-block">
|
||||||
<vn-card margin-medium-v>
|
<vn-item-descriptor item="$ctrl.item"></vn-item-descriptor>
|
||||||
<a class="item-product-link pad-large text-center" ui-sref="item.index">
|
|
||||||
<b>{{$ctrl.item.name}}</b>
|
|
||||||
<img ng-src="http://verdnatura.es/vn-image-data/catalog/200x200/{{$ctrl.item.image}}" />
|
|
||||||
</a>
|
|
||||||
</vn-card>
|
|
||||||
<vn-left-menu></vn-left-menu>
|
<vn-left-menu></vn-left-menu>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<mg-ajax
|
<mg-ajax
|
||||||
path="/item/api/Items/{{patch.params.id}}"
|
path="/item/api/Items/{{patch.params.id}}"
|
||||||
options="vnPatch"
|
options="vnPatch"
|
||||||
override="{filter: {include: [{relation: 'itemType'}, {relation: 'origin'}, {relation: 'ink'}, {relation: 'producer'}]}}"
|
override="{filter: {include: [{relation: 'itemType'}, {relation: 'origin'}, {relation: 'ink'}, {relation: 'producer'}, {relation: 'expence'}]}}"
|
||||||
>
|
>
|
||||||
</mg-ajax>
|
</mg-ajax>
|
||||||
<vn-watcher
|
<vn-watcher
|
||||||
|
@ -16,46 +16,32 @@
|
||||||
<vn-vertical pad-large>
|
<vn-vertical pad-large>
|
||||||
<vn-title>Basic data</vn-title>
|
<vn-title>Basic data</vn-title>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-three label="Name" field="$ctrl.item.name" vn-focus></vn-textfield>
|
<vn-textfield vn-one label="Name" field="$ctrl.item.name" vn-focus></vn-textfield>
|
||||||
<vn-textfield vn-one label="Size" field="$ctrl.item.size"></vn-textfield>
|
|
||||||
<vn-textfield vn-one label="Stems" field="$ctrl.item.stems"></vn-textfield>
|
|
||||||
<vn-textfield vn-one label="Category" field="$ctrl.item.category"></vn-textfield>
|
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-textfield vn-one label="Description" field="$ctrl.item.description"></vn-textfield>
|
|
||||||
<vn-autocomplete vn-one
|
|
||||||
url="/item/api/Intrastats"
|
|
||||||
label="Intrastat"
|
|
||||||
show-field="description"
|
|
||||||
value-field="id"
|
|
||||||
field="$ctrl.item.intrastatFk"
|
|
||||||
initial-data="$ctrl.item.intrastat"
|
|
||||||
order = "description DESC"
|
|
||||||
filter-search="{where: {description: {regexp: 'search'}}}"
|
|
||||||
>
|
|
||||||
<tpl-item>{{$parent.$parent.item.description}}</tpl-item>
|
|
||||||
</vn-autocomplete>
|
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
url="/item/api/ItemTypes"
|
url="/item/api/ItemTypes"
|
||||||
label="Type"
|
label="Type"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
field="$ctrl.item.typeFk"
|
field="$ctrl.item.typeFk"
|
||||||
initial-data="$ctrl.item.itemType"
|
|
||||||
>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-autocomplete vn-one
|
|
||||||
url="/item/api/Inks"
|
|
||||||
label="Ink"
|
|
||||||
show-field="name"
|
|
||||||
value-field="id"
|
|
||||||
field="$ctrl.item.inkFk"
|
|
||||||
initial-data="$ctrl.item.ink"
|
|
||||||
>
|
>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-autocomplete vn-one
|
||||||
|
url="/item/api/Intrastats"
|
||||||
|
label="Intrastat"
|
||||||
|
show-field="description"
|
||||||
|
value-field="id"
|
||||||
|
field="$ctrl.item.intrastatFk"
|
||||||
|
order="description ASC"
|
||||||
|
filter-search="{where: {description: {regexp: 'search'}} }"
|
||||||
|
>
|
||||||
|
<tpl-item>{{$parent.$parent.item.description}}</tpl-item>
|
||||||
|
</vn-autocomplete>
|
||||||
|
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
|
||||||
|
|
||||||
|
</vn-horizontal>
|
||||||
|
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
url="/item/api/Origins"
|
url="/item/api/Origins"
|
||||||
|
@ -63,17 +49,12 @@
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
field="$ctrl.item.originFk"
|
field="$ctrl.item.originFk"
|
||||||
initial-data="$ctrl.item.origin"
|
></vn-autocomplete>
|
||||||
>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
url="/item/api/Producers"
|
url="/item/api/Expences"
|
||||||
label="Producer"
|
label="Expence"
|
||||||
show-field="name"
|
field="$ctrl.item.expenceFk"
|
||||||
value-field="id"
|
></vn-autocomplete>
|
||||||
field="$ctrl.item.producer"
|
|
||||||
>
|
|
||||||
</vn-autocomplete>
|
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<vn-card margin-medium-v>
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-auto class="descriptor-header pointer" ui-sref="clients">
|
||||||
|
<img ng-src="/static/images/icon_item.png"/>
|
||||||
|
</vn-auto>
|
||||||
|
<vn-auto>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-one>
|
||||||
|
</vn-one>
|
||||||
|
<vn-auto>
|
||||||
|
<img ng-src="http://verdnatura.es/vn-image-data/catalog/200x200/{{$ctrl.item.image}}" on-error-src/>
|
||||||
|
</vn-auto>
|
||||||
|
<vn-one>
|
||||||
|
</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-auto>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
|
||||||
|
<!-- <vn-card margin-medium-v>
|
||||||
|
<a class="item-product-link pad-large text-center" ui-sref="item.index">
|
||||||
|
<vn-auto class="descriptor-header pointer" ui-sref="clients">
|
||||||
|
<i class="material-icons">person</i>
|
||||||
|
</vn-auto>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</vn-card> -->
|
|
@ -0,0 +1,8 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnItemDescriptor', {
|
||||||
|
template: require('./item-descriptor.html'),
|
||||||
|
bindings: {
|
||||||
|
item: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vn-card>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title>Item history</vn-title>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,5 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnItemHistory', {
|
||||||
|
template: require('./item-history.html')
|
||||||
|
});
|
|
@ -4,4 +4,12 @@ import './list/list';
|
||||||
import './filter-panel/filter-panel';
|
import './filter-panel/filter-panel';
|
||||||
import './create/item-create';
|
import './create/item-create';
|
||||||
import './card/item-card';
|
import './card/item-card';
|
||||||
|
import './descriptor/item-descriptor';
|
||||||
import './data/item-data';
|
import './data/item-data';
|
||||||
|
import './tags/item-tags';
|
||||||
|
import './history/item-history';
|
||||||
|
import './niche/item-niche';
|
||||||
|
import './botanical/item-botanical';
|
||||||
|
import './picture/item-picture';
|
||||||
|
import './barcode/item-barcode';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
<vn-horizontal pad-medium border-solid-bottom>
|
<vn-horizontal pad-medium border-solid-bottom>
|
||||||
<vn-auto margin-medium-right ng-if="$ctrl.item.image">
|
<vn-auto margin-medium-right ng-if="$ctrl.item.image">
|
||||||
<img ng-src="http://verdnatura.es/vn-image-data/catalog/200x200/{{$ctrl.item.image}}" />
|
<img ng-src="http://verdnatura.es/vn-image-data/catalog/200x200/{{$ctrl.item.image}}" on-error-src/>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<div><span translate>Id</span>: <b>{{$ctrl.item.id}}</b></div>
|
<div><span translate>Id</span>: <b>{{$ctrl.item.id}}</b></div>
|
||||||
|
|
|
@ -7,5 +7,14 @@
|
||||||
"Type": "Tipo",
|
"Type": "Tipo",
|
||||||
"Name": "Nombre",
|
"Name": "Nombre",
|
||||||
"Relevancy": "Relevancia",
|
"Relevancy": "Relevancia",
|
||||||
"New item": "Nuevo artículo"
|
"New item": "Nuevo artículo",
|
||||||
|
"Basic data": "Datos básicos",
|
||||||
|
"History" : "Historial",
|
||||||
|
"Item history" : "Historial del artículo",
|
||||||
|
"Item tags" : "Tags del artículo",
|
||||||
|
"Niche": "Nicho",
|
||||||
|
"Picture": "Foto",
|
||||||
|
"Item pictures": "Fotos del artículo",
|
||||||
|
"Barcode": "Código barras",
|
||||||
|
"Item barcode": "Código de barras del artículo"
|
||||||
}
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vn-card>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title>Niche</vn-title>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,5 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnItemNiche', {
|
||||||
|
template: require('./item-niche.html')
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vn-card>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title>Item pictures</vn-title>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,5 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnItemPicture', {
|
||||||
|
template: require('./item-picture.html')
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vn-card>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title>Item tags</vn-title>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,5 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnItemTags', {
|
||||||
|
template: require('./item-tags.html')
|
||||||
|
});
|
|
@ -113,3 +113,23 @@ vn-main-block {
|
||||||
padding-bottom: 1em;
|
padding-bottom: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.descriptor-header{
|
||||||
|
background: rgb(255,171,64);
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
i {
|
||||||
|
font-size: 51px;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
width: 51px;
|
||||||
|
height: 51px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldset[disabled] .mdl-textfield .mdl-textfield__input, .mdl-textfield.is-disabled .mdl-textfield__input,
|
||||||
|
fieldset[disabled] .mdl-checkbox .mdl-checkbox__label, .mdl-checkbox.is-disabled .mdl-checkbox__label{
|
||||||
|
border: none !important;
|
||||||
|
color: inherit !important;
|
||||||
|
}
|
||||||
|
fieldset[disabled] .mdl-textfield .mdl-textfield__label, .mdl-textfield.is-disabled.is-disabled .mdl-textfield__label {
|
||||||
|
color: rgb(255,171,64) !important;
|
||||||
|
}
|
|
@ -70,7 +70,7 @@ describe('Edit fiscalData path', () => {
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Confirm all addresses have EQtax for future propagation test', () => {
|
describe('Confirm all addresses have EQtax false for future propagation test', () => {
|
||||||
it(`should click on the search result to access to the client's addresses`, done => {
|
it(`should click on the search result to access to the client's addresses`, done => {
|
||||||
nightmare
|
nightmare
|
||||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
||||||
|
@ -94,7 +94,7 @@ describe('Edit fiscalData path', () => {
|
||||||
return document.querySelector(selector).checked;
|
return document.querySelector(selector).checked;
|
||||||
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
||||||
.then(value => {
|
.then(value => {
|
||||||
expect(value).toBeTruthy();
|
expect(value).toBeFalsy();
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
|
@ -110,7 +110,7 @@ describe('Edit fiscalData path', () => {
|
||||||
return document.querySelector(selector).checked;
|
return document.querySelector(selector).checked;
|
||||||
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
||||||
.then(value => {
|
.then(value => {
|
||||||
expect(value).toBeTruthy();
|
expect(value).toBeFalsy();
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
|
@ -189,7 +189,7 @@ describe('Edit fiscalData path', () => {
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should uncheck the Equalization tax checkbox', done => {
|
it('should check the Equalization tax checkbox', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.waitToClick(selectors.fiscalData.equalizationTaxCheckboxLabel)
|
.waitToClick(selectors.fiscalData.equalizationTaxCheckboxLabel)
|
||||||
.waitToClick(selectors.fiscalData.saveButton)
|
.waitToClick(selectors.fiscalData.saveButton)
|
||||||
|
@ -214,7 +214,7 @@ describe('Edit fiscalData path', () => {
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Equalization tax checkbox is unchecked', done => {
|
it('should confirm Equalization tax checkbox is checked', done => {
|
||||||
nightmare
|
nightmare
|
||||||
.waitForSnackbarReset()
|
.waitForSnackbarReset()
|
||||||
.waitToClick(selectors.basicData.basicDataButton)
|
.waitToClick(selectors.basicData.basicDataButton)
|
||||||
|
@ -225,13 +225,13 @@ describe('Edit fiscalData path', () => {
|
||||||
return document.querySelector(selector).checked;
|
return document.querySelector(selector).checked;
|
||||||
}, selectors.fiscalData.equalizationTaxCheckboxLabel)
|
}, selectors.fiscalData.equalizationTaxCheckboxLabel)
|
||||||
.then(value => {
|
.then(value => {
|
||||||
expect(value).toBeFalsy();
|
expect(value).toBeTruthy();
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Confirm all addresses havent got EQtax as uncheck was propagated', () => {
|
describe('Confirm all addresses have now EQtax checked', () => {
|
||||||
it(`should click on the addresses button to access to the client's addresses`, done => {
|
it(`should click on the addresses button to access to the client's addresses`, done => {
|
||||||
nightmare
|
nightmare
|
||||||
.waitToClick(selectors.addresses.addressesButton)
|
.waitToClick(selectors.addresses.addressesButton)
|
||||||
|
@ -244,7 +244,7 @@ describe('Edit fiscalData path', () => {
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the 1st edit icon to check EQtax is unchecked`, done => {
|
it(`should click on the 1st edit icon to confirm EQtax is checked`, done => {
|
||||||
nightmare
|
nightmare
|
||||||
.waitToClick(selectors.addresses.firstEditButton)
|
.waitToClick(selectors.addresses.firstEditButton)
|
||||||
.wait(selectors.addresses.equalizationTaxCheckboxLabel)
|
.wait(selectors.addresses.equalizationTaxCheckboxLabel)
|
||||||
|
@ -253,7 +253,7 @@ describe('Edit fiscalData path', () => {
|
||||||
return document.querySelector(selector).checked;
|
return document.querySelector(selector).checked;
|
||||||
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
||||||
.then(value => {
|
.then(value => {
|
||||||
expect(value).toBeFalsy();
|
expect(value).toBeTruthy();
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
|
@ -269,7 +269,7 @@ describe('Edit fiscalData path', () => {
|
||||||
return document.querySelector(selector).checked;
|
return document.querySelector(selector).checked;
|
||||||
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
}, selectors.addresses.equalizationTaxCheckboxLabel)
|
||||||
.then(value => {
|
.then(value => {
|
||||||
expect(value).toBeFalsy();
|
expect(value).toBeTruthy();
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
|
|
|
@ -56,17 +56,16 @@ module.exports = function(Client) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Client.app.models.Address.find(filter, function(err, instances) {
|
Client.app.models.Address.find(filter, function(err, results) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err, null);
|
return callback(err, null);
|
||||||
response('find', instances);
|
response('find', results);
|
||||||
});
|
});
|
||||||
|
|
||||||
Client.app.models.Address.count(filter.where, function(err, total) {
|
Client.app.models.Address.count(filter.where, function(err, result) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err, null);
|
return callback(err, null);
|
||||||
response('total', total);
|
response('total', result);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,4 +40,4 @@ module.exports = function(Client) {
|
||||||
callback(null, false);
|
callback(null, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
|
@ -19,7 +19,7 @@ module.exports = function(Client) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Client.card = function(id, cb) {
|
Client.card = function(id, callback) {
|
||||||
let filter = {
|
let filter = {
|
||||||
where: {
|
where: {
|
||||||
id: id
|
id: id
|
||||||
|
@ -27,10 +27,10 @@ module.exports = function(Client) {
|
||||||
include: require('./card.json')
|
include: require('./card.json')
|
||||||
};
|
};
|
||||||
|
|
||||||
Client.find(filter, function(err, instances) {
|
Client.find(filter, function(error, instances) {
|
||||||
if (!err) {
|
if (error) throw error;
|
||||||
cb(null, formatCard(instances[0]));
|
|
||||||
}
|
callback(null, formatCard(instances[0]));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ module.exports = function(Client) {
|
||||||
password: md5(parseInt(Math.random() * 100000000000000))
|
password: md5(parseInt(Math.random() * 100000000000000))
|
||||||
};
|
};
|
||||||
|
|
||||||
app.models.Account.beginTransaction('READ COMMITTED', (error, transaction) => {
|
app.models.Account.beginTransaction({}, (error, transaction) => {
|
||||||
app.models.Account.create(user, {transaction}, (error, account) => {
|
app.models.Account.create(user, {transaction}, (error, account) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
transaction.rollback();
|
transaction.rollback();
|
||||||
|
|
|
@ -12,7 +12,6 @@ module.exports = function(Client) {
|
||||||
delete params.size;
|
delete params.size;
|
||||||
|
|
||||||
if (params.search) {
|
if (params.search) {
|
||||||
hasAnd = true;
|
|
||||||
filters.where.and = [
|
filters.where.and = [
|
||||||
{
|
{
|
||||||
or: [
|
or: [
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import app from '../../../../server/server';
|
||||||
|
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||||
|
|
||||||
|
describe('Client addresses', () => {
|
||||||
|
it('should call the addressesList method and receive total results and results of 2 as it has only 2 addresses', done => {
|
||||||
|
let id = 1;
|
||||||
|
let params = {
|
||||||
|
page: 10,
|
||||||
|
size: 30
|
||||||
|
};
|
||||||
|
|
||||||
|
let callback = (error, result) => {
|
||||||
|
if (error) return catchErrors(done)(error);
|
||||||
|
|
||||||
|
expect(result).toEqual(jasmine.objectContaining({
|
||||||
|
total: 2
|
||||||
|
}));
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
app.models.Client.addressesList(id, params, callback);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,84 @@
|
||||||
|
import app from '../../../../server/server';
|
||||||
|
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||||
|
import restoreFixtures from '../../../../../../services/db/testing_fixtures';
|
||||||
|
|
||||||
|
describe('Client addressesPropagateRe', () => {
|
||||||
|
let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [
|
||||||
|
`INSERT INTO account.user(id,name,password,role,active,email)
|
||||||
|
VALUES
|
||||||
|
(1, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@verdnatura.es'),
|
||||||
|
(2, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@verdnatura.es'),
|
||||||
|
(3, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@verdnatura.es'),
|
||||||
|
(4, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@verdnatura.es'),
|
||||||
|
(5, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@verdnatura.es'),
|
||||||
|
(6, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'DavidCharlesHaller@verdnatura.es'),
|
||||||
|
(7, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@verdnatura.es'),
|
||||||
|
(8, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'CharlesXavier@verdnatura.es'),
|
||||||
|
(9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'),
|
||||||
|
(10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'),
|
||||||
|
(11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es');
|
||||||
|
|
||||||
|
INSERT INTO salix.Address(id, consignee, street, city, postcode, provinceFk, phone, mobile, isEnabled, isDefaultAddress, clientFk, defaultAgencyFk, longitude, latitude, isEqualizated)
|
||||||
|
VALUES
|
||||||
|
(1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 0),
|
||||||
|
(2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0),
|
||||||
|
(3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0),
|
||||||
|
(4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0),
|
||||||
|
(5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0),
|
||||||
|
(6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0),
|
||||||
|
(7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0),
|
||||||
|
(8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0),
|
||||||
|
(9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
|
||||||
|
(10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0);
|
||||||
|
|
||||||
|
INSERT INTO vn.client(id,name,fi,socialName,contact,street,city,postcode,phone,mobile,fax,isRelevant,email,iban,dueDay,accountingAccount,isEqualizated,provinceFk,hasToInvoice,credit,countryFk,isActive,gestdocFk,quality,payMethodFk,created,isToBeMailed,contactChannelFk,hasSepaVnl,hasCoreVnl,hasCoreVnh,riskCalculated,clientTypeFk,mailAddress,cplusTerIdNifFk,hasToInvoiceByAddress,isTaxDataChecked,isFreezed,creditInsurance,isCreatedAsServed,hasInvoiceSimplified,salesPersonFk,isVies,eypbc)
|
||||||
|
VALUES
|
||||||
|
(1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(2, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(3, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(4, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(5, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
|
(6, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
|
(7, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
|
(8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1),
|
||||||
|
(9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1),
|
||||||
|
(10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1);`
|
||||||
|
]};
|
||||||
|
|
||||||
|
beforeEach(done => {
|
||||||
|
restoreFixtures(fixturesToApply, done);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(done => {
|
||||||
|
restoreFixtures(fixturesToApply, done);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should propagate the isEqualizated on both addresses of Mr Wayne', done => {
|
||||||
|
let id = 1;
|
||||||
|
let data = {
|
||||||
|
isEqualizated: true
|
||||||
|
};
|
||||||
|
|
||||||
|
let callback = (error, result) => {
|
||||||
|
if (error) return catchErrors(done)(error);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
app.models.Address.find({where: {clientFk: id}})
|
||||||
|
.then(result => {
|
||||||
|
expect(result[0].isEqualizated).toBeTruthy();
|
||||||
|
expect(result[1].isEqualizated).toBeTruthy();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
app.models.Address.find({where: {clientFk: id}})
|
||||||
|
.then(result => {
|
||||||
|
expect(result[0].isEqualizated).toBeFalsy();
|
||||||
|
expect(result[1].isEqualizated).toBeFalsy();
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
app.models.Client.addressesPropagateRe(id, data, callback);
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,20 @@
|
||||||
|
import app from '../../../../server/server';
|
||||||
|
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||||
|
|
||||||
|
describe('Client card', () => {
|
||||||
|
it('should call the card() method to receive a formatd card of Bruce Wayne', done => {
|
||||||
|
let id = 1;
|
||||||
|
|
||||||
|
let callback = (error, result) => {
|
||||||
|
if (error) return catchErrors(done)(error);
|
||||||
|
|
||||||
|
expect(result).toEqual(jasmine.objectContaining({
|
||||||
|
id: 1,
|
||||||
|
name: 'Bruce Wayne'
|
||||||
|
}));
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
app.models.Client.card(id, callback);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,20 +1,66 @@
|
||||||
import app from '../../../../server/server';
|
import app from '../../../../server/server';
|
||||||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||||
import {restoreFixtures} from '../../../../../../services/db/testing_fixtures';
|
import restoreFixtures from '../../../../../../services/db/testing_fixtures';
|
||||||
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
describe('Client Create', () => {
|
||||||
|
let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [
|
||||||
|
`INSERT INTO account.user(id,name,password,role,active,email)
|
||||||
|
VALUES
|
||||||
|
(1, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@verdnatura.es'),
|
||||||
|
(2, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@verdnatura.es'),
|
||||||
|
(3, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@verdnatura.es'),
|
||||||
|
(4, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@verdnatura.es'),
|
||||||
|
(5, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@verdnatura.es'),
|
||||||
|
(6, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'DavidCharlesHaller@verdnatura.es'),
|
||||||
|
(7, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@verdnatura.es'),
|
||||||
|
(8, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'CharlesXavier@verdnatura.es'),
|
||||||
|
(9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'),
|
||||||
|
(10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'),
|
||||||
|
(11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es');
|
||||||
|
|
||||||
describe('Client Create()', () => {
|
INSERT INTO salix.Address(id, consignee, street, city, postcode, provinceFk, phone, mobile, isEnabled, isDefaultAddress, clientFk, defaultAgencyFk, longitude, latitude, isEqualizated)
|
||||||
beforeEach(() => {
|
VALUES
|
||||||
restoreFixtures();
|
(1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 0),
|
||||||
|
(2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0),
|
||||||
|
(3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0),
|
||||||
|
(4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0),
|
||||||
|
(5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0),
|
||||||
|
(6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0),
|
||||||
|
(7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0),
|
||||||
|
(8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0),
|
||||||
|
(9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
|
||||||
|
(10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0);
|
||||||
|
|
||||||
|
INSERT INTO vn.client(id,name,fi,socialName,contact,street,city,postcode,phone,mobile,fax,isRelevant,email,iban,dueDay,accountingAccount,isEqualizated,provinceFk,hasToInvoice,credit,countryFk,isActive,gestdocFk,quality,payMethodFk,created,isToBeMailed,contactChannelFk,hasSepaVnl,hasCoreVnl,hasCoreVnh,riskCalculated,clientTypeFk,mailAddress,cplusTerIdNifFk,hasToInvoiceByAddress,isTaxDataChecked,isFreezed,creditInsurance,isCreatedAsServed,hasInvoiceSimplified,salesPersonFk,isVies,eypbc)
|
||||||
|
VALUES
|
||||||
|
(1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(2, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(3, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(4, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
|
(5, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
|
(6, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
|
(7, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
|
(8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1),
|
||||||
|
(9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1),
|
||||||
|
(10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1);`
|
||||||
|
]};
|
||||||
|
|
||||||
|
beforeEach(done => {
|
||||||
|
restoreFixtures(fixturesToApply, done);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(done => {
|
||||||
|
restoreFixtures(fixturesToApply, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
let newAccountData = {
|
let newAccountData = {
|
||||||
|
active: true,
|
||||||
name: 'Wade',
|
name: 'Wade',
|
||||||
userName: 'Deadpool',
|
userName: 'Deadpool',
|
||||||
email: 'Deadpool@marvel.com',
|
email: 'Deadpool@marvel.com',
|
||||||
fi: 'DP',
|
fi: 'DP',
|
||||||
socialName: 'Deadpool Marvel'
|
socialName: 'Deadpool Marvel',
|
||||||
|
salesPersonFk: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should find Charles Xavier', done => {
|
it('should find Charles Xavier', done => {
|
||||||
|
@ -22,8 +68,7 @@ describe('Client Create()', () => {
|
||||||
.then(account => {
|
.then(account => {
|
||||||
expect(account.name).toEqual('CharlesXavier');
|
expect(account.name).toEqual('CharlesXavier');
|
||||||
done();
|
done();
|
||||||
})
|
});
|
||||||
.catch(catchErrors(done));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not find Deadpool as he's not created yet", done => {
|
it("should not find Deadpool as he's not created yet", done => {
|
||||||
|
@ -42,36 +87,42 @@ describe('Client Create()', () => {
|
||||||
it('should not be able to create a user if exists', done => {
|
it('should not be able to create a user if exists', done => {
|
||||||
app.models.Client.findOne({where: {name: 'Charles Xavier'}})
|
app.models.Client.findOne({where: {name: 'Charles Xavier'}})
|
||||||
.then(client => {
|
.then(client => {
|
||||||
|
app.models.Account.findOne({where: {id: client.id}})
|
||||||
|
.then(account => {
|
||||||
let formerAccountData = {
|
let formerAccountData = {
|
||||||
name: client.name,
|
name: client.name,
|
||||||
userName: client.userName,
|
userName: account.name,
|
||||||
email: client.email,
|
email: client.email,
|
||||||
fi: client.fi,
|
fi: client.fi,
|
||||||
socialName: client.socialName
|
socialName: client.socialName
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(app.models.Client.createUserProfile(formerAccountData)).toBeFalsy();
|
app.models.Client.createUserProfile(formerAccountData, (err, client) => {
|
||||||
|
expect(err.details.codes.name[0]).toEqual('uniqueness');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
})
|
||||||
// awaiting for fixtures
|
.catch(catchErrors(done));
|
||||||
// it('should create a new account', done => {
|
});
|
||||||
// app.models.Client.createUserProfile(data => {
|
|
||||||
// app.models.Account.findOne({where: {name: data.userName}})
|
it('should create a new account', done => {
|
||||||
// .then(account => {
|
app.models.Client.createUserProfile(newAccountData, (error, client) => {
|
||||||
// expect(account.name).toEqual(data.userName);
|
if (error) return catchErrors(done)(error);
|
||||||
// app.models.Client.findOne({where: {name: data.name}})
|
app.models.Account.findOne({where: {name: newAccountData.userName}})
|
||||||
// .then(client => {
|
.then(account => {
|
||||||
// expect(client.id).toEqual(account.id);
|
expect(account.name).toEqual(newAccountData.userName);
|
||||||
// expect(client.name).toEqual(data.name);
|
app.models.Client.findOne({where: {name: newAccountData.name}})
|
||||||
// expect(client.email).toEqual(data.email);
|
.then(client => {
|
||||||
// expect(client.fi).toEqual(data.fi);
|
expect(client.id).toEqual(account.id);
|
||||||
// expect(client.socialName).toEqual(data.socialName);
|
expect(client.name).toEqual(newAccountData.name);
|
||||||
// done();
|
expect(client.email).toEqual(newAccountData.email);
|
||||||
// });
|
expect(client.fi).toEqual(newAccountData.fi);
|
||||||
// })
|
expect(client.socialName).toEqual(newAccountData.socialName);
|
||||||
// .catch(catchErrors(done));
|
done();
|
||||||
// });
|
});
|
||||||
// });
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
import app from '../../../../server/server';
|
||||||
|
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||||
|
|
||||||
|
describe('Client employeeList', () => {
|
||||||
|
it('should call the employeeList()', done => {
|
||||||
|
let callback = (error, result) => {
|
||||||
|
if (error) return catchErrors(done)(error);
|
||||||
|
|
||||||
|
expect(result).toEqual(jasmine.objectContaining([
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: 'Bruce Banner'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: 'Charles Xavier'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: 'David Charles Haller'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: 'Hank Pym'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: 'Jessica Jones'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 20,
|
||||||
|
name: 'Victor Stone'
|
||||||
|
}
|
||||||
|
]));
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
app.models.Client.employeeList(callback);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,18 @@
|
||||||
|
import filter from '../filter';
|
||||||
|
|
||||||
|
describe('Greuge filterClients()', () => {
|
||||||
|
it('should call the filterClients method', () => {
|
||||||
|
let params = {
|
||||||
|
page: 1,
|
||||||
|
size: 1,
|
||||||
|
search: 'Bruce Wayne',
|
||||||
|
phone: 555555555
|
||||||
|
};
|
||||||
|
let expectedResponse = {where: {and: [{or: [{id: 'Bruce Wayne'}, {name: {regexp: 'Bruce Wayne'}}]}, {or: [{phone: 555555555}, {mobile: 555555555}]}]}, skip: 0, limit: 1};
|
||||||
|
let client = jasmine.createSpyObj('client', ['installMethod']);
|
||||||
|
filter(client);
|
||||||
|
let filterClients = client.installMethod.calls.allArgs()[0][1];
|
||||||
|
|
||||||
|
expect(Object.keys(filterClients(params))).toEqual(Object.keys(expectedResponse));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,23 @@
|
||||||
|
import filter from '../filter';
|
||||||
|
|
||||||
|
describe('Greuge filterParams()', () => {
|
||||||
|
it('should call the filterParams method', () => {
|
||||||
|
let params = {
|
||||||
|
clientFk: 1,
|
||||||
|
page: 1,
|
||||||
|
size: 1,
|
||||||
|
order: 'DESC'
|
||||||
|
};
|
||||||
|
let self = jasmine.createSpyObj('self', ['installMethod']);
|
||||||
|
filter(self);
|
||||||
|
let filterParams = self.installMethod.calls.allArgs()[0][1];
|
||||||
|
|
||||||
|
expect(filterParams(params)).toEqual({
|
||||||
|
where: Object({clientFk: 1}),
|
||||||
|
skip: 0,
|
||||||
|
limit: 1,
|
||||||
|
order: 'DESC',
|
||||||
|
include: Object({relation: 'greugeType', scope: Object({fields: ['id', 'name']})})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,19 @@
|
||||||
|
import totalGreuge from '../total';
|
||||||
|
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||||
|
|
||||||
|
describe('Greuge totalGreuge()', () => {
|
||||||
|
it('should call the sumAmount method', done => {
|
||||||
|
let clientFk = 1;
|
||||||
|
let self = jasmine.createSpyObj('self', ['remoteMethod', 'rawSql']);
|
||||||
|
self.rawSql.and.returnValue(Promise.resolve([{sumAmount: 6000}]));
|
||||||
|
totalGreuge(self);
|
||||||
|
|
||||||
|
let callback = (error, result) => {
|
||||||
|
if (error) return catchErrors(done)(error);
|
||||||
|
|
||||||
|
expect(result).toBe(6000);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
self.sumAmount(clientFk, callback);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,6 +1,6 @@
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
require('../methods/greuge/filter.js')(Self);
|
require('../methods/greuge/filter.js')(Self);
|
||||||
require('../methods/greuge/totalGreuge.js')(Self);
|
require('../methods/greuge/total.js')(Self);
|
||||||
|
|
||||||
Self.validatesLengthOf('description', {
|
Self.validatesLengthOf('description', {
|
||||||
max: 45,
|
max: 45,
|
||||||
|
|
|
@ -8,9 +8,9 @@ COPY localDB02StructureVn2008.sql /docker-entrypoint-initdb.d
|
||||||
COPY localDB03StructureVn.sql /docker-entrypoint-initdb.d
|
COPY localDB03StructureVn.sql /docker-entrypoint-initdb.d
|
||||||
COPY localDB04StructureOthersDB.sql /docker-entrypoint-initdb.d
|
COPY localDB04StructureOthersDB.sql /docker-entrypoint-initdb.d
|
||||||
COPY localDB05StructureUtil.sql /docker-entrypoint-initdb.d
|
COPY localDB05StructureUtil.sql /docker-entrypoint-initdb.d
|
||||||
COPY localDB06Views2008.sql /docker-entrypoint-initdb.d
|
COPY localDB06ViewsVn.sql /docker-entrypoint-initdb.d
|
||||||
COPY localDB07ViewsVn.sql /docker-entrypoint-initdb.d
|
COPY localDB07OthersViews.sql /docker-entrypoint-initdb.d
|
||||||
COPY localDB08OthersViews.sql /docker-entrypoint-initdb.d
|
COPY localDB08Views2008.sql /docker-entrypoint-initdb.d
|
||||||
COPY localDB09Inserts.sql /docker-entrypoint-initdb.d
|
COPY localDB09Inserts.sql /docker-entrypoint-initdb.d
|
||||||
|
|
||||||
RUN chmod -R 755 /docker-entrypoint-initdb.d
|
RUN chmod -R 755 /docker-entrypoint-initdb.d
|
||||||
|
|
|
@ -30,6 +30,48 @@ CREATE TABLE `account` (
|
||||||
CONSTRAINT `account_ibfk_3` FOREIGN KEY (`id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
CONSTRAINT `account_ibfk_3` FOREIGN KEY (`id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Users allowed to have an account';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Users allowed to have an account';
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||||
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||||
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
|
/*!50003 SET character_set_client = utf8 */ ;
|
||||||
|
/*!50003 SET character_set_results = utf8 */ ;
|
||||||
|
/*!50003 SET collation_connection = utf8_general_ci */ ;
|
||||||
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
|
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
|
DELIMITER ;;
|
||||||
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`accountAfterInsert`
|
||||||
|
AFTER INSERT ON `account`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
UPDATE user SET sync = FALSE
|
||||||
|
WHERE id = NEW.id;
|
||||||
|
END */;;
|
||||||
|
DELIMITER ;
|
||||||
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||||
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||||
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||||
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||||
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||||
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
|
/*!50003 SET character_set_client = utf8 */ ;
|
||||||
|
/*!50003 SET character_set_results = utf8 */ ;
|
||||||
|
/*!50003 SET collation_connection = utf8_general_ci */ ;
|
||||||
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
|
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
|
DELIMITER ;;
|
||||||
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`accountAfterDelete`
|
||||||
|
AFTER DELETE ON `account`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
UPDATE user SET sync = FALSE
|
||||||
|
WHERE id = OLD.id;
|
||||||
|
END */;;
|
||||||
|
DELIMITER ;
|
||||||
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||||
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||||
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `accountConfig`
|
-- Table structure for table `accountConfig`
|
||||||
|
@ -270,7 +312,7 @@ CREATE TABLE `user` (
|
||||||
KEY `nickname` (`nickname`),
|
KEY `nickname` (`nickname`),
|
||||||
KEY `lang` (`lang`),
|
KEY `lang` (`lang`),
|
||||||
CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE
|
CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=50171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users';
|
) ENGINE=InnoDB AUTO_INCREMENT=50179 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users';
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||||
|
@ -1278,7 +1320,7 @@ BEGIN
|
||||||
* excepción.
|
* excepción.
|
||||||
* El nombre de usuario solo debe contener letras minúsculas
|
* El nombre de usuario solo debe contener letras minúsculas
|
||||||
* o, a partir del segundo carácter, números o subguiones.
|
* o, a partir del segundo carácter, números o subguiones.
|
||||||
**/
|
*/
|
||||||
IF vUserName NOT REGEXP '^[a-z0-9_]*$' THEN
|
IF vUserName NOT REGEXP '^[a-z0-9_]*$' THEN
|
||||||
SIGNAL SQLSTATE '45000'
|
SIGNAL SQLSTATE '45000'
|
||||||
SET MESSAGE_TEXT = 'INVALID_USER_NAME';
|
SET MESSAGE_TEXT = 'INVALID_USER_NAME';
|
||||||
|
@ -1573,4 +1615,4 @@ DELIMITER ;
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2017-12-27 7:50:17
|
-- Dump completed on 2018-01-23 12:30:01
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -613,4 +613,4 @@ ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2017-12-29 7:39:15
|
-- Dump completed on 2018-01-23 13:30:21
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -278,7 +278,8 @@ INSERT INTO `salix`.`Country`(`id`, `name`, `inCee`, `code`, `currencyFk`, `real
|
||||||
(2, 'Italia', 1, 'IT', 1, 2),
|
(2, 'Italia', 1, 'IT', 1, 2),
|
||||||
(3, 'Alemania', 1, 'DE', 1, 3),
|
(3, 'Alemania', 1, 'DE', 1, 3),
|
||||||
(4, 'Rumania', 1, 'RO', 1, 4),
|
(4, 'Rumania', 1, 'RO', 1, 4),
|
||||||
(5, 'Holanda', 1, 'NL', 1, 5);
|
(5, 'Holanda', 1, 'NL', 1, 5),
|
||||||
|
(30,'Francia', 1, 'FR', 1, 6);
|
||||||
|
|
||||||
INSERT INTO `salix`.`Warehouse`(`id`, `name`, `tpv`, `inventory`, `isManaged`)
|
INSERT INTO `salix`.`Warehouse`(`id`, `name`, `tpv`, `inventory`, `isManaged`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -377,30 +378,30 @@ INSERT INTO `salix`.`ContactChannel`(`id`, `name`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
|
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1 ),
|
(1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
(2, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1 ),
|
(2, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
(3, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1 ),
|
(3, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
(4, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1 ),
|
(4, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1),
|
||||||
(5, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1 ),
|
(5, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
(6, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1 ),
|
(6, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
(7, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1 ),
|
(7, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1),
|
||||||
(8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1 ),
|
(8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1),
|
||||||
(9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1 ),
|
(9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1),
|
||||||
(10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 1, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1 );
|
(10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `salix`.`Address`(`id`, `consignee`, `street`, `city`, `postcode`, `provinceFk`, `phone`, `mobile`, `isEnabled`, `isDefaultAddress`, `clientFk`, `defaultAgencyFk`, `longitude`, `latitude`, `isEqualizated`)
|
INSERT INTO `salix`.`Address`(`id`, `consignee`, `street`, `city`, `postcode`, `provinceFk`, `phone`, `mobile`, `isEnabled`, `isDefaultAddress`, `clientFk`, `defaultAgencyFk`, `longitude`, `latitude`, `isEqualizated`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 1),
|
(1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 0),
|
||||||
(2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 1),
|
(2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0),
|
||||||
(3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 1),
|
(3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0),
|
||||||
(4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 1),
|
(4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0),
|
||||||
(5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 1),
|
(5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0),
|
||||||
(6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 1),
|
(6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0),
|
||||||
(7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 1),
|
(7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0),
|
||||||
(8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 1),
|
(8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0),
|
||||||
(9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 1),
|
(9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
|
||||||
(10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 1);
|
(10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0);
|
||||||
|
|
||||||
INSERT INTO `salix`.`ClientCredit`(`id`, `clientFk`, `employeeFk`, `amount`, `created`)
|
INSERT INTO `salix`.`ClientCredit`(`id`, `clientFk`, `employeeFk`, `amount`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -461,18 +462,19 @@ INSERT INTO `vn2008`.`empresa`(`id`, `abbreviation`, `registro`, `gerente_id`, `
|
||||||
VALUES
|
VALUES
|
||||||
(442, 'WAY', 'Wayne Industries, Inc. operates as a warehouse for steel products. Wayne Industries, Inc. was founded in 1989 and is based in Wayne, Michigan.', '2', '1989-11-19', NULL, NULL, '1', '1', '00FF00', 'BruceWayne@verdnatura.es', NULL, '1989-08-11 12:31:22', '10', '1', NULL, '1', '1');
|
(442, 'WAY', 'Wayne Industries, Inc. operates as a warehouse for steel products. Wayne Industries, Inc. was founded in 1989 and is based in Wayne, Michigan.', '2', '1989-11-19', NULL, NULL, '1', '1', '00FF00', 'BruceWayne@verdnatura.es', NULL, '1989-08-11 12:31:22', '10', '1', NULL, '1', '1');
|
||||||
|
|
||||||
INSERT INTO `salix`.`Ticket`(`id`, `agencyFk`, `employeeFk`, `date`, `hour`, `clientFk`, `addressFk`)
|
|
||||||
|
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `clientFk`,`nickname`, `addressFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, CURDATE(), 0, 1, 1),
|
(1, 1, 1, NULL, CURDATE(), 1, 'Batman', 1),
|
||||||
(2, 1, 1, CURDATE(), 0, 1, 2),
|
(2, 1, 1, NULL, CURDATE(), 1, 'Spider-Man', 2),
|
||||||
(3, 2, 2, CURDATE(), 0, 2, 3),
|
(3, 2, 2, NULL, CURDATE(), 2, 'Super-Man', 3),
|
||||||
(4, 2, 2, CURDATE(), 0, 2, 4),
|
(4, 2, 2, NULL, CURDATE(), 2, 'Iron-Man', 4),
|
||||||
(5, 3, 3, CURDATE(), 0, 3, 5),
|
(5, 3, 3, NULL, CURDATE(), 3, 'Magneto', 5),
|
||||||
(6, 3, 3, CURDATE(), 0, 3, 6),
|
(6, 3, 3, NULL, CURDATE(), 3, 'Legion', 6),
|
||||||
(7, 4, 4, CURDATE(), 0, 4, 7),
|
(7, 4, 4, NULL, CURDATE(), 4, 'Ant-Man', 7),
|
||||||
(8, 4, 4, CURDATE(), 0, 4, 8),
|
(8, 4, 4, NULL, CURDATE(), 4, 'Professor X', 8),
|
||||||
(9, 5, 5, CURDATE(), 0, 5, 9),
|
(9, 5, 5, NULL, CURDATE(), 5, 'Hulk', 9),
|
||||||
(10, 6, 5, CURDATE(), 0, 5, 10);
|
(10, 6, 5, NULL, CURDATE(), 5, 'Jessica Jones', 10);
|
||||||
|
|
||||||
INSERT INTO `salix`.`TicketState`(`id`, `ticketFk`, `stateFk`, `employeeFk`, `updated`)
|
INSERT INTO `salix`.`TicketState`(`id`, `ticketFk`, `stateFk`, `employeeFk`, `updated`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -527,3 +529,68 @@ INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `ma
|
||||||
VALUES
|
VALUES
|
||||||
(1, 2, 442, '1-1', CURDATE(), 2);
|
(1, 2, 442, '1-1', CURDATE(), 2);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`)
|
||||||
|
VALUES
|
||||||
|
(1, 'Vestimenta', 1, 'B92A26'),
|
||||||
|
(2, 'Objetos', 2, 'dcf711');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 'ARM', 'Armor', 1, 15, 5),
|
||||||
|
(2, 'ITG', 'Infinity gem', 2, 30, 5),
|
||||||
|
(3, 'WPN', 'Weapons', 2, 30, 5);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`)
|
||||||
|
VALUES
|
||||||
|
('AMA', 'Amarillo' ,1 , 1),
|
||||||
|
('AZL', 'Azul' ,1 , 2),
|
||||||
|
('AMR', 'Rojo/Amarillo',1 , 3);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`origin`(`id`,`code`, `name`)
|
||||||
|
VALUES
|
||||||
|
(1, 'ESP', 'España'),
|
||||||
|
(2, 'HOL', 'Holanda'),
|
||||||
|
(3, 'VCL', 'Valencia');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`producer`(`id`, `name`)
|
||||||
|
VALUES
|
||||||
|
(1, 'Cine Marvel'),
|
||||||
|
(2, 'Mitologia nordica');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`taxType`(`id`, `nickname`, `isAccrued`, `serial`, `TIPOOPE`, `description`, `countryFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 'nacional',1, 'R', 'I', 'national VAT',1),
|
||||||
|
(2, 'europea', 0, 'E', 'I', 'europe VAT', 1);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`taxCode`(`id`, `dated`, `code`, `taxTypeFk`, `rate`, `equalizationTax`, `type`, `link`, `isActive`, `updated`, `transactionCode`)
|
||||||
|
VALUES
|
||||||
|
(1, CURDATE(), '1111111111', 1, 7.0 , 0.0, 'R', 1, 1, CURDATE(), 1),
|
||||||
|
(2, CURDATE(), '2222222222', 2, 16.0, 0.0, 'G', 2, 1, CURDATE(), 2);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`)
|
||||||
|
VALUES
|
||||||
|
(1, 'VAT Reduced','R'),
|
||||||
|
(2, 'VAT General', 'G');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 'automatic armor', 1, 1),
|
||||||
|
(2, 'magic weapon' , 2, 2);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`)
|
||||||
|
VALUES
|
||||||
|
(1, 1, 'bail', 0),
|
||||||
|
(2, 1, 'loan', 1);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`item`(`id`, `name`,`typeFk`,`size`,`inkFk`,`category`,`stems`,`originFk`,`description`,`producerFk`,`intrastatFk`,`isOnOffer`,`expenceFk`,`isBargain`,`comment`,`relevancy`,`image`,`taxClassFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 'Gema del Tiempo', 2, 70, 'AMA', 'EXT', 1, 1, 'Una de las gemas del infinito', 1, 2, 0, 1, 0, NULL, 0, NULL, 1),
|
||||||
|
(2, 'Gema de la Mente', 2, 70, 'AZL', 'EXT', 1, 2, 'Una de las gemas del infinito', 1, 2, 0, 1, 0, NULL, 0, NULL, 1),
|
||||||
|
(3, 'Iron Patriot', 1, 60, 'AMR', 'EXT', 1, 3, 'La armadura de Rhodey', 1, 1, 0, 1, 0, NULL, 0, NULL, 1),
|
||||||
|
(4, 'Mark I', 1, 60, 'AMR', 'EXT', 1, 1, 'La primera armadura de Iron Man', 1, 1, 1, 2, 0, NULL, 0, NULL, 2),
|
||||||
|
(5, 'Mjolnir', 3, 30, 'AZR', 'EXT', 1, 2, 'El martillo de Thor', 2, 2, 1, 2, 0, NULL, 0, NULL, 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,42 @@
|
||||||
let mysql = require('mysql');
|
let mysql = require('mysql');
|
||||||
|
|
||||||
let connection = mysql.createConnection({
|
let connection = mysql.createConnection({
|
||||||
multipleStatements: false,
|
multipleStatements: true,
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
user: 'root',
|
user: 'root',
|
||||||
password: '',
|
password: '',
|
||||||
database: 'salix'
|
database: 'salix'
|
||||||
});
|
});
|
||||||
|
|
||||||
export function restoreFixtures() {
|
let errorHandler = callback => {
|
||||||
// connection.connect();
|
return error => {
|
||||||
// connection.query('CALL truncateDatabase');
|
if (error)
|
||||||
// connection.disconect();
|
throw error;
|
||||||
// console.log('fixtures restored');
|
callback();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
let insertFixtures = (inserts, callback) => {
|
||||||
|
connection.query(inserts[0], errorHandler(callback));
|
||||||
|
// connection.query('SET FOREIGN_KEY_CHECKS = 1');
|
||||||
|
};
|
||||||
|
|
||||||
|
let truncate = (tables, callback) => {
|
||||||
|
let truncatesSQL = tables.reduce((accumulator, currentValue, i) => {
|
||||||
|
let sql = 'TRUNCATE TABLE ' + currentValue + '; ';
|
||||||
|
return (`${accumulator}${sql}`);
|
||||||
|
}, '');
|
||||||
|
|
||||||
|
connection.query(truncatesSQL.slice(0, -2), errorHandler(callback));
|
||||||
|
};
|
||||||
|
|
||||||
|
connection.connect();
|
||||||
|
|
||||||
|
export default function restoreFixtures(fixturesToApply, callback) {
|
||||||
|
connection.query('SET FOREIGN_KEY_CHECKS = 0', () => {
|
||||||
|
truncate(fixturesToApply.tables, () => {
|
||||||
|
insertFixtures(fixturesToApply.inserts, callback);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "Expence",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "expence",
|
||||||
|
"database": "vn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "Number",
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "String"
|
||||||
|
},
|
||||||
|
"isWithheld": {
|
||||||
|
"type": "Number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"taxType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "TaxType",
|
||||||
|
"foreignKey": "taxTypeFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,6 +70,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Intrastat",
|
"model": "Intrastat",
|
||||||
"foreignKey": "intrastatFk"
|
"foreignKey": "intrastatFk"
|
||||||
|
},
|
||||||
|
"expence": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Expence",
|
||||||
|
"foreignKey": "expenceFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -51,6 +51,9 @@
|
||||||
"TaxType": {
|
"TaxType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"Expence": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Country": {
|
"Country": {
|
||||||
"dataSource": "salix"
|
"dataSource": "salix"
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,7 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
this[methodName] = (params, cb) => {
|
this[methodName] = (params, cb) => {
|
||||||
let filter = removeEmpty(filterCb(params));
|
let filter = removeEmpty(filterCb(params));
|
||||||
|
|
||||||
var response = {};
|
var response = {};
|
||||||
|
|
||||||
function returnValues() {
|
function returnValues() {
|
||||||
|
@ -181,6 +182,7 @@ module.exports = function(Self) {
|
||||||
returnValues();
|
returnValues();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.count(filter.where, function(err, totalCount) {
|
this.count(filter.where, function(err, totalCount) {
|
||||||
if (err) {
|
if (err) {
|
||||||
error();
|
error();
|
||||||
|
@ -229,4 +231,3 @@ function removeEmpty(o) {
|
||||||
function isEmpty(value) {
|
function isEmpty(value) {
|
||||||
return value === undefined || value === "";
|
return value === undefined || value === "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue