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

This commit is contained in:
Gerard 2018-10-16 13:18:32 +02:00
commit 31fa66e052
13 changed files with 450 additions and 245 deletions

View File

@ -10,19 +10,38 @@
<vn-title>Pay method</vn-title>
<vn-horizontal>
<vn-autocomplete
vn-one
vn-two
label="Pay method"
vn-acl="administrative, salesAssistant"
vn-acl="salesAssistant"
field="$ctrl.client.payMethodFk"
url="/client/api/PayMethods"
select-fields="ibanRequired"
initial-data="$ctrl.client.payMethod">
</vn-autocomplete>
<vn-autocomplete vn-two
label="Swift / BIC"
url="/client/api/BankEntities"
field="$ctrl.client.bankEntityFk"
select-fields="['name']"
initial-data="$ctrl.client.bankEntityFk"
where="{or: [{bic: {regexp: 'search'}}, {name: {regexp: 'search'}}]}"
value-field="id"
show-field="bic"
vn-acl="salesAssistant">
<tpl-item>
<vn-horizontal>
<vn-one>{{bic}}</vn-one>
<vn-one>
<div class="ellipsize" style="max-width: 10em">{{name}}</div>
</vn-one>
</vn-horizontal>
</tpl-item>
</vn-autocomplete>
<vn-textfield
vn-one
label="Due day"
field="$ctrl.client.dueDay"
vn-acl="administrative, salesAssistant">
vn-acl="salesAssistant">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
@ -30,7 +49,7 @@
vn-one
label="IBAN"
field="$ctrl.client.iban"
vn-acl="administrative, salesAssistant">
vn-acl="salesAssistant">
</vn-textfield>
</vn-horizontal>
<vn-horizontal pad-small-v>
@ -38,26 +57,26 @@
<vn-check
label="Received LCR"
field="$ctrl.client.hasLcr"
vn-acl="administrative, salesAssistant">
vn-acl="salesAssistant">
</vn-check>
</vn-one>
<vn-one>
<vn-check
label="Received core VNL"
field="$ctrl.client.hasCoreVnl"
vn-acl="administrative, salesAssistant">
vn-acl="salesAssistant">
</vn-check>
</vn-one>
<vn-one>
<vn-check
label="Received B2B VNL"
field="$ctrl.client.hasSepaVnl"
vn-acl="administrative, salesAssistant">
vn-acl="salesAssistant">
</vn-check>
</vn-one>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit label="Save" vn-acl="administrative, salesAssistant"></vn-submit>
<vn-submit label="Save" vn-acl="salesAssistant"></vn-submit>
</vn-button-bar>
</form>

View File

@ -1,4 +1,5 @@
vn-dialog vn-one {
min-width: 15em;
vn-dialog {
vn-client-summary vn-one {
min-width: 10em;
}
}

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Client', () => {
xdescribe('Client', () => {
describe('Edit pay method path', () => {
const nightmare = createNightmare();

View File

@ -0,0 +1,30 @@
{
"name": "BankEntity",
"base": "VnModel",
"options": {
"mysql": {
"table": "bankEntity",
"database": "vn"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"bic": {
"type": "String"
},
"name": {
"type": "String"
}
},
"relations": {
"country": {
"type": "belongsTo",
"model": "Country",
"foreignKey": "countryFk"
}
}
}

View File

@ -0,0 +1,27 @@
{
"name": "ClientRisk",
"base": "VnModel",
"options": {
"mysql": {
"table": "clientRisk",
"database": "vn"
}
},
"properties": {
"amount": {
"type": "Number"
}
},
"relations": {
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "companyFk"
}
}
}

View File

@ -1,59 +1,65 @@
{
"AddressObservation": {
"dataSource": "vn"
},
"ClientCredit": {
"dataSource": "vn"
},
"ClientObservation": {
"dataSource": "vn"
},
"ClientContact": {
"dataSource": "vn"
},
"Greuge": {
"dataSource": "vn"
},
"GreugeType": {
"dataSource": "vn"
},
"Mandate": {
"dataSource": "vn"
},
"MandateType": {
"dataSource": "vn"
},
"ObservationType": {
"dataSource": "vn"
},
"Recovery": {
"dataSource": "vn"
},
"InvoiceOut": {
"dataSource": "vn"
},
"CreditInsurance": {
"dataSource": "vn"
},
"CreditClassification": {
"dataSource": "vn"
},
"Sample": {
"dataSource": "vn"
},
"ClientSample": {
"dataSource": "vn"
},
"TpvError": {
"dataSource": "hedera"
},
"TpvMerchant": {
"dataSource": "hedera"
},
"TpvResponse": {
"dataSource": "hedera"
},
"Defaulter": {
"dataSource": "vn"
}
"AddressObservation": {
"dataSource": "vn"
},
"BankEntity": {
"dataSource": "vn"
},
"ClientCredit": {
"dataSource": "vn"
},
"ClientObservation": {
"dataSource": "vn"
},
"ClientContact": {
"dataSource": "vn"
},
"Greuge": {
"dataSource": "vn"
},
"GreugeType": {
"dataSource": "vn"
},
"Mandate": {
"dataSource": "vn"
},
"MandateType": {
"dataSource": "vn"
},
"ObservationType": {
"dataSource": "vn"
},
"Recovery": {
"dataSource": "vn"
},
"InvoiceOut": {
"dataSource": "vn"
},
"CreditInsurance": {
"dataSource": "vn"
},
"CreditClassification": {
"dataSource": "vn"
},
"Sample": {
"dataSource": "vn"
},
"ClientSample": {
"dataSource": "vn"
},
"TpvError": {
"dataSource": "hedera"
},
"TpvMerchant": {
"dataSource": "hedera"
},
"TpvResponse": {
"dataSource": "hedera"
},
"Defaulter": {
"dataSource": "vn"
},
"ClientRisk": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,64 @@
/**
* Cambios para evitar fallos en local.
* Ya está en producción
**/
ALTER TABLE `vn2008`.`Clientes`
ADD COLUMN `bankEntityFk` INT(10) UNSIGNED NULL AFTER `hasLcr`;
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `client` AS
SELECT
`c`.`id_cliente` AS `id`,
`c`.`cliente` AS `name`,
`c`.`if` AS `fi`,
`c`.`razonSocial` AS `socialName`,
`c`.`contacto` AS `contact`,
`c`.`domicilio` AS `street`,
`c`.`poblacion` AS `city`,
`c`.`codPostal` AS `postcode`,
`c`.`telefono` AS `phone`,
`c`.`movil` AS `mobile`,
`c`.`fax` AS `fax`,
`c`.`real` AS `isRelevant`,
`c`.`e-mail` AS `email`,
`c`.`iban` AS `iban`,
`c`.`vencimiento` AS `dueDay`,
`c`.`Cuenta` AS `accountingAccount`,
`c`.`RE` AS `isEqualizated`,
`c`.`province_id` AS `provinceFk`,
`c`.`invoice` AS `hasToInvoice`,
`c`.`credito` AS `credit`,
`c`.`Id_Pais` AS `countryFk`,
`c`.`activo` AS `isActive`,
`c`.`gestdoc_id` AS `gestdocFk`,
`c`.`calidad` AS `quality`,
`c`.`pay_met_id` AS `payMethodFk`,
`c`.`created` AS `created`,
`c`.`mail` AS `isToBeMailed`,
`c`.`chanel_id` AS `contactChannelFk`,
`c`.`sepaVnl` AS `hasSepaVnl`,
`c`.`coreVnl` AS `hasCoreVnl`,
`c`.`coreVnh` AS `hasCoreVnh`,
`c`.`hasLcr` AS `hasLcr`,
`c`.`default_address` AS `defaultAddressFk`,
`c`.`risk_calculated` AS `riskCalculated`,
`c`.`clientes_tipo_id` AS `clientTypeFk`,
`c`.`mail_address` AS `mailAddress`,
`c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`,
`c`.`invoiceByAddress` AS `hasToInvoiceByAddress`,
`c`.`contabilizado` AS `isTaxDataChecked`,
`c`.`congelado` AS `isFreezed`,
`c`.`creditInsurance` AS `creditInsurance`,
`c`.`isCreatedAsServed` AS `isCreatedAsServed`,
`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,
`c`.`Id_Trabajador` AS `salesPersonFk`,
`c`.`vies` AS `isVies`,
`c`.`EYPBC` AS `eypbc`,
bankEntityFk
FROM
`vn2008`.`Clientes` `c`;

View File

@ -0,0 +1,12 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `clientRisk` AS
SELECT
`c`.`customer_id` AS `clientFk`,
`c`.`company_id` AS `companyFk`,
`c`.`amount` AS `amount`
FROM
`bi`.`customer_risk` `c`;

View File

@ -33,6 +33,7 @@ module.exports = Self => {
let data = filterAttributes(params, [
'payMethodFk',
'bankEntityFk',
'dueDay',
'iban',
'hasLcr',

View File

@ -0,0 +1,35 @@
{
"name": "ClaimRatio",
"base": "VnModel",
"options": {
"mysql": {
"table": "claimRatio",
"database": "vn"
}
},
"validateUpsert": true,
"properties": {
"yearSale": {
"type": "Number"
},
"claimAmount": {
"type": "Number"
},
"claimingRate": {
"type": "Number"
},
"priceIncreasing": {
"type": "Number"
},
"packingRate": {
"type": "Number"
}
},
"relations": {
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
}
}
}

View File

@ -84,6 +84,7 @@ module.exports = Self => {
Self.validate('payMethod', hasSalesMan, {
message: 'Cannot change the payment method if no salesperson'
});
function hasSalesMan(err) {
if (this.payMethod && !this.salesPerson)
err();
@ -92,9 +93,10 @@ module.exports = Self => {
Self.validateAsync('payMethodFk', hasIban, {
message: 'That payment method requires an IBAN'
});
function hasIban(err, done) {
Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => {
if (instance && instance.ibanRequired && !this.iban)
if (instance && instance.ibanRequired && (!this.iban || !this.bankEntityFk))
err();
done();
});

View File

@ -1,177 +1,182 @@
{
"name": "Client",
"base": "Loggable",
"log": {
"model":"ClientLog"
},
"options": {
"mysql": {
"table": "client"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string",
"required": true
},
"fi": {
"type": "string",
"description": "Fiscal indentifier"
},
"socialName": {
"type": "string",
"required": true
},
"contact": {
"type": "string"
},
"street": {
"type": "string"
},
"city": {
"type": "string"
},
"postcode": {
"type": "string"
},
"email": {
"type": "string"
},
"phone": {
"type": "string"
},
"mobile": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"credit": {
"type": "Number"
},
"creditInsurance": {
"type": "Number"
},
"iban": {
"type": "string"
},
"dueDay": {
"type": "Number"
},
"isEqualizated": {
"type": "boolean",
"description": "The client has equalization tax"
},
"isFreezed": {
"type": "boolean",
"description": "The client frozen"
},
"hasToInvoiceByAddress": {
"type": "boolean",
"description": "The client has to be invoiced by address"
},
"hasToInvoice": {
"type": "boolean",
"description": "Global invoicing enabled for the client"
},
"isToBeMailed": {
"type": "boolean",
"description": "Send invoices by email"
},
"hasSepaVnl": {
"type": "boolean"
},
"hasLcr": {
"type": "boolean"
},
"hasCoreVnl": {
"type": "boolean"
},
"hasCoreVnh": {
"type": "boolean"
},
"isTaxDataChecked":{
"type": "boolean"
},
"eypbc": {
"type": "boolean"
},
"quality": {
"type": "Number"
},
"isVies": {
"type": "boolean"
},
"isRelevant": {
"type": "boolean"
},
"accountingAccount": {
"type": "string"
},
"created": {
"type": "date"
}
},
"relations": {
"account": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "id"
},
"payMethod": {
"type": "belongsTo",
"model": "PayMethod",
"foreignKey": "payMethodFk"
},
"salesPerson": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "salesPersonFk"
},
"province":{
"type": "belongsTo",
"model": "Province",
"foreignKey": "provinceFk"
},
"country":{
"type": "belongsTo",
"model": "Country",
"foreignKey": "countryFk"
},
"contactChannel":{
"type": "belongsTo",
"model": "ContactChannel",
"foreignKey": "contactChannelFk"
},
"type": {
"type": "belongsTo",
"model": "ClientType",
"foreignKey": "typeFk"
},
"addresses": {
"type": "hasMany",
"model": "Address",
"foreignKey": "clientFk"
},
"greuge": {
"type": "hasMany",
"model": "Greuge",
"foreignKey": "clientFk"
},
"classifications": {
"type": "hasMany",
"model": "CreditClassification",
"foreignKey": "client"
},
"contacts": {
"type": "hasMany",
"model": "ClientContact",
"foreignKey": "clientFk"
}
}
"name": "Client",
"base": "Loggable",
"log": {
"model":"ClientLog"
},
"options": {
"mysql": {
"table": "client"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string",
"required": true
},
"fi": {
"type": "string",
"description": "Fiscal indentifier"
},
"socialName": {
"type": "string",
"required": true
},
"contact": {
"type": "string"
},
"street": {
"type": "string"
},
"city": {
"type": "string"
},
"postcode": {
"type": "string"
},
"email": {
"type": "string"
},
"phone": {
"type": "string"
},
"mobile": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"credit": {
"type": "Number"
},
"creditInsurance": {
"type": "Number"
},
"iban": {
"type": "string"
},
"dueDay": {
"type": "Number"
},
"isEqualizated": {
"type": "boolean",
"description": "The client has equalization tax"
},
"isFreezed": {
"type": "boolean",
"description": "The client frozen"
},
"hasToInvoiceByAddress": {
"type": "boolean",
"description": "The client has to be invoiced by address"
},
"hasToInvoice": {
"type": "boolean",
"description": "Global invoicing enabled for the client"
},
"isToBeMailed": {
"type": "boolean",
"description": "Send invoices by email"
},
"hasSepaVnl": {
"type": "boolean"
},
"hasLcr": {
"type": "boolean"
},
"hasCoreVnl": {
"type": "boolean"
},
"hasCoreVnh": {
"type": "boolean"
},
"isTaxDataChecked":{
"type": "boolean"
},
"eypbc": {
"type": "boolean"
},
"quality": {
"type": "Number"
},
"isVies": {
"type": "boolean"
},
"isRelevant": {
"type": "boolean"
},
"accountingAccount": {
"type": "string"
},
"created": {
"type": "date"
}
},
"relations": {
"account": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "id"
},
"payMethod": {
"type": "belongsTo",
"model": "PayMethod",
"foreignKey": "payMethodFk"
},
"salesPerson": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "salesPersonFk"
},
"province": {
"type": "belongsTo",
"model": "Province",
"foreignKey": "provinceFk"
},
"country": {
"type": "belongsTo",
"model": "Country",
"foreignKey": "countryFk"
},
"contactChannel": {
"type": "belongsTo",
"model": "ContactChannel",
"foreignKey": "contactChannelFk"
},
"type": {
"type": "belongsTo",
"model": "ClientType",
"foreignKey": "typeFk"
},
"addresses": {
"type": "hasMany",
"model": "Address",
"foreignKey": "clientFk"
},
"greuge": {
"type": "hasMany",
"model": "Greuge",
"foreignKey": "clientFk"
},
"classifications": {
"type": "hasMany",
"model": "CreditClassification",
"foreignKey": "client"
},
"contacts": {
"type": "hasMany",
"model": "ClientContact",
"foreignKey": "clientFk"
},
"bank": {
"type": "belongsTo",
"model": "BankEntity",
"foreignKey": "bankEntityFk"
}
}
}

View File

@ -134,5 +134,8 @@
},
"UserConfig": {
"dataSource": "vn"
},
"ClaimRatio": {
"dataSource": "vn"
}
}