Merge branch 'dev' into 3683-monitor_clients
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
d1d48f8beb
|
@ -1,3 +0,0 @@
|
|||
UPDATE vn.absenceType
|
||||
SET code='halfPaidLeave'
|
||||
WHERE id=15 AND name='Permiso retribuido 1/2 día' AND rgb='#5151c0' AND code IS NULL AND permissionRate=NULL AND holidayEntitlementRate=0.50 AND discountRate=0.00;
|
|
@ -1,27 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL`
|
||||
(model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('EntryObservation', '*', '*', 'ALLOW', 'ROLE', 'buyer'),
|
||||
('LdapConfig', '*', '*', 'ALLOW', 'ROLE', 'sysadmin'),
|
||||
('SambaConfig', '*', '*', 'ALLOW', 'ROLE', 'sysadmin'),
|
||||
('ACL', '*', '*', 'ALLOW', 'ROLE', 'developer'),
|
||||
('AccessToken', '*', '*', 'ALLOW', 'ROLE', 'developer'),
|
||||
('MailAliasAccount', '*', '*', 'ALLOW', 'ROLE', 'marketing'),
|
||||
('MailAliasAccount', '*', '*', 'ALLOW', 'ROLE', 'hr'),
|
||||
('MailAlias', '*', '*', 'ALLOW', 'ROLE', 'hr'),
|
||||
('MailForward', '*', '*', 'ALLOW', 'ROLE', 'marketing'),
|
||||
('MailForward', '*', '*', 'ALLOW', 'ROLE', 'hr'),
|
||||
('RoleInherit', '*', '*', 'ALLOW', 'ROLE', 'it'),
|
||||
('RoleRole', '*', '*', 'ALLOW', 'ROLE', 'it'),
|
||||
('AccountConfig', '*', '*', 'ALLOW', 'ROLE', 'sysadmin');
|
||||
|
||||
UPDATE `salix`.`ACL`
|
||||
SET accessType='*', principalId='it'
|
||||
WHERE model = 'Role';
|
||||
|
||||
DELETE FROM `salix`.`ACL`
|
||||
WHERE id IN (280, 281);
|
||||
|
||||
UPDATE `salix`.`ACL`
|
||||
SET accessType='*', principalId='marketing'
|
||||
WHERE id=279;
|
|
@ -1,5 +0,0 @@
|
|||
UPDATE `salix`.`defaultViewConfig`
|
||||
SET `columns` = '{"intrastat":false,"description":false,"density":false,"isActive":false,
|
||||
"freightValue":false,"packageValue":false,"isIgnored":false,"price2":false,"ektFk":false,"weight":false,
|
||||
"size":false,"comissionValue":false,"landing":false}'
|
||||
WHERE tableCode = 'latestBuys'
|
|
@ -1,33 +0,0 @@
|
|||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=96;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=95;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=115;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=123;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=94;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=101;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=80;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=125;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=98;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail='direccioncomercial@verdnatura.es'
|
||||
WHERE id=92;
|
||||
UPDATE vn.department
|
||||
SET notificationEmail=''
|
||||
WHERE id=43;
|
|
@ -1,142 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`item_getBalance`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`item_getBalance`(IN vItemId int, IN vWarehouse int)
|
||||
BEGIN
|
||||
DECLARE vDateInventory DATETIME;
|
||||
DECLARE vCurdate DATE DEFAULT CURDATE();
|
||||
DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
|
||||
|
||||
SELECT inventoried INTO vDateInventory FROM config;
|
||||
SET @a = 0;
|
||||
SET @currentLineFk = 0;
|
||||
SET @shipped = '';
|
||||
|
||||
SELECT DATE(@shipped:= shipped) shipped,
|
||||
alertLevel,
|
||||
stateName,
|
||||
origin,
|
||||
reference,
|
||||
clientFk,
|
||||
name,
|
||||
`in` AS invalue,
|
||||
`out`,
|
||||
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
|
||||
@currentLineFk := IF (@shipped < CURDATE()
|
||||
OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)),
|
||||
lineFk,@currentLineFk) lastPreparedLineFk,
|
||||
isTicket,
|
||||
lineFk,
|
||||
isPicked,
|
||||
clientType,
|
||||
claimFk
|
||||
FROM
|
||||
( SELECT tr.landed AS shipped,
|
||||
b.quantity AS `in`,
|
||||
NULL AS `out`,
|
||||
al.id AS alertLevel,
|
||||
st.name AS stateName,
|
||||
s.name AS name,
|
||||
e.ref AS reference,
|
||||
e.id AS origin,
|
||||
s.id AS clientFk,
|
||||
IF(al.id = 3, TRUE, FALSE) isPicked,
|
||||
FALSE AS isTicket,
|
||||
b.id lineFk,
|
||||
NULL `order`,
|
||||
NULL AS clientType,
|
||||
NULL AS claimFk
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN supplier s ON s.id = e.supplierFk
|
||||
JOIN alertLevel al ON al.id =
|
||||
CASE
|
||||
WHEN tr.shipped < CURDATE() THEN 3
|
||||
WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
|
||||
ELSE 0
|
||||
END
|
||||
JOIN state st ON st.code = al.code
|
||||
WHERE tr.landed >= vDateInventory
|
||||
AND vWarehouse = tr.warehouseInFk
|
||||
AND b.itemFk = vItemId
|
||||
AND e.isInventory = FALSE
|
||||
AND e.isRaid = FALSE
|
||||
UNION ALL
|
||||
|
||||
SELECT tr.shipped,
|
||||
NULL,
|
||||
b.quantity,
|
||||
al.id,
|
||||
st.name,
|
||||
s.name,
|
||||
e.ref,
|
||||
e.id,
|
||||
s.id,
|
||||
IF(al.id = 3, TRUE, FALSE),
|
||||
FALSE,
|
||||
b.id,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
||||
JOIN supplier s ON s.id = e.supplierFk
|
||||
JOIN alertLevel al ON al.id =
|
||||
CASE
|
||||
WHEN tr.shipped < CURDATE() THEN 3
|
||||
WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
|
||||
ELSE 0
|
||||
END
|
||||
JOIN state st ON st.code = al.code
|
||||
WHERE tr.shipped >= vDateInventory
|
||||
AND vWarehouse =tr.warehouseOutFk
|
||||
AND s.id <> 4
|
||||
AND b.itemFk = vItemId
|
||||
AND e.isInventory = FALSE
|
||||
AND w.isFeedStock = FALSE
|
||||
AND e.isRaid = FALSE
|
||||
UNION ALL
|
||||
|
||||
SELECT DATE(t.shipped),
|
||||
NULL,
|
||||
s.quantity,
|
||||
al.id,
|
||||
st.name,
|
||||
t.nickname,
|
||||
t.refFk,
|
||||
t.id,
|
||||
t.clientFk,
|
||||
stk.id,
|
||||
TRUE,
|
||||
s.id,
|
||||
st.`order`,
|
||||
ct.code,
|
||||
cb.claimFk
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN ticketState ts ON ts.ticket = t.id
|
||||
LEFT JOIN state st ON st.code = ts.code
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
||||
JOIN alertLevel al ON al.id =
|
||||
CASE
|
||||
WHEN t.shipped < curdate() THEN 3
|
||||
WHEN t.shipped > util.dayEnd(curdate()) THEN 0
|
||||
ELSE IFNULL(ts.alertLevel, 0)
|
||||
END
|
||||
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
|
||||
LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id
|
||||
LEFT JOIN claimBeginning cb ON s.id = cb.saleFk
|
||||
WHERE t.shipped >= vDateInventory
|
||||
AND s.itemFk = vItemId
|
||||
AND vWarehouse =t.warehouseFk
|
||||
ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC
|
||||
) AS itemDiary;
|
||||
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;
|
|
@ -1,2 +0,0 @@
|
|||
ALTER TABLE vn.payMethod CHANGE ibanRequiredForClients isIbanRequiredForClients tinyint(3) DEFAULT 0 NULL;
|
||||
ALTER TABLE vn.payMethod CHANGE ibanRequiredForSuppliers isIbanRequiredForSuppliers tinyint(3) DEFAULT 0 NULL;
|
|
@ -1,120 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`sale_recalcComponent`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sale_recalcComponent`(vOption INT)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Actualiza los componentes
|
||||
*
|
||||
* @table tmp.recalculateSales
|
||||
*/
|
||||
DECLARE vShipped DATE;
|
||||
DECLARE vWarehouseFk SMALLINT;
|
||||
DECLARE vAgencyModeFk INT;
|
||||
DECLARE vAddressFk INT;
|
||||
DECLARE vTicketFk BIGINT;
|
||||
DECLARE vItemFk BIGINT;
|
||||
DECLARE vLanded DATE;
|
||||
DECLARE vIsEditable BOOLEAN;
|
||||
DECLARE vZoneFk INTEGER;
|
||||
DECLARE vOption INTEGER;
|
||||
|
||||
DECLARE vSale INTEGER;
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
|
||||
DECLARE vCur CURSOR FOR
|
||||
SELECT id from tmp.recalculateSales;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
OPEN vCur;
|
||||
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vCur INTO vSale;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0),
|
||||
s.ticketFk,
|
||||
s.itemFk ,
|
||||
t.zoneFk,
|
||||
t.warehouseFk,
|
||||
t.shipped,
|
||||
t.addressFk,
|
||||
t.agencyModeFk,
|
||||
t.landed
|
||||
INTO vIsEditable,
|
||||
vTicketFk,
|
||||
vItemFk,
|
||||
vZoneFk,
|
||||
vWarehouseFk,
|
||||
vShipped,
|
||||
vAddressFk,
|
||||
vAgencyModeFk,
|
||||
vLanded
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
WHERE s.id = vSale;
|
||||
|
||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
|
||||
|
||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
||||
CALL util.throw('There is no zone for these parameters');
|
||||
END IF;
|
||||
|
||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
||||
|
||||
UPDATE ticket t
|
||||
SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
|
||||
WHERE t.id = vTicketFk AND t.landed IS NULL;
|
||||
|
||||
IF vZoneFk IS NULL THEN
|
||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
||||
UPDATE ticket t
|
||||
SET t.zoneFk = vZoneFk
|
||||
WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
|
||||
END IF;
|
||||
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
||||
|
||||
-- rellena la tabla buyUltimate con la ultima compra
|
||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
||||
|
||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
||||
SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk
|
||||
FROM tmp.buyUltimate
|
||||
WHERE itemFk = vItemFk;
|
||||
|
||||
CALL catalog_componentPrepare();
|
||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
CREATE TEMPORARY TABLE tmp.sale
|
||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
||||
|
||||
IF vOption IS NULL THEN
|
||||
SET vOption = IF(vIsEditable, 1, 6);
|
||||
END IF;
|
||||
|
||||
CALL ticketComponentUpdateSale(vOption);
|
||||
CALL catalog_componentPurge();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
|
||||
END LOOP;
|
||||
CLOSE vCur;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,23 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`sale_calculateComponent`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sale_calculateComponent`(vSale INT, vOption INT)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes
|
||||
*
|
||||
* @param vSale Id de la venta
|
||||
* @param vOption indica en que componente pone el descuadre, NULL en casos habituales
|
||||
*/
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
|
||||
CREATE TEMPORARY TABLE tmp.recalculateSales
|
||||
SELECT s.id
|
||||
FROM sale s
|
||||
WHERE s.id = vSale;
|
||||
|
||||
CALL vn.sale_recalcComponent(vOption);
|
||||
|
||||
DROP TEMPORARY TABLE tmp.recalculateSales;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,2 +0,0 @@
|
|||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||
VALUES ('Sale','payBack','WRITE','ALLOW','ROLE','employee');
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`payMethod` ADD hasVerified TINYINT(1) DEFAULT 0 NULL;
|
|
@ -1,90 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`ticket_doRefund`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doRefund`(IN vOriginTicket INT, OUT vNewTicket INT)
|
||||
BEGIN
|
||||
|
||||
DECLARE vDone BIT DEFAULT 0;
|
||||
DECLARE vCustomer MEDIUMINT;
|
||||
DECLARE vWarehouse TINYINT;
|
||||
DECLARE vCompany MEDIUMINT;
|
||||
DECLARE vAddress MEDIUMINT;
|
||||
DECLARE vRefundAgencyMode INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vQuantity DECIMAL (10,2);
|
||||
DECLARE vConcept VARCHAR(50);
|
||||
DECLARE vPrice DECIMAL (10,2);
|
||||
DECLARE vDiscount TINYINT;
|
||||
DECLARE vSaleNew INT;
|
||||
DECLARE vSaleMain INT;
|
||||
DECLARE vZoneFk INT;
|
||||
|
||||
DECLARE vRsMainTicket CURSOR FOR
|
||||
SELECT *
|
||||
FROM tmp.sale;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
|
||||
|
||||
SELECT id INTO vRefundAgencyMode
|
||||
FROM agencyMode WHERE `name` = 'ABONO';
|
||||
|
||||
SELECT clientFk, warehouseFk, companyFk, addressFk
|
||||
INTO vCustomer, vWarehouse, vCompany, vAddress
|
||||
FROM ticket
|
||||
WHERE id = vOriginTicket;
|
||||
|
||||
SELECT id INTO vZoneFk
|
||||
FROM zone WHERE agencyModeFk = vRefundAgencyMode
|
||||
LIMIT 1;
|
||||
|
||||
INSERT INTO vn.ticket (
|
||||
clientFk,
|
||||
shipped,
|
||||
addressFk,
|
||||
agencyModeFk,
|
||||
nickname,
|
||||
warehouseFk,
|
||||
companyFk,
|
||||
landed,
|
||||
zoneFk
|
||||
)
|
||||
SELECT
|
||||
vCustomer,
|
||||
CURDATE(),
|
||||
vAddress,
|
||||
vRefundAgencyMode,
|
||||
a.nickname,
|
||||
vWarehouse,
|
||||
vCompany,
|
||||
CURDATE(),
|
||||
vZoneFk
|
||||
FROM address a
|
||||
WHERE a.id = vAddress;
|
||||
|
||||
SET vNewTicket = LAST_INSERT_ID();
|
||||
|
||||
SET vDone := 0;
|
||||
OPEN vRsMainTicket ;
|
||||
FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount;
|
||||
|
||||
WHILE NOT vDone DO
|
||||
|
||||
INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount)
|
||||
VALUES( vNewTicket, vItemFk, vQuantity, vConcept, vPrice, vDiscount );
|
||||
|
||||
SET vSaleNew = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO vn.saleComponent(saleFk,componentFk,`value`)
|
||||
SELECT vSaleNew,componentFk,`value`
|
||||
FROM vn.saleComponent
|
||||
WHERE saleFk = vSaleMain;
|
||||
|
||||
FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount;
|
||||
|
||||
END WHILE;
|
||||
CLOSE vRsMainTicket;
|
||||
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;
|
|
@ -1,3 +0,0 @@
|
|||
UPDATE `vn`.`department`
|
||||
SET `notificationEmail` = 'finanzas@verdnatura.es'
|
||||
WHERE `name` = 'FINANZAS';
|
|
@ -1,2 +0,0 @@
|
|||
UPDATE `vn`.`supplier`
|
||||
SET isPayMethodChecked = TRUE;
|
|
@ -1,33 +0,0 @@
|
|||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`payment_afterInsert` AFTER INSERT ON `payment` FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vIsPayMethodChecked BOOLEAN;
|
||||
DECLARE vEmail VARCHAR(150);
|
||||
|
||||
SELECT isPayMethodChecked INTO vIsPayMethodChecked
|
||||
FROM supplier
|
||||
WHERE id = NEW.supplierFk;
|
||||
|
||||
|
||||
IF vIsPayMethodChecked = FALSE THEN
|
||||
|
||||
SELECT notificationEmail INTO vEmail
|
||||
FROM department
|
||||
WHERE name = 'FINANZAS';
|
||||
|
||||
CALL mail_insert(
|
||||
vEmail,
|
||||
NULL,
|
||||
'Pago con método sin verificar',
|
||||
CONCAT(
|
||||
'Se ha realizado el pago ',
|
||||
NEW.id,
|
||||
' al proveedor ',
|
||||
NEW.supplierFk,
|
||||
' con el método de pago sin verificar.'
|
||||
)
|
||||
);
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,26 +0,0 @@
|
|||
DROP TRIGGER IF EXISTS `vn`.`supplier_beforeUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`supplier_beforeUpdate`
|
||||
BEFORE UPDATE ON `vn`.`supplier` FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vHasChange BOOL DEFAULT FALSE;
|
||||
DECLARE vPayMethodHasVerified BOOL;
|
||||
|
||||
SELECT hasVerified INTO vPayMethodHasVerified
|
||||
FROM payMethod
|
||||
WHERE id = NEW.payMethodFk;
|
||||
|
||||
SET vHasChange = (NEW.payDemFk <> OLD.payDemFk) OR (NEW.payDay <> OLD.payDay);
|
||||
|
||||
IF vPayMethodHasVerified AND !vHasChange THEN
|
||||
SET vHasChange = (NEW.payMethodFk <> OLD.payMethodFk);
|
||||
END IF;
|
||||
|
||||
IF vHasChange THEN
|
||||
SET NEW.isPayMethodChecked = FALSE;
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
|||
CREATE TABLE `vn`.`claimConfig` (
|
||||
`id` int(11) NOT NULL,
|
||||
`pickupContact` varchar(250),
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
INSERT INTO vn.claimConfig (id, pickupContact)
|
||||
VALUES(1, 'Email: cmorenoa@logista.com Telf: 961594250 Extensión: 206');
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.claim ADD packages smallint(10) unsigned DEFAULT 0 NULL COMMENT 'packages received by the client';
|
File diff suppressed because one or more lines are too long
|
@ -32,6 +32,11 @@ INSERT INTO `vn`.`packagingConfig`(`upperGap`)
|
|||
('10');
|
||||
|
||||
UPDATE `account`.`role` SET id = 100 WHERE id = 0;
|
||||
|
||||
INSERT INTO `account`.`roleConfig`(`id`, `mysqlPassword`, `rolePrefix`, `userPrefix`, `userHost`, `tplUser`)
|
||||
VALUES
|
||||
(1, 'mysqlPassword', '$', '!', '%', 'any');
|
||||
|
||||
CALL `account`.`role_sync`;
|
||||
|
||||
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`, `image`)
|
||||
|
@ -1705,12 +1710,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`)
|
|||
( 6, 'mana', 'Mana', 1, 4),
|
||||
( 7, 'lack', 'Faltas', 1, 2);
|
||||
|
||||
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created` )
|
||||
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`)
|
||||
VALUES
|
||||
(1, CURDATE(), 1, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', 1101, 18, 3, 0, CURDATE()),
|
||||
(2, CURDATE(), 2, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', 1101, 18, 3, 0, CURDATE()),
|
||||
(3, CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, CURDATE()),
|
||||
(4, CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, CURDATE());
|
||||
(1, CURDATE(), 1, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', 1101, 18, 3, 0, CURDATE(), 0),
|
||||
(2, CURDATE(), 2, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', 1101, 18, 3, 0, CURDATE(), 1),
|
||||
(3, CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, CURDATE(), 5),
|
||||
(4, CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, CURDATE(), 10);
|
||||
|
||||
INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`)
|
||||
VALUES
|
||||
|
|
23438
db/dump/structure.sql
23438
db/dump/structure.sql
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,6 @@ IGNORETABLES=(
|
|||
--ignore-table=bs.productionIndicators
|
||||
--ignore-table=bs.VentasPorCliente
|
||||
--ignore-table=bs.v_ventas
|
||||
--ignore-table=edi.supplyOffer
|
||||
--ignore-table=postgresql.currentWorkersStats
|
||||
--ignore-table=vn.accounting__
|
||||
--ignore-table=vn.agencyModeZone
|
||||
|
|
|
@ -692,6 +692,7 @@ export default {
|
|||
claimBasicData: {
|
||||
claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
|
||||
observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]',
|
||||
packages: 'vn-input-number[ng-model="$ctrl.claim.packages"]',
|
||||
hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]',
|
||||
saveButton: `button[type=submit]`
|
||||
},
|
||||
|
@ -898,6 +899,7 @@ export default {
|
|||
sundayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(7)',
|
||||
weekWorkedHours: 'vn-worker-time-control vn-side-menu vn-label-value > section > span',
|
||||
nextMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_right]',
|
||||
previousMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_left]',
|
||||
secondWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(8) > .day-number',
|
||||
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]'
|
||||
},
|
||||
|
|
|
@ -10,6 +10,8 @@ describe('Worker time control path', () => {
|
|||
await page.loginAndModule('salesBoss', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
|
@ -97,9 +99,9 @@ describe('Worker time control path', () => {
|
|||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 7 hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.');
|
||||
// 3736 check proc vn.timeControl_calculate
|
||||
xit(`should check Hank Pym worked 6:40 hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '06:40 h.');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -152,8 +154,8 @@ describe('Worker time control path', () => {
|
|||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 happy hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.');
|
||||
it(`should check Hank Pym worked 7:40 hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '07:40 h.');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -206,8 +208,8 @@ describe('Worker time control path', () => {
|
|||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.');
|
||||
it(`should check Hank Pym worked 7:40 cheerfull hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '07:40 h.');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -257,8 +259,8 @@ describe('Worker time control path', () => {
|
|||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.');
|
||||
it(`should check Hank Pym worked 7:40 joyfull hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '07:40 h.');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -307,8 +309,8 @@ describe('Worker time control path', () => {
|
|||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.');
|
||||
it(`should check Hank Pym worked 7:40 hours with a smile on his face`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '07:40 h.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -327,6 +329,8 @@ describe('Worker time control path', () => {
|
|||
it('should access to the time control section', async() => {
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
await page.waitForState('worker.card.timeControl');
|
||||
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||
});
|
||||
|
||||
it('should lovingly scan in Hank Pym', async() => {
|
||||
|
@ -352,8 +356,8 @@ describe('Worker time control path', () => {
|
|||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours with all his will`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.');
|
||||
it(`should check Hank Pym worked 7:40 hours with all his will`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '07:40 h.');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -380,11 +384,11 @@ describe('Worker time control path', () => {
|
|||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 glad hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.');
|
||||
it(`should check Hank Pym worked 7:40 glad hours`, async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '07:40 h.');
|
||||
});
|
||||
|
||||
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
||||
it(`should check Hank Pym doesn't have hours set on the next months second week`, async() => {
|
||||
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
|
||||
|
@ -408,10 +412,12 @@ describe('Worker time control path', () => {
|
|||
await page.loginAndModule('HankPym', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||
});
|
||||
|
||||
it('should check his weekly hours are alright', async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '52:40 h.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('Ticket Create new tracking state path', () => {
|
|||
});
|
||||
|
||||
it(`should create a new state`, async() => {
|
||||
await page.autocompleteSearch(selectors.createStateView.state, '¿Fecha?');
|
||||
await page.autocompleteSearch(selectors.createStateView.state, 'OK');
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ describe('Claim edit basic data path', () => {
|
|||
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado');
|
||||
await page.clearTextarea(selectors.claimBasicData.observation);
|
||||
await page.write(selectors.claimBasicData.observation, 'edited observation');
|
||||
await page.clearInput(selectors.claimBasicData.packages);
|
||||
await page.write(selectors.claimBasicData.packages, '2');
|
||||
await page.waitToClick(selectors.claimBasicData.saveButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
|
@ -64,10 +66,19 @@ describe('Claim edit basic data path', () => {
|
|||
expect(result).toEqual('edited observation');
|
||||
});
|
||||
|
||||
it('should confirm the claim packages was edited', async() => {
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.claimBasicData.packages, 'value');
|
||||
|
||||
expect(result).toEqual('2');
|
||||
});
|
||||
|
||||
it(`should edit the claim to leave it untainted`, async() => {
|
||||
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente');
|
||||
await page.clearTextarea(selectors.claimBasicData.observation);
|
||||
await page.write(selectors.claimBasicData.observation, 'Observation one');
|
||||
await page.clearInput(selectors.claimBasicData.packages);
|
||||
await page.write(selectors.claimBasicData.packages, '0');
|
||||
await page.waitToClick(selectors.claimBasicData.saveButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ describe('Account create and basic data path', () => {
|
|||
await page.reloadSection('account.card.roles');
|
||||
const rolesCount = await page.countElement(selectors.accountRoles.anyResult);
|
||||
|
||||
expect(rolesCount).toEqual(35);
|
||||
expect(rolesCount).toEqual(61);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -121,5 +121,6 @@
|
|||
"Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}",
|
||||
"The type of business must be filled in basic data": "The type of business must be filled in basic data",
|
||||
"The worker has hours recorded that day": "The worker has hours recorded that day",
|
||||
"isWithoutNegatives": "isWithoutNegatives"
|
||||
"isWithoutNegatives": "isWithoutNegatives",
|
||||
"routeFk": "routeFk"
|
||||
}
|
|
@ -220,5 +220,6 @@
|
|||
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
||||
"You don't have privileges to create pay back": "No tienes permisos para crear un abono",
|
||||
"The item is required": "El artículo es requerido",
|
||||
"date in the future": "Fecha en el futuro",
|
||||
"reference duplicated": "Referencia duplicada"
|
||||
}
|
|
@ -26,7 +26,6 @@ module.exports = Self => {
|
|||
|
||||
Self.sync = async function(userName, password, force) {
|
||||
let $ = Self.app.models;
|
||||
|
||||
let user = await $.Account.findOne({
|
||||
fields: ['id'],
|
||||
where: {name: userName}
|
||||
|
|
|
@ -28,6 +28,10 @@ module.exports = Self => {
|
|||
{
|
||||
arg: 'hasToPickUp',
|
||||
type: 'boolean'
|
||||
},
|
||||
{
|
||||
arg: 'packages',
|
||||
type: 'number'
|
||||
}],
|
||||
returns: {
|
||||
type: 'object',
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
},
|
||||
"workerFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"packages": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -44,6 +44,13 @@
|
|||
vn-focus>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-input-number vn-one
|
||||
min="0"
|
||||
type="number"
|
||||
label="Packages received"
|
||||
ng-model="$ctrl.claim.packages">
|
||||
</vn-input-number>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textarea
|
||||
|
|
|
@ -6,3 +6,4 @@ Company: Empresa
|
|||
Sales/Client: Comercial/Cliente
|
||||
Pick up: Recoger
|
||||
When checked will notify a pickup to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial
|
||||
Packages received: Bultos recibidos
|
|
@ -78,6 +78,11 @@
|
|||
</vn-table>
|
||||
</vn-card>
|
||||
</vn-data-viewer>
|
||||
<vn-button
|
||||
label="Next"
|
||||
class="next"
|
||||
ui-sref="claim.card.photos">
|
||||
</vn-button>
|
||||
<vn-float-button
|
||||
icon="add"
|
||||
ng-if="$ctrl.isRewritable"
|
||||
|
|
|
@ -25,3 +25,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.next{
|
||||
float: right;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const soap = require('soap');
|
||||
|
||||
// #3673 sendSms tests excluded
|
||||
xdescribe('client sendSms()', () => {
|
||||
describe('client sendSms()', () => {
|
||||
it('should now send a message and log it', async() => {
|
||||
spyOn(soap, 'createClientAsync').and.returnValue('a so fake client');
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
xdescribe('Client updatePortfolio', () => {
|
||||
const salesPersonId = 18;
|
||||
describe('Client updatePortfolio', () => {
|
||||
const clientId = 1108;
|
||||
it('should update the portfolioWeight', async() => {
|
||||
it('should update the portfolioWeight when the salesPerson of a client changes', async() => {
|
||||
const salesPersonId = 18;
|
||||
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
||||
try {
|
||||
|
@ -15,9 +16,34 @@ xdescribe('Client updatePortfolio', () => {
|
|||
|
||||
await models.Client.updatePortfolio();
|
||||
|
||||
let [vendedores] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.vendedores WHERE Id_Trabajador = ${salesPersonId}; `, null, options);
|
||||
let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options);
|
||||
|
||||
expect(vendedores.portfolioWeight).toEqual(expectedResult);
|
||||
expect(salesPerson.portfolioWeight).toEqual(expectedResult);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
// 3742 first have to migrate vn2008.Clientes_cedidos to vn
|
||||
xit('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => {
|
||||
const salesPersonId = 19;
|
||||
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const expectedResult = 34.40;
|
||||
|
||||
await models.Client.rawSql(`UPDATE vn.client SET salesPersonFk = NULL WHERE id = ${clientId}; `);
|
||||
|
||||
await models.Client.updatePortfolio();
|
||||
|
||||
let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options);
|
||||
|
||||
expect(salesPerson.portfolioWeight).toEqual(expectedResult);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
// #3673 sendSms tests excluded
|
||||
xdescribe('sms send()', () => {
|
||||
describe('sms send()', () => {
|
||||
it('should not return status error', async() => {
|
||||
const ctx = {req: {accessToken: {userId: 1}}};
|
||||
const result = await app.models.Sms.send(ctx, 1105, '123456789', 'My SMS Body');
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('filter', {
|
||||
|
@ -9,7 +11,31 @@ module.exports = Self => {
|
|||
arg: 'filter',
|
||||
type: 'object',
|
||||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'search',
|
||||
type: 'string',
|
||||
description: `If it's and integer searchs by invoiceInFk, otherwise it searchs by the supplierName`,
|
||||
},
|
||||
{
|
||||
arg: 'agencyModeFk',
|
||||
type: 'integer',
|
||||
description: 'The agency agencyModeFk id',
|
||||
},
|
||||
{
|
||||
arg: 'agencyFk',
|
||||
type: 'integer',
|
||||
description: 'The agencyFk id',
|
||||
},
|
||||
{
|
||||
arg: 'from',
|
||||
type: 'date',
|
||||
description: 'The from date filter',
|
||||
},
|
||||
{
|
||||
arg: 'to',
|
||||
type: 'date',
|
||||
description: 'The to date filter',
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -29,6 +55,25 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const where = buildFilter(ctx.args, (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? {'invoiceInFk': {inq: value}}
|
||||
: {'supplierName': {like: `%${value}%`}};
|
||||
case 'agencyModeFk':
|
||||
return {'agencyModeFk': value};
|
||||
case 'agencyFk':
|
||||
return {'agencyFk': value};
|
||||
case 'from':
|
||||
return {'created': {gte: value}};
|
||||
case 'to':
|
||||
return {'created': {lte: value}};
|
||||
}
|
||||
});
|
||||
|
||||
filter = mergeFilters(filter, {where});
|
||||
|
||||
const stmts = [];
|
||||
const stmt = new ParameterizedSQL(
|
||||
`SELECT *
|
||||
|
@ -61,7 +106,8 @@ module.exports = Self => {
|
|||
) a`
|
||||
);
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
stmt.merge(conn.makePagination(filter));
|
||||
|
||||
const agencyTerm = stmts.push(stmt) - 1;
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('AgencyTerm filter()', () => {
|
||||
const authUserId = 9;
|
||||
const today = new Date();
|
||||
today.setHours(2, 0, 0, 0);
|
||||
|
||||
it('should return all the tickets matching the filter', async() => {
|
||||
it('should return all results matching the filter', async() => {
|
||||
const tx = await models.AgencyTerm.beginTransaction({});
|
||||
|
||||
try {
|
||||
|
@ -23,4 +26,84 @@ describe('AgencyTerm filter()', () => {
|
|||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return results matching "search" searching by integer', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
search: 1,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].routeFk).toEqual(1);
|
||||
});
|
||||
|
||||
it('should return results matching "search" searching by string', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
search: 'Plants SL',
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should return results matching "from" and "to"', async() => {
|
||||
const tx = await models.Buy.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const from = new Date();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
|
||||
const to = new Date();
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
const ctx = {
|
||||
args: {
|
||||
from: from,
|
||||
to: to
|
||||
}
|
||||
};
|
||||
|
||||
const results = await models.AgencyTerm.filter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(3);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return results matching "agencyModeFk"', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
agencyModeFk: 1,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].routeFk).toEqual(1);
|
||||
});
|
||||
|
||||
it('should return results matching "agencyFk"', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
agencyFk: 2,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].routeFk).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Route filter()', () => {
|
||||
let today = new Date();
|
||||
|
@ -17,29 +18,33 @@ describe('Route filter()', () => {
|
|||
expect(result[0].id).toEqual(1);
|
||||
});
|
||||
|
||||
// #1428 cuadrar formato de horas
|
||||
xit('should return the routes matching "from"', async() => {
|
||||
let ctx = {
|
||||
it('should return results matching "from" and "to"', async() => {
|
||||
const tx = await models.Buy.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const from = new Date();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
|
||||
const to = new Date();
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
const ctx = {
|
||||
args: {
|
||||
from: today,
|
||||
from: from,
|
||||
to: to
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.Route.filter(ctx);
|
||||
const results = await models.Route.filter(ctx, options);
|
||||
|
||||
expect(result.length).toEqual(7);
|
||||
});
|
||||
expect(results.length).toBe(7);
|
||||
|
||||
it('should return the routes matching "to"', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
to: today,
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.Route.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(7);
|
||||
});
|
||||
|
||||
it('should return the routes matching "m3"', async() => {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<div class="search-panel">
|
||||
<form id="manifold-form" ng-submit="$ctrl.onSearch()">
|
||||
<vn-horizontal class="vn-px-lg vn-pt-lg">
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="General search"
|
||||
ng-model="filter.search"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-px-lg">
|
||||
<vn-autocomplete vn-one
|
||||
url="AgencyModes"
|
||||
label="Agency route"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
ng-model="filter.agencyModeFk">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete vn-one
|
||||
url="Agencies"
|
||||
label="Agency Agreement"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
ng-model="filter.agencyFk">
|
||||
</vn-autocomplete>
|
||||
</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"
|
||||
on-change="$ctrl.from = value">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="To"
|
||||
ng-model="filter.to"
|
||||
on-change="$ctrl.to = value">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
</section>
|
||||
<vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,17 @@
|
|||
import ngModule from '../module';
|
||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||
|
||||
class Controller extends SearchPanel {
|
||||
get filter() {
|
||||
return this.$.filter;
|
||||
}
|
||||
|
||||
set filter(value = {}) {
|
||||
this.$.filter = value;
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnAgencyTermSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,2 @@
|
|||
Search by invoiceIn id or autonomous name: Buscar por id de recibida o por nombre de autónomo
|
||||
Search autonomous: Buscar autónomos
|
|
@ -1,10 +1,19 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="AgencyTerms/filter"
|
||||
filter="::$ctrl.filter"
|
||||
data="agencyTerms"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
auto-state="false"
|
||||
panel="vn-agency-term-search-panel"
|
||||
info="Search by invoiceIn id or autonomous name"
|
||||
placeholder="Search autonomous"
|
||||
filter="{}"
|
||||
model="model">
|
||||
</vn-searchbar>
|
||||
</vn-portal>
|
||||
<vn-card>
|
||||
<smart-table
|
||||
model="model"
|
||||
|
@ -36,10 +45,10 @@
|
|||
<th field="created">
|
||||
<span translate>Date</span>
|
||||
</th>
|
||||
<th field="agencyFk">
|
||||
<th field="agencyModeFk">
|
||||
<span translate>Agency route</span>
|
||||
</th>
|
||||
<th field="agencyAgreement">
|
||||
<th field="agencyFk">
|
||||
<span translate>Agency Agreement</span>
|
||||
</th>
|
||||
<th field="packages">
|
||||
|
|
|
@ -12,19 +12,19 @@ class Controller extends Section {
|
|||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'agencyFk',
|
||||
field: 'agencyModeFk',
|
||||
autocomplete: {
|
||||
url: 'AgencyModes',
|
||||
showField: 'name',
|
||||
valueField: 'name'
|
||||
valueField: 'id'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'agencyAgreement',
|
||||
field: 'agencyFk',
|
||||
autocomplete: {
|
||||
url: 'Agencies',
|
||||
showField: 'name',
|
||||
valueField: 'name'
|
||||
valueField: 'id'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -41,14 +41,14 @@ class Controller extends Section {
|
|||
|
||||
exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'agencyFk':
|
||||
return {'a.agencyModeName': value};
|
||||
case 'agencyModeFk':
|
||||
return {'a.agencyModeFk': value};
|
||||
case 'supplierFk':
|
||||
return {'a.supplierName': value};
|
||||
case 'routeFk':
|
||||
return {'a.routeFk': value};
|
||||
case 'created':
|
||||
case 'agencyAgreement':
|
||||
case 'agencyFk':
|
||||
case 'packages':
|
||||
case 'm3':
|
||||
case 'kmTotal':
|
||||
|
|
|
@ -13,4 +13,5 @@ import './log';
|
|||
import './tickets';
|
||||
import './agency-term/index';
|
||||
import './agency-term/createInvoiceIn';
|
||||
import './agency-term-search-panel';
|
||||
import './ticket-popup';
|
||||
|
|
|
@ -158,7 +158,8 @@ module.exports = Self => {
|
|||
'companyFk',
|
||||
'shipped',
|
||||
'landed',
|
||||
'isDeleted'
|
||||
'isDeleted',
|
||||
'routeFk'
|
||||
],
|
||||
include: [
|
||||
{
|
||||
|
@ -169,6 +170,7 @@ module.exports = Self => {
|
|||
}]
|
||||
}, myOptions);
|
||||
|
||||
args.routeFk = null;
|
||||
const updatedTicket = Object.assign({}, args);
|
||||
delete updatedTicket.ctx;
|
||||
delete updatedTicket.option;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const soap = require('soap');
|
||||
|
||||
// #3673 sendSms tests excluded
|
||||
xdescribe('ticket sendSms()', () => {
|
||||
describe('ticket sendSms()', () => {
|
||||
it('should send a message and log it', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ describe('ticket setDeleted()', () => {
|
|||
|
||||
expect(error.message).toEqual('You must delete the claim id %d first');
|
||||
});
|
||||
|
||||
it('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get rid of the itemshelving', async() => {
|
||||
// test excluded by task #3693
|
||||
xit('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get rid of the itemshelving', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
||||
try {
|
||||
|
|
|
@ -10,13 +10,13 @@ describe('department moveChild()', () => {
|
|||
|
||||
it('should move a child department to a new parent', async() => {
|
||||
const childId = 22;
|
||||
const parentId = 1;
|
||||
const parentId = 37;
|
||||
|
||||
const child = await app.models.Department.findById(childId);
|
||||
|
||||
expect(child.parentFk).toBeNull();
|
||||
expect(child.parentFk).toEqual(1);
|
||||
updatedChild = await app.models.Department.moveChild(childId, parentId);
|
||||
|
||||
expect(updatedChild.parentFk).toEqual(1);
|
||||
expect(updatedChild.parentFk).toEqual(37);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,6 +12,6 @@ describe('Worker getWorkedHours()', () => {
|
|||
const [result] = await models.Worker.getWorkedHours(workerID, started, ended);
|
||||
|
||||
expect(result.expectedHours).toEqual(28800); // 8:00 hours in seconds
|
||||
expect(result.workedHours).toEqual(29400); // 8:10 hours in seconds
|
||||
expect(result.workedHours).toEqual(28200); // 7:50 hours in seconds
|
||||
});
|
||||
});
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
</div>
|
||||
|
||||
<p v-html="$t('sections.agency.description')"></p>
|
||||
<p>{{claimConfig.pickupContact}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer block -->
|
||||
|
|
|
@ -7,6 +7,7 @@ module.exports = {
|
|||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.claimId);
|
||||
this.sales = await this.fetchSales(this.claimId);
|
||||
this.claimConfig = await this.fetchClaimConfig();
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
|
@ -25,6 +26,9 @@ module.exports = {
|
|||
fetchSales(claimId) {
|
||||
return this.rawSqlFromDef('sales', [claimId]);
|
||||
},
|
||||
fetchClaimConfig() {
|
||||
return this.findOneFromDef('claimConfig');
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-header': reportHeader.build(),
|
||||
|
|
|
@ -14,4 +14,4 @@ phone: Teléfono
|
|||
sections:
|
||||
agency:
|
||||
description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina
|
||||
de Logista Parcel. <br/> Tlf: 96 166 77 88 - Ana Gómez (Ext. 2113) <em>(atcsalidas.i2valencia@integra2.es)</em>'
|
||||
de Logista Parcel.'
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
SELECT pickupContact
|
||||
FROM claimConfig;
|
Loading…
Reference in New Issue