Merge branch 'dev' into 2708-travel_extracommunity
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2021-01-19 12:10:06 +00:00
commit dfbf114161
56 changed files with 2134 additions and 1266 deletions

2
Jenkinsfile vendored
View File

@ -25,9 +25,11 @@ pipeline {
switch (env.BRANCH_NAME) {
case 'master':
env.NODE_ENV = 'production'
env.BACK_REPLICAS = 4
break
case 'test':
env.NODE_ENV = 'test'
env.BACK_REPLICAS = 2
break
}
}

View File

@ -48,7 +48,7 @@ module.exports = Self => {
throw new UserError(`You don't have enough privileges`);
if (process.env.NODE_ENV == 'test')
throw new UserError(`You can't upload images on the test instance`);
throw new UserError(`You can't upload images on the test environment`);
// Upload file to temporary path
const tempContainer = await TempContainer.container(args.collection);

View File

@ -0,0 +1,19 @@
DROP TRIGGER IF EXISTS `vn`.`itemTag_afterUpdate`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`itemTag_afterUpdate`
AFTER UPDATE ON `itemTag` FOR EACH ROW
trig: BEGIN
IF @isTriggerDisabled THEN
LEAVE trig;
END IF;
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
SELECT NEW.itemFk id;
CALL item_refreshTags();
DROP TEMPORARY TABLE tmp.item;
END$$
DELIMITER ;

View File

@ -13144,9 +13144,9 @@ DELIMITER ;
/*!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 character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@ -13162,7 +13162,7 @@ BEGIN
DECLARE vOk BOOL;
DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vWarehouse INT;
DECLARE vShipment DATETIME;
DECLARE vShipment DATE;
DECLARE vTicket INT;
DECLARE vNotes VARCHAR(255);
DECLARE vItem INT;
@ -16842,7 +16842,7 @@ CREATE TABLE `clientesProveedores` (
`IBAN` varchar(34) COLLATE utf8_unicode_ci NOT NULL,
`CodigoCondiciones` smallint(6) NOT NULL,
`StatusTraspasadoIME` tinyint(4) NOT NULL,
`TipoImportacionIME` tinyint(4) NOT NULL,
`TipoImportacionIME` tinyint(4) NOT NULL DEFAULT '2',
`TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT '2',
`Contrapartida` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`CodigoCuentaImpagado` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
@ -17481,8 +17481,7 @@ BEGIN
*/
TRUNCATE XDiario_movConta_IVA;
DELETE FROM movConta WHERE enlazadoSage = FALSE ;
DELETE FROM movConta WHERE enlazadoSage = FALSE AND Asiento <> 1 ;
CALL clientesProveedoresAdd;
CALL planCuentasPgcAdd;
CALL XDiario_movConta_IVA_InvoiceOutAdd_Manager;
@ -17588,7 +17587,7 @@ BEGIN
IF(x.EURODEBE,x.EURODEBE,x.EUROHABER) AS ImporteAsiento, -- DOBLE(19)
MONTH(x.FECHA) AS NumeroPeriodo, -- ENT(2) "-1" Al informar este valor se calcula automát. A partir de la fecha de asiento
IF( sub2.FECREGCON IS NULL, sub2.FECHA_EX, sub2.FECREGCON) FechaGrabacion, -- FECHA(8)
IFNULL(xmi.CodigoDivisa, sub3.code) CodigoDivisa, -- VARCHAR(3)
IF(x.CAMBIO,IFNULL(xmi.CodigoDivisa, sub3.code),'') CodigoDivisa, -- VARCHAR(3)
x.CAMBIO AS ImporteCambio, -- DOBLE(19)
IFNULL(x.DEBEME,x.HABERME) AS ImporteDivisa, -- DOBLE(19)
IF(x.CAMBIO,1,0) AS FactorCambio, -- DOBLE(19)
@ -17675,6 +17674,7 @@ BEGIN
LEFT JOIN ( SELECT DISTINCT(account),cu.code
FROM vn.bank b
JOIN vn.currency cu ON cu.id = b.currencyFk
WHERE cu.code <> "EUR" -- no se informa cuando la divisa en EUR
)sub3 ON sub3.account = x.SUBCTA
WHERE x.enlazadoSage = 0
AND c.companyCode;
@ -30637,6 +30637,100 @@ CREATE TABLE `payMethod` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `payment`
--
DROP TABLE IF EXISTS `payment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payment` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`received` date NOT NULL,
`supplierFk` int(11) NOT NULL,
`amount` decimal(10,2) NOT NULL DEFAULT '0.00',
`currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '1',
`divisa` decimal(10,2) DEFAULT NULL,
`bankFk` int(11) NOT NULL DEFAULT '0',
`payMethodFk` tinyint(3) unsigned NOT NULL,
`bankingFees` double(6,2) unsigned NOT NULL DEFAULT '0.00',
`concept` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`companyFk` smallint(5) unsigned NOT NULL DEFAULT '442',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0',
`exchangeInsuranceFk` int(11) DEFAULT NULL,
`dueDated` date DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `empresa_id` (`companyFk`),
KEY `id_banco` (`bankFk`),
KEY `id_moneda` (`currencyFk`),
KEY `pay_met` (`payMethodFk`),
KEY `fk_pago_pago_sdc1_idx` (`exchangeInsuranceFk`),
KEY `pagoDueDatedIdx` (`dueDated`),
KEY `pago_ibfk_3` (`supplierFk`),
CONSTRAINT `pago_ibfk_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE,
CONSTRAINT `pago_moneda_1` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE,
CONSTRAINT `pago_pay_met` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!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 = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `payment_beforeInsert` BEFORE INSERT ON `payment` FOR EACH ROW
-- Edit trigger body code below this line. Do not edit lines above this one
BEGIN
DECLARE cuenta_banco,cuenta_proveedor DOUBLE;
DECLARE vNewBookEntry INT;
DECLARE bolCASH BOOLEAN;
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
SELECT (cash = 1) INTO bolCASH FROM bank WHERE bank.id = NEW.bankFk ;
IF bolCASH THEN
SELECT account INTO cuenta_banco
FROM bank
WHERE id = NEW.bankFk;
SELECT account INTO cuenta_proveedor
FROM supplier
WHERE id = NEW.supplierFk;
CALL vn.ledger_next(vNewBookEntry);
INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
SELECT vNewBookEntry,NEW.received,SUBCTA,CONTRA,NEW.concept,EURODEBE,EUROHABER,NEW.companyFk
FROM
( SELECT cuenta_banco SUBCTA,cuenta_proveedor CONTRA,0 EURODEBE, NEW.amount + NEW.bankingFees EUROHABER
UNION ALL
SELECT cuenta_proveedor SUBCTA, cuenta_banco CONTRA,NEW.amount EURODEBE, 0 EUROHABER
) gf;
IF NEW.bankingFees <> 0 THEN
INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
SELECT vNewBookEntry,NEW.received,IF(c.id = 1,6260000002,IF(CEE = 1,6260000003,6260000004)),cuenta_banco,NEW.concept,NEW.bankingFees,0,NEW.companyFk
FROM supplier s
JOIN country c ON s.countryFk = c.id
WHERE s.id = NEW.supplierFk;
END IF;
END IF;
SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received);
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 */ ;
--
-- Temporary table structure for view `payment__`
--
@ -33333,7 +33427,26 @@ CREATE TABLE `tag` (
CONSTRAINT `fgnTag` FOREIGN KEY (`ediTypeFk`) REFERENCES `edi`.`type` (`type_id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos';
/*!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 `vn`.`tag_BEFORE_INSERT` BEFORE INSERT ON `tag` FOR EACH ROW
BEGIN
IF NEW.ediTypeFk IS NULL AND (SELECT COUNT(*) FROM tag WHERE `name` = NEW.`name`) THEN
CALL util.throw('name duplicated');
END IF;
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 `tagAbbreviation`
@ -33622,7 +33735,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `ticket_beforeUpdate`
BEFORE UPDATE ON `ticket`
@ -33668,6 +33781,9 @@ BEGIN
' a ',
TIME(NEW.shipped));
END IF;
INSERT IGNORE INTO zoneAgencyMode (agencyModeFk,zoneFk)
SELECT r.agencyModeFk, NEW.zoneFk FROM route r
WHERE r.id = NEW.routeFk;
END IF;
END */;;
DELIMITER ;
@ -36110,6 +36226,25 @@ CREATE TABLE `zone` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `zoneAgencyMode`
--
DROP TABLE IF EXISTS `zoneAgencyMode`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zoneAgencyMode` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`agencyModeFk` int(11) NOT NULL,
`zoneFk` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `zoneAgencyMode_UN` (`agencyModeFk`,`zoneFk`),
KEY `zoneAgencyMode_FK_1` (`zoneFk`),
CONSTRAINT `zoneAgencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `zoneAgencyMode_FK_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='junta agencias con zonas para que al enrutar se puedan proponer tickets.';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `zoneClosure`
--
@ -40362,7 +40497,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8 COLLATE utf8_unicode_ci
CREATE DEFINER=`root`@`%` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8
READS SQL DATA
BEGIN
DECLARE vSplitCounter VARCHAR(15);
@ -40375,7 +40510,9 @@ BEGIN
LEFT JOIN vn2008.movement_label l ON l.Id_Movimiento = s.id
WHERE ticketFk = vTicketFk
) sub;
RETURN vSplitCounter;
RETURN IFNULL(vSplitCounter,'--');
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -42906,7 +43043,7 @@ proc: BEGIN
FROM edi.warehouseFloramondo
WHERE warehouseFk = vWarehouseFk;
CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk);
CALL cache.visible_refresh(vVisibleCache, TRUE, vWarehouseFk);
IF (NOT vIsLogifloraAllowed AND vVNHWarehouseFk != vWarehouseFk)
OR (vShipped > TIMESTAMPADD(DAY, vMaxLogifloraDays + vRangeLogifloraDays, CURDATE()) )
@ -65147,6 +65284,150 @@ BEGIN
CLOSE rsTicket;
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 DROP PROCEDURE IF EXISTS `ticket_cloneWeekly__3` */;
/*!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 = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly__3`(IN vWeek INT)
BEGIN
DECLARE vIsDone BOOL;
DECLARE vLanding DATE;
DECLARE vShipment DATE;
DECLARE vWarehouse INT;
DECLARE vTicket INT;
DECLARE vWeekDay INT;
DECLARE vClient INT;
DECLARE vEmpresa INT;
DECLARE vConsignatario INT;
DECLARE vAgencia INT;
DECLARE vNewTicket INT;
DECLARE vYear INT;
DECLARE rsTicket CURSOR FOR
SELECT tt.Id_Ticket, weekDay, Id_Cliente, warehouse_id, empresa_id, Id_Consigna, Id_Agencia
FROM Tickets_turno tt
JOIN Tickets t ON tt.Id_Ticket = t.Id_Ticket;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
OPEN rsTicket;
myLoop: LOOP
BEGIN
DECLARE vSalesPersonEmail VARCHAR(150);
DECLARE vMailSent BOOL;
DECLARE vSubject VARCHAR(150);
DECLARE vMessage TEXT;
/*DECLARE vError TEXT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
vError = MESSAGE_TEXT;
END;*/
SET vIsDone = FALSE;
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vConsignatario, vAgencia;
IF vIsDone THEN
LEAVE myLoop;
END IF;
SELECT date INTO vShipment
FROM `time`
WHERE `year` = vYear AND `week` = vWeek
AND WEEKDAY(date) = vWeekDay;
-- busca si el ticket ya ha sido clonado
IF (SELECT COUNT(*) FROM vn.ticket tOrig
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
WHERE tOrig.id = vTicket AND tClon.isDeleted = FALSE AND DATE(tClon.shipped) = vShipment) > 0
THEN
ITERATE myLoop;
END IF;
CALL vn.zone_getLanded(vShipment, vConsignatario, vAgencia, vWarehouse,FALSE);
SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
IF (SELECT COUNT(*) FROM Agencias WHERE Id_Agencia = vAgencia AND Agencia LIKE '%turno%') THEN
SET vAgencia = NULL;
END IF;
CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vConsignatario, vAgencia, NULL, vLanding,account.userGetId(), vNewTicket);
IF (vLanding IS NULL) THEN
SELECT e.email INTO vSalesPersonEmail
FROM vn.client c
JOIN vn.worker sp ON sp.id = c.salesPersonFk
JOIN account.emailUser e ON e.userFk = sp.userFk
WHERE c.id = vClient;
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
' para el dia: ', vShipment);
SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
' para el dia: ', vShipment,
' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
' pero ha que revisar las fechas y la agencia');
SELECT COUNT(*) INTO vMailSent
FROM vn.mail
WHERE sender = vSalesPersonEmail
AND subject = vSubject;
IF NOT vMailSent THEN
INSERT INTO vn2008.mail (`to`,`subject`,`text`)
VALUES (vSalesPersonEmail, vSubject, vMessage);
END IF;
CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
END IF;
INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
FROM vn.sale saleOrig
WHERE saleOrig.ticketFk = vTicket;
INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
SELECT saleOriginal.id, saleClon.id
FROM vn.sale saleOriginal
JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
INSERT INTO Ordenes (orden,datorden,datticket,codvendedor,codcomprador,cantidad,preciomax,preu,id_article,id_cliente,comentario,
ok, total,datcompra,ko,id_movimiento)
SELECT o.orden,o.datorden,vShipment,o.codvendedor,o.codcomprador,o.cantidad,o.preciomax,o.preu,o.id_article,o.id_cliente,o.comentario,
o.ok, o.total,o.datcompra,o.ko,m2.Id_Movimiento
FROM Movimientos m JOIN Ordenes o ON o.Id_Movimiento = m.Id_Movimiento
JOIN Movimientos m2 ON m.Concepte = m2.Concepte AND m.Cantidad = m2.Cantidad AND m.Id_Article = m2.Id_Article
WHERE m.Id_Ticket = vTicket AND m2.Id_Ticket = vNewTicket;
INSERT INTO ticket_observation(Id_Ticket,observation_type_id,text) VALUES(vNewTicket,4,CONCAT('turno desde ticket: ',vTicket))
ON DUPLICATE KEY UPDATE text = CONCAT(ticket_observation.text,VALUES(text),' ');
INSERT INTO ticket_observation(Id_Ticket,observation_type_id,text) VALUES(vNewTicket,1,'ATENCION: Contiene lineas de TURNO')
ON DUPLICATE KEY UPDATE text = CONCAT(ticket_observation.text,VALUES(text),' ');
CALL vn.ticketCalculateClon(vNewTicket, vTicket);
END;
END LOOP;
CLOSE rsTicket;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -76215,4 +76496,4 @@ USE `vncontrol`;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-01-05 9:34:47
-- Dump completed on 2021-01-08 10:00:22

View File

@ -59,7 +59,6 @@ IGNORETABLES=(
--ignore-table=vn.mail__
--ignore-table=vn.manaSpellers
--ignore-table=vn.outgoingInvoiceKk
--ignore-table=vn.payment
--ignore-table=vn.paymentExchangeInsurance
--ignore-table=vn.payrollCenter
--ignore-table=vn.plantpassport__

View File

@ -8,7 +8,7 @@ services:
ports:
- 80
deploy:
replicas: 3
replicas: 2
back:
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
build: .
@ -30,7 +30,7 @@ services:
- /mnt/storage/dms:/var/lib/salix/dms
- /mnt/storage/image:/var/lib/salix/image
deploy:
replicas: 6
replicas: ${BACK_REPLICAS:?}
configs:
datasources:
external: true

View File

@ -721,9 +721,9 @@ export default {
},
workerSummary: {
header: 'vn-worker-summary h5',
id: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(2) > section > span',
email: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(3) > section > span',
department: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(4) > section > span',
id: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(3) > section > span',
email: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(4) > section > span',
department: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(5) > section > span',
userId: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(2) > section > span',
userName: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(3) > section > span',
role: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(4) > section > span',

View File

@ -187,7 +187,10 @@ export default class Field extends FormInput {
}
onChange() {
// Changes doesn't reflect until appling async
this.$.$applyAsync(() => {
this.emit('change', {value: this.field});
});
}
}
Field.$inject = ['$element', '$scope'];

View File

@ -1,4 +1,5 @@
import Component from '../../lib/component';
import './style.scss';
export default class SearchPanel extends Component {
set filter(value) {

View File

@ -1,4 +1,4 @@
@import "variables";
@import "./variables";
vn-searchbar {
display: block;
@ -44,4 +44,27 @@ vn-searchbar {
& > form {
padding: $spacing-lg;
}
& > form#manifold-form {
padding: 0;
.manifold-panel {
border: $border-thin-light;
border-radius: 5px;
position: relative;
text-align: right;
.or {
font-weight: bold;
font-size: 26px;
color: $color-font-secondary
}
vn-icon[icon="info"] {
position: absolute;
top: 2px;
right: 2px
}
}
}
}

View File

@ -1,4 +1,5 @@
import ngModule from '../../module';
import './style.scss';
export default class Th {
constructor($element) {

View File

@ -73,6 +73,21 @@ ui-view > .vn-summary {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
position: relative;
span {
display: block;
}
a {
color: $color-font;
}
}
h4 span:after {
font-family: 'Material Icons';
content: 'open_in_new';
position: absolute;
right: 5px;
text-transform: none;
color: $color-spacer
}
& > * {
margin: $spacing-sm;

View File

@ -52,6 +52,7 @@ Suppliers: Proveedores
Summary: Vista previa
Basic data: Datos básicos
List: Listado
Go to: Ir a
# Misc

View File

@ -86,5 +86,7 @@
"The social name cannot be empty": "The social name cannot be empty",
"The nif cannot be empty": "The nif cannot be empty",
"A travel with this data already exists": "A travel with this data already exists",
"The observation type can't be repeated": "The observation type can't be repeated"
"The observation type can't be repeated": "The observation type can't be repeated",
"New ticket request has been created with price": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong> and a price of <strong>{{price}} €</strong>",
"New ticket request has been created": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong>"
}

View File

@ -164,5 +164,7 @@
"You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
"You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas",
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
"Sorts whole route": "Reordena ruta entera"
"Sorts whole route": "Reordena ruta entera",
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>",
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>"
}

View File

@ -24,9 +24,9 @@ exports.translateValues = async(instance, changes) => {
function formatDate(date) {
return new Intl.DateTimeFormat('es', {
year: '2-digit',
month: '2-digit',
day: '2-digit',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'

View File

@ -35,14 +35,13 @@ module.exports = Self => {
accountConfig
} = this;
let newEntry;
let dn = `uid=${userName},${this.userDn}`;
if (info.hasAccount) {
let {user} = info;
let oldUser = await client.searchOne(this.userDn, {
scope: 'sub',
attributes: ['userPassword', 'sambaNTPassword'],
filter: `&(uid=${userName})`
});
@ -52,7 +51,7 @@ module.exports = Self => {
? nameArgs.splice(1).join(' ')
: '-';
newEntry = {
let newEntry = {
uid: userName,
objectClass: [
'inetOrgPerson',
@ -101,62 +100,115 @@ module.exports = Self => {
if (newEntry[prop] == null)
delete newEntry[prop];
}
if (oldUser) {
let changes = [];
let skipProps = new Set([
'dn',
'controls'
]);
for (let prop in oldUser) {
let deleteProp = !skipProps.has(prop)
&& !newEntry.hasOwnProperty(prop);
if (!deleteProp) continue;
changes.push(new ldap.Change({
operation: 'delete',
modification: {
[prop]: oldUser[prop]
}
}));
}
for (let prop in newEntry) {
if (this.isEqual(oldUser[prop], newEntry[prop]))
continue;
changes.push(new ldap.Change({
operation: 'replace',
modification: {
[prop]: newEntry[prop]
}
}));
}
// Remove and recreate (if applicable) user
let dn = `uid=${userName},${this.userDn}`;
let operation;
if (changes.length)
await client.modify(dn, changes);
} else
await client.add(dn, newEntry);
} else {
try {
await client.del(dn);
operation = 'delete';
console.log(` -> User '${userName}' removed from LDAP`);
} catch (e) {
if (e.name !== 'NoSuchObjectError') throw e;
}
if (info.hasAccount) {
await client.add(dn, newEntry);
operation = 'add';
}
},
if (operation === 'delete')
console.log(` -> User '${userName}' removed from LDAP`);
isEqual(a, b) {
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length)
return false;
for (let element of a) {
if (b.indexOf(element) === -1)
return false;
}
return true;
} else
return a == b;
},
async syncUserGroups(userName, info) {
let {client} = this;
let {user} = info;
let groupDn = this.groupDn;
let opts = {
scope: 'sub',
attributes: ['dn'],
attributes: ['dn', 'cn'],
filter: `&(memberUid=${userName})(objectClass=posixGroup)`
};
let oldGroups = await client.searchAll(this.groupDn, opts);
let oldGroups = await client.searchAll(groupDn, opts);
let reqs = [];
for (let oldGroup of oldGroups) {
let change = new ldap.Change({
operation: 'delete',
modification: {memberUid: userName}
});
reqs.push(client.modify(oldGroup.dn, change));
let deleteGroups = [];
let addGroups = [];
if (info.hasAccount) {
let oldSet = new Set();
oldGroups.forEach(e => oldSet.add(e.cn));
let newSet = new Set();
user.roles().forEach(e => newSet.add(e.inherits().name));
for (let group of oldGroups) {
if (!newSet.has(group.cn))
deleteGroups.push(group.cn);
}
await Promise.all(reqs);
if (!info.hasAccount) return;
reqs = [];
for (let role of info.user.roles()) {
let change = new ldap.Change({
operation: 'add',
modification: {memberUid: userName}
});
let roleName = role.inherits().name;
let dn = `cn=${roleName},${this.groupDn}`;
reqs.push(client.modify(dn, change));
for (let role of user.roles()) {
if (!oldSet.has(role.inherits().name))
addGroups.push(role.inherits().name);
}
await Promise.all(reqs);
} else {
for (let group of oldGroups)
deleteGroups.push(group.cn);
}
async function applyOperations(groups, operation) {
for (let group of groups) {
try {
let dn = `cn=${group},${groupDn}`;
await client.modify(dn, new ldap.Change({
operation,
modification: {memberUid: userName}
}));
} catch (err) {
if (err.name !== 'NoSuchObjectError')
throw err;
}
}
}
await applyOperations(deleteGroups, 'delete');
await applyOperations(addGroups, 'add');
},
async getUsers(usersToSync) {

View File

@ -1,6 +1,7 @@
<vn-card class="summary">
<h5>
<a ng-if="::summary.id"
<a
ng-if="::summary.id"
vn-tooltip="Go to the user"
ui-sref="account.card.summary({id: {{::summary.id}}})"
name="goToSummary">
@ -10,7 +11,18 @@
</h5>
<vn-horizontal class="vn-pa-md">
<vn-one>
<h4 translate>Basic data</h4>
<h4 ng-show="$ctrl.isHr">
<a
ui-sref="account.card.basicData({id:summary.id})"
target="_self">
<span translate vn-tooltip="Go to">Basic Data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isHr">
Basic Data
</h4>
<vn-label-value
label="Id"
value="{{summary.id}}">

View File

@ -18,6 +18,9 @@ class Controller extends Summary {
this.$http.get(`Accounts/${value.id}`, {filter})
.then(res => this.$.summary = res.data);
}
get isHr() {
return this.aclService.hasAny(['hr']);
}
get user() {
return this._user;

View File

@ -4,7 +4,8 @@
</vn-crud-model>
<vn-card class="summary">
<h5>
<a ng-if="::$ctrl.summary.claim.id"
<a
ng-if="::$ctrl.summary.claim.id"
vn-tooltip="Go to the claim"
ui-sref="claim.card.summary({id: {{::$ctrl.summary.claim.id}}})"
name="goToSummary">
@ -54,7 +55,18 @@
</vn-range>
</vn-one>
<vn-auto>
<h4 translate>Detail</h4>
<h4 ng-show="$ctrl.isSalesPerson">
<a
ui-sref="claim.card.detail({id:$ctrl.claim.id})"
target="_self">
<span translate vn-tooltip="Go to">Detail</span>
</a>
</h4>
<h4
ng-show="!$ctrl.isSalesPerson"
translate>
Detail
</h4>
<vn-data-viewer data="::$ctrl.summary.salesClaimed">
<vn-table>
<vn-thead>
@ -105,7 +117,18 @@
</vn-horizontal>
</vn-auto>
<vn-auto>
<h4 translate>Development</h4>
<h4 ng-show="$ctrl.isClaimManager">
<a
ui-sref="claim.card.development({id:$ctrl.claim.id})"
target="_self">
<span translate vn-tooltip="Go to">Development</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isClaimManager">
Development
</h4>
<vn-data-viewer data="::$ctrl.summary.developments">
<vn-table>
<vn-thead>
@ -136,7 +159,18 @@
</vn-data-viewer>
</vn-auto>
<vn-auto>
<h4 translate>Action</h4>
<h4 ng-show="$ctrl.isClaimManager">
<a
ui-sref="claim.card.action({id:$ctrl.claim.id})"
target="_self">
<span translate vn-tooltip="Go to">Action</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isClaimManager">
Action
</h4>
<vn-data-viewer data="::$ctrl.summary.actions">
<vn-table>
<vn-thead>

View File

@ -13,6 +13,14 @@ class Controller extends Summary {
this.getSummary();
}
get isSalesPerson() {
return this.aclService.hasAny(['salesPerson']);
}
get isClaimManager() {
return this.aclService.hasAny(['claimManager']);
}
get claim() {
return this._claim;
}

View File

@ -33,7 +33,7 @@ class Controller extends Section {
get reportParams() {
const userParams = this.$.model.userParams;
return Object.assign({
authorization: this.vnToken.token,
recipient: this.client.email,
recipientId: this.client.id
}, userParams);
}

View File

@ -12,7 +12,18 @@
</h5>
<vn-horizontal>
<vn-one>
<h4 translate>Basic data</h4>
<h4 ng-show="$ctrl.isEmployee">
<a
ui-sref="client.card.basicData({id:$ctrl.client.id})"
target="_self">
<span translate vn-tooltip="Go to">Basic data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isEmployee">
Basic data
</h4>
<vn-label-value label="Id"
value="{{$ctrl.summary.id}}">
</vn-label-value>
@ -43,7 +54,18 @@
</vn-label-value>
</vn-one>
<vn-one>
<h4 translate>Fiscal address</h4>
<h4 ng-show="$ctrl.isEmployee">
<a
ui-sref="client.card.fiscalData({id:$ctrl.client.id})"
target="_self">
<span translate vn-tooltip="Go to">Fiscal address</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isEmployee">
Fiscal address
</h4>
<vn-label-value label="Social name"
value="{{$ctrl.summary.socialName}}">
</vn-label-value>
@ -67,7 +89,18 @@
</vn-label-value>
</vn-one>
<vn-one>
<h4 translate>Fiscal data</h4>
<h4 ng-show="$ctrl.isEmployee">
<a
ui-sref="client.card.fiscalData({id:$ctrl.client.id})"
target="_self">
<span translate vn-tooltip="Go to">Fiscal data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isEmployee">
Fiscal data
</h4>
<vn-vertical>
<vn-check
label="Is equalizated"
@ -107,7 +140,18 @@
</vn-vertical>
</vn-one>
<vn-one>
<h4 translate>Billing data</h4>
<h4 ng-show="$ctrl.isEmployee">
<a
ui-sref="client.card.billingData({id:$ctrl.client.id})"
target="_self">
<span translate vn-tooltip="Go to">Billing data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isEmployee">
Billing data
</h4>
<vn-label-value label="Pay method"
value="{{$ctrl.summary.payMethod.name}}">
</vn-label-value>
@ -136,7 +180,18 @@
</vn-vertical>
</vn-one>
<vn-one>
<h4 translate>Default address</h4>
<h4 ng-show="$ctrl.isEmployee">
<a
ui-sref="client.card.address.index({id:$ctrl.client.id})"
target="_self">
<span translate vn-tooltip="Go to">Address</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isEmployee">
Address
</h4>
<vn-label-value label="Name"
value="{{$ctrl.summary.defaultAddress.nickname}}">
</vn-label-value>
@ -148,7 +203,17 @@
</vn-label-value>
</vn-one>
<vn-one>
<h4 translate>Web access</h4>
<h4 ng-show="$ctrl.isEmployee">
<a
ui-sref="client.card.webAccess({id:$ctrl.client.id})"
target="_self">
<span translate vn-tooltip="Go to">Web access</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isEmployee">Web access
</h4>
<vn-label-value label="User"
value="{{$ctrl.summary.account.name}}">
</vn-label-value>

View File

@ -18,6 +18,9 @@ class Controller extends Summary {
}
});
}
get isEmployee() {
return this.aclService.hasAny(['employee']);
}
sumRisk() {
let total = 0;

View File

@ -7,6 +7,7 @@ Secured credit: Crédito asegurado
Average invoiced: Consumo medio
Sales person: Comercial
Recovery: Recobro
Basic data: Datos básicos
Balance due: Saldo vencido
Rate: Tarifa
Business data: Datos comerciales

View File

@ -93,7 +93,12 @@ module.exports = Self => {
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return {'e.id': value};
return /^\d+$/.test(value)
? {'e.id': value}
: {or: [
{'s.name': {like: `%${value}%`}},
{'s.nickname': {like: `%${value}%`}}
]};
case 'ref':
param = `e.${param}`;
return {[param]: {like: `%${value}%`}};
@ -141,6 +146,7 @@ module.exports = Self => {
e.invoiceInFk,
t.landed,
s.name AS supplierName,
s.nickname AS supplierAlias,
co.code AS companyCode,
cu.code AS currencyCode
FROM vn.entry e

View File

@ -8,7 +8,7 @@
<vn-searchbar
vn-focus
panel="vn-entry-search-panel"
info="Search entrys by id"
info="Search entry by id or a suppliers by name or alias"
model="model">
</vn-searchbar>
</vn-portal>
@ -16,3 +16,6 @@
<vn-left-menu></vn-left-menu>
</vn-portal>
<ui-view></ui-view>

View File

@ -5,7 +5,7 @@
vn-one
label="General search"
ng-model="filter.search"
info="Search entries by id"
info="Search entry by id or a suppliers by name or alias"
vn-focus>
</vn-textfield>
</vn-horizontal>
@ -45,8 +45,11 @@
label="Supplier"
ng-model="filter.supplierFk"
url="Suppliers"
fields="['name','nickname']"
search-function="{or: [{nickname: {like: '%'+ $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"
show-field="name"
value-field="id">
<tpl-item>{{name}}: {{nickname}}</tpl-item>
</vn-autocomplete>
<vn-date-picker
vn-one

View File

@ -5,3 +5,4 @@ From: Desde
To: Hasta
Agency: Agencia
Warehouse: Almacén
Search entry by id or a suppliers by name or alias: Buscar entrada por id o proveedores por nombre y alias

View File

@ -119,6 +119,7 @@ module.exports = Self => {
ori.code AS origin,
ic.name AS category,
i.density,
i.stemMultiplier,
b.grouping,
b.packing,
itn.code AS niche, @visibleCalc

View File

@ -65,7 +65,10 @@
"type": "Number",
"description": "Density"
},
"image": {
"stemMultiplier": {
"type": "Number",
"description": "Multiplier"
},"image": {
"type": "String",
"description": "Image"
},

View File

@ -25,6 +25,7 @@
<vn-th field="origin" shrink>Origin</vn-th>
<vn-th field="salesperson" shrink>Buyer</vn-th>
<vn-th field="density" shrink>Density</vn-th>
<vn-th field="stemMultiplier" shrink>Multiplier</vn-th>
<vn-th field="active" shrink>Active</vn-th>
<vn-th></vn-th>
</vn-tr>
@ -78,6 +79,7 @@
</span>
</vn-td>
<vn-td shrink>{{::item.density}}</vn-td>
<vn-td shrink >{{::item.stemMultiplier}}</vn-td>
<vn-td shrink>
<vn-check
disabled="true"

View File

@ -25,7 +25,18 @@
</vn-horizontal>
</vn-one>
<vn-one name="basicData">
<h4 translate>Basic data</h4>
<h4 ng-show="$ctrl.isBuyer">
<a
ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Basic data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer">
Basic data
</h4>
<vn-label-value label="Name"
value="{{$ctrl.summary.item.name}}">
</vn-label-value>
@ -53,7 +64,18 @@
</vn-label-value>
</vn-one>
<vn-one name="otherData">
<h4 translate>Other data</h4>
<h4 ng-show="$ctrl.isBuyer">
<a
ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Other data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer">
Other data
</h4>
<vn-label-value label="Intrastat code"
value="{{$ctrl.summary.item.intrastat.id}}">
</vn-label-value>
@ -77,7 +99,18 @@
</vn-label-value>
</vn-one>
<vn-one name="tags">
<h4 translate>Tags</h4>
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a
ui-sref="item.card.tags({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Tags</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer || !$ctrl.isReplenisher">
Tags
</h4>
<vn-label-value
label="{{tag.priority}} {{tag.tag.name}}"
ng-repeat="tag in $ctrl.summary.tags track by tag.id"
@ -85,21 +118,54 @@
</vn-label-value>
</vn-one>
<vn-one name="tax">
<h4 translate>Tax</h4>
<h4 ng-show="$ctrl.isBuyer || $ctrl.isAdministrative">
<a
ui-sref="item.card.tax({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Tax</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer || !$ctrl.isAdministrative">
Tax
</h4>
<vn-label-value label="{{tax.country.country}}"
ng-repeat="tax in $ctrl.summary.item.taxes"
value="{{tax.taxClass.description}}">
</vn-label-value>
</vn-one>
<vn-one name="niche">
<h4 translate>Niche</h4>
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a
ui-sref="item.card.niche({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Niche</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer || !$ctrl.isReplenisher">
Niche
</h4>
<vn-label-value label="{{niche.warehouse.name}}"
ng-repeat="niche in $ctrl.summary.niches"
value="{{niche.code}}">
</vn-label-value>
</vn-one>
<vn-one name="botanical">
<h4 translate>Botanical</h4>
<h4 ng-show="$ctrl.isBuyer">
<a
ui-sref="item.card.botanical({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Botanical</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer">
Botanical
</h4>
<vn-label-value label="Botanical"
value="{{$ctrl.summary.botanical.botanical}}">
</vn-label-value>
@ -111,7 +177,18 @@
</vn-label-value>
</vn-one>
<vn-one name="barcode">
<h4 translate>Barcode</h4>
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a
ui-sref="item.card.itemBarcode({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Barcode</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer || !$ctrl.isReplenisher">
Barcode
</h4>
<p ng-repeat="barcode in $ctrl.summary.item.itemBarcode track by $index">
<b>{{barcode.code}}</b>
</p>

View File

@ -13,6 +13,22 @@ class Controller extends Summary {
if (this.item && this.item.id)
this.getSummary();
}
get isBuyer() {
return this.aclService.hasAny(['buyer']);
}
get isReplenisher() {
return this.aclService.hasAny(['replenisher']);
}
get isAdministrative() {
return this.aclService.hasAny(['administrative']);
}
get isEmployee() {
return this.aclService.hasAny(['employee']);
}
}
ngModule.vnComponent('vnItemSummary', {

View File

@ -61,7 +61,18 @@
</vn-textarea>
</vn-one>
<vn-auto>
<h4 translate>Ticket</h4>
<h4 ng-show="$ctrl.isDelivery">
<a
ui-sref="route.card.tickets({id:$ctrl.route.id})"
target="_self">
<span translate vn-tooltip="Go to">Ticket</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isDelivery">
Ticket
</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>

View File

@ -16,6 +16,10 @@ class Controller extends Summary {
});
}
get isDelivery() {
return this.aclService.hasAny(['delivery']);
}
get route() {
return this._route;
}

View File

@ -10,7 +10,18 @@
</h5>
<vn-horizontal>
<vn-one>
<h4 translate>Basic data</h4>
<h4 ng-show="$ctrl.isAdministrative">
<a
ui-sref="supplier.card.basicData({id:$ctrl.supplier.id})"
target="_self">
<span translate vn-tooltip="Go to">Basic data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isAdministrative">
Basic data
</h4>
<vn-vertical>
<vn-label-value
label="Id"
@ -37,7 +48,18 @@
</vn-vertical>
</vn-one>
<vn-one>
<h4 translate>Billing data</h4>
<h4 ng-show="$ctrl.isAdministrative">
<a
ui-sref="supplier.card.billingData({id:$ctrl.supplier.id})"
target="_self">
<span translate vn-tooltip="Go to">Billing data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isAdministrative">
Billing data
</h4>
<vn-label-value
label="Pay method"
value="{{::$ctrl.summary.payMethod.name}}">
@ -63,7 +85,18 @@
</vn-horizontal>
<vn-horizontal>
<vn-one>
<h4 translate>Fiscal data</h4>
<h4 ng-show="$ctrl.isAdministrative">
<a
ui-sref="supplier.card.fiscalData({id:$ctrl.supplier.id})"
target="_self">
<span translate vn-tooltip="Go to">Fiscal data</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isAdministrative">
Fiscal data
</h4>
<vn-label-value
label="Sage tax type"
value="{{::$ctrl.summary.sageTaxType.vat}}">
@ -82,7 +115,18 @@
</vn-horizontal>
<vn-horizontal>
<vn-one>
<h4 translate>Fiscal address</h4>
<h4 ng-show="$ctrl.isAdministrative">
<a
ui-sref="supplier.card.fiscalData({id:$ctrl.supplier.id})"
target="_self">
<span translate vn-tooltip="Go to">Fiscal address</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isAdministrative">
Fiscal address
</h4>
<vn-label-value
label="Social name"
value="{{::$ctrl.summary.name}}">

View File

@ -10,6 +10,10 @@ class Controller extends Summary {
this.getSummary();
}
get isAdministrative() {
return this.aclService.hasAny(['administrative']);
}
getSummary() {
return this.$http.get(`Suppliers/${this.supplier.id}/getSummary`).then(response => {
this.summary = response.data;

View File

@ -8,10 +8,38 @@ module.exports = function(Self) {
Self.observe('before save', async function(ctx) {
if (ctx.isNewInstance) {
const loopBackContext = LoopBackContext.getCurrentContext();
let filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
let worker = await Self.app.models.Worker.findOne(filter);
const filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
const models = Self.app.models;
const worker = await models.Worker.findOne(filter);
ctx.instance.requesterFk = worker.id;
const instance = ctx.instance;
instance.requesterFk = worker.id;
const httpCtx = {req: loopBackContext.active};
const httpRequest = httpCtx.req.http .req;
const $t = httpRequest.__;
const attenderId = instance.attenderFk;
if (attenderId) {
const ticket = await models.Ticket.findById(instance.ticketFk);
let messageText = 'New ticket request has been created';
if (instance.price)
messageText = 'New ticket request has been created with price';
const shipped = new Intl.DateTimeFormat('es', {
year: 'numeric',
month: 'numeric',
day: 'numeric'
}).format(ticket.shipped);
const message = $t(messageText, {
description: instance.description,
shipped: shipped,
quantity: instance.quantity,
price: instance.price
});
await models.Chat.sendCheckingPresence(httpCtx, attenderId, message);
}
}
});
};

View File

@ -1,6 +1,6 @@
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<form id="manifold-form" ng-submit="$ctrl.onSearch()">
<vn-horizontal class="vn-px-lg vn-pt-lg">
<vn-textfield
vn-one
label="General search"
@ -9,7 +9,7 @@
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-textfield
vn-one
label="Client id"
@ -21,27 +21,37 @@
ng-model="filter.orderFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<section class="vn-px-md">
<vn-horizontal class="manifold-panel vn-pa-md">
<vn-date-picker
vn-one
label="From"
ng-model="filter.from">
ng-model="filter.from"
on-change="$ctrl.from = value">
</vn-date-picker>
<vn-date-picker
vn-one
label="To"
ng-model="filter.to">
ng-model="filter.to"
on-change="$ctrl.to = value">
</vn-date-picker>
<vn-none class="or vn-px-md">O</vn-none>
<vn-input-number
vn-one
min="0"
step="1"
label="Days onward"
ng-model="filter.scopeDays"
on-change="$ctrl.scopeDays = value"
display-controls="true">
</vn-input-number>
<vn-icon color-marginal
icon="info"
vn-tooltip="Cannot choose a range of dates and days onward at the same time">
</vn-icon>
</vn-horizontal>
<vn-horizontal>
</section>
<vn-horizontal class="vn-px-lg">
<vn-textfield
vn-one
label="Nickname"
@ -63,7 +73,7 @@
ng-model="filter.refFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-autocomplete
vn-one
label="Agency"
@ -87,7 +97,7 @@
</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-autocomplete
vn-one
label="Warehouse"
@ -101,7 +111,7 @@
url="Provinces">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-check
vn-one
label="My team"
@ -121,7 +131,7 @@
triple-state="true">
</vn-check>
</vn-horizontal>
<vn-horizontal class="vn-mt-lg">
<vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>

View File

@ -1,8 +1,11 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
class Controller extends SearchPanel {
constructor($, $element) {
super($, $element);
this.filter = this.$.filter;
this.getGroupedStates();
}
@ -19,6 +22,35 @@ class Controller extends SearchPanel {
this.groupedStates = groupedStates;
});
}
get from() {
return this._from;
}
set from(value) {
this._from = value;
this.filter.scopeDays = null;
}
get to() {
return this._to;
}
set to(value) {
this._to = value;
this.filter.scopeDays = null;
}
get scopeDays() {
return this._scopeDays;
}
set scopeDays(value) {
this._scopeDays = value;
this.filter.from = null;
this.filter.to = null;
}
}
ngModule.vnComponent('vnTicketSearchPanel', {

View File

@ -10,10 +10,11 @@ describe('Ticket Component vnTicketSearchPanel', () => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnTicketSearchPanel', {$element: null});
controller.$t = () => {};
controller.filter = {};
}));
describe('getGroupedStates()', () => {
it('should set an array of groupedStates with the aditionof a name translation', () => {
it('should set an array of groupedStates with the adition of a name translation', () => {
jest.spyOn(controller, '$t').mockReturnValue('miCodigo');
const data = [
{
@ -32,4 +33,39 @@ describe('Ticket Component vnTicketSearchPanel', () => {
}]);
});
});
describe('from() setter', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
controller.from = new Date();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
});
});
describe('to() setter', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
controller.to = new Date();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
});
});
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
controller.filter.from = new Date();
controller.filter.to = new Date();
controller.scopeDays = 1;
expect(controller.filter.from).toBeNull();
expect(controller.filter.to).toBeNull();
expect(controller.scopeDays).toBeDefined();
});
});
});

View File

@ -17,3 +17,4 @@ FREE: Libre
DELIVERED: Servido
ON_PREPARATION: En preparacion
PACKED: Encajado
Cannot choose a range of dates and days onward at the same time: No se puede selecionar un rango de fechas y días en adelante a la vez

View File

@ -6,6 +6,7 @@
auto-load="true">
</vn-crud-model>
<vn-crud-model
vn-id="typesModel"
auto-load="true"
url="TicketServiceTypes"
data="ticketServiceTypes"

View File

@ -35,6 +35,10 @@ class Controller extends Section {
throw new UserError(`Name can't be empty`);
return this.$http.post(`TicketServiceTypes`, this.$.newServiceType)
.then(res => {
this.$.typesModel.refresh();
return res;
})
.then(res => service.ticketServiceTypeFk = res.data.id);
}

View File

@ -1,4 +1,5 @@
import './index.js';
import crudModel from 'core/mocks/crud-model';
describe('Ticket component vnTicketService', () => {
let controller;
@ -11,7 +12,7 @@ describe('Ticket component vnTicketService', () => {
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
$scope.typesModel = crudModel;
$element = angular.element(`<div></div>`);
controller = $componentController('vnTicketService', {$scope, $element});
}));

View File

@ -1,6 +1,7 @@
<vn-card class="summary">
<h5>
<a ng-if="::$ctrl.summary.id"
<a
ng-if="::$ctrl.summary.id"
vn-tooltip="Go to the ticket"
ui-sref="ticket.card.summary({id: {{::$ctrl.summary.id}}})"
name="goToSummary">
@ -103,7 +104,13 @@
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.summary.total | currency: 'EUR':2}}</strong></p>
</vn-one>
<vn-auto name="sales">
<h4 translate>Sale</h4>
<h4>
<a
ui-sref="ticket.card.sale({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Sale</span>
</a>
</h4>
<vn-table>
<vn-thead>
<vn-tr>
@ -158,7 +165,13 @@
</vn-table>
</vn-auto>
<vn-one ng-if="$ctrl.summary.packagings.length != 0">
<h4 translate>Packages</h4>
<h4>
<a
ui-sref="ticket.card.package({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Packages</span>
</a>
</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>
@ -177,7 +190,13 @@
</vn-table>
</vn-one>
<vn-one class="services" ng-if="$ctrl.summary.services.length != 0">
<h4 translate>Service</h4>
<h4>
<a
ui-sref="ticket.card.service({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Service</span>
</a>
</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>
@ -202,7 +221,13 @@
</vn-horizontal>
<vn-horizontal>
<vn-auto ng-if="$ctrl.summary.requests.length != 0">
<h4 translate>Purchase request</h4>
<h4>
<a
ui-sref="ticket.card.request.index({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Purchase request</span>
</a>
</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>

View File

@ -4,4 +4,4 @@ You are going to delete this weekly ticket: Vas a eliminar este ticket programad
This ticket will be removed from weekly tickets! Continue anyway?: Este ticket se eliminará de tickets programados! ¿Continuar de todas formas?
Search weekly ticket by id or client id: Busca tickets programados por el identificador o el identificador del cliente
Search by weekly ticket: Buscar por tickets programados
weekDay: Dia
Weekday: Llegada

View File

@ -1,6 +1,7 @@
<vn-card class="summary">
<h5>
<a ng-if="::$ctrl.travelData.id"
<a
ng-if="::$ctrl.travelData.id"
vn-tooltip="Go to the travel"
ui-sref="travel.card.summary({id: {{::$ctrl.travelData.id}}})"
name="goToSummary">
@ -132,7 +133,18 @@
</vn-table>
</vn-auto>
<vn-auto ng-if="$ctrl.travelThermographs.length != 0">
<h4 translate>Thermographs</h4>
<h4 ng-show="$ctrl.isBuyer">
<a
ui-sref="travel.card.thermograph.index({id:$ctrl.travelData.id})"
target="_self">
<span translate vn-tooltip="Go to">Thermograph</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer">
Thermograph
</h4>
<vn-table>
<vn-thead>
<vn-tr>

View File

@ -56,6 +56,10 @@ class Controller extends Summary {
return total;
}
get isBuyer() {
return this.aclService.hasAny(['buyer']);
}
}
ngModule.vnComponent('vnTravelSummary', {

View File

@ -84,13 +84,6 @@
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textarea vn-one vn-focus
label="Description"
ng-model="$ctrl.dms.description"
rule>
</vn-textarea>
</vn-horizontal>
<vn-horizontal>
<vn-input-file
vn-one

View File

@ -1,6 +1,6 @@
{
"name": "Calendar",
"base": "Loggable",
"base": "VnModel",
"log": {
"model": "WorkerLog",
"relation": "labour"

View File

@ -10,7 +10,17 @@
</h5>
<vn-horizontal class="vn-pa-md">
<vn-one>
<h4 translate>Basic data</h4>
<h4 ng-show="$ctrl.isHr">
<a
ui-sref="worker.card.basicData({id:$ctrl.worker.id})">
<span translate vn-tooltip="Go to">Basic data</span>
</a>
</h4>
<h4
translates
ng-show="!$ctrl.isHr">
Basic data
</h4>
<vn-label-value label="Id"
value="{{worker.id}}">
</vn-label-value>

View File

@ -52,6 +52,10 @@ class Controller extends Summary {
this.$.worker = res.data;
});
}
get isHr() {
return this.aclService.hasAny(['hr']);
}
}
ngModule.vnComponent('vnWorkerSummary', {

View File

@ -1,6 +1,7 @@
<vn-card class="summary">
<h5>
<a ng-if="::$ctrl.summary.id"
<a
ng-if="::$ctrl.summary.id"
vn-tooltip="Go to the zone"
ui-sref="zone.card.summary({id: {{::$ctrl.summary.id}}})"
name="goToSummary">
@ -36,7 +37,11 @@
</vn-horizontal>
<vn-horizontal class="vn-pa-md">
<vn-auto>
<h4 translate>Warehouses</h4>
<h4>
<a ui-sref="zone.card.warehouses({id:$ctrl.zone.id})">
<span translate vn-tooltip="Go to">Warehouse</span>
</a>
</h4>
<vn-table model="model" auto-load="false">
<vn-thead>
<vn-tr>

View File

@ -7,4 +7,4 @@ FROM client c
JOIN company AS cny
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
JOIN bankEntity be ON be.id = sa.bankEntityFk
WHERE c.id = ? AND cny.id = ?`
WHERE c.id = ? AND cny.id = ?