This commit is contained in:
parent
cd20a2d06d
commit
1f1dfae7e3
|
@ -84,7 +84,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"userConfig": {
|
"userConfig": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
ALTER TABLE `vn`.`workerDocument` DROP FOREIGN KEY `workerDocument_ibfk_1`;
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`worker` DROP KEY `user_id_UNIQUE`;
|
ALTER TABLE `vn`.`worker` DROP KEY `user_id_UNIQUE`;
|
||||||
|
|
||||||
ALTER TABLE `vn`.`worker` DROP COLUMN `userFk`;
|
ALTER TABLE `vn`.`worker` DROP COLUMN `userFk`;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
|
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
|
||||||
INSERT INTO `account`.`role` (name,description)
|
INSERT INTO `account`.`role` (name, description)
|
||||||
VALUES ('deliveryAssistant','Jefe auxiliar repartos');
|
VALUES ('deliveryAssistant','Jefe auxiliar repartos');
|
||||||
|
|
||||||
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerCreate`(
|
||||||
|
vFirstname VARCHAR(50),
|
||||||
|
vLastName VARCHAR(50),
|
||||||
|
vCode CHAR(3),
|
||||||
|
vBossFk INT,
|
||||||
|
vUserFk INT,
|
||||||
|
vFi VARCHAR(15) ,
|
||||||
|
vBirth DATE
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Create new worker
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
INSERT INTO worker(id, code, firstName, lastName, bossFk, fi, birth)
|
||||||
|
VALUES (vUserFk, vCode, vFirstname, vLastName, vBossFk, vFi, vBirth);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -24255,7 +24255,6 @@ BEGIN
|
||||||
CONCAT('Cliente ', NEW.id),
|
CONCAT('Cliente ', NEW.id),
|
||||||
CONCAT('Recibida la documentación: ', vText)
|
CONCAT('Recibida la documentación: ', vText)
|
||||||
FROM worker w
|
FROM worker w
|
||||||
LEFT JOIN account.user u ON w.id = u.id AND u.active
|
|
||||||
LEFT JOIN account.user u ON w.id = u.id AND u.active
|
LEFT JOIN account.user u ON w.id = u.id AND u.active
|
||||||
LEFT JOIN account.account ac ON ac.id = u.id
|
LEFT JOIN account.account ac ON ac.id = u.id
|
||||||
WHERE w.id = NEW.salesPersonFk;
|
WHERE w.id = NEW.salesPersonFk;
|
||||||
|
@ -45804,23 +45803,6 @@ DELIMITER ;
|
||||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
|
||||||
CREATE DEFINER=`root`@`localhost` FUNCTION `getWorkerCode`() RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
|
||||||
READS SQL DATA
|
|
||||||
BEGIN
|
|
||||||
DECLARE vUserCode VARCHAR(3) CHARSET utf8 COLLATE utf8_unicode_ci;
|
|
||||||
|
|
||||||
SELECT code INTO vUserCode
|
|
||||||
FROM worker
|
|
||||||
WHERE userFk = account.myUser_getId();
|
|
||||||
|
|
||||||
RETURN vUserCode;
|
|
||||||
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 FUNCTION IF EXISTS `hasAnyNegativeBase` */;
|
/*!50003 DROP FUNCTION IF EXISTS `hasAnyNegativeBase` */;
|
||||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||||
|
@ -48196,56 +48178,6 @@ DELIMITER ;
|
||||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
|
||||||
CREATE DEFINER=`root`@`localhost` FUNCTION `workerIsBoss`(vUserId INT) RETURNS int(11)
|
|
||||||
DETERMINISTIC
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Comprueba por jerarquía si el trabajador actual es jefe
|
|
||||||
* de un trabajador en concreto.
|
|
||||||
*
|
|
||||||
* @param vUserId Id del trabajador que se desea comprobar.
|
|
||||||
* @return Revuelve verdadero si es jefe del empleado por escala jerárquica.
|
|
||||||
*/
|
|
||||||
DECLARE vWorkerId INT;
|
|
||||||
DECLARE vBossId INT;
|
|
||||||
|
|
||||||
SELECT id INTO vWorkerId
|
|
||||||
FROM vn.worker
|
|
||||||
WHERE userFk = vUserId;
|
|
||||||
IF vWorkerId IS NULL THEN
|
|
||||||
CALL util.throw('USER_NOT_FOUND');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tCheckedWorker;
|
|
||||||
CREATE TEMPORARY TABLE tCheckedWorker
|
|
||||||
(PRIMARY KEY (workerFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT id workerFk FROM worker LIMIT 0;
|
|
||||||
LOOP
|
|
||||||
SELECT bossFk INTO vBossId
|
|
||||||
FROM vn.worker
|
|
||||||
WHERE id = vWorkerId;
|
|
||||||
IF (SELECT COUNT(*) FROM tCheckedWorker WHERE workerFk = vBossId) THEN
|
|
||||||
CALL util.throw('INFINITE_LOOP');
|
|
||||||
END IF;
|
|
||||||
IF vBossId = vWorkerId THEN
|
|
||||||
RETURN FALSE;
|
|
||||||
ELSEIF vBossId = account.myUser_getId() THEN
|
|
||||||
RETURN TRUE;
|
|
||||||
ELSE
|
|
||||||
INSERT INTO tCheckedWorker VALUES (vWorkerId);
|
|
||||||
SET vWorkerId = vBossId;
|
|
||||||
END IF;
|
|
||||||
END LOOP;
|
|
||||||
DROP TEMPORARY TABLE tCheckedWorker;
|
|
||||||
RETURN FALSE;
|
|
||||||
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 FUNCTION IF EXISTS `workerMachinery_isRegistered` */;
|
/*!50003 DROP FUNCTION IF EXISTS `workerMachinery_isRegistered` */;
|
||||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||||
|
@ -71229,9 +71161,8 @@ BEGIN
|
||||||
IF (vLanding IS NULL) THEN
|
IF (vLanding IS NULL) THEN
|
||||||
|
|
||||||
SELECT e.email INTO vSalesPersonEmail
|
SELECT e.email INTO vSalesPersonEmail
|
||||||
FROM vn.client c
|
FROM client c
|
||||||
JOIN vn.worker sp ON sp.id = c.salesPersonFk
|
JOIN account.emailUser e ON e.userFk = c.salesPersonFk
|
||||||
JOIN account.emailUser e ON e.userFk = sp.userFk
|
|
||||||
WHERE c.id = vClientFk;
|
WHERE c.id = vClientFk;
|
||||||
|
|
||||||
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ',
|
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ',
|
||||||
|
@ -73418,7 +73349,8 @@ BEGIN
|
||||||
at2.permissionRate,
|
at2.permissionRate,
|
||||||
at2.discountRate,
|
at2.discountRate,
|
||||||
ct.hoursWeek hoursWeek,
|
ct.hoursWeek hoursWeek,
|
||||||
at2.isAllowedToWork
|
at2.isAllowedToWork,
|
||||||
|
u.userFk
|
||||||
FROM time t
|
FROM time t
|
||||||
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
||||||
LEFT JOIN worker w ON w.id = b.workerFk
|
LEFT JOIN worker w ON w.id = b.workerFk
|
||||||
|
@ -73946,7 +73878,7 @@ BEGIN
|
||||||
CREATE TEMPORARY TABLE tmp.`user`
|
CREATE TEMPORARY TABLE tmp.`user`
|
||||||
SELECT u.id userFk
|
SELECT u.id userFk
|
||||||
FROM account.user u
|
FROM account.user u
|
||||||
JOIN vn.worker w ON w.id = u.id
|
JOIN vn.worker w ON w.userFk = u.id
|
||||||
WHERE w.id = vWorkerFk;
|
WHERE w.id = vWorkerFk;
|
||||||
|
|
||||||
CALL vn.timeControl_calculate(vDatedFrom, vDatedTo);
|
CALL vn.timeControl_calculate(vDatedFrom, vDatedTo);
|
||||||
|
@ -76048,8 +75980,7 @@ BEGIN
|
||||||
LIMIT 10000000000000000000)sub
|
LIMIT 10000000000000000000)sub
|
||||||
GROUP BY cont
|
GROUP BY cont
|
||||||
HAVING cont2 MOD 2 = 1
|
HAVING cont2 MOD 2 = 1
|
||||||
)sub2
|
)sub2;
|
||||||
JOIN worker w ON w.userFk = sub2.userFk;
|
|
||||||
END ;;
|
END ;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -82085,7 +82016,6 @@ USE `vn`;
|
||||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Final view structure for view `workerTimeJourneyNG`
|
-- Final view structure for view `workerTimeJourneyNG`
|
||||||
--
|
--
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "worker",
|
"relation": "worker",
|
||||||
"scope": {
|
"scope": {
|
||||||
"fields": ["userFk"],
|
"fields": ["id"],
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "user",
|
"relation": "user",
|
||||||
"scope": {
|
"scope": {
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"supplier": {
|
"supplier": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,6 @@ module.exports = Self => {
|
||||||
{'u.nickname': {like: `%${value}%`}}
|
{'u.nickname': {like: `%${value}%`}}
|
||||||
]};
|
]};
|
||||||
case 'id':
|
case 'id':
|
||||||
case 'userFk':
|
|
||||||
return {'w.id': value};
|
|
||||||
case 'firstName':
|
case 'firstName':
|
||||||
return {'w.firstName': {like: `%${value}%`}};
|
return {'w.firstName': {like: `%${value}%`}};
|
||||||
case 'lastName':
|
case 'lastName':
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"warehouse": {
|
"warehouse": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
vn-one
|
vn-one
|
||||||
label="User id"
|
label="User id"
|
||||||
ng-model="filter.userFk">
|
ng-model="filter.id">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -64,4 +64,4 @@
|
||||||
<vn-submit label="Search"></vn-submit>
|
<vn-submit label="Search"></vn-submit>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue