2595 - Added invoiceIn module #545
|
@ -1,8 +0,0 @@
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'deliveryBoss' WHERE (`id` = '194');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '97');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '100');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '103');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '202');
|
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Town', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Province', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
|
|
|
@ -1,3 +0,0 @@
|
||||||
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '3');
|
|
||||||
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '5');
|
|
|
@ -1,9 +0,0 @@
|
||||||
ALTER TABLE `vn`.`observationType`
|
|
||||||
ADD COLUMN `code` VARCHAR(45) NOT NULL AFTER `description`;
|
|
||||||
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'itemPicker' WHERE (`id` = '1');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'packager' WHERE (`id` = '2');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'salesPerson' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'administrative' WHERE (`id` = '5');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'weight' WHERE (`id` = '6');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'delivery' WHERE (`id` = '3');
|
|
|
@ -1,7 +0,0 @@
|
||||||
ALTER TABLE `account`.`roleRole`
|
|
||||||
ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
|
|
||||||
ADD PRIMARY KEY (`id`);
|
|
||||||
|
|
||||||
UPDATE `account`.`role` SET id = 100 WHERE `name` = 'root';
|
|
||||||
|
|
||||||
CALL account.role_sync;
|
|
|
@ -1,504 +0,0 @@
|
||||||
DROP PROCEDURE IF EXISTS account.role_syncPrivileges;
|
|
||||||
DELIMITER $$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `account`.`role_syncPrivileges`()
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Synchronizes permissions of MySQL role users based on role hierarchy.
|
|
||||||
* The computed role users of permission mix will be named according to
|
|
||||||
* pattern z-[role_name].
|
|
||||||
*
|
|
||||||
* If any@localhost user exists, it will be taken as a template for basic
|
|
||||||
* attributes.
|
|
||||||
*
|
|
||||||
* Warning! This procedure should only be called when MySQL privileges
|
|
||||||
* are modified. If role hierarchy is modified, you must call the role_sync()
|
|
||||||
* procedure wich calls this internally.
|
|
||||||
*/
|
|
||||||
DECLARE vIsMysql BOOL DEFAULT VERSION() NOT LIKE '%MariaDB%';
|
|
||||||
DECLARE vVersion INT DEFAULT SUBSTRING_INDEX(VERSION(), '.', 1);
|
|
||||||
DECLARE vTplUser VARCHAR(255) DEFAULT 'any';
|
|
||||||
DECLARE vTplHost VARCHAR(255) DEFAULT '%';
|
|
||||||
DECLARE vRoleHost VARCHAR(255) DEFAULT 'localhost';
|
|
||||||
DECLARE vAllHost VARCHAR(255) DEFAULT '%';
|
|
||||||
DECLARE vPrefix VARCHAR(2) DEFAULT 'z-';
|
|
||||||
DECLARE vPrefixedLike VARCHAR(255);
|
|
||||||
DECLARE vPassword VARCHAR(255) DEFAULT '';
|
|
||||||
|
|
||||||
-- Deletes computed role users
|
|
||||||
|
|
||||||
SET vPrefixedLike = CONCAT(vPrefix, '%');
|
|
||||||
|
|
||||||
IF vIsMysql THEN
|
|
||||||
DELETE FROM mysql.user
|
|
||||||
WHERE `User` LIKE vPrefixedLike;
|
|
||||||
ELSE
|
|
||||||
DELETE FROM mysql.global_priv
|
|
||||||
WHERE `User` LIKE vPrefixedLike;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DELETE FROM mysql.db
|
|
||||||
WHERE `User` LIKE vPrefixedLike;
|
|
||||||
|
|
||||||
DELETE FROM mysql.tables_priv
|
|
||||||
WHERE `User` LIKE vPrefixedLike;
|
|
||||||
|
|
||||||
DELETE FROM mysql.columns_priv
|
|
||||||
WHERE `User` LIKE vPrefixedLike;
|
|
||||||
|
|
||||||
DELETE FROM mysql.procs_priv
|
|
||||||
WHERE `User` LIKE vPrefixedLike;
|
|
||||||
|
|
||||||
DELETE FROM mysql.proxies_priv
|
|
||||||
WHERE `Proxied_user` LIKE vPrefixedLike;
|
|
||||||
|
|
||||||
-- Temporary tables
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tRole;
|
|
||||||
CREATE TEMPORARY TABLE tRole
|
|
||||||
(INDEX (id))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
`name` role,
|
|
||||||
CONCAT(vPrefix, `name`) prefixedRole
|
|
||||||
FROM role
|
|
||||||
WHERE hasLogin;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tRoleInherit;
|
|
||||||
CREATE TEMPORARY TABLE tRoleInherit
|
|
||||||
(INDEX (inheritsFrom))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
ri.`name` inheritsFrom
|
|
||||||
FROM tRole r
|
|
||||||
JOIN roleRole rr ON rr.role = r.id
|
|
||||||
JOIN role ri ON ri.id = rr.inheritsFrom;
|
|
||||||
|
|
||||||
-- Recreate role users
|
|
||||||
|
|
||||||
IF vIsMysql THEN
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tUser;
|
|
||||||
CREATE TEMPORARY TABLE tUser
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole `User`,
|
|
||||||
vTplHost `Host`,
|
|
||||||
IFNULL(t.`authentication_string`,
|
|
||||||
'') `authentication_string`,
|
|
||||||
IFNULL(t.`plugin`,
|
|
||||||
'mysql_native_password') `plugin`,
|
|
||||||
IFNULL(IF('' != u.`ssl_type`,
|
|
||||||
u.`ssl_type`, t.`ssl_type`),
|
|
||||||
'') `ssl_type`,
|
|
||||||
IFNULL(IF('' != u.`ssl_cipher`,
|
|
||||||
u.`ssl_cipher`, t.`ssl_cipher`),
|
|
||||||
'') `ssl_cipher`,
|
|
||||||
IFNULL(IF('' != u.`x509_issuer`,
|
|
||||||
u.`x509_issuer`, t.`x509_issuer`),
|
|
||||||
'') `x509_issuer`,
|
|
||||||
IFNULL(IF('' != u.`x509_subject`,
|
|
||||||
u.`x509_subject`, t.`x509_subject`),
|
|
||||||
'') `x509_subject`,
|
|
||||||
IFNULL(IF(0 != u.`max_questions`,
|
|
||||||
u.`max_questions`, t.`max_questions`),
|
|
||||||
0) `max_questions`,
|
|
||||||
IFNULL(IF(0 != u.`max_updates`,
|
|
||||||
u.`max_updates`, t.`max_updates`),
|
|
||||||
0) `max_updates`,
|
|
||||||
IFNULL(IF(0 != u.`max_connections`,
|
|
||||||
u.`max_connections`, t.`max_connections`),
|
|
||||||
0) `max_connections`,
|
|
||||||
IFNULL(IF(0 != u.`max_user_connections`,
|
|
||||||
u.`max_user_connections`, t.`max_user_connections`),
|
|
||||||
0) `max_user_connections`
|
|
||||||
FROM tRole r
|
|
||||||
LEFT JOIN mysql.user t
|
|
||||||
ON t.`User` = vTplUser
|
|
||||||
AND t.`Host` = vRoleHost
|
|
||||||
LEFT JOIN mysql.user u
|
|
||||||
ON u.`User` = r.role
|
|
||||||
AND u.`Host` = vRoleHost;
|
|
||||||
|
|
||||||
IF vVersion <= 5 THEN
|
|
||||||
SELECT `Password` INTO vPassword
|
|
||||||
FROM mysql.user
|
|
||||||
WHERE `User` = vTplUser
|
|
||||||
AND `Host` = vRoleHost;
|
|
||||||
|
|
||||||
INSERT INTO mysql.user (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`Password`,
|
|
||||||
`authentication_string`,
|
|
||||||
`plugin`,
|
|
||||||
`ssl_type`,
|
|
||||||
`ssl_cipher`,
|
|
||||||
`x509_issuer`,
|
|
||||||
`x509_subject`,
|
|
||||||
`max_questions`,
|
|
||||||
`max_updates`,
|
|
||||||
`max_connections`,
|
|
||||||
`max_user_connections`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
vPassword,
|
|
||||||
`authentication_string`,
|
|
||||||
`plugin`,
|
|
||||||
`ssl_type`,
|
|
||||||
`ssl_cipher`,
|
|
||||||
`x509_issuer`,
|
|
||||||
`x509_subject`,
|
|
||||||
`max_questions`,
|
|
||||||
`max_updates`,
|
|
||||||
`max_connections`,
|
|
||||||
`max_user_connections`
|
|
||||||
FROM tUser;
|
|
||||||
ELSE
|
|
||||||
INSERT INTO mysql.user (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`authentication_string`,
|
|
||||||
`plugin`,
|
|
||||||
`ssl_type`,
|
|
||||||
`ssl_cipher`,
|
|
||||||
`x509_issuer`,
|
|
||||||
`x509_subject`,
|
|
||||||
`max_questions`,
|
|
||||||
`max_updates`,
|
|
||||||
`max_connections`,
|
|
||||||
`max_user_connections`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`authentication_string`,
|
|
||||||
`plugin`,
|
|
||||||
`ssl_type`,
|
|
||||||
`ssl_cipher`,
|
|
||||||
`x509_issuer`,
|
|
||||||
`x509_subject`,
|
|
||||||
`max_questions`,
|
|
||||||
`max_updates`,
|
|
||||||
`max_connections`,
|
|
||||||
`max_user_connections`
|
|
||||||
FROM tUser;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tUser;
|
|
||||||
ELSE
|
|
||||||
INSERT INTO mysql.global_priv (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`Priv`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
vTplHost,
|
|
||||||
JSON_MERGE_PATCH(
|
|
||||||
IFNULL(t.`Priv`, '{}'),
|
|
||||||
IFNULL(u.`Priv`, '{}'),
|
|
||||||
JSON_OBJECT(
|
|
||||||
'mysql_old_password', JSON_VALUE(t.`Priv`, '$.mysql_old_password'),
|
|
||||||
'mysql_native_password', JSON_VALUE(t.`Priv`, '$.mysql_native_password'),
|
|
||||||
'authentication_string', JSON_VALUE(t.`Priv`, '$.authentication_string'),
|
|
||||||
'ssl_type', JSON_VALUE(t.`Priv`, '$.ssl_type')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
FROM tRole r
|
|
||||||
LEFT JOIN mysql.global_priv t
|
|
||||||
ON t.`User` = vTplUser
|
|
||||||
AND t.`Host` = vRoleHost
|
|
||||||
LEFT JOIN mysql.global_priv u
|
|
||||||
ON u.`User` = r.role
|
|
||||||
AND u.`Host` = vRoleHost;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO mysql.proxies_priv (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`Proxied_user`,
|
|
||||||
`Proxied_host`,
|
|
||||||
`Grantor`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
'',
|
|
||||||
vAllHost,
|
|
||||||
prefixedRole,
|
|
||||||
vTplHost,
|
|
||||||
CONCAT(prefixedRole, '@', vTplHost)
|
|
||||||
FROM tRole;
|
|
||||||
|
|
||||||
-- Copies global privileges
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tUserPriv;
|
|
||||||
|
|
||||||
IF vIsMysql THEN
|
|
||||||
CREATE TEMPORARY TABLE tUserPriv
|
|
||||||
(INDEX (prefixedRole))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
MAX(u.`Select_priv`) `Select_priv`,
|
|
||||||
MAX(u.`Insert_priv`) `Insert_priv`,
|
|
||||||
MAX(u.`Update_priv`) `Update_priv`,
|
|
||||||
MAX(u.`Delete_priv`) `Delete_priv`,
|
|
||||||
MAX(u.`Create_priv`) `Create_priv`,
|
|
||||||
MAX(u.`Drop_priv`) `Drop_priv`,
|
|
||||||
MAX(u.`Reload_priv`) `Reload_priv`,
|
|
||||||
MAX(u.`Shutdown_priv`) `Shutdown_priv`,
|
|
||||||
MAX(u.`Process_priv`) `Process_priv`,
|
|
||||||
MAX(u.`File_priv`) `File_priv`,
|
|
||||||
MAX(u.`Grant_priv`) `Grant_priv`,
|
|
||||||
MAX(u.`References_priv`) `References_priv`,
|
|
||||||
MAX(u.`Index_priv`) `Index_priv`,
|
|
||||||
MAX(u.`Alter_priv`) `Alter_priv`,
|
|
||||||
MAX(u.`Show_db_priv`) `Show_db_priv`,
|
|
||||||
MAX(u.`Super_priv`) `Super_priv`,
|
|
||||||
MAX(u.`Create_tmp_table_priv`) `Create_tmp_table_priv`,
|
|
||||||
MAX(u.`Lock_tables_priv`) `Lock_tables_priv`,
|
|
||||||
MAX(u.`Execute_priv`) `Execute_priv`,
|
|
||||||
MAX(u.`Repl_slave_priv`) `Repl_slave_priv`,
|
|
||||||
MAX(u.`Repl_client_priv`) `Repl_client_priv`,
|
|
||||||
MAX(u.`Create_view_priv`) `Create_view_priv`,
|
|
||||||
MAX(u.`Show_view_priv`) `Show_view_priv`,
|
|
||||||
MAX(u.`Create_routine_priv`) `Create_routine_priv`,
|
|
||||||
MAX(u.`Alter_routine_priv`) `Alter_routine_priv`,
|
|
||||||
MAX(u.`Create_user_priv`) `Create_user_priv`,
|
|
||||||
MAX(u.`Event_priv`) `Event_priv`,
|
|
||||||
MAX(u.`Trigger_priv`) `Trigger_priv`,
|
|
||||||
MAX(u.`Create_tablespace_priv`) `Create_tablespace_priv`
|
|
||||||
FROM tRoleInherit r
|
|
||||||
JOIN mysql.user u
|
|
||||||
ON u.`User` = r.inheritsFrom
|
|
||||||
AND u.`Host`= vRoleHost
|
|
||||||
GROUP BY r.prefixedRole;
|
|
||||||
|
|
||||||
UPDATE mysql.user u
|
|
||||||
JOIN tUserPriv t
|
|
||||||
ON u.`User` = t.prefixedRole
|
|
||||||
AND u.`Host` = vTplHost
|
|
||||||
SET
|
|
||||||
u.`Select_priv`
|
|
||||||
= t.`Select_priv`,
|
|
||||||
u.`Insert_priv`
|
|
||||||
= t.`Insert_priv`,
|
|
||||||
u.`Update_priv`
|
|
||||||
= t.`Update_priv`,
|
|
||||||
u.`Delete_priv`
|
|
||||||
= t.`Delete_priv`,
|
|
||||||
u.`Create_priv`
|
|
||||||
= t.`Create_priv`,
|
|
||||||
u.`Drop_priv`
|
|
||||||
= t.`Drop_priv`,
|
|
||||||
u.`Reload_priv`
|
|
||||||
= t.`Reload_priv`,
|
|
||||||
u.`Shutdown_priv`
|
|
||||||
= t.`Shutdown_priv`,
|
|
||||||
u.`Process_priv`
|
|
||||||
= t.`Process_priv`,
|
|
||||||
u.`File_priv`
|
|
||||||
= t.`File_priv`,
|
|
||||||
u.`Grant_priv`
|
|
||||||
= t.`Grant_priv`,
|
|
||||||
u.`References_priv`
|
|
||||||
= t.`References_priv`,
|
|
||||||
u.`Index_priv`
|
|
||||||
= t.`Index_priv`,
|
|
||||||
u.`Alter_priv`
|
|
||||||
= t.`Alter_priv`,
|
|
||||||
u.`Show_db_priv`
|
|
||||||
= t.`Show_db_priv`,
|
|
||||||
u.`Super_priv`
|
|
||||||
= t.`Super_priv`,
|
|
||||||
u.`Create_tmp_table_priv`
|
|
||||||
= t.`Create_tmp_table_priv`,
|
|
||||||
u.`Lock_tables_priv`
|
|
||||||
= t.`Lock_tables_priv`,
|
|
||||||
u.`Execute_priv`
|
|
||||||
= t.`Execute_priv`,
|
|
||||||
u.`Repl_slave_priv`
|
|
||||||
= t.`Repl_slave_priv`,
|
|
||||||
u.`Repl_client_priv`
|
|
||||||
= t.`Repl_client_priv`,
|
|
||||||
u.`Create_view_priv`
|
|
||||||
= t.`Create_view_priv`,
|
|
||||||
u.`Show_view_priv`
|
|
||||||
= t.`Show_view_priv`,
|
|
||||||
u.`Create_routine_priv`
|
|
||||||
= t.`Create_routine_priv`,
|
|
||||||
u.`Alter_routine_priv`
|
|
||||||
= t.`Alter_routine_priv`,
|
|
||||||
u.`Create_user_priv`
|
|
||||||
= t.`Create_user_priv`,
|
|
||||||
u.`Event_priv`
|
|
||||||
= t.`Event_priv`,
|
|
||||||
u.`Trigger_priv`
|
|
||||||
= t.`Trigger_priv`,
|
|
||||||
u.`Create_tablespace_priv`
|
|
||||||
= t.`Create_tablespace_priv`;
|
|
||||||
ELSE
|
|
||||||
CREATE TEMPORARY TABLE tUserPriv
|
|
||||||
(INDEX (prefixedRole))
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
BIT_OR(JSON_VALUE(p.`Priv`, '$.access')) access
|
|
||||||
FROM tRoleInherit r
|
|
||||||
JOIN mysql.global_priv p
|
|
||||||
ON p.`User` = r.inheritsFrom
|
|
||||||
AND p.`Host`= vRoleHost
|
|
||||||
GROUP BY r.prefixedRole;
|
|
||||||
|
|
||||||
UPDATE mysql.global_priv p
|
|
||||||
JOIN tUserPriv t
|
|
||||||
ON p.`User` = t.prefixedRole
|
|
||||||
AND p.`Host` = vTplHost
|
|
||||||
SET
|
|
||||||
p.`Priv` = JSON_SET(p.`Priv`, '$.access', t.access);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tUserPriv;
|
|
||||||
|
|
||||||
-- Copy schema level privileges
|
|
||||||
|
|
||||||
INSERT INTO mysql.db (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`Db`,
|
|
||||||
`Select_priv`,
|
|
||||||
`Insert_priv`,
|
|
||||||
`Update_priv`,
|
|
||||||
`Delete_priv`,
|
|
||||||
`Create_priv`,
|
|
||||||
`Drop_priv`,
|
|
||||||
`Grant_priv`,
|
|
||||||
`References_priv`,
|
|
||||||
`Index_priv`,
|
|
||||||
`Alter_priv`,
|
|
||||||
`Create_tmp_table_priv`,
|
|
||||||
`Lock_tables_priv`,
|
|
||||||
`Create_view_priv`,
|
|
||||||
`Show_view_priv`,
|
|
||||||
`Create_routine_priv`,
|
|
||||||
`Alter_routine_priv`,
|
|
||||||
`Execute_priv`,
|
|
||||||
`Event_priv`,
|
|
||||||
`Trigger_priv`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
vTplHost,
|
|
||||||
t.`Db`,
|
|
||||||
MAX(t.`Select_priv`),
|
|
||||||
MAX(t.`Insert_priv`),
|
|
||||||
MAX(t.`Update_priv`),
|
|
||||||
MAX(t.`Delete_priv`),
|
|
||||||
MAX(t.`Create_priv`),
|
|
||||||
MAX(t.`Drop_priv`),
|
|
||||||
MAX(t.`Grant_priv`),
|
|
||||||
MAX(t.`References_priv`),
|
|
||||||
MAX(t.`Index_priv`),
|
|
||||||
MAX(t.`Alter_priv`),
|
|
||||||
MAX(t.`Create_tmp_table_priv`),
|
|
||||||
MAX(t.`Lock_tables_priv`),
|
|
||||||
MAX(t.`Create_view_priv`),
|
|
||||||
MAX(t.`Show_view_priv`),
|
|
||||||
MAX(t.`Create_routine_priv`),
|
|
||||||
MAX(t.`Alter_routine_priv`),
|
|
||||||
MAX(t.`Execute_priv`),
|
|
||||||
MAX(t.`Event_priv`),
|
|
||||||
MAX(t.`Trigger_priv`)
|
|
||||||
FROM tRoleInherit r
|
|
||||||
JOIN mysql.db t
|
|
||||||
ON t.`User` = r.inheritsFrom
|
|
||||||
AND t.`Host`= vRoleHost
|
|
||||||
GROUP BY r.prefixedRole, t.`Db`;
|
|
||||||
|
|
||||||
-- Copy table level privileges
|
|
||||||
|
|
||||||
INSERT INTO mysql.tables_priv (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`Db`,
|
|
||||||
`Table_name`,
|
|
||||||
`Grantor`,
|
|
||||||
`Timestamp`,
|
|
||||||
`Table_priv`,
|
|
||||||
`Column_priv`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
vTplHost,
|
|
||||||
t.`Db`,
|
|
||||||
t.`Table_name`,
|
|
||||||
t.`Grantor`,
|
|
||||||
MAX(t.`Timestamp`),
|
|
||||||
IFNULL(GROUP_CONCAT(NULLIF(t.`Table_priv`, '')), ''),
|
|
||||||
IFNULL(GROUP_CONCAT(NULLIF(t.`Column_priv`, '')), '')
|
|
||||||
FROM tRoleInherit r
|
|
||||||
JOIN mysql.tables_priv t
|
|
||||||
ON t.`User` = r.inheritsFrom
|
|
||||||
AND t.`Host`= vRoleHost
|
|
||||||
GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`;
|
|
||||||
|
|
||||||
-- Copy column level privileges
|
|
||||||
|
|
||||||
INSERT INTO mysql.columns_priv (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`Db`,
|
|
||||||
`Table_name`,
|
|
||||||
`Column_name`,
|
|
||||||
`Timestamp`,
|
|
||||||
`Column_priv`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
vTplHost,
|
|
||||||
t.`Db`,
|
|
||||||
t.`Table_name`,
|
|
||||||
t.`Column_name`,
|
|
||||||
MAX(t.`Timestamp`),
|
|
||||||
IFNULL(GROUP_CONCAT(NULLIF(t.`Column_priv`, '')), '')
|
|
||||||
FROM tRoleInherit r
|
|
||||||
JOIN mysql.columns_priv t
|
|
||||||
ON t.`User` = r.inheritsFrom
|
|
||||||
AND t.`Host`= vRoleHost
|
|
||||||
GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`, t.`Column_name`;
|
|
||||||
|
|
||||||
-- Copy routine privileges
|
|
||||||
|
|
||||||
INSERT IGNORE INTO mysql.procs_priv (
|
|
||||||
`User`,
|
|
||||||
`Host`,
|
|
||||||
`Db`,
|
|
||||||
`Routine_name`,
|
|
||||||
`Routine_type`,
|
|
||||||
`Grantor`,
|
|
||||||
`Timestamp`,
|
|
||||||
`Proc_priv`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
r.prefixedRole,
|
|
||||||
vTplHost,
|
|
||||||
t.`Db`,
|
|
||||||
t.`Routine_name`,
|
|
||||||
t.`Routine_type`,
|
|
||||||
t.`Grantor`,
|
|
||||||
t.`Timestamp`,
|
|
||||||
t.`Proc_priv`
|
|
||||||
FROM tRoleInherit r
|
|
||||||
JOIN mysql.procs_priv t
|
|
||||||
ON t.`User` = r.inheritsFrom
|
|
||||||
AND t.`Host`= vRoleHost;
|
|
||||||
|
|
||||||
-- Free memory
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tRole,
|
|
||||||
tRoleInherit;
|
|
||||||
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,36 +0,0 @@
|
||||||
ALTER TABLE account.sambaConfig ADD adUser VARCHAR(255) DEFAULT NULL NULL COMMENT 'Active directory user';
|
|
||||||
ALTER TABLE account.sambaConfig ADD adPassword varchar(255) DEFAULT NULL NULL COMMENT 'Active directory password';
|
|
||||||
ALTER TABLE account.sambaConfig ADD userDn varchar(255) DEFAULT NULL NULL COMMENT 'The base DN for users';
|
|
||||||
ALTER TABLE account.sambaConfig DROP COLUMN uidBase;
|
|
||||||
ALTER TABLE account.sambaConfig CHANGE sshPass sshPassword varchar(255) DEFAULT NULL NULL COMMENT 'The SSH password';
|
|
||||||
|
|
||||||
ALTER TABLE account.ldapConfig DROP COLUMN `filter`;
|
|
||||||
ALTER TABLE account.ldapConfig CHANGE baseDn userDn varchar(255) DEFAULT NULL NULL COMMENT 'The base DN to do the query';
|
|
||||||
ALTER TABLE account.ldapConfig CHANGE host server varchar(255) NOT NULL COMMENT 'The hostname of LDAP server';
|
|
||||||
ALTER TABLE account.ldapConfig MODIFY COLUMN password varchar(255) NOT NULL COMMENT 'The LDAP password';
|
|
||||||
|
|
||||||
-- Updated
|
|
||||||
|
|
||||||
ALTER TABLE account.sambaConfig DROP COLUMN sshUser;
|
|
||||||
ALTER TABLE account.sambaConfig DROP COLUMN sshPassword;
|
|
||||||
ALTER TABLE account.sambaConfig CHANGE host adController varchar(255) DEFAULT NULL NULL COMMENT 'The hosname of domain controller';
|
|
||||||
ALTER TABLE account.sambaConfig MODIFY COLUMN adController varchar(255) DEFAULT NULL NULL COMMENT 'The hosname of domain controller';
|
|
||||||
|
|
||||||
ALTER TABLE account.sambaConfig DROP COLUMN userDn;
|
|
||||||
ALTER TABLE account.sambaConfig ADD adDomain varchar(255) NOT NULL AFTER id;
|
|
||||||
ALTER TABLE account.sambaConfig ADD verifyCert TINYINT UNSIGNED NOT NULL DEFAULT TRUE AFTER adPassword;
|
|
||||||
ALTER TABLE account.sambaConfig MODIFY COLUMN adController varchar(255) NOT NULL COMMENT 'The hosname of domain controller';
|
|
||||||
|
|
||||||
ALTER TABLE account.user
|
|
||||||
ADD COLUMN `realm` varchar(512) CHARACTER SET utf8 DEFAULT NULL AFTER id,
|
|
||||||
ADD COLUMN `emailVerified` tinyint(1) DEFAULT NULL AFTER email,
|
|
||||||
ADD COLUMN `verificationToken` varchar(512) DEFAULT NULL AFTER emailVerified;
|
|
||||||
|
|
||||||
DROP TABLE salix.user;
|
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW salix.User
|
|
||||||
AS SELECT id, realm, name AS username, bcryptPassword AS password, email, emailVerified, verificationToken
|
|
||||||
FROM account.user;
|
|
||||||
|
|
||||||
ALTER TABLE account.`user`
|
|
||||||
MODIFY COLUMN bcryptPassword varchar(512) DEFAULT NULL NULL;
|
|
|
@ -1,20 +0,0 @@
|
||||||
CREATE TABLE `vn`.`supplierLog` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`originFk` int(11) NOT NULL,
|
|
||||||
`userFk` int(10) unsigned NOT NULL,
|
|
||||||
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
|
||||||
`description` text CHARACTER SET utf8 DEFAULT NULL,
|
|
||||||
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`changedModelId` int(11) DEFAULT NULL,
|
|
||||||
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `logSupplier_ibfk_1` (`originFk`),
|
|
||||||
KEY `supplierLog_ibfk_2` (`userFk`),
|
|
||||||
CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
CREATE TABLE `vn`.`supplierContact` (
|
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`supplierFk` INT(11) NULL DEFAULT NULL,
|
|
||||||
`phone` VARCHAR(16) NULL DEFAULT NULL,
|
|
||||||
`mobile` VARCHAR(16) NULL DEFAULT NULL,
|
|
||||||
`email` VARCHAR(255) NULL DEFAULT NULL,
|
|
||||||
`observation` TEXT NULL DEFAULT NULL,
|
|
||||||
`name` VARCHAR(255) NULL DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`))
|
|
||||||
ENGINE = InnoDB;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`supplierContact`
|
|
||||||
ADD CONSTRAINT `supplier_id`
|
|
||||||
FOREIGN KEY (`supplierFk`)
|
|
||||||
REFERENCES `vn`.`supplier` (`id`)
|
|
||||||
ON DELETE CASCADE
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
INSERT INTO vn.supplierContact(supplierFk,phone,mobile,email,observation,`name`)
|
|
||||||
SELECT r.Id_Proveedor,c.Telefono,c.Movil,c.email,c.Notas,concat(c.Nombre," ", IFNULL(c.Apellidos,""))
|
|
||||||
FROM vn2008.Contactos c
|
|
||||||
JOIN vn2008.Relaciones r ON r.Id_Contacto = c.Id_Contacto
|
|
||||||
JOIN vn.supplier s ON s.id = r.Id_Proveedor;
|
|
|
@ -1,25 +0,0 @@
|
||||||
DROP TRIGGER IF EXISTS `vn`.`ticket_afterUpdate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` TRIGGER `ticket_afterUpdate`
|
|
||||||
AFTER UPDATE ON `ticket`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF !(NEW.id <=> OLD.id)
|
|
||||||
OR !(NEW.warehouseFk <=> OLD.warehouseFk)
|
|
||||||
OR !(NEW.shipped <=> OLD.shipped) THEN
|
|
||||||
CALL stock.log_add('ticket', NEW.id, OLD.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NEW.clientFk = 2067 AND !(NEW.clientFk <=> OLD.clientFk) THEN
|
|
||||||
-- Fallo que se insertan no se sabe como tickets en este cliente
|
|
||||||
INSERT INTO vn.mail SET
|
|
||||||
`sender` = 'jgallego@verdnatura.es',
|
|
||||||
`replyTo` = 'jgallego@verdnatura.es',
|
|
||||||
`subject` = 'Modificado ticket al cliente 2067',
|
|
||||||
`body` = CONCAT(account.myUserGetName(), ' ha modificado el ticket ',
|
|
||||||
NEW.id);
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,107 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_componentPreview`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentPreview`(
|
|
||||||
vTicketFk INT,
|
|
||||||
vLanded DATE,
|
|
||||||
vAddressFk INT,
|
|
||||||
vZoneFk INT,
|
|
||||||
vWarehouseFk SMALLINT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Calcula los componentes de los articulos de un ticket
|
|
||||||
*
|
|
||||||
* @param vTicketFk id del ticket
|
|
||||||
* @param vLanded nueva fecha de entrega
|
|
||||||
* @param vAddressFk nuevo consignatario
|
|
||||||
* @param vZoneFk nueva zona
|
|
||||||
* @param vWarehouseFk nuevo warehouse
|
|
||||||
*
|
|
||||||
* @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
*/
|
|
||||||
DECLARE vHasDataChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasAddressChanged BOOL;
|
|
||||||
DECLARE vHasZoneChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vAddressTypeRateFk INT DEFAULT NULL;
|
|
||||||
DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL;
|
|
||||||
|
|
||||||
DECLARE vHasChangeAll BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
SELECT DATE(landed) <> vLanded,
|
|
||||||
addressFk <> vAddressFk,
|
|
||||||
zoneFk <> vZoneFk,
|
|
||||||
warehouseFk <> vWarehouseFk
|
|
||||||
INTO
|
|
||||||
vHasDataChanged,
|
|
||||||
vHasAddressChanged,
|
|
||||||
vHasZoneChanged,
|
|
||||||
vHasWarehouseChanged
|
|
||||||
FROM vn.ticket t
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vHasDataChanged OR vHasWarehouseChanged THEN
|
|
||||||
SET vHasChangeAll = TRUE;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vHasAddressChanged THEN
|
|
||||||
SET vAddressTypeRateFk = 5;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vHasZoneChanged THEN
|
|
||||||
SET vAgencyModeTypeRateFk = 6;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped
|
|
||||||
FROM zone
|
|
||||||
WHERE id = vZoneFk;
|
|
||||||
|
|
||||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY (
|
|
||||||
SELECT
|
|
||||||
vWarehouseFk AS warehouseFk,
|
|
||||||
NULL AS available,
|
|
||||||
s.itemFk,
|
|
||||||
bu.buyFk,
|
|
||||||
vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
GROUP BY bu.warehouseFk, bu.itemFk);
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value
|
|
||||||
FROM saleComponent sc
|
|
||||||
JOIN sale s ON s.id = sc.saleFk
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN `component` c ON c.id = sc.componentFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
AND (c.isRenewable = FALSE
|
|
||||||
OR
|
|
||||||
(NOT vHasChangeAll
|
|
||||||
AND (NOT (c.typeFk <=> vAddressTypeRateFk
|
|
||||||
OR c.typeFk <=> vAgencyModeTypeRateFk))));
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentPreview
|
|
||||||
SELECT * FROM tmp.ticketComponent;
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
|
|
||||||
IF vShipped IS NULL THEN
|
|
||||||
CALL util.throw('NO_ZONE_AVAILABLE');
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'deliveryBoss' WHERE (`id` = '194');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '97');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '100');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '103');
|
|
||||||
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '202');
|
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Town', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Province', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierContact', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
|
|
|
@ -1,3 +0,0 @@
|
||||||
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '3');
|
|
||||||
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '5');
|
|
|
@ -1,5 +0,0 @@
|
||||||
|
|
||||||
ALTER TABLE `hedera`.`imageCollection`
|
|
||||||
ADD COLUMN `readRoleFk` VARCHAR(45) NULL DEFAULT NULL AFTER `column`;
|
|
||||||
|
|
||||||
update `hedera`.`imageCollection` set `readRoleFk` = 1;
|
|
|
@ -1,9 +0,0 @@
|
||||||
ALTER TABLE `vn`.`observationType`
|
|
||||||
ADD COLUMN `code` VARCHAR(45) NOT NULL AFTER `description`;
|
|
||||||
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'itemPicker' WHERE (`id` = '1');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'packager' WHERE (`id` = '2');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'salesPerson' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'administrative' WHERE (`id` = '5');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'weight' WHERE (`id` = '6');
|
|
||||||
UPDATE `vn`.`observationType` SET `code` = 'delivery' WHERE (`id` = '3');
|
|
|
@ -1,20 +0,0 @@
|
||||||
CREATE TABLE `vn`.`supplierLog` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`originFk` int(11) NOT NULL,
|
|
||||||
`userFk` int(10) unsigned NOT NULL,
|
|
||||||
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
|
||||||
`description` text CHARACTER SET utf8 DEFAULT NULL,
|
|
||||||
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`changedModelId` int(11) DEFAULT NULL,
|
|
||||||
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `logSupplier_ibfk_1` (`originFk`),
|
|
||||||
KEY `supplierLog_ibfk_2` (`userFk`),
|
|
||||||
CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
DROP TRIGGER IF EXISTS `vn`.`ticket_afterUpdate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` TRIGGER `ticket_afterUpdate`
|
|
||||||
AFTER UPDATE ON `ticket`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF !(NEW.id <=> OLD.id)
|
|
||||||
OR !(NEW.warehouseFk <=> OLD.warehouseFk)
|
|
||||||
OR !(NEW.shipped <=> OLD.shipped) THEN
|
|
||||||
CALL stock.log_add('ticket', NEW.id, OLD.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NEW.clientFk = 2067 AND !(NEW.clientFk <=> OLD.clientFk) THEN
|
|
||||||
-- Fallo que se insertan no se sabe como tickets en este cliente
|
|
||||||
INSERT INTO vn.mail SET
|
|
||||||
`sender` = 'jgallego@verdnatura.es',
|
|
||||||
`replyTo` = 'jgallego@verdnatura.es',
|
|
||||||
`subject` = 'Modificado ticket al cliente 2067',
|
|
||||||
`body` = CONCAT(account.myUserGetName(), ' ha modificado el ticket ',
|
|
||||||
NEW.id);
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,107 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_componentPreview`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentPreview`(
|
|
||||||
vTicketFk INT,
|
|
||||||
vLanded DATE,
|
|
||||||
vAddressFk INT,
|
|
||||||
vZoneFk INT,
|
|
||||||
vWarehouseFk SMALLINT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Calcula los componentes de los articulos de un ticket
|
|
||||||
*
|
|
||||||
* @param vTicketFk id del ticket
|
|
||||||
* @param vLanded nueva fecha de entrega
|
|
||||||
* @param vAddressFk nuevo consignatario
|
|
||||||
* @param vZoneFk nueva zona
|
|
||||||
* @param vWarehouseFk nuevo warehouse
|
|
||||||
*
|
|
||||||
* @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
*/
|
|
||||||
DECLARE vHasDataChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasAddressChanged BOOL;
|
|
||||||
DECLARE vHasZoneChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vAddressTypeRateFk INT DEFAULT NULL;
|
|
||||||
DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL;
|
|
||||||
|
|
||||||
DECLARE vHasChangeAll BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
SELECT DATE(landed) <> vLanded,
|
|
||||||
addressFk <> vAddressFk,
|
|
||||||
zoneFk <> vZoneFk,
|
|
||||||
warehouseFk <> vWarehouseFk
|
|
||||||
INTO
|
|
||||||
vHasDataChanged,
|
|
||||||
vHasAddressChanged,
|
|
||||||
vHasZoneChanged,
|
|
||||||
vHasWarehouseChanged
|
|
||||||
FROM vn.ticket t
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vHasDataChanged OR vHasWarehouseChanged THEN
|
|
||||||
SET vHasChangeAll = TRUE;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vHasAddressChanged THEN
|
|
||||||
SET vAddressTypeRateFk = 5;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vHasZoneChanged THEN
|
|
||||||
SET vAgencyModeTypeRateFk = 6;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped
|
|
||||||
FROM zone
|
|
||||||
WHERE id = vZoneFk;
|
|
||||||
|
|
||||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY (
|
|
||||||
SELECT
|
|
||||||
vWarehouseFk AS warehouseFk,
|
|
||||||
NULL AS available,
|
|
||||||
s.itemFk,
|
|
||||||
bu.buyFk,
|
|
||||||
vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
GROUP BY bu.warehouseFk, bu.itemFk);
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value
|
|
||||||
FROM saleComponent sc
|
|
||||||
JOIN sale s ON s.id = sc.saleFk
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN `component` c ON c.id = sc.componentFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
AND (c.isRenewable = FALSE
|
|
||||||
OR
|
|
||||||
(NOT vHasChangeAll
|
|
||||||
AND (NOT (c.typeFk <=> vAddressTypeRateFk
|
|
||||||
OR c.typeFk <=> vAgencyModeTypeRateFk))));
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentPreview
|
|
||||||
SELECT * FROM tmp.ticketComponent;
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
|
|
||||||
IF vShipped IS NULL THEN
|
|
||||||
CALL util.throw('NO_ZONE_AVAILABLE');
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
DROP PROCEDURE IF EXISTS `vn`.`timeControl_calculate`;
|
|
||||||
DELIMITER $$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
|
|
||||||
BEGIN
|
|
||||||
SET @vIsOdd := TRUE;
|
|
||||||
SET @vUser := NULL;
|
|
||||||
SET @vDated := NULL;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.timeControlCalculate
|
|
||||||
SELECT
|
|
||||||
userFk,
|
|
||||||
dated,
|
|
||||||
IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds,
|
|
||||||
SEC_TO_TIME(@timeWork ) timeWorkSexagesimal,
|
|
||||||
@timeWork / 3600 timeWorkDecimal,
|
|
||||||
timed
|
|
||||||
FROM (SELECT SUM(timeWork) timeWork,
|
|
||||||
userFk,
|
|
||||||
dated,
|
|
||||||
GROUP_CONCAT(DATE_FORMAT(sub.timed,"%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') timed
|
|
||||||
FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk),
|
|
||||||
IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE),
|
|
||||||
IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd),
|
|
||||||
IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed),
|
|
||||||
IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork,
|
|
||||||
IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated,
|
|
||||||
wtc.timed timed,
|
|
||||||
wtc.userFk,
|
|
||||||
direction
|
|
||||||
FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction
|
|
||||||
FROM workerTimeControl wtc
|
|
||||||
JOIN tmp.`user` w ON w.userFk = wtc.userFk
|
|
||||||
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
|
|
||||||
ORDER BY userFk, timed ASC
|
|
||||||
) wtc
|
|
||||||
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
|
|
||||||
) sub
|
|
||||||
GROUP BY userFk, dated
|
|
||||||
)sub2;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE `account`.`user`
|
|
||||||
ADD COLUMN `image` VARCHAR(255) NULL AFTER `password`;
|
|
|
@ -1,20 +0,0 @@
|
||||||
CREATE TABLE `vn`.supplierFreighter
|
|
||||||
(
|
|
||||||
supplierFk INT NOT NULL,
|
|
||||||
CONSTRAINT supplierFreighter_pk
|
|
||||||
PRIMARY KEY (supplierFk),
|
|
||||||
CONSTRAINT supplier_id_fk
|
|
||||||
FOREIGN KEY (supplierFk) REFERENCES supplier (id)
|
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (286);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (454);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (582);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (470);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (775);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (812);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1112);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1242);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1281);
|
|
||||||
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1765);
|
|
|
@ -1,7 +0,0 @@
|
||||||
ALTER TABLE `vn`.travel
|
|
||||||
DROP FOREIGN KEY travel_ibfk_4;
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.travel
|
|
||||||
ADD CONSTRAINT supplierFreighter_fk_4
|
|
||||||
FOREIGN KEY (cargoSupplierFk) REFERENCES supplierFreighter (supplierFk)
|
|
||||||
ON UPDATE CASCADE ON DELETE SET NULL;
|
|
|
@ -1,20 +0,0 @@
|
||||||
CREATE TABLE `vn`.continent
|
|
||||||
(
|
|
||||||
id TINYINT(4) AUTO_INCREMENT,
|
|
||||||
name VARCHAR(50) NOT NULL,
|
|
||||||
code VARCHAR(2) NOT NULL COLLATE utf8_general_ci,
|
|
||||||
CONSTRAINT continent_pk
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
)
|
|
||||||
COMMENT 'World continents';
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX continent_name_uindex
|
|
||||||
ON `vn`.continent (name);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO `vn`.continent (`name`, `code`)
|
|
||||||
VALUES
|
|
||||||
('Asia', 'AS'),
|
|
||||||
('América', 'AM'),
|
|
||||||
('África', 'AF'),
|
|
||||||
('Europa', 'EU'),
|
|
||||||
('Oceanía', 'OC');
|
|
|
@ -1,13 +0,0 @@
|
||||||
ALTER TABLE `vn`.`country`
|
|
||||||
ADD COLUMN `continentFk` TINYINT(4) NULL AFTER `ibanLength`,
|
|
||||||
ADD INDEX `continent_id_fk_idx` (`continentFk` ASC);
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`country`
|
|
||||||
ADD CONSTRAINT `continent_id_fk`
|
|
||||||
FOREIGN KEY (`continentFk`)
|
|
||||||
REFERENCES `vn`.`continent` (`id`)
|
|
||||||
ON DELETE NO ACTION
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
UPDATE `vn`.`country` SET `continentFk` = '2' WHERE (`id` = '11');
|
|
||||||
UPDATE `vn`.`country` SET `continentFk` = '2' WHERE (`id` = '13');
|
|
|
@ -1 +0,0 @@
|
||||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) VALUES ('Image', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
|
@ -1,14 +0,0 @@
|
||||||
CREATE TABLE `vn`.`entryObservation` (
|
|
||||||
id int NOT NULL AUTO_INCREMENT,
|
|
||||||
entryFk int NOT NULL,
|
|
||||||
observationTypeFk TINYINT(3) UNSIGNED,
|
|
||||||
description TEXT,
|
|
||||||
PRIMARY KEY (id),
|
|
||||||
CONSTRAINT entry_id_entryFk
|
|
||||||
FOREIGN KEY (entryFk) REFERENCES entry(id),
|
|
||||||
CONSTRAINT observationType_id_observationTypeFk
|
|
||||||
FOREIGN KEY (observationTypeFk) REFERENCES observationType(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`entryObservation`
|
|
||||||
ADD UNIQUE INDEX `entryFk_observationTypeFk_UNIQUE` (`entryFk` ASC,`observationTypeFk` ASC);
|
|
|
@ -1,135 +0,0 @@
|
||||||
-- DROP PROCEDURE `vn`.`clonTravelComplete`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE
|
|
||||||
DEFINER = root@`%` PROCEDURE `vn`.`travel_cloneWithEntries`(IN vTravelFk INT, IN vDateStart DATE, IN vDateEnd DATE,
|
|
||||||
IN vRef VARCHAR(255), OUT vNewTravelFk INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vEntryNew INT;
|
|
||||||
DECLARE vDone BOOLEAN DEFAULT FALSE;
|
|
||||||
DECLARE vAuxEntryFk INT;
|
|
||||||
DECLARE vRsEntry CURSOR FOR
|
|
||||||
SELECT e.id
|
|
||||||
FROM entry e
|
|
||||||
JOIN travel t
|
|
||||||
ON t.id = e.travelFk
|
|
||||||
WHERE e.travelFk = vTravelFk;
|
|
||||||
|
|
||||||
DECLARE vRsBuy CURSOR FOR
|
|
||||||
SELECT b.*
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e
|
|
||||||
ON b.entryFk = e.id
|
|
||||||
WHERE e.travelFk = vNewTravelFk and b.entryFk=vNewTravelFk
|
|
||||||
ORDER BY e.id;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg)
|
|
||||||
SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg
|
|
||||||
FROM travel
|
|
||||||
WHERE id = vTravelFk;
|
|
||||||
|
|
||||||
SET vNewTravelFk = LAST_INSERT_ID();
|
|
||||||
SET vDone = FALSE;
|
|
||||||
OPEN vRsEntry ;
|
|
||||||
FETCH vRsEntry INTO vAuxEntryFk;
|
|
||||||
|
|
||||||
WHILE NOT vDone DO
|
|
||||||
INSERT INTO entry (supplierFk,
|
|
||||||
ref,
|
|
||||||
isInventory,
|
|
||||||
isConfirmed,
|
|
||||||
isOrdered,
|
|
||||||
isRaid,
|
|
||||||
commission,
|
|
||||||
created,
|
|
||||||
evaNotes,
|
|
||||||
travelFk,
|
|
||||||
currencyFk,
|
|
||||||
companyFk,
|
|
||||||
gestDocFk,
|
|
||||||
invoiceInFk)
|
|
||||||
SELECT supplierFk,
|
|
||||||
ref,
|
|
||||||
isInventory,
|
|
||||||
isConfirmed,
|
|
||||||
isOrdered,
|
|
||||||
isRaid,
|
|
||||||
commission,
|
|
||||||
created,
|
|
||||||
evaNotes,
|
|
||||||
vNewTravelFk,
|
|
||||||
currencyFk,
|
|
||||||
companyFk,
|
|
||||||
gestDocFk,
|
|
||||||
invoiceInFk
|
|
||||||
FROM entry
|
|
||||||
WHERE id = vAuxEntryFk;
|
|
||||||
|
|
||||||
SET vEntryNew = LAST_INSERT_ID();
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO buy (entryFk,
|
|
||||||
itemFk,
|
|
||||||
quantity,
|
|
||||||
buyingValue,
|
|
||||||
packageFk,
|
|
||||||
stickers,
|
|
||||||
freightValue,
|
|
||||||
packageValue,
|
|
||||||
comissionValue,
|
|
||||||
packing,
|
|
||||||
`grouping`,
|
|
||||||
groupingMode,
|
|
||||||
location,
|
|
||||||
price1,
|
|
||||||
price2,
|
|
||||||
price3,
|
|
||||||
minPrice,
|
|
||||||
producer,
|
|
||||||
printedStickers,
|
|
||||||
isChecked,
|
|
||||||
weight)
|
|
||||||
SELECT vEntryNew,
|
|
||||||
itemFk,
|
|
||||||
quantity,
|
|
||||||
buyingValue,
|
|
||||||
packageFk,
|
|
||||||
stickers,
|
|
||||||
freightValue,
|
|
||||||
packageValue,
|
|
||||||
comissionValue,
|
|
||||||
packing,
|
|
||||||
`grouping`,
|
|
||||||
groupingMode,
|
|
||||||
location,
|
|
||||||
price1,
|
|
||||||
price2,
|
|
||||||
price3,
|
|
||||||
minPrice,
|
|
||||||
producer,
|
|
||||||
printedStickers,
|
|
||||||
isChecked,
|
|
||||||
weight
|
|
||||||
FROM buy
|
|
||||||
WHERE entryFk = vAuxEntryFk;
|
|
||||||
|
|
||||||
|
|
||||||
FETCH vRsEntry INTO vAuxEntryFk;
|
|
||||||
END WHILE;
|
|
||||||
CLOSE vRsEntry;
|
|
||||||
COMMIT;
|
|
||||||
END;$$
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
CREATE TABLE `vn`.`zoneLog` (
|
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`originFk` int(10) NOT NULL,
|
|
||||||
`userFk` int(10) unsigned DEFAULT NULL,
|
|
||||||
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
|
||||||
`description` text CHARACTER SET utf8 DEFAULT NULL,
|
|
||||||
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
`changedModelId` int(11) DEFAULT NULL,
|
|
||||||
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `originFk` (`originFk`),
|
|
||||||
KEY `userFk` (`userFk`),
|
|
||||||
CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn`.`zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
|
@ -1,13 +0,0 @@
|
||||||
INSERT INTO account.role (id, name, description)
|
|
||||||
VALUES
|
|
||||||
(74, 'userPhotos', 'Privilegios para subir fotos de usuario'),
|
|
||||||
(75, 'catalogPhotos', 'Privilegios para subir fotos del catálogo');
|
|
||||||
|
|
||||||
INSERT INTO account.roleInherit (role, inheritsFrom)
|
|
||||||
VALUES
|
|
||||||
(37, (SELECT id FROM account.role WHERE name = 'userPhotos')),
|
|
||||||
(51, (SELECT id FROM account.role WHERE name = 'userPhotos')),
|
|
||||||
(51, (SELECT id FROM account.role WHERE name = 'catalogPhotos')),
|
|
||||||
(35, (SELECT id FROM account.role WHERE name = 'catalogPhotos'));
|
|
||||||
|
|
||||||
CALL account.role_sync();
|
|
|
@ -1,27 +0,0 @@
|
||||||
ALTER TABLE `hedera`.`imageCollection`
|
|
||||||
ADD writeRoleFk INT UNSIGNED NULL DEFAULT 1;
|
|
||||||
|
|
||||||
ALTER TABLE `hedera`.`imageCollection`
|
|
||||||
ADD CONSTRAINT role_id_writeRoleFk
|
|
||||||
FOREIGN KEY (writeRoleFk) REFERENCES account.role (id)
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
ALTER TABLE `hedera`.`imageCollection` modify readRoleFk INT UNSIGNED default 1 null;
|
|
||||||
|
|
||||||
ALTER TABLE `hedera`.`imageCollection`
|
|
||||||
ADD CONSTRAINT role_id_readRoleFk
|
|
||||||
FOREIGN KEY (readRoleFk) REFERENCES account.role (id)
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
UPDATE hedera.imageCollection t SET t.writeRoleFk = (
|
|
||||||
SELECT id FROM `account`.`role` WHERE name = 'catalogPhotos'
|
|
||||||
)
|
|
||||||
WHERE t.name = 'catalog';
|
|
||||||
|
|
||||||
UPDATE hedera.imageCollection t SET t.writeRoleFk = (
|
|
||||||
SELECT id FROM `account`.`role` WHERE name = 'userPhotos'
|
|
||||||
)
|
|
||||||
WHERE t.name = 'user';
|
|
||||||
|
|
||||||
UPDATE hedera.imageCollection t SET t.writeRoleFk = 9
|
|
||||||
WHERE t.name IN ('link', 'news');
|
|
|
@ -1,19 +0,0 @@
|
||||||
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 ;
|
|
|
@ -1,6 +0,0 @@
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
|
||||||
VALUES
|
|
||||||
('FixedPrice', '*', '*', 'ALLOW', 'ROLE', 'buyer'),
|
|
||||||
('PayDem', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
|
||||||
('Client', 'createReceipt', '*', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('PrintServerQueue', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
|
@ -1,82 +0,0 @@
|
||||||
DROP PROCEDURE IF EXISTS vn.ledger_doCompensation;
|
|
||||||
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ledger_doCompensation`(vDated DATE, vCompensationAccount VARCHAR(10) , vBankFk VARCHAR(10), vConcept VARCHAR(255), vAmount DECIMAL(10,2), vCompanyFk INT, vOriginalAccount VARCHAR(10))
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Compensa un pago o un recibo insertando en contabilidad
|
|
||||||
*
|
|
||||||
* @param vDated fecha en la cual se anota
|
|
||||||
* @param vCompensationAccount cuenta contable contra la que se compensa
|
|
||||||
* @param vBankFk banco de la compensacion
|
|
||||||
* @param vConcept descripcion
|
|
||||||
* @param vAmount cantidad que se compensa
|
|
||||||
* @param vCompany empresa
|
|
||||||
* @param vOriginalAccount cuenta contable desde la cual se compensa
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
DECLARE vNewBookEntry INT;
|
|
||||||
DECLARE vIsClientCompensation INT;
|
|
||||||
DECLARE vClientFk INT;
|
|
||||||
DECLARE vSupplierFk INT;
|
|
||||||
DECLARE vIsOriginalAClient BOOL;
|
|
||||||
DECLARE vPayMethodCompensation INT;
|
|
||||||
|
|
||||||
CALL ledger_next(vNewBookEntry);
|
|
||||||
|
|
||||||
SELECT COUNT(id) INTO vIsOriginalAClient FROM client WHERE accountingAccount LIKE vOriginalAccount COLLATE utf8_general_ci;
|
|
||||||
|
|
||||||
SELECT id, COUNT(id) INTO vClientFk, vIsClientCompensation
|
|
||||||
FROM client
|
|
||||||
WHERE accountingAccount LIKE vCompensationAccount COLLATE utf8_general_ci;
|
|
||||||
|
|
||||||
SET @vAmount1:= 0.0;
|
|
||||||
SET @vAmount2:= 0.0;
|
|
||||||
|
|
||||||
INSERT INTO XDiario (ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, empresa_id)
|
|
||||||
VALUES ( vNewBookEntry,
|
|
||||||
vDated,
|
|
||||||
vOriginalAccount,
|
|
||||||
vCompensationAccount,
|
|
||||||
vConcept,
|
|
||||||
@vAmount1:= IF(
|
|
||||||
(vIsOriginalAClient OR NOT vIsOriginalAClient)
|
|
||||||
AND vAmount > 0,
|
|
||||||
0,
|
|
||||||
ABS(vAmount)
|
|
||||||
),
|
|
||||||
@vAmount2:= IF(@vAmount1,
|
|
||||||
0,
|
|
||||||
ABS(vAmount)
|
|
||||||
),
|
|
||||||
vCompanyFk
|
|
||||||
),
|
|
||||||
( vNewBookEntry,
|
|
||||||
vDated,
|
|
||||||
vCompensationAccount,
|
|
||||||
vOriginalAccount,
|
|
||||||
vConcept,
|
|
||||||
@vAmount2,
|
|
||||||
@vAmount1,
|
|
||||||
vCompanyFk);
|
|
||||||
|
|
||||||
IF vIsClientCompensation THEN
|
|
||||||
IF vIsOriginalAClient THEN
|
|
||||||
SET vAmount = -vAmount;
|
|
||||||
END IF;
|
|
||||||
INSERT INTO receipt(invoiceFk, amountPaid, payed, bankFk, companyFk, clientFk, isConciliate)
|
|
||||||
VALUES (vConcept, vAmount, vDated, vBankFk, vCompanyFk, vClientFk, TRUE);
|
|
||||||
ELSE
|
|
||||||
IF NOT vIsOriginalAClient THEN
|
|
||||||
SET vAmount = -vAmount;
|
|
||||||
END IF;
|
|
||||||
SELECT id INTO vSupplierFk FROM supplier WHERE `account` LIKE vCompensationAccount COLLATE utf8_general_ci;
|
|
||||||
SELECT id INTO vPayMethodCompensation FROM payMethod WHERE `code` = 'compensation';
|
|
||||||
|
|
||||||
INSERT INTO payment (received, dueDated, supplierFk, amount, bankFk, payMethodFk, concept, companyFk, isConciliated)
|
|
||||||
VALUES(vDated, vDated, vSupplierFk, vAmount, vBankFk, vPayMethodCompensation, vConcept, vCompanyFk, TRUE);
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,17 +0,0 @@
|
||||||
DROP TRIGGER IF EXISTS vn.receipt_beforInsert;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
$$
|
|
||||||
CREATE TRIGGER receipt_beforInsert
|
|
||||||
BEFORE INSERT
|
|
||||||
ON receipt FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SELECT isAutoConciliated INTO @isAutoConciliated
|
|
||||||
FROM accounting a
|
|
||||||
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
|
||||||
WHERE a.id =NEW.bankFk;
|
|
||||||
|
|
||||||
SET NEW.isConciliate = @isAutoConciliated;
|
|
||||||
END
|
|
||||||
$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,4 +1,5 @@
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
VALUES
|
VALUES
|
||||||
('SupplierAccount', '*', '*', 'ALLOW', 'ROLE', 'administrative'),
|
('SupplierAccount', '*', '*', 'ALLOW', 'ROLE', 'administrative'),
|
||||||
('Entry', '*', '*', 'ALLOW', 'ROLE', 'administrative');
|
('Entry', '*', '*', 'ALLOW', 'ROLE', 'administrative'),
|
||||||
|
('InvoiceIn', '*', '*', 'ALLOW', 'ROLE', 'administrative');
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1246,11 +1246,6 @@ INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email
|
||||||
(3, 2, 321654987, NULL, 'supplier2@email.es', NULL, NULL),
|
(3, 2, 321654987, NULL, 'supplier2@email.es', NULL, NULL),
|
||||||
(4, 442, 321654987, NULL, NULL, 'observation442', NULL);
|
(4, 442, 321654987, NULL, NULL, 'observation442', NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierFreighter` (`supplierFk`)
|
|
||||||
VALUES
|
|
||||||
(1),
|
|
||||||
(2);
|
|
||||||
|
|
||||||
INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`)
|
INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 2, 'available', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL),
|
(1, 2, 'available', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL),
|
||||||
|
@ -2175,3 +2170,69 @@ INSERT INTO `hedera`.`image`(`collectionFk`, `name`)
|
||||||
INSERT INTO `hedera`.`imageCollectionSize`(`id`, `collectionFk`,`width`, `height`)
|
INSERT INTO `hedera`.`imageCollectionSize`(`id`, `collectionFk`,`width`, `height`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 4, 160, 160);
|
(1, 4, 160, 160);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
|
||||||
|
VALUES
|
||||||
|
(1, '07546501420', 67, 671, CURDATE(), 1761, 1, 1),
|
||||||
|
(2, '07546491421', 252, 2769, CURDATE(), 5231, 1, 1),
|
||||||
|
(3, '07546500823', 102, 1495, CURDATE(), 3221, 1, 1),
|
||||||
|
(4, '99610288821', 252, 2777, CURDATE(), 3641, 1, 1),
|
||||||
|
(5, '07546500834', 229, 3292, CURDATE(), 6601, 2, 1),
|
||||||
|
(6, '22101929561', 37, 458, CURDATE(), 441, 2, 1),
|
||||||
|
(7, '07546491432', 258, 3034, CURDATE(), 6441, 2, 1),
|
||||||
|
(8, '99610288644', 476, 4461, CURDATE(), 5751, 442, 1),
|
||||||
|
(9, '99610289193', 302, 2972, CURDATE(), 3871, 442, 1),
|
||||||
|
(10, '07546500856', 185, 2364, CURDATE(), 5321, 442, 1);
|
||||||
|
|
||||||
|
REPLACE INTO vn.dua (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
|
||||||
carlosjr marked this conversation as resolved
|
|||||||
|
VALUES
|
||||||
|
(1, '19ES0028013A481523', 1, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 1, 11276.95, 442),
|
||||||
|
(2, '21ES00280136115760', 2, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 1376.20, 442),
|
||||||
|
(3, '19ES00280131956004', 3, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 3, 14268.50, 442),
|
||||||
|
(4, '19ES00280131955995', 4, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 1, 8242.50, 442),
|
||||||
|
(5, '19ES00280132022070', 5, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 10012.49, 442),
|
||||||
|
(6, '19ES00280132032308', 6, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 19914.25, 442),
|
||||||
|
(7, '19ES00280132025489', 7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 1934.06, 442),
|
||||||
|
(8, '19ES00280132025489', 8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 3618.52, 442),
|
||||||
|
(9, '19ES00280132025489', 9, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 7126.23, 442),
|
||||||
|
(10, '19ES00280132025489', 10, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 4631.45, 442);
|
||||||
|
|
||||||
|
REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issued`, `created`, `supplierRef`, `isBooked`, `companyFk`, `docFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 1001, 'R', 1, CURDATE(), CURDATE(), 1234, 0, 442, 1),
|
||||||
|
(2, 1002, 'R', 1, CURDATE(), CURDATE(), 1235, 1, 442, 1),
|
||||||
|
(3, 1003, 'R', 1, CURDATE(), CURDATE(), 1236, 0, 442, 1),
|
||||||
|
(4, 1004, 'R', 1, CURDATE(), CURDATE(), 1237, 0, 442, 1),
|
||||||
|
(5, 1005, 'R', 1, CURDATE(), CURDATE(), 1238, 1, 442, 1),
|
||||||
|
(6, 1006, 'R', 2, CURDATE(), CURDATE(), 1239, 0, 442, 1),
|
||||||
|
(7, 1007, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1240, 1, 442, 1),
|
||||||
|
(8, 1008, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1241, 1, 442, 1),
|
||||||
|
(9, 1009, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1242, 1, 442, 1),
|
||||||
|
(10, 1010, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1243, 1, 442, 1);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`invoiceInDueDay`(`invoiceInFk`, `dueDated`, `bankFk`, `amount`)
|
||||||
|
VALUES
|
||||||
|
(1, CURDATE(), 1, 237),
|
||||||
|
(1, CURDATE(), 1, 15.25),
|
||||||
|
(2, CURDATE(), 1, 168),
|
||||||
|
(2, CURDATE(), 1, 55.17),
|
||||||
|
(3, CURDATE(), 1, 87.95),
|
||||||
|
(3, CURDATE(), 1, 7.65),
|
||||||
|
(4, CURDATE(), 1, 373.27),
|
||||||
|
(4, CURDATE(), 1, 73.36),
|
||||||
|
(5, CURDATE(), 1, 64.23),
|
||||||
|
(6, CURDATE(), 1, 32.95),
|
||||||
|
(7, CURDATE(), 1, 58.64);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 1, 1),
|
||||||
|
(2, 2, 2),
|
||||||
|
(3, 3, 3),
|
||||||
|
(4, 4, 4),
|
||||||
|
(5, 5, 5),
|
||||||
|
(6, 6, 6),
|
||||||
|
(7, 7, 7),
|
||||||
|
(8, 8, 8),
|
||||||
|
(9, 9, 9),
|
||||||
|
(10, 10, 10);
|
10813
db/dump/structure.sql
10813
db/dump/structure.sql
File diff suppressed because it is too large
Load Diff
|
@ -39,9 +39,12 @@ TABLES=(
|
||||||
vn
|
vn
|
||||||
alertLevel
|
alertLevel
|
||||||
bookingPlanner
|
bookingPlanner
|
||||||
|
cplusInvoiceType472
|
||||||
cplusInvoiceType477
|
cplusInvoiceType477
|
||||||
|
cplusRectificationType
|
||||||
cplusSubjectOp
|
cplusSubjectOp
|
||||||
cplusTaxBreak
|
cplusTaxBreak
|
||||||
|
cplusTrascendency472
|
||||||
pgc
|
pgc
|
||||||
time
|
time
|
||||||
claimResponsible
|
claimResponsible
|
||||||
|
@ -54,6 +57,7 @@ TABLES=(
|
||||||
department
|
department
|
||||||
component
|
component
|
||||||
componentType
|
componentType
|
||||||
|
continent
|
||||||
)
|
)
|
||||||
dump_tables ${TABLES[@]}
|
dump_tables ${TABLES[@]}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ IGNORETABLES=(
|
||||||
--ignore-table=vn.agencyModeZone
|
--ignore-table=vn.agencyModeZone
|
||||||
--ignore-table=vn.agencyProvince
|
--ignore-table=vn.agencyProvince
|
||||||
--ignore-table=vn.agencyWarehouse
|
--ignore-table=vn.agencyWarehouse
|
||||||
--ignore-table=vn.awb
|
|
||||||
--ignore-table=vn.botanicExport__
|
--ignore-table=vn.botanicExport__
|
||||||
--ignore-table=vn.clientDefaultCompany
|
--ignore-table=vn.clientDefaultCompany
|
||||||
--ignore-table=vn.color
|
--ignore-table=vn.color
|
||||||
|
@ -39,6 +38,7 @@ IGNORETABLES=(
|
||||||
--ignore-table=vn.comparativeFilter
|
--ignore-table=vn.comparativeFilter
|
||||||
--ignore-table=vn.coolerPath
|
--ignore-table=vn.coolerPath
|
||||||
--ignore-table=vn.coolerPathDetail
|
--ignore-table=vn.coolerPathDetail
|
||||||
|
--ignore-table=vn.config__
|
||||||
--ignore-table=vn.department__
|
--ignore-table=vn.department__
|
||||||
--ignore-table=vn.doc
|
--ignore-table=vn.doc
|
||||||
--ignore-table=vn.entity
|
--ignore-table=vn.entity
|
||||||
|
@ -49,13 +49,8 @@ IGNORETABLES=(
|
||||||
--ignore-table=vn.grant
|
--ignore-table=vn.grant
|
||||||
--ignore-table=vn.grantGroup
|
--ignore-table=vn.grantGroup
|
||||||
--ignore-table=vn.invoiceCorrection__
|
--ignore-table=vn.invoiceCorrection__
|
||||||
--ignore-table=vn.invoiceIn
|
|
||||||
--ignore-table=vn.invoiceInAwb
|
|
||||||
--ignore-table=vn.invoiceInDueDay
|
|
||||||
--ignore-table=vn.invoiceInEntry
|
|
||||||
--ignore-table=vn.invoiceInIntrastat
|
|
||||||
--ignore-table=vn.invoiceInTax
|
|
||||||
--ignore-table=vn.itemTaxCountrySpain
|
--ignore-table=vn.itemTaxCountrySpain
|
||||||
|
--ignore-table=vn.itemFreeNumber__
|
||||||
--ignore-table=vn.mail__
|
--ignore-table=vn.mail__
|
||||||
--ignore-table=vn.manaSpellers
|
--ignore-table=vn.manaSpellers
|
||||||
--ignore-table=vn.outgoingInvoiceKk
|
--ignore-table=vn.outgoingInvoiceKk
|
||||||
|
@ -69,7 +64,6 @@ IGNORETABLES=(
|
||||||
--ignore-table=vn.printingQueue
|
--ignore-table=vn.printingQueue
|
||||||
--ignore-table=vn.printServerQueue__
|
--ignore-table=vn.printServerQueue__
|
||||||
--ignore-table=vn.promissoryNote
|
--ignore-table=vn.promissoryNote
|
||||||
--ignore-table=vn.rate
|
|
||||||
--ignore-table=vn.referenceRate__
|
--ignore-table=vn.referenceRate__
|
||||||
--ignore-table=vn.routesControl
|
--ignore-table=vn.routesControl
|
||||||
--ignore-table=vn.salesToPrePrepare
|
--ignore-table=vn.salesToPrePrepare
|
||||||
|
@ -78,6 +72,7 @@ IGNORETABLES=(
|
||||||
--ignore-table=vn.ticketeToPreparePrepared
|
--ignore-table=vn.ticketeToPreparePrepared
|
||||||
--ignore-table=vn.ticketObservation__
|
--ignore-table=vn.ticketObservation__
|
||||||
--ignore-table=vn.ticketRequest__
|
--ignore-table=vn.ticketRequest__
|
||||||
|
--ignore-table=vn.ticket_print__
|
||||||
--ignore-table=vn.ticketToPrepare
|
--ignore-table=vn.ticketToPrepare
|
||||||
--ignore-table=vn.till__
|
--ignore-table=vn.till__
|
||||||
--ignore-table=vn.travelThermograph__
|
--ignore-table=vn.travelThermograph__
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default class Contextmenu {
|
||||||
if (!event.defaultPrevented)
|
if (!event.defaultPrevented)
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (!this.isFilterEnabled()) return;
|
if (!this.isMenuEnabled()) return;
|
||||||
|
|
||||||
const parent = this.$.contextmenu;
|
const parent = this.$.contextmenu;
|
||||||
parent.style.top = event.pageY + 'px';
|
parent.style.top = event.pageY + 'px';
|
||||||
|
@ -121,13 +121,31 @@ export default class Contextmenu {
|
||||||
return isEnabled != 'false';
|
return isEnabled != 'false';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isMenuEnabled() {
|
||||||
|
if (!this.rowHeader) return true;
|
||||||
|
const isEnabled = this.rowHeader.getAttribute('menu-enabled');
|
||||||
|
|
||||||
|
return isEnabled != 'false';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if filter
|
* Returns true if filter
|
||||||
* by selection is allowed
|
* by selection is enabled and
|
||||||
|
* the menu can be interacted
|
||||||
*
|
*
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
isFilterAllowed() {
|
isFilterAllowed() {
|
||||||
|
return this.isActionAllowed() && this.isFilterEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the
|
||||||
|
* context menu can be interacted
|
||||||
|
*
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
isActionAllowed() {
|
||||||
if (!this.target) return false;
|
if (!this.target) return false;
|
||||||
const isTableCell = this.target.closest('vn-td, .vn-td');
|
const isTableCell = this.target.closest('vn-td, .vn-td');
|
||||||
|
|
||||||
|
@ -179,9 +197,13 @@ export default class Contextmenu {
|
||||||
if (!where) return;
|
if (!where) return;
|
||||||
|
|
||||||
const whereKeys = Object.keys(where);
|
const whereKeys = Object.keys(where);
|
||||||
for (let key of whereKeys)
|
for (let key of whereKeys) {
|
||||||
removeProp(where, filterKey, key);
|
removeProp(where, filterKey, key);
|
||||||
|
|
||||||
|
if (!Object.keys(where))
|
||||||
|
delete userFilter.where;
|
||||||
|
}
|
||||||
|
|
||||||
function removeProp(instance, findProp, prop) {
|
function removeProp(instance, findProp, prop) {
|
||||||
if (prop == findProp)
|
if (prop == findProp)
|
||||||
delete instance[prop];
|
delete instance[prop];
|
||||||
|
@ -208,6 +230,16 @@ export default class Contextmenu {
|
||||||
const userParams = this.model.userParams;
|
const userParams = this.model.userParams;
|
||||||
this.model.applyFilter(null, userParams);
|
this.model.applyFilter(null, userParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the current field
|
||||||
|
* value to the clipboard
|
||||||
|
*/
|
||||||
|
copyValue() {
|
||||||
|
const cell = angular.element(this.cell);
|
||||||
|
if (navigator && navigator.clipboard)
|
||||||
|
navigator.clipboard.writeText(cell.text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Contextmenu.$inject = ['$element', '$scope', '$transclude'];
|
Contextmenu.$inject = ['$element', '$scope', '$transclude'];
|
||||||
|
|
|
@ -16,6 +16,7 @@ export default function moduleImport(moduleName) {
|
||||||
case 'travel' : return import('travel/front');
|
case 'travel' : return import('travel/front');
|
||||||
case 'worker' : return import('worker/front');
|
case 'worker' : return import('worker/front');
|
||||||
case 'invoiceOut' : return import('invoiceOut/front');
|
case 'invoiceOut' : return import('invoiceOut/front');
|
||||||
|
case 'invoiceIn' : return import('invoiceIn/front');
|
||||||
case 'route' : return import('route/front');
|
case 'route' : return import('route/front');
|
||||||
case 'entry' : return import('entry/front');
|
case 'entry' : return import('entry/front');
|
||||||
case 'account' : return import('account/front');
|
case 'account' : return import('account/front');
|
||||||
|
|
|
@ -43,6 +43,7 @@ Workers: Trabajadores
|
||||||
Routes: Rutas
|
Routes: Rutas
|
||||||
Locator: Localizador
|
Locator: Localizador
|
||||||
Invoices out: Facturas emitidas
|
Invoices out: Facturas emitidas
|
||||||
|
Invoices in: Fact. recibidas
|
||||||
Entries: Entradas
|
Entries: Entradas
|
||||||
Users: Usuarios
|
Users: Usuarios
|
||||||
Suppliers: Proveedores
|
Suppliers: Proveedores
|
||||||
|
|
|
@ -6,6 +6,7 @@ import './modules/zone/front/module.js';
|
||||||
import './modules/claim/front/module.js';
|
import './modules/claim/front/module.js';
|
||||||
import './modules/client/front/module.js';
|
import './modules/client/front/module.js';
|
||||||
import './modules/invoiceOut/front/module.js';
|
import './modules/invoiceOut/front/module.js';
|
||||||
|
import './modules/invoiceIn/front/module.js';
|
||||||
import './modules/item/front/module.js';
|
import './modules/item/front/module.js';
|
||||||
import './modules/order/front/module.js';
|
import './modules/order/front/module.js';
|
||||||
import './modules/route/front/module.js';
|
import './modules/route/front/module.js';
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
|
||||||
|
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', {
|
||||||
|
description: 'Find all instances of the model matched by filter from the data source.',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
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: 'Searchs the invoiceOut by id',
|
||||||
|
http: {source: 'query'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'supplierRef',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The supplier reference'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'fi',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The supplier fiscal id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'serialNumber',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The serial number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'serial',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The serial'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'amount',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The amount'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'from',
|
||||||
|
type: 'date',
|
||||||
|
description: `The from date filter`
|
||||||
|
}, {
|
||||||
|
arg: 'to',
|
||||||
|
type: 'date',
|
||||||
|
description: `The to date filter`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'issued',
|
||||||
|
type: 'date',
|
||||||
|
description: 'The issued date'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'account',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The account number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'awbCode',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The Air Waybill code'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'isBooked',
|
||||||
|
type: 'boolean',
|
||||||
|
description: 'Whether the the invoice is booked or not',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
returns: {
|
||||||
|
type: ['object'],
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/filter`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.filter = async(ctx, filter) => {
|
||||||
|
const conn = Self.dataSource.connector;
|
||||||
|
const args = ctx.args;
|
||||||
|
|
||||||
|
if (args && args.to) {
|
||||||
|
const dateTo = args.to;
|
||||||
|
dateTo.setHours(23, 59, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
let where = buildFilter(ctx.args, (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? {'ii.id': value}
|
||||||
|
: {'s.name': {like: `%${value}%`}};
|
||||||
|
case 'from':
|
||||||
|
return {'ii.created': {gte: value}};
|
||||||
|
case 'to':
|
||||||
|
return {'ii.created': {lte: value}};
|
||||||
|
case 'account':
|
||||||
|
case 'fi':
|
||||||
|
return {[`s.${param}`]: value};
|
||||||
|
case 'supplierRef':
|
||||||
|
case 'serialNumber':
|
||||||
|
case 'serial':
|
||||||
|
case 'issued':
|
||||||
|
case 'isBooked':
|
||||||
|
return {[`ii.${param}`]: value};
|
||||||
|
case 'awbCode':
|
||||||
|
return {'awb.code': value};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
filter = mergeFilters(filter, {where});
|
||||||
|
|
||||||
|
let stmts = [];
|
||||||
|
let stmt;
|
||||||
|
|
||||||
|
stmt = new ParameterizedSQL(
|
||||||
|
`SELECT
|
||||||
|
ii.id,
|
||||||
|
ii.serialNumber,
|
||||||
|
ii.serial,
|
||||||
|
ii.issued,
|
||||||
|
ii.isBooked,
|
||||||
|
ii.supplierRef,
|
||||||
|
ii.docFk AS dmsFk,
|
||||||
|
s.id AS supplierFk,
|
||||||
|
s.name AS supplierName,
|
||||||
|
s.account,
|
||||||
|
SUM(iid.amount) AS amount,
|
||||||
|
awb.code AS awbCode
|
||||||
|
FROM invoiceIn ii
|
||||||
|
JOIN supplier s ON s.id = ii.supplierFk
|
||||||
|
LEFT JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id
|
||||||
|
LEFT JOIN duaInvoiceIn dii ON dii.invoiceInFk = ii.id
|
||||||
|
LEFT JOIN dua d ON d.id = dii.duaFk
|
||||||
|
LEFT JOIN awb ON awb.id = d.awbFk
|
||||||
|
LEFT JOIN company co ON co.id = ii.companyFk`
|
||||||
|
);
|
||||||
|
|
||||||
|
const sqlWhere = conn.makeWhere(filter.where);
|
||||||
|
|
||||||
|
stmt.merge(sqlWhere);
|
||||||
|
stmt.merge(`GROUP BY ii.id`);
|
||||||
|
|
||||||
|
const amount = ctx.args.amount;
|
||||||
|
if (amount) {
|
||||||
|
stmt.merge({
|
||||||
|
sql: `HAVING SUM(iid.amount) = ?`,
|
||||||
|
params: [amount],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
stmt.merge(conn.makePagination(filter));
|
||||||
|
|
||||||
|
let itemsIndex = stmts.push(stmt) - 1;
|
||||||
|
|
||||||
|
let sql = ParameterizedSQL.join(stmts, ';');
|
||||||
|
let result = await conn.executeStmt(sql);
|
||||||
|
return itemsIndex === 0 ? result : result[itemsIndex];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
|
describe('InvoiceIn filter()', () => {
|
||||||
|
it('should return the invoice in matching supplier name', async() => {
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
search: 'Plants SL',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(5);
|
||||||
carlosjr marked this conversation as resolved
carlosjr
commented
if all results are the same perhaps usage of random if all results are the same perhaps usage of random
|
|||||||
|
expect(result[0].supplierName).toEqual('Plants SL');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the invoice in matching supplier reference', async() => {
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
supplierRef: '1241',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
expect(result[0].supplierRef).toEqual('1241');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the invoice in matching the serial number', async() => {
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
serialNumber: '1002',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
expect(result[0].serialNumber).toEqual(1002);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the invoice in matching the account', async() => {
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
account: '4000020002',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(5);
|
||||||
|
expect(result[0].account).toEqual('4000020002');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the invoice in matching the awb code', async() => {
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
awbCode: '07546491432',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
const firstRow = result[0];
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
expect(firstRow.id).toEqual(7);
|
||||||
|
expect(firstRow.awbCode).toEqual('07546491432');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the invoice in matching the amount', async() => {
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
amount: '64.23',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
expect(result[0].amount).toEqual(64.23);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the invoice in matching "from" and "to"', async() => {
|
||||||
|
const from = new Date();
|
||||||
|
const to = new Date();
|
||||||
|
from.setHours(0, 0, 0, 0);
|
||||||
|
to.setHours(23, 59, 59, 999);
|
||||||
|
to.setDate(to.getDate() + 1);
|
||||||
|
const ctx = {
|
||||||
|
args: {from, to}
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(6);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the booked invoice in', async() => {
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
isBooked: true,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = await app.models.InvoiceIn.filter(ctx);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(6);
|
||||||
|
expect(result[0].isBooked).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"InvoiceIn": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/invoice-in/filter')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,67 @@
|
||||||
|
{
|
||||||
|
"name": "InvoiceIn",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "invoiceIn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "Number",
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"serialNumber": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"serial": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"issued": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"isBooked": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"booked": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"operated": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"dmsFk": {
|
||||||
|
"type": "number",
|
||||||
|
"mysql": {
|
||||||
|
"columnName": "docFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"company": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Company",
|
||||||
|
"foreignKey": "companyFk"
|
||||||
|
},
|
||||||
|
"supplier": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Supplier",
|
||||||
|
"foreignKey": "supplierFk"
|
||||||
|
},
|
||||||
|
"currency": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Currency",
|
||||||
|
"foreignKey": "currencyFk"
|
||||||
|
},
|
||||||
|
"dms": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Dms",
|
||||||
|
"foreignKey": "dmsFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vn-portal slot="menu">
|
||||||
|
<vn-invoice-in-descriptor invoice-in="$ctrl.invoiceIn"></vn-invoice-in-descriptor>
|
||||||
|
<vn-left-menu source="card"></vn-left-menu>
|
||||||
|
</vn-portal>
|
||||||
|
<ui-view></ui-view>
|
|
@ -0,0 +1,17 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import ModuleCard from 'salix/components/module-card';
|
||||||
|
|
||||||
|
class Controller extends ModuleCard {
|
||||||
|
reload() {
|
||||||
|
const filter = {};
|
||||||
|
|
||||||
|
this.$http.get(`InvoiceIns/${this.$params.id}`, {filter})
|
||||||
|
.then(res => this.invoiceIn = res.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnInvoiceInCard', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import './index.js';
|
||||||
|
|
||||||
|
describe('vnInvoiceIn', () => {
|
||||||
|
let controller;
|
||||||
|
let $httpBackend;
|
||||||
|
let data = {id: 1, name: 'fooName'};
|
||||||
|
|
||||||
|
beforeEach(ngModule('invoiceIn'));
|
||||||
|
|
||||||
|
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
|
||||||
|
$httpBackend = _$httpBackend_;
|
||||||
|
|
||||||
|
let $element = angular.element('<div></div>');
|
||||||
|
controller = $componentController('vnInvoiceInCard', {$element});
|
||||||
|
|
||||||
|
$stateParams.id = data.id;
|
||||||
|
$httpBackend.whenRoute('GET', 'InvoiceIns/:id').respond(data);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should request data and set it on the controller', () => {
|
||||||
|
controller.reload();
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.invoiceIn).toEqual(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<slot-descriptor>
|
||||||
|
<vn-invoice-in-descriptor>
|
||||||
|
</vn-invoice-in-descriptor>
|
||||||
|
</slot-descriptor>
|
|
@ -0,0 +1,9 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import DescriptorPopover from 'salix/components/descriptor-popover';
|
||||||
|
|
||||||
|
class Controller extends DescriptorPopover {}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnInvoiceInDescriptorPopover', {
|
||||||
|
slotTemplate: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -0,0 +1,36 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Descriptor from 'salix/components/descriptor';
|
||||||
|
|
||||||
|
class Controller extends Descriptor {
|
||||||
|
get invoiceIn() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
set invoiceIn(value) {
|
||||||
|
this.entity = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadData() {
|
||||||
|
const filter = {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'company',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'code']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.getData(`InvoiceIns/${this.id}`, {filter})
|
||||||
|
.then(res => this.entity = res.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnInvoiceInDescriptor', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
invoiceIn: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,26 @@
|
||||||
|
import './index';
|
||||||
|
|
||||||
|
describe('vnInvoiceInDescriptor', () => {
|
||||||
|
let controller;
|
||||||
|
let $httpBackend;
|
||||||
|
|
||||||
|
beforeEach(ngModule('invoiceIn'));
|
||||||
|
|
||||||
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
||||||
|
$httpBackend = _$httpBackend_;
|
||||||
|
controller = $componentController('vnInvoiceInDescriptor', {$element: null});
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('loadData()', () => {
|
||||||
|
it(`should perform a get query to store the invoice in data into the controller`, () => {
|
||||||
|
const id = 1;
|
||||||
|
const response = {id: 1};
|
||||||
|
|
||||||
|
$httpBackend.expectGET(`InvoiceIns/${id}`).respond(response);
|
||||||
|
controller.id = id;
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.invoiceIn).toEqual(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
export * from './module';
|
||||||
|
|
||||||
|
import './main';
|
||||||
|
import './index/';
|
||||||
|
import './search-panel';
|
||||||
|
import './card';
|
||||||
|
import './descriptor';
|
||||||
|
import './descriptor-popover';
|
|
@ -0,0 +1,103 @@
|
||||||
|
<vn-auto-search
|
||||||
|
model="model">
|
||||||
|
</vn-auto-search>
|
||||||
|
<vn-data-viewer
|
||||||
|
model="model"
|
||||||
|
class="vn-w-lg">
|
||||||
|
<vn-card>
|
||||||
|
<vn-table model="model">
|
||||||
|
<vn-thead>
|
||||||
|
<vn-tr>
|
||||||
|
<vn-th field="id">ID</vn-th>
|
||||||
|
<vn-th field="supplierFk">Supplier</vn-th>
|
||||||
|
<vn-th field="supplierRef">Supplier ref.</vn-th>
|
||||||
|
<vn-th field="serialNumber">Serial number</vn-th>
|
||||||
|
<vn-th field="serial">Serial</vn-th>
|
||||||
|
<vn-th field="account">Account</vn-th>
|
||||||
|
<vn-th field="issued" expand>Issued</vn-th>
|
||||||
|
<vn-th field="isBooked" center>Is booked</vn-th>
|
||||||
|
<vn-th field="awbCode" vn-tooltip="Air Waybill">AWB</vn-th>
|
||||||
|
<vn-th field="amount" filter-enabled="false">Amount</vn-th>
|
||||||
|
<vn-th></vn-th>
|
||||||
|
</vn-tr>
|
||||||
|
</vn-thead>
|
||||||
|
<vn-tbody>
|
||||||
|
<a ng-repeat="invoiceIn in model.data"
|
||||||
|
class="clickable vn-tr search-result"
|
||||||
|
ui-sref="invoiceIn.card.summary({id: {{::invoiceIn.id}}})">
|
||||||
|
<vn-td>{{::invoiceIn.id}}</vn-td>
|
||||||
|
<vn-td>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
|
vn-click-stop="supplierDescriptor.show($event, invoiceIn.supplierFk)">
|
||||||
|
{{::invoiceIn.supplierName}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td>{{::invoiceIn.supplierRef | dashIfEmpty}}</vn-td>
|
||||||
|
<vn-td>{{::invoiceIn.serialNumber}}</vn-td>
|
||||||
|
<vn-td>{{::invoiceIn.serial}}</vn-td>
|
||||||
|
<vn-td>{{::invoiceIn.account}}</vn-td>
|
||||||
|
<vn-td expand>{{::invoiceIn.issued | date:'dd/MM/yyyy' | dashIfEmpty}}</vn-td>
|
||||||
|
<vn-td center>
|
||||||
|
<vn-check disabled="true"
|
||||||
|
ng-model="invoiceIn.isBooked">
|
||||||
|
</vn-check>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td>{{::invoiceIn.awbCode}}</vn-td>
|
||||||
|
<vn-td>{{::invoiceIn.amount | currency:'EUR'}}</vn-td>
|
||||||
|
<vn-td shrink>
|
||||||
|
<vn-icon-button
|
||||||
|
vn-click-stop="$ctrl.preview(invoiceIn)"
|
||||||
|
vn-tooltip="Preview"
|
||||||
|
icon="preview">
|
||||||
|
</vn-icon-button>
|
||||||
|
<vn-icon-button
|
||||||
|
ng-show="invoiceIn.dmsFk"
|
||||||
|
vn-click-stop="$ctrl.openPdf(invoiceIn.dmsFk)"
|
||||||
|
icon="cloud_download"
|
||||||
|
title="Download PDF"
|
||||||
|
vn-tooltip="Download PDF">
|
||||||
|
</vn-icon-button>
|
||||||
|
</vn-td>
|
||||||
|
</a>
|
||||||
|
</vn-tbody>
|
||||||
|
</vn-table>
|
||||||
|
</vn-card>
|
||||||
|
</vn-data-viewer>
|
||||||
|
<vn-popup vn-id="summary">
|
||||||
|
<vn-invoice-in-summary
|
||||||
|
invoice-in="$ctrl.selectedinvoiceIn">
|
||||||
|
</vn-invoice-in-summary>
|
||||||
|
</vn-popup>
|
||||||
|
<vn-supplier-descriptor-popover
|
||||||
|
vn-id="supplierDescriptor">
|
||||||
|
</vn-supplier-descriptor-popover>
|
||||||
|
<vn-contextmenu vn-id="contextmenu" targets="['vn-data-viewer']" model="model"
|
||||||
|
expr-builder="$ctrl.exprBuilder(param, value)">
|
||||||
|
<slot-menu>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isFilterAllowed()"
|
||||||
|
ng-click="contextmenu.filterBySelection()">
|
||||||
|
Filter by selection
|
||||||
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isFilterAllowed()"
|
||||||
|
ng-click="contextmenu.excludeSelection()">
|
||||||
|
Exclude selection
|
||||||
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isFilterAllowed()"
|
||||||
|
ng-click="contextmenu.removeFilter()">
|
||||||
|
Remove filter
|
||||||
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-click="contextmenu.removeAllFilters()">
|
||||||
|
Remove all filters
|
||||||
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isActionAllowed()"
|
||||||
|
ng-click="contextmenu.copyValue()">
|
||||||
|
Copy value
|
||||||
|
</vn-item>
|
||||||
|
</slot-menu>
|
||||||
|
</vn-contextmenu>
|
|
@ -0,0 +1,42 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
export default class Controller extends Section {
|
||||||
|
exprBuilder(param, value) {
|
||||||
|
switch (param) {
|
||||||
|
case 'issued':
|
||||||
|
return {'ii.issued': {
|
||||||
|
between: this.dateRange(value)}
|
||||||
|
};
|
||||||
|
case 'id':
|
||||||
|
case 'supplierFk':
|
||||||
|
case 'supplierRef':
|
||||||
|
case 'serialNumber':
|
||||||
|
case 'serial':
|
||||||
|
case 'created':
|
||||||
|
case 'isBooked':
|
||||||
|
return {[`ii.${param}`]: value};
|
||||||
|
case 'account':
|
||||||
|
case 'fi':
|
||||||
|
return {[`s.${param}`]: value};
|
||||||
|
case 'awbCode':
|
||||||
|
return {'awb.code': value};
|
||||||
|
default:
|
||||||
|
return {[param]: value};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dateRange(value) {
|
||||||
|
const minHour = new Date(value);
|
||||||
|
minHour.setHours(0, 0, 0, 0);
|
||||||
|
const maxHour = new Date(value);
|
||||||
|
maxHour.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
|
return [minHour, maxHour];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnInvoiceInIndex', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -0,0 +1,6 @@
|
||||||
|
Created: Fecha creación
|
||||||
|
Issued: Fecha emisión
|
||||||
|
Supplier ref.: Ref. proveedor
|
||||||
|
Serial number: Num. serie
|
||||||
|
Serial: Serie
|
||||||
|
Is booked: Conciliada
|
|
@ -0,0 +1,2 @@
|
||||||
|
InvoiceIn: Facturas recibidas
|
||||||
|
Search invoices in by reference: Buscar facturas recibidas por referencia
|
|
@ -0,0 +1,18 @@
|
||||||
|
<vn-crud-model
|
||||||
|
vn-id="model"
|
||||||
|
url="InvoiceIns/filter"
|
||||||
|
limit="20"
|
||||||
|
order="isBooked, issued DESC">
|
||||||
|
</vn-crud-model>
|
||||||
|
<vn-portal slot="topbar">
|
||||||
|
<vn-searchbar
|
||||||
|
vn-focus
|
||||||
|
panel="vn-invoice-in-search-panel"
|
||||||
|
info="Search invoices in by reference"
|
||||||
|
model="model">
|
||||||
|
</vn-searchbar>
|
||||||
|
</vn-portal>
|
||||||
|
<vn-portal slot="menu">
|
||||||
|
<vn-left-menu></vn-left-menu>
|
||||||
|
</vn-portal>
|
||||||
|
<ui-view></ui-view>
|
|
@ -0,0 +1,9 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import ModuleMain from 'salix/components/module-main';
|
||||||
|
|
||||||
|
export default class InvoiceIn extends ModuleMain {}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnInvoiceIn', {
|
||||||
|
controller: InvoiceIn,
|
||||||
|
template: require('./index.html')
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
import {ng} from 'core/vendor';
|
||||||
|
|
||||||
|
export default ng.module('invoiceIn', ['vnCore']);
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"module": "invoiceIn",
|
||||||
|
"name": "Invoices in",
|
||||||
|
"icon": "contact_support",
|
||||||
|
"validations" : true,
|
||||||
|
"dependencies": ["worker", "supplier"],
|
||||||
|
"menus": {
|
||||||
|
"main": [
|
||||||
|
{"state": "invoiceIn.index", "icon": "contact_support"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"url": "/invoice-in",
|
||||||
|
"state": "invoiceIn",
|
||||||
|
"abstract": true,
|
||||||
|
"component": "vn-invoice-in",
|
||||||
|
"description": "InvoiceIn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "/index?q",
|
||||||
|
"state": "invoiceIn.index",
|
||||||
|
"component": "vn-invoice-in-index",
|
||||||
|
"description": "InvoiceIn",
|
||||||
|
"acl": ["administrative"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "/:id",
|
||||||
|
"state": "invoiceIn.card",
|
||||||
|
"abstract": true,
|
||||||
|
"component": "vn-invoice-in-card"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "/summary",
|
||||||
|
"state": "invoiceIn.card.summary",
|
||||||
|
"component": "vn-invoice-in-summary",
|
||||||
|
"description": "Summary",
|
||||||
|
"params": {
|
||||||
|
"invoice-In": "$ctrl.invoiceIn"
|
||||||
|
},
|
||||||
|
"acl": ["developer"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
<div class="search-panel">
|
||||||
|
<form ng-submit="$ctrl.onSearch()">
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="General search"
|
||||||
|
ng-model="filter.search"
|
||||||
|
info="Search invoices in by id or supplier fiscal name"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="Supplier ref."
|
||||||
|
ng-model="filter.supplierRef">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="Supplier fiscal id"
|
||||||
|
ng-model="filter.fi">
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="Account"
|
||||||
|
ng-model="filter.account">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="Amount"
|
||||||
|
ng-model="filter.amount">
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-date-picker
|
||||||
|
vn-one
|
||||||
|
label="From"
|
||||||
|
ng-model="filter.from">
|
||||||
|
</vn-date-picker>
|
||||||
|
<vn-date-picker
|
||||||
|
vn-one
|
||||||
|
label="To"
|
||||||
|
ng-model="filter.to">
|
||||||
|
</vn-date-picker>
|
||||||
|
<vn-date-picker
|
||||||
|
vn-one
|
||||||
|
label="Issued"
|
||||||
|
ng-model="filter.issued">
|
||||||
|
</vn-date-picker>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="Serial number"
|
||||||
|
ng-model="filter.serialNumber">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="Serial"
|
||||||
|
ng-model="filter.serial">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="AWB"
|
||||||
|
ng-model="filter.awbCode">
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-check
|
||||||
|
vn-one
|
||||||
|
triple-state="true"
|
||||||
|
label="Is booked"
|
||||||
|
ng-model="filter.isBooked">
|
||||||
|
</vn-check>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal class="vn-mt-lg">
|
||||||
|
<vn-submit label="Search"></vn-submit>
|
||||||
|
</vn-horizontal>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -0,0 +1,7 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnInvoiceInSearchPanel', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: SearchPanel
|
||||||
|
});
|
|
@ -0,0 +1,2 @@
|
||||||
|
Supplier fiscal id: CIF proveedor
|
||||||
|
Search invoices in by id or supplier fiscal name: Buscar facturas recibidas por id o por nombre fiscal del proveedor
|
|
@ -0,0 +1,27 @@
|
||||||
|
import './index.js';
|
||||||
|
|
||||||
|
describe('vnInvoiceOut', () => {
|
||||||
|
let controller;
|
||||||
|
let $httpBackend;
|
||||||
|
let data = {id: 1, name: 'fooName'};
|
||||||
|
|
||||||
|
beforeEach(ngModule('invoiceOut'));
|
||||||
|
|
||||||
|
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
|
||||||
|
$httpBackend = _$httpBackend_;
|
||||||
|
|
||||||
|
let $element = angular.element('<div></div>');
|
||||||
|
controller = $componentController('vnInvoiceOutCard', {$element});
|
||||||
|
|
||||||
|
$stateParams.id = data.id;
|
||||||
|
$httpBackend.whenRoute('GET', 'InvoiceOuts/:id').respond(data);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should request data and set it on the controller', () => {
|
||||||
|
controller.reload();
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.invoiceOut).toEqual(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
import './index';
|
||||||
|
|
||||||
|
describe('vnInvoiceOutDescriptor', () => {
|
||||||
|
let controller;
|
||||||
|
let $httpBackend;
|
||||||
|
|
||||||
|
beforeEach(ngModule('invoiceOut'));
|
||||||
|
|
||||||
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
||||||
|
$httpBackend = _$httpBackend_;
|
||||||
|
controller = $componentController('vnInvoiceOutDescriptor', {$element: null});
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('loadData()', () => {
|
||||||
|
it(`should perform a get query to store the invoice in data into the controller`, () => {
|
||||||
|
const id = 1;
|
||||||
|
const response = {id: 1};
|
||||||
|
|
||||||
|
$httpBackend.expectGET(`InvoiceOuts/${id}`).respond(response);
|
||||||
|
controller.id = id;
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.invoiceOut).toEqual(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -109,5 +109,10 @@
|
||||||
ng-click="contextmenu.removeAllFilters()">
|
ng-click="contextmenu.removeAllFilters()">
|
||||||
Remove all filters
|
Remove all filters
|
||||||
</vn-item>
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isActionAllowed()"
|
||||||
|
ng-click="contextmenu.copyValue()">
|
||||||
|
Copy value
|
||||||
|
</vn-item>
|
||||||
</slot-menu>
|
</slot-menu>
|
||||||
</vn-contextmenu>
|
</vn-contextmenu>
|
|
@ -154,5 +154,10 @@
|
||||||
ng-click="contextmenu.removeAllFilters()">
|
ng-click="contextmenu.removeAllFilters()">
|
||||||
Remove all filters
|
Remove all filters
|
||||||
</vn-item>
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isActionAllowed()"
|
||||||
|
ng-click="contextmenu.copyValue()">
|
||||||
|
Copy value
|
||||||
|
</vn-item>
|
||||||
</slot-menu>
|
</slot-menu>
|
||||||
</vn-contextmenu>
|
</vn-contextmenu>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<slot-descriptor>
|
||||||
|
<vn-supplier-descriptor></vn-supplier-descriptor>
|
||||||
|
</slot-descriptor>
|
|
@ -0,0 +1,9 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import DescriptorPopover from 'salix/components/descriptor-popover';
|
||||||
|
|
||||||
|
class Controller extends DescriptorPopover {}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnSupplierDescriptorPopover', {
|
||||||
|
slotTemplate: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -23,7 +23,7 @@ class Controller extends Descriptor {
|
||||||
to.setDate(to.getDate() + 10);
|
to.setDate(to.getDate() + 10);
|
||||||
|
|
||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
supplierFk: this.supplier.id,
|
supplierFk: this.id,
|
||||||
from,
|
from,
|
||||||
to
|
to
|
||||||
});
|
});
|
||||||
|
@ -65,7 +65,7 @@ class Controller extends Descriptor {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.getData(`Suppliers/${this.supplier.id}`, {filter})
|
return this.getData(`Suppliers/${this.id}`, {filter})
|
||||||
.then(res => this.supplier = res.data);
|
.then(res => this.supplier = res.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ export * from './module';
|
||||||
import './main';
|
import './main';
|
||||||
import './card';
|
import './card';
|
||||||
import './descriptor';
|
import './descriptor';
|
||||||
|
import './descriptor-popover';
|
||||||
import './index/';
|
import './index/';
|
||||||
import './search-panel';
|
import './search-panel';
|
||||||
import './summary';
|
import './summary';
|
||||||
|
|
|
@ -213,5 +213,10 @@
|
||||||
ng-click="contextmenu.removeAllFilters()">
|
ng-click="contextmenu.removeAllFilters()">
|
||||||
Remove all filters
|
Remove all filters
|
||||||
</vn-item>
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isActionAllowed()"
|
||||||
|
ng-click="contextmenu.copyValue()">
|
||||||
|
Copy value
|
||||||
|
</vn-item>
|
||||||
</slot-menu>
|
</slot-menu>
|
||||||
</vn-contextmenu>
|
</vn-contextmenu>
|
|
@ -9,4 +9,5 @@ Filter by selection: Filtro por selección
|
||||||
Exclude selection: Excluir selección
|
Exclude selection: Excluir selección
|
||||||
Remove filter: Quitar filtro por selección
|
Remove filter: Quitar filtro por selección
|
||||||
Remove all filters: Eliminar todos los filtros
|
Remove all filters: Eliminar todos los filtros
|
||||||
|
Copy value: Copiar valor
|
||||||
No verified data: Sin datos comprobados
|
No verified data: Sin datos comprobados
|
|
@ -106,5 +106,10 @@
|
||||||
ng-click="contextmenu.removeAllFilters()" >
|
ng-click="contextmenu.removeAllFilters()" >
|
||||||
Remove all filters
|
Remove all filters
|
||||||
</vn-item>
|
</vn-item>
|
||||||
|
<vn-item translate
|
||||||
|
ng-if="contextmenu.isActionAllowed()"
|
||||||
|
ng-click="contextmenu.copyValue()">
|
||||||
|
Copy value
|
||||||
|
</vn-item>
|
||||||
</slot-menu>
|
</slot-menu>
|
||||||
</vn-contextmenu>
|
</vn-contextmenu>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
remove this.