Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Daniel Herrero 2018-03-13 14:30:51 +01:00
commit 5530828d62
43 changed files with 170 additions and 128 deletions

6
.env.json Normal file
View File

@ -0,0 +1,6 @@
{
"salixHost": "localhost",
"salixPort": "3306",
"salixUser": "root",
"salixPassword": "root"
}

6
Jenkinsfile vendored
View File

@ -6,10 +6,14 @@ def branchTest = "test";
env.BRANCH_NAME = branchName; env.BRANCH_NAME = branchName;
env.TAG = "${env.BUILD_NUMBER}"; env.TAG = "${env.BUILD_NUMBER}";
env.salixUser="${env.salixUser}";
env.salixPassword="${env.salixPassword}";
switch (branchName){ switch (branchName){
case branchTest: case branchTest:
env.NODE_ENV = "test"; env.NODE_ENV = "test";
env.salixHost = "${env.testSalixHost}";
env.salixPort = "${env.testSalixPort}";
break; break;
case branchProduction: case branchProduction:
env.DOCKER_HOST = "tcp://172.16.255.29:2375"; env.DOCKER_HOST = "tcp://172.16.255.29:2375";
@ -20,7 +24,7 @@ switch (branchName){
node node
{ {
stage ('Print environment variables'){ stage ('Print environment variables'){
echo "Branch ${branchName}, Build ${env.TAG}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}" echo "Branch ${branchName}, Build ${env.TAG}, salixHost ${env.salixHost}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}"
} }
stage ('Checkout') { stage ('Checkout') {
checkout scm checkout scm

View File

@ -30,7 +30,7 @@
}, },
"menu": { "menu": {
"description": "Basic data", "description": "Basic data",
"icon": "person" "icon": "settings"
} }
}, },
{ {
@ -54,7 +54,7 @@
}, },
"menu": { "menu": {
"description": "Pay method", "description": "Pay method",
"icon": "assignment" "icon": "icon-payment"
} }
}, },
{ {
@ -94,7 +94,7 @@
}, },
"menu": { "menu": {
"description": "Web access", "description": "Web access",
"icon": "language" "icon": "cloud"
} }
}, },
{ {
@ -186,7 +186,7 @@
"component": "vn-client-invoices", "component": "vn-client-invoices",
"menu": { "menu": {
"description": "Invoices", "description": "Invoices",
"icon": "insert_drive_file" "icon": "icon-invoices"
} }
}, },
{ {
@ -204,7 +204,7 @@
}, },
"menu": { "menu": {
"description": "Recovery", "description": "Recovery",
"icon": "credit_card" "icon": "icon-recovery"
} }
}, { }, {
"url": "/create", "url": "/create",

View File

@ -59,9 +59,7 @@
field="observation.observationTypeFk" field="observation.observationTypeFk"
data="observationsTypes.model" data="observationsTypes.model"
show-field="description" show-field="description"
label="Observation type" label="Observation type">
order="description ASC"
filter-search="{where: {description: {regexp: 'search'}}}">
<tpl-item>{{$parent.$parent.item.description}}</tpl-item> <tpl-item>{{$parent.$parent.item.description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-textfield <vn-textfield

View File

@ -30,7 +30,7 @@
value-field="id" value-field="id"
select-fields="name" select-fields="name"
label="Salesperson" label="Salesperson"
filter-search="{where: {or: [{name: {regexp: 'search'}}, {name: {regexp: 'search'}}]}}"> where="{or: [{firstName: {regexp: 'search'}}, {name: {regexp: 'search'}}]}">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one
initial-data="$ctrl.client.contactChannel" initial-data="$ctrl.client.contactChannel"

View File

@ -15,7 +15,7 @@
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Business name" field="$ctrl.client.socialName"></vn-textfield> <vn-textfield vn-one label="Business name" field="$ctrl.client.socialName"></vn-textfield>
<vn-textfield vn-one label="User name" field="$ctrl.client.userName"></vn-textfield> <vn-textfield vn-one label="Web user" field="$ctrl.client.userName"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Email" field="$ctrl.client.email" info="You can save multiple emails"></vn-textfield> <vn-textfield vn-one label="Email" field="$ctrl.client.email" info="You can save multiple emails"></vn-textfield>
@ -26,7 +26,7 @@
value-field="id" value-field="id"
select-fields="name" select-fields="name"
label="Salesperson" label="Salesperson"
filter-search="{where: {or: [{name: {regexp: 'search'}}, {name: {regexp: 'search'}}]}}"> where="{or: [{firstName: {regexp: 'search'}}, {name: {regexp: 'search'}}]}">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>

View File

@ -1,7 +1,7 @@
Name: Nombre Name: Nombre
Tax number: NIF/CIF Tax number: NIF/CIF
Business name: Razón social Business name: Razón social
User name: Nombre de usuario Web user: Usuario Web
Email: Correo electrónico Email: Correo electrónico
Create and edit: Crear y editar Create and edit: Crear y editar
Create: Crear Create: Crear

View File

@ -25,6 +25,7 @@ class ClientDescriptor {
} }
} }
} }
ClientDescriptor.$inject = ['$http'];
ngModule.component('vnClientDescriptor', { ngModule.component('vnClientDescriptor', {
template: require('./descriptor.html'), template: require('./descriptor.html'),

View File

@ -14,7 +14,7 @@
<vn-icon <vn-icon
ng-click="$ctrl.preview($event)" ng-click="$ctrl.preview($event)"
vn-tooltip="Preview" vn-tooltip="Preview"
icon="icon-preview"> icon="desktop_windows">
</vn-icon> </vn-icon>
</vn-horizontal> </vn-horizontal>
</vn-horizontal> </vn-horizontal>

View File

@ -312,7 +312,7 @@ export default class DropDown extends Component {
this.ul.appendChild(fragment); this.ul.appendChild(fragment);
this.activateOption(this._activeOption); this.activateOption(this._activeOption);
this.$.popover.relocate(); this.$.$applyAsync(() => this.$.popover.relocate());
} }
destroyList() { destroyList() {

View File

@ -30,6 +30,8 @@ describe('Component vnDropDown', () => {
let popoverTemplate = require('../popover/popover.html'); let popoverTemplate = require('../popover/popover.html');
let $popover = angular.element(`<div>${popoverTemplate}</div>`); let $popover = angular.element(`<div>${popoverTemplate}</div>`);
$scope.popover = $componentController('vnPopover', {$element: $popover, $scope, $timeout, $transitions}); $scope.popover = $componentController('vnPopover', {$element: $popover, $scope, $timeout, $transitions});
$scope.popover.$postLink();
$scope.model = $componentController('vnModel', {$httpBackend, $q, $filter}); $scope.model = $componentController('vnModel', {$httpBackend, $q, $filter});
controller = $componentController('vnDropDown', {$element, $scope, $transclude: null, $timeout, $httpBackend, $translate: null}); controller = $componentController('vnDropDown', {$element, $scope, $transclude: null, $timeout, $httpBackend, $translate: null});
controller.$postLink(); controller.$postLink();

View File

@ -2,8 +2,6 @@ import './textfield/textfield';
import './watcher/watcher'; import './watcher/watcher';
import './paging/paging'; import './paging/paging';
import './icon/icon'; import './icon/icon';
import './autocomplete/autocomplete';
import './popover/popover';
import './dialog/dialog'; import './dialog/dialog';
import './confirm/confirm'; import './confirm/confirm';
import './title/title'; import './title/title';
@ -12,7 +10,10 @@ import './spinner/spinner';
import './snackbar/snackbar'; import './snackbar/snackbar';
import './tooltip/tooltip'; import './tooltip/tooltip';
import './icon-menu/icon-menu'; import './icon-menu/icon-menu';
import './popover/popover';
import './autocomplete/autocomplete';
import './drop-down/drop-down'; import './drop-down/drop-down';
import './menu/menu';
import './column-header/column-header'; import './column-header/column-header';
import './grid-header/grid-header'; import './grid-header/grid-header';
import './multi-check/multi-check'; import './multi-check/multi-check';

View File

@ -0,0 +1,24 @@
import ngModule from '../../module';
import Popover from '../popover/popover';
export default class Menu extends Popover {
$postLink() {
super.$postLink();
this.element.addEventListener('click',
() => this.onClick());
}
onClick() {
this.hide();
}
}
ngModule.component('vnMenu', {
template: require('../popover/popover.html'),
controller: Menu,
transclude: true,
bindings: {
onOpen: '&?',
onClose: '&?'
}
});

View File

@ -11,6 +11,10 @@ export default class Popover extends Component {
this.$timeout = $timeout; this.$timeout = $timeout;
this.$transitions = $transitions; this.$transitions = $transitions;
this._shown = false; this._shown = false;
}
$postLink() {
this.$element.addClass('vn-popover');
this.docKeyDownHandler = e => this.onDocKeyDown(e); this.docKeyDownHandler = e => this.onDocKeyDown(e);
this.docFocusInHandler = e => this.onDocFocusIn(e); this.docFocusInHandler = e => this.onDocFocusIn(e);
@ -153,7 +157,6 @@ export default class Popover extends Component {
if (event.keyCode == 27) { // Esc if (event.keyCode == 27) { // Esc
event.preventDefault(); event.preventDefault();
this.hide(); this.hide();
this.$.$applyAsync();
} }
} }

View File

@ -1,4 +1,4 @@
vn-popover { .vn-popover {
display: none; display: none;
z-index: 10; z-index: 10;
position: fixed; position: fixed;

View File

@ -0,0 +1,6 @@
vn-textarea {
& > .mdl-textfield {
width: initial;
display: block;
}
}

View File

@ -1,5 +1,6 @@
import ngModule from '../../module'; import ngModule from '../../module';
import template from './textarea.html'; import template from './textarea.html';
import './style.scss';
directive.$inject = ['vnTemplate']; directive.$inject = ['vnTemplate'];
export function directive(vnTemplate) { export function directive(vnTemplate) {

View File

@ -1,6 +1,18 @@
.icon-tags:before { content: '\e800'; } .icon-barcode:before { content: '\e800'; } /* '' */
.icon-tree:before { content: '\e801'; } .icon-volume:before { content: '\e801'; } /* '' */
.icon-clone2:before { content: '\e802'; } .icon-bucket:before { content: '\e802'; } /* '' */
.icon-preview:before { content: '\e803'; } .icon-disabled:before { content: '\e80b'; } /* '' */
.icon-history:before { content: '\f1da'; } .icon-invoices:before { content: '\e80c'; } /* '' */
.icon-noweb:before { content: '\e812'; } /* '' */
.icon-payment:before { content: '\e813'; } /* '' */
.icon-recovery:before { content: '\e815'; } /* '' */
.icon-risk:before { content: '\e816'; } /* '' */
.icon-lines:before { content: '\e819'; } /* '' */
.icon-volum:before { content: '\e81b'; } /* '' */
.icon-components:before { content: '\e81c'; } /* '' */
.icon-clone:before { content: '\e81d'; } /* '' */
.icon-addperson:before { content: '\e81e'; } /* '' */
.icon-bin:before { content: '\e81f'; } /* '' */
.icon-sms:before { content: '\e820'; } /* '' */
.icon-tags:before { content: '\e821'; } /* '' */

View File

@ -35,7 +35,7 @@
}, },
"menu": { "menu": {
"description": "Basic data", "description": "Basic data",
"icon": "folder" "icon": "settings"
}, },
"acl": ["buyer"] "acl": ["buyer"]
}, },
@ -48,7 +48,7 @@
}, },
"menu": { "menu": {
"description": "Tags", "description": "Tags",
"icon": "folder" "icon": "icon-tags"
}, },
"acl": ["buyer"] "acl": ["buyer"]
}, },
@ -70,7 +70,7 @@
}, },
"menu": { "menu": {
"description": "History", "description": "History",
"icon": "folder" "icon": "history"
} }
}, },
{ {
@ -107,7 +107,7 @@
}, },
"menu": { "menu": {
"description": "Barcode", "description": "Barcode",
"icon": "folder" "icon": "icon-barcode"
}, },
"acl": ["buyer","replenisher"] "acl": ["buyer","replenisher"]
},{ },{

View File

@ -23,12 +23,9 @@
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/item/api/Intrastats" url="/item/api/Intrastats"
label="Intrastat" label="Intrastat"
show-field="description"
value-field="id" value-field="id"
field="$ctrl.item.intrastatFk" show-field="description"
order="description ASC" field="$ctrl.item.intrastatFk">
filter-search="{where: {description: {regexp: 'search'}} }">
<tpl-item>{{$parent.$parent.item.description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -30,10 +30,9 @@
show-field="description" show-field="description"
value-field="id" value-field="id"
field="$ctrl.item.intrastatFk" field="$ctrl.item.intrastatFk"
order="description ASC" where="{or: [{id: {regexp: 'search'}}, {description: {regexp: 'search'}}]}"
filter-search= "{where: {or: [{id: {regexp: 'search'}}, {description: {regexp: 'search'}}]}}"
initial-data="$ctrl.item.intrastat"> initial-data="$ctrl.item.intrastat">
<tpl-item>{{$parent.$parent.item.id}} : {{$parent.$parent.item.description}}</tpl-item> <tpl-item>{{id}} : {{description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield> <vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
</vn-horizontal> </vn-horizontal>

View File

@ -20,12 +20,12 @@
<vn-icon <vn-icon
ng-click="$ctrl.clone($event)" ng-click="$ctrl.clone($event)"
vn-tooltip="Clone" vn-tooltip="Clone"
icon="icon-clone2"> icon="icon-clone">
</vn-icon> </vn-icon>
<vn-icon <vn-icon
ng-click="$ctrl.preview($event)" ng-click="$ctrl.preview($event)"
vn-tooltip="Preview" vn-tooltip="Preview"
icon="icon-preview"> icon="desktop_windows">
</vn-icon> </vn-icon>
</vn-horizontal> </vn-horizontal>
</vn-horizontal> </vn-horizontal>

View File

@ -1,7 +1,7 @@
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
data="$ctrl.item" data="$ctrl.item"
form = "form"> form="form">
</vn-watcher> </vn-watcher>
<form name="form" ng-submit="$ctrl.submit()"> <form name="form" ng-submit="$ctrl.submit()">
<vn-card pad-large> <vn-card pad-large>
@ -9,13 +9,12 @@
<vn-horizontal ng-repeat="itemNiche in $ctrl.niches track by $index"> <vn-horizontal ng-repeat="itemNiche in $ctrl.niches track by $index">
<vn-autocomplete <vn-autocomplete
vn-three vn-three
initial-data = "itemNiche.warehouse" data="$ctrl.warehouses"
field = "itemNiche.warehouseFk" show-field="name"
data = "$ctrl.warehouses" value-field="id"
show-field = "name" initial-data="itemNiche.warehouse"
value-field = "id" field="itemNiche.warehouseFk"
label = "Warehouse" label="Warehouse"
order = "name ASC"
vn-acl="buyer,replenisher"> vn-acl="buyer,replenisher">
</vn-autocomplete> </vn-autocomplete>
<vn-textfield <vn-textfield
@ -39,7 +38,7 @@
margin-medium-left margin-medium-left
orange orange
icon="add_circle" icon="add_circle"
ng-if = "itemNiche.showAddIcon" ng-if="itemNiche.showAddIcon"
ng-click="$ctrl.addNiche()"> ng-click="$ctrl.addNiche()">
</vn-icon> </vn-icon>
</vn-one> </vn-one>

View File

@ -14,7 +14,6 @@
data="tags.model" data="tags.model"
show-field="name" show-field="name"
label="Tag" label="Tag"
order="name ASC"
vn-acl="buyer"> vn-acl="buyer">
</vn-autocomplete> </vn-autocomplete>
<vn-textfield <vn-textfield

View File

@ -9,22 +9,22 @@
vn-popover="apps-menu" vn-popover="apps-menu"
translate-attr="{title: 'Applications'}"> translate-attr="{title: 'Applications'}">
</vn-icon> </vn-icon>
<vn-popover vn-id="apps-menu" ng-click="appsMenu.hide()"> <vn-menu vn-id="apps-menu">
<ul id="apps-menu" pad-small> <ul pad-small>
<li ng-repeat="mod in ::$ctrl.modules" ui-sref="{{::mod.route.state}}"> <li ng-repeat="mod in ::$ctrl.modules" ui-sref="{{::mod.route.state}}">
<vn-icon icon="{{::mod.icon}}"></vn-icon> <vn-icon icon="{{::mod.icon}}"></vn-icon>
<span translate>{{::mod.name}}</span> <span translate>{{::mod.name}}</span>
</li> </li>
</ul> </ul>
</vn-popover> </vn-menu>
<vn-icon <vn-icon
id="lang" id="lang"
icon="language" icon="language"
vn-popover="langs-menu" vn-popover="langs-menu"
translate-attr="{title: 'Change language'}"> translate-attr="{title: 'Change language'}">
</vn-icon> </vn-icon>
<vn-popover vn-id="langs-menu"> <vn-menu vn-id="langs-menu">
<ul id="langs-menu" pad-small> <ul pad-small>
<li <li
ng-repeat="lang in ::$ctrl.langs" ng-repeat="lang in ::$ctrl.langs"
name="{{::lang}}" name="{{::lang}}"
@ -32,7 +32,7 @@
<span>{{::lang}}</span> <span>{{::lang}}</span>
</li> </li>
</ul> </ul>
</vn-popover> </vn-menu>
<vn-icon <vn-icon
id="logout" id="logout"
icon="exit_to_app" icon="exit_to_app"

View File

@ -14,7 +14,7 @@ vn-main-menu {
color: #FF9300; color: #FF9300;
} }
} }
vn-popover ul { .vn-popover ul {
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
color: white; color: white;
@ -25,7 +25,7 @@ vn-main-menu {
cursor: pointer; cursor: pointer;
padding: .8em; padding: .8em;
border-radius: .1em; border-radius: .1em;
min-width: 4em; min-width: 8em;
& > vn-icon { & > vn-icon {
padding-right: .3em; padding-right: .3em;

View File

@ -23,7 +23,7 @@ Nightmare.action('changeLanguageToEnglish', function(done) {
this.then(done); this.then(done);
} else { } else {
this.click('#lang') this.click('#lang')
.click('#langs-menu > li[name="en"]') .click('vn-main-menu [vn-id="langs-menu"] ul > li[name="en"]')
.then(done); .then(done);
} }
}); });

View File

@ -150,8 +150,8 @@ export default {
itemsIndex: { itemsIndex: {
createItemButton: `${components.vnFloatButton}`, createItemButton: `${components.vnFloatButton}`,
searchResult: `vn-item-product a`, searchResult: `vn-item-product a`,
searchResultPreviewButton: `vn-item-product .buttons > [icon="icon-preview"]`, searchResultPreviewButton: `vn-item-product .buttons > [icon="desktop_windows"]`,
searchResultCloneButton: `vn-item-product .buttons > [icon="icon-clone2"]`, searchResultCloneButton: `vn-item-product .buttons > [icon="icon-clone"]`,
acceptClonationAlertButton: `vn-item-list [vn-id="clone"] [response="ACCEPT"]`, acceptClonationAlertButton: `vn-item-list [vn-id="clone"] [response="ACCEPT"]`,
searchItemInput: `${components.vnTextfield}`, searchItemInput: `${components.vnTextfield}`,
searchButton: `${components.vnSearchBar} > vn-icon-button > button`, searchButton: `${components.vnSearchBar} > vn-icon-button > button`,

View File

@ -6,6 +6,7 @@ const exec = require('child_process').exec;
const PluginError = require('plugin-error'); const PluginError = require('plugin-error');
const argv = require('minimist')(process.argv.slice(2)); const argv = require('minimist')(process.argv.slice(2));
const log = require('fancy-log'); const log = require('fancy-log');
const environment = require('gulp-env');
// Configuration // Configuration
@ -37,7 +38,13 @@ let defaultPort = proxyConf.defaultPort;
// Development // Development
gulp.task('default', () => { gulp.task('default', () => {
return gulp.start('services', 'client'); return gulp.start('environment', 'services', 'client');
});
gulp.task('environment', async () => {
await environment({
file: '.env.json'
});
}); });
gulp.task('client', ['build-clean'], async () => { gulp.task('client', ['build-clean'], async () => {
@ -48,7 +55,7 @@ gulp.task('client', ['build-clean'], async () => {
* Starts all backend services, including the nginx proxy and the database. * Starts all backend services, including the nginx proxy and the database.
*/ */
gulp.task('services', async () => { gulp.task('services', async () => {
await runSequenceP('docker-start', 'services-only', 'nginx'); await runSequenceP('environment', 'docker-start', 'services-only', 'nginx');
}); });
/** /**
@ -137,7 +144,7 @@ gulp.task('install', () => {
// Deployment // Deployment
gulp.task('build', ['clean'], async () => { gulp.task('build', ['clean'], async () => {
await runSequenceP(['routes', 'locales', 'webpack', 'docker-compose', 'nginx-conf']); await runSequenceP(['environment', 'routes', 'locales', 'webpack', 'docker-compose', 'nginx-conf']);
}); });
gulp.task('docker-compose', async () => { gulp.task('docker-compose', async () => {
@ -154,7 +161,9 @@ gulp.task('docker-compose', async () => {
// dockerFile = 'Dockerfile'; // dockerFile = 'Dockerfile';
composeYml.services[service.name] = { composeYml.services[service.name] = {
environment: ['NODE_ENV=${NODE_ENV}'], environment: ['NODE_ENV=${NODE_ENV}' ,'salixHost=${salixHost}', 'salixPort=${salixPort}',
'salixUser=${salixUser}', 'salixPassword=${salixPassword}'
],
container_name: `\${BRANCH_NAME}-${service.name}`, container_name: `\${BRANCH_NAME}-${service.name}`,
image: `${service.name}:\${TAG}`, image: `${service.name}:\${TAG}`,
build: { build: {
@ -480,7 +489,8 @@ gulp.task('docker-wait', callback => {
let conn = mysql.createConnection({ let conn = mysql.createConnection({
host: 'localhost', host: 'localhost',
user: 'root' user: 'root',
password: 'root'
}); });
conn.on('error', () => {}); conn.on('error', () => {});
conn.connect(err => { conn.connect(err => {

View File

@ -44,6 +44,7 @@
"file-loader": "^1.1.6", "file-loader": "^1.1.6",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-env": "^0.4.0",
"gulp-extend": "^0.2.0", "gulp-extend": "^0.2.0",
"gulp-install": "^1.1.0", "gulp-install": "^1.1.0",
"gulp-jasmine": "^3.0.0", "gulp-jasmine": "^3.0.0",

View File

@ -1,24 +0,0 @@
// const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
// module.exports = {
// reporter: new SpecReporter({
// spec: {
// // displayStacktrace: 'summary',
// displaySuccessful: false,
// displayFailedSpec: true,
// displaySpecDuration: true
// }
// }),
// config: {
// spec_dir: 'services',
// spec_files: [
// // '**/*.spec.js',
// 'auth/server/**/*.spec.js',
// 'client/common/**/*.spec.js',
// 'loopback/common/**/*.spec.js'
// ],
// helpers: [
// '/services/utils/jasmineHelpers.js'
// ]
// }
// };

View File

@ -2,5 +2,5 @@
for file in changes/*/*.sql; do for file in changes/*/*.sql; do
echo "Importing $file" echo "Importing $file"
mysql -u root < $file mysql -u root -proot < $file
done done

View File

@ -1,6 +1,6 @@
FROM mysql:5.6.37 FROM mysql:5.6.37
ENV MYSQL_ALLOW_EMPTY_PASSWORD yes ENV MYSQL_ROOT_PASSWORD root
ENV TZ GMT-1 ENV TZ GMT-1
WORKDIR /docker-entrypoint-initdb.d WORKDIR /docker-entrypoint-initdb.d

View File

@ -4,7 +4,7 @@ let connection = mysql.createConnection({
multipleStatements: true, multipleStatements: true,
host: 'localhost', host: 'localhost',
user: 'root', user: 'root',
password: '', password: 'root',
database: 'salix' database: 'salix'
}); });

View File

@ -25,12 +25,6 @@ module.exports = function(Self) {
Self.validatesUniquenessOf('socialName', { Self.validatesUniquenessOf('socialName', {
message: 'La razón social debe ser única' message: 'La razón social debe ser única'
}); });
Self.validatesFormatOf('postcode', {
message: 'El código postal solo debe contener números',
allowNull: true,
allowBlank: true,
with: /^\d+$/
});
Self.validatesFormatOf('email', { Self.validatesFormatOf('email', {
message: 'Correo electrónico inválido', message: 'Correo electrónico inválido',
allowNull: true, allowNull: true,

View File

@ -1,39 +1,39 @@
const validateDni = require('../validateDni'); const validateDni = require('../validateDni');
describe('DNI validation', () => { describe('DNI validation', () => {
it('should return false for invented DNI', () => { it('should return true for any DNI when no country is passed', () => {
let isValid = validateDni('Pepinillos'); let isValid = validateDni('Pepinillos');
expect(isValid).toBeFalsy(); expect(isValid).toBeTruthy();
}); });
describe('Spanish', () => { describe('Spanish', () => {
it('should return true for valid spanish DNI', () => { it('should return true for valid spanish DNI', () => {
let isValid = validateDni('20849756A'); let isValid = validateDni('20849756A', 'es');
expect(isValid).toBeTruthy(); expect(isValid).toBeTruthy();
}); });
it('should return false for spanish DNI with exceeded digits', () => { it('should return false for spanish DNI with exceeded digits', () => {
let isValid = validateDni('208497563239A'); let isValid = validateDni('208497563239A', 'es');
expect(isValid).toBeFalsy(); expect(isValid).toBeFalsy();
}); });
it('should return false for spanish DNI with invalid letter', () => { it('should return false for spanish DNI with invalid letter', () => {
let isValid = validateDni('20243746E'); let isValid = validateDni('20243746E', 'es');
expect(isValid).toBeFalsy(); expect(isValid).toBeFalsy();
}); });
it('should return true for valid spanish CIF', () => { it('should return true for valid spanish CIF', () => {
let isValid = validateDni('B97367486'); let isValid = validateDni('B97367486', 'es');
expect(isValid).toBeTruthy(); expect(isValid).toBeTruthy();
}); });
it('should return false for spanish CIF with invalid letter', () => { it('should return false for spanish CIF with invalid letter', () => {
let isValid = validateDni('A97527786'); let isValid = validateDni('A97527786', 'es');
expect(isValid).toBeFalsy(); expect(isValid).toBeFalsy();
}); });

View File

@ -1,9 +1,11 @@
module.exports = function(fi, country) { module.exports = function(fi, country) {
if (fi == null) return true; if (fi == null || country == null)
if (typeof fi != 'string') return false; return true;
if (typeof fi != 'string' || typeof country != 'string')
return false;
fi = fi.toUpperCase(); fi = fi.toUpperCase();
country = country ? country.toLowerCase() : 'es'; country = country.toLowerCase();
let len = fi.length; let len = fi.length;

View File

@ -4,7 +4,7 @@ module.exports = function(iban) {
iban = iban.toUpperCase(); iban = iban.toUpperCase();
iban = trim(iban); iban = trim(iban);
iban = iban.replace(/\s/g, ""); iban = iban.replace(/\s/g, '');
if (iban.length != 24) { if (iban.length != 24) {
return false; return false;
@ -33,7 +33,7 @@ module.exports = function(iban) {
function module97(iban) { function module97(iban) {
var parts = Math.ceil(iban.length / 7); var parts = Math.ceil(iban.length / 7);
var remainer = ""; var remainer = '';
for (var i = 1; i <= parts; i++) { for (var i = 1; i <= parts; i++) {
remainer = String(parseFloat(remainer + iban.substr((i - 1) * 7, 7)) % 97); remainer = String(parseFloat(remainer + iban.substr((i - 1) * 7, 7)) % 97);
@ -48,6 +48,6 @@ module.exports = function(iban) {
} }
function trim(text) { function trim(text) {
return (text || "").replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g, "" ); return (text || '').replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g, '');
} }
}; };

View File

@ -1,37 +1,41 @@
{ {
"db": { "db": {
"name": "db",
"connector": "memory" "connector": "memory"
}, },
"vn": { "vn": {
"name": "mysql",
"connector": "mysql", "connector": "mysql",
"database": "vn", "database": "vn",
"debug": false, "debug": false,
"host": "localhost", "host": "${salixHost}",
"port": 3306, "port": "${salixPort}",
"username": "root", "username": "${salixUser}",
"password": "", "password": "${salixPassword}",
"connectTimeout": 20000, "connectTimeout": 20000,
"acquireTimeout": 20000 "acquireTimeout": 20000
}, },
"salix": { "salix": {
"name": "mysql",
"connector": "mysql", "connector": "mysql",
"database": "salix", "database": "salix",
"debug": false, "debug": false,
"host": "localhost", "host": "${salixHost}",
"port": 3306, "port": "${salixPort}",
"username": "root", "username": "${salixUser}",
"password": "", "password": "${salixPassword}",
"connectTimeout": 20000, "connectTimeout": 20000,
"acquireTimeout": 20000 "acquireTimeout": 20000
}, },
"account": { "account": {
"name": "mysql",
"connector": "mysql", "connector": "mysql",
"database": "account", "database": "account",
"debug": false, "debug": false,
"host": "localhost", "host": "${salixHost}",
"port": 3306, "port": "${salixPort}",
"username": "root", "username": "${salixUser}",
"password": "", "password": "${salixPassword}",
"connectTimeout": 20000, "connectTimeout": 20000,
"acquireTimeout": 20000 "acquireTimeout": 20000
}, },
@ -39,10 +43,10 @@
"connector": "mysql", "connector": "mysql",
"database": "edi", "database": "edi",
"debug": false, "debug": false,
"host": "localhost", "host": "${salixHost}",
"port": 3306, "port": "${salixPort}",
"username": "root", "username": "${salixUser}",
"password": "", "password": "${salixPassword}",
"connectTimeout": 20000, "connectTimeout": 20000,
"acquireTimeout": 20000 "acquireTimeout": 20000
} }

View File

@ -11,7 +11,7 @@
"port": 3306, "port": 3306,
"database": "vn", "database": "vn",
"user": "root", "user": "root",
"password": "" "password": "root"
}, },
"smtp": { "smtp": {
"host": "localhost", "host": "localhost",

View File

@ -9,7 +9,7 @@
"port": 3306, "port": 3306,
"database": "vn", "database": "vn",
"user": "root", "user": "root",
"password": "" "password": "root"
}, },
"pdf": { "pdf": {
"format": "A4", "format": "A4",

View File

@ -13,6 +13,9 @@ if (process.argv[2] === '--v') {
var Jasmine = require('jasmine'); var Jasmine = require('jasmine');
var jasmine = new Jasmine(); var jasmine = new Jasmine();
var SpecReporter = require('jasmine-spec-reporter').SpecReporter; var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
let environment = require('gulp-env');
environment(".env.json");
jasmine.loadConfig({ jasmine.loadConfig({
spec_dir: 'services', spec_dir: 'services',