diff --git a/Dockerfile b/Dockerfile
index a574e61fd..b42249099 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,6 +8,11 @@ RUN apt-get update \
ca-certificates \
gnupg2 \
libfontconfig \
+ && apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
+ libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
+ libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
+ libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
+ libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y --no-install-recommends \
nodejs \
diff --git a/back/model-config.json b/back/model-config.json
index 323e5f233..dc5cde217 100644
--- a/back/model-config.json
+++ b/back/model-config.json
@@ -2,6 +2,9 @@
"Account": {
"dataSource": "vn"
},
+ "AccountingType": {
+ "dataSource": "vn"
+ },
"Bank": {
"dataSource": "vn"
},
diff --git a/back/models/accounting-type.json b/back/models/accounting-type.json
new file mode 100644
index 000000000..796793342
--- /dev/null
+++ b/back/models/accounting-type.json
@@ -0,0 +1,30 @@
+{
+ "name": "AccountingType",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "accountingType"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "description": {
+ "type": "String",
+ "required": true
+ },
+ "receiptDescription": {
+ "type": "String",
+ "required": true
+ }
+ },
+ "acls": [{
+ "accessType": "READ",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ }]
+}
\ No newline at end of file
diff --git a/back/models/bank.json b/back/models/bank.json
index 119ea9743..33a2637d6 100644
--- a/back/models/bank.json
+++ b/back/models/bank.json
@@ -2,39 +2,49 @@
"name": "Bank",
"base": "VnModel",
"options": {
- "mysql": {
- "table": "bank"
- }
+ "mysql": {
+ "table": "bank"
+ }
},
"properties": {
- "id": {
- "type": "Number",
- "id": true,
- "description": "Identifier"
- },
- "bank": {
- "type": "string",
- "required": true
- },
- "account": {
- "type": "string",
- "required": true
- },
- "cash": {
- "type": "string",
- "required": true
- },
- "entityFk": {
- "type": "string",
- "required": true
- },
- "isActive": {
- "type": "string",
- "required": true
- },
- "currencyFk": {
- "type": "string",
- "required": true
- }
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "bank": {
+ "type": "String",
+ "required": true
+ },
+ "account": {
+ "type": "String",
+ "required": true
+ },
+ "accountingTypeFk": {
+ "type": "Number",
+ "required": true,
+ "mysql": {
+ "columnName": "cash"
+ }
+ },
+ "entityFk": {
+ "type": "Number",
+ "required": true
+ },
+ "isActive": {
+ "type": "Boolean",
+ "required": true
+ },
+ "currencyFk": {
+ "type": "Number",
+ "required": true
+ }
+ },
+ "relations": {
+ "accountingType": {
+ "type": "belongsTo",
+ "model": "AccountingType",
+ "foreignKey": "accountingTypeFk"
+ }
}
- }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/back/models/image.js b/back/models/image.js
index 079acd293..113bc7084 100644
--- a/back/models/image.js
+++ b/back/models/image.js
@@ -55,8 +55,9 @@ module.exports = Self => {
};
await fs.mkdir(dstDir, {recursive: true});
- await sharp(srcFilePath)
+ await sharp(srcFilePath, {failOnError: false})
.resize(collection.maxWidth, collection.maxHeight, resizeOpts)
+ .png()
.toFile(dstFile);
const sizes = collection.sizes();
@@ -69,8 +70,9 @@ module.exports = Self => {
};
await fs.mkdir(dstDir, {recursive: true});
- await sharp(srcFilePath)
+ await sharp(srcFilePath, {failOnError: false})
.resize(size.width, size.height, resizeOpts)
+ .png()
.toFile(dstFile);
}
@@ -88,7 +90,9 @@ module.exports = Self => {
);
}
- await fs.unlink(srcFilePath);
+ if (fs.existsSync(srcFilePath))
+ await fs.unlink(srcFilePath);
+
await tx.commit();
return newImage;
} catch (e) {
diff --git a/db/changes/10180-holyWeek/00-ACL.sql b/db/changes/10180-holyWeek/00-ACL.sql
deleted file mode 100644
index b0ab68a97..000000000
--- a/db/changes/10180-holyWeek/00-ACL.sql
+++ /dev/null
@@ -1 +0,0 @@
-INSERT IGNORE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WorkerLog', '*', 'READ', 'ALLOW', 'ROLE', 'hr');
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/00-claim.sql b/db/changes/10180-holyWeek/00-claim.sql
deleted file mode 100644
index e3b979efe..000000000
--- a/db/changes/10180-holyWeek/00-claim.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-ALTER TABLE `vn`.`claim`
-ADD COLUMN `hasToPickUp` TINYINT(1) NOT NULL AFTER `ticketFk`;
diff --git a/db/changes/10180-holyWeek/00-claimState.sql b/db/changes/10180-holyWeek/00-claimState.sql
deleted file mode 100644
index c39ba751d..000000000
--- a/db/changes/10180-holyWeek/00-claimState.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-ALTER TABLE `vn`.`claimState`
-DROP FOREIGN KEY `roleFgn`;
-ALTER TABLE `vn`.`claimState`
-ADD COLUMN `code` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL AFTER `id`,
-CHANGE COLUMN `roleFk` `roleFk` INT(10) UNSIGNED NOT NULL DEFAULT '1' ;
-ALTER TABLE `vn`.`claimState`
-ADD CONSTRAINT `roleFgn`
- FOREIGN KEY (`roleFk`)
- REFERENCES `account`.`role` (`id`)
- ON UPDATE CASCADE;
-
-UPDATE `vn`.`claimState` SET `code` = 'pending' WHERE (`id` = '1');
-UPDATE `vn`.`claimState` SET `code` = 'canceled' WHERE (`id` = '4');
-UPDATE `vn`.`claimState` SET `code` = 'resolved' WHERE (`id` = '3');
-UPDATE `vn`.`claimState` SET `code` = 'disputed' WHERE (`id` = '5');
-UPDATE `vn`.`claimState` SET `code` = 'mana' WHERE (`id` = '6');
-UPDATE `vn`.`claimState` SET `code` = 'managed' WHERE (`id` = '2');
-
-ALTER TABLE `vn`.`claimState`
-ADD COLUMN `priority` INT NOT NULL DEFAULT 1 AFTER `roleFk`;
-
-UPDATE `vn`.`claimState` SET `priority` = '1' WHERE (`id` = '1');
-UPDATE `vn`.`claimState` SET `priority` = '5' WHERE (`id` = '2');
-UPDATE `vn`.`claimState` SET `priority` = '7' WHERE (`id` = '3');
-UPDATE `vn`.`claimState` SET `priority` = '6' WHERE (`id` = '4');
-UPDATE `vn`.`claimState` SET `priority` = '3' WHERE (`id` = '5');
-UPDATE `vn`.`claimState` SET `priority` = '4' WHERE (`id` = '6');
-UPDATE `vn`.`claimState` SET `priority` = '2' WHERE (`id` = '7');
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/00-ticketWeekly.sql b/db/changes/10180-holyWeek/00-ticketWeekly.sql
deleted file mode 100644
index 05d65e124..000000000
--- a/db/changes/10180-holyWeek/00-ticketWeekly.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-ALTER TABLE `vn`.`ticketWeekly`
-ADD COLUMN `agencyModeFk` INT(11) NULL DEFAULT NULL AFTER `weekDay`,
-ADD INDEX `agencyModeFk_idx` (`agencyModeFk` ASC);
-
-ALTER TABLE `vn`.`ticketWeekly`
-ADD CONSTRAINT `agencyModeFk`
- FOREIGN KEY (`agencyModeFk`)
- REFERENCES `vn`.`agencyMode` (`id`)
- ON DELETE SET NULL
- ON UPDATE CASCADE;
-
-ALTER TABLE `vn`.`ticketWeekly`
-CHANGE COLUMN `weekDay` `weekDay` TINYINT(1) NOT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6' ;
diff --git a/db/changes/10180-holyWeek/00-ticket_cloneWeekly.sql b/db/changes/10180-holyWeek/00-ticket_cloneWeekly.sql
deleted file mode 100644
index 544296feb..000000000
--- a/db/changes/10180-holyWeek/00-ticket_cloneWeekly.sql
+++ /dev/null
@@ -1,130 +0,0 @@
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT)
-BEGIN
- DECLARE vIsDone BOOL;
- DECLARE vLanding DATE;
- DECLARE vShipment DATE;
- DECLARE vWarehouse INT;
- DECLARE vTicket INT;
- DECLARE vWeekDay INT;
- DECLARE vClient INT;
- DECLARE vEmpresa INT;
- DECLARE vAddressFk INT;
- DECLARE vAgencyModeFk INT;
- DECLARE vNewTicket INT;
- DECLARE vYear INT;
-
- DECLARE rsTicket CURSOR FOR
- SELECT tw.ticketFk, weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tw.agencyModeFk
- FROM ticketWeekly tw
- JOIN ticket t ON tt.ticketFk = t.id;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
-
- SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
-
- OPEN rsTicket;
-
- myLoop: LOOP
- BEGIN
- DECLARE vError TEXT;
- DECLARE vSalesPersonEmail VARCHAR(150);
- DECLARE vMailSent BOOL;
- DECLARE vSubject VARCHAR(150);
- DECLARE vMessage TEXT;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- GET DIAGNOSTICS CONDITION 1
- vError = MESSAGE_TEXT;
-
- END;
-
- SET vIsDone = FALSE;
- FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk;
-
- IF vIsDone THEN
-
- LEAVE myLoop;
- END IF;
- SELECT date INTO vShipment
- FROM `time`
- WHERE `year` = vYear AND `week` = vWeek
- AND WEEKDAY(date) = vWeekDay;
-
- -- busca si el ticket ya ha sido clonado
- IF (SELECT COUNT(*) FROM vn.ticket tOrig
- JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
- JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
- JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
- JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
- WHERE tOrig.id = vTicket AND DATE(tClon.shipped) = vShipment) > 0
- THEN
- ITERATE myLoop;
- END IF;
- CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouse);
-
- SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
-
- CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk, NULL, vLanding, account.userGetId(), vNewTicket);
-
- IF (vLanding IS NULL) THEN
-
- SELECT e.email INTO vSalesPersonEmail
- FROM vn.client c
- JOIN vn.worker sp ON sp.id = c.salesPersonFk
- JOIN account.emailUser e ON e.userFk = sp.userFk
- WHERE c.id = vClient;
-
- SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
- ' para el dia: ', vShipment);
- SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
- ' para el dia: ', vShipment,
- ' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
- ' pero ha que revisar las fechas y la agencia');
-
- SELECT COUNT(*) INTO vMailSent
- FROM vn.mail
- WHERE sender = vSalesPersonEmail
- AND subject = vSubject;
-
- IF NOT vMailSent THEN
- INSERT INTO vn.mail (sender,`subject`,body)
- VALUES (vSalesPersonEmail, vSubject, vMessage);
- END IF;
- CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
- END IF;
-
- INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
- SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
- FROM vn.ticket tOrig
- JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
- LEFT JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
- LEFT JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
- LEFT JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk AND DATE(tClon.shipped) = vShipment
- WHERE tOrig.id = vTicket AND saleClon.id IS NULL;
-
- INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
- SELECT saleOriginal.id, saleClon.id
- FROM vn.sale saleOriginal
- JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
- WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
-
- INSERT INTO ticketRequest (description, ordered, shipped, salesPersonCode, buyerCode, quantity, price,
- itemFk ,clientFk, response, total, buyed, saleFk)
- SELECT tr.description, tr.ordered, tr.shipped, tr.salesPersonCode, tr.buyerCode, tr.quantity, tr.price,
- tr.itemFk, tr.clientFk, tr.response, tr.total, tr.buyed, tr.saleFk
- FROM sale s JOIN ticketRequest tr ON tr.saleFk = s.id
- JOIN sale s2 ON s.concept = s2.concept AND s.quantity = s2.quantity AND m.Id_Article = m2.Id_Article
- WHERE s.ticketFk = vTicket AND s2.ticketFk = vNewTicket;
-
- CALL vn.ticketCalculateClon(vNewTicket, vTicket);
- END;
- END LOOP;
-
- CLOSE rsTicket;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/00-time_createTable.sql b/db/changes/10180-holyWeek/00-time_createTable.sql
deleted file mode 100644
index 62b60c4bf..000000000
--- a/db/changes/10180-holyWeek/00-time_createTable.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-USE `util`;
-DROP procedure IF EXISTS `time_createTable`;
-
-DELIMITER $$
-USE `util`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `time_createTable`(vStarted DATE, vEnded DATE)
-BEGIN
- DECLARE vCurrentDate DATE;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.time;
- CREATE TEMPORARY TABLE tmp.time (dated DATE PRIMARY KEY) ENGINE = MEMORY;
- SET vCurrentDate = vStarted;
- WHILE vCurrentDate <= vEnded DO
- INSERT INTO tmp.time (dated) VALUES (vCurrentDate);
- SET vCurrentDate = DATE_ADD(vCurrentDate, INTERVAL 1 DAY);
- END WHILE;
-
-END$$
-
-DELIMITER ;
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/00-workerLog.sql b/db/changes/10180-holyWeek/00-workerLog.sql
deleted file mode 100644
index f3f76f274..000000000
--- a/db/changes/10180-holyWeek/00-workerLog.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-ALTER TABLE `vn`.`workerLog`
-ADD COLUMN `changedModel` VARCHAR(45) NULL DEFAULT NULL AFTER `description`,
-ADD COLUMN `oldInstance` TEXT NULL DEFAULT NULL AFTER `changedModel`,
-ADD COLUMN `newInstance` TEXT NULL DEFAULT NULL AFTER `oldInstance`,
-ADD COLUMN `changedModelId` INT(11) NULL DEFAULT NULL AFTER `newInstance`,
-ADD COLUMN `changedModelValue` VARCHAR(45) NULL DEFAULT NULL AFTER `changedModelId`;
diff --git a/db/changes/10180-holyWeek/01-componentRenameMismatchXImbalance.sql b/db/changes/10180-holyWeek/01-componentRenameMismatchXImbalance.sql
deleted file mode 100644
index 34dd3be3c..000000000
--- a/db/changes/10180-holyWeek/01-componentRenameMismatchXImbalance.sql
+++ /dev/null
@@ -1 +0,0 @@
-UPDATE `vn`.`component` SET `code` = 'imbalance' WHERE (`id` = '36');
diff --git a/db/changes/10180-holyWeek/01-migrateFromTicketToTicketWeekly.sql b/db/changes/10180-holyWeek/01-migrateFromTicketToTicketWeekly.sql
deleted file mode 100644
index 939a8e73c..000000000
--- a/db/changes/10180-holyWeek/01-migrateFromTicketToTicketWeekly.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-UPDATE vn.ticketWeekly tw
- JOIN vn.ticket t ON t.id = tw.ticketFk
- JOIN vn.agencyMode am ON am.id = t.agencyModeFk
-SET tw.agencyModeFk = t.agencyModeFk
-WHERE am.name NOT LIKE '%turno%';
-
diff --git a/db/changes/10180-holyWeek/01-zoneConfigAlterTable.sql b/db/changes/10180-holyWeek/01-zoneConfigAlterTable.sql
deleted file mode 100644
index 5f4e7114b..000000000
--- a/db/changes/10180-holyWeek/01-zoneConfigAlterTable.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-ALTER TABLE `vn`.`zoneConfig`
-ADD COLUMN `forwardDays` INT(10) NOT NULL DEFAULT 7 COMMENT 'days forward to show zone_upcomingDeliveries' AFTER `scope`;
diff --git a/db/changes/10180-holyWeek/02-catalog_calculate.sql b/db/changes/10180-holyWeek/02-catalog_calculate.sql
deleted file mode 100644
index eeadb7241..000000000
--- a/db/changes/10180-holyWeek/02-catalog_calculate.sql
+++ /dev/null
@@ -1,148 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `catalog_calculate`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `catalog_calculate`(
- vLanded DATE,
- vAddressFk INT,
- vAgencyModeFk INT)
-proc: BEGIN
-/**
- * Calcula los articulos disponibles y sus precios
- *
- * @table tmp.item(itemFk) Listado de artÃculos a calcular
- * @param vLanded Fecha de recepcion de mercancia
- * @param vAddressFk Id del consignatario
- * @param vAgencyModeFk Id de la agencia
- * @return tmp.ticketCalculateItem(itemFk, available, producer,
- * item, size, stems, category, inkFk, image, origin, price)
- * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk)
- * @return tmp.ticketComponent
- * @return tmp.ticketComponentPrice
- * @return tmp.zoneGetShipped
- */
-
- DECLARE vAvailableCalc INT;
- DECLARE vShipped DATE;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vZoneFk INT;
- DECLARE vDone BOOL;
- DECLARE cTravelTree CURSOR FOR
- SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-
- -- Establece los almacenes y las fechas que van a entrar al disponible
-
- CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot(
- `warehouseFk` smallint(5) unsigned NOT NULL,
- `itemFk` int(11) NOT NULL,
- `available` double DEFAULT NULL,
- `buyFk` int(11) DEFAULT NULL,
- `fix` tinyint(3) unsigned DEFAULT '0',
- `zoneFk` int(11) NOT NULL,
- KEY `itemFk` (`itemFk`),
- KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH
- ) ENGINE=MEMORY DEFAULT CHARSET=utf8;
-
- CALL catalog_componentPrepare();
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem;
- CREATE TEMPORARY TABLE tmp.ticketCalculateItem(
- itemFk INT(11) NOT NULL,
- available INT(11),
- producer VARCHAR(50),
- item VARCHAR(50),
- size INT(10) UNSIGNED,
- stems INT(11),
- category VARCHAR(3),
- inkFk VARCHAR(3),
- image VARCHAR(50),
- origin VARCHAR(3),
- price DECIMAL(10,2),
- priceKg DECIMAL(10,2),
- KEY `itemFk` (`itemFk`)
- ) ENGINE = MEMORY DEFAULT CHARSET=utf8;
-
- OPEN cTravelTree;
-
- l: LOOP
- SET vDone = FALSE;
- FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped;
-
- IF vDone THEN
- LEAVE l;
- END IF;
-
- CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped);
- CALL buyUltimate (vWarehouseFk, vShipped);
-
- INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk)
- SELECT vWarehouseFk,
- i.item_id,
- IFNULL(i.available, 0),
- bu.buyFk,
- vZoneFk
- FROM `cache`.available i
- JOIN tmp.item br ON br.itemFk = i.item_id
- LEFT JOIN item it ON it.id = i.item_id
- LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.item_id
- WHERE i.calc_id = vAvailableCalc
- AND i.available > 0;
-
- DROP TEMPORARY TABLE tmp.buyUltimate;
-
- CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
-
- INSERT INTO tmp.ticketCalculateItem (
- itemFk,
- available,
- producer,
- item,
- size,
- stems,
- category,
- inkFk,
- image,
- origin,
- price,
- priceKg)
- SELECT
- tl.itemFk,
- SUM(tl.available) available,
- p.name producer,
- i.name item,
- i.size size,
- i.stems,
- i.category,
- i.inkFk,
- i.image,
- o.code origin,
- bl.price,
- bl.priceKg
- FROM tmp.ticketLot tl
- JOIN item i ON tl.itemFk = i.id
- LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible
- JOIN origin o ON o.id = i.originFk
- JOIN (
- SELECT MIN(price) price, itemFk, priceKg
- FROM tmp.ticketComponentPrice
- WHERE warehouseFk = vWarehouseFk
- GROUP BY itemFk
- ) bl ON bl.itemFk = tl.itemFk
- WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk
- GROUP BY tl.itemFk;
- -- on duplicatekey update
-
- END LOOP;
-
- CLOSE cTravelTree;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-catalog_componentCalculate.sql b/db/changes/10180-holyWeek/02-catalog_componentCalculate.sql
deleted file mode 100644
index 04ec1330a..000000000
--- a/db/changes/10180-holyWeek/02-catalog_componentCalculate.sql
+++ /dev/null
@@ -1,262 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `catalog_componentCalculate`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `catalog_componentCalculate`(
- vZoneFk INT,
- vAddressFk INT,
- vShipped DATE,
- vWarehouseFk INT)
-proc: BEGIN
-/**
- * Calcula los componentes de los articulos de tmp.ticketLot
- *
- * @param vZoneFk para calcular el transporte
- * @param vAddressFk Consignatario
- * @param vShipped dia de salida del pedido
- * @param tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk)
- *
- * @return tmp.ticketComponent(itemFk, warehouseFk, available, rate2, rate3, minPrice,
- * packing, grouping, groupingMode, buyFk, typeFk)
- * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, grouping, price)
- */
- DECLARE vClientFk INT;
- DECLARE vGeneralInflationCoefficient INT DEFAULT 1;
- DECLARE vMinimumDensityWeight INT DEFAULT 167;
- DECLARE vBoxVolume BIGINT; -- DEFAULT 138000;
- DECLARE vSpecialPriceComponent INT DEFAULT 10;
- DECLARE vDeliveryComponent INT DEFAULT 15;
- DECLARE vRecoveryComponent INT DEFAULT 17;
- DECLARE vSellByPacketComponent INT DEFAULT 22;
- DECLARE vBuyValueComponent INT DEFAULT 28;
- DECLARE vMarginComponent INT DEFAULT 29;
- DECLARE vDiscountLastItemComponent INT DEFAULT 32;
- DECLARE vExtraBaggedComponent INT DEFAULT 38;
- DECLARE vManaAutoComponent INT DEFAULT 39;
-
- SELECT volume INTO vBoxVolume
- FROM vn.packaging
- WHERE id = '94';
-
- SELECT clientFk INTO vClientFK
- FROM address
- WHERE id = vAddressFk;
-
- SET @rate2 := 0;
- SET @rate3 := 0;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate;
- CREATE TEMPORARY TABLE tmp.ticketComponentCalculate
- (PRIMARY KEY (itemFk, warehouseFk))
- ENGINE = MEMORY
- SELECT
- tl.itemFk, tl.warehouseFk, tl.available,
- IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) * 1.0 rate2,
- IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3,
- IFNULL(pf.rate3, 0) AS minPrice,
- IFNULL(pf.packing, b.packing) packing,
- IFNULL(pf.`grouping`, b.`grouping`) `grouping`,
- ABS(IFNULL(pf.box, b.groupingMode)) groupingMode,
- tl.buyFk,
- i.typeFk,
- IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping
- FROM tmp.ticketLot tl
- JOIN buy b ON b.id = tl.buyFk
- JOIN item i ON i.id = tl.itemFk
- JOIN itemType it ON it.id = i.typeFk
- LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
- LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk
- LEFT JOIN (
- SELECT * FROM (
- SELECT pf.itemFk, pf.`grouping`, pf.packing, pf.box, pf.rate2, pf.rate3, zw.warehouseFk
- FROM priceFixed pf
- JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk AND (zw.warehouseFk = pf.warehouseFk OR pf.warehouseFk = 0)
- WHERE vShipped BETWEEN pf.started AND pf.ended ORDER BY pf.itemFk, pf.warehouseFk DESC
- ) tpf
- GROUP BY tpf.itemFk, tpf.warehouseFk
- ) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk
- WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.display <> 0
- AND tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk;
-
- INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
- SELECT
- tcc.warehouseFk,
- tcc.itemFk,
- vBuyValueComponent,
- b.buyingValue + b.freightValue + b.packageValue + b.comissionValue
- FROM tmp.ticketComponentCalculate tcc
- JOIN buy b ON b.id = tcc.buyFk;
-
- INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
- SELECT
- tcc.warehouseFk,
- tcc.itemFk,
- vMarginComponent,
- tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue
- FROM tmp.ticketComponentCalculate tcc
- JOIN buy b ON b.id = tcc.buyFk;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase;
- CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY
- SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk
- FROM tmp.ticketComponent tc
- JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk
- GROUP BY tc.itemFk, warehouseFk;
-
- INSERT INTO tmp.ticketComponent
- SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3)
- FROM tmp.ticketComponentBase tcb
- JOIN claimRatio cr ON cr.clientFk = vClientFk
- WHERE cr.priceIncreasing > 0.009;
-
- INSERT INTO tmp.ticketComponent
- SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto
- FROM tmp.ticketComponentBase tcb
- JOIN `client` c on c.id = vClientFk
- JOIN workerMana wm ON c.salesPersonFk = wm.workerFk
- WHERE wm.isPricesModifierActivated
- HAVING manaAuto <> 0;
-
- INSERT INTO tmp.ticketComponent
- SELECT tcb.warehouseFk,
- tcb.itemFk,
- c.id,
- GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3)
- FROM tmp.ticketComponentBase tcb
- JOIN component c
- JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
- LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
- WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL;
-
- INSERT INTO tmp.ticketComponent
- SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
- FROM tmp.ticketComponentCalculate tcc
- JOIN buy b ON b.id = tcc.buyFk
- LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
- WHERE sp.value IS NULL;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.zone;
- CREATE TEMPORARY TABLE IF NOT EXISTS tmp.zone (INDEX (id))
- ENGINE = MEMORY
- SELECT vZoneFk id;
-
- CALL zone_getOptionsForShipment(vShipped, TRUE);
-
- INSERT INTO tmp.ticketComponent
- SELECT tcc.warehouseFK,
- tcc.itemFk,
- vDeliveryComponent,
- vGeneralInflationCoefficient
- * ROUND((
- i.compression
- * ic.cm3
- * IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
- * IFNULL((zo.price - zo.bonus)
- * 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
- ) cost
- FROM tmp.ticketComponentCalculate tcc
- JOIN item i ON i.id = tcc.itemFk
- JOIN tmp.zoneOption zo ON zo.zoneFk = vZoneFk
- JOIN zone z ON z.id = vZoneFk
- JOIN agencyMode am ON am.id = z.agencyModeFk
- LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
- AND ic.itemFk = tcc.itemFk
- HAVING cost <> 0;
-
- DROP TEMPORARY TABLE tmp.zoneOption;
-
- IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
- INSERT INTO tmp.ticketComponent
- SELECT tcc.warehouseFk, b.itemFk, vExtraBaggedComponent, ap.packagingValue cost
- FROM tmp.ticketComponentCalculate tcc
- JOIN vn.addressForPackaging ap
- WHERE ap.addressFk = vAddressFk;
- END IF;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy;
- CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY
- SELECT * FROM tmp.ticketComponent;
-
- INSERT INTO tmp.ticketComponent
- SELECT tcc.warehouseFk,
- tcc.itemFk,
- vSpecialPriceComponent,
- sp.value - SUM(tcc.cost) sumCost
- FROM tmp.ticketComponentCopy tcc
- JOIN component c ON c.id = tcc.componentFk
- JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
- WHERE c.classRate IS NULL
- GROUP BY tcc.itemFk, tcc.warehouseFk
- HAVING ABS(sumCost) > 0.001;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum;
- CREATE TEMPORARY TABLE tmp.ticketComponentSum
- (INDEX (itemFk, warehouseFk))
- ENGINE = MEMORY
- SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate
- FROM tmp.ticketComponent tc
- JOIN component c ON c.id = tc.componentFk
- GROUP BY tc.itemFk, tc.warehouseFk, c.classRate;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
- CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY
- SELECT tcc.warehouseFk,
- tcc.itemFk,
- 1 rate,
- IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`,
- CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price,
- CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg
- FROM tmp.ticketComponentCalculate tcc
- JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
- AND tcs.warehouseFk = tcc.warehouseFk
- WHERE IFNULL(tcs.classRate, 1) = 1
- AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0)
- GROUP BY tcs.warehouseFk, tcs.itemFk;
-
- INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg)
- SELECT
- tcc.warehouseFk,
- tcc.itemFk,
- 2 rate,
- tcc.packing `grouping`,
- SUM(tcs.sumCost) price,
- SUM(tcs.sumCost) / weightGrouping priceKg
- FROM tmp.ticketComponentCalculate tcc
- JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
- AND tcs.warehouseFk = tcc.warehouseFk
- WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2
- AND tcc.packing > 0 AND tcc.available >= tcc.packing)
- GROUP BY tcs.warehouseFk, tcs.itemFk;
-
- INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg)
- SELECT
- tcc.warehouseFk,
- tcc.itemFk,
- 3 rate,
- tcc.available `grouping`,
- SUM(tcs.sumCost) price,
- SUM(tcs.sumCost) / weightGrouping priceKg
- FROM tmp.ticketComponentCalculate tcc
- JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
- AND tcs.warehouseFk = tcc.warehouseFk
- WHERE IFNULL(tcs.classRate, 3) = 3
- GROUP BY tcs.warehouseFk, tcs.itemFk;
-
- INSERT INTO tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg)
- SELECT * FROM (
- SELECT * FROM tmp.ticketComponentRate ORDER BY price
- ) t
- GROUP BY itemFk, warehouseFk, `grouping`;
-
- DROP TEMPORARY TABLE
- tmp.ticketComponentCalculate,
- tmp.ticketComponentSum,
- tmp.ticketComponentBase,
- tmp.ticketComponentRate,
- tmp.ticketComponentCopy;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-catalog_componentPrepare.sql b/db/changes/10180-holyWeek/02-catalog_componentPrepare.sql
deleted file mode 100644
index 98b93a97e..000000000
--- a/db/changes/10180-holyWeek/02-catalog_componentPrepare.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `catalog_componentPrepare`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE PROCEDURE `catalog_componentPrepare` ()
-BEGIN
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
- CREATE TEMPORARY TABLE tmp.ticketComponent (
- `warehouseFk` INT UNSIGNED NOT NULL,
- `itemFk` INT NOT NULL,
- `componentFk` INT UNSIGNED NOT NULL,
- `cost` DECIMAL(10,4) NOT NULL,
- INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
- UNIQUE `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)
- )ENGINE=MEMORY DEFAULT CHARSET=utf8;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
- CREATE TEMPORARY TABLE tmp.ticketComponentPrice (
- `warehouseFk` INT UNSIGNED NOT NULL,
- `itemFk` INT NOT NULL,
- `rate` INT NOT NULL,
- `grouping` INT UNSIGNED NOT NULL,
- `price` DECIMAL(10,4) NOT NULL,
- `priceKg` DECIMAL(10,4),
- INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
- UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC)
- )ENGINE=MEMORY DEFAULT CHARSET=utf8;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-catalog_componentPurge.sql b/db/changes/10180-holyWeek/02-catalog_componentPurge.sql
deleted file mode 100644
index 2b744b5f0..000000000
--- a/db/changes/10180-holyWeek/02-catalog_componentPurge.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-
-USE `vn`;
-DROP procedure IF EXISTS `vn`.`catalog_componentPurge`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `catalog_componentPurge`()
-BEGIN
- DROP TEMPORARY TABLE
- tmp.ticketComponentPrice,
- tmp.ticketComponent,
- tmp.ticketLot;
-END$$
-
-DELIMITER ;
-;
diff --git a/db/changes/10180-holyWeek/02-order_confirmWithUser.sql b/db/changes/10180-holyWeek/02-order_confirmWithUser.sql
deleted file mode 100644
index c9acdc038..000000000
--- a/db/changes/10180-holyWeek/02-order_confirmWithUser.sql
+++ /dev/null
@@ -1,250 +0,0 @@
-USE `hedera`;
-DROP procedure IF EXISTS `order_confirmWithUser`;
-
-DELIMITER $$
-USE `hedera`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT)
-BEGIN
-/**
- * Confirms an order, creating each of its tickets on the corresponding
- * date, store and user.
- *
- * @param vOrder The order identifier
- * @param vUser The user identifier
- */
- DECLARE vOk BOOL;
- DECLARE vDone BOOL DEFAULT FALSE;
- DECLARE vWarehouse INT;
- DECLARE vShipment DATETIME;
- DECLARE vTicket INT;
- DECLARE vNotes VARCHAR(255);
- DECLARE vItem INT;
- DECLARE vConcept VARCHAR(30);
- DECLARE vAmount INT;
- DECLARE vPrice DECIMAL(10,2);
- DECLARE vSale INT;
- DECLARE vRate INT;
- DECLARE vRowId INT;
- DECLARE vDelivery DATE;
- DECLARE vAddress INT;
- DECLARE vIsConfirmed BOOL;
- DECLARE vClientId INT;
- DECLARE vCompanyId INT;
- DECLARE vAgencyModeId INT;
- DECLARE TICKET_FREE INT DEFAULT 2;
-
- DECLARE cDates CURSOR FOR
- SELECT zgs.shipped, r.warehouse_id
- FROM `order` o
- JOIN order_row r ON r.order_id = o.id
- LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
- WHERE o.id = vOrder AND r.amount != 0
- GROUP BY r.warehouse_id;
-
- DECLARE cRows CURSOR FOR
- SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate
- FROM order_row r
- JOIN vn.item i ON i.id = r.item_id
- WHERE r.amount != 0
- AND r.warehouse_id = vWarehouse
- AND r.order_id = vOrder
- ORDER BY r.rate DESC;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND
- SET vDone = TRUE;
-
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
- RESIGNAL;
- END;
-
- -- Carga los datos del pedido
-
- SELECT o.date_send, o.address_id, o.note,
- o.confirmed, a.clientFk, o.company_id, o.agency_id
- INTO vDelivery, vAddress, vNotes,
- vIsConfirmed, vClientId, vCompanyId, vAgencyModeId
- FROM hedera.`order` o
- JOIN vn.address a ON a.id = o.address_id
- WHERE o.id = vOrder;
-
- -- Comprueba que el pedido no está confirmado
-
- IF vIsConfirmed THEN
- CALL util.throw ('ORDER_ALREADY_CONFIRMED');
- END IF;
-
- -- Comprueba que el pedido no está vacío
-
- SELECT COUNT(*) > 0 INTO vOk
- FROM order_row WHERE order_id = vOrder AND amount > 0;
-
- IF NOT vOk THEN
- CALL util.throw ('ORDER_EMPTY');
- END IF;
-
- -- Carga las fechas de salida de cada almacén
-
- CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
-
- -- Trabajador que realiza la acción
-
- IF vUserId IS NULL THEN
- SELECT employeeFk INTO vUserId FROM orderConfig;
- END IF;
-
- -- Crea los tickets del pedido
-
- START TRANSACTION;
-
- OPEN cDates;
-
- lDates:
- LOOP
- SET vTicket = NULL;
- SET vDone = FALSE;
- FETCH cDates INTO vShipment, vWarehouse;
-
- IF vDone THEN
- LEAVE lDates;
- END IF;
-
- -- Busca un ticket existente que coincida con los parametros
-
- SELECT t.id INTO vTicket
- FROM vn.ticket t
- LEFT JOIN vn.ticketState tls on tls.ticket = t.id
- JOIN `order` o
- ON o.address_id = t.addressFk
- AND vWarehouse = t.warehouseFk
- AND o.agency_id = t.agencyModeFk
- AND o.date_send = t.landed
- AND vShipment = DATE(t.shipped)
- WHERE o.id = vOrder
- AND t.invoiceOutFk IS NULL
- AND IFNULL(tls.alertLevel,0) = 0
- AND t.clientFk <> 1118
- LIMIT 1;
-
- -- Crea el ticket en el caso de no existir uno adecuado
-
- IF vTicket IS NULL
- THEN
- CALL vn.ticketCreateWithUser(
- vClientId,
- IFNULL(vShipment, CURDATE()),
- vWarehouse,
- vCompanyId,
- vAddress,
- vAgencyModeId,
- NULL,
- vDelivery,
- vUserId,
- vTicket
- );
- ELSE
- INSERT INTO vncontrol.inter
- SET Id_Ticket = vTicket,
- Id_Trabajador = vUserId,
- state_id = TICKET_FREE;
- END IF;
-
- INSERT IGNORE INTO vn.orderTicket
- SET orderFk = vOrder,
- ticketFk = vTicket;
-
- -- Añade las notas
-
- IF vNotes IS NOT NULL AND vNotes != ''
- THEN
- INSERT INTO vn.ticketObservation SET
- ticketFk = vTicket,
- observationTypeFk = 4 /* salesperson */ ,
- `description` = vNotes
- ON DUPLICATE KEY UPDATE
- `description` = CONCAT(VALUES(`description`),'. ', `description`);
- END IF;
-
- -- Añade los movimientos y sus componentes
-
- OPEN cRows;
-
- lRows:
- LOOP
- SET vDone = FALSE;
- FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate;
-
- IF vDone THEN
- LEAVE lRows;
- END IF;
- SET vSale = NULL;
- SELECT s.id INTO vSale
- FROM vn.sale s
- WHERE ticketFk = vTicket
- AND price = vPrice
- AND itemFk = vItem
- LIMIT 1;
- IF vSale THEN
- UPDATE vn.sale
- SET quantity = quantity + vAmount
- WHERE id = vSale;
- ELSE
- INSERT INTO vn.sale
- SET
- itemFk = vItem,
- ticketFk = vTicket,
- concept = vConcept,
- quantity = vAmount,
- price = vPrice,
- priceFixed = 0,
- isPriceFixed = TRUE;
-
- SET vSale = LAST_INSERT_ID();
-
- INSERT INTO vn.saleComponent
- (saleFk, componentFk, `value`)
- SELECT vSale, cm.component_id, cm.price
- FROM order_component cm
- JOIN vn.component c ON c.id = cm.component_id
- WHERE cm.order_row_id = vRowId
- GROUP BY vSale, cm.component_id;
- END IF;
- UPDATE order_row SET Id_Movimiento = vSale
- WHERE id = vRowId;
-
- END LOOP;
-
- CLOSE cRows;
-
- -- Fija el coste
-
- DROP TEMPORARY TABLE IF EXISTS tComponents;
- CREATE TEMPORARY TABLE tComponents
- (INDEX (saleFk))
- ENGINE = MEMORY
- SELECT SUM(sc.`value`) valueSum, sc.saleFk
- FROM vn.saleComponent sc
- JOIN vn.component c ON c.id = sc.componentFk
- JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
- JOIN vn.sale s ON s.id = sc.saleFk
- WHERE s.ticketFk = vTicket
- GROUP BY sc.saleFk;
-
- UPDATE vn.sale s
- JOIN tComponents mc ON mc.saleFk = s.id
- SET s.priceFixed = valueSum;
-
- DROP TEMPORARY TABLE tComponents;
- END LOOP;
-
- CLOSE cDates;
-
- DELETE FROM basketOrder WHERE orderFk = vOrder;
- UPDATE `order` SET confirmed = TRUE, confirm_date = NOW()
- WHERE id = vOrder;
-
- COMMIT;
-END$$
-
-DELIMITER ;
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/02-sale_calculateComponent.sql b/db/changes/10180-holyWeek/02-sale_calculateComponent.sql
deleted file mode 100644
index 979608a35..000000000
--- a/db/changes/10180-holyWeek/02-sale_calculateComponent.sql
+++ /dev/null
@@ -1,103 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `sale_calculateComponent`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `sale_calculateComponent`(vSale INT, vOption INT)
-proc: BEGIN
-/**
- * Actualiza los componentes
- *
- * @param vSale Delivery date
- * @param vOption indica en que componente pone el descuadre, NULL en casos habituales
- */
- DECLARE vShipped DATE;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vAgencyModeFk INT;
- DECLARE vAddressFk INT;
- DECLARE vTicketFk BIGINT;
- DECLARE vItemFk BIGINT;
- DECLARE vLanded DATE;
- DECLARE vIsEditable BOOLEAN;
- DECLARE vZoneFk INTEGER;
-
- SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0),
- s.ticketFk,
- s.itemFk ,
- t.zoneFk,
- t.warehouseFk,
- t.shipped,
- t.addressFk,
- t.agencyModeFk,
- t.landed
- INTO vIsEditable,
- vTicketFk,
- vItemFk,
- vZoneFk,
- vWarehouseFk,
- vShipped,
- vAddressFk,
- vAgencyModeFk,
- vLanded
- FROM ticket t
- JOIN sale s ON s.ticketFk = t.id
- LEFT JOIN ticketState ts ON ts.ticketFk = t.id
- WHERE s.id = vSale;
-
- IF vLanded IS NULL OR vZoneFk IS NULL THEN
-
- CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk);
-
- IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
- CALL util.throw('There is no zone for these parameters');
- END IF;
-
- UPDATE ticket t
- SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
- WHERE t.id = vTicketFk AND t.landed IS NULL;
-
- IF vZoneFk IS NULL THEN
- SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
- UPDATE ticket t
- SET t.zoneFk = vZoneFk
- WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
- END IF;
- DROP TEMPORARY TABLE tmp.zoneGetLanded;
-
- END IF;
-
- -- rellena la tabla buyUltimate con la ultima compra
- CALL buyUltimate (vWarehouseFk, vShipped);
-
- DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk
- FROM tmp.buyUltimate
- WHERE itemFk = vItemFk;
-
- CALL catalog_componentPrepare();
- CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT vSale saleFk,vWarehouseFk warehouseFk;
-
- IF vOption IS NULL THEN
- SET vOption = IF(vIsEditable, 1, 6);
- END IF;
-
- CALL ticketComponentUpdateSale(vOption);
-
- INSERT INTO ticketLog (originFk, userFk, `action`, description)
- VALUES (vTicketFk, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
-
- CALL catalog_componentPurge();
- DROP TEMPORARY TABLE tmp.buyUltimate;
- DROP TEMPORARY TABLE tmp.sale;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-ticketCalculateClon.sql b/db/changes/10180-holyWeek/02-ticketCalculateClon.sql
deleted file mode 100644
index 6c9518b3b..000000000
--- a/db/changes/10180-holyWeek/02-ticketCalculateClon.sql
+++ /dev/null
@@ -1,93 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticketCalculateClon`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
-BEGIN
-/*
- * Recalcula los componentes un ticket clonado,
- * las lineas a precio cero fuerza para que tengan precio, el resto lo respeta
- * @param vTicketNew nuevo ticket clonado
- * @param vTicketOld icket original, a partir del qual se clonara el nuevo
-*/
- DECLARE vShipped DATE;
- DECLARE vClient INT;
- DECLARE vWarehouse SMALLINT;
- DECLARE vAgencyMode INT;
- DECLARE vAddress INT;
- DECLARE vLanded DATE;
- DECLARE vAgency INT;
- DECLARE vZoneFk INT;
-
- REPLACE INTO orderTicket(orderFk,ticketFk)
- SELECT orderFk, vTicketNew
- FROM orderTicket
- WHERE ticketFk = vTicketOld;
-
- SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk
- INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk
- FROM agencyMode a
- JOIN ticket t ON t.agencyModeFk = a.id
- WHERE t.id = vTicketNew;
-
- IF vLanded IS NULL THEN
- CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse);
- UPDATE ticket t
- JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk
- SET t.landed = zgl.landed,
- t.zone = zgl.zoneFk
- WHERE t.id = vTicketNew;
-
- SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
- DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
- END IF;
-
- -- rellena la tabla tmp.buyUltimate con la ultima compra
- CALL buyUltimate(vWarehouse, vShipped);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
- FROM sale s
- LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
- WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk;
-
- CALL catalog_componentPrepare();
- CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode, vWarehouse);
-
- -- Bionizamos lineas con Preu = 0
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT s.id saleFk, vWarehouse warehouseFk
- FROM sale s
- JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0;
-
- CALL ticketComponentUpdateSale(1);
-
- -- Bionizamos lineas con Preu > 0
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT s.id saleFk, vWarehouse warehouseFk
- FROM sale s
- JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew
- AND s.price > 0;
-
- CALL ticketComponentUpdateSale(6);
-
- -- Log
- CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket');
-
- -- Limpieza
- CALL catalog_componentPurge();
- DROP TEMPORARY TABLE IF EXISTS
- tmp.buyUltimate,
- tmp.sale,
- tmp.zoneGetLanded;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-ticketCalculateSaleForcePrice.sql b/db/changes/10180-holyWeek/02-ticketCalculateSaleForcePrice.sql
deleted file mode 100644
index 99ecf739e..000000000
--- a/db/changes/10180-holyWeek/02-ticketCalculateSaleForcePrice.sql
+++ /dev/null
@@ -1,61 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticketCalculateSaleForcePrice`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateSaleForcePrice`(IN vSale BIGINT)
-proc: BEGIN
-
- DECLARE vShipped DATE;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vAddressFk INT;
- DECLARE vTicket BIGINT;
- DECLARE vItem BIGINT;
- DECLARE vZoneFk INT;
-
- SELECT ticketFk, itemFk
- INTO vTicket, vItem
- FROM sale
- WHERE id = vSale;
-
- SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.zoneFk
- INTO vWarehouseFk, vShipped, vAddressFk, vZoneFk
- FROM agencyMode a
- JOIN ticket t ON t.agencyModeFk = a.id
- WHERE t.id = vTicket;
-
- IF vZoneFk IS NULL THEN
- CALL util.throw('ticket without zone');
- END IF;
-
- CALL buyUltimate (vWarehouseFk, vShipped);
-
- DELETE FROM tmp.buyUltimate WHERE itemFk != vItem;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk
- FROM tmp.buyUltimate
- WHERE itemFk = vItem;
-
- CALL catalog_componentPrepare();
- CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT vSale saleFk,vWarehouseFk warehouseFk;
-
- CALL ticketComponentUpdateSale(1);
-
- INSERT INTO vn.ticketLog (originFk, userFk, `action`, description)
- VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
-
- CALL catalog_componentPurge();
- DROP TEMPORARY TABLE tmp.buyUltimate;
- DROP TEMPORARY TABLE tmp.sale;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-ticketComponentUpdateSale.sql b/db/changes/10180-holyWeek/02-ticketComponentUpdateSale.sql
deleted file mode 100644
index b58189ae6..000000000
--- a/db/changes/10180-holyWeek/02-ticketComponentUpdateSale.sql
+++ /dev/null
@@ -1,154 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticketComponentUpdateSale`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentUpdateSale`(vOption INT)
-BEGIN
-/**
- * A partir de la tabla tmp.sale, crea los Movimientos_componentes
- * y modifica el campo Preu de la tabla Movimientos
- *
- * @param i_option integer tipo de actualizacion
- * @param table tmp.sale tabla memory con el campo saleFk, warehouseFk
- **/
- DECLARE vComponentFk INT;
- DECLARE vRenewComponents BOOLEAN;
- DECLARE vKeepPrices BOOLEAN;
-
- CASE vOption
- WHEN 1 THEN
- SET vRenewComponents = TRUE;
- SET vKeepPrices = FALSE;
- WHEN 2 THEN
- SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection';
- SET vRenewComponents = TRUE;
- SET vKeepPrices = TRUE;
- WHEN 3 THEN
- SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana';
- SET vRenewComponents = TRUE;
- SET vKeepPrices = TRUE;
- WHEN 4 THEN
- SELECT id INTO vComponentFk FROM component WHERE `code` = 'buyerDiscount';
- SET vRenewComponents = TRUE;
- SET vKeepPrices = TRUE;
- /* WHEN 5 THEN
- SET vComponentFk = 35;
- SET vRenewComponents = TRUE;
- SET vKeepPrices = TRUE;*/
- WHEN 6 THEN
- SELECT id INTO vComponentFk FROM component WHERE `code` = 'imbalance';
- SET vRenewComponents = TRUE;
- SET vKeepPrices = TRUE;
- WHEN 7 THEN
- REPLACE INTO saleComponent(saleFk, componentFk, value)
- SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3)
- FROM sale s
- JOIN tmp.sale tmps ON tmps.saleFk = s.id
- LEFT JOIN saleComponent sc ON sc.saleFk = s.id
- AND sc.componentFk NOT IN (28, 29)
- GROUP BY s.id;
-
- REPLACE INTO saleComponent(saleFk, componentFk, value)
- SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3)
- FROM sale s
- JOIN tmp.sale tmps ON tmps.saleFk = s.id
- LEFT JOIN saleComponent sc ON sc.saleFk = s.id
- AND sc.componentFk NOT IN (28, 29)
- GROUP BY s.id;
-
- SET vRenewComponents = FALSE;
- SET vKeepPrices = FALSE;
- WHEN 8 THEN
- DELETE sc.*
- FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk;
-
- REPLACE INTO saleComponent(saleFk, componentFk, value)
- SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3)
- FROM sale s
- JOIN tmp.sale tmps ON tmps.saleFk = s.id;
-
- SET vRenewComponents = FALSE;
- SET vKeepPrices = FALSE;
- WHEN 9 THEN
- SET vRenewComponents = TRUE;
- SET vKeepPrices = TRUE;
- END CASE;
-
- IF vRenewComponents THEN
- DELETE sc.*
- FROM tmp.sale tmps
- JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
- JOIN `component` c ON c.id = sc.componentFk
- WHERE c.isRenewable;
-
- REPLACE INTO saleComponent(saleFk, componentFk, value)
- SELECT s.id, tc.componentFk, tc.cost
- FROM sale s
- JOIN tmp.sale tmps ON tmps.saleFk = s.id
- JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
- LEFT JOIN saleComponent sc ON sc.saleFk = s.id
- AND sc.componentFk = tc.componentFk
- LEFT JOIN `component` c ON c.id = tc.componentFk
- WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE);
- END IF;
-
- IF vKeepPrices THEN
- REPLACE INTO saleComponent(saleFk, componentFk, value)
- SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
- FROM sale s
- JOIN tmp.sale tmps ON tmps.saleFk = s.id
- LEFT JOIN saleComponent sc ON sc.saleFk = s.id
- WHERE sc.saleFk <> vComponentFk
- GROUP BY s.id
- HAVING dif <> 0;
- ELSE
- UPDATE sale s
- JOIN item i on i.id = s.itemFk
- JOIN itemType it on it.id = i.typeFk
- JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk
- FROM saleComponent sc
- JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
- GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
- SET s.price = sumValue
- WHERE it.code != 'PRT' ;
-
- REPLACE INTO saleComponent(saleFk, componentFk, value)
- SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue
- FROM sale s
- JOIN tmp.sale tmps ON tmps.saleFk = s.id
- LEFT JOIN saleComponent sc ON sc.saleFk = s.id
- WHERE sc.componentFk != 21
- GROUP BY s.id
- HAVING ROUND(saleValue, 4) <> 0;
- END IF;
-
- UPDATE sale s
- JOIN (
- SELECT SUM(sc.value) sumValue, sc.saleFk
- FROM saleComponent sc
- JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
- JOIN `component` c ON c.id = sc.componentFk
- JOIN componentType ct on ct.id = c.typeFk AND ct.isBase
- GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
- SET s.priceFixed = sumValue, s.isPriceFixed = 1;
-
- DELETE sc.*
- FROM saleComponent sc
- JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
- JOIN sale s on s.id = sc.saleFk
- JOIN item i ON i.id = s.itemFk
- JOIN itemType it ON it.id = i.typeFk
- WHERE it.code = 'PRT';
-
- INSERT INTO saleComponent(saleFk, componentFk, value)
- SELECT s.id, 15, s.price
- FROM sale s
- JOIN tmp.sale tmps ON tmps.saleFk = s.id
- JOIN item i ON i.id = s.itemFK
- JOIN itemType it ON it.id = i.typeFk
- WHERE it.code = 'PRT' AND s.price > 0;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-ticket_componentMakeUpdate.sql b/db/changes/10180-holyWeek/02-ticket_componentMakeUpdate.sql
deleted file mode 100644
index 7fdf3f193..000000000
--- a/db/changes/10180-holyWeek/02-ticket_componentMakeUpdate.sql
+++ /dev/null
@@ -1,107 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticket_componentMakeUpdate`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentMakeUpdate`(
- vTicketFk INT,
- vClientFk INT,
- vAgencyModeFk INT,
- vAddressFk INT,
- vZoneFk INT,
- vWarehouseFk TINYINT,
- vCompanyFk SMALLINT,
- vShipped DATETIME,
- vLanded DATE,
- vIsDeleted BOOLEAN,
- vHasToBeUnrouted BOOLEAN,
- vOption INT)
-BEGIN
-/**
- * Modifica en el ticket los campos que se le pasan por parámetro
- * y cambia sus componentes
- *
- * @param vTicketFk Id del ticket a modificar
- * @param vClientFk nuevo cliente
- * @param vAgencyModeFk nueva agencia
- * @param vAddressFk nuevo consignatario
- * @param vZoneFk nueva zona
- * @param vWarehouseFk nuevo almacen
- * @param vCompanyFk nueva empresa
- * @param vShipped nueva fecha del envio de mercancia
- * @param vLanded nueva fecha de recepcion de mercancia
- * @param vIsDeleted si se borra el ticket
- * @param vHasToBeUnrouted si se le elimina la ruta al ticket
- * @param vOption opcion para el case del proc ticketComponentUpdateSale
- */
- DECLARE vPrice DECIMAL(10,2);
- DECLARE vBonus DECIMAL(10,2);
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
- RESIGNAL;
- END;
-
- CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
-
- START TRANSACTION;
-
- IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
-
- UPDATE ticket t
- JOIN address a ON a.id = vAddressFk
- SET t.nickname = a.nickname
- WHERE t.id = vTicketFk;
-
- END IF;
-
- CALL zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
-
- SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
- FROM tmp.zoneGetShipped
- WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1;
-
- UPDATE ticket t
- SET
- t.clientFk = vClientFk,
- t.agencyModeFk = vAgencyModeFk,
- t.addressFk = vAddressFk,
- t.zoneFk = vZoneFk,
- t.zonePrice = vPrice,
- t.zoneBonus = vBonus,
- t.warehouseFk = vWarehouseFk,
- t.companyFk = vCompanyFk,
- t.landed = vLanded,
- t.shipped = vShipped,
- t.isDeleted = vIsDeleted
- WHERE
- t.id = vTicketFk;
-
- IF vHasToBeUnrouted THEN
- UPDATE ticket t SET t.routeFk = NULL
- WHERE t.id = vTicketFk;
- END IF;
-
- IF vOption <> 8 THEN
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk))
- ENGINE = MEMORY
- SELECT id AS saleFk, vWarehouseFk warehouseFk
- FROM sale s WHERE s.ticketFk = vTicketFk;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
- CREATE TEMPORARY TABLE tmp.ticketComponent
- SELECT * FROM tmp.ticketComponentPreview;
-
- CALL ticketComponentUpdateSale (vOption);
-
- DROP TEMPORARY TABLE tmp.sale;
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
- END IF;
- COMMIT;
-
- DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview;
-END$$
-
-DELIMITER ;
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/02-ticket_componentPreview.sql b/db/changes/10180-holyWeek/02-ticket_componentPreview.sql
deleted file mode 100644
index d69435bb7..000000000
--- a/db/changes/10180-holyWeek/02-ticket_componentPreview.sql
+++ /dev/null
@@ -1,111 +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;
-
- IF vShipped < CURDATE() THEN
- CALL util.throw('ERROR_PAST_SHIPMENT');
- END IF;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-ticket_priceDifference.sql b/db/changes/10180-holyWeek/02-ticket_priceDifference.sql
deleted file mode 100644
index b80ea7f88..000000000
--- a/db/changes/10180-holyWeek/02-ticket_priceDifference.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticket_priceDifference`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_priceDifference`(
- vTicketFk INT,
- vLanded DATE,
- vAddressFk INT,
- vZoneFk INT,
- vWarehouseFk INT)
-BEGIN
-/**
- * Devuelve las diferencias de precio de los movimientos de un ticket.
- *
- * @param vTicketFk Id del ticket
- * @param vLanded Fecha de recepcion
- * @param vAddressFk Id del consignatario
- * @param vZoneFk Id de la zona
- * @param vWarehouseFk Id del almacén
- */
- CALL vn.ticket_componentPreview(vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
-
- SELECT s.itemFk,
- i.name,
- i.size,
- i.category,
- IFNULL(s.quantity, 0) AS quantity,
- IFNULL(s.price, 0) AS price,
- ROUND(SUM(tc.cost), 2) AS newPrice,
- s.quantity * (s.price - ROUND(SUM(tc.cost), 2)) difference,
- s.id AS saleFk
- FROM sale s
- JOIN item i ON i.id = s.itemFk
- JOIN ticket t ON t.id = s.ticketFk
- LEFT JOIN tmp.ticketComponentPreview tc ON tc.itemFk = s.itemFk
- AND tc.warehouseFk = t.warehouseFk
- LEFT JOIN saleComponent sc ON sc.saleFk = s.id
- AND sc.componentFk = tc.componentFk
- LEFT JOIN `component` c ON c.id = tc.componentFk
- WHERE t.id = vTicketFk
- AND IF(sc.componentFk IS NULL
- AND c.classRate IS NOT NULL, FALSE, TRUE)
- GROUP BY s.id ORDER BY s.id;
-
- DROP TEMPORARY TABLE tmp.ticketComponentPreview;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-ticket_recalcComponents.sql b/db/changes/10180-holyWeek/02-ticket_recalcComponents.sql
deleted file mode 100644
index 9ac4942f9..000000000
--- a/db/changes/10180-holyWeek/02-ticket_recalcComponents.sql
+++ /dev/null
@@ -1,94 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticket_recalcComponents`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN)
-proc: BEGIN
-
-/**
- * Este procedimiento recalcula los componentes de un ticket,
- * eliminando los componentes existentes e insertandolos de nuevo
- *
- * @param vTicketFk Id del ticket
- * @param vIsTicketEditable si no se quiere forzar llamar con NULL
- */
- DECLARE vShipped DATE;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vAgencyModeFk INT;
- DECLARE vAddressFk INT;
- DECLARE vLanded DATE;
- DECLARE vZoneFk INTEGER;
-
- IF vIsTicketEditable IS NULL THEN
- SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = ''
- INTO vIsTicketEditable
- FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
- WHERE id = vTicketFk;
- END IF;
-
- SELECT t.warehouseFk,
- t.shipped,
- t.addressFk,
- t.agencyModeFk,
- t.landed,
- t.zoneFk
- INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk
- FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
- WHERE t.id = vTicketFk;
-
- IF vLanded IS NULL OR vZoneFk IS NULL THEN
-
- CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk);
-
- IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
- CALL util.throw('There is no zone for these parameters');
- END IF;
-
- UPDATE ticket t
- SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
- WHERE t.id = vTicketFk AND t.landed IS NULL;
-
- IF vZoneFk IS NULL THEN
- SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
- UPDATE ticket t
- SET t.zoneFk = vZoneFk
- WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
- END IF;
- DROP TEMPORARY TABLE tmp.zoneGetLanded;
-
- END IF;
-
- -- rellena la tabla buyUltimate con la ultima compra
- CALL buyUltimate (vWarehouseFk, vShipped);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouseFk warehouseFk, NULL 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 s.itemFk;
-
- CALL catalog_componentPrepare();
- CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT id saleFk, vWarehouseFk warehouseFk
- FROM sale s
- WHERE s.ticketFk = vTicketFk;
-
- -- si el ticket esta facturado, respeta los precios
- CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6));
-
- CALL catalog_componentPurge();
- DROP TEMPORARY TABLE
- tmp.buyUltimate,
- tmp.sale;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/02-ticket_recalcComponentsForcePrice__.sql b/db/changes/10180-holyWeek/02-ticket_recalcComponentsForcePrice__.sql
deleted file mode 100644
index 995bfbfcd..000000000
--- a/db/changes/10180-holyWeek/02-ticket_recalcComponentsForcePrice__.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticket_recalcComponentsForcePrice`;
diff --git a/db/changes/10180-holyWeek/02-ticket_withoutComponents.sql b/db/changes/10180-holyWeek/02-ticket_withoutComponents.sql
deleted file mode 100644
index de789b956..000000000
--- a/db/changes/10180-holyWeek/02-ticket_withoutComponents.sql
+++ /dev/null
@@ -1,72 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticket_withoutComponents`;
-DROP procedure IF EXISTS `ticket_checkNoComponents`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
-BEGIN
-
-/**
- * Comprueba que los tickets entre un rango de fechas tienen componentes
- *
- * @param vDatedFrom Id del ticket
- * @param vIsTicketEditable si no se quiere forzar llamar con NULL
- */
- DECLARE v_done BOOL DEFAULT FALSE;
- DECLARE vSaleFk INTEGER;
- DECLARE vCur CURSOR FOR
- SELECT s.id
- FROM ticket t
- JOIN client clt ON clt.id = t.clientFk
- JOIN sale s ON s.ticketFk = t.id
- JOIN item i ON i.id = s.itemFk
- JOIN itemType tp ON tp.id = i.typeFk
- JOIN itemCategory ic ON ic.id = tp.categoryFk
- LEFT JOIN tmp.coste c ON c.id = s.id
- WHERE t.shipped >= vDatedFrom AND t.shipped <= vDatedTo
- AND c.id IS NULL
- AND clt.isActive != 0
- AND ic.merchandise != 0
- GROUP BY s.id;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND
- SET v_done = TRUE;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.coste;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.coste;
- CREATE TEMPORARY TABLE tmp.coste
- (primary key (id)) ENGINE = MEMORY
- SELECT s.id
- FROM ticket t
- JOIN client clt ON clt.id = t.clientFk
- JOIN sale s ON s.ticketFk = t.id
- JOIN item i ON i.id = s.itemFk
- JOIN itemType tp ON tp.id = i.typeFk
- JOIN itemCategory ic ON ic.id = tp.categoryFk
- JOIN saleComponent sc ON sc.saleFk = s.id
- JOIN component c ON c.id = sc.componentFk
- JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1
- WHERE t.shipped >= vDatedFrom
- AND ic.merchandise != 0;
-
- OPEN vCur;
-
- l: LOOP
- SET v_done = FALSE;
- FETCH vCur INTO vSaleFk;
-
- IF v_done THEN
- LEAVE l;
- END IF;
-
- CALL sale_calculateComponent(vSaleFk, 1);
- END LOOP;
-
- CLOSE vCur;
- DROP TEMPORARY TABLE tmp.coste;
- END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/03-ekt_load.sql b/db/changes/10180-holyWeek/03-ekt_load.sql
deleted file mode 100644
index 6766cdfaf..000000000
--- a/db/changes/10180-holyWeek/03-ekt_load.sql
+++ /dev/null
@@ -1,162 +0,0 @@
-
-USE `edi`;
-DROP procedure IF EXISTS `ekt_load`;
-
-DELIMITER $$
-USE `edi`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ekt_load`(IN `vSelf` INT)
-BEGIN
- DECLARE vRef INT;
- DECLARE vBuy INT;
- DECLARE vItem INT;
- DECLARE vQty INT;
- DECLARE vPackage INT;
- DECLARE vIsLot BOOLEAN;
- DECLARE vForceToPacking INT DEFAULT 2;
-
- -- Carga los datos necesarios del EKT
-
- SELECT ref, qty, package INTO vRef, vQty, vPackage
- FROM ekt e
- LEFT JOIN item i ON e.ref = i.id
- WHERE e.id = vSelf;
-
- -- Inserta el cubo si no existe
-
- IF vPackage = 800
- THEN
- SET vPackage = 800 + vQty;
-
- INSERT IGNORE INTO vn2008.Cubos SET
- Id_Cubo = vPackage,
- x = 7200 / vQty,
- y = 1;
- ELSE
- INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z)
- SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10)
- FROM bucket WHERE bucket_id = vPackage;
-
- IF ROW_COUNT() > 0
- THEN
- INSERT INTO vn2008.mail SET
- `subject` = 'Cubo añadido',
- `text` = CONCAT('Se ha añadido el cubo: ', vPackage),
- `to` = 'ekt@verdnatura.es';
- END IF;
- END IF;
-
- -- Intenta obtener el artículo en base a los atributos holandeses
-
- INSERT IGNORE INTO item_track SET
- item_id = vRef;
-
- SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem
- FROM vn2008.buy_edi e
- JOIN item_track t ON t.item_id = e.ref
- LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref
- LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id
- JOIN vn2008.config cfg
- WHERE e.id = vSelf
- AND l.id != vSelf
- AND c.Id_Article != cfg.generic_item
- AND IF(t.s1, l.s1 = e.s1, TRUE)
- AND IF(t.s2, l.s2 = e.s2, TRUE)
- AND IF(t.s3, l.s3 = e.s3, TRUE)
- AND IF(t.s4, l.s4 = e.s4, TRUE)
- AND IF(t.s5, l.s5 = e.s5, TRUE)
- AND IF(t.s6, l.s6 = e.s6, TRUE)
- AND IF(t.kop, l.kop = e.kop, TRUE)
- AND IF(t.pac, l.pac = e.pac, TRUE)
- AND IF(t.cat, l.cat = e.cat, TRUE)
- AND IF(t.ori, l.ori = e.ori, TRUE)
- AND IF(t.pro, l.pro = e.pro, TRUE)
- AND IF(t.sub, l.sub = e.sub, TRUE)
- AND IF(t.package, l.package = e.package, TRUE)
- AND c.Id_Article < 170000
- ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1;
-
- -- Determina si el articulo se vende por lotes
-
- IF vItem
- THEN
- SELECT COUNT(*) > 0 INTO vIsLot
- FROM vn2008.Articles a
- LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
- WHERE a.Id_Article = vItem
- AND t.`transaction`;
-
- -- Si el articulo se vende por lotes se inserta un nuevo artículo
-
- IF vIsLot
- THEN
- INSERT INTO vn2008.Articles (
- Article
- ,Medida
- ,Categoria
- ,Id_Origen
- ,iva_group_id
- ,Foto
- ,Color
- ,Codintrastat
- ,tipo_id
- ,Tallos
- )
- SELECT
- i.`name`
- ,IFNULL(e.s1, e.pac)
- ,e.cat
- ,IFNULL(o.id, 17)
- ,IFNULL(a.iva_group_id, 1)
- ,a.Foto
- ,a.Color
- ,a.Codintrastat
- ,IFNULL(a.tipo_id, 10)
- ,IF(a.tipo_id = 15, 0, 1)
- FROM vn2008.buy_edi e
- LEFT JOIN item i ON i.id = e.ref
- LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori
- LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem
- WHERE e.id = vSelf;
-
- SET vItem = LAST_INSERT_ID();
- END IF;
- END IF;
-
- -- Inserta la compra asociada al EKT
-
- INSERT INTO vn2008.Compres
- (
- Id_Entrada
- ,buy_edi_id
- ,Costefijo
- ,Id_Article
- ,`grouping`
- ,caja
- ,Packing
- ,Cantidad
- ,Productor
- ,Etiquetas
- ,Id_Cubo
- ,`weight`
- )
- SELECT
- cfg.edi_entry
- ,vSelf
- ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri
- ,IFNULL(vItem, cfg.generic_item)
- ,IFNULL(c.`grouping`, e.pac)
- ,vForceToPacking
- ,@pac := e.pac / @t
- ,@pac * e.qty
- ,s.company_name
- ,e.qty
- ,IFNULL(c.Id_Cubo, e.package)
- ,a.density * (vn.item_getVolume(a.Id_Article, IFNULL(c.Id_Cubo, e.package)) / 1000000)
- FROM vn2008.buy_edi e
- LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy
- LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article
- LEFT JOIN supplier s ON e.pro = s.supplier_id
- JOIN vn2008.config cfg
- WHERE e.id = vSelf
- LIMIT 1;
-END
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/03-itemDiary.sql b/db/changes/10180-holyWeek/03-itemDiary.sql
deleted file mode 100644
index d30597e14..000000000
--- a/db/changes/10180-holyWeek/03-itemDiary.sql
+++ /dev/null
@@ -1,130 +0,0 @@
-DROP procedure IF EXISTS `vn`.`item_getBalance`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `item_getBalance`(IN vItemId INT, IN vWarehouse INT)
-BEGIN
- DECLARE vDateInventory DATETIME;
- DECLARE vCurdate DATE DEFAULT CURDATE();
- DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
-
- SELECT inventoried INTO vDateInventory FROM config;
- SET @a = 0;
- SET @currentLineFk = 0;
- SET @shipped = '';
-
- SELECT DATE(@shipped:= shipped) shipped,
- alertLevel,
- stateName,
- origin,
- reference,
- clientFk,
- name,
- `in`,
- `out`,
- @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
- @currentLineFk := IF (@shipped < CURDATE()
- OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)),
- lineFk,@currentLineFk) lastPreparedLineFk,
- isTicket,
- lineFk,isPicked
- FROM
- ( SELECT tr.landed as shipped,
- b.quantity as `in`,
- NULL as `out`,
- al.alertLevel as alertLevel,
- st.name AS stateName,
- s.name as name,
- e.ref as reference,
- e.id as origin,
- s.id as clientFk,
- IF(al.alertLevel = 3, TRUE, FALSE) isPicked,
- FALSE AS isTicket,
- b.id lineFk,
- NULL `order`
- FROM buy b
- JOIN entry e ON e.id = b.entryFk
- JOIN travel tr ON tr.id = e.travelFk
- JOIN supplier s ON s.id = e.supplierFk
- JOIN alertLevel al ON al.alertLevel =
- CASE
- WHEN tr.shipped < CURDATE() THEN 3
- WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
- ELSE 0
- END
- JOIN state st ON st.code = al.code
- WHERE tr.landed >= vDateInventory
- AND vWarehouse = tr.warehouseInFk
- AND b.itemFk = vItemId
- AND e.isInventory = FALSE
- AND e.isRaid = FALSE
- UNION ALL
-
- SELECT tr.shipped,
- NULL as `in`,
- b.quantity as `out`,
- al.alertLevel as alertLevel,
- st.name AS stateName,
- s.name as name,
- e.ref as reference,
- e.id as origin,
- s.id as clientFk,
- IF(al.alertLevel = 3, TRUE, FALSE) isPicked,
- FALSE AS isTicket,
- b.id,
- NULL `order`
- FROM buy b
- JOIN entry e ON e.id = b.entryFk
- JOIN travel tr ON tr.id = e.travelFk
- JOIN warehouse w ON w.id = tr.warehouseOutFk
- JOIN supplier s ON s.id = e.supplierFk
- JOIN alertLevel al ON al.alertLevel =
- CASE
- WHEN tr.shipped < CURDATE() THEN 3
- WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
- ELSE 0
- END
- JOIN state st ON st.code = al.code
- WHERE tr.shipped >= vDateInventory
- AND vWarehouse =tr.warehouseOutFk
- AND s.id <> 4
- AND b.itemFk = vItemId
- AND e.isInventory = FALSE
- AND w.isFeedStock = FALSE
- AND e.isRaid = FALSE
- UNION ALL
-
- SELECT DATE(t.shipped),
- NULL as `in`,
- s.quantity as `out`,
- al.alertLevel as alertLevel,
- st.name AS stateName,
- t.nickname as name,
- t.refFk as reference,
- t.id as origin,
- t.clientFk,
- stk.id as isPicked,
- TRUE as isTicket,
- s.id,
- st.`order`
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- LEFT JOIN ticketState ts ON ts.ticket = t.id
- LEFT JOIN state st ON st.code = ts.code
- JOIN client c ON c.id = t.clientFk
- JOIN alertLevel al ON al.alertLevel =
- CASE
- WHEN t.shipped < curdate() THEN 3
- WHEN t.shipped > util.dayEnd(curdate()) THEN 0
- ELSE IFNULL(ts.alertLevel, 0)
- END
- LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
- LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id
- WHERE t.shipped >= vDateInventory
- AND s.itemFk = vItemId
- AND vWarehouse =t.warehouseFk
- ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC
- ) AS itemDiary;
-
-END$$
-delimiter ;
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/03-ticketCalculateSaleForcePrice2__.sql b/db/changes/10180-holyWeek/03-ticketCalculateSaleForcePrice2__.sql
deleted file mode 100644
index a880135ba..000000000
--- a/db/changes/10180-holyWeek/03-ticketCalculateSaleForcePrice2__.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticketCalculateSaleForcePrice2`;
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/03-ticketCalculateSaleForcePrice__.sql b/db/changes/10180-holyWeek/03-ticketCalculateSaleForcePrice__.sql
deleted file mode 100644
index d7eb5d32b..000000000
--- a/db/changes/10180-holyWeek/03-ticketCalculateSaleForcePrice__.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticketCalculateSaleForcePrice`;
\ No newline at end of file
diff --git a/db/changes/10180-holyWeek/03-ticketCalculateSale__.sql b/db/changes/10180-holyWeek/03-ticketCalculateSale__.sql
deleted file mode 100644
index acefc29d5..000000000
--- a/db/changes/10180-holyWeek/03-ticketCalculateSale__.sql
+++ /dev/null
@@ -1,68 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticketCalculateSale`;
-DROP procedure IF EXISTS `ticketCalculateSale__`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateSale__`(IN vSale BIGINT)
-proc: BEGIN
--- OBSOLETO USAR: sale_calculateComponent(vSale, NULL)
- DECLARE vShipped DATE;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vAgencyModeFk INT;
- DECLARE vAddressFk INT;
- DECLARE vTicket BIGINT;
- DECLARE vItem BIGINT;
- DECLARE vLanded DATE;
- DECLARE vTicketFree BOOLEAN DEFAULT TRUE;
- DECLARE vZoneFk INTEGER;
-
- SELECT NOT (t.refFk IS NOT NULL OR ts.alertLevel > 0) OR s.price = 0, s.ticketFk, s.itemFk , t.zoneFk
- INTO vTicketFree, vTicket, vItem, vZoneFk
- FROM vn.ticket t
- JOIN vn.sale s ON s.ticketFk = t.id
- LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
- WHERE s.id = vSale
- LIMIT 1;
-
- SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.agencyModeFk, t.landed
- INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded
- FROM agencyMode a
- JOIN ticket t ON t.agencyModeFk = a.id
- WHERE t.id = vTicket;
-
- IF IFNULL(vZoneFk,0) = 0 THEN
- CALL util.throw('ticket dont have zone');
- END IF;
-
- CALL buyUltimate (vWarehouseFk, vShipped);
-
- DELETE FROM tmp.buyUltimate WHERE itemFk != vItem;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk
- FROM tmp.buyUltimate
- WHERE itemFk = vItem;
-
- CALL vn.catalog_componentCalculate;
- CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT vSale saleFk,vWarehouseFk warehouseFk;
-
- CALL ticketComponentUpdateSale(IF(vTicketFree,1,6));
-
- INSERT INTO vn.ticketLog (originFk, userFk, `action`, description)
- VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
-
- CALL catalog_componentPurge();
- DROP TEMPORARY TABLE tmp.buyUltimate;
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10180-holyWeek/03-ticket_componentUpdate__.sql b/db/changes/10180-holyWeek/03-ticket_componentUpdate__.sql
deleted file mode 100644
index f75f157e8..000000000
--- a/db/changes/10180-holyWeek/03-ticket_componentUpdate__.sql
+++ /dev/null
@@ -1,83 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `vn`.`ticket_componentUpdate`;
-DROP procedure IF EXISTS `vn`.`ticket_componentUpdate__`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentUpdate__`(
- vTicketFk INT,
- vClientFk INT,
- vAgencyModeFk INT,
- vAddressFk INT,
- vZoneFk INT,
- vWarehouseFk TINYINT,
- vCompanyFk SMALLINT,
- vShipped DATETIME,
- vLanded DATE,
- vIsDeleted BOOLEAN,
- vHasToBeUnrouted BOOLEAN,
- vOption INT)
-BEGIN
- DECLARE vPrice DECIMAL(10,2);
- DECLARE vBonus DECIMAL(10,2);
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
- RESIGNAL;
- END;
-
- START TRANSACTION;
-
- IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
-
- UPDATE ticket t
- JOIN address a ON a.id = vAddressFk
- SET t.nickname = a.nickname
- WHERE t.id = vTicketFk;
-
- END IF;
-
- CALL vn.zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
-
- SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
- FROM tmp.zoneGetShipped
- WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1;
-
- UPDATE ticket t
- SET
- t.clientFk = vClientFk,
- t.agencyModeFk = vAgencyModeFk,
- t.addressFk = vAddressFk,
- t.zoneFk = vZoneFk,
- t.zonePrice = vPrice,
- t.zoneBonus = vBonus,
- t.warehouseFk = vWarehouseFk,
- t.companyFk = vCompanyFk,
- t.landed = vLanded,
- t.shipped = vShipped,
- t.isDeleted = vIsDeleted
- WHERE
- t.id = vTicketFk;
-
- IF vHasToBeUnrouted THEN
- UPDATE ticket t SET t.routeFk = NULL
- WHERE t.id = vTicketFk;
- END IF;
-
- IF vOption <> 8 THEN
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk))
- ENGINE = MEMORY
- SELECT id AS saleFk, vWarehouseFk warehouseFk
- FROM sale s WHERE s.ticketFk = vTicketFk;
-
- CALL ticketComponentUpdateSale (vOption);
-
- DROP TEMPORARY TABLE tmp.sale;
- END IF;
- COMMIT;
-END$$
-
-DELIMITER ;
-;
diff --git a/db/changes/10180-holyWeek/03-zone_UpcomingDeliveries.sql b/db/changes/10180-holyWeek/03-zone_UpcomingDeliveries.sql
deleted file mode 100644
index c8f85527e..000000000
--- a/db/changes/10180-holyWeek/03-zone_UpcomingDeliveries.sql
+++ /dev/null
@@ -1,80 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `zone_upcomingDeliveries`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_upcomingDeliveries`()
-BEGIN
- DECLARE vForwardDays INT;
-
- SELECT forwardDays INTO vForwardDays FROM zoneConfig;
- CALL util.time_createTable(CURDATE(), DATE_ADD(CURDATE(), INTERVAL vForwardDays DAY));
-
- DROP TEMPORARY TABLE IF EXISTS tLandings;
- CREATE TEMPORARY TABLE tLandings
- (INDEX (eventFk))
- ENGINE = MEMORY
- SELECT e.id eventFk,
- @travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays,
- TIMESTAMPADD(DAY, @travelingDays, ti.dated) landed,
- ti.dated shipped
- FROM zone z
- JOIN zoneEvent e ON e.zoneFk = z.id
- JOIN tmp.time ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate());
-
- DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption;
- CREATE TEMPORARY TABLE tmp.zoneOption
- ENGINE = MEMORY
- SELECT *
- FROM (
- SELECT z.id zoneFk,
- TIME(IFNULL(e.`hour`, z.`hour`)) `hour`,
- l.travelingDays,
- IFNULL(e.price, z.price) price,
- IFNULL(e.bonus, z.bonus) bonus,
- l.landed,
- l.shipped
- FROM zone z
- JOIN zoneEvent e ON e.zoneFk = z.id
- JOIN tLandings l ON l.eventFk = e.id
- WHERE (
- e.`type` = 'day'
- AND e.`dated` = l.landed
- ) OR (
- e.`type` != 'day'
- AND e.weekDays & (1 << WEEKDAY(l.landed))
- AND (e.`started` IS NULL OR l.landed >= e.`started`)
- AND (e.`ended` IS NULL OR l.landed <= e.`ended`)
- )
- ORDER BY
- zoneFk,
- CASE
- WHEN e.`type` = 'day'
- THEN 1
- WHEN e.`type` = 'range'
- THEN 2
- ELSE 3
- END
- ) t
- GROUP BY zoneFk, landed;
-
- DELETE t FROM tmp.zoneOption t
- JOIN zoneExclusion e
- ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed;
-
- SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped
- FROM tmp.zoneOption zo
- JOIN `zone` z ON z.id = zo.zoneFk
- JOIN agencyMode am ON am.id = z.agencyModeFk
- JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
- JOIN zoneIncluded zi ON zi.zoneFk = z.id
- JOIN zoneGeo zg ON zg.id = zi.geoFk AND zg.type = 'province'
- WHERE dm.code = 'DELIVERY'
- GROUP BY shipped, zg.`name`
- ORDER BY shipped, zg.`name`;
-
- DROP TEMPORARY TABLE tmp.time, tLandings;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10190-PostErte/00-route.sql b/db/changes/10190-PostErte/00-route.sql
deleted file mode 100644
index 5ffab3a46..000000000
--- a/db/changes/10190-PostErte/00-route.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-ALTER TABLE `vn`.`route`
-DROP FOREIGN KEY `fk_route_1`;
-ALTER TABLE `vn`.`route`
-ADD CONSTRAINT `fk_route_1`
- FOREIGN KEY (`zoneFk`)
- REFERENCES `vn`.`zone` (`id`)
- ON DELETE SET NULL
- ON UPDATE CASCADE;
diff --git a/db/changes/10190-PostErte/00-saleCalculateComponent.sql b/db/changes/10190-PostErte/00-saleCalculateComponent.sql
deleted file mode 100644
index 8ab498f57..000000000
--- a/db/changes/10190-PostErte/00-saleCalculateComponent.sql
+++ /dev/null
@@ -1,99 +0,0 @@
-
-DROP procedure IF EXISTS `vn`.`sale_calculateComponent`;
-
-DELIMITER $$
-CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sale_calculateComponent`(vSale INT, vOption INT)
-proc: BEGIN
-/**
- * Actualiza los componentes
- *
- * @param vSale Delivery date
- * @param vOption indica en que componente pone el descuadre, NULL en casos habituales
- */
- DECLARE vShipped DATE;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vAgencyModeFk INT;
- DECLARE vAddressFk INT;
- DECLARE vTicketFk BIGINT;
- DECLARE vItemFk BIGINT;
- DECLARE vLanded DATE;
- DECLARE vIsEditable BOOLEAN;
- DECLARE vZoneFk INTEGER;
-
- SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0),
- s.ticketFk,
- s.itemFk ,
- t.zoneFk,
- t.warehouseFk,
- t.shipped,
- t.addressFk,
- t.agencyModeFk,
- t.landed
- INTO vIsEditable,
- vTicketFk,
- vItemFk,
- vZoneFk,
- vWarehouseFk,
- vShipped,
- vAddressFk,
- vAgencyModeFk,
- vLanded
- FROM ticket t
- JOIN sale s ON s.ticketFk = t.id
- LEFT JOIN ticketState ts ON ts.ticketFk = t.id
- WHERE s.id = vSale;
-
- IF vLanded IS NULL OR vZoneFk IS NULL THEN
-
- CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
-
- IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
- CALL util.throw('There is no zone for these parameters');
- END IF;
-
- UPDATE ticket t
- SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
- WHERE t.id = vTicketFk AND t.landed IS NULL;
-
- IF vZoneFk IS NULL THEN
- SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
- UPDATE ticket t
- SET t.zoneFk = vZoneFk
- WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
- END IF;
- DROP TEMPORARY TABLE tmp.zoneGetLanded;
-
- END IF;
-
- -- rellena la tabla buyUltimate con la ultima compra
- CALL buyUltimate (vWarehouseFk, vShipped);
-
- DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk
- FROM tmp.buyUltimate
- WHERE itemFk = vItemFk;
-
- CALL catalog_componentPrepare();
- CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT vSale saleFk,vWarehouseFk warehouseFk;
-
- IF vOption IS NULL THEN
- SET vOption = IF(vIsEditable, 1, 6);
- END IF;
-
- CALL ticketComponentUpdateSale(vOption);
- CALL catalog_componentPurge();
-
- DROP TEMPORARY TABLE tmp.buyUltimate;
- DROP TEMPORARY TABLE tmp.sale;
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10190-PostErte/01-ticketCalculateClon.sql b/db/changes/10190-PostErte/01-ticketCalculateClon.sql
deleted file mode 100644
index 6e2906f6a..000000000
--- a/db/changes/10190-PostErte/01-ticketCalculateClon.sql
+++ /dev/null
@@ -1,93 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticketCalculateClon`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
-BEGIN
-/*
- * Recalcula los componentes un ticket clonado,
- * las lineas a precio cero fuerza para que tengan precio, el resto lo respeta
- * @param vTicketNew nuevo ticket clonado
- * @param vTicketOld icket original, a partir del qual se clonara el nuevo
-*/
- DECLARE vShipped DATE;
- DECLARE vClient INT;
- DECLARE vWarehouse SMALLINT;
- DECLARE vAgencyMode INT;
- DECLARE vAddress INT;
- DECLARE vLanded DATE;
- DECLARE vAgency INT;
- DECLARE vZoneFk INT;
-
- REPLACE INTO orderTicket(orderFk,ticketFk)
- SELECT orderFk, vTicketNew
- FROM orderTicket
- WHERE ticketFk = vTicketOld;
-
- SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk
- INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk
- FROM agencyMode a
- JOIN ticket t ON t.agencyModeFk = a.id
- WHERE t.id = vTicketNew;
-
- IF vLanded IS NULL THEN
- CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse, TRUE);
- UPDATE ticket t
- JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk
- SET t.landed = zgl.landed,
- t.zone = zgl.zoneFk
- WHERE t.id = vTicketNew;
-
- SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
- DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
- END IF;
-
- -- rellena la tabla tmp.buyUltimate con la ultima compra
- CALL buyUltimate(vWarehouse, vShipped);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
- FROM sale s
- LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
- WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk;
-
- CALL catalog_componentPrepare();
- CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode, vWarehouse);
-
- -- Bionizamos lineas con Preu = 0
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT s.id saleFk, vWarehouse warehouseFk
- FROM sale s
- JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0;
-
- CALL ticketComponentUpdateSale(1);
-
- -- Bionizamos lineas con Preu > 0
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT s.id saleFk, vWarehouse warehouseFk
- FROM sale s
- JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew
- AND s.price > 0;
-
- CALL ticketComponentUpdateSale(6);
-
- -- Log
- CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket');
-
- -- Limpieza
- CALL catalog_componentPurge();
- DROP TEMPORARY TABLE IF EXISTS
- tmp.buyUltimate,
- tmp.sale,
- tmp.zoneGetLanded;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10190-PostErte/01-ticket_cloneWeekly.sql b/db/changes/10190-PostErte/01-ticket_cloneWeekly.sql
deleted file mode 100644
index 137386ac9..000000000
--- a/db/changes/10190-PostErte/01-ticket_cloneWeekly.sql
+++ /dev/null
@@ -1,132 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticket_cloneWeekly`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT)
-BEGIN
- DECLARE vIsDone BOOL;
- DECLARE vLanding DATE;
- DECLARE vShipment DATE;
- DECLARE vWarehouse INT;
- DECLARE vTicket INT;
- DECLARE vWeekDay INT;
- DECLARE vClient INT;
- DECLARE vEmpresa INT;
- DECLARE vAddressFk INT;
- DECLARE vAgencyModeFk INT;
- DECLARE vNewTicket INT;
- DECLARE vYear INT;
-
- DECLARE rsTicket CURSOR FOR
- SELECT tw.ticketFk, weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tw.agencyModeFk
- FROM ticketWeekly tw
- JOIN ticket t ON tt.ticketFk = t.id;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
-
- SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
-
- OPEN rsTicket;
-
- myLoop: LOOP
- BEGIN
- DECLARE vError TEXT;
- DECLARE vSalesPersonEmail VARCHAR(150);
- DECLARE vMailSent BOOL;
- DECLARE vSubject VARCHAR(150);
- DECLARE vMessage TEXT;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- GET DIAGNOSTICS CONDITION 1
- vError = MESSAGE_TEXT;
- END;
-
- SET vIsDone = FALSE;
- FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk;
-
- IF vIsDone THEN
-
- LEAVE myLoop;
- END IF;
- SELECT date INTO vShipment
- FROM `time`
- WHERE `year` = vYear AND `week` = vWeek
- AND WEEKDAY(date) = vWeekDay;
-
- -- busca si el ticket ya ha sido clonado
- IF (SELECT COUNT(*) FROM vn.ticket tOrig
- JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
- JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
- JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
- JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
- WHERE tOrig.id = vTicket AND DATE(tClon.shipped) = vShipment) > 0
- THEN
- ITERATE myLoop;
- END IF;
- CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouse, TRUE);
-
- SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
-
- CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk, NULL, vLanding, account.userGetId(), vNewTicket);
-
- IF (vLanding IS NULL) THEN
-
- SELECT e.email INTO vSalesPersonEmail
- FROM vn.client c
- JOIN vn.worker sp ON sp.id = c.salesPersonFk
- JOIN account.emailUser e ON e.userFk = sp.userFk
- WHERE c.id = vClient;
-
- SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
- ' para el dia: ', vShipment);
- SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
- ' para el dia: ', vShipment,
- ' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
- ' pero ha que revisar las fechas y la agencia');
-
- SELECT COUNT(*) INTO vMailSent
- FROM vn.mail
- WHERE sender = vSalesPersonEmail
- AND subject = vSubject;
-
- IF NOT vMailSent THEN
- INSERT INTO vn.mail (sender,`subject`,body)
- VALUES (vSalesPersonEmail, vSubject, vMessage);
- END IF;
- CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
- END IF;
-
- INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
- SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
- FROM vn.ticket tOrig
- JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
- LEFT JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
- LEFT JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
- LEFT JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk AND DATE(tClon.shipped) = vShipment
- WHERE tOrig.id = vTicket AND saleClon.id IS NULL;
-
- INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
- SELECT saleOriginal.id, saleClon.id
- FROM vn.sale saleOriginal
- JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
- WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
-
- INSERT INTO ticketRequest (description, ordered, shipped, salesPersonCode, buyerCode, quantity, price,
- itemFk ,clientFk, response, total, buyed, saleFk)
- SELECT tr.description, tr.ordered, tr.shipped, tr.salesPersonCode, tr.buyerCode, tr.quantity, tr.price,
- tr.itemFk, tr.clientFk, tr.response, tr.total, tr.buyed, tr.saleFk
- FROM sale s JOIN ticketRequest tr ON tr.saleFk = s.id
- JOIN sale s2 ON s.concept = s2.concept AND s.quantity = s2.quantity AND m.Id_Article = m2.Id_Article
- WHERE s.ticketFk = vTicket AND s2.ticketFk = vNewTicket;
-
- CALL vn.ticketCalculateClon(vNewTicket, vTicket);
- END;
- END LOOP;
-
- CLOSE rsTicket;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10190-PostErte/01-ticket_recalcComponents.sql b/db/changes/10190-PostErte/01-ticket_recalcComponents.sql
deleted file mode 100644
index 8a8f71ea4..000000000
--- a/db/changes/10190-PostErte/01-ticket_recalcComponents.sql
+++ /dev/null
@@ -1,93 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `ticket_recalcComponents`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN)
-proc: BEGIN
-
-/**
- * Este procedimiento recalcula los componentes de un ticket,
- * eliminando los componentes existentes e insertandolos de nuevo
- *
- * @param vTicketFk Id del ticket
- * @param vIsTicketEditable si no se quiere forzar llamar con NULL
- */
- DECLARE vShipped DATE;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vAgencyModeFk INT;
- DECLARE vAddressFk INT;
- DECLARE vLanded DATE;
- DECLARE vZoneFk INTEGER;
-
- IF vIsTicketEditable IS NULL THEN
- SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = ''
- INTO vIsTicketEditable
- FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
- WHERE id = vTicketFk;
- END IF;
-
- SELECT t.warehouseFk,
- t.shipped,
- t.addressFk,
- t.agencyModeFk,
- t.landed,
- t.zoneFk
- INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk
- FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
- WHERE t.id = vTicketFk;
-
- IF vLanded IS NULL OR vZoneFk IS NULL THEN
-
- CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
-
- IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
- CALL util.throw('There is no zone for these parameters');
- END IF;
-
- UPDATE ticket t
- SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
- WHERE t.id = vTicketFk AND t.landed IS NULL;
-
- IF vZoneFk IS NULL THEN
- SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
- UPDATE ticket t
- SET t.zoneFk = vZoneFk
- WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
- END IF;
- DROP TEMPORARY TABLE tmp.zoneGetLanded;
-
- END IF;
-
- -- rellena la tabla buyUltimate con la ultima compra
- CALL buyUltimate (vWarehouseFk, vShipped);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
- CREATE TEMPORARY TABLE tmp.ticketLot
- SELECT vWarehouseFk warehouseFk, NULL 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 s.itemFk;
-
- CALL catalog_componentPrepare();
- CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk)) ENGINE = MEMORY
- SELECT id saleFk, vWarehouseFk warehouseFk
- FROM sale s
- WHERE s.ticketFk = vTicketFk;
-
- -- si el ticket esta facturado, respeta los precios
- CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6));
-
- CALL catalog_componentPurge();
- DROP TEMPORARY TABLE
- tmp.buyUltimate,
- tmp.sale;
-END$$
-
-DELIMITER ;
\ No newline at end of file
diff --git a/db/changes/10190-PostErte/01-zone_getLanded.sql b/db/changes/10190-PostErte/01-zone_getLanded.sql
deleted file mode 100644
index 4ddac0112..000000000
--- a/db/changes/10190-PostErte/01-zone_getLanded.sql
+++ /dev/null
@@ -1,40 +0,0 @@
-USE `vn`;
-DROP procedure IF EXISTS `zone_getLanded`;
-
-DELIMITER $$
-USE `vn`$$
-CREATE DEFINER=`root`@`%` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN)
-BEGIN
-/**
-* Devuelve una tabla temporal con el dia de recepcion para vShipped.
-*
-* @param vShipped Fecha de preparacion de mercancia
-* @param vAddressFk Id de consignatario, %NULL para recogida
-* @param vAgencyModeFk Id agencia
-* @param vWarehouseFk vWarehouseFk
-* @table tmp.zoneGetLanded Datos de recepción
-*/
-
- CALL zone_getFromGeo(address_getGeo(vAddressFk));
- CALL zone_getOptionsForShipment(vShipped, vShowExpiredZones);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
- CREATE TEMPORARY TABLE tmp.zoneGetLanded
- ENGINE = MEMORY
- SELECT vWarehouseFk warehouseFk,
- TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed,
- zo.zoneFk
- FROM tmp.zoneOption zo
- JOIN zone z ON z.id = zo.zoneFk
- JOIN zoneWarehouse zw ON zw.zoneFk = z.id
- WHERE agencyModeFk = vAgencyModeFk
- AND zw.warehouseFk = vWarehouseFk;
-
- DROP TEMPORARY TABLE
- tmp.zone,
- tmp.zoneOption;
-
-END$$
-
-DELIMITER ;
-
diff --git a/db/changes/10200-normality/00-ACL.sql b/db/changes/10200-normality/00-ACL.sql
new file mode 100644
index 000000000..ad9bc79d6
--- /dev/null
+++ b/db/changes/10200-normality/00-ACL.sql
@@ -0,0 +1,2 @@
+UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '155');
+UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '157');
diff --git a/db/changes/10190-PostErte/00-itemLastEntry.sql b/db/changes/10200-normality/00-itemLastEntries.sql
similarity index 89%
rename from db/changes/10190-PostErte/00-itemLastEntry.sql
rename to db/changes/10200-normality/00-itemLastEntries.sql
index b293c234e..ce600b39f 100644
--- a/db/changes/10190-PostErte/00-itemLastEntry.sql
+++ b/db/changes/10200-normality/00-itemLastEntries.sql
@@ -1,8 +1,10 @@
+USE `vn`;
DROP procedure IF EXISTS `vn`.`itemLastEntries`;
DELIMITER $$
-CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`itemLastEntries`(IN `vItem` INT, IN `vDays` DATE)
+USE `vn`$$
+CREATE DEFINER=`root`@`%` PROCEDURE `itemLastEntries__`(IN `vItem` INT, IN `vDays` DATE)
BEGIN
SELECT
w.id AS warehouseFk,
@@ -39,4 +41,4 @@ BEGIN
END$$
DELIMITER ;
-
+;
diff --git a/db/changes/12200-Normalidad/00-zoneEstimatedDelivery.sql b/db/changes/10200-normality/00-zoneEstimatedDelivery.sql
similarity index 100%
rename from db/changes/12200-Normalidad/00-zoneEstimatedDelivery.sql
rename to db/changes/10200-normality/00-zoneEstimatedDelivery.sql
diff --git a/db/changes/10200-normality/01-calendar_employee.sql b/db/changes/10200-normality/01-calendar_employee.sql
deleted file mode 100644
index c5db9da2c..000000000
--- a/db/changes/10200-normality/01-calendar_employee.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-ALTER TABLE `postgresql`.`calendar_employee`
-ADD COLUMN `id` INT NULL AUTO_INCREMENT FIRST,
-ADD UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE,
-ADD INDEX `id_index` (`id` ASC) VISIBLE;
-;
diff --git a/db/changes/12200-Normalidad/01-zoneETD.sql b/db/changes/10200-normality/01-zoneETD.sql
similarity index 100%
rename from db/changes/12200-Normalidad/01-zoneETD.sql
rename to db/changes/10200-normality/01-zoneETD.sql
diff --git a/db/changes/10200-normality/02-workerCalendar.sql b/db/changes/10200-normality/02-workerCalendar.sql
deleted file mode 100644
index 479470ac0..000000000
--- a/db/changes/10200-normality/02-workerCalendar.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-USE `vn`;
-CREATE
- OR REPLACE ALGORITHM = UNDEFINED
- DEFINER = `root`@`%`
- SQL SECURITY DEFINER
-VIEW `workerCalendar2` AS
- SELECT
- `ce`.`id` AS `id`,
- `ce`.`business_id` AS `businessFk`,
- `ce`.`calendar_state_id` AS `absenceTypeFk`,
- `ce`.`date` AS `dated`
- FROM `postgresql`.`calendar_employee` `ce`;
diff --git a/db/changes/10210-summer/00-accountingType.sql b/db/changes/10210-summer/00-accountingType.sql
new file mode 100644
index 000000000..1dbe29952
--- /dev/null
+++ b/db/changes/10210-summer/00-accountingType.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `vn`.`accountingType`
+ADD COLUMN `receiptDescription` VARCHAR(50) NULL AFTER `description`;
diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql
index bd117cd30..ae20b019c 100644
--- a/db/dump/dumpedFixtures.sql
+++ b/db/dump/dumpedFixtures.sql
@@ -36,7 +36,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 9:52:59
+-- Dump completed on 2020-08-11 11:50:54
USE `account`;
-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64)
--
@@ -94,7 +94,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 9:53:01
+-- Dump completed on 2020-08-11 11:50:55
USE `salix`;
-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64)
--
@@ -142,7 +142,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 9:53:02
+-- Dump completed on 2020-08-11 11:50:56
USE `vn`;
-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64)
--
@@ -227,7 +227,7 @@ UNLOCK TABLES;
LOCK TABLES `tag` WRITE;
/*!40000 ALTER TABLE `tag` DISABLE KEYS */;
-INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL),(2,NULL,'Forma',1,0,NULL,NULL,NULL),(3,NULL,'Material',1,0,NULL,NULL,NULL),(4,NULL,'Longitud',1,1,NULL,'mm',NULL),(5,NULL,'Diámetro',1,1,NULL,'mm',NULL),(6,NULL,'Perímetro',1,1,NULL,'mm',NULL),(7,NULL,'Ancho de la base',1,1,NULL,'mm',NULL),(8,NULL,'Altura',1,1,NULL,'mm',NULL),(9,NULL,'Volumen',1,1,NULL,'ml',NULL),(10,NULL,'Densidad',1,1,NULL,NULL,NULL),(11,NULL,'Calidad',1,0,NULL,NULL,NULL),(12,NULL,'Textura',1,0,NULL,NULL,NULL),(13,NULL,'Material del mango',1,0,NULL,NULL,NULL),(14,NULL,'Compra mínima',1,0,NULL,NULL,NULL),(15,NULL,'Nº pétalos',1,1,NULL,NULL,NULL),(16,NULL,'Ancho',1,1,NULL,'mm',NULL),(18,NULL,'Profundidad',1,1,NULL,'mm',NULL),(19,NULL,'Largo',1,1,NULL,'mm',NULL),(20,NULL,'Ancho superior',1,1,NULL,'mm',NULL),(21,NULL,'Ancho inferior',1,1,NULL,'mm',NULL),(22,NULL,'Gramaje',1,1,NULL,'g',NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL),(24,NULL,'Estado',1,0,NULL,NULL,NULL),(25,NULL,'Color principal',0,0,'ink',NULL,NULL),(26,NULL,'Color secundario',0,0,'ink',NULL,NULL),(27,NULL,'Longitud(cm)',1,1,NULL,'cm',NULL),(28,NULL,'Diámetro base',1,1,'','mm',NULL),(29,NULL,'Colección',1,0,NULL,NULL,NULL),(30,NULL,'Uds / caja',1,1,NULL,NULL,NULL),(31,NULL,'Contenido',1,0,NULL,NULL,NULL),(32,NULL,'Peso',1,1,NULL,'g',NULL),(33,NULL,'Grosor',1,1,NULL,'mm',NULL),(34,NULL,'Marca',1,0,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL),(36,NULL,'Proveedor',1,0,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL),(38,NULL,'Duración',1,1,NULL,'s',NULL),(39,NULL,'Flor',1,0,NULL,NULL,NULL),(40,NULL,'Soporte',1,0,NULL,NULL,NULL),(41,NULL,'Tamaño flor',1,0,NULL,NULL,NULL),(42,NULL,'Apertura',1,0,NULL,NULL,NULL),(43,NULL,'Tallo',1,0,NULL,NULL,NULL),(44,NULL,'Nº hojas',1,1,NULL,NULL,NULL),(45,NULL,'Dimensiones',1,0,NULL,NULL,NULL),(46,NULL,'Diámetro boca',1,1,NULL,'mm',NULL),(47,NULL,'Nº flores',1,1,NULL,NULL,NULL),(48,NULL,'Uds / paquete',1,1,NULL,NULL,NULL),(49,NULL,'Maceta',1,1,NULL,'cm',NULL),(50,NULL,'Textura flor',1,0,NULL,NULL,NULL),(51,NULL,'Textura hoja',1,0,NULL,NULL,NULL),(52,NULL,'Tipo de IVA',1,0,NULL,NULL,NULL),(53,NULL,'Tronco',1,0,NULL,NULL,NULL),(54,NULL,'Hoja',1,0,NULL,NULL,NULL),(55,NULL,'Formato',1,0,NULL,NULL,NULL),(56,NULL,'Genero',1,0,NULL,NULL,NULL),(57,NULL,'Especie',1,0,NULL,NULL,NULL),(58,NULL,'Variedad',1,0,NULL,NULL,NULL),(59,NULL,'Medida grande',1,0,NULL,NULL,NULL),(60,NULL,'Medida mediano',1,0,NULL,NULL,NULL),(61,NULL,'Medida pequeño',1,0,NULL,NULL,NULL),(63,NULL,'Recipiente interior',1,0,NULL,NULL,NULL),(64,NULL,'Material secundario',1,0,NULL,NULL,NULL),(65,NULL,'Colores',1,0,NULL,NULL,NULL),(66,NULL,'Referencia',1,0,NULL,NULL,NULL),(67,'category','Categoria',1,0,NULL,NULL,NULL),(68,NULL,'Amb',1,0,NULL,NULL,NULL),(69,NULL,'Anchura',1,1,NULL,'cm',NULL),(70,NULL,'Hueco interior',1,0,NULL,NULL,NULL),(71,NULL,'Tamaño',1,0,NULL,NULL,NULL),(72,NULL,'Color botón',1,0,NULL,NULL,NULL),(73,NULL,'Tamaño minimo del botón',1,0,NULL,NULL,NULL),(74,NULL,'Obtentor',1,0,NULL,NULL,NULL),(75,NULL,'Longitud del brote',1,0,NULL,NULL,NULL),(76,NULL,'Tallos / u.v.',1,0,NULL,NULL,NULL),(77,NULL,'Madera de',1,0,NULL,NULL,NULL),(78,NULL,'Unidad de venta',1,0,NULL,NULL,NULL),(79,NULL,'Temporal',1,0,NULL,NULL,NULL),(80,NULL,'Gramaje/tallo',1,1,NULL,'g',NULL),(81,NULL,'Peso/paquete',1,1,NULL,'g',NULL),(82,NULL,'Flexibilidad del tallo',1,0,NULL,NULL,NULL),(83,NULL,'Nº planchas',1,1,NULL,NULL,NULL),(84,NULL,'Nº páginas',1,1,NULL,NULL,NULL),(85,NULL,'Editorial',1,0,NULL,NULL,NULL),(86,NULL,'Idioma',1,0,NULL,NULL,NULL),(87,NULL,'Fecha publicación',1,0,NULL,NULL,NULL),(88,NULL,'Cubierta',1,0,NULL,NULL,NULL),(89,NULL,'Encuadernación',1,0,NULL,NULL,NULL),(90,NULL,'Autor',1,0,NULL,NULL,NULL),(91,NULL,'Envoltorio',1,0,NULL,NULL,NULL),(92,NULL,'Nombre temporal',1,0,NULL,NULL,NULL),(93,NULL,'Modelo',1,0,NULL,NULL,NULL),(94,NULL,'Producto',1,0,NULL,NULL,NULL),(95,NULL,'Título',1,0,NULL,NULL,NULL),(96,NULL,'Tomo',1,0,NULL,NULL,NULL),(97,NULL,'Articulo',1,0,NULL,NULL,NULL),(98,NULL,'Metodo de cultivo',1,0,NULL,NULL,NULL),(99,NULL,'Edad',1,0,NULL,NULL,NULL),(100,NULL,'Agotado',1,0,NULL,NULL,NULL),(101,NULL,'Altura con asa',1,1,NULL,'cm',NULL),(102,NULL,'Nº tallos',1,1,NULL,NULL,NULL),(103,NULL,'Cultivo',1,0,NULL,NULL,NULL),(104,NULL,'Sabor',1,0,NULL,NULL,NULL),(105,NULL,'Talla',1,0,NULL,NULL,NULL),(106,NULL,'Calibre',1,1,NULL,NULL,NULL),(107,NULL,'Dulzura',1,1,NULL,'bx',NULL),(108,NULL,'Piezas',1,0,NULL,NULL,NULL),(109,NULL,'Altura con patas',1,0,NULL,NULL,NULL),(110,NULL,'Envase',1,0,NULL,NULL,NULL),(111,NULL,'Nº piezas',1,0,NULL,NULL,NULL),(112,NULL,'Uso',1,0,NULL,'cm',NULL),(113,NULL,'Color luz',1,0,NULL,NULL,NULL),(114,NULL,'Capacidad',1,0,NULL,NULL,NULL),(115,NULL,'fout kenmerk',1,0,NULL,NULL,NULL),(116,NULL,'Potinhoud',1,0,NULL,NULL,NULL),(117,NULL,'Marketingconcept',1,0,NULL,NULL,NULL),(118,NULL,'Leeftijd',1,0,NULL,NULL,NULL),(119,NULL,'Uitgangsmateriaal',1,0,NULL,NULL,NULL),(120,NULL,'Kleurbehandeld',1,0,NULL,NULL,NULL),(121,NULL,'Verzorging: Standplaats',1,0,NULL,NULL,NULL),(122,NULL,'Verzorging: Water',1,0,NULL,NULL,NULL),(123,NULL,'Verzorging: Voeding',1,0,NULL,NULL,NULL),(124,NULL,'Verzorging: Temperatuur',1,0,NULL,NULL,NULL),(125,NULL,'Verzorging: Specifieke in',1,0,NULL,NULL,NULL),(126,NULL,'Verzorging: Consumptie',1,0,NULL,NULL,NULL),(127,NULL,'Nabehandeling',1,0,NULL,NULL,NULL),(128,NULL,'Artikel beeld',1,0,NULL,NULL,NULL),(129,NULL,'Hoofdkleur 1',1,0,NULL,NULL,NULL),(130,NULL,'Hoofdkleur 2',1,0,NULL,NULL,NULL),(131,NULL,'RHS hoofdkleur 1',1,0,NULL,NULL,NULL),(132,NULL,'RHS hoofdkleur 2',1,0,NULL,NULL,NULL),(133,NULL,'Hoofdkleur 1 blad',1,0,NULL,NULL,NULL),(134,NULL,'Hoofdkleur 2 blad',1,0,NULL,NULL,NULL),(135,NULL,'RHS hoofdkleur 1 blad',1,0,NULL,NULL,NULL),(136,NULL,'RHS hoofdkleur 2 blad',1,0,NULL,NULL,NULL),(137,NULL,'Botanisch beeld',1,0,NULL,NULL,NULL),(138,NULL,'Hoofdkleur bes/vrucht',1,0,NULL,NULL,NULL),(139,NULL,'RHS hoofdkleur bes/vrucht',1,0,NULL,NULL,NULL),(140,NULL,'UPOV hoofdkleur 1 bloem',1,0,NULL,NULL,NULL),(141,NULL,'UPOV hoofdkleur 2 bloem',1,0,NULL,NULL,NULL),(142,NULL,'UPOV hoofdkleur 1 blad',1,0,NULL,NULL,NULL),(143,NULL,'UPOV hoofdkleur 2 blad',1,0,NULL,NULL,NULL),(144,NULL,'UPOV hoofdkleur bes/vruch',1,0,NULL,NULL,NULL),(145,NULL,'Negatieve keurcode 1',1,0,NULL,NULL,NULL),(146,NULL,'Negatieve keurcode 2',1,0,NULL,NULL,NULL),(147,NULL,'Bedrijfskenmerk fytosanit',1,0,NULL,NULL,NULL),(148,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,NULL),(149,NULL,'Certificaten MPS-TraceCer',1,0,NULL,NULL,NULL),(150,NULL,'Overige leveranciersinfor',1,0,NULL,NULL,NULL),(151,NULL,'Certificaten MPS-GAP',1,0,NULL,NULL,NULL),(152,NULL,'Betrouwbaarheidsindex kla',1,0,NULL,NULL,NULL),(153,NULL,'Betrouwbaarheidsindex waa',1,0,NULL,NULL,NULL),(154,NULL,'Productkwaliteitslabel',1,0,NULL,NULL,NULL),(155,NULL,'Label Fair Flowers Fair P',1,0,NULL,NULL,NULL),(156,NULL,'Certificaten Socialy Qual',1,0,NULL,NULL,NULL),(157,NULL,'Certificaten GlobalGAP',1,0,NULL,NULL,NULL),(158,NULL,'Certificaten MPS Quality',1,0,NULL,NULL,NULL),(159,NULL,'Certificaten biologisch',1,0,NULL,NULL,NULL),(160,NULL,'Certificaten eetbare prod',1,0,NULL,NULL,NULL),(161,NULL,'Certificaten Florimark',1,0,NULL,NULL,NULL),(162,NULL,'Certificaten Milieukeur',1,0,NULL,NULL,NULL),(163,NULL,'Certificaten Kenya Flower',1,0,NULL,NULL,NULL),(164,NULL,'Certificaten Fairtrade',1,0,NULL,NULL,NULL),(165,NULL,'Keurmerk MPS-ProductProof',1,0,NULL,NULL,NULL),(166,NULL,'Certificaten ISO',1,0,NULL,NULL,NULL),(167,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,NULL),(168,NULL,'Certificaten Florverde',1,0,NULL,NULL,NULL),(169,NULL,'Certificaten Ethical Trad',1,0,NULL,NULL,NULL),(170,NULL,'Certificaten Ethiopian EH',1,0,NULL,NULL,NULL),(171,NULL,'Certificaten gewasbescher',1,0,NULL,NULL,NULL),(172,NULL,'Certificaten SAN',1,0,NULL,NULL,NULL),(173,NULL,'Certificaten GRASP',1,0,NULL,NULL,NULL),(174,NULL,'Label Fair Flora',1,0,NULL,NULL,NULL),(175,NULL,'Fust',1,0,NULL,NULL,NULL),(176,NULL,'Stapelwagen',1,0,NULL,NULL,NULL),(177,NULL,'Aantal legborden veilings',1,0,NULL,NULL,NULL),(178,NULL,'Aantal legborden Deense s',1,0,NULL,NULL,NULL),(179,NULL,'Aantal onderstellen Deens',1,0,NULL,NULL,NULL),(180,NULL,'Fustsoort',1,0,NULL,NULL,NULL),(181,NULL,'Fustmateriaal',1,0,NULL,NULL,NULL),(182,NULL,'Aantal legborden Eurostap',1,0,NULL,NULL,NULL),(183,NULL,'Aantal onderstellen Euros',1,0,NULL,NULL,NULL),(184,NULL,'Tallos por paquete',1,0,NULL,NULL,NULL),(185,NULL,'Aantal bossen per bundel',1,0,NULL,NULL,NULL),(186,NULL,'Aantal stuks per fust',1,0,NULL,NULL,NULL),(187,NULL,'Aantal bossen per fust',1,0,NULL,NULL,NULL),(188,NULL,'Aantal bundels per fust',1,0,NULL,NULL,NULL),(189,NULL,'Aantal bossen per hoes',1,0,NULL,NULL,NULL),(190,NULL,'Aantal bundels per hoes',1,0,NULL,NULL,NULL),(191,NULL,'Fustlabel',1,0,NULL,NULL,NULL),(192,NULL,'Karlabel',1,0,NULL,NULL,NULL),(193,NULL,'Service productlabel',1,0,NULL,NULL,NULL),(194,NULL,'Service fustlabel',1,0,NULL,NULL,NULL),(195,NULL,'Service karlabel',1,0,NULL,NULL,NULL),(196,NULL,'Aantal fusten per laag',1,0,NULL,NULL,NULL),(197,NULL,'Presentatie per schapm2',1,0,NULL,NULL,NULL),(198,NULL,'Positieve keurcode fytosa',1,0,NULL,NULL,NULL),(199,NULL,'Positieve keurcode kwalit',1,0,NULL,NULL,NULL),(200,NULL,'Positieve keurcode veilin',1,0,NULL,NULL,NULL),(201,NULL,'Potmaat',1,0,NULL,NULL,NULL),(202,NULL,'Minimum planthoogte',1,0,NULL,NULL,NULL),(203,NULL,'Min aantal stekken/plante',1,0,NULL,NULL,NULL),(204,NULL,'Minimum plantdiameter',1,0,NULL,NULL,NULL),(205,NULL,'Apertura',1,0,NULL,NULL,NULL),(206,NULL,'Combinatiehoogte',1,0,NULL,NULL,NULL),(207,NULL,'Min aantal koppen hoogste',1,0,NULL,NULL,NULL),(208,NULL,'Dikte',1,0,NULL,NULL,NULL),(209,NULL,'Min aantal bloemen/bloeiw',1,0,NULL,NULL,NULL),(210,NULL,'Min aantal bloemtrossen p',1,0,NULL,NULL,NULL),(211,NULL,'Minimum aantal takken per',1,0,NULL,NULL,NULL),(212,NULL,'Minimum aantal bollen per',1,0,NULL,NULL,NULL),(213,NULL,'Minimum aantal bladeren p',1,0,NULL,NULL,NULL),(214,NULL,'Minimum stamhoogte',1,0,NULL,NULL,NULL),(215,NULL,'Transporthoogte',1,0,NULL,NULL,NULL),(216,NULL,'Lengte scheuten',1,0,NULL,NULL,NULL),(217,NULL,'Min aant vertakkingen pr ',1,0,NULL,NULL,NULL),(218,NULL,'Minimum bloemknophoogte',1,0,NULL,NULL,NULL),(219,NULL,'Altura min.',1,0,NULL,NULL,NULL),(220,NULL,'Gewicht (gemiddeld)',1,0,NULL,NULL,NULL),(221,NULL,'Aantal bloemknoppen snijb',1,0,NULL,NULL,NULL),(222,NULL,'Minimum bloemdiameter',1,0,NULL,NULL,NULL),(223,NULL,'Minimum bloemschedelengte',1,0,NULL,NULL,NULL),(224,NULL,'Aantal bloemkoppen per tr',1,0,NULL,NULL,NULL),(225,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,NULL),(226,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,NULL),(227,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,NULL),(228,NULL,'Minimum bloeiwijzelengte',1,0,NULL,NULL,NULL),(229,NULL,'Verpakkingswijze snijbloe',1,0,NULL,NULL,NULL),(230,NULL,'Minimum aant bloemen per ',1,0,NULL,NULL,NULL),(231,NULL,'Minimum ranklengte',1,0,NULL,NULL,NULL),(232,NULL,'Jaartal sortering hout',1,0,NULL,NULL,NULL),(233,NULL,'Minimum bladdiameter',1,0,NULL,NULL,NULL),(234,NULL,'Minimum bundelgewicht',1,0,NULL,NULL,NULL),(235,NULL,'Maximum planthoogte',1,0,NULL,NULL,NULL),(236,NULL,'Maximum plantdiameter',1,0,NULL,NULL,NULL),(237,NULL,'Max aantal bloemen/bloeiw',1,0,NULL,NULL,NULL),(238,NULL,'Maximum aantal takken per',1,0,NULL,NULL,NULL),(239,NULL,'Maximum aantal bollen per',1,0,NULL,NULL,NULL),(240,NULL,'Maximum stamhoogte',1,0,NULL,NULL,NULL),(241,NULL,'Altura max.',1,0,NULL,NULL,NULL),(242,NULL,'Maximum aantal knoppen sn',1,0,NULL,NULL,NULL),(243,NULL,'Maximum bloemdiameter',1,0,NULL,NULL,NULL),(244,NULL,'Maximum bloeiwijzelengte',1,0,NULL,NULL,NULL),(245,NULL,'Aantal vruchten / trossen',1,0,NULL,NULL,NULL),(246,NULL,'Verpakkingswijze',1,0,NULL,NULL,NULL),(247,NULL,'Minimum vruchtdiameter',1,0,NULL,NULL,NULL),(248,NULL,'Bolomvang',1,0,NULL,NULL,NULL),(249,NULL,'Bloem/bes/vruchtkleur 1',1,0,NULL,NULL,NULL),(250,NULL,'Potvorm',1,0,NULL,NULL,NULL),(251,NULL,'Potkleur',1,0,NULL,NULL,NULL),(252,NULL,'Potmateriaal',1,0,NULL,NULL,NULL),(253,NULL,'Plantvorm',1,0,NULL,NULL,NULL),(254,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,NULL),(255,NULL,'Teeltwijze',1,0,NULL,NULL,NULL),(256,NULL,'Teeltmedium',1,0,NULL,NULL,NULL),(257,NULL,'Hoesmateriaal',1,0,NULL,NULL,NULL),(258,NULL,'Hoesvorm',1,0,NULL,NULL,NULL),(259,NULL,'Hoesbedrukking algemeen',1,0,NULL,NULL,NULL),(260,NULL,'Extra toevoegingen',1,0,NULL,NULL,NULL),(261,NULL,'Land van herkomst (bedrij',1,0,NULL,NULL,NULL),(262,NULL,'Verpakte orchidee',1,0,NULL,NULL,NULL),(263,NULL,'Hoesbedrukking extra',1,0,NULL,NULL,NULL),(264,NULL,'Voorbehandeling',1,0,NULL,NULL,NULL),(265,NULL,'Overige niet in pot',1,0,NULL,NULL,NULL),(266,NULL,'Vorm snijbloemen',1,0,NULL,NULL,NULL),(267,NULL,'Buigzaamheid bloemsteel',1,0,NULL,NULL,NULL),(268,NULL,'Hoeskleur',1,0,NULL,NULL,NULL),(269,NULL,'Extra deco materiaal',1,0,NULL,NULL,NULL),(270,NULL,'Productkleur',1,0,NULL,NULL,NULL),(271,NULL,'Productmateriaal',1,0,NULL,NULL,NULL),(272,NULL,'Materiaalhoogte',1,0,NULL,NULL,NULL),(273,NULL,'Materiaaldiameter',1,0,NULL,NULL,NULL),(274,NULL,'Barcode',1,0,NULL,NULL,NULL),(275,NULL,'Productlabel',1,0,NULL,NULL,NULL),(276,NULL,'Eetbaar/ niet eetbaar',1,0,NULL,NULL,NULL),(277,NULL,'Plantmaat zonder pot',1,0,NULL,NULL,NULL),(278,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,NULL),(279,NULL,'Maximum percentage oud ho',1,0,NULL,NULL,NULL),(280,NULL,'Maximum lengte verschil',1,0,NULL,NULL,NULL),(281,NULL,'Bladkleur',1,0,NULL,NULL,NULL),(282,NULL,'Plantgewicht',1,0,NULL,NULL,NULL),(283,NULL,'Gemiddelde bloemdiameter',1,0,NULL,NULL,NULL),(284,NULL,'Bloem/bes/vruchtkleur 2',1,0,NULL,NULL,NULL),(285,NULL,'Winterhardheid (USDA zone',1,0,NULL,NULL,NULL),(286,NULL,'Kleurbehandeld',1,0,NULL,NULL,NULL),(287,NULL,'Bloem-/bladkleurverdeling',1,0,NULL,NULL,NULL),(288,NULL,'Minimum bloemknopdiameter',1,0,NULL,NULL,NULL),(289,NULL,'Volume inhoud',1,0,NULL,NULL,NULL),(290,NULL,'Vruchtbenaming',1,0,NULL,NULL,NULL),(291,NULL,'Vaaslevenindex',1,0,NULL,NULL,NULL),(292,NULL,'Overige informatie plante',1,0,NULL,NULL,NULL),(293,NULL,'Overige informatie snijbl',1,0,NULL,NULL,NULL),(294,NULL,'Toepassingsmogelijkheid',1,0,NULL,NULL,NULL),(295,NULL,'Productbeeld aanvoerder',1,0,NULL,NULL,NULL),(296,NULL,'MPS certificering',1,0,NULL,NULL,NULL),(297,NULL,'Kwaliteitsgroep',1,0,NULL,NULL,NULL),(298,NULL,'Artikelomschrijving',1,0,NULL,NULL,NULL),(299,NULL,'BTW-tarief',1,0,NULL,NULL,NULL),(300,NULL,'Prijseenheid',1,0,NULL,NULL,NULL),(301,NULL,'Transactievorm',1,0,NULL,NULL,NULL),(302,NULL,'Handelsverpakking voorwaa',1,0,NULL,NULL,NULL),(303,NULL,'Consumentenverpakking voo',1,0,NULL,NULL,NULL),(304,NULL,'Leveringsvoorwaarden',1,0,NULL,NULL,NULL),(305,NULL,'PT heffing voorwaarden',1,0,NULL,NULL,NULL),(306,NULL,'Serviceheffing voorwaarde',1,0,NULL,NULL,NULL),(307,NULL,'Algemene voorwaarden',1,0,NULL,NULL,NULL),(308,NULL,'Marktvorm',1,0,NULL,NULL,NULL),(309,NULL,'Themadagen',1,0,NULL,NULL,NULL),(310,NULL,'Handelscategorie',1,0,NULL,NULL,NULL),(311,NULL,'Producentengroepen',1,0,NULL,NULL,NULL),(312,NULL,'Favorieten Id',1,0,NULL,NULL,NULL),(313,NULL,'Verkoopeenheid',1,0,NULL,NULL,NULL),(314,NULL,'Veilgroep voorkeur',1,0,NULL,NULL,NULL),(315,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(316,NULL,'Keurmeesternummer FloraHo',1,0,NULL,NULL,NULL),(317,NULL,'Rijnummer Rijnsburg',1,0,NULL,NULL,NULL),(318,NULL,'Verwerkingslocatie FloraH',1,0,NULL,NULL,NULL),(319,NULL,'FloraHolland Financial',1,0,NULL,NULL,NULL),(320,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(321,NULL,'Benefiet veiling',1,0,NULL,NULL,NULL),(322,NULL,'Kloksoort',1,0,NULL,NULL,NULL),(323,NULL,'Minimumprijs aanvoerder',1,0,NULL,NULL,NULL),(324,NULL,'Rest aantallen',1,0,NULL,NULL,NULL),(325,NULL,'Veilsoort',1,0,NULL,NULL,NULL),(326,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(327,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(328,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(329,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(330,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(331,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(332,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,NULL),(333,NULL,'Gereserveerd',1,0,NULL,NULL,NULL),(334,NULL,'Veilgroep Aalsmeer',1,0,NULL,NULL,NULL),(335,NULL,'Promotie kenmerk FloraHol',1,0,NULL,NULL,NULL),(336,NULL,'Verrekening snijbloemenvo',1,0,NULL,NULL,NULL),(337,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(338,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(339,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(340,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(341,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(342,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(343,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(344,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(345,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(346,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(347,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(348,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(349,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(350,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(351,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(352,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,NULL),(353,NULL,'Gereserveerd',1,0,NULL,NULL,NULL),(354,NULL,'Tussenopslag klok Plantio',1,0,NULL,NULL,NULL),(355,NULL,'Soort ladingsdrager Plant',1,0,NULL,NULL,NULL),(356,NULL,'Logistiek middel Plantion',1,0,NULL,NULL,NULL),(357,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(358,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(359,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(360,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(361,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(362,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(363,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(364,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(365,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(366,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(367,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(368,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(369,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(370,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(371,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(372,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(373,NULL,'Gereserveerd',1,0,NULL,NULL,NULL),(374,NULL,'Veilgroep Plantion Ede',1,0,NULL,NULL,NULL),(375,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(376,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(377,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(378,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(379,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(380,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(381,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(382,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(383,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(384,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(385,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(386,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(387,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(388,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,NULL),(389,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,NULL),(390,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,NULL),(391,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,NULL),(392,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,NULL),(393,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(394,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(395,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(396,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(397,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(398,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(399,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(400,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(401,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(402,NULL,'Gereserveerd VRM',1,0,NULL,NULL,NULL),(403,NULL,'Veiling',1,0,NULL,NULL,NULL),(404,NULL,'kopersaantallen',1,0,NULL,NULL,NULL),(552,NULL,'fout kenmerk',1,0,NULL,NULL,'081'),(553,NULL,'Potinhoud',1,0,NULL,NULL,'A01'),(554,NULL,'Marketingconcept',1,0,NULL,NULL,'A02'),(555,NULL,'Leeftijd',1,0,NULL,NULL,'A03'),(556,NULL,'Uitgangsmateriaal',1,0,NULL,NULL,'A04'),(557,NULL,'Kleurbehandeld',1,0,NULL,NULL,'A05'),(558,NULL,'Verzorging: Standplaats',1,0,NULL,NULL,'A06'),(559,NULL,'Verzorging: Water',1,0,NULL,NULL,'A07'),(560,NULL,'Verzorging: Voeding',1,0,NULL,NULL,'A08'),(561,NULL,'Verzorging: Temperatuur',1,0,NULL,NULL,'A09'),(562,NULL,'Verzorging: Specifieke in',1,0,NULL,NULL,'A10'),(563,NULL,'Verzorging: Consumptie',1,0,NULL,NULL,'A11'),(564,NULL,'Nabehandeling',1,0,NULL,NULL,'A13'),(565,NULL,'Artikel beeld',1,0,NULL,NULL,'A23'),(566,NULL,'Hoofdkleur 1',1,0,NULL,NULL,'B01'),(567,NULL,'Hoofdkleur 2',1,0,NULL,NULL,'B02'),(568,NULL,'RHS hoofdkleur 1',1,0,NULL,NULL,'B03'),(569,NULL,'RHS hoofdkleur 2',1,0,NULL,NULL,'B04'),(570,NULL,'Hoofdkleur 1 blad',1,0,NULL,NULL,'B05'),(571,NULL,'Hoofdkleur 2 blad',1,0,NULL,NULL,'B06'),(572,NULL,'RHS hoofdkleur 1 blad',1,0,NULL,NULL,'B07'),(573,NULL,'RHS hoofdkleur 2 blad',1,0,NULL,NULL,'B08'),(574,NULL,'Botanisch beeld',1,0,NULL,NULL,'B09'),(575,NULL,'Hoofdkleur bes/vrucht',1,0,NULL,NULL,'B10'),(576,NULL,'RHS hoofdkleur bes/vrucht',1,0,NULL,NULL,'B11'),(577,NULL,'UPOV hoofdkleur 1 bloem',1,0,NULL,NULL,'B12'),(578,NULL,'UPOV hoofdkleur 2 bloem',1,0,NULL,NULL,'B13'),(579,NULL,'UPOV hoofdkleur 1 blad',1,0,NULL,NULL,'B14'),(580,NULL,'UPOV hoofdkleur 2 blad',1,0,NULL,NULL,'B15'),(581,NULL,'UPOV hoofdkleur bes/vruch',1,0,NULL,NULL,'B16'),(582,NULL,'Negatieve keurcode 1',1,0,NULL,NULL,'K01'),(583,NULL,'Negatieve keurcode 2',1,0,NULL,NULL,'K02'),(584,NULL,'Bedrijfskenmerk fytosanit',1,0,NULL,NULL,'K03'),(585,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K04'),(586,NULL,'Certificaten MPS-TraceCer',1,0,NULL,NULL,'K05'),(587,NULL,'Overige leveranciersinfor',1,0,NULL,NULL,'K07'),(588,NULL,'Certificaten MPS-GAP',1,0,NULL,NULL,'K08'),(589,NULL,'Betrouwbaarheidsindex kla',1,0,NULL,NULL,'K11'),(590,NULL,'Betrouwbaarheidsindex waa',1,0,NULL,NULL,'K12'),(591,NULL,'Productkwaliteitslabel',1,0,NULL,NULL,'K13'),(592,NULL,'Label Fair Flowers Fair P',1,0,NULL,NULL,'K14'),(593,NULL,'Certificaten Socialy Qual',1,0,NULL,NULL,'K15'),(594,NULL,'Certificaten GlobalGAP',1,0,NULL,NULL,'K16'),(595,NULL,'Certificaten MPS Quality',1,0,NULL,NULL,'K17'),(596,NULL,'Certificaten biologisch',1,0,NULL,NULL,'K18'),(597,NULL,'Certificaten eetbare prod',1,0,NULL,NULL,'K19'),(598,NULL,'Certificaten Florimark',1,0,NULL,NULL,'K20'),(599,NULL,'Certificaten Milieukeur',1,0,NULL,NULL,'K21'),(600,NULL,'Certificaten Kenya Flower',1,0,NULL,NULL,'K22'),(601,NULL,'Certificaten Fairtrade',1,0,NULL,NULL,'K23'),(602,NULL,'Keurmerk MPS-ProductProof',1,0,NULL,NULL,'K24'),(603,NULL,'Certificaten ISO',1,0,NULL,NULL,'K25'),(604,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K26'),(605,NULL,'Certificaten Florverde',1,0,NULL,NULL,'K27'),(606,NULL,'Certificaten Ethical Trad',1,0,NULL,NULL,'K28'),(607,NULL,'Certificaten Ethiopian EH',1,0,NULL,NULL,'K29'),(608,NULL,'Certificaten gewasbescher',1,0,NULL,NULL,'K30'),(609,NULL,'Certificaten SAN',1,0,NULL,NULL,'K31'),(610,NULL,'Certificaten GRASP',1,0,NULL,NULL,'K32'),(611,NULL,'Label Fair Flora',1,0,NULL,NULL,'K33'),(612,NULL,'GLobalG.A.P. Chain of Cus',1,0,NULL,NULL,'K34'),(613,NULL,'Fust',1,0,NULL,NULL,'L01'),(614,NULL,'Stapelwagen',1,0,NULL,NULL,'L02'),(615,NULL,'Aantal legborden veilings',1,0,NULL,NULL,'L03'),(616,NULL,'Aantal legborden Deense s',1,0,NULL,NULL,'L04'),(617,NULL,'Aantal onderstellen Deens',1,0,NULL,NULL,'L05'),(618,NULL,'Fustsoort',1,0,NULL,NULL,'L06'),(619,NULL,'Fustmateriaal',1,0,NULL,NULL,'L07'),(620,NULL,'Aantal legborden Eurostap',1,0,NULL,NULL,'L08'),(621,NULL,'Aantal onderstellen Euros',1,0,NULL,NULL,'L09'),(622,NULL,'Aantal stelen per bos',1,0,NULL,NULL,'L11'),(623,NULL,'Aantal bossen per bundel',1,0,NULL,NULL,'L12'),(624,NULL,'Aantal stuks per fust',1,0,NULL,NULL,'L13'),(625,NULL,'Aantal bossen per fust',1,0,NULL,NULL,'L14'),(626,NULL,'Aantal bundels per fust',1,0,NULL,NULL,'L15'),(627,NULL,'Aantal bossen per hoes',1,0,NULL,NULL,'L16'),(628,NULL,'Aantal bundels per hoes',1,0,NULL,NULL,'L17'),(629,NULL,'Fustlabel',1,0,NULL,NULL,'L18'),(630,NULL,'Karlabel',1,0,NULL,NULL,'L19'),(631,NULL,'Service productlabel',1,0,NULL,NULL,'L20'),(632,NULL,'Service fustlabel',1,0,NULL,NULL,'L21'),(633,NULL,'Service karlabel',1,0,NULL,NULL,'L22'),(634,NULL,'Aantal fusten per laag',1,0,NULL,NULL,'L23'),(635,NULL,'Presentatie per schapm2',1,0,NULL,NULL,'L24'),(636,NULL,'Positieve keurcode fytosa',1,0,NULL,NULL,'P01'),(637,NULL,'Positieve keurcode kwalit',1,0,NULL,NULL,'P02'),(638,NULL,'Positieve keurcode veilin',1,0,NULL,NULL,'P03'),(639,NULL,'Potmaat',1,0,NULL,NULL,'S01'),(640,NULL,'Minimum planthoogte',1,0,NULL,NULL,'S02'),(641,NULL,'Min aantal stekken/plante',1,0,NULL,NULL,'S03'),(642,NULL,'Minimum plantdiameter',1,0,NULL,NULL,'S04'),(643,NULL,'Rijpheidsstadium',1,0,NULL,NULL,'S05'),(644,NULL,'Combinatiehoogte',1,0,NULL,NULL,'S06'),(645,NULL,'Min aantal koppen hoogste',1,0,NULL,NULL,'S07'),(646,NULL,'Dikte',1,0,NULL,NULL,'S08'),(647,NULL,'Min aantal bloemen/bloeiw',1,0,NULL,NULL,'S09'),(648,NULL,'Min aantal bloemtrossen p',1,0,NULL,NULL,'S10'),(649,NULL,'Minimum aantal takken per',1,0,NULL,NULL,'S11'),(650,NULL,'Minimum aantal bollen per',1,0,NULL,NULL,'S12'),(651,NULL,'Minimum aantal bladeren p',1,0,NULL,NULL,'S13'),(652,NULL,'Minimum stamhoogte',1,0,NULL,NULL,'S14'),(653,NULL,'Transporthoogte',1,0,NULL,NULL,'S15'),(654,NULL,'Lengte scheuten',1,0,NULL,NULL,'S16'),(655,NULL,'Min aant vertakkingen pr ',1,0,NULL,NULL,'S17'),(656,NULL,'Minimum bloemknophoogte',1,0,NULL,NULL,'S19'),(657,NULL,'Minimum steellengte',1,0,NULL,NULL,'S20'),(658,NULL,'Gewicht (gemiddeld)',1,0,NULL,NULL,'S21'),(659,NULL,'Aantal bloemknoppen snijb',1,0,NULL,NULL,'S22'),(660,NULL,'Minimum bloemdiameter',1,0,NULL,NULL,'S23'),(661,NULL,'Minimum bloemschedelengte',1,0,NULL,NULL,'S24'),(662,NULL,'Aantal bloemkoppen per tr',1,0,NULL,NULL,'S25'),(663,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S26'),(664,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S27'),(665,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S28'),(666,NULL,'Minimum bloeiwijzelengte',1,0,NULL,NULL,'S29'),(667,NULL,'Verpakkingswijze snijbloe',1,0,NULL,NULL,'S30'),(668,NULL,'Minimum aant bloemen per ',1,0,NULL,NULL,'S31'),(669,NULL,'Minimum ranklengte',1,0,NULL,NULL,'S32'),(670,NULL,'Jaartal sortering hout',1,0,NULL,NULL,'S33'),(671,NULL,'Minimum bladdiameter',1,0,NULL,NULL,'S34'),(672,NULL,'Minimum bundelgewicht',1,0,NULL,NULL,'S35'),(673,NULL,'Maximum planthoogte',1,0,NULL,NULL,'S36'),(674,NULL,'Maximum plantdiameter',1,0,NULL,NULL,'S37'),(675,NULL,'Max aantal bloemen/bloeiw',1,0,NULL,NULL,'S38'),(676,NULL,'Maximum aantal takken per',1,0,NULL,NULL,'S39'),(677,NULL,'Maximum aantal bollen per',1,0,NULL,NULL,'S40'),(678,NULL,'Maximum stamhoogte',1,0,NULL,NULL,'S41'),(679,NULL,'Maximum steellengte',1,0,NULL,NULL,'S42'),(680,NULL,'Maximum aantal knoppen sn',1,0,NULL,NULL,'S43'),(681,NULL,'Maximum bloemdiameter',1,0,NULL,NULL,'S44'),(682,NULL,'Maximum bloeiwijzelengte',1,0,NULL,NULL,'S45'),(683,NULL,'Aantal vruchten / trossen',1,0,NULL,NULL,'S46'),(684,NULL,'Verpakkingswijze',1,0,NULL,NULL,'S47'),(685,NULL,'Minimum vruchtdiameter',1,0,NULL,NULL,'S48'),(686,NULL,'Bolomvang',1,0,NULL,NULL,'S49'),(687,NULL,'Bloem/bes/vruchtkleur 1',1,0,NULL,NULL,'S50'),(688,NULL,'Potvorm',1,0,NULL,NULL,'S51'),(689,NULL,'Potkleur',1,0,NULL,NULL,'S52'),(690,NULL,'Potmateriaal',1,0,NULL,NULL,'S53'),(691,NULL,'Plantvorm',1,0,NULL,NULL,'S54'),(692,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S55'),(693,NULL,'Teeltwijze',1,0,NULL,NULL,'S56'),(694,NULL,'Teeltmedium',1,0,NULL,NULL,'S57'),(695,NULL,'Hoesmateriaal',1,0,NULL,NULL,'S58'),(696,NULL,'Hoesvorm',1,0,NULL,NULL,'S59'),(697,NULL,'Hoesbedrukking algemeen',1,0,NULL,NULL,'S60'),(698,NULL,'Extra toevoegingen',1,0,NULL,NULL,'S61'),(699,NULL,'Land van herkomst (bedrij',1,0,NULL,NULL,'S62'),(700,NULL,'Verpakte orchidee',1,0,NULL,NULL,'S63'),(701,NULL,'Hoesbedrukking extra',1,0,NULL,NULL,'S64'),(702,NULL,'Voorbehandeling',1,0,NULL,NULL,'S65'),(703,NULL,'Overige niet in pot',1,0,NULL,NULL,'S66'),(704,NULL,'Vorm snijbloemen',1,0,NULL,NULL,'S67'),(705,NULL,'Buigzaamheid bloemsteel',1,0,NULL,NULL,'S68'),(706,NULL,'Hoeskleur',1,0,NULL,NULL,'S69'),(707,NULL,'Extra deco materiaal',1,0,NULL,NULL,'S70'),(708,NULL,'Productkleur',1,0,NULL,NULL,'S71'),(709,NULL,'Productmateriaal',1,0,NULL,NULL,'S72'),(710,NULL,'Materiaalhoogte',1,0,NULL,NULL,'S73'),(711,NULL,'Materiaaldiameter',1,0,NULL,NULL,'S74'),(712,NULL,'Barcode',1,0,NULL,NULL,'S75'),(713,NULL,'Productlabel',1,0,NULL,NULL,'S76'),(714,NULL,'Eetbaar/ niet eetbaar',1,0,NULL,NULL,'S77'),(715,NULL,'Plantmaat zonder pot',1,0,NULL,NULL,'S78'),(716,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S79'),(717,NULL,'Maximum percentage oud ho',1,0,NULL,NULL,'S80'),(718,NULL,'Maximum lengte verschil',1,0,NULL,NULL,'S81'),(719,NULL,'Bladkleur',1,0,NULL,NULL,'S82'),(720,NULL,'Plantgewicht',1,0,NULL,NULL,'S83'),(721,NULL,'Gemiddelde bloemdiameter',1,0,NULL,NULL,'S84'),(722,NULL,'Bloem/bes/vruchtkleur 2',1,0,NULL,NULL,'S85'),(723,NULL,'Winterhardheid (USDA zone',1,0,NULL,NULL,'S86'),(724,NULL,'Kleurbehandeld',1,0,NULL,NULL,'S87'),(725,NULL,'Bloem-/bladkleurverdeling',1,0,NULL,NULL,'S88'),(726,NULL,'Minimum bloemknopdiameter',1,0,NULL,NULL,'S89'),(727,NULL,'Volume inhoud',1,0,NULL,NULL,'S90'),(728,NULL,'Vruchtbenaming',1,0,NULL,NULL,'S91'),(729,NULL,'Vaaslevenindex',1,0,NULL,NULL,'S92'),(730,NULL,'Overige informatie plante',1,0,NULL,NULL,'S93'),(731,NULL,'Overige informatie snijbl',1,0,NULL,NULL,'S94'),(732,NULL,'Toepassingsmogelijkheid',1,0,NULL,NULL,'S95'),(733,NULL,'Productbeeld aanvoerder',1,0,NULL,NULL,'S96'),(734,NULL,'MPS certificering',1,0,NULL,NULL,'S97'),(735,NULL,'Kwaliteitsgroep',1,0,NULL,NULL,'S98'),(736,NULL,'Artikelomschrijving',1,0,NULL,NULL,'S99'),(737,NULL,'BTW-tarief',1,0,NULL,NULL,'T01'),(738,NULL,'Prijseenheid',1,0,NULL,NULL,'T02'),(739,NULL,'Transactievorm',1,0,NULL,NULL,'T03'),(740,NULL,'Handelsverpakking voorwaa',1,0,NULL,NULL,'T10'),(741,NULL,'Consumentenverpakking voo',1,0,NULL,NULL,'T11'),(742,NULL,'Leveringsvoorwaarden',1,0,NULL,NULL,'T12'),(743,NULL,'PT heffing voorwaarden',1,0,NULL,NULL,'T13'),(744,NULL,'Serviceheffing voorwaarde',1,0,NULL,NULL,'T14'),(745,NULL,'Algemene voorwaarden',1,0,NULL,NULL,'T15'),(746,NULL,'Marktvorm',1,0,NULL,NULL,'T16'),(747,NULL,'Themadagen',1,0,NULL,NULL,'T17'),(748,NULL,'Handelscategorie',1,0,NULL,NULL,'T18'),(749,NULL,'Producentengroepen',1,0,NULL,NULL,'T19'),(750,NULL,'Favorieten Id',1,0,NULL,NULL,'T20'),(751,NULL,'Verkoopeenheid',1,0,NULL,NULL,'T21'),(752,NULL,'Veilgroep voorkeur',1,0,NULL,NULL,'V01'),(753,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V02'),(754,NULL,'Keurmeesternummer FloraHo',1,0,NULL,NULL,'V03'),(755,NULL,'Rijnummer Rijnsburg',1,0,NULL,NULL,'V04'),(756,NULL,'Verwerkingslocatie FloraH',1,0,NULL,NULL,'V05'),(757,NULL,'FloraHolland Financial',1,0,NULL,NULL,'V06'),(758,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V07'),(759,NULL,'Benefiet veiling',1,0,NULL,NULL,'V08'),(760,NULL,'Kloksoort',1,0,NULL,NULL,'V09'),(761,NULL,'Minimumprijs aanvoerder',1,0,NULL,NULL,'V10'),(762,NULL,'Rest aantallen',1,0,NULL,NULL,'V11'),(763,NULL,'Veilsoort',1,0,NULL,NULL,'V12'),(764,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V13'),(765,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V14'),(766,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V15'),(767,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V16'),(768,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V17'),(769,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V18'),(770,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V19'),(771,NULL,'Gereserveerd',1,0,NULL,NULL,'V20'),(772,NULL,'Veilgroep Aalsmeer',1,0,NULL,NULL,'V21'),(773,NULL,'Promotie kenmerk FloraHol',1,0,NULL,NULL,'V22'),(774,NULL,'Verrekening snijbloemenvo',1,0,NULL,NULL,'V23'),(775,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V24'),(776,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V25'),(777,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V26'),(778,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V27'),(779,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V28'),(780,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V29'),(781,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V30'),(782,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V31'),(783,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V32'),(784,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V33'),(785,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V34'),(786,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V35'),(787,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V36'),(788,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V37'),(789,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V38'),(790,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V39'),(791,NULL,'Gereserveerd',1,0,NULL,NULL,'V40'),(792,NULL,'Tussenopslag klok Plantio',1,0,NULL,NULL,'V41'),(793,NULL,'Soort ladingsdrager Plant',1,0,NULL,NULL,'V42'),(794,NULL,'Logistiek middel Plantion',1,0,NULL,NULL,'V43'),(795,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V44'),(796,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V45'),(797,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V46'),(798,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V47'),(799,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V48'),(800,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V49'),(801,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V50'),(802,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V51'),(803,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V52'),(804,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V53'),(805,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V54'),(806,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V55'),(807,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V56'),(808,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V57'),(809,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V58'),(810,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V59'),(811,NULL,'Gereserveerd',1,0,NULL,NULL,'V60'),(812,NULL,'Veilgroep Plantion Ede',1,0,NULL,NULL,'V61'),(813,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V62'),(814,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V63'),(815,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V64'),(816,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V65'),(817,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V66'),(818,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V67'),(819,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V68'),(820,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V69'),(821,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V70'),(822,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V71'),(823,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V72'),(824,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V73'),(825,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V74'),(826,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V75'),(827,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V76'),(828,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V77'),(829,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V78'),(830,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V79'),(831,NULL,'Toegevoegde waardes VRM',1,0,NULL,NULL,'V80'),(832,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V81'),(833,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V82'),(834,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V83'),(835,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V84'),(836,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V85'),(837,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V86'),(838,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V87'),(839,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V88'),(840,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V89'),(841,NULL,'Veiling',1,0,NULL,NULL,'V99'),(842,NULL,'kopersaantallen',1,0,NULL,NULL,'Z01');
+INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL,'inkFk'),(2,NULL,'Forma',1,0,NULL,NULL,NULL,NULL),(3,NULL,'Material',1,0,NULL,NULL,NULL,NULL),(4,NULL,'Longitud',1,1,NULL,'mm',NULL,'size'),(5,NULL,'Diámetro',1,1,NULL,'mm',NULL,NULL),(6,NULL,'Perímetro',1,1,NULL,'mm',NULL,NULL),(7,NULL,'Ancho de la base',1,1,NULL,'mm',NULL,NULL),(8,NULL,'Altura',1,1,NULL,'mm',NULL,'size'),(9,NULL,'Volumen',1,1,NULL,'ml',NULL,NULL),(10,NULL,'Densidad',1,1,NULL,NULL,NULL,NULL),(11,NULL,'Calidad',1,0,NULL,NULL,NULL,NULL),(12,NULL,'Textura',1,0,NULL,NULL,NULL,NULL),(13,NULL,'Material del mango',1,0,NULL,NULL,NULL,NULL),(14,NULL,'Compra mínima',1,0,NULL,NULL,NULL,NULL),(15,NULL,'Nº pétalos',1,1,NULL,NULL,NULL,NULL),(16,NULL,'Ancho',1,1,NULL,'mm',NULL,NULL),(18,NULL,'Profundidad',1,1,NULL,'mm',NULL,NULL),(19,NULL,'Largo',1,1,NULL,'mm',NULL,'size'),(20,NULL,'Ancho superior',1,1,NULL,'mm',NULL,NULL),(21,NULL,'Ancho inferior',1,1,NULL,'mm',NULL,NULL),(22,NULL,'Gramaje',1,1,NULL,'g',NULL,NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL,'stems'),(24,NULL,'Estado',1,0,NULL,NULL,NULL,NULL),(25,NULL,'Color principal',0,0,'ink',NULL,NULL,NULL),(26,NULL,'Color secundario',0,0,'ink',NULL,NULL,NULL),(27,NULL,'Longitud(cm)',1,1,NULL,'cm',NULL,NULL),(28,NULL,'Diámetro base',1,1,'','mm',NULL,NULL),(29,NULL,'Colección',1,0,NULL,NULL,NULL,NULL),(30,NULL,'Uds / caja',1,1,NULL,NULL,NULL,NULL),(31,NULL,'Contenido',1,0,NULL,NULL,NULL,NULL),(32,NULL,'Peso',1,1,NULL,'g',NULL,NULL),(33,NULL,'Grosor',1,1,NULL,'mm',NULL,NULL),(34,NULL,'Marca',1,0,NULL,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL,'originFk'),(36,NULL,'Proveedor',1,0,NULL,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL,'producerFk'),(38,NULL,'Duración',1,1,NULL,'s',NULL,NULL),(39,NULL,'Flor',1,0,NULL,NULL,NULL,NULL),(40,NULL,'Soporte',1,0,NULL,NULL,NULL,NULL),(41,NULL,'Tamaño flor',1,0,NULL,NULL,NULL,NULL),(42,NULL,'Apertura',1,0,NULL,NULL,NULL,NULL),(43,NULL,'Tallo',1,0,NULL,NULL,NULL,NULL),(44,NULL,'Nº hojas',1,1,NULL,NULL,NULL,NULL),(45,NULL,'Dimensiones',1,0,NULL,NULL,NULL,NULL),(46,NULL,'Diámetro boca',1,1,NULL,'mm',NULL,NULL),(47,NULL,'Nº flores',1,1,NULL,NULL,NULL,NULL),(48,NULL,'Uds / paquete',1,1,NULL,NULL,NULL,NULL),(49,NULL,'Maceta',1,1,NULL,'cm',NULL,NULL),(50,NULL,'Textura flor',1,0,NULL,NULL,NULL,NULL),(51,NULL,'Textura hoja',1,0,NULL,NULL,NULL,NULL),(52,NULL,'Tipo de IVA',1,0,NULL,NULL,NULL,NULL),(53,NULL,'Tronco',1,0,NULL,NULL,NULL,NULL),(54,NULL,'Hoja',1,0,NULL,NULL,NULL,NULL),(55,NULL,'Formato',1,0,NULL,NULL,NULL,NULL),(56,NULL,'Genero',1,0,NULL,NULL,NULL,NULL),(57,NULL,'Especie',1,0,NULL,NULL,NULL,NULL),(58,NULL,'Variedad',1,0,NULL,NULL,NULL,NULL),(59,NULL,'Medida grande',1,0,NULL,NULL,NULL,NULL),(60,NULL,'Medida mediano',1,0,NULL,NULL,NULL,NULL),(61,NULL,'Medida pequeño',1,0,NULL,NULL,NULL,NULL),(63,NULL,'Recipiente interior',1,0,NULL,NULL,NULL,NULL),(64,NULL,'Material secundario',1,0,NULL,NULL,NULL,NULL),(65,NULL,'Colores',1,0,NULL,NULL,NULL,NULL),(66,NULL,'Referencia',1,0,NULL,NULL,NULL,NULL),(67,'category','Categoria',1,0,NULL,NULL,NULL,NULL),(68,NULL,'Amb',1,0,NULL,NULL,NULL,NULL),(69,NULL,'Anchura',1,1,NULL,'cm',NULL,NULL),(70,NULL,'Hueco interior',1,0,NULL,NULL,NULL,NULL),(71,NULL,'Tamaño',1,0,NULL,NULL,NULL,NULL),(72,NULL,'Color botón',1,0,NULL,NULL,NULL,NULL),(73,NULL,'Tamaño minimo del botón',1,0,NULL,NULL,NULL,NULL),(74,NULL,'Obtentor',1,0,NULL,NULL,NULL,NULL),(75,NULL,'Longitud del brote',1,0,NULL,NULL,NULL,NULL),(76,NULL,'Tallos / u.v.',1,0,NULL,NULL,NULL,NULL),(77,NULL,'Madera de',1,0,NULL,NULL,NULL,NULL),(78,NULL,'Unidad de venta',1,0,NULL,NULL,NULL,NULL),(79,NULL,'Temporal',1,0,NULL,NULL,NULL,NULL),(80,NULL,'Gramaje/tallo',1,1,NULL,'g',NULL,NULL),(81,NULL,'Peso/paquete',1,1,NULL,'g',NULL,NULL),(82,NULL,'Flexibilidad del tallo',1,0,NULL,NULL,NULL,NULL),(83,NULL,'Nº planchas',1,1,NULL,NULL,NULL,NULL),(84,NULL,'Nº páginas',1,1,NULL,NULL,NULL,NULL),(85,NULL,'Editorial',1,0,NULL,NULL,NULL,NULL),(86,NULL,'Idioma',1,0,NULL,NULL,NULL,NULL),(87,NULL,'Fecha publicación',1,0,NULL,NULL,NULL,NULL),(88,NULL,'Cubierta',1,0,NULL,NULL,NULL,NULL),(89,NULL,'Encuadernación',1,0,NULL,NULL,NULL,NULL),(90,NULL,'Autor',1,0,NULL,NULL,NULL,NULL),(91,NULL,'Envoltorio',1,0,NULL,NULL,NULL,NULL),(92,NULL,'Nombre temporal',1,0,NULL,NULL,NULL,NULL),(93,NULL,'Modelo',1,0,NULL,NULL,NULL,NULL),(94,NULL,'Producto',1,0,NULL,NULL,NULL,NULL),(95,NULL,'Título',1,0,NULL,NULL,NULL,NULL),(96,NULL,'Tomo',1,0,NULL,NULL,NULL,NULL),(97,NULL,'Articulo',1,0,NULL,NULL,NULL,NULL),(98,NULL,'Metodo de cultivo',1,0,NULL,NULL,NULL,NULL),(99,NULL,'Edad',1,0,NULL,NULL,NULL,NULL),(100,NULL,'Agotado',1,0,NULL,NULL,NULL,NULL),(101,NULL,'Altura con asa',1,1,NULL,'cm',NULL,NULL),(102,NULL,'Nº tallos',1,1,NULL,NULL,NULL,NULL),(103,NULL,'Cultivo',1,0,NULL,NULL,NULL,NULL),(104,NULL,'Sabor',1,0,NULL,NULL,NULL,NULL),(105,NULL,'Talla',1,0,NULL,NULL,NULL,NULL),(106,NULL,'Calibre',1,1,NULL,NULL,NULL,NULL),(107,NULL,'Dulzura',1,1,NULL,'bx',NULL,NULL),(108,NULL,'Piezas',1,0,NULL,NULL,NULL,NULL),(109,NULL,'Altura con patas',1,0,NULL,NULL,NULL,NULL),(110,NULL,'Envase',1,0,NULL,NULL,NULL,NULL),(111,NULL,'Nº piezas',1,0,NULL,NULL,NULL,NULL),(112,NULL,'Uso',1,0,NULL,'cm',NULL,NULL),(113,NULL,'Color luz',1,0,NULL,NULL,NULL,NULL),(114,NULL,'Capacidad',1,0,NULL,NULL,NULL,NULL),(184,NULL,'Tallos por paquete',1,0,NULL,NULL,NULL,NULL),(205,NULL,'Apertura',1,0,NULL,NULL,'S05',NULL),(219,NULL,'Altura',1,0,NULL,NULL,'S20','size'),(552,NULL,'fout kenmerk',1,0,NULL,NULL,'081',NULL),(553,NULL,'Potinhoud',1,0,NULL,NULL,'A01',NULL),(554,NULL,'Marketingconcept',1,0,NULL,NULL,'A02',NULL),(555,NULL,'Leeftijd',1,0,NULL,NULL,'A03',NULL),(556,NULL,'Uitgangsmateriaal',1,0,NULL,NULL,'A04',NULL),(557,NULL,'Kleurbehandeld',1,0,NULL,NULL,'A05','inkFk'),(558,NULL,'Verzorging: Standplaats',1,0,NULL,NULL,'A06',NULL),(559,NULL,'Verzorging: Water',1,0,NULL,NULL,'A07',NULL),(560,NULL,'Verzorging: Voeding',1,0,NULL,NULL,'A08',NULL),(561,NULL,'Verzorging: Temperatuur',1,0,NULL,NULL,'A09',NULL),(562,NULL,'Verzorging: Specifieke in',1,0,NULL,NULL,'A10',NULL),(563,NULL,'Verzorging: Consumptie',1,0,NULL,NULL,'A11',NULL),(564,NULL,'Nabehandeling',1,0,NULL,NULL,'A13',NULL),(565,NULL,'Artikel beeld',1,0,NULL,NULL,'A23',NULL),(566,NULL,'Hoofdkleur 1',1,0,NULL,NULL,'B01',NULL),(567,NULL,'Hoofdkleur 2',1,0,NULL,NULL,'B02',NULL),(568,NULL,'RHS hoofdkleur 1',1,0,NULL,NULL,'B03',NULL),(569,NULL,'RHS hoofdkleur 2',1,0,NULL,NULL,'B04',NULL),(570,NULL,'Hoofdkleur 1 blad',1,0,NULL,NULL,'B05',NULL),(571,NULL,'Hoofdkleur 2 blad',1,0,NULL,NULL,'B06',NULL),(572,NULL,'RHS hoofdkleur 1 blad',1,0,NULL,NULL,'B07',NULL),(573,NULL,'RHS hoofdkleur 2 blad',1,0,NULL,NULL,'B08',NULL),(574,NULL,'Botanisch beeld',1,0,NULL,NULL,'B09',NULL),(575,NULL,'Hoofdkleur bes/vrucht',1,0,NULL,NULL,'B10',NULL),(576,NULL,'RHS hoofdkleur bes/vrucht',1,0,NULL,NULL,'B11',NULL),(577,NULL,'UPOV hoofdkleur 1 bloem',1,0,NULL,NULL,'B12',NULL),(578,NULL,'UPOV hoofdkleur 2 bloem',1,0,NULL,NULL,'B13',NULL),(579,NULL,'UPOV hoofdkleur 1 blad',1,0,NULL,NULL,'B14',NULL),(580,NULL,'UPOV hoofdkleur 2 blad',1,0,NULL,NULL,'B15',NULL),(581,NULL,'UPOV hoofdkleur bes/vruch',1,0,NULL,NULL,'B16',NULL),(582,NULL,'Negatieve keurcode 1',1,0,NULL,NULL,'K01',NULL),(583,NULL,'Negatieve keurcode 2',1,0,NULL,NULL,'K02',NULL),(584,NULL,'Bedrijfskenmerk fytosanit',1,0,NULL,NULL,'K03',NULL),(585,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K04',NULL),(586,NULL,'Certificaten MPS-TraceCer',1,0,NULL,NULL,'K05',NULL),(587,NULL,'Overige leveranciersinfor',1,0,NULL,NULL,'K07',NULL),(588,NULL,'Certificaten MPS-GAP',1,0,NULL,NULL,'K08',NULL),(589,NULL,'Betrouwbaarheidsindex kla',1,0,NULL,NULL,'K11',NULL),(590,NULL,'Betrouwbaarheidsindex waa',1,0,NULL,NULL,'K12',NULL),(591,NULL,'Productkwaliteitslabel',1,0,NULL,NULL,'K13',NULL),(592,NULL,'Label Fair Flowers Fair P',1,0,NULL,NULL,'K14',NULL),(593,NULL,'Certificaten Socialy Qual',1,0,NULL,NULL,'K15',NULL),(594,NULL,'Certificaten GlobalGAP',1,0,NULL,NULL,'K16',NULL),(595,NULL,'Certificaten MPS Quality',1,0,NULL,NULL,'K17',NULL),(596,NULL,'Certificaten biologisch',1,0,NULL,NULL,'K18',NULL),(597,NULL,'Certificaten eetbare prod',1,0,NULL,NULL,'K19',NULL),(598,NULL,'Certificaten Florimark',1,0,NULL,NULL,'K20',NULL),(599,NULL,'Certificaten Milieukeur',1,0,NULL,NULL,'K21',NULL),(600,NULL,'Certificaten Kenya Flower',1,0,NULL,NULL,'K22',NULL),(601,NULL,'Certificaten Fairtrade',1,0,NULL,NULL,'K23',NULL),(602,NULL,'Keurmerk MPS-ProductProof',1,0,NULL,NULL,'K24',NULL),(603,NULL,'Certificaten ISO',1,0,NULL,NULL,'K25',NULL),(604,NULL,'Certificaten aardwarmte',1,0,NULL,NULL,'K26',NULL),(605,NULL,'Certificaten Florverde',1,0,NULL,NULL,'K27',NULL),(606,NULL,'Certificaten Ethical Trad',1,0,NULL,NULL,'K28',NULL),(607,NULL,'Certificaten Ethiopian EH',1,0,NULL,NULL,'K29',NULL),(608,NULL,'Certificaten gewasbescher',1,0,NULL,NULL,'K30',NULL),(609,NULL,'Certificaten SAN',1,0,NULL,NULL,'K31',NULL),(610,NULL,'Certificaten GRASP',1,0,NULL,NULL,'K32',NULL),(611,NULL,'Label Fair Flora',1,0,NULL,NULL,'K33',NULL),(612,NULL,'GLobalG.A.P. Chain of Cus',1,0,NULL,NULL,'K34',NULL),(613,NULL,'Fust',1,0,NULL,NULL,'L01',NULL),(614,NULL,'Stapelwagen',1,0,NULL,NULL,'L02',NULL),(615,NULL,'Aantal legborden veilings',1,0,NULL,NULL,'L03',NULL),(616,NULL,'Aantal legborden Deense s',1,0,NULL,NULL,'L04',NULL),(617,NULL,'Aantal onderstellen Deens',1,0,NULL,NULL,'L05',NULL),(618,NULL,'Fustsoort',1,0,NULL,NULL,'L06',NULL),(619,NULL,'Fustmateriaal',1,0,NULL,NULL,'L07',NULL),(620,NULL,'Aantal legborden Eurostap',1,0,NULL,NULL,'L08',NULL),(621,NULL,'Aantal onderstellen Euros',1,0,NULL,NULL,'L09',NULL),(622,NULL,'Tallos/bolsa',1,0,NULL,NULL,'L11',''),(623,NULL,'Aantal bossen per bundel',1,0,NULL,NULL,'L12',NULL),(624,NULL,'Aantal stuks per fust',1,0,NULL,NULL,'L13',NULL),(625,NULL,'Aantal bossen per fust',1,0,NULL,NULL,'L14',NULL),(626,NULL,'Aantal bundels per fust',1,0,NULL,NULL,'L15',NULL),(627,NULL,'Aantal bossen per hoes',1,0,NULL,NULL,'L16',NULL),(628,NULL,'Aantal bundels per hoes',1,0,NULL,NULL,'L17',NULL),(629,NULL,'Fustlabel',1,0,NULL,NULL,'L18',NULL),(630,NULL,'Karlabel',1,0,NULL,NULL,'L19',NULL),(631,NULL,'Service productlabel',1,0,NULL,NULL,'L20',NULL),(632,NULL,'Service fustlabel',1,0,NULL,NULL,'L21',NULL),(633,NULL,'Service karlabel',1,0,NULL,NULL,'L22',NULL),(634,NULL,'Aantal fusten per laag',1,0,NULL,NULL,'L23',NULL),(635,NULL,'Presentatie per schapm2',1,0,NULL,NULL,'L24',NULL),(636,NULL,'Positieve keurcode fytosa',1,0,NULL,NULL,'P01',NULL),(637,NULL,'Positieve keurcode kwalit',1,0,NULL,NULL,'P02',NULL),(638,NULL,'Positieve keurcode veilin',1,0,NULL,NULL,'P03',NULL),(639,NULL,'Maceta',1,1,NULL,'cm','S01',NULL),(640,NULL,'Altura',1,0,NULL,NULL,'S02','size'),(641,NULL,'nº plantas',1,0,NULL,NULL,'S03',NULL),(642,NULL,'Diámetro',1,0,NULL,NULL,'S04',NULL),(644,NULL,'Combinatiehoogte',1,0,NULL,NULL,'S06',NULL),(645,NULL,'Plantas/Maceta',1,0,NULL,NULL,'S07',NULL),(646,NULL,'Dikte',1,0,NULL,NULL,'S08',NULL),(647,NULL,'nº flores',1,0,NULL,NULL,'S09',NULL),(648,NULL,'Min aantal bloemtrossen p',1,0,NULL,NULL,'S10',NULL),(649,NULL,'nº ramales',1,0,NULL,NULL,'S11',NULL),(650,NULL,'Minimum aantal bollen per',1,0,NULL,NULL,'S12',NULL),(651,NULL,'Minimum aantal bladeren p',1,0,NULL,NULL,'S13',NULL),(652,NULL,'Minimum stamhoogte',1,0,NULL,NULL,'S14',NULL),(653,NULL,'Altura caja',1,0,NULL,NULL,'S15',NULL),(654,NULL,'Lengte scheuten',1,0,NULL,NULL,'S16',NULL),(655,NULL,'Min aant vertakkingen pr ',1,0,NULL,NULL,'S17',NULL),(656,NULL,'Altura del capullo',1,0,NULL,NULL,'S19',NULL),(658,NULL,'Peso tallo',1,0,NULL,NULL,'S21',NULL),(659,NULL,'nº flores',1,0,NULL,NULL,'S22',NULL),(660,NULL,'Diámetro de la flor',1,0,NULL,NULL,'S23',NULL),(661,NULL,'Minimum bloemschedelengte',1,0,NULL,NULL,'S24',NULL),(662,NULL,'Aantal bloemkoppen per tr',1,0,NULL,NULL,'S25',NULL),(663,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S26',NULL),(664,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S27',NULL),(665,NULL,'Aant.kleuren/cultiv/vorme',1,0,NULL,NULL,'S28',NULL),(666,NULL,'Longitud inflorescencia',1,0,NULL,NULL,'S29',NULL),(667,NULL,'Verpakkingswijze snijbloe',1,0,NULL,NULL,'S30',NULL),(668,NULL,'Minimum aant bloemen per ',1,0,NULL,NULL,'S31',NULL),(669,NULL,'Longitud',1,0,NULL,NULL,'S32',NULL),(670,NULL,'Jaartal sortering hout',1,0,NULL,NULL,'S33',NULL),(671,NULL,'Diámetro de la hoja',1,0,NULL,NULL,'S34',NULL),(672,NULL,'Peso paquete',1,0,NULL,NULL,'S35',NULL),(673,NULL,'Maximum planthoogte',1,0,NULL,NULL,'S36',NULL),(674,NULL,'Maximum plantdiameter',1,0,NULL,NULL,'S37',NULL),(675,NULL,'Max aantal bloemen/bloeiw',1,0,NULL,NULL,'S38',NULL),(676,NULL,'Maximum aantal takken per',1,0,NULL,NULL,'S39',NULL),(677,NULL,'Maximum aantal bollen per',1,0,NULL,NULL,'S40',NULL),(678,NULL,'Maximum stamhoogte',1,0,NULL,NULL,'S41',NULL),(679,NULL,'Longitud mínima',1,0,NULL,NULL,'S42','size'),(680,NULL,'Maximum aantal knoppen sn',1,0,NULL,NULL,'S43',NULL),(681,NULL,'Maximum bloemdiameter',1,0,NULL,NULL,'S44',NULL),(682,NULL,'Maximum bloeiwijzelengte',1,0,NULL,NULL,'S45',NULL),(683,NULL,'Aantal vruchten / trossen',1,0,NULL,NULL,'S46',NULL),(684,NULL,'Verpakkingswijze',1,0,NULL,NULL,'S47',NULL),(685,NULL,'Minimum vruchtdiameter',1,0,NULL,NULL,'S48',NULL),(686,NULL,'Bolomvang',1,0,NULL,NULL,'S49',NULL),(687,NULL,'Bloem/bes/vruchtkleur 1',1,0,NULL,NULL,'S50',NULL),(688,NULL,'Potvorm',1,0,NULL,NULL,'S51',NULL),(689,NULL,'Potkleur',1,0,NULL,NULL,'S52',NULL),(690,NULL,'Material maceta',1,0,NULL,NULL,'S53',NULL),(691,NULL,'Plantvorm',1,0,NULL,NULL,'S54',NULL),(692,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S55',NULL),(693,NULL,'Teeltwijze',1,0,NULL,NULL,'S56',NULL),(694,NULL,'Teeltmedium',1,0,NULL,NULL,'S57',NULL),(695,NULL,'Hoesmateriaal',1,0,NULL,NULL,'S58',NULL),(696,NULL,'Hoesvorm',1,0,NULL,NULL,'S59',NULL),(697,NULL,'Hoesbedrukking algemeen',1,0,NULL,NULL,'S60',NULL),(698,NULL,'Extra toevoegingen',1,0,NULL,NULL,'S61',NULL),(699,NULL,'Land van herkomst (bedrij',1,0,NULL,NULL,'S62',NULL),(700,NULL,'Verpakte orchidee',1,0,NULL,NULL,'S63',NULL),(701,NULL,'Hoesbedrukking extra',1,0,NULL,NULL,'S64',NULL),(702,NULL,'Voorbehandeling',1,0,NULL,NULL,'S65',NULL),(703,NULL,'Overige niet in pot',1,0,NULL,NULL,'S66',NULL),(704,NULL,'Vorm snijbloemen',1,0,NULL,NULL,'S67',NULL),(705,NULL,'Buigzaamheid bloemsteel',1,0,NULL,NULL,'S68',NULL),(706,NULL,'Hoeskleur',1,0,NULL,NULL,'S69',NULL),(707,NULL,'Extra deco materiaal',1,0,NULL,NULL,'S70',NULL),(708,NULL,'Productkleur',1,0,NULL,NULL,'S71','inkFk'),(709,NULL,'Productmateriaal',1,0,NULL,NULL,'S72',NULL),(710,NULL,'Materiaalhoogte',1,0,NULL,NULL,'S73',NULL),(711,NULL,'Materiaaldiameter',1,0,NULL,NULL,'S74',NULL),(712,NULL,'Barcode',1,0,NULL,NULL,'S75',NULL),(713,NULL,'Productlabel',1,0,NULL,NULL,'S76',NULL),(714,NULL,'Eetbaar/ niet eetbaar',1,0,NULL,NULL,'S77',NULL),(715,NULL,'Plantmaat zonder pot',1,0,NULL,NULL,'S78',NULL),(716,NULL,'Aantal kleuren/cultiv per',1,0,NULL,NULL,'S79',NULL),(717,NULL,'Maximum percentage oud ho',1,0,NULL,NULL,'S80',NULL),(718,NULL,'Maximum lengte verschil',1,0,NULL,NULL,'S81',NULL),(719,NULL,'Bladkleur',1,0,NULL,NULL,'S82',NULL),(720,NULL,'Plantgewicht',1,0,NULL,NULL,'S83',NULL),(721,NULL,'Diámetro',1,0,NULL,NULL,'S84',NULL),(722,NULL,'Bloem/bes/vruchtkleur 2',1,0,NULL,NULL,'S85',NULL),(723,NULL,'Winterhardheid (USDA zone',1,0,NULL,NULL,'S86',NULL),(724,NULL,'Kleurbehandeld',1,0,NULL,NULL,'S87','inkFk'),(725,NULL,'Bloem-/bladkleurverdeling',1,0,NULL,NULL,'S88',NULL),(726,NULL,'Diámetro del capullo',1,0,NULL,NULL,'S89',NULL),(727,NULL,'Volume inhoud',1,0,NULL,NULL,'S90',NULL),(728,NULL,'Vruchtbenaming',1,0,NULL,NULL,'S91',NULL),(729,NULL,'Vaaslevenindex',1,0,NULL,NULL,'S92',NULL),(730,NULL,'Overige informatie plante',1,0,NULL,NULL,'S93',NULL),(731,NULL,'Overige informatie snijbl',1,0,NULL,NULL,'S94',NULL),(732,NULL,'Toepassingsmogelijkheid',1,0,NULL,NULL,'S95',NULL),(733,NULL,'Productbeeld aanvoerder',1,0,NULL,NULL,'S96',NULL),(734,NULL,'MPS certificering',1,0,NULL,NULL,'S97',NULL),(735,NULL,'Kwaliteitsgroep',1,0,NULL,NULL,'S98',NULL),(736,NULL,'Artikelomschrijving',1,0,NULL,NULL,'S99',NULL),(737,NULL,'BTW-tarief',1,0,NULL,NULL,'T01',NULL),(738,NULL,'Prijseenheid',1,0,NULL,NULL,'T02',NULL),(739,NULL,'Transactievorm',1,0,NULL,NULL,'T03',NULL),(740,NULL,'Handelsverpakking voorwaa',1,0,NULL,NULL,'T10',NULL),(741,NULL,'Consumentenverpakking voo',1,0,NULL,NULL,'T11',NULL),(742,NULL,'Leveringsvoorwaarden',1,0,NULL,NULL,'T12',NULL),(743,NULL,'PT heffing voorwaarden',1,0,NULL,NULL,'T13',NULL),(744,NULL,'Serviceheffing voorwaarde',1,0,NULL,NULL,'T14',NULL),(745,NULL,'Algemene voorwaarden',1,0,NULL,NULL,'T15',NULL),(746,NULL,'Marktvorm',1,0,NULL,NULL,'T16',NULL),(747,NULL,'Themadagen',1,0,NULL,NULL,'T17',NULL),(748,NULL,'Handelscategorie',1,0,NULL,NULL,'T18',NULL),(749,NULL,'Producentengroepen',1,0,NULL,NULL,'T19',NULL),(750,NULL,'Favorieten Id',1,0,NULL,NULL,'T20',NULL),(751,NULL,'Verkoopeenheid',1,0,NULL,NULL,'T21',NULL),(752,NULL,'Veilgroep voorkeur',1,0,NULL,NULL,'V01',NULL),(753,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V02',NULL),(754,NULL,'Keurmeesternummer FloraHo',1,0,NULL,NULL,'V03',NULL),(755,NULL,'Rijnummer Rijnsburg',1,0,NULL,NULL,'V04',NULL),(756,NULL,'Verwerkingslocatie FloraH',1,0,NULL,NULL,'V05',NULL),(757,NULL,'FloraHolland Financial',1,0,NULL,NULL,'V06',NULL),(758,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V07',NULL),(759,NULL,'Benefiet veiling',1,0,NULL,NULL,'V08',NULL),(760,NULL,'Kloksoort',1,0,NULL,NULL,'V09',NULL),(761,NULL,'Minimumprijs aanvoerder',1,0,NULL,NULL,'V10',NULL),(762,NULL,'Rest aantallen',1,0,NULL,NULL,'V11',NULL),(763,NULL,'Veilsoort',1,0,NULL,NULL,'V12',NULL),(764,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V13',NULL),(765,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V14',NULL),(766,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V15',NULL),(767,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V16',NULL),(768,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V17',NULL),(769,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V18',NULL),(770,NULL,'Gereserveerd FloraHolland',1,0,NULL,NULL,'V19',NULL),(771,NULL,'Gereserveerd',1,0,NULL,NULL,'V20',NULL),(772,NULL,'Veilgroep Aalsmeer',1,0,NULL,NULL,'V21',NULL),(773,NULL,'Promotie kenmerk FloraHol',1,0,NULL,NULL,'V22',NULL),(774,NULL,'Verrekening snijbloemenvo',1,0,NULL,NULL,'V23',NULL),(775,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V24',NULL),(776,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V25',NULL),(777,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V26',NULL),(778,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V27',NULL),(779,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V28',NULL),(780,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V29',NULL),(781,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V30',NULL),(782,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V31',NULL),(783,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V32',NULL),(784,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V33',NULL),(785,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V34',NULL),(786,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V35',NULL),(787,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V36',NULL),(788,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V37',NULL),(789,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V38',NULL),(790,NULL,'Gereserveerd Aalsmeer',1,0,NULL,NULL,'V39',NULL),(791,NULL,'Gereserveerd',1,0,NULL,NULL,'V40',NULL),(792,NULL,'Tussenopslag klok Plantio',1,0,NULL,NULL,'V41',NULL),(793,NULL,'Soort ladingsdrager Plant',1,0,NULL,NULL,'V42',NULL),(794,NULL,'Logistiek middel Plantion',1,0,NULL,NULL,'V43',NULL),(795,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V44',NULL),(796,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V45',NULL),(797,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V46',NULL),(798,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V47',NULL),(799,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V48',NULL),(800,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V49',NULL),(801,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V50',NULL),(802,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V51',NULL),(803,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V52',NULL),(804,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V53',NULL),(805,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V54',NULL),(806,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V55',NULL),(807,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V56',NULL),(808,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V57',NULL),(809,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V58',NULL),(810,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V59',NULL),(811,NULL,'Gereserveerd',1,0,NULL,NULL,'V60',NULL),(812,NULL,'Veilgroep Plantion Ede',1,0,NULL,NULL,'V61',NULL),(813,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V62',NULL),(814,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V63',NULL),(815,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V64',NULL),(816,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V65',NULL),(817,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V66',NULL),(818,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V67',NULL),(819,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V68',NULL),(820,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V69',NULL),(821,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V70',NULL),(822,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V71',NULL),(823,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V72',NULL),(824,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V73',NULL),(825,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V74',NULL),(826,NULL,'Gereserveerd Plantion Ede',1,0,NULL,NULL,'V75',NULL),(827,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V76',NULL),(828,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V77',NULL),(829,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V78',NULL),(830,NULL,'Gereserveerd Holambra',1,0,NULL,NULL,'V79',NULL),(831,NULL,'Toegevoegde waardes VRM',1,0,NULL,NULL,'V80',NULL),(832,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V81',NULL),(833,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V82',NULL),(834,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V83',NULL),(835,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V84',NULL),(836,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V85',NULL),(837,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V86',NULL),(838,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V87',NULL),(839,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V88',NULL),(840,NULL,'Gereserveerd VRM',1,0,NULL,NULL,'V89',NULL),(841,NULL,'Veiling',1,0,NULL,NULL,'V99',NULL),(842,NULL,'kopersaantallen',1,0,NULL,NULL,'Z01',NULL);
/*!40000 ALTER TABLE `tag` ENABLE KEYS */;
UNLOCK TABLES;
@@ -340,7 +340,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 9:53:07
+-- Dump completed on 2020-08-11 11:51:01
USE `cache`;
-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64)
--
@@ -378,7 +378,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 9:53:08
+-- Dump completed on 2020-08-11 11:51:01
USE `hedera`;
-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64)
--
@@ -436,7 +436,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 9:53:09
+-- Dump completed on 2020-08-11 11:51:03
USE `postgresql`;
-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64)
--
@@ -524,4 +524,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 9:53:11
+-- Dump completed on 2020-08-11 11:51:04
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index a1018ab5a..4351cd867 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -116,13 +116,13 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park
('GVC', '1', '0', '1', '0', '106'),
('HEJ', '2', '0', '1', '0', '106');
-INSERT INTO `vn`.`accountingType`(`id`, `description`)
+INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`)
VALUES
- (1, 'Digital money'),
- (2, 'Cash'),
- (3, 'Card'),
- (4, 'Stolen Money'),
- (5, 'Miscellaneous');
+ (1, 'Digital money', ''),
+ (2, 'Cash', 'Cash'),
+ (3, 'Card', 'Pay on receipt'),
+ (4, 'Stolen Money', ''),
+ (5, 'Miscellaneous', '');
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
VALUES
@@ -133,8 +133,8 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
VALUES
- (1, 'Pay on receipt', '0000000000', 4, 0, 1, 1),
- (2, 'Cash', '1111111111', 1, 0, 1, 1);
+ (1, 'Pay on receipt', '0000000000', 3, 0, 1, 1),
+ (2, 'Cash', '1111111111', 2, 0, 1, 1);
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
VALUES
@@ -556,11 +556,11 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
(12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
(13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()),
(14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
- (15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()),
+ (15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, CURDATE()),
(16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
(17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
(18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),
- (19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()),
+ (19, 1, 5, 5, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()),
(20, 1, 5, 5, 3, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(21, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(22, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
@@ -601,11 +601,11 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
(12, 3, 19, NOW()),
(13, 3, 19, NOW()),
(14, 3, 19, NOW()),
- (15, 3, 19, NOW()),
+ (15, 2, 19, NOW()),
(16, 3, 19, NOW()),
- (17, 3, 19, NOW()),
- (18, 3, 19, NOW()),
- (19, 3, 19, NOW()),
+ (17, 2, 19, NOW()),
+ (18, 2, 19, NOW()),
+ (19, 2, 19, NOW()),
(20, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
(21, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
(22, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
@@ -735,36 +735,23 @@ INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`)
VALUES
- (1, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1, NULL),
- (2, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1, NULL),
- (3, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1, NULL),
- (4, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2, NULL),
- (5, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL),
- (6, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
- (7, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
- (8, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1, NULL),
- (9, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1, NULL),
- (10, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1, NULL),
- (11, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2, NULL),
- (12, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL),
- (13, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
- (14, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
+ (1, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 67, 1, NULL),
+ (2, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66, 1, NULL),
+ (3, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 65, 1, NULL),
+ (4, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 69, 2, NULL),
+ (5, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 74, 2, NULL),
+ (6, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 62, 2, NULL),
+ (7, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 64, 2, NULL),
+ (8, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 75, 1, NULL),
+ (9, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 76, 1, NULL),
+ (10, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 77, 1, NULL),
+ (11, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 78, 2, NULL),
+ (12, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 82, 2, NULL),
+ (13, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 83, 2, NULL),
+ (14, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 84, 2, NULL),
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
- (71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL);
-
-INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
- VALUES
- (1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
- (2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 18),
- (3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 3, 1, 18),
- (4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 18),
- (5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
- (6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 1, 1, 18),
- (7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 1, 1, 18),
- (8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 18),
- (9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
- (10, 7, 7, 71, CURDATE(), 1, 1, 1, 18);
+ (71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, 88, 2, NULL);
INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`)
VALUES
@@ -777,6 +764,19 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack
('cc', 1640038.00, 56.00, 220.00, 128.00, 1, CURDATE(), 15, 90.00),
('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, CURDATE(), 16, 0.00);
+INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `packagingFk`)
+ VALUES
+ (1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1),
+ (2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 1),
+ (3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 3, 1, 1),
+ (4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 1),
+ (5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1),
+ (6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 1, 1, 1),
+ (7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 1, 1, 1),
+ (8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 1),
+ (9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1),
+ (10, 7, 7, 71, CURDATE(), 1, 1, 1, 1);
+
INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`)
VALUES
(1, 1, 2, 2, CURDATE(), NULL),
@@ -1199,8 +1199,8 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
(4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0),
(5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1),
(6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1),
- (7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 1),
- (8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1);
+ (7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 2),
+ (8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`)
VALUES
@@ -1251,30 +1251,30 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`package
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 4, CURDATE());
-INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`)
+INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
VALUES
- (1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
- (2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
- (3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
- (4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
- (5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
- (6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
- (7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 1, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 2, 7, 124, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
- (20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
- (21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
- (22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH));
+ (1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1,'155.89', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
+ (2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1,'100.10', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
+ (3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1,'107.25', DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
+ (4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
+ (5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
+ (6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
+ (7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 1, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
+ (8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 121, 442, NULL, 'SALIX', 0,'123.53', CURDATE(), CURDATE(), CURDATE()),
+ (9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 2, 7, 124, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
+ (10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
+ (11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0,'60.90', CURDATE(), CURDATE(), CURDATE()),
+ (12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
+ (13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
+ (14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
+ (15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
+ (16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0,'155.89', CURDATE(), CURDATE(), CURDATE()),
+ (17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
+ (18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
+ (19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0,'16.50', CURDATE(), CURDATE(), CURDATE()),
+ (20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0,'21.45', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
+ (21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0,'0.00', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
+ (22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0,'148.50', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH));
INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`)
VALUES
diff --git a/db/dump/structure.sql b/db/dump/structure.sql
index c0052acf9..ce0c634ac 100644
--- a/db/dump/structure.sql
+++ b/db/dump/structure.sql
@@ -1925,10 +1925,10 @@ CREATE TABLE `clientNewBorn` (
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `bs`.`clientNewBorn_BEFORE_UPDATE` BEFORE UPDATE ON `clientNewBorn` FOR EACH ROW
BEGIN
--- Si ha pasado un año o mas
-IF TIMESTAMPDIFF(YEAR,NEW.lastShipped, OLD.firstShipped) THEN
-SET NEW.firstShipped = NEW.lastShipped;
-END IF;
+ -- Si ha pasado un año o mas
+ IF TIMESTAMPDIFF(YEAR,NEW.lastShipped, OLD.lastShipped) THEN
+ SET NEW.firstShipped = NEW.lastShipped;
+ END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -2655,14 +2655,14 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2017-08-27 02:00:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2020-08-05 02:45:17' ON COMPLETION NOT PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -4141,16 +4141,16 @@ BEGIN
* La tabla mana_spellers es una caché
*
*/
-
- UPDATE mana_spellers me
- JOIN
- (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual
- FROM bs.vendedores
- WHERE año * 100 + mes >= (YEAR(CURDATE()) -1) * 100 + MONTH(CURDATE())
- GROUP BY Id_Trabajador
- ) lastYearSales USING(Id_Trabajador)
- SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,3))) ;
-
+
+ UPDATE mana_spellers me
+ JOIN
+ (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual
+ FROM bs.vendedores
+ WHERE año * 100 + mes >= (YEAR(CURDATE()) -1) * 100 + MONTH(CURDATE())
+ GROUP BY Id_Trabajador
+ ) lastYearSales USING(Id_Trabajador)
+ SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,3))) ;
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -6078,9 +6078,9 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -6096,9 +6096,9 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -6312,9 +6312,9 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `cacheCalc_clean`()
-BEGIN
- DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, NOW());
- DELETE FROM cache_calc WHERE expires < vCleanTime;
+BEGIN
+ DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, NOW());
+ DELETE FROM cache_calc WHERE expires < vCleanTime;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -6332,27 +6332,27 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_end`(IN `v_calc` INT)
-BEGIN
- DECLARE v_cache_name VARCHAR(255);
- DECLARE v_params VARCHAR(255);
-
- -- Libera el bloqueo y actualiza la fecha de ultimo refresco.
-
- UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id
- SET
- cc.last_refresh = NOW(),
- cc.expires = ADDTIME(NOW(), c.lifetime),
- cc.connection_id = NULL
- WHERE cc.id = v_calc;
-
- SELECT c.name, ca.params INTO v_cache_name, v_params
- FROM cache c
- JOIN cache_calc ca ON c.id = ca.cache_id
- WHERE ca.id = v_calc;
-
- IF v_cache_name IS NOT NULL THEN
- DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, '')));
- END IF;
+BEGIN
+ DECLARE v_cache_name VARCHAR(255);
+ DECLARE v_params VARCHAR(255);
+
+ -- Libera el bloqueo y actualiza la fecha de ultimo refresco.
+
+ UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id
+ SET
+ cc.last_refresh = NOW(),
+ cc.expires = ADDTIME(NOW(), c.lifetime),
+ cc.connection_id = NULL
+ WHERE cc.id = v_calc;
+
+ SELECT c.name, ca.params INTO v_cache_name, v_params
+ FROM cache c
+ JOIN cache_calc ca ON c.id = ca.cache_id
+ WHERE ca.id = v_calc;
+
+ IF v_cache_name IS NOT NULL THEN
+ DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, '')));
+ END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -6370,88 +6370,88 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100))
-proc: BEGIN
- DECLARE v_valid BOOL;
- DECLARE v_lock_id VARCHAR(100);
- DECLARE v_cache_id INT;
- DECLARE v_expires DATETIME;
- DECLARE v_clean_time DATETIME;
-
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- IF v_lock_id IS NOT NULL THEN
- DO RELEASE_LOCK(v_lock_id);
- END IF;
-
- RESIGNAL;
- END;
-
- SET v_params = IFNULL(v_params, '');
-
- -- Si el servidor se ha reiniciado invalida todos los calculos.
-
- SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid;
-
- IF !v_valid
- THEN
- DELETE FROM cache_calc;
- INSERT INTO cache_valid (valid) VALUES (TRUE);
- END IF;
-
- -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia.
-
- SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params);
-
- IF !GET_LOCK(v_lock_id, 30)
- THEN
- SET v_calc = NULL;
- SET v_refresh = FALSE;
- LEAVE proc;
- END IF;
-
- -- Comprueba si el calculo solicitado existe y esta actualizado.
-
- SELECT c.id, ca.id, ca.expires
- INTO v_cache_id, v_calc, v_expires
- FROM cache c
- LEFT JOIN cache_calc ca
- ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci'
- WHERE c.name = v_cache_name COLLATE 'utf8_general_ci';
-
- -- Si existe una calculo valido libera el bloqueo y devuelve su identificador.
-
- IF !v_refresh AND NOW() < v_expires
- THEN
- DO RELEASE_LOCK(v_lock_id);
- SET v_refresh = FALSE;
- LEAVE proc;
- END IF;
-
- -- Si el calculo no existe le crea una entrada en la tabla de calculos.
-
- IF v_calc IS NULL
- THEN
- INSERT INTO cache_calc SET
- cache_id = v_cache_id,
- cacheName = v_cache_name,
- params = v_params,
- last_refresh = NULL,
- expires = NULL,
- connection_id = CONNECTION_ID();
-
- SET v_calc = LAST_INSERT_ID();
- ELSE
- UPDATE cache_calc
- SET
- last_refresh = NULL,
- expires = NULL,
- connection_id = CONNECTION_ID()
- WHERE id = v_calc;
- END IF;
-
- -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador.
-
- SET v_refresh = TRUE;
+proc: BEGIN
+ DECLARE v_valid BOOL;
+ DECLARE v_lock_id VARCHAR(100);
+ DECLARE v_cache_id INT;
+ DECLARE v_expires DATETIME;
+ DECLARE v_clean_time DATETIME;
+
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ IF v_lock_id IS NOT NULL THEN
+ DO RELEASE_LOCK(v_lock_id);
+ END IF;
+
+ RESIGNAL;
+ END;
+
+ SET v_params = IFNULL(v_params, '');
+
+ -- Si el servidor se ha reiniciado invalida todos los calculos.
+
+ SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid;
+
+ IF !v_valid
+ THEN
+ DELETE FROM cache_calc;
+ INSERT INTO cache_valid (valid) VALUES (TRUE);
+ END IF;
+
+ -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia.
+
+ SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params);
+
+ IF !GET_LOCK(v_lock_id, 30)
+ THEN
+ SET v_calc = NULL;
+ SET v_refresh = FALSE;
+ LEAVE proc;
+ END IF;
+
+ -- Comprueba si el calculo solicitado existe y esta actualizado.
+
+ SELECT c.id, ca.id, ca.expires
+ INTO v_cache_id, v_calc, v_expires
+ FROM cache c
+ LEFT JOIN cache_calc ca
+ ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci'
+ WHERE c.name = v_cache_name COLLATE 'utf8_general_ci';
+
+ -- Si existe una calculo valido libera el bloqueo y devuelve su identificador.
+
+ IF !v_refresh AND NOW() < v_expires
+ THEN
+ DO RELEASE_LOCK(v_lock_id);
+ SET v_refresh = FALSE;
+ LEAVE proc;
+ END IF;
+
+ -- Si el calculo no existe le crea una entrada en la tabla de calculos.
+
+ IF v_calc IS NULL
+ THEN
+ INSERT INTO cache_calc SET
+ cache_id = v_cache_id,
+ cacheName = v_cache_name,
+ params = v_params,
+ last_refresh = NULL,
+ expires = NULL,
+ connection_id = CONNECTION_ID();
+
+ SET v_calc = LAST_INSERT_ID();
+ ELSE
+ UPDATE cache_calc
+ SET
+ last_refresh = NULL,
+ expires = NULL,
+ connection_id = CONNECTION_ID()
+ WHERE id = v_calc;
+ END IF;
+
+ -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador.
+
+ SET v_refresh = TRUE;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -6469,24 +6469,24 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_unlock`(IN `v_calc` INT)
-proc: BEGIN
- DECLARE v_cache_name VARCHAR(50);
- DECLARE v_params VARCHAR(100);
-
- IF v_calc IS NULL THEN
- LEAVE proc;
- END IF;
-
- SELECT c.name, ca.params INTO v_cache_name, v_params
- FROM cache c
- JOIN cache_calc ca ON c.id = ca.cache_id
- WHERE ca.id = v_calc;
-
- DELETE FROM cache_calc WHERE id = v_calc;
-
- IF v_cache_name IS NOT NULL THEN
- DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, '')));
- END IF;
+proc: BEGIN
+ DECLARE v_cache_name VARCHAR(50);
+ DECLARE v_params VARCHAR(100);
+
+ IF v_calc IS NULL THEN
+ LEAVE proc;
+ END IF;
+
+ SELECT c.name, ca.params INTO v_cache_name, v_params
+ FROM cache c
+ JOIN cache_calc ca ON c.id = ca.cache_id
+ WHERE ca.id = v_calc;
+
+ DELETE FROM cache_calc WHERE id = v_calc;
+
+ IF v_cache_name IS NOT NULL THEN
+ DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, '')));
+ END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -6505,9 +6505,9 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `cache_clean`()
NO SQL
-BEGIN
- CALL available_clean;
- CALL visible_clean;
+BEGIN
+ CALL available_clean;
+ CALL visible_clean;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -6525,13 +6525,13 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `clean`()
-BEGIN
-
- DECLARE vDateShort DATETIME;
-
- SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE());
-
- DELETE FROM cache.departure_limit WHERE Fecha < vDateShort;
+BEGIN
+
+ DECLARE vDateShort DATETIME;
+
+ SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE());
+
+ DELETE FROM cache.departure_limit WHERE Fecha < vDateShort;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -7570,7 +7570,7 @@ CREATE TABLE `item_groupToOffer` (
`itemTypeFk` smallint(5) unsigned NOT NULL,
`intrastatFk` int(8) unsigned zerofill NOT NULL,
`originFk` tinyint(2) unsigned NOT NULL DEFAULT '17',
- `expenseFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT '6001000001',
+ `expenseFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT '7001000000',
PRIMARY KEY (`group_code`),
KEY `item_groupToOffer_fk2_idx` (`itemTypeFk`),
KEY `item_groupToOffer_fk3_idx` (`intrastatFk`),
@@ -7893,14 +7893,14 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`z-sysadmin`@`%`*/ /*!50106 EVENT `floramondo` ON SCHEDULE EVERY 5 MINUTE STARTS '2020-06-25 13:39:59' ON COMPLETION NOT PRESERVE ENABLE DO CALL edi.floramondo_offerRefresh() */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `floramondo` ON SCHEDULE EVERY 5 MINUTE STARTS '2020-07-29 01:58:29' ON COMPLETION NOT PRESERVE ENABLE DO CALL edi.floramondo_offerRefresh() */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -8027,10 +8027,10 @@ BEGIN
DELETE FROM ekt WHERE fec < vFourYearsAgo;
- DELETE sr.*
+ DELETE IGNORE sr.*
FROM supplyResponse sr
- JOIN edi.deliveryInformation di ON sr.ID = di.supplyResponseID
- WHERE di.LatestOrderDateTime < vOneWeekAgo;
+ LEFT JOIN edi.deliveryInformation di ON sr.ID = di.supplyResponseID
+ WHERE di.LatestOrderDateTime < vOneWeekAgo OR di.ID IS NULL;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -8433,154 +8433,154 @@ CREATE DEFINER=`root`@`%` PROCEDURE `exchange_new`(
IN `vAuction` SMALLINT,
IN `vPackage` INT,
IN `vPutOrderFk` INT)
-BEGIN
+BEGIN
/**
* Adds a new exchange, generates it's barcode and
* inserts/updates the transaction. When the referenced
* transaction exists as provisional, updates it with
- * the new values.
- */
- DECLARE vEkt INT;
- DECLARE vRewriteKop INT DEFAULT NULL;
- DECLARE vBarcode CHAR(15) DEFAULT NULL;
- DECLARE vIsDuplicated BOOL;
+ * the new values.
+ */
+ DECLARE vEkt INT;
+ DECLARE vRewriteKop INT DEFAULT NULL;
+ DECLARE vBarcode CHAR(15) DEFAULT NULL;
+ DECLARE vIsDuplicated BOOL;
DECLARE vUpdateExistent BOOL DEFAULT FALSE;
- DECLARE duplicateKey CONDITION FOR 1062;
-
- DECLARE CONTINUE HANDLER FOR duplicateKey
- SET vIsDuplicated = TRUE;
-
- -- Generates the barcode
-
- IF vAgj != 0 AND vAgj IS NOT NULL
- THEN
- SET vBarcode = CONCAT(
- LPAD(vAuction, 2, 0),
- LPAD(IFNULL(vClock, 99), 2, 0),
- LPAD(DAYOFYEAR(vDate), 3, 0),
- IF(vClock IS NULL OR vClock = 99,
- LPAD(vAgj, 7, 0),
- CONCAT(LPAD(vAgj, 5, 0), '01')
- ),
- '0'
- );
- END IF;
-
- -- Rewrites the kop parameter
-
- IF vKop IS NULL THEN
- SELECT defaultKop INTO vKop FROM exchangeConfig;
- END IF;
-
- SELECT e.kop INTO vRewriteKop
- FROM mailSender e
- JOIN mail m ON m.senderFk = e.id
- WHERE m.id = vMailFk;
-
- SET vKop = IFNULL(vRewriteKop, vKop);
-
- -- Inserts the new transaction
+ DECLARE duplicateKey CONDITION FOR 1062;
- SET vIsDuplicated = FALSE;
- INSERT INTO ekt SET
- barcode = IFNULL(vBarcode, barcode)
- ,deliveryNumber = vDeliveryNumber
- ,entryYear = YEAR(vDate)
- ,fec = vDate
- ,hor = vHour
- ,ref = vRef
- ,item = vItem
- ,agj = vAgj
- ,cat = vCat
- ,pac = vPac
- ,sub = vSub
- ,kop = vKop
- ,ptd = vPtd
- ,pro = vPro
- ,ori = vOrigin
- ,ptj = vPtj
- ,qty = vQuantiy
- ,pri = vPrice
- ,klo = vClock
- ,s1 = vS1
- ,s2 = vS2
- ,s3 = vS3
- ,s4 = vS4
- ,s5 = vS5
- ,s6 = vS6
- ,k1 = vK1
- ,k2 = vK2
- ,k3 = vP1
- ,k4 = vP2
- ,auction = vAuction
- ,package = vPackage
- ,putOrderFk = vPutOrderFk;
-
- -- If it exists duplicado updates it
-
- IF NOT vIsDuplicated
- THEN
- SET vEkt = LAST_INSERT_ID();
- CALL ekt_load (vEkt);
-
- ELSEIF vDeliveryNumber != 0
- AND vDeliveryNumber IS NOT NULL
- THEN
- SELECT id INTO vEkt
- FROM ekt
- WHERE deliveryNumber = vDeliveryNumber;
-
- SELECT COUNT(*) = 0 INTO vUpdateExistent
- FROM ekt t
- JOIN `exchange` b ON b.ektFk = t.id
- JOIN exchangeConfig c
- WHERE t.deliveryNumber = vDeliveryNumber
- AND t.entryYear = YEAR(vDate)
- AND b.typeFk != c.presaleFk;
- END IF;
-
- IF vUpdateExistent
- THEN
- UPDATE ekt SET
- barcode = IFNULL(vBarcode, barcode)
- ,fec = vDate
- ,hor = vHour
- ,ref = vRef
- ,item = vItem
- ,agj = vAgj
- ,cat = vCat
- ,pac = vPac
- ,sub = vSub
- ,kop = vKop
- ,ptd = vPtd
- ,pro = vPro
- ,ori = vOrigin
- ,ptj = vPtj
- ,qty = vQuantiy
- ,pri = vPrice
- ,klo = vClock
- ,s1 = vS1
- ,s2 = vS2
- ,s3 = vS3
- ,s4 = vS4
- ,s5 = vS5
- ,s6 = vS6
- ,k1 = vK1
- ,k2 = vK2
- ,k3 = vP1
- ,k4 = vP2
- ,auction = vAuction
- ,package = vPackage
- ,putOrderFk = vPutOrderFk
- WHERE id = vEkt;
- END IF;
-
- -- Registers the exchange
-
- INSERT INTO `exchange` SET
- mailFk = vMailFk
- ,typeFk = vType
- ,ektFk = vEkt;
+ DECLARE CONTINUE HANDLER FOR duplicateKey
+ SET vIsDuplicated = TRUE;
+
+ -- Generates the barcode
+
+ IF vAgj != 0 AND vAgj IS NOT NULL
+ THEN
+ SET vBarcode = CONCAT(
+ LPAD(vAuction, 2, 0),
+ LPAD(IFNULL(vClock, 99), 2, 0),
+ LPAD(DAYOFYEAR(vDate), 3, 0),
+ IF(vClock IS NULL OR vClock = 99,
+ LPAD(vAgj, 7, 0),
+ CONCAT(LPAD(vAgj, 5, 0), '01')
+ ),
+ '0'
+ );
+ END IF;
+
+ -- Rewrites the kop parameter
+
+ IF vKop IS NULL THEN
+ SELECT defaultKop INTO vKop FROM exchangeConfig;
+ END IF;
+
+ SELECT e.kop INTO vRewriteKop
+ FROM mailSender e
+ JOIN mail m ON m.senderFk = e.id
+ WHERE m.id = vMailFk;
+
+ SET vKop = IFNULL(vRewriteKop, vKop);
+
+ -- Inserts the new transaction
+
+ SET vIsDuplicated = FALSE;
+ INSERT INTO ekt SET
+ barcode = IFNULL(vBarcode, barcode)
+ ,deliveryNumber = vDeliveryNumber
+ ,entryYear = YEAR(vDate)
+ ,fec = vDate
+ ,hor = vHour
+ ,ref = vRef
+ ,item = vItem
+ ,agj = vAgj
+ ,cat = vCat
+ ,pac = vPac
+ ,sub = vSub
+ ,kop = vKop
+ ,ptd = vPtd
+ ,pro = vPro
+ ,ori = vOrigin
+ ,ptj = vPtj
+ ,qty = vQuantiy
+ ,pri = vPrice
+ ,klo = vClock
+ ,s1 = vS1
+ ,s2 = vS2
+ ,s3 = vS3
+ ,s4 = vS4
+ ,s5 = vS5
+ ,s6 = vS6
+ ,k1 = vK1
+ ,k2 = vK2
+ ,k3 = vP1
+ ,k4 = vP2
+ ,auction = vAuction
+ ,package = vPackage
+ ,putOrderFk = vPutOrderFk;
+
+ -- If it exists duplicado updates it
+
+ IF NOT vIsDuplicated
+ THEN
+ SET vEkt = LAST_INSERT_ID();
+ CALL ekt_load (vEkt);
+
+ ELSEIF vDeliveryNumber != 0
+ AND vDeliveryNumber IS NOT NULL
+ THEN
+ SELECT id INTO vEkt
+ FROM ekt
+ WHERE deliveryNumber = vDeliveryNumber;
+
+ SELECT COUNT(*) = 0 INTO vUpdateExistent
+ FROM ekt t
+ JOIN `exchange` b ON b.ektFk = t.id
+ JOIN exchangeConfig c
+ WHERE t.deliveryNumber = vDeliveryNumber
+ AND t.entryYear = YEAR(vDate)
+ AND b.typeFk != c.presaleFk;
+ END IF;
+
+ IF vUpdateExistent
+ THEN
+ UPDATE ekt SET
+ barcode = IFNULL(vBarcode, barcode)
+ ,fec = vDate
+ ,hor = vHour
+ ,ref = vRef
+ ,item = vItem
+ ,agj = vAgj
+ ,cat = vCat
+ ,pac = vPac
+ ,sub = vSub
+ ,kop = vKop
+ ,ptd = vPtd
+ ,pro = vPro
+ ,ori = vOrigin
+ ,ptj = vPtj
+ ,qty = vQuantiy
+ ,pri = vPrice
+ ,klo = vClock
+ ,s1 = vS1
+ ,s2 = vS2
+ ,s3 = vS3
+ ,s4 = vS4
+ ,s5 = vS5
+ ,s6 = vS6
+ ,k1 = vK1
+ ,k2 = vK2
+ ,k3 = vP1
+ ,k4 = vP2
+ ,auction = vAuction
+ ,package = vPackage
+ ,putOrderFk = vPutOrderFk
+ WHERE id = vEkt;
+ END IF;
+
+ -- Registers the exchange
+
+ INSERT INTO `exchange` SET
+ mailFk = vMailFk
+ ,typeFk = vType
+ ,ektFk = vEkt;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -8591,9 +8591,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -8608,9 +8608,10 @@ BEGIN
FROM edi.supplyOffer
JOIN edi.marketPlace mp ON mp.id = MarketPlaceID
WHERE mp.isOffered = TRUE
+ -- OR diId IN(35413041, 35408673, 35335122, 35400930)
ORDER BY NumberOfUnits DESC) t
JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id
- GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6;
+ GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Price, Quality, NumberOfItemsPerCask, EmbalageCode;
DROP TEMPORARY TABLE IF EXISTS edi.offer;
CREATE TEMPORARY TABLE edi.offer ENGINE = MEMORY
@@ -8625,7 +8626,7 @@ BEGIN
LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode
AND eif3.presentation_order = 3 AND eif3.expiry_date IS NULL
LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode
- AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL
+ AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL
LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode
AND eif5.presentation_order = 5 AND eif5.expiry_date IS NULL
LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode
@@ -8640,12 +8641,18 @@ BEGIN
DROP TEMPORARY TABLE tmp;
-- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos
- UPDATE edi.offer o
+ UPDATE IGNORE edi.offer o
+ LEFT JOIN vn.item iExist ON iExist.supplyResponseFk = o.srID
JOIN vn.item i ON i.name = o.product_name
- AND value5 <=> s1Value AND value6 <=> s2Value
- AND value7 <=> s3Value AND value8 <=> s4Value
- AND value9 <=> s5Value AND value10 <=> s6Value
- SET i.supplyResponseFk = o.srID;
+ AND i.subname <=> o.company_name
+ AND i.value5 <=> o.s1Value
+ AND i.value6 <=> o.s2Value
+ AND i.value7 <=> o.s3Value
+ AND i.value8 <=> o.s4Value
+ AND i.value9 <=> o.s5Value
+ AND i.value10 <=> o.s6Value
+ SET i.supplyResponseFk = o.srID
+ WHERE iExist.id IS NULL;
DROP TEMPORARY TABLE IF EXISTS itemToInsert;
CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY
@@ -8653,10 +8660,11 @@ BEGIN
FROM edi.offer o
LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId
WHERE i.id IS NULL;
-
+
-- Insertamos todos los items en Articles de la oferta
- INSERT INTO vn.item(`name`,
+ INSERT IGNORE INTO vn.item(`name`,
longName,
+ subName,
expenceFk,
typeFk,
intrastatFk,
@@ -8664,6 +8672,7 @@ BEGIN
supplyResponseFk)
SELECT product_name,
product_name,
+ company_name,
expenseFk,
itemTypeFk,
intrastatFk,
@@ -8671,7 +8680,7 @@ BEGIN
srId
FROM itemToInsert;
- INSERT INTO vn.itemImageQueue(itemFk, url)
+ INSERT IGNORE INTO vn.itemImageQueue(itemFk, url)
SELECT i.id, PictureReference
FROM itemToInsert ii
JOIN vn.item i ON i.supplyResponseFk = ii.srId;
@@ -8684,20 +8693,19 @@ BEGIN
-- desabilita el trigger para recalcular los tags al final
SET @isTriggerDisabled = TRUE;
-
+
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , product_name, 1
+ SELECT i.id, t.id , CONCAT(ii.product_name,IF(ii.Quality != 'A1', CONCAT(' ',ii.Quality),'')), 1
FROM itemToInsert ii
JOIN vn.tag t ON t.`name` = 'Producto'
JOIN vn.item i ON i.supplyResponseFk = ii.srId;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , company_name, 4
+ SELECT i.id, t.id , ii.company_name, 4
FROM itemToInsert ii
- JOIN vn.tag t ON t.`name` = 'Productor'
- JOIN vn.item i ON i.supplyResponseFk = ii.srId
- WHERE s1Value;
-
+ JOIN vn.tag t ON t.`name` = 'Marca'
+ JOIN vn.item i ON i.supplyResponseFk = ii.srId;
+
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s1Value, 5
FROM itemToInsert ii
@@ -8706,7 +8714,7 @@ BEGIN
WHERE s1Value;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s2Value, 6
+ SELECT i.id, t.id , REPLACE(s2Value," en 'op'","+") , 6
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef2
JOIN vn.item i ON i.supplyResponseFk = ii.srId
@@ -8720,11 +8728,10 @@ BEGIN
WHERE s3Value;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
- SELECT i.id, t.id , s4Value, 8
+ SELECT i.id, t.id , ii.Quality, 8
FROM itemToInsert ii
- JOIN vn.tag t ON t.ediTypeFk = ii.ef4
- JOIN vn.item i ON i.supplyResponseFk = ii.srId
- WHERE s4Value;
+ JOIN vn.tag t ON t.`name` = 'Calidad'
+ JOIN vn.item i ON i.supplyResponseFk = ii.srId;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s5Value, 9
@@ -8733,9 +8740,9 @@ BEGIN
JOIN vn.item i ON i.supplyResponseFk = ii.srId
WHERE s5Value;
- DROP TEMPORARY TABLE IF EXISTS tmp.item;
- CREATE TEMPORARY TABLE tmp.item
- (PRIMARY KEY (id)) ENGINE = MEMORY
+ DROP TABLE IF EXISTS tmp.item;
+ CREATE TABLE tmp.item
+ (PRIMARY KEY (id))
SELECT i.id FROM vn.item i
JOIN itemToInsert ii ON i.supplyResponseFk = ii.srId;
@@ -8758,7 +8765,8 @@ BEGIN
UPDATE vn.buy b
JOIN vn.item i ON i.id = b.itemFk
JOIN edi.offer o ON i.supplyResponseFk = o.srId
- SET quantity = o.NumberOfUnits * o.NumberOfItemsPerCask
+ SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask,
+ b.buyingValue = o.price
WHERE b.entryFk = @myEntry;
-- Inserta la oferta
@@ -8791,9 +8799,10 @@ BEGIN
CALL vn2008.buy_tarifas_entry(@myEntry);
END IF;
DROP TEMPORARY TABLE
- tmp.item,
edi.offer,
itemToInsert;
+
+ DROP TABLE tmp.item;
END ;;
DELIMITER ;
@@ -8931,7 +8940,8 @@ CREATE TABLE `config` (
`productionDomain` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The address for production website',
`pdfsDir` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Directory where PDFs are allocated',
`dmsDir` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Directory where documents are allocated',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `jwtkey_IX` (`jwtKey`) COMMENT 'Prueba de Ernesto 3.8.2020. MySQL se queja de no tener indices. Si, se que solo tiene un registro pero molesta para depurar otros.'
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -10301,9 +10311,9 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -10870,30 +10880,30 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `item_listAllocation`(IN `vWh` TINYINT, IN `vDate` DATE, IN `vType` INT, IN `vPrefix` VARCHAR(255), IN `vUseIds` BOOLEAN)
-BEGIN
-/**
- * Lists visible items and it's box sizes of the specified
- * type at specified date.
- *
- * @param vWh The warehouse id
- * @param vDate The visible date
- * @param vType The type id
- * @param vPrefix The article prefix to filter or %NULL for all
- * @param vUseIds Whether to order the result by item id
- * @select List of visible items with it's box sizes
- */
- CALL item_getVisible(vWh, vDate, vType, vPrefix);
-
- IF vUseIds
- THEN
- SELECT * FROM tmp.itemVisible
- ORDER BY Id_Article;
- ELSE
- SELECT * FROM tmp.itemVisible
- ORDER BY Article, packing;
- END IF;
-
- DROP TEMPORARY TABLE tmp.itemVisible;
+BEGIN
+/**
+ * Lists visible items and it's box sizes of the specified
+ * type at specified date.
+ *
+ * @param vWh The warehouse id
+ * @param vDate The visible date
+ * @param vType The type id
+ * @param vPrefix The article prefix to filter or %NULL for all
+ * @param vUseIds Whether to order the result by item id
+ * @select List of visible items with it's box sizes
+ */
+ CALL item_getVisible(vWh, vDate, vType, vPrefix);
+
+ IF vUseIds
+ THEN
+ SELECT * FROM tmp.itemVisible
+ ORDER BY Id_Article;
+ ELSE
+ SELECT * FROM tmp.itemVisible
+ ORDER BY Article, packing;
+ END IF;
+
+ DROP TEMPORARY TABLE tmp.itemVisible;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -12674,9 +12684,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -12697,6 +12707,8 @@ proc: BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
DO RELEASE_LOCK('hedera.order_doRecalc');
+ # Agregado por Ernesto 9.Agosto.2020, quiero comprobar cuantos rollbacks suceden.
+ CALL util.debugAdd('Event Hedera order_doRecalc() (ernesto)', 'Rollback! '); # max 255 chars en variable y 255 en value, ya hay campo de fecha
ROLLBACK;
RESIGNAL;
END;
@@ -14538,6 +14550,7 @@ SET character_set_client = utf8;
1 AS `careinvite`,
1 AS `insecure`,
1 AS `transport`,
+ 1 AS `nat`,
1 AS `ipaddr`,
1 AS `regseconds`,
1 AS `port`,
@@ -14575,6 +14588,7 @@ CREATE TABLE `sipConfig` (
`dtlscertfile` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`dtlsprivatekey` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`dtlssetup` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `nat` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -15166,6 +15180,7 @@ CREATE TABLE `incometype_employee` (
`id_incometype` int(11) NOT NULL,
`descripcion` varchar(255) DEFAULT NULL,
`nomina` smallint(6) DEFAULT '0',
+ `isExtraSalarial` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_incometype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -15534,7 +15549,10 @@ CREATE TABLE `ACL` (
`permission` set('DENY','ALLOW') COLLATE utf8_unicode_ci DEFAULT 'ALLOW',
`principalType` set('ROLE','USER') COLLATE utf8_unicode_ci DEFAULT 'ROLE',
`principalId` varchar(512) CHARACTER SET utf8 DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `model_ix` (`model`(255)) COMMENT 'ernesto 3.8.2020. Mysql pide indices',
+ KEY `property_ix` (`property`(255)),
+ KEY `accessType_ix` (`accessType`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -15826,9 +15844,10 @@ DROP TABLE IF EXISTS `inboundPick`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `inboundPick` (
- `inboundFk` int(10) unsigned DEFAULT NULL,
- `outboundFk` int(10) unsigned DEFAULT NULL,
+ `inboundFk` int(10) unsigned NOT NULL,
+ `outboundFk` int(10) unsigned NOT NULL,
`quantity` int(11) NOT NULL,
+ PRIMARY KEY (`inboundFk`,`outboundFk`,`quantity`),
UNIQUE KEY `buyFk` (`inboundFk`,`outboundFk`),
KEY `saleFk` (`outboundFk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -15967,9 +15986,9 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -16282,8 +16301,8 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `log_add_beta`(IN `vTableName` VARCHAR(255), IN `vNewId` VARCHAR(255), IN `vOldId` VARCHAR(255))
-proc: BEGIN
- -- XXX: Disabled while testing
+proc: BEGIN
+ -- XXX: Disabled while testing
DECLARE vLanded DATE;
DECLARE vWarehouseFk INT;
DECLARE vBuyerFk INT;
@@ -16291,20 +16310,20 @@ proc: BEGIN
DECLARE vItemFk INT;
DECLARE vItemName VARCHAR(50);
- -- LEAVE proc;
+ -- LEAVE proc;
- IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN
- INSERT IGNORE INTO `log` SET
- tableName = vTableName,
- tableId = vOldId,
- operation = 'delete';
- END IF;
-
- IF vNewId IS NOT NULL THEN
- INSERT IGNORE INTO `log` SET
- tableName = vTableName,
- tableId = vNewId,
- operation = 'insert';
+ IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN
+ INSERT IGNORE INTO `log` SET
+ tableName = vTableName,
+ tableId = vOldId,
+ operation = 'delete';
+ END IF;
+
+ IF vNewId IS NOT NULL THEN
+ INSERT IGNORE INTO `log` SET
+ tableName = vTableName,
+ tableId = vNewId,
+ operation = 'insert';
END IF;
IF vTableName = 'buy' THEN
@@ -16334,7 +16353,7 @@ proc: BEGIN
END IF;
END IF;
-
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -16602,29 +16621,29 @@ CREATE DEFINER=`root`@`%` PROCEDURE `log_refreshSale`(
BEGIN
DROP TEMPORARY TABLE IF EXISTS tValues;
CREATE TEMPORARY TABLE tValues
- ENGINE = MEMORY
- SELECT
- m.id saleFk,
- m.ticketFk,
- m.itemFk,
- t.warehouseFk,
- t.shipped,
+ ENGINE = MEMORY
+ SELECT
+ m.id saleFk,
+ m.ticketFk,
+ m.itemFk,
+ t.warehouseFk,
+ t.shipped,
ABS(m.quantity) quantity,
m.created,
TIMESTAMPADD(DAY, tp.life, t.shipped) expired,
m.quantity < 0 isIn,
- m.isPicked OR s.alertLevel > 1 isPicked
- FROM vn.sale m
- JOIN vn.ticket t ON t.id = m.ticketFk
+ m.isPicked OR s.alertLevel > 1 isPicked
+ FROM vn.sale m
+ JOIN vn.ticket t ON t.id = m.ticketFk
JOIN vn.ticketState s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = m.itemFk
- JOIN vn.itemType tp ON tp.id = i.typeFk
+ JOIN vn.itemType tp ON tp.id = i.typeFk
WHERE (
- vTableId IS NULL
- OR (vTableName = 'ticket' AND t.id = vTableId)
- OR (vTableName = 'sale' AND m.id = vTableId)
- )
- AND t.shipped >= vn.getInventoryDate()
+ vTableId IS NULL
+ OR (vTableName = 'ticket' AND t.id = vTableId)
+ OR (vTableName = 'sale' AND m.id = vTableId)
+ )
+ AND t.shipped >= vn.getInventoryDate()
AND m.quantity != 0;
REPLACE INTO inbound (
@@ -16657,7 +16676,7 @@ BEGIN
FROM tValues
WHERE !isIn;
- DROP TEMPORARY TABLE tValues;
+ DROP TEMPORARY TABLE tValues;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -17071,7 +17090,7 @@ CREATE TABLE `debug` (
`variable` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración';
+) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración';
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -18153,8 +18172,8 @@ CREATE TABLE `XDiario` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ASIEN` double DEFAULT NULL,
`FECHA` datetime DEFAULT NULL,
- `SUBCTA` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL,
- `CONTRA` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `SUBCTA` varchar(12) CHARACTER SET utf8 DEFAULT NULL,
+ `CONTRA` varchar(12) CHARACTER SET utf8 DEFAULT NULL,
`CONCEPTO` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`EURODEBE` decimal(10,2) DEFAULT NULL,
`EUROHABER` decimal(10,2) DEFAULT NULL,
@@ -21151,24 +21170,26 @@ DROP TABLE IF EXISTS `delivery_zip`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `delivery_zip` (
- `postal_code` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `country_code` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `place_name` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `admin_name1` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `postal_code` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
+ `country_code` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `place_name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
+ `admin_name1` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`code_name1` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`admin_name2` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `code_name2` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `admin_name3` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `code_name3` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `latitude` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `longitude` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
- `accuracy` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `code_name2` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `admin_name3` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
+ `code_name3` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
+ `latitude` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
+ `longitude` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
+ `accuracy` varchar(1) COLLATE utf8_unicode_ci NOT NULL,
+ `delivery_zipPK` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`delivery_zipPK`),
KEY `country_code_idx` (`country_code`),
KEY `place_name_idx` (`place_name`),
KEY `postal_code_idx` (`postal_code`),
KEY `admin_name3_idx` (`admin_name3`),
KEY `admin_name2_idx` (`admin_name2`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -23329,7 +23350,7 @@ CREATE TABLE `item` (
CONSTRAINT `item_ibfk_4` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE,
CONSTRAINT `item_ibfk_5` FOREIGN KEY (`typeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
CONSTRAINT `item_ibfk_6` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
- CONSTRAINT `itemsupplyResponseFk` FOREIGN KEY (`supplyResponseFk`) REFERENCES `edi`.`supplyResponse` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `itemsupplyResponseFk` FOREIGN KEY (`supplyResponseFk`) REFERENCES `edi`.`supplyResponse` (`ID`) ON UPDATE CASCADE,
CONSTRAINT `producer_id` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -24652,7 +24673,8 @@ DROP TABLE IF EXISTS `kk`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `kk` (
- `pasillo` varchar(3) COLLATE utf8_unicode_ci NOT NULL
+ `pasillo` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`pasillo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -24671,7 +24693,6 @@ SET character_set_client = utf8;
1 AS `stems`,
1 AS `category`,
1 AS `productor`,
- 1 AS `value`,
1 AS `packing`,
1 AS `warehouse_id`,
1 AS `size`,
@@ -24751,9 +24772,10 @@ DROP TABLE IF EXISTS `lungSize`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lungSize` (
- `hora` time DEFAULT NULL,
- `size` decimal(5,0) DEFAULT NULL,
- `dia` date NOT NULL
+ `hora` time NOT NULL,
+ `size` decimal(5,0) NOT NULL,
+ `dia` date NOT NULL,
+ PRIMARY KEY (`hora`,`size`,`dia`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -26006,7 +26028,8 @@ CREATE TABLE `professionalCategory` (
`description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`salary` decimal(10,2) DEFAULT NULL,
`salaryorSeniority` decimal(10,2) DEFAULT NULL,
- `year` int(2) DEFAULT NULL
+ `year` int(2) DEFAULT NULL,
+ PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -27808,6 +27831,7 @@ CREATE TABLE `tag` (
`sourceTable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`unit` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`ediTypeFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `overwrite` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'nombre del campo de item a sobreescribir con el valor del tag, hay que añadir el código correspondiente en item_refreshTags',
PRIMARY KEY (`id`),
UNIQUE KEY `tagNameIdx` (`name`,`ediTypeFk`),
UNIQUE KEY `tagEdiTypeFkIdx` (`ediTypeFk`),
@@ -27915,7 +27939,7 @@ DROP TABLE IF EXISTS `taxCode`;
CREATE TABLE `taxCode` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dated` date NOT NULL,
- `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
+ `code` varchar(10) CHARACTER SET utf8 NOT NULL,
`taxTypeFk` tinyint(2) NOT NULL,
`rate` decimal(4,1) NOT NULL DEFAULT '0.0',
`equalizationTax` decimal(4,1) NOT NULL DEFAULT '0.0',
@@ -28068,9 +28092,11 @@ BEGIN
FROM state
WHERE `code` = vStateCode COLLATE utf8_general_ci;
- INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped)
- VALUES(NEW.clientFk, NEW.shipped, NEW.shipped)
- ON DUPLICATE KEY UPDATE lastShipped = NEW.shipped;
+ IF YEAR(NEW.shipped) > 2000 THEN
+ INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped)
+ VALUES(NEW.clientFk, NEW.shipped, NEW.shipped)
+ ON DUPLICATE KEY UPDATE lastShipped = NEW.shipped;
+ END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -28080,9 +28106,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -29563,6 +29589,7 @@ CREATE TABLE `worker` (
`bossFk` int(11) NOT NULL DEFAULT '103',
`fiDueDate` datetime DEFAULT NULL,
`hasMachineryAutorized` tinyint(2) DEFAULT '0',
+ `seniority` date DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `CodigoTrabajador_UNIQUE` (`code`),
UNIQUE KEY `user` (`user__`),
@@ -30663,97 +30690,97 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN
-
- DECLARE vCurrentCount INT;
- DECLARE vCheckSum INT;
- DECLARE vIsAlreadyNotified BOOLEAN;
- DECLARE vTableQueue TEXT;
- DECLARE vLineQueue TEXT;
- DECLARE vDone BOOL DEFAULT FALSE;
- DECLARE vCur CURSOR FOR
- SELECT CONCAT('
- ', IFNULL(pq.id, ''), '
- ', IFNULL(p.path, ''),'
- ', IFNULL(i.Informe, ''),'
- ', IFNULL(e.Estado, ''),'
- ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),'
- ', IFNULL(pq.`error`, ''),'
- ')
- FROM vn.printingQueue pq
- LEFT JOIN vn.worker w ON w.id = pq.worker
- LEFT JOIN vn.printer p ON p.id = pq.printer
- LEFT JOIN vn2008.Informes i ON i.Id_Informe = pq.report
- JOIN vn2008.Estados e ON e.Id_Estado = pq.state
- LIMIT 30;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND
- SET vDone = TRUE;
-
- SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum
- FROM vn.printingQueue WHERE state = 1;
-
- SELECT isAlreadyNotified INTO vIsAlreadyNotified
- FROM printingQueueCheck;
-
- IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND
- (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND
- vIsAlreadyNotified = FALSE AND vCurrentCount > 0
- THEN
-
- SELECT '
-
- Id Cola
- Ruta Impresora
- Informe
- Estado
- Trabajador
- Error
- ' INTO vTableQueue;
-
- OPEN vCur;
-
- l: LOOP
-
- SET vDone = FALSE;
-
- FETCH vCur INTO vLineQueue;
-
- IF vDone THEN
- LEAVE l;
- END IF;
-
- SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue;
-
- END LOOP;
-
- CLOSE vCur;
-
- INSERT INTO vn2008.mail (`to`, subject, text)
- VALUES ('cau@verdnatura.es, sysadmin@verdnatura.es',
- 'servidor de impresion parado',
- CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
'));
-
- UPDATE printingQueueCheck SET isAlreadyNotified = TRUE;
- END IF;
-
- IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND
- vIsAlreadyNotified = TRUE
- THEN
- UPDATE printingQueueCheck SET isAlreadyNotified = FALSE;
- END IF;
-
- UPDATE printingQueueCheck
- SET lastCount = vCurrentCount,
- lastCheckSum = vCheckSum;
-
+/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN
+
+ DECLARE vCurrentCount INT;
+ DECLARE vCheckSum INT;
+ DECLARE vIsAlreadyNotified BOOLEAN;
+ DECLARE vTableQueue TEXT;
+ DECLARE vLineQueue TEXT;
+ DECLARE vDone BOOL DEFAULT FALSE;
+ DECLARE vCur CURSOR FOR
+ SELECT CONCAT('
+ ', IFNULL(pq.id, ''), '
+ ', IFNULL(p.path, ''),'
+ ', IFNULL(i.Informe, ''),'
+ ', IFNULL(e.Estado, ''),'
+ ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),'
+ ', IFNULL(pq.`error`, ''),'
+ ')
+ FROM vn.printingQueue pq
+ LEFT JOIN vn.worker w ON w.id = pq.worker
+ LEFT JOIN vn.printer p ON p.id = pq.printer
+ LEFT JOIN vn2008.Informes i ON i.Id_Informe = pq.report
+ JOIN vn2008.Estados e ON e.Id_Estado = pq.state
+ LIMIT 30;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND
+ SET vDone = TRUE;
+
+ SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum
+ FROM vn.printingQueue WHERE state = 1;
+
+ SELECT isAlreadyNotified INTO vIsAlreadyNotified
+ FROM printingQueueCheck;
+
+ IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND
+ (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND
+ vIsAlreadyNotified = FALSE AND vCurrentCount > 0
+ THEN
+
+ SELECT '
+
+ Id Cola
+ Ruta Impresora
+ Informe
+ Estado
+ Trabajador
+ Error
+ ' INTO vTableQueue;
+
+ OPEN vCur;
+
+ l: LOOP
+
+ SET vDone = FALSE;
+
+ FETCH vCur INTO vLineQueue;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue;
+
+ END LOOP;
+
+ CLOSE vCur;
+
+ INSERT INTO vn2008.mail (`to`, subject, text)
+ VALUES ('cau@verdnatura.es, sysadmin@verdnatura.es',
+ 'servidor de impresion parado',
+ CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
'));
+
+ UPDATE printingQueueCheck SET isAlreadyNotified = TRUE;
+ END IF;
+
+ IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND
+ vIsAlreadyNotified = TRUE
+ THEN
+ UPDATE printingQueueCheck SET isAlreadyNotified = FALSE;
+ END IF;
+
+ UPDATE printingQueueCheck
+ SET lastCount = vCurrentCount,
+ lastCheckSum = vCheckSum;
+
END */ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
@@ -30801,9 +30828,9 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -30819,9 +30846,9 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET character_set_client = utf8 */ ;;
+/*!50003 SET character_set_results = utf8 */ ;;
+/*!50003 SET collation_connection = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -31380,11 +31407,94 @@ BEGIN
CALL vn.ticketGetTotal;
SELECT IFNULL(SUM(t.amount), 0) INTO vDebt
- FROM (
- SELECT SUM(total) amount
+ FROM (
+ SELECT SUM(IFNULL(total,0)) amount
FROM tmp.ticketTotal
+ UNION ALL
+ SELECT SUM(amountPaid) amount
+ FROM receipt
+ WHERE clientFk = vClient
+ AND payed > vDateEnd
UNION ALL
- SELECT SUM(amountPaid)
+ SELECT SUM(amount)
+ FROM clientRisk
+ WHERE clientFk = vClient
+ UNION ALL
+ SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2))
+ FROM hedera.tpvTransaction
+ WHERE clientFk = vClient
+ AND receiptFk IS NULL
+ AND `status` = 'ok'
+ ) t;
+
+ DROP TEMPORARY TABLE IF EXISTS
+ tmp.ticket,
+ tmp.ticketTotal;
+
+ RETURN vDebt;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP FUNCTION IF EXISTS `clientGetDebt__` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` FUNCTION `clientGetDebt__`(vClient INT, vDate DATE) RETURNS decimal(10,2)
+ READS SQL DATA
+BEGIN
+/**
+ * Devuelve el saldo de un cliente.
+ *
+ * @param vClient Identificador del cliente
+ * @param vDate Fecha hasta la que tener en cuenta
+ * @return Saldo del cliente
+ */
+ DECLARE vDateEnd DATETIME;
+ DECLARE vDateIni DATETIME;
+ DECLARE vDebt DECIMAL(10,2);
+ DECLARE vHasDebt BOOLEAN;
+
+ SELECT COUNT(*) INTO vHasDebt
+ FROM `client` c
+ WHERE c.id = vClient AND c.typeFk = 'normal';
+
+ IF NOT vHasDebt THEN
+ RETURN 0;
+ END IF;
+
+ SET vDate = IFNULL(vDate, CURDATE());
+
+ SET vDateIni = TIMESTAMPADD(MONTH, -2, CURDATE());
+ SET vDateEnd = TIMESTAMP(vDate, '23:59:59');
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
+ CREATE TEMPORARY TABLE tmp.ticket
+ (INDEX (ticketFk))
+ ENGINE = MEMORY
+ SELECT id ticketFk
+ FROM ticket
+ WHERE clientFk = vClient
+ AND refFk IS NULL
+ AND shipped BETWEEN vDateIni AND vDateEnd;
+
+ CALL vn.ticketGetTotal;
+
+ SELECT IFNULL(SUM(t.amount), 0) INTO vDebt
+ FROM (
+
+ SELECT SUM(IFNULL(total,0)) amount
+ FROM tmp.ticketTotal
+ UNION ALL
+ SELECT SUM(amountPaid) amount
FROM receipt
WHERE clientFk = vClient
AND payed > vDateEnd
@@ -35087,9 +35197,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -35138,9 +35248,15 @@ BEGIN
UPDATE vn.itemCost ic
JOIN vn.item i ON i.id = ic.itemFk
SET ic.cm3delivery = i.compression * ic.cm3
- WHERE ic.itemFk = vItemFk
- AND ic.warehouseFk = vWarehouse;
+ WHERE ic.itemFk = vItemFk AND
+ ic.warehouseFk = vWarehouse;
+ UPDATE vn.itemCost ic
+ JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk
+ JOIN vn.buy b ON b.id = lb.buy_id
+ SET ic.grams = b.weight * 1000 / b.packing
+ WHERE ic.itemFk = vItemFk AND
+ ic.warehouseFk = vWarehouse;
END IF;
SELECT isFeedStock INTO vIsFeedStock
@@ -35248,6 +35364,88 @@ BEGIN
END IF;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `buy_afterUpsert___` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `buy_afterUpsert___`(vSelf INT)
+BEGIN
+/**
+ * Triggered actions when a buy is updated or inserted.
+ *
+ * @param vSelf The buy reference
+ */
+ DECLARE vEntryFk INT;
+ DECLARE vItemFk INT;
+ DECLARE vStickers INT;
+ DECLARE vPacking INT;
+ DECLARE vWarehouse INT;
+ DECLARE vWarehouseOut INT;
+ DECLARE vIsMerchandise BOOL;
+ DECLARE vIsFeedStock BOOL;
+
+
+ SELECT entryFk, itemFk, stickers, packing
+ INTO vEntryFk, vItemFk, vStickers, vPacking
+ FROM buy
+ WHERE id = vSelf;
+
+ SELECT t.warehouseInFk, t.warehouseOutFk
+ INTO vWarehouse, vWarehouseOut
+ FROM entry e
+ JOIN travel t ON t.id = e.travelFk
+ WHERE e.id = vEntryFk;
+
+ SELECT k.merchandise
+ INTO vIsMerchandise
+ FROM itemCategory k
+ JOIN itemType it ON it.categoryFk = k.id
+ JOIN item i ON i.typeFk = it.id
+ WHERE i.id = vItemFk;
+
+ IF vIsMerchandise THEN
+
+ REPLACE itemCost SET
+ itemFk = vItemFk,
+ warehouseFk = vWarehouse,
+ cm3 = buy_getUnitVolume(vSelf);
+
+ UPDATE vn.itemCost ic
+ JOIN vn.item i ON i.id = ic.itemFk
+ SET ic.cm3delivery = i.compression * ic.cm3
+ WHERE ic.itemFk = vItemFk
+ AND ic.warehouseFk = vWarehouse;
+
+ END IF;
+
+ SELECT isFeedStock INTO vIsFeedStock
+ FROM warehouse WHERE id = vWarehouseOut AND id <> 13;
+
+ IF vIsFeedStock THEN
+ INSERT IGNORE INTO producer(`name`)
+ SELECT es.company_name
+ FROM buy b
+ JOIN edi.ekt be ON be.id = b.ektFk
+ JOIN edi.supplier es ON es.supplier_id = be.pro
+ WHERE b.id = vSelf;
+
+ IF buy_hasNotifyPassport(vSelf, vItemFk) THEN
+ CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking);
+ END IF;
+ END IF;
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -36587,9 +36785,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -36640,6 +36838,7 @@ BEGIN
JOIN travel t ON t.id = e.travelFk
WHERE t.landed <= vDateShort;
DELETE FROM stowaway WHERE created < v3Month;
+ DELETE FROM vn.buy WHERE created < vDateShort AND entryFk = 9200;
-- Equipos duplicados
DELETE w.*
@@ -37517,54 +37716,54 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `clientRemoveWorker__`()
-BEGIN
- DECLARE done BOOL DEFAULT FALSE;
- DECLARE vClientFk INT;
-
- DECLARE rs CURSOR FOR
- SELECT c.clientFk
- FROM tmp.clientGetDebt c
- LEFT JOIN tmp.risk r ON r.clientFk = c.clientFk
- WHERE IFNULL(r.risk,0) = 0;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
- CREATE TEMPORARY TABLE tmp.clientGetDebt
- SELECT cd.id as clientFk
- FROM bs.clientDied cd
- LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id
- JOIN vn.client c ON c.id = cd.id
- JOIN vn.province p ON p.id = c.provinceFk
- JOIN vn.country co ON co.id = p.countryFk
- WHERE cd.Aviso = 'TERCER AVISO'
- AND cp.clientFk IS NULL
- AND co.country NOT IN ('Portugal','Francia','España exento')
- AND c.salesPersonFk IS NOT NULL;
-
- CALL vn.clientGetDebt(curdate());
-
- DROP TEMPORARY TABLE IF EXISTS tmp.contador;
- CREATE TEMPORARY TABLE tmp.contador (id INT)
- ENGINE = MEMORY;
-
- OPEN rs;
- FETCH rs INTO vClientFk;
-
- WHILE NOT done DO
- INSERT INTO tmp.contador SET id = vClientFk;
- CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE);
+BEGIN
+ DECLARE done BOOL DEFAULT FALSE;
+ DECLARE vClientFk INT;
+
+ DECLARE rs CURSOR FOR
+ SELECT c.clientFk
+ FROM tmp.clientGetDebt c
+ LEFT JOIN tmp.risk r ON r.clientFk = c.clientFk
+ WHERE IFNULL(r.risk,0) = 0;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
+ CREATE TEMPORARY TABLE tmp.clientGetDebt
+ SELECT cd.id as clientFk
+ FROM bs.clientDied cd
+ LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id
+ JOIN vn.client c ON c.id = cd.id
+ JOIN vn.province p ON p.id = c.provinceFk
+ JOIN vn.country co ON co.id = p.countryFk
+ WHERE cd.Aviso = 'TERCER AVISO'
+ AND cp.clientFk IS NULL
+ AND co.country NOT IN ('Portugal','Francia','España exento')
+ AND c.salesPersonFk IS NOT NULL;
+
+ CALL vn.clientGetDebt(curdate());
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.contador;
+ CREATE TEMPORARY TABLE tmp.contador (id INT)
+ ENGINE = MEMORY;
+
+ OPEN rs;
+ FETCH rs INTO vClientFk;
+
+ WHILE NOT done DO
+ INSERT INTO tmp.contador SET id = vClientFk;
+ CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE);
UPDATE vn.client SET salesPersonFk = NULL WHERE id = vClientFk;
INSERT INTO vn.clientLog (originFk, userFk, `action`, description)
VALUES (vClientFk, account.userGetId(), 'update', CONCAT('Se ha desasignado el cliente por que no ha comprado en 3 meses'));
-
+
REPLACE bs.clientNewBorn(clientFk, shipped)
- VALUES(vClientFk, CURDATE());
- FETCH rs INTO vClientFk;
- END WHILE;
-
- CLOSE rs;
+ VALUES(vClientFk, CURDATE());
+ FETCH rs INTO vClientFk;
+ END WHILE;
+
+ CLOSE rs;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -38255,9 +38454,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -38266,12 +38465,12 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
CREATE TEMPORARY TABLE tmp.ticket
- SELECT t.id, t.clientFk, t.warehouseFk, t.zoneFk
+ SELECT t.id, t.clientFk, t.warehouseFk, t.zoneFk,t.observations
FROM vn.ticket t
WHERE id = vCollectionFk
AND t.shipped > '2020-01-01'
UNION ALL
- SELECT t.id, t.clientFk, t.warehouseFk, t.zoneFk
+ SELECT t.id, t.clientFk, t.warehouseFk, t.zoneFk,t.observations
FROM vn.ticketCollection tc
JOIN vn.ticket t ON t.id = tc.ticketFk
WHERE tc.collectionFk = vCollectionFk;
@@ -38280,13 +38479,15 @@ BEGIN
IFNULL(tc.wagon * 100 + tc.level,0) `level`,
am.name as agencyName,
t.warehouseFk ,
- w.id as salesPersonFk
+ w.id as salesPersonFk,
+ IFNULL(tob.description,'')as observaciones
FROM tmp.ticket t
LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN vn.client c ON c.id = t.clientFk
- LEFT JOIN vn.worker w ON w.id = c.salesPersonFk;
+ LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
+ LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 1;
END ;;
DELIMITER ;
@@ -38745,6 +38946,31 @@ BEGIN
JOIN vn.state s ON c.stateFk = s.id
WHERE c.workerFk = vWorkerFk AND s.code = 'ON_PREPARATION';
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `collection_increaseQuantity` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `collection_increaseQuantity`(
+ vSaleFk INT,
+ vQuantity INT)
+BEGIN
+ DECLARE vOriginalQuantity INT;
+
+ SELECT quantity INTO vOriginalQuantity FROM vn.sale WHERE id = vSaleFk;
+ UPDATE `vn`.`sale` SET `quantity` = vQuantity,`originalQuantity` = vOriginalQuantity WHERE (`id` = vSaleFk);
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -38761,12 +38987,13 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`%` PROCEDURE `collection_missingTrash`(vSaleFk BIGINT, vQuantity INT, vIsTrash BOOLEAN, vWarehouseFk INT)
+CREATE DEFINER=`root`@`%` PROCEDURE `collection_missingTrash`(vSaleFk BIGINT, vQuantity INT, vIsTrash BOOLEAN, vWarehouseFk INT, vNewQuantity INT)
BEGIN
DECLARE vTicketFk INT;
DECLARE vClientFk INT DEFAULT 400;
DECLARE vClientName VARCHAR(50);
DECLARE vConsignatario INT;
+ DECLARE vOriginalQuantity INT;
IF vIsTrash THEN
SELECT 200 INTO vClientFk;
@@ -38791,6 +39018,9 @@ BEGIN
INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded)
SELECT itemFk, vTicketFk, concept, vQuantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded
FROM vn.sale s WHERE s.id = vSaleFk;
+
+ SELECT quantity INTO vOriginalQuantity FROM vn.sale WHERE id = vSaleFk;
+ UPDATE vn.sale SET originalQuantity = vOriginalQuantity ,quantity = vNewQuantity WHERE id = vSaleFk;
END ;;
DELIMITER ;
@@ -39125,6 +39355,29 @@ proc:BEGIN
END IF;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `collection_reject` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `collection_reject`(vSale INT, vQuantity INT)
+proc: BEGIN
+
+UPDATE vn.sale SET quantity = vQuantity
+WHERE id = vSale;
+
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -39236,26 +39489,33 @@ BEGIN
DECLARE vCollectionFk INT;
DECLARE vStateFk INT;
+DECLARE vLastState VARCHAR(50);
-SELECT collectionFk INTO vCollectionFk FROM vn.ticketCollection WHERE ticketFk = vTicketFk;
+SELECT name INTO vLastState FROM vn.ticketLastState WHERE ticketFk = vTicketFk;
-SELECT id INTO vStateFk
- FROM vn.state
- WHERE `code` = vState COLLATE utf8_unicode_ci;
+IF vLastState <> 'Encajado' THEN
--- Actualiza el estado del ticket
- INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador)
- SELECT vStateFk, ticketFk, account.myUserGetId()
- FROM vn.ticketCollection tc
- WHERE tc.ticketFk = vTicketFk
- UNION ALL
- SELECT vStateFk, sw.id, account.myUserGetId()
- FROM vn.stowaway sw
- JOIN vn.ticketCollection tc ON tc.ticketFk = sw.shipFk
- WHERE tc.ticketFk = vTicketFk;
-
--- Actualiza la colección
- CALL vn.collection_update(vTicketFk);
+ SELECT collectionFk INTO vCollectionFk FROM vn.ticketCollection WHERE ticketFk = vTicketFk;
+
+ SELECT id INTO vStateFk
+ FROM vn.state
+ WHERE `code` = vState COLLATE utf8_unicode_ci;
+
+ -- Actualiza el estado del ticket
+ INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador)
+ SELECT vStateFk, ticketFk, account.myUserGetId()
+ FROM vn.ticketCollection tc
+ WHERE tc.ticketFk = vTicketFk
+ UNION ALL
+ SELECT vStateFk, sw.id, account.myUserGetId()
+ FROM vn.stowaway sw
+ JOIN vn.ticketCollection tc ON tc.ticketFk = sw.shipFk
+ WHERE tc.ticketFk = vTicketFk;
+
+ -- Actualiza la colección
+ CALL vn.collection_update(vTicketFk);
+
+END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -40680,216 +40940,216 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `entryConverter`(IN `vEntry` INT)
-BEGIN
-
- DECLARE vWarehouseIn INT;
- DECLARE vWarehouseOut INT;
- DECLARE vTravel INT;
-
- DECLARE done BOOL DEFAULT FALSE;
-
- DECLARE vId_Entrada INT;
- DECLARE vId_Article INT;
- DECLARE vEtiquetas INT;
- DECLARE vId_Cubo VARCHAR(10);
- DECLARE vPacking INT;
- DECLARE vGrouping INT;
- DECLARE vCantidad INT;
- DECLARE vCostefijo DECIMAL(10,3);
- DECLARE vPortefijo DECIMAL(10,3);
- DECLARE vEmbalajefijo DECIMAL(10);
- DECLARE vComisionfija DECIMAL(10,3);
- DECLARE vCaja INT;
- DECLARE vNicho VARCHAR(5);
- DECLARE vTarifa1 DECIMAL(10,2);
- DECLARE vTarifa2 DECIMAL(10,2);
- DECLARE vTarifa3 DECIMAL(10,2);
- DECLARE vPVP DECIMAL(10,2);
- DECLARE vCompra INT;
-
- DECLARE rs CURSOR FOR
- SELECT
- b.Id_Entrada,
- b.Id_Article,
- b.Etiquetas,
- b.Id_Cubo,
- b.Packing,
- b.`grouping`,
- b.Cantidad,
- b.Costefijo,
- b.Portefijo,
- b.Embalajefijo,
- b.Comisionfija,
- b.caja,
- b.Nicho,
- b.Tarifa1,
- b.Tarifa2,
- b.Tarifa3,
- b.PVP
- FROM vn2008.Compres b
- JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article
- WHERE Id_Entrada = vEntry;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-
- SELECT warehouseInFk, warehouseOutFk, tr.id
- INTO vWarehouseIn, vWarehouseOut, vTravel
- FROM travel tr
- JOIN entry e ON e.travelFk = tr.id
- WHERE e.id = vEntry;
-
- UPDATE travel
- SET warehouseInFk = vWarehouseOut,
- warehouseOutFk = vWarehouseIn
- WHERE id = vTravel;
-
- UPDATE vn2008.Compres c
- LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article
- SET Etiquetas = 0, Cantidad = 0
- WHERE c.Id_Entrada = vEntry
- AND ic.espItemFk IS NULL;
-
- OPEN rs;
-
- DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry;
-
- FETCH rs INTO
- vId_Entrada,
- vId_Article,
- vEtiquetas,
- vId_Cubo,
- vPacking,
- vGrouping,
- vCantidad,
- vCostefijo,
- vPortefijo,
- vEmbalajefijo,
- vComisionfija,
- vCaja,
- vNicho,
- vTarifa1,
- vTarifa2,
- vTarifa3,
- vPVP;
-
- WHILE NOT done DO
-
- -- Primero la linea original con las cantidades invertidas
- INSERT INTO vn2008.Compres
- (
- Id_Entrada,
- Id_Article,
- Etiquetas,
- Id_Cubo,
- Packing,
- `grouping`,
- Cantidad,
- Costefijo,
- Portefijo,
- Embalajefijo,
- Comisionfija,
- caja,
- Nicho,
- Tarifa1,
- Tarifa2,
- Tarifa3,
- PVP
- )
- VALUES
- (
- vId_Entrada,
- vId_Article,
- - vEtiquetas,
- vId_Cubo,
- vPacking,
- vGrouping,
- - vCantidad,
- vCostefijo,
- vPortefijo,
- vEmbalajefijo,
- vComisionfija,
- vCaja,
- vNicho,
- vTarifa1,
- vTarifa2,
- vTarifa3,
- vPVP);
-
- -- Ahora la linea nueva, con el item genérico
- INSERT INTO vn2008.Compres
- (
- Id_Entrada,
- Id_Article,
- Etiquetas,
- Id_Cubo,
- Packing,
- `grouping`,
- Cantidad,
- Costefijo,
- Portefijo,
- Embalajefijo,
- Comisionfija,
- caja,
- Nicho,
- Tarifa1,
- Tarifa2,
- Tarifa3,
- PVP
- )
- SELECT
- vId_Entrada,
- genItemFk as Id_Article,
- vEtiquetas,
- vId_Cubo,
- vPacking,
- vGrouping,
- vCantidad,
- vCostefijo,
- vPortefijo,
- vEmbalajefijo,
- vComisionfija,
- vCaja,
- vNicho,
- vTarifa1,
- vTarifa2,
- vTarifa3,
- vPVP
- FROM itemConversor
- WHERE espItemFk = vId_Article;
-
- SELECT LAST_INSERT_ID()
- INTO vCompra;
-
- REPLACE vn2008.Compres_mark(Id_Compra,`comment`)
- SELECT vCompra, vId_Article;
-
-
- FETCH rs INTO
- vId_Entrada,
- vId_Article,
- vEtiquetas,
- vId_Cubo,
- vPacking,
- vGrouping,
- vCantidad,
- vCostefijo,
- vPortefijo,
- vEmbalajefijo,
- vComisionfija,
- vCaja,
- vNicho,
- vTarifa1,
- vTarifa2,
- vTarifa3,
- vPVP;
-
- END WHILE;
-
-
- CLOSE rs;
-
-
-
+BEGIN
+
+ DECLARE vWarehouseIn INT;
+ DECLARE vWarehouseOut INT;
+ DECLARE vTravel INT;
+
+ DECLARE done BOOL DEFAULT FALSE;
+
+ DECLARE vId_Entrada INT;
+ DECLARE vId_Article INT;
+ DECLARE vEtiquetas INT;
+ DECLARE vId_Cubo VARCHAR(10);
+ DECLARE vPacking INT;
+ DECLARE vGrouping INT;
+ DECLARE vCantidad INT;
+ DECLARE vCostefijo DECIMAL(10,3);
+ DECLARE vPortefijo DECIMAL(10,3);
+ DECLARE vEmbalajefijo DECIMAL(10);
+ DECLARE vComisionfija DECIMAL(10,3);
+ DECLARE vCaja INT;
+ DECLARE vNicho VARCHAR(5);
+ DECLARE vTarifa1 DECIMAL(10,2);
+ DECLARE vTarifa2 DECIMAL(10,2);
+ DECLARE vTarifa3 DECIMAL(10,2);
+ DECLARE vPVP DECIMAL(10,2);
+ DECLARE vCompra INT;
+
+ DECLARE rs CURSOR FOR
+ SELECT
+ b.Id_Entrada,
+ b.Id_Article,
+ b.Etiquetas,
+ b.Id_Cubo,
+ b.Packing,
+ b.`grouping`,
+ b.Cantidad,
+ b.Costefijo,
+ b.Portefijo,
+ b.Embalajefijo,
+ b.Comisionfija,
+ b.caja,
+ b.Nicho,
+ b.Tarifa1,
+ b.Tarifa2,
+ b.Tarifa3,
+ b.PVP
+ FROM vn2008.Compres b
+ JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article
+ WHERE Id_Entrada = vEntry;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+ SELECT warehouseInFk, warehouseOutFk, tr.id
+ INTO vWarehouseIn, vWarehouseOut, vTravel
+ FROM travel tr
+ JOIN entry e ON e.travelFk = tr.id
+ WHERE e.id = vEntry;
+
+ UPDATE travel
+ SET warehouseInFk = vWarehouseOut,
+ warehouseOutFk = vWarehouseIn
+ WHERE id = vTravel;
+
+ UPDATE vn2008.Compres c
+ LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article
+ SET Etiquetas = 0, Cantidad = 0
+ WHERE c.Id_Entrada = vEntry
+ AND ic.espItemFk IS NULL;
+
+ OPEN rs;
+
+ DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry;
+
+ FETCH rs INTO
+ vId_Entrada,
+ vId_Article,
+ vEtiquetas,
+ vId_Cubo,
+ vPacking,
+ vGrouping,
+ vCantidad,
+ vCostefijo,
+ vPortefijo,
+ vEmbalajefijo,
+ vComisionfija,
+ vCaja,
+ vNicho,
+ vTarifa1,
+ vTarifa2,
+ vTarifa3,
+ vPVP;
+
+ WHILE NOT done DO
+
+ -- Primero la linea original con las cantidades invertidas
+ INSERT INTO vn2008.Compres
+ (
+ Id_Entrada,
+ Id_Article,
+ Etiquetas,
+ Id_Cubo,
+ Packing,
+ `grouping`,
+ Cantidad,
+ Costefijo,
+ Portefijo,
+ Embalajefijo,
+ Comisionfija,
+ caja,
+ Nicho,
+ Tarifa1,
+ Tarifa2,
+ Tarifa3,
+ PVP
+ )
+ VALUES
+ (
+ vId_Entrada,
+ vId_Article,
+ - vEtiquetas,
+ vId_Cubo,
+ vPacking,
+ vGrouping,
+ - vCantidad,
+ vCostefijo,
+ vPortefijo,
+ vEmbalajefijo,
+ vComisionfija,
+ vCaja,
+ vNicho,
+ vTarifa1,
+ vTarifa2,
+ vTarifa3,
+ vPVP);
+
+ -- Ahora la linea nueva, con el item genérico
+ INSERT INTO vn2008.Compres
+ (
+ Id_Entrada,
+ Id_Article,
+ Etiquetas,
+ Id_Cubo,
+ Packing,
+ `grouping`,
+ Cantidad,
+ Costefijo,
+ Portefijo,
+ Embalajefijo,
+ Comisionfija,
+ caja,
+ Nicho,
+ Tarifa1,
+ Tarifa2,
+ Tarifa3,
+ PVP
+ )
+ SELECT
+ vId_Entrada,
+ genItemFk as Id_Article,
+ vEtiquetas,
+ vId_Cubo,
+ vPacking,
+ vGrouping,
+ vCantidad,
+ vCostefijo,
+ vPortefijo,
+ vEmbalajefijo,
+ vComisionfija,
+ vCaja,
+ vNicho,
+ vTarifa1,
+ vTarifa2,
+ vTarifa3,
+ vPVP
+ FROM itemConversor
+ WHERE espItemFk = vId_Article;
+
+ SELECT LAST_INSERT_ID()
+ INTO vCompra;
+
+ REPLACE vn2008.Compres_mark(Id_Compra,`comment`)
+ SELECT vCompra, vId_Article;
+
+
+ FETCH rs INTO
+ vId_Entrada,
+ vId_Article,
+ vEtiquetas,
+ vId_Cubo,
+ vPacking,
+ vGrouping,
+ vCantidad,
+ vCostefijo,
+ vPortefijo,
+ vEmbalajefijo,
+ vComisionfija,
+ vCaja,
+ vNicho,
+ vTarifa1,
+ vTarifa2,
+ vTarifa3,
+ vPVP;
+
+ END WHILE;
+
+
+ CLOSE rs;
+
+
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -40951,62 +41211,62 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `entryPrepare`(IN `idE` BIGINT)
-BEGIN
- SELECT
- b.quantity / b.packing AS Paquetes,
- b.packing AS `Grouping`,
- barcode,
- 'ASEGURADO' AS asegurado,
- ic.name,
- ic.order,
- s.name AS Consignatario,
- e.supplierFk AS Id_Cliente,
- e.isOrdered,
- e.isConfirmed,
- 10 AS Calidad,
- LPAD(IFNULL(cpd.id, ip.code),
- 5,
- '0') AS path,
- b.entryFk AS Id_Ticket,
- t.landed AS Fecha,
- b.itemFk,
- b.quantity,
- i.name AS Concepte,
- i.size,
- i.inkFk,
- i.category,
- o.code AS Origen,
- 0 AS Bultos,
- wIn.`name` AS Tipo,
- 0 AS OK,
- 0 AS Reservado,
- i.stems,
- b.id AS Id_Movimiento,
- ip.code,
- 'PEDIDO ASEGURADO' AS MSG,
- 0 AS Seguro,
- i.image,
- pr.name AS producer
- FROM vn.buy b
- JOIN vn.entry e ON b.entryFk = e.id
- JOIN vn.travel t ON t.id = e.travelFk
- JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk
- JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk
- JOIN vn.item i ON i.id = b.itemFk
- JOIN vn.itemType it ON it.id =i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
- JOIN vn.packaging pkg ON pkg.id = b.packageFk
- LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk
- LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk
- LEFT JOIN vn.origin o ON o.id = i.originFk
- LEFT JOIN vn.supplier s ON s.id = e.supplierFk
- LEFT JOIN vn.producer pr on pr.id = i.producerFk
- LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway
- WHERE
- NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid
- AND e.id = 158772
- AND i.typeFk IS NOT NULL
- AND ic.merchandise IS NOT FALSE;
+BEGIN
+ SELECT
+ b.quantity / b.packing AS Paquetes,
+ b.packing AS `Grouping`,
+ barcode,
+ 'ASEGURADO' AS asegurado,
+ ic.name,
+ ic.order,
+ s.name AS Consignatario,
+ e.supplierFk AS Id_Cliente,
+ e.isOrdered,
+ e.isConfirmed,
+ 10 AS Calidad,
+ LPAD(IFNULL(cpd.id, ip.code),
+ 5,
+ '0') AS path,
+ b.entryFk AS Id_Ticket,
+ t.landed AS Fecha,
+ b.itemFk,
+ b.quantity,
+ i.name AS Concepte,
+ i.size,
+ i.inkFk,
+ i.category,
+ o.code AS Origen,
+ 0 AS Bultos,
+ wIn.`name` AS Tipo,
+ 0 AS OK,
+ 0 AS Reservado,
+ i.stems,
+ b.id AS Id_Movimiento,
+ ip.code,
+ 'PEDIDO ASEGURADO' AS MSG,
+ 0 AS Seguro,
+ i.image,
+ pr.name AS producer
+ FROM vn.buy b
+ JOIN vn.entry e ON b.entryFk = e.id
+ JOIN vn.travel t ON t.id = e.travelFk
+ JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk
+ JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk
+ JOIN vn.item i ON i.id = b.itemFk
+ JOIN vn.itemType it ON it.id =i.typeFk
+ JOIN vn.itemCategory ic ON ic.id = it.categoryFk
+ JOIN vn.packaging pkg ON pkg.id = b.packageFk
+ LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk
+ LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk
+ LEFT JOIN vn.origin o ON o.id = i.originFk
+ LEFT JOIN vn.supplier s ON s.id = e.supplierFk
+ LEFT JOIN vn.producer pr on pr.id = i.producerFk
+ LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway
+ WHERE
+ NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid
+ AND e.id = 158772
+ AND i.typeFk IS NOT NULL
+ AND ic.merchandise IS NOT FALSE;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -41790,7 +42050,7 @@ BEGIN
FROM vn.itemShelving ish
JOIN vn.shelving sh ON sh.`code` = ish.shelvingFk
JOIN vn.parking pk ON pk.id = sh.parkingFk
- WHERE ish.itemFk = vItemFk;
+ WHERE ish.itemFk = vItemFk ORDER BY created ASC;
END ;;
DELIMITER ;
@@ -45876,137 +46136,20 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `itemRefreshTags`(IN vItem INT)
BEGIN
-/**
- * Actualiza la tabla item, los campos "cache" de tags
- *
- * @param vItem El id del articulo. Si es NULL, equivale a todos.
- **/
- DECLARE vInkId VARCHAR(3) DEFAULT NULL;
- DECLARE vSize INT DEFAULT NULL;
- DECLARE vOriginId INT DEFAULT NULL;
- DECLARE vProducerId INT DEFAULT NULL;
- DECLARE vStems INT DEFAULT NULL;
-
- UPDATE item i
- LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id
- LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id
- LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id
- SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, it3.`value`)
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id
- LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value`
- LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id
- LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value`
- LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id
- LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value`
- SET i.`name` = CONCAT_WS(' ',
- IFNULL(ta1.abbreviation,it1.`value`),
- IFNULL(ta2.abbreviation,it2.`value`),
- IFNULL(ta3.abbreviation,it3.`value`))
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4
- SET i.subName = it.`value`
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5
- LEFT JOIN tag t ON t.id = it.tagFk
- SET tag5 = t.name, value5 = it.`value`
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6
- LEFT JOIN tag t ON t.id = it.tagFk
- SET tag6 = t.name, value6 = it.`value`
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7
- LEFT JOIN tag t ON t.id = it.tagFk
- SET i.tag7 = t.name, i.value7 = it.`value`
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8
- LEFT JOIN tag t ON t.id = it.tagFk
- SET tag8 = t.name, value8 = it.`value`
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9
- LEFT JOIN tag t ON t.id = it.tagFk
- SET tag9 = t.name, value9 = it.`value`
- WHERE (vItem IS NULL OR vItem = i.id);
-
- UPDATE item i
- LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10
- LEFT JOIN tag t ON t.id = it.tagFk
- SET tag10 = t.name, value10 = it.`value`
- WHERE (vItem IS NULL OR vItem = i.id);
-
- IF vItem IS NOT NULL THEN
- -- Al insertar el tag color se modifica también el antiguo campo color
- SELECT i.id INTO vInkId FROM ink i
- JOIN itemTag it ON it.tagFk = 1 AND i.`name` = it.`value`
- WHERE vItem = it.itemFk
- LIMIT 1;
-
- IF vInkId > '' THEN
- UPDATE item SET inkFk = vInkId WHERE id = vItem;
- END IF;
-
- -- Al insertar el tag origen se modifica también en la tabla item
- SELECT o.id INTO vOriginId FROM origin o
- JOIN itemTag it ON it.tagFk = 35 AND o.`name` = it.`value`
- WHERE vItem = it.itemFk
- LIMIT 1;
-
- IF vOriginId > '' THEN
- UPDATE item SET originFk = vOriginId WHERE id = vItem;
- END IF;
-
- -- Al insertar el tag medida se modifica también en la tabla item
- SELECT it.`value` INTO vSize
- FROM itemTag it
- WHERE vItem = it.itemFk AND it.tagFk IN (4, 8)
- LIMIT 1;
-
- IF vSize > '' THEN
- UPDATE item SET size = vSize WHERE id = vItem;
- END IF;
-
- -- Al insertar el tag productor se modifica también en la tabla item
- SELECT p.id INTO vProducerId FROM producer p
- JOIN itemTag it ON it.tagFk = 37 AND p.`name` = it.`value`
- WHERE vItem = it.itemFk
- LIMIT 1;
-
- IF vProducerId > '' THEN
- UPDATE item SET producerFk = vProducerId WHERE id = vItem;
- END IF;
-
- -- Al insertar el tag tallos se modifica también en la tabla item
- SELECT CAST(it.`value` as signed) INTO vStems
- FROM itemTag it
- WHERE vItem = it.itemFk AND it.tagFk = 23
- LIMIT 1;
-
- IF vStems > 0 THEN
- UPDATE item SET stems = vStems WHERE id = vItem;
- END IF;
- END IF;
+ /* DEPRECATED USAR item_refreshTags JGF 16/17/2020*/
+ DROP TEMPORARY TABLE IF EXISTS tmp.item;
+ CREATE TEMPORARY TABLE tmp.item
+ SELECT vItem id;
+ CALL item_refreshTags();
+ DROP TEMPORARY TABLE tmp.item;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -47632,9 +47775,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -47642,6 +47785,139 @@ CREATE DEFINER=`root`@`%` PROCEDURE `item_refreshTags`()
BEGIN
/**
* Actualiza la tabla item, los campos "cache" de tags
+ * Para actualizar mas de un registro, la tabla NO tiene que ser en memoria
+ * Error Code: 1137. No puedo reabrir tabla: 'tmpI
+ *
+ * @param temporary table vItem(id) del articulo
+ **/
+ DROP TEMPORARY TABLE IF EXISTS tmp.itemToRefresh;
+ CREATE TEMPORARY TABLE tmp.itemToRefresh
+ SELECT id from tmp.item;
+
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id
+ LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id
+ LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id
+ SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, it3.`value`);
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id
+ LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value`
+ LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id
+ LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value`
+ LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id
+ LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value`
+ SET i.`name` = CONCAT_WS(' ',
+ IFNULL(ta1.abbreviation,it1.`value`),
+ IFNULL(ta2.abbreviation,it2.`value`),
+ IFNULL(ta3.abbreviation,it3.`value`));
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4
+ SET i.subName = it.`value`
+ WHERE i.subName IS NULL;
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5
+ LEFT JOIN tag t ON t.id = it.tagFk
+ SET tag5 = t.name, value5 = it.`value`;
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6
+ LEFT JOIN tag t ON t.id = it.tagFk
+ SET tag6 = t.name, value6 = it.`value`;
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7
+ LEFT JOIN tag t ON t.id = it.tagFk
+ SET i.tag7 = t.name, i.value7 = it.`value`;
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8
+ LEFT JOIN tag t ON t.id = it.tagFk
+ SET tag8 = t.name, value8 = it.`value`;
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9
+ LEFT JOIN tag t ON t.id = it.tagFk
+ SET tag9 = t.name, value9 = it.`value`;
+
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10
+ LEFT JOIN tag t ON t.id = it.tagFk
+ SET tag10 = t.name, value10 = it.`value`;
+
+ -- Al insertar el tag color se modifica también el antiguo campo color
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ JOIN tag t ON t.overwrite = 'inkFk'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
+ JOIN ink ON ink.`name` = it.`value`
+ SET i.inkFk = ink.id;
+
+ -- Al insertar el tag origen se modifica también en la tabla item
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ JOIN tag t ON t.overwrite = 'originFk'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
+ JOIN origin o ON o.`name` = it.`value`
+ SET i.originFk = o.id;
+
+ -- Al insertar el tag medida se modifica también en la tabla item
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ JOIN tag t ON t.overwrite = 'size'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
+ SET i.size = it.`value`;
+
+ -- Al insertar el tag productor se modifica también en la tabla item
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ JOIN tag t ON t.overwrite = 'producerFk'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
+ JOIN producer p ON p.`name` = it.`value`
+ SET i.producerFk = p.id;
+
+ -- Al insertar el tag tallos se modifica también en la tabla item
+ UPDATE item i
+ JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id
+ JOIN tag t ON t.overwrite = 'stems'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
+ SET i.stems = it.`value`;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.itemToRefresh;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `item_refreshTags__` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `item_refreshTags__`()
+BEGIN
+/**
+ * Actualiza la tabla item, los campos "cache" de tags
+ * Para actualizar mas de un registro, la tabla NO tiene que ser en memoria
+ * Error Code: 1137. No puedo reabrir tabla: 'tmpI
*
* @param temporary table vItem(id) del articulo
**/
@@ -47710,34 +47986,39 @@ BEGIN
-- Al insertar el tag color se modifica también el antiguo campo color
UPDATE item i
JOIN tmp.item tmpI ON tmpI.id = i.id
- JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = 1
+ JOIN tag t ON t.overwrite = 'inkFk'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
JOIN ink ON ink.`name` = it.`value`
SET i.inkFk = ink.id;
-- Al insertar el tag origen se modifica también en la tabla item
UPDATE item i
JOIN tmp.item tmpI ON tmpI.id = i.id
- JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = 35
+ JOIN tag t ON t.overwrite = 'originFk'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
JOIN origin o ON o.`name` = it.`value`
SET i.originFk = o.id;
-- Al insertar el tag medida se modifica también en la tabla item
UPDATE item i
JOIN tmp.item tmpI ON tmpI.id = i.id
- JOIN itemTag it ON it.itemFk = i.id AND it.tagFk IN (4, 8, 219)
+ JOIN tag t ON t.overwrite = 'size'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
SET i.size = it.`value`;
-- Al insertar el tag productor se modifica también en la tabla item
UPDATE item i
JOIN tmp.item tmpI ON tmpI.id = i.id
- JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = 37
+ JOIN tag t ON t.overwrite = 'producerFk'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
JOIN producer p ON p.`name` = it.`value`
SET i.producerFk = p.id;
-- Al insertar el tag tallos se modifica también en la tabla item
UPDATE item i
JOIN tmp.item tmpI ON tmpI.id = i.id
- JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = 23
+ JOIN tag t ON t.overwrite = 'stems'
+ JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id
SET i.stems = it.`value`;
END ;;
@@ -48146,7 +48427,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-CREATE DEFINER=`z-sysadmin`@`%` PROCEDURE `kk`(IN vItemId INT, IN vWarehouse INT)
+CREATE DEFINER=`root`@`%` PROCEDURE `kk`(IN vItemId INT, IN vWarehouse INT)
BEGIN
DECLARE vDateInventory DATETIME;
DECLARE vCurdate DATE DEFAULT CURDATE();
@@ -49750,6 +50031,68 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `productionSectorList`(vSectorFk INT)
+BEGIN
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
+ CREATE TEMPORARY TABLE tmp.clientGetDebt
+ SELECT DISTINCT t.clientFk
+ FROM vn.ticket t
+ JOIN vn.itemShelvingAvailable isa ON isa.ticketFk = t.id;
+
+ CALL vn.clientGetDebt(CURDATE());
+
+ SELECT 0,999999,0 INTO @sameTicket, @ticket, @litrosTicket;
+
+ SELECT @litrosTicket := IF(sub.ticketFk = @ticket, @litrosTicket + Litros, Litros) as LitrosTicket,
+ @sameTicket := IF(sub.ticketFk = @ticket, @sameTicket, IF(@sameTicket, 0 , 1)) as sameTicket,
+ sub.*,
+ @ticket := ticketFk
+ FROM
+ (
+ SELECT * FROM
+ (
+ SELECT isa.*,
+ cast(max(isa.quantity mod isa.packing) as DECIMAL(10,0)) as picos,
+ sum(isa.available) as totalAvailable,
+ IF (HOUR(isa.shipped),HOUR(isa.shipped), HOUR(isa.`hour`)) Hora,
+ IF (MINUTE(isa.shipped),MINUTE(isa.shipped), MINUTE(isa.`hour`)) Minuto,
+ i.subName,
+ CAST(isa.physicalVolume * 1000 AS DECIMAL(10,0)) as Litros
+ FROM vn.itemShelvingAvailable isa
+ JOIN vn.item i ON i.id = isa.itemFk
+ JOIN vn.sector s ON s.id = isa.sectorFk AND s.warehouseFk = isa.warehouseFk
+ JOIN vn.ticket t ON t.id = isa.ticketFk
+ JOIN vn.client c ON c.id = t.clientFk
+ JOIN tmp.risk r ON r.clientFk = c.id
+ WHERE IF(s.isPreviousPreparedByPacking, (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ), TRUE)
+ -- AND isa.isPreviousPreparable = TRUE
+ AND isa.sectorFk = vSectorFk
+ AND isa.quantity > 0
+ AND r.risk < c.credit + 10
+ GROUP BY saleFk
+ HAVING isa.quantity <= totalAvailable
+ ) sub2
+ ORDER BY Hora, Minuto, ticketFk
+ ) sub
+ ;
+
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `productionSectorList__` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `productionSectorList__`(vSectorFk INT)
BEGIN
SELECT 0,999999,0 INTO @sameTicket, @ticket, @litrosTicket;
@@ -50664,77 +51007,77 @@ DELIMITER ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `saleItemShelvingMake`(IN `vTicketFk` INT, IN `vSectorFk` INT)
-BEGIN
-
- SET @rest:= CAST(0 AS DECIMAL(10,0));
- SET @saleFk := CAST(0 AS DECIMAL(10,0));
- SET @reserved := CAST(0 AS DECIMAL(10,0));
-
- UPDATE vn.itemShelving ish
- JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id
- JOIN sale s ON s.id = sis.saleFk
- SET ish.visible = sis.quantity + ish.visible,
- ish.available = sis.quantity + ish.visible
- WHERE s.ticketFk = vTicketFk;
-
- DELETE sis.*
- FROM saleItemShelving sis
- JOIN sale s ON s.id = sis.saleFk
- WHERE s.ticketFk = vTicketFk;
-
- INSERT INTO saleItemShelving( saleFk,
- itemShelvingFk,
- quantity,
- ubication)
- SELECT saleFk,
- itemShelvingFk,
- CAST(Reserved as DECIMAL(10,0)) as Reserved,
- ubication
- FROM
- (SELECT saleFk,
- itemShelvingFk,
- ubication,
- @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta,
- @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved,
- @rest := @rest - @reserved,
- @saleFk := saleFk
- FROM
- ( SELECT s.id as saleFk,
- ish.created,
- ish.id as itemShelvingFk,
- ish.available,
- s.quantity,
- ish.packing,
- CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication
- FROM vn.sale s
- JOIN vn.ticket t ON t.id = s.ticketFk
- JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk
- JOIN vn.parking p ON p.sectorFk = sc.id
- JOIN vn.shelving sh ON sh.parkingFk = p.id
- JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk
- WHERE t.id = vTicketFk
- AND sc.id = vSectorFk
- AND s.quantity MOD ish.packing = 0
- AND s.quantity >= ish.packing
- ORDER BY s.id,
- sh.priority DESC,
- ish.packing DESC,
- ish.created
- ) sub
- ) sub2
- WHERE Reserved > 0;
-
- UPDATE vn.itemShelving ish
- JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id
- JOIN vn.sale s ON s.id = sis.saleFk
- SET ish.available = ish.visible - sis.quantity,
- ish.visible = ish.visible - sis.quantity
- WHERE s.ticketFk = vTicketFk
- AND s.isPicked = FALSE;
-
- CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE);
-
-
+BEGIN
+
+ SET @rest:= CAST(0 AS DECIMAL(10,0));
+ SET @saleFk := CAST(0 AS DECIMAL(10,0));
+ SET @reserved := CAST(0 AS DECIMAL(10,0));
+
+ UPDATE vn.itemShelving ish
+ JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id
+ JOIN sale s ON s.id = sis.saleFk
+ SET ish.visible = sis.quantity + ish.visible,
+ ish.available = sis.quantity + ish.visible
+ WHERE s.ticketFk = vTicketFk;
+
+ DELETE sis.*
+ FROM saleItemShelving sis
+ JOIN sale s ON s.id = sis.saleFk
+ WHERE s.ticketFk = vTicketFk;
+
+ INSERT INTO saleItemShelving( saleFk,
+ itemShelvingFk,
+ quantity,
+ ubication)
+ SELECT saleFk,
+ itemShelvingFk,
+ CAST(Reserved as DECIMAL(10,0)) as Reserved,
+ ubication
+ FROM
+ (SELECT saleFk,
+ itemShelvingFk,
+ ubication,
+ @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta,
+ @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved,
+ @rest := @rest - @reserved,
+ @saleFk := saleFk
+ FROM
+ ( SELECT s.id as saleFk,
+ ish.created,
+ ish.id as itemShelvingFk,
+ ish.available,
+ s.quantity,
+ ish.packing,
+ CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication
+ FROM vn.sale s
+ JOIN vn.ticket t ON t.id = s.ticketFk
+ JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk
+ JOIN vn.parking p ON p.sectorFk = sc.id
+ JOIN vn.shelving sh ON sh.parkingFk = p.id
+ JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk
+ WHERE t.id = vTicketFk
+ AND sc.id = vSectorFk
+ AND s.quantity MOD ish.packing = 0
+ AND s.quantity >= ish.packing
+ ORDER BY s.id,
+ sh.priority DESC,
+ ish.packing DESC,
+ ish.created
+ ) sub
+ ) sub2
+ WHERE Reserved > 0;
+
+ UPDATE vn.itemShelving ish
+ JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id
+ JOIN vn.sale s ON s.id = sis.saleFk
+ SET ish.available = ish.visible - sis.quantity,
+ ish.visible = ish.visible - sis.quantity
+ WHERE s.ticketFk = vTicketFk
+ AND s.isPicked = FALSE;
+
+ CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE);
+
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -51455,50 +51798,6 @@ BEGIN
REPLACE INTO vn.routeLoadWorker(routeFk, workerFk)
VALUES(routeFk,workerFk);
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `scanTreeCreate` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`%` PROCEDURE `scanTreeCreate`()
-BEGIN
- CALL nestTree(
- 'vn2008',
- 'scan',
- 'vn2008',
- 'scanTree'
- );
-
- UPDATE vn2008.scanTree st
- JOIN (
- SELECT sl.scan_id,
- MAX(sl.odbc_date) lastScanned,
- COUNT(DISTINCT t.routeFk) routeCount,
- MIN(t.routeFk) mod 1000 as minRoute,
- MAX(t.routeFk) mod 1000 as maxRoute,
- COUNT(sl.scan_line_id) as scanned
- FROM vn2008.scan_line sl
- JOIN expedition e ON e.id = sl.`code`
- JOIN ticket t ON t.id = e.ticketFk
- WHERE t.routeFk
- GROUP BY sl.scan_id
- ) rs ON rs.scan_id = st.id
- SET st.lastScanned = rs.lastScanned,
- st.routeCount = rs.routeCount,
- st.minRoute = rs.minRoute,
- st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL),
- st.scanned = rs.scanned;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -51509,40 +51808,40 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `scanTreeCreate__`()
-BEGIN
- CALL nestTree(
- 'vn2008',
- 'scan',
- 'vn2008',
- 'scanTree'
- );
-
- UPDATE vn2008.scanTree st
- JOIN (
- SELECT sl.scan_id,
- MAX(sl.odbc_date) lastScanned,
- COUNT(DISTINCT t.routeFk) routeCount,
- MIN(t.routeFk) mod 1000 as minRoute,
- MAX(t.routeFk) mod 1000 as maxRoute,
- COUNT(sl.scan_line_id) as scanned
- FROM vn2008.scan_line sl
- JOIN expedition e ON e.id = sl.`code`
- JOIN ticket t ON t.id = e.ticketFk
- WHERE t.routeFk
- GROUP BY sl.scan_id
- ) rs ON rs.scan_id = st.id
- SET st.lastScanned = rs.lastScanned,
- st.routeCount = rs.routeCount,
- st.minRoute = rs.minRoute,
- st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL),
- st.scanned = rs.scanned;
+BEGIN
+ CALL nestTree(
+ 'vn2008',
+ 'scan',
+ 'vn2008',
+ 'scanTree'
+ );
+
+ UPDATE vn2008.scanTree st
+ JOIN (
+ SELECT sl.scan_id,
+ MAX(sl.odbc_date) lastScanned,
+ COUNT(DISTINCT t.routeFk) routeCount,
+ MIN(t.routeFk) mod 1000 as minRoute,
+ MAX(t.routeFk) mod 1000 as maxRoute,
+ COUNT(sl.scan_line_id) as scanned
+ FROM vn2008.scan_line sl
+ JOIN expedition e ON e.id = sl.`code`
+ JOIN ticket t ON t.id = e.ticketFk
+ WHERE t.routeFk
+ GROUP BY sl.scan_id
+ ) rs ON rs.scan_id = st.id
+ SET st.lastScanned = rs.lastScanned,
+ st.routeCount = rs.routeCount,
+ st.minRoute = rs.minRoute,
+ st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL),
+ st.scanned = rs.scanned;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -51899,7 +52198,7 @@ proc: BEGIN
UPDATE vn.shelving
- SET parkingFk = vParkingFk, parked = NOW()
+ SET parkingFk = vParkingFk, parked = NOW(), isPrinted = 1
WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci;
SELECT (COUNT(*) > 0) AS IsUpdated
@@ -51947,6 +52246,27 @@ SELECT s.itemFk,
HAVING sinServir > aparcado;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `shelvingPriority_update` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10))
+BEGIN
+
+ UPDATE vn.shelving SET priority = priority WHERE code=vShelvingFk COLLATE utf8_unicode_ci;
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -51976,9 +52296,9 @@ BEGIN
UPDATE vn.shelving sh
LEFT JOIN vn.itemShelving its ON its.shelvingFk = sh.`code`
- SET isPrinted = 0
- WHERE isPrinted = 1
- AND its.id IS NULL
+ SET isPrinted = 0,
+ parkingFk = NULL
+ WHERE its.id IS NULL
AND ( sh.parked IS NULL
OR
sh.parked < TIMESTAMPADD(MONTH,-1,CURDATE())
@@ -51990,6 +52310,28 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `sleep_X_min` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `sleep_X_min`()
+BEGIN
+ # Ernesto. 4.8.2020
+ # Para su uso en las tareas ejecutadas a las 2AM (visibles con: SELECT * FROM bs.nightTask order by started asc;)
+ # Simplemente esperar unos minutos para que en las graficas de rendimiento de Percona PMM y escritura a disco de vCenter se puedan ver los efectos de cada tarea.
+ do SLEEP(300);
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `solunionRiskRequest` */;
ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -53145,6 +53487,109 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `ticketClon` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE)
+BEGIN
+
+ DECLARE done INT DEFAULT FALSE;
+ DECLARE vNewTicketFk INT;
+ DECLARE vOldSaleFk INT;
+ DECLARE vNewSaleFk INT;
+
+ DECLARE cur1 CURSOR FOR
+ SELECT id
+ FROM vn.sale
+ WHERE ticketFk = vTicketFk;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+ SET vNewShipped = IFNULL(vNewShipped, CURDATE());
+
+ CALL vn.ticket_Clone(vTicketFk, vNewTicketFk);
+
+ UPDATE vn.ticket
+ SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed),
+ shipped = vNewShipped
+ WHERE id = vNewTicketFk;
+
+ OPEN cur1;
+
+ read_loop: LOOP
+
+ FETCH cur1 INTO vOldSaleFk;
+
+ IF done THEN
+ LEAVE read_loop;
+ END IF;
+
+ INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed)
+ SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed
+ FROM vn.sale
+ WHERE id = vOldSaleFk;
+
+ SELECT max(id) INTO vNewSaleFk
+ FROM vn.sale
+ WHERE ticketFk = vNewTicketFk;
+
+ INSERT INTO vn.saleComponent(saleFk, componentFk, value, isGreuge)
+ SELECT vNewSaleFk, componentFk, value, isGreuge
+ FROM vn.saleComponent
+ WHERE saleFk = vOldSaleFk;
+
+ END LOOP;
+
+ CLOSE cur1;
+
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `ticketClon_OneYear` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `ticketClon_OneYear`(vTicketFk INT)
+BEGIN
+
+ DECLARE vShipped DATE;
+ DECLARE vMaxDated DATE;
+
+ SELECT shipped, TIMESTAMPADD(YEAR,1,shipped)
+ INTO vShipped, vMaxDated
+ FROM vn.ticket
+ WHERE id = vTicketFk;
+
+ WHILE vShipped <= vMaxDated DO
+
+ SET vShipped = TIMESTAMPADD(WEEK, 1, vShipped);
+
+ CALL vn.ticketClon(vTicketFk, vShipped);
+
+ END WHILE;
+
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticketClosure` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -54513,9 +54958,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -54850,9 +55295,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -57233,6 +57678,69 @@ proc: BEGIN
DROP TEMPORARY TABLE tmp.ticketComponentPrice;
DROP TEMPORARY TABLE tmp.ticketComponent;
DROP TEMPORARY TABLE tmp.sale;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `ticket_WeightDeclaration` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`%` PROCEDURE `ticket_WeightDeclaration`(vClientFk INT, vDated DATE)
+BEGIN
+
+ DECLARE vTheorycalWeight DECIMAL(10,2);
+ DECLARE vRealWeight DECIMAL(10,2);
+ DECLARE vRatio DOUBLE;
+
+ SELECT IFNULL(sum(tob.description),0) INTO vRealWeight
+ FROM vn.ticketObservation tob
+ JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
+ JOIN vn.ticket t ON t.id = tob.ticketFk
+ WHERE ot.description = 'Peso Aduana'
+ AND t.clientFk = vClientFk
+ AND t.shipped BETWEEN vDated AND util.dayend(vDated);
+
+ SELECT sum(IF(sv.physicalWeight = 0, sv.weight, sv.physicalWeight)) INTO vTheorycalWeight
+ FROM vn.ticket t
+ JOIN vn.sale s ON s.ticketFk = t.id
+ JOIN vn.saleVolume sv ON sv.saleFk = s.id
+ JOIN vn.item i ON i.id = s.itemFk
+ JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
+ WHERE t.clientFk = vClientFk
+ AND t.shipped BETWEEN vDated AND util.dayend(vDated);
+
+ SET vRatio = vRealWeight / vTheorycalWeight;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.ticketWeight;
+
+ CREATE TEMPORARY TABLE tmp.ticketWeight
+ ENGINE = MEMORY
+ SELECT i.intrastatFk,
+ ib.ediBotanic,
+ FLOOR(sum(s.quantity)) as quantity,
+ CAST(vRatio * SUM(IF(sv.physicalWeight = 0, sv.weight, sv.physicalWeight) ) AS DECIMAL(10,2)) physicalWeight,
+ o.code as countryCode,
+ vDated as Dated
+ FROM vn.ticket t
+ JOIN vn.sale s ON s.ticketFk = t.id
+ JOIN vn.saleVolume sv ON sv.saleFk = s.id
+ JOIN vn.item i ON i.id = s.itemFk
+ LEFT JOIN vn.itemBotanicalWithGenus ib ON ib.itemFk = i.id
+ LEFT JOIN vn.origin o ON o.id = i.originFk
+ WHERE t.clientFk = vClientFk
+ AND t.shipped BETWEEN vDated AND util.dayend(vDated)
+ GROUP BY ib.ediBotanic, o.code;
+
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -57243,9 +57751,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@@ -57260,12 +57768,12 @@ BEGIN
* @return tmp.timeBusinessCalculate
*/
- DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate;
+ DROP TABLE IF EXISTS tmp.timeBusinessCalculate;
DROP TEMPORARY TABLE IF EXISTS tmp.businessFullTime;
CALL rangeDateInfo(vDatedFrom, vDatedTo);
- CREATE TEMPORARY TABLE tmp.timeBusinessCalculate
+ CREATE TABLE tmp.timeBusinessCalculate
SELECT dated,
businessFk,
userFk,
@@ -57541,7 +58049,8 @@ BEGIN
FROM (SELECT wtc.*
FROM workerTimeControl wtc
JOIN tmp.`user` w ON w.userFk = wtc.userFk
- WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
+ WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo AND
+ isSendMail = FALSE
ORDER BY userFk, timed ASC
) wtc
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
@@ -63449,7 +63958,7 @@ USE `pbx`;
/*!50001 SET collation_connection = utf8mb4_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
-/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on((`u`.`id` = `s`.`user_id`))) left join `pbx`.`sipReg` `r` on((`s`.`user_id` = `r`.`userId`))) join `pbx`.`sipConfig` `c`) */;
+/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`c`.`nat` AS `nat`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on((`u`.`id` = `s`.`user_id`))) left join `pbx`.`sipReg` `r` on((`s`.`user_id` = `r`.`userId`))) join `pbx`.`sipConfig` `c`) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -64595,7 +65104,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8mb4_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
-/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`i`.`inkFk` AS `colorCode`,`i`.`stems` AS `stems`,`i`.`category` AS `category`,`i`.`subName` AS `productor`,`it`.`value` AS `value`,`b`.`packing` AS `packing`,`clb`.`warehouse_id` AS `warehouse_id`,`i`.`size` AS `size`,`b`.`isPickedOff` AS `isPickedOff`,`e`.`evaNotes` AS `notes`,`w`.`name` AS `wh_in`,`e`.`id` AS `entryId`,`b`.`id` AS `buyId` from (((((((`vn`.`item` `i` join `vn`.`itemTag` `it` on((`it`.`itemFk` = `i`.`id`))) join `vn`.`tag` `t` on((`t`.`id` = `it`.`tagFk`))) join `cache`.`last_buy` `clb` on((`clb`.`item_id` = `i`.`id`))) join `vn`.`buy` `b` on((`b`.`id` = `clb`.`buy_id`))) join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) left join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */;
+/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`i`.`inkFk` AS `colorCode`,`i`.`stems` AS `stems`,`i`.`category` AS `category`,`i`.`subName` AS `productor`,`b`.`packing` AS `packing`,`clb`.`warehouse_id` AS `warehouse_id`,`i`.`size` AS `size`,`b`.`isPickedOff` AS `isPickedOff`,`e`.`evaNotes` AS `notes`,`w`.`name` AS `wh_in`,`e`.`id` AS `entryId`,`b`.`id` AS `buyId` from (((((`vn`.`buy` `b` join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `cache`.`last_buy` `clb` on((`clb`.`item_id` = `i`.`id`))) join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) left join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -64793,7 +65302,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
-/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(((`ic`.`cm3delivery` * `s`.`quantity`) / 1000),0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `volume`,((`s`.`quantity` * `ic`.`grams`) / 1000) AS `physicalWeight`,(((`s`.`quantity` * `ic`.`cm3delivery`) * greatest(`i`.`density`,167)) / 1000000) AS `weight`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `physicalVolume`,(((`s`.`quantity` * `ic`.`cm3delivery`) * `t`.`zonePrice`) / `cb`.`volume`) AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked` from ((((`sale` `s` join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `packaging` `cb` on((`cb`.`id` = '94'))) join `itemCost` `ic` on(((`ic`.`itemFk` = `s`.`itemFk`) and (`ic`.`warehouseFk` = `t`.`warehouseFk`)))) */;
+/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(((`ic`.`cm3delivery` * `s`.`quantity`) / 1000),0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `volume`,((`s`.`quantity` * `ic`.`grams`) / 1000) AS `physicalWeight`,(((`s`.`quantity` * `ic`.`cm3delivery`) * greatest(`i`.`density`,167)) / 1000000) AS `weight`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `physicalVolume`,(((`s`.`quantity` * `ic`.`cm3delivery`) * ifnull(`t`.`zonePrice`,`z`.`price`)) / `cb`.`volume`) AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked` from (((((`sale` `s` join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) join `packaging` `cb` on((`cb`.`id` = '94'))) join `itemCost` `ic` on(((`ic`.`itemFk` = `s`.`itemFk`) and (`ic`.`warehouseFk` = `t`.`warehouseFk`)))) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -65299,4 +65808,4 @@ USE `vncontrol`;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-07-16 10:43:28
+-- Dump completed on 2020-08-11 11:57:36
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index cb29afac9..d93b72483 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -189,8 +189,9 @@ export default {
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]',
saveButton: '.vn-dialog.shown [response="accept"]',
- firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
-
+ firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)',
+ firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable',
+ firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable > div > field > vn-textfield'
},
webPayment: {
confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]',
@@ -371,7 +372,7 @@ export default {
ticketsIndex: {
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"]',
- newTicketButton: 'vn-ticket-index a',
+ newTicketButton: 'vn-ticket-index a[ui-sref="ticket.create"]',
searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
secondTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(2) > vn-td:nth-child(1) > vn-check',
thirdTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(3) > vn-td:nth-child(1) > vn-check',
@@ -544,6 +545,7 @@ export default {
logButton: 'vn-left-menu a[ui-sref="ticket.card.log"]',
changedBy: 'vn-ticket-log > vn-log vn-tr:nth-child(1) > vn-td:nth-child(2) > span',
actionTaken: 'vn-ticket-log > vn-log vn-td:nth-child(1) > div > div:nth-child(3) > span.value',
+ changes: 'vn-ticket-log vn-data-viewer vn-tbody > vn-tr > vn-td:nth-child(7)',
id: 'vn-ticket-log > vn-log vn-td.before > vn-one:nth-child(1) > div > span.value'
},
ticketService: {
@@ -688,7 +690,7 @@ export default {
confirmButton: '.vn-confirm.shown button[response="accept"]',
},
routeIndex: {
- addNewRouteButton: 'vn-route-index > a[ui-sref="route.create"]'
+ addNewRouteButton: 'vn-route-index a[ui-sref="route.create"]'
},
createRouteView: {
worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
@@ -803,6 +805,22 @@ export default {
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]',
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
},
+ workerCalendar: {
+ year: 'vn-worker-calendar vn-autocomplete[ng-model="$ctrl.year"]',
+ totalHolidaysUsed: 'vn-worker-calendar div.totalBox > div',
+ januaryThirtyFirst: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(33) > div',
+ marchTwentyThird: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div',
+ mayFourth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div',
+ mayEighth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(12) > div',
+ mayTwelfth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div',
+ mayThirteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div',
+ mayFourteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div',
+ holidays: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(1)',
+ absence: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(2)',
+ halfHoliday: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(3)',
+ furlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(4)',
+ halfFurlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(5)',
+ },
invoiceOutIndex: {
topbarSearch: 'vn-searchbar',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
@@ -852,6 +870,13 @@ export default {
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
upload: 'vn-travel-thermograph-create button[type=submit]'
},
+ zoneIndex: {
+ searchResult: 'vn-zone-index a.vn-tr',
+ },
+ zoneDescriptor: {
+ menu: 'vn-zone-descriptor vn-icon-button[vn-popover="menu"]',
+ deleteZone: 'slot-menu vn-item[ng-click="$ctrl.onDelete()"]'
+ },
zoneBasicData: {
name: 'vn-zone-basic-data vn-textfield[ng-model="$ctrl.zone.name"]',
agency: 'vn-zone-basic-data vn-autocomplete[ng-model="$ctrl.zone.agencyModeFk"]',
@@ -870,7 +895,7 @@ export default {
confirmed: 'vn-entry-summary vn-check[label="Confirmed"]',
},
entryDescriptor: {
- agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(2) span',
+ agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span',
travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a',
entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a'
}
diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js
index 108f76710..6c16d455d 100644
--- a/e2e/paths/02-client/14_balance.spec.js
+++ b/e2e/paths/02-client/14_balance.spec.js
@@ -53,15 +53,28 @@ describe('Client balance path', () => {
expect(message.type).toBe('success');
});
- it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => {
+ it('should edit the 1st line reference', async() => {
+ await page.waitToClick(selectors.clientBalance.firstLineReference);
+ await page.write(selectors.clientBalance.firstLineReferenceInput, 'Miscellaneous payment');
+ await page.keyboard.press('Enter');
+ const message = await page.waitForSnackbar();
+
+ expect(message.type).toBe('success');
+ });
+
+ it('should check balance is now 0, the reference was saved and the company is now VNL becouse the user local settings were removed', async() => {
await page.waitForSpinnerLoad();
let company = await page
.waitToGetProperty(selectors.clientBalance.company, 'value');
+ let reference = await page
+ .waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText');
+
let firstBalanceLine = await page
- .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
+ .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
expect(company).toEqual('VNL');
+ expect(reference).toEqual('Miscellaneous payment');
expect(firstBalanceLine).toContain('0.00');
});
@@ -76,7 +89,7 @@ describe('Client balance path', () => {
it('should check balance is now -100', async() => {
let result = await page
- .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
+ .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
expect(result).toContain('-€100.00');
});
@@ -92,7 +105,7 @@ describe('Client balance path', () => {
it('should check balance is now 50', async() => {
let result = await page
- .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
+ .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
expect(result).toEqual('€50.00');
});
diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js
new file mode 100644
index 000000000..801ff4151
--- /dev/null
+++ b/e2e/paths/03-worker/05_calendar.spec.js
@@ -0,0 +1,137 @@
+import selectors from '../../helpers/selectors.js';
+import getBrowser from '../../helpers/puppeteer';
+
+describe('Worker calendar path', () => {
+ let reasonableTimeBetweenClicks = 400;
+ let browser;
+ let page;
+ beforeAll(async() => {
+ browser = await getBrowser();
+ page = browser.page;
+ await page.loginAndModule('hr', 'worker');
+ await page.accessToSearchResult('Hank Pym');
+ await page.accessToSection('worker.card.calendar');
+ });
+
+ afterAll(async() => {
+ await browser.close();
+ });
+
+ describe('as hr', () => {
+ it('should check 5 total holidays have been used so far before testing anything', async() => {
+ const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
+
+ expect(result).toContain(' 5 ');
+ });
+
+ it('should set two days as holidays on the calendar', async() => {
+ await page.waitToClick(selectors.workerCalendar.holidays);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.absence);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.marchTwentyThird);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.halfHoliday);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.mayFourth);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.furlough);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.mayTwelfth);
+ await page.waitToClick(selectors.workerCalendar.mayThirteenth);
+ await page.waitToClick(selectors.workerCalendar.mayFourteenth);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.halfFurlough);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.mayEighth);
+ });
+
+ it('should check the total holidays increased by 1.5', async() => {
+ const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
+
+ expect(result).toContain(' 6.5 ');
+ });
+ });
+
+ describe(`as salesBoss`, () => {
+ it(`should log in and get to Hank's calendar`, async() => {
+ await page.loginAndModule('salesBoss', 'worker');
+ await page.accessToSearchResult('Hank Pym');
+ await page.accessToSection('worker.card.calendar');
+ });
+
+ it('should undo what was done here', async() => {
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.holidays);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.absence);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.marchTwentyThird);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.halfHoliday);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.mayFourth);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.furlough);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.mayTwelfth);
+ await page.waitToClick(selectors.workerCalendar.mayThirteenth);
+ await page.waitToClick(selectors.workerCalendar.mayFourteenth);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.halfFurlough);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.mayEighth);
+ });
+
+ it('should check the total holidays used are back to what it was', async() => {
+ const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
+
+ expect(result).toContain(' 5 ');
+ });
+ });
+
+ describe(`as Hank`, () => {
+ it(`should log in and get to his calendar`, async() => {
+ await page.loginAndModule('HankPym', 'worker');
+ await page.accessToSearchResult('Hank Pym');
+ await page.accessToSection('worker.card.calendar');
+ });
+
+ it('should make a futile attempt to add holidays', async() => {
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.holidays);
+ await page.waitFor(reasonableTimeBetweenClicks);
+ await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
+ });
+
+ it('should check the total holidays used are now the initial ones', async() => {
+ const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
+
+ expect(result).toContain(' 5 ');
+ });
+
+ it('should use the year selector to go to the previous year', async() => {
+ const date = new Date();
+ const lastYear = (date.getFullYear() - 1).toString();
+
+ await page.autocompleteSearch(selectors.workerCalendar.year, lastYear);
+
+ await page.waitFor(reasonableTimeBetweenClicks);
+ const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
+
+ expect(result).toContain(' 0 ');
+ });
+ });
+});
diff --git a/e2e/paths/04-item/13_request.spec.js b/e2e/paths/04-item/13_request.spec.js
index ab48e0c37..66cd7a0f5 100644
--- a/e2e/paths/04-item/13_request.spec.js
+++ b/e2e/paths/04-item/13_request.spec.js
@@ -31,7 +31,7 @@ describe('Item request path', () => {
it('should the status of the request should now be accepted', async() => {
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
- expect(status).toContain('Aceptada');
+ expect(status).toContain('Accepted');
});
it('should now click on the second declain request icon then type the reason', async() => {
@@ -40,6 +40,6 @@ describe('Item request path', () => {
await page.respondToDialog('accept');
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
- expect(status).toContain('Denegada');
+ expect(status).toContain('Denied');
});
});
diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js
index b1dc06e51..37e5261dc 100644
--- a/e2e/paths/05-ticket/18_index_payout.spec.js
+++ b/e2e/paths/05-ticket/18_index_payout.spec.js
@@ -19,7 +19,7 @@ describe('Ticket index payout path', () => {
await page.waitForState('ticket.index');
});
- it('should check three tickets 2 of a clinet and 1 of another', async() => {
+ it('should check the second ticket from a client and 1 of another', async() => {
await page.keyboard.press('Enter');
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
diff --git a/e2e/paths/11-zone/02_descriptor.spec.js b/e2e/paths/11-zone/02_descriptor.spec.js
new file mode 100644
index 000000000..1de84d601
--- /dev/null
+++ b/e2e/paths/11-zone/02_descriptor.spec.js
@@ -0,0 +1,42 @@
+import selectors from '../../helpers/selectors.js';
+import getBrowser from '../../helpers/puppeteer';
+
+describe('Zone descriptor path', () => {
+ let browser;
+ let page;
+
+ beforeAll(async() => {
+ browser = await getBrowser();
+ page = browser.page;
+ await page.loginAndModule('deliveryBoss', 'zone');
+ await page.accessToSearchResult('13');
+ });
+
+ afterAll(async() => {
+ await browser.close();
+ });
+
+ it('should eliminate the zone using the descriptor option', async() => {
+ await page.waitToClick(selectors.zoneDescriptor.menu);
+ await page.waitToClick(selectors.zoneDescriptor.deleteZone);
+ await page.respondToDialog('accept');
+ await page.waitForState('zone.index');
+ });
+
+ it('should search for the deleted zone to find no results', async() => {
+ await page.doSearch('13');
+ const count = await page.countElement(selectors.zoneIndex.searchResult);
+
+ expect(count).toEqual(0);
+ });
+
+ it('should check the ticket whom lost the zone and see evidence on the logs', async() => {
+ await page.waitToClick(selectors.globalItems.homeButton);
+ await page.selectModule('ticket');
+ await page.accessToSearchResult('20');
+ await page.accessToSection('ticket.card.log');
+ const lastChanges = await page.waitToGetProperty(selectors.ticketLog.changes, 'innerText');
+
+ expect(lastChanges).toContain('Arreglar');
+ });
+});
diff --git a/front/core/components/array-model/array-model.js b/front/core/components/array-model/array-model.js
index 5b0b94cdc..7ebb95755 100644
--- a/front/core/components/array-model/array-model.js
+++ b/front/core/components/array-model/array-model.js
@@ -214,7 +214,7 @@ export default class ArrayModel extends ModelProxy {
}
ArrayModel.$inject = ['$q', '$filter', '$element', '$scope'];
-ngModule.component('vnArrayModel', {
+ngModule.vnComponent('vnArrayModel', {
controller: ArrayModel,
bindings: {
orgData: '',
diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js
index 38c85db57..30e984fc6 100755
--- a/front/core/components/autocomplete/index.js
+++ b/front/core/components/autocomplete/index.js
@@ -192,7 +192,7 @@ export default class Autocomplete extends Field {
if (this.translateFields) {
if (this.translateFields.indexOf(this.showField) > -1)
- this.input.value = this.$translate.instant(display);
+ this.input.value = this.$t(display);
}
}
diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js
index 02d2a4798..17bf52941 100644
--- a/front/core/components/calendar/index.js
+++ b/front/core/components/calendar/index.js
@@ -135,7 +135,10 @@ export default class Calendar extends FormInput {
$days: [day],
$type: 'day'
});
- // this.repaint();
+
+ // Repaint only if 'selection' event is not listening
+ if (!this.$events || this.$events && !this.$events['selection'])
+ this.repaint();
}
/*
diff --git a/front/core/components/chip/index.spec.js b/front/core/components/chip/index.spec.js
index 60129fd69..fc93527d6 100644
--- a/front/core/components/chip/index.spec.js
+++ b/front/core/components/chip/index.spec.js
@@ -8,7 +8,7 @@ describe('Component vnChip', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($componentController, $rootScope) => {
+ beforeEach(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$element = angular.element(`${template}
`);
controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}});
diff --git a/front/core/components/contextmenu/index.js b/front/core/components/contextmenu/index.js
index 90c14b7e3..db74848a6 100755
--- a/front/core/components/contextmenu/index.js
+++ b/front/core/components/contextmenu/index.js
@@ -67,13 +67,13 @@ export default class Contextmenu {
get cell() {
if (!this.target) return null;
- return this.target.closest('vn-td, .vn-td');
+ return this.target.closest('vn-td, .vn-td, vn-td-editable');
}
get cellIndex() {
if (!this.row) return null;
- const cells = this.row.querySelectorAll('vn-td, .vn-td');
+ const cells = this.row.querySelectorAll('vn-td, .vn-td, vn-td-editable');
return Array.from(cells).findIndex(
cellItem => cellItem == this.cell
);
diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js
index 52052cc7f..9cfa3b410 100644
--- a/front/core/components/crud-model/crud-model.js
+++ b/front/core/components/crud-model/crud-model.js
@@ -272,7 +272,7 @@ export default class CrudModel extends ModelProxy {
}
CrudModel.$inject = ['$q', '$http', '$element', '$scope'];
-ngModule.component('vnCrudModel', {
+ngModule.vnComponent('vnCrudModel', {
controller: CrudModel,
bindings: {
orgData: '',
diff --git a/front/core/components/data-viewer/index.js b/front/core/components/data-viewer/index.js
index 1f967d94b..8d0d94402 100644
--- a/front/core/components/data-viewer/index.js
+++ b/front/core/components/data-viewer/index.js
@@ -21,7 +21,7 @@ export default class DataViewer {
}
}
-ngModule.component('vnDataViewer', {
+ngModule.vnComponent('vnDataViewer', {
template: require('./index.html'),
transclude: true,
controller: DataViewer,
diff --git a/front/core/components/date-picker/index.spec.js b/front/core/components/date-picker/index.spec.js
index 2dd419e07..f76396311 100644
--- a/front/core/components/date-picker/index.spec.js
+++ b/front/core/components/date-picker/index.spec.js
@@ -9,7 +9,7 @@ describe('Component vnDatePicker', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
+ beforeEach(inject(($compile, $rootScope, _$filter_) => {
$filter = _$filter_;
$element = $compile(` `)($rootScope);
diff --git a/front/core/components/dialog/index.spec.js b/front/core/components/dialog/index.spec.js
index e8c8f6320..03720bf31 100644
--- a/front/core/components/dialog/index.spec.js
+++ b/front/core/components/dialog/index.spec.js
@@ -5,7 +5,7 @@ describe('Component vnDialog', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($rootScope, $compile) => {
+ beforeEach(inject(($rootScope, $compile) => {
$scope = $rootScope.$new();
$element = $compile('Body ')($scope);
controller = $element.controller('vnDialog');
diff --git a/front/core/components/drop-down/index.js b/front/core/components/drop-down/index.js
index dfdfbe18d..fd5792da6 100644
--- a/front/core/components/drop-down/index.js
+++ b/front/core/components/drop-down/index.js
@@ -276,7 +276,7 @@ export default class DropDown extends Popover {
if (this.translateFields) {
option = Object.assign({}, option);
for (let field of this.translateFields)
- option[field] = this.$translate.instant(option[field]);
+ option[field] = this.$t(option[field]);
}
let li = this.document.createElement('li');
diff --git a/front/core/components/icon/icon.js b/front/core/components/icon/icon.js
index 1b78f4693..38aea0056 100644
--- a/front/core/components/icon/icon.js
+++ b/front/core/components/icon/icon.js
@@ -25,7 +25,7 @@ class Icon {
}
Icon.$inject = ['$attrs'];
-ngModule.component('vnIcon', {
+ngModule.vnComponent('vnIcon', {
template: '{{::$ctrl.iconContent}} ',
controller: Icon,
bindings: {
diff --git a/front/core/components/input-file/index.spec.js b/front/core/components/input-file/index.spec.js
index 3b37a8d6c..25df9a47e 100644
--- a/front/core/components/input-file/index.spec.js
+++ b/front/core/components/input-file/index.spec.js
@@ -7,7 +7,7 @@ describe('Component vnInputFile', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($compile, $rootScope) => {
+ beforeEach(inject(($compile, $rootScope) => {
$scope = $rootScope.$new();
$element = $compile(' ')($scope);
controller = $element.controller('vnInputFile');
diff --git a/front/core/components/input-number/index.spec.js b/front/core/components/input-number/index.spec.js
index 0e0f8c4a5..5e80659f1 100644
--- a/front/core/components/input-number/index.spec.js
+++ b/front/core/components/input-number/index.spec.js
@@ -6,7 +6,7 @@ describe('Component vnInputNumber', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($compile, $rootScope) => {
+ beforeEach(inject(($compile, $rootScope) => {
$element = $compile(` `)($rootScope);
$ctrl = $element.controller('vnInputNumber');
}));
diff --git a/front/core/components/input-time/index.spec.js b/front/core/components/input-time/index.spec.js
index 39993b5cc..abb684df8 100644
--- a/front/core/components/input-time/index.spec.js
+++ b/front/core/components/input-time/index.spec.js
@@ -7,7 +7,7 @@ describe('Component vnInputTime', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
+ beforeEach(inject(($compile, $rootScope, _$filter_) => {
$filter = _$filter_;
$element = $compile(` `)($rootScope);
diff --git a/front/core/components/label-value/index.js b/front/core/components/label-value/index.js
index 71863f867..ec1e6c1a3 100644
--- a/front/core/components/label-value/index.js
+++ b/front/core/components/label-value/index.js
@@ -42,7 +42,7 @@ export default class Controller extends Component {
}
}
-ngModule.component('vnLabelValue', {
+ngModule.vnComponent('vnLabelValue', {
controller: Controller,
template: require('./index.html'),
transclude: true,
diff --git a/front/core/components/model-proxy/model-proxy.js b/front/core/components/model-proxy/model-proxy.js
index 1eaf749d5..592b25710 100644
--- a/front/core/components/model-proxy/model-proxy.js
+++ b/front/core/components/model-proxy/model-proxy.js
@@ -30,7 +30,7 @@ export class DataModel extends Component {
clear() {}
}
-ngModule.component('vnDataModel', {
+ngModule.vnComponent('vnDataModel', {
controller: DataModel,
bindings: {
data: '=?',
@@ -269,7 +269,7 @@ export default class ModelProxy extends DataModel {
}
}
-ngModule.component('vnModelProxy', {
+ngModule.vnComponent('vnModelProxy', {
controller: ModelProxy,
bindings: {
orgData: '',
diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js
index 5c11e955e..3de9b4c71 100644
--- a/front/core/components/multi-check/multi-check.js
+++ b/front/core/components/multi-check/multi-check.js
@@ -11,6 +11,7 @@ import './style.scss';
export default class MultiCheck extends FormInput {
constructor($element, $scope) {
super($element, $scope);
+ this.checkAll = false;
this._checked = false;
this.checkField = 'checked';
this.isIntermediate = false;
@@ -114,7 +115,7 @@ export default class MultiCheck extends FormInput {
}
}
-ngModule.component('vnMultiCheck', {
+ngModule.vnComponent('vnMultiCheck', {
template: require('./multi-check.html'),
controller: MultiCheck,
bindings: {
diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js
index d10cc27cf..e49c68d2b 100644
--- a/front/core/components/multi-check/multi-check.spec.js
+++ b/front/core/components/multi-check/multi-check.spec.js
@@ -7,7 +7,7 @@ describe('Component vnMultiCheck', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject($componentController => {
+ beforeEach(inject($componentController => {
$element = angular.element(`
`);
controller = $componentController('vnMultiCheck', {$element: $element});
controller._model = crudModel;
diff --git a/front/core/components/pagination/pagination.js b/front/core/components/pagination/pagination.js
index f1393aee8..9979be368 100644
--- a/front/core/components/pagination/pagination.js
+++ b/front/core/components/pagination/pagination.js
@@ -90,7 +90,7 @@ class Pagination extends Component {
}
}
-ngModule.component('vnPagination', {
+ngModule.vnComponent('vnPagination', {
template: require('./pagination.html'),
bindings: {
model: '<',
diff --git a/front/core/components/scroll-up/scroll-up.js b/front/core/components/scroll-up/scroll-up.js
index 2ada05394..f18513bca 100644
--- a/front/core/components/scroll-up/scroll-up.js
+++ b/front/core/components/scroll-up/scroll-up.js
@@ -22,7 +22,7 @@ export default class Controller extends Component {
Controller.$inject = ['$element', '$scope', '$window'];
-ngModule.component('vnScrollUp', {
+ngModule.vnComponent('vnScrollUp', {
template: require('./scroll-up.html'),
controller: Controller,
bindings: {
diff --git a/front/core/components/searchbar/searchbar.js b/front/core/components/searchbar/searchbar.js
index 073b77f6e..0b7bd8cd2 100644
--- a/front/core/components/searchbar/searchbar.js
+++ b/front/core/components/searchbar/searchbar.js
@@ -36,7 +36,7 @@ export default class Searchbar extends Component {
}
this.searchState = `${this.baseState}.index`;
- this.placeholder = this.$translate.instant('Search by', {
+ this.placeholder = this.$t('Search by', {
module: this.baseState
});
}
@@ -189,7 +189,7 @@ export default class Searchbar extends Component {
}
doSearch(filter, source) {
- if (filter === this.filter) return;
+ if (filter === this.filter && source != 'state') return;
let promise = this.onSearch({$params: filter});
promise = promise || this.$q.resolve();
promise.then(data => this.onFilter(filter, source, data));
diff --git a/front/core/components/slot/portal.js b/front/core/components/slot/portal.js
index f4dbecb09..40631c52e 100644
--- a/front/core/components/slot/portal.js
+++ b/front/core/components/slot/portal.js
@@ -19,7 +19,7 @@ export default class Portal {
}
Portal.$inject = ['$transclude', 'vnSlotService'];
-ngModule.component('vnPortal', {
+ngModule.vnComponent('vnPortal', {
controller: Portal,
transclude: true,
bindings: {
diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js
index 9439198f0..14d920211 100644
--- a/front/core/components/snackbar/snackbar.js
+++ b/front/core/components/snackbar/snackbar.js
@@ -144,7 +144,7 @@ export default class Controller extends Component {
}
}
-ngModule.component('vnSnackbar', {
+ngModule.vnComponent('vnSnackbar', {
template: require('./snackbar.html'),
controller: Controller
});
diff --git a/front/core/components/spinner/spinner.js b/front/core/components/spinner/spinner.js
index aee973aa6..ad535b6a4 100644
--- a/front/core/components/spinner/spinner.js
+++ b/front/core/components/spinner/spinner.js
@@ -54,4 +54,4 @@ export const component = {
},
controller: Spinner
};
-ngModule.component('vnSpinner', component);
+ngModule.vnComponent('vnSpinner', component);
diff --git a/front/core/components/spinner/spinner.spec.js b/front/core/components/spinner/spinner.spec.js
index ef3c99623..fc1f8d207 100644
--- a/front/core/components/spinner/spinner.spec.js
+++ b/front/core/components/spinner/spinner.spec.js
@@ -6,7 +6,7 @@ describe('Component vnSpinner', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($compile, $rootScope) => {
+ beforeEach(inject(($compile, $rootScope) => {
$element = $compile(` `)($rootScope);
controller = $element.controller('vnSpinner');
}));
diff --git a/front/core/components/step-control/step-control.js b/front/core/components/step-control/step-control.js
index 0ca1f0c46..b5b3466ca 100644
--- a/front/core/components/step-control/step-control.js
+++ b/front/core/components/step-control/step-control.js
@@ -74,7 +74,7 @@ export default class StepControl {
StepControl.$inject = ['$state'];
-ngModule.component('vnStepControl', {
+ngModule.vnComponent('vnStepControl', {
template: require('./step-control.html'),
controller: StepControl,
bindings: {
diff --git a/front/core/components/step-control/step-control.spec.js b/front/core/components/step-control/step-control.spec.js
index 11a157470..d4fbbb1eb 100644
--- a/front/core/components/step-control/step-control.spec.js
+++ b/front/core/components/step-control/step-control.spec.js
@@ -6,7 +6,7 @@ describe('Component vnStepControl', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($componentController, _$state_) => {
+ beforeEach(inject(($componentController, _$state_) => {
$state = _$state_;
jest.spyOn($state, 'go');
controller = $componentController('vnStepControl', {$state: $state});
diff --git a/front/core/components/table/index.js b/front/core/components/table/index.js
index baed54821..eadb10cb5 100644
--- a/front/core/components/table/index.js
+++ b/front/core/components/table/index.js
@@ -42,7 +42,7 @@ export default class Table {
Table.$inject = ['$scope', '$element', '$transclude'];
-ngModule.component('vnTable', {
+ngModule.vnComponent('vnTable', {
template: require('./index.html'),
transclude: true,
controller: Table,
diff --git a/front/core/components/table/index.spec.js b/front/core/components/table/index.spec.js
index 40e1ef74e..631111b72 100644
--- a/front/core/components/table/index.spec.js
+++ b/front/core/components/table/index.spec.js
@@ -7,7 +7,7 @@ describe('Component vnTable', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($componentController, $rootScope) => {
+ beforeEach(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$element = angular.element(`
diff --git a/front/core/components/td-editable/index.js b/front/core/components/td-editable/index.js
index 844e7501e..b3ef1e436 100644
--- a/front/core/components/td-editable/index.js
+++ b/front/core/components/td-editable/index.js
@@ -94,7 +94,7 @@ export default class Controller extends Component {
}
Controller.$inject = ['$element', '$scope', '$transclude', '$timeout'];
-ngModule.component('vnTdEditable', {
+ngModule.vnComponent('vnTdEditable', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/front/core/components/textarea/index.spec.js b/front/core/components/textarea/index.spec.js
index fc153be93..ea105db13 100644
--- a/front/core/components/textarea/index.spec.js
+++ b/front/core/components/textarea/index.spec.js
@@ -6,7 +6,7 @@ describe('Component vnTextarea', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($compile, $rootScope) => {
+ beforeEach(inject(($compile, $rootScope) => {
$element = $compile(` `)($rootScope);
$ctrl = $element.controller('vnTextarea');
}));
diff --git a/front/core/components/th/index.js b/front/core/components/th/index.js
index 682fb4eb1..b8260bd74 100644
--- a/front/core/components/th/index.js
+++ b/front/core/components/th/index.js
@@ -75,7 +75,7 @@ export default class Th {
Th.$inject = ['$element'];
-ngModule.component('vnTh', {
+ngModule.vnComponent('vnTh', {
template: require('./index.html'),
transclude: true,
controller: Th,
diff --git a/front/core/components/th/index.spec.js b/front/core/components/th/index.spec.js
index ce6dbeec5..a00f73cc9 100644
--- a/front/core/components/th/index.spec.js
+++ b/front/core/components/th/index.spec.js
@@ -7,7 +7,7 @@ describe('Component vnTh', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject($componentController => {
+ beforeEach(inject($componentController => {
$element = angular.element(`${template}
`);
controller = $componentController('vnTh', {$element: $element});
controller.table = {
diff --git a/front/core/components/tooltip/tooltip.js b/front/core/components/tooltip/tooltip.js
index 72d69f83d..e2dba2d03 100644
--- a/front/core/components/tooltip/tooltip.js
+++ b/front/core/components/tooltip/tooltip.js
@@ -197,7 +197,7 @@ export default class Tooltip extends Component {
}
Tooltip.$inject = ['$element', '$scope', '$timeout'];
-ngModule.component('vnTooltip', {
+ngModule.vnComponent('vnTooltip', {
template: require('./tooltip.html'),
controller: Tooltip,
transclude: true,
diff --git a/front/core/components/treeview/child.js b/front/core/components/treeview/child.js
index 9e4edef35..36db07601 100644
--- a/front/core/components/treeview/child.js
+++ b/front/core/components/treeview/child.js
@@ -49,7 +49,7 @@ class Controller {
}
Controller.$inject = ['$element', '$scope', '$compile'];
-ngModule.component('vnTreeviewChild', {
+ngModule.vnComponent('vnTreeviewChild', {
template: require('./child.html'),
controller: Controller,
bindings: {
diff --git a/front/core/components/treeview/childs.js b/front/core/components/treeview/childs.js
index 03ae30233..dfb241ed2 100644
--- a/front/core/components/treeview/childs.js
+++ b/front/core/components/treeview/childs.js
@@ -2,7 +2,7 @@ import ngModule from '../../module';
class Controller {}
-ngModule.component('vnTreeviewChilds', {
+ngModule.vnComponent('vnTreeviewChilds', {
template: require('./childs.html'),
controller: Controller,
bindings: {
diff --git a/front/core/components/treeview/index.js b/front/core/components/treeview/index.js
index b39ff7b46..848440cdc 100644
--- a/front/core/components/treeview/index.js
+++ b/front/core/components/treeview/index.js
@@ -247,7 +247,7 @@ export default class Treeview extends Component {
Treeview.$inject = ['$element', '$scope', '$transclude', '$window'];
-ngModule.component('vnTreeview', {
+ngModule.vnComponent('vnTreeview', {
template: require('./index.html'),
controller: Treeview,
bindings: {
diff --git a/front/core/components/watcher/watcher.js b/front/core/components/watcher/watcher.js
index 1a1abffa5..9de9d8c1b 100644
--- a/front/core/components/watcher/watcher.js
+++ b/front/core/components/watcher/watcher.js
@@ -267,7 +267,7 @@ export default class Watcher extends Component {
}
Watcher.$inject = ['$element', '$scope', '$state', '$stateParams', '$transitions', '$http', 'vnApp', '$translate', '$attrs', '$q'];
-ngModule.component('vnWatcher', {
+ngModule.vnComponent('vnWatcher', {
template: require('./watcher.html'),
bindings: {
url: '@?',
diff --git a/front/core/components/watcher/watcher.spec.js b/front/core/components/watcher/watcher.spec.js
index 6c2567f7e..e19592387 100644
--- a/front/core/components/watcher/watcher.spec.js
+++ b/front/core/components/watcher/watcher.spec.js
@@ -12,7 +12,7 @@ describe('Component vnWatcher', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => {
$scope = $rootScope.$new();
$element = angular.element('
');
$state = _$state_;
diff --git a/front/core/directives/specs/zoom-image.spec.js b/front/core/directives/specs/zoom-image.spec.js
index f9d9c1801..541bc65f2 100644
--- a/front/core/directives/specs/zoom-image.spec.js
+++ b/front/core/directives/specs/zoom-image.spec.js
@@ -7,7 +7,7 @@ describe('Directive zoomImage', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject(($compile, $rootScope) => {
+ beforeEach(inject(($compile, $rootScope) => {
compile = $compile;
scope = $rootScope.$new();
}));
diff --git a/front/core/lib/specs/module-loader.spec.js b/front/core/lib/specs/module-loader.spec.js
index dbed5e9a0..811922169 100644
--- a/front/core/lib/specs/module-loader.spec.js
+++ b/front/core/lib/specs/module-loader.spec.js
@@ -5,7 +5,7 @@ describe('factory vnModuleLoader', () => {
beforeEach(ngModule('vnCore'));
- beforeEach(angular.mock.inject((_vnModuleLoader_, _$rootScope_, $httpBackend, _$window_, $q) => {
+ beforeEach(inject((_vnModuleLoader_, _$rootScope_, $httpBackend, _$window_, $q) => {
vnModuleLoader = _vnModuleLoader_;
$rootScope = _$rootScope_;
$window = _$window_;
diff --git a/front/salix/components/descriptor/index.js b/front/salix/components/descriptor/index.js
index 3d6dd1b3f..333360d2b 100644
--- a/front/salix/components/descriptor/index.js
+++ b/front/salix/components/descriptor/index.js
@@ -107,7 +107,7 @@ export class DescriptorContent {
}
DescriptorContent.$inject = ['$transclude', 'vnModules'];
-ngModule.component('vnDescriptorContent', {
+ngModule.vnComponent('vnDescriptorContent', {
template: require('./index.html'),
controller: DescriptorContent,
bindings: {
diff --git a/front/salix/components/descriptor/quick-link.js b/front/salix/components/descriptor/quick-link.js
index 545f235a0..cd85f5250 100644
--- a/front/salix/components/descriptor/quick-link.js
+++ b/front/salix/components/descriptor/quick-link.js
@@ -2,7 +2,7 @@ import ngModule from '../../module';
export default class QuickLink {}
-ngModule.component('vnQuickLink', {
+ngModule.vnComponent('vnQuickLink', {
template: require('./quick-link.html'),
controller: QuickLink,
bindings: {
diff --git a/front/salix/components/home/home.js b/front/salix/components/home/home.js
index 367880b31..3da49a265 100644
--- a/front/salix/components/home/home.js
+++ b/front/salix/components/home/home.js
@@ -28,7 +28,7 @@ export default class Controller extends Component {
}
Controller.$inject = ['$element', '$scope', 'vnModules', '$sce'];
-ngModule.component('vnHome', {
+ngModule.vnComponent('vnHome', {
template: require('./home.html'),
controller: Controller
});
diff --git a/front/salix/components/layout/index..js b/front/salix/components/layout/index..js
deleted file mode 100644
index 9fdcfc034..000000000
--- a/front/salix/components/layout/index..js
+++ /dev/null
@@ -1,24 +0,0 @@
-import './index.js';
-
-describe('Component vnMainMenu', () => {
- let $httpBackend;
- let controller;
-
- beforeEach(ngModule('salix'));
-
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
- let vnModules = {get: () => {}};
- $httpBackend = _$httpBackend_;
- controller = $componentController('vnMainMenu', {vnModules});
- }));
-
- describe('getCurrentUserName()', () => {
- it(`should set the user name property in the controller`, () => {
- $httpBackend.expect('GET', `Accounts/getUserData`).respond({name: 'batman'});
- controller.getCurrentUserName();
- $httpBackend.flush();
-
- expect(controller.$.$root.user.name).toEqual('batman');
- });
- });
-});
diff --git a/front/salix/components/layout/index.js b/front/salix/components/layout/index.js
index 883b010ba..b8ca74b99 100644
--- a/front/salix/components/layout/index.js
+++ b/front/salix/components/layout/index.js
@@ -21,7 +21,7 @@ export class Layout extends Component {
}
Layout.$inject = ['$element', '$scope', 'vnModules'];
-ngModule.component('vnLayout', {
+ngModule.vnComponent('vnLayout', {
template: require('./index.html'),
controller: Layout,
require: {
diff --git a/front/salix/components/layout/index.spec.js b/front/salix/components/layout/index.spec.js
index 7163acb65..18aca1f01 100644
--- a/front/salix/components/layout/index.spec.js
+++ b/front/salix/components/layout/index.spec.js
@@ -6,7 +6,7 @@ describe('Component vnLayout', () => {
beforeEach(ngModule('salix'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
+ beforeEach(inject(($componentController, _$httpBackend_) => {
let vnModules = {get: () => {}};
$httpBackend = _$httpBackend_;
let $element = angular.element('
');
diff --git a/front/salix/components/left-menu/left-menu.js b/front/salix/components/left-menu/left-menu.js
index c4bba64dd..5f047060a 100644
--- a/front/salix/components/left-menu/left-menu.js
+++ b/front/salix/components/left-menu/left-menu.js
@@ -117,7 +117,7 @@ export default class LeftMenu {
}
LeftMenu.$inject = ['$state', '$transitions', 'aclService', '$timeout', '$element'];
-ngModule.component('vnLeftMenu', {
+ngModule.vnComponent('vnLeftMenu', {
template: require('./left-menu.html'),
controller: LeftMenu,
bindings: {
diff --git a/front/salix/components/left-menu/left-menu.spec.js b/front/salix/components/left-menu/left-menu.spec.js
index 84c1b60d4..56d7ea10d 100644
--- a/front/salix/components/left-menu/left-menu.spec.js
+++ b/front/salix/components/left-menu/left-menu.spec.js
@@ -6,7 +6,7 @@ describe('Component vnLeftMenu', () => {
beforeEach(ngModule('salix'));
- beforeEach(angular.mock.inject(($componentController, $state, $window) => {
+ beforeEach(inject(($componentController, $state, $window) => {
$element = angular.element('
');
$state.current.name = 'client.card.summary';
$state.current.data = {moduleIndex: 0};
diff --git a/front/salix/components/login/login.js b/front/salix/components/login/login.js
index efb5e02bb..b5f8c1e7d 100644
--- a/front/salix/components/login/login.js
+++ b/front/salix/components/login/login.js
@@ -37,7 +37,7 @@ export default class Controller {
}
Controller.$inject = ['$scope', '$element', 'vnAuth'];
-ngModule.component('vnLogin', {
+ngModule.vnComponent('vnLogin', {
template: require('./login.html'),
controller: Controller
});
diff --git a/front/salix/components/side-menu/side-menu.js b/front/salix/components/side-menu/side-menu.js
index c2b5b421e..0e683b4bb 100644
--- a/front/salix/components/side-menu/side-menu.js
+++ b/front/salix/components/side-menu/side-menu.js
@@ -68,7 +68,7 @@ export default class SideMenu extends Component {
}
}
-ngModule.component('vnSideMenu', {
+ngModule.vnComponent('vnSideMenu', {
template: require('./side-menu.html'),
controller: SideMenu,
transclude: true,
diff --git a/front/salix/components/user-popover/index.js b/front/salix/components/user-popover/index.js
index 88efb26d1..c2fb6a130 100644
--- a/front/salix/components/user-popover/index.js
+++ b/front/salix/components/user-popover/index.js
@@ -80,7 +80,7 @@ class Controller {
}
Controller.$inject = ['$scope', '$translate', 'vnConfig', 'vnAuth'];
-ngModule.component('vnUserPopover', {
+ngModule.vnComponent('vnUserPopover', {
template: require('./index.html'),
controller: Controller
});
diff --git a/front/salix/components/user-popover/index.spec.js b/front/salix/components/user-popover/index.spec.js
index 217471ca5..a0f1a953c 100644
--- a/front/salix/components/user-popover/index.spec.js
+++ b/front/salix/components/user-popover/index.spec.js
@@ -7,7 +7,7 @@ describe('Salix', () => {
beforeEach(ngModule('salix'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, $httpBackend) => {
+ beforeEach(inject(($componentController, $rootScope, $httpBackend) => {
$httpBackend.expectGET('UserConfigs/getUserConfig');
$scope = $rootScope.$new();
diff --git a/gulpfile.js b/gulpfile.js
index 096c44584..40590d7c2 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -403,8 +403,8 @@ module.exports = {
back,
backOnly,
backWatch,
- backTestOnce,
backTest,
+ backTestOnce,
e2e,
i,
install,
diff --git a/jest.config.js b/jest.config.js
index facd1c8a7..874d9ac0b 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -70,7 +70,8 @@ module.exports = {
`front`,
`modules`,
`front/node_modules`,
- `node_modules`
+ `node_modules`,
+ `print`
],
// An array of file extensions your modules use
@@ -153,6 +154,7 @@ module.exports = {
// The glob patterns Jest uses to detect test files
testMatch: [
'**/front/**/*.spec.js',
+ '**/print/**/*.spec.js',
// 'loopback/**/*.spec.js',
// 'modules/*/back/**/*.spec.js'
// "**/__tests__/**/*.[jt]s?(x)",
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index 9951df4a5..d28cceb41 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -134,5 +134,5 @@
"This ticket is deleted": "Este ticket está eliminado",
"A travel with this data already exists": "Ya existe un travel con estos datos",
"This thermograph id already exists": "La id del termógrafo ya existe",
- "ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED"
+ "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante"
}
\ No newline at end of file
diff --git a/modules/claim/back/methods/claim/updateClaim.js b/modules/claim/back/methods/claim/updateClaim.js
index 61b8085d3..b7156feef 100644
--- a/modules/claim/back/methods/claim/updateClaim.js
+++ b/modules/claim/back/methods/claim/updateClaim.js
@@ -36,7 +36,7 @@ module.exports = Self => {
relation: 'client',
scope: {
include: {
- relation: 'salesPerson'
+ relation: 'salesPersonUser'
}
}
}
@@ -53,7 +53,7 @@ module.exports = Self => {
const updatedClaim = await claim.updateAttributes(data);
// Get sales person from claim client
- const salesPerson = claim.client().salesPerson();
+ const salesPerson = claim.client().salesPersonUser();
if (salesPerson && changedHasToPickUp && updatedClaim.hasToPickUp) {
const origin = ctx.req.headers.origin;
const message = $t('Claim will be picked', {
diff --git a/modules/claim/front/action/index.js b/modules/claim/front/action/index.js
index 2ba010ef2..2010d75c8 100644
--- a/modules/claim/front/action/index.js
+++ b/modules/claim/front/action/index.js
@@ -154,7 +154,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnClaimAction', {
+ngModule.vnComponent('vnClaimAction', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js
index c477984d9..34899537b 100644
--- a/modules/claim/front/action/index.spec.js
+++ b/modules/claim/front/action/index.spec.js
@@ -9,7 +9,7 @@ describe('claim', () => {
beforeEach(ngModule('claim'));
- beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
+ beforeEach(inject(($componentController, _$state_, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$state = _$state_;
$state.params.id = 1;
@@ -91,7 +91,7 @@ describe('claim', () => {
$httpBackend.flush();
expect(controller.$.model.refresh).toHaveBeenCalledWith();
- expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
expect(controller.$.lastTicketsPopover.hide).toHaveBeenCalledWith();
});
});
@@ -106,7 +106,7 @@ describe('claim', () => {
$httpBackend.flush();
expect(controller.card.reload).toHaveBeenCalledWith();
- expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
diff --git a/modules/claim/front/basic-data/index.js b/modules/claim/front/basic-data/index.js
index c3eac92ff..9fa3bdf4d 100644
--- a/modules/claim/front/basic-data/index.js
+++ b/modules/claim/front/basic-data/index.js
@@ -11,7 +11,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClaimBasicData', {
+ngModule.vnComponent('vnClaimBasicData', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/claim/front/basic-data/index.spec.js b/modules/claim/front/basic-data/index.spec.js
index 65e934cb8..638f88418 100644
--- a/modules/claim/front/basic-data/index.spec.js
+++ b/modules/claim/front/basic-data/index.spec.js
@@ -8,7 +8,7 @@ describe('Claim', () => {
beforeEach(ngModule('claim'));
- beforeEach(angular.mock.inject(($componentController, $rootScope) => {
+ beforeEach(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$scope.watcher = watcher;
const $element = angular.element(' ');
diff --git a/modules/claim/front/card/index.js b/modules/claim/front/card/index.js
index ccd78a271..361b0e74f 100644
--- a/modules/claim/front/card/index.js
+++ b/modules/claim/front/card/index.js
@@ -34,17 +34,7 @@ class Controller extends ModuleCard {
scope: {
fields: ['salesPersonFk', 'name', 'email'],
include: {
- relation: 'salesPerson',
- scope: {
- fields: ['userFk'],
- include: {
- relation: 'user',
- scope: {
- fields: ['nickname']
- }
- }
- }
-
+ relation: 'salesPersonUser'
}
}
}
diff --git a/modules/claim/front/card/index.spec.js b/modules/claim/front/card/index.spec.js
index 1b2344925..aa796c1e3 100644
--- a/modules/claim/front/card/index.spec.js
+++ b/modules/claim/front/card/index.spec.js
@@ -8,7 +8,7 @@ describe('Claim', () => {
beforeEach(ngModule('claim'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('
');
diff --git a/modules/claim/front/descriptor/index.html b/modules/claim/front/descriptor/index.html
index dcd103247..627537348 100644
--- a/modules/claim/front/descriptor/index.html
+++ b/modules/claim/front/descriptor/index.html
@@ -33,7 +33,7 @@
+ value="{{$ctrl.claim.client.salesPersonUser.nickname}}">
-
+
\ No newline at end of file
diff --git a/modules/claim/front/detail/index.js b/modules/claim/front/detail/index.js
index c97f3bd47..b1c6c81e0 100644
--- a/modules/claim/front/detail/index.js
+++ b/modules/claim/front/detail/index.js
@@ -75,7 +75,7 @@ class Controller extends Section {
this.$http.post(query, saleToAdd).then(() => {
this.$.addSales.hide();
this.$.model.refresh();
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ this.vnApp.showSuccess(this.$t('Data saved!'));
if (this.aclService.hasAny(['salesAssistant']))
this.$state.go('claim.card.development');
@@ -90,7 +90,7 @@ class Controller extends Section {
deleteClaimedSale() {
let query = `ClaimBeginnings/${this.sale.id}`;
this.$http.delete(query).then(() => {
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.remove(this.sale);
this.calculateTotals();
});
@@ -100,7 +100,7 @@ class Controller extends Section {
let params = {id: id, quantity: claimedQuantity};
let query = `ClaimBeginnings/`;
this.$http.patch(query, params).then(() => {
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ this.vnApp.showSuccess(this.$t('Data saved!'));
this.calculateTotals();
});
}
@@ -134,7 +134,7 @@ class Controller extends Section {
showEditPopover(event, saleClaimed) {
if (this.isEditable) {
if (!this.aclService.hasAny(['salesAssistant']))
- return this.vnApp.showError(this.$translate.instant('Insuficient permisos'));
+ return this.vnApp.showError(this.$t('Insuficient permisos'));
this.saleClaimed = saleClaimed;
this.$.editPopover.parent = event.target;
@@ -175,7 +175,7 @@ class Controller extends Section {
this.calculateTotals();
this.clearDiscount();
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ this.vnApp.showSuccess(this.$t('Data saved!'));
}).catch(err => {
this.vnApp.showError(err.message);
});
@@ -196,7 +196,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClaimDetail', {
+ngModule.vnComponent('vnClaimDetail', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js
index 5061eaff7..972d487e5 100644
--- a/modules/claim/front/detail/index.spec.js
+++ b/modules/claim/front/detail/index.spec.js
@@ -9,7 +9,7 @@ describe('claim', () => {
beforeEach(ngModule('claim'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$scope = $rootScope.$new();
$scope.descriptor = {
show: () => {}
@@ -80,7 +80,7 @@ describe('claim', () => {
controller.deleteClaimedSale();
$httpBackend.flush();
- expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
@@ -91,7 +91,7 @@ describe('claim', () => {
controller.setClaimedQuantity(1, 1);
$httpBackend.flush();
- expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
@@ -126,7 +126,7 @@ describe('claim', () => {
expect(controller.calculateTotals).toHaveBeenCalledWith();
expect(controller.clearDiscount).toHaveBeenCalledWith();
- expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
expect(controller.$.editPopover.hide).toHaveBeenCalledWith();
});
});
diff --git a/modules/claim/front/development/index.js b/modules/claim/front/development/index.js
index cc86d5452..a19654c56 100644
--- a/modules/claim/front/development/index.js
+++ b/modules/claim/front/development/index.js
@@ -15,7 +15,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClaimDevelopment', {
+ngModule.vnComponent('vnClaimDevelopment', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/claim/front/development/index.spec.js b/modules/claim/front/development/index.spec.js
index 5708f82f2..e2574ccb9 100644
--- a/modules/claim/front/development/index.spec.js
+++ b/modules/claim/front/development/index.spec.js
@@ -9,7 +9,7 @@ describe('Claim', () => {
beforeEach(ngModule('claim'));
- beforeEach(angular.mock.inject(($componentController, $rootScope) => {
+ beforeEach(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$scope.watcher = watcher;
$scope.model = crudModel;
diff --git a/modules/claim/front/index/index.js b/modules/claim/front/index/index.js
index 773c6a999..fe4b6def7 100644
--- a/modules/claim/front/index/index.js
+++ b/modules/claim/front/index/index.js
@@ -19,7 +19,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnClaimIndex', {
+ngModule.vnComponent('vnClaimIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/claim/front/photos/index.js b/modules/claim/front/photos/index.js
index 38cb89ad1..2b77c6abc 100644
--- a/modules/claim/front/photos/index.js
+++ b/modules/claim/front/photos/index.js
@@ -93,7 +93,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope', 'vnFile'];
-ngModule.component('vnClaimPhotos', {
+ngModule.vnComponent('vnClaimPhotos', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/claim/front/photos/index.spec.js b/modules/claim/front/photos/index.spec.js
index 9cb893bae..38e77d13f 100644
--- a/modules/claim/front/photos/index.spec.js
+++ b/modules/claim/front/photos/index.spec.js
@@ -9,7 +9,7 @@ describe('Claim', () => {
beforeEach(ngModule('claim'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
controller = $componentController('vnClaimPhotos', {$element: null, $scope});
diff --git a/modules/claim/front/search-panel/index.js b/modules/claim/front/search-panel/index.js
index b6bd2b974..a7e8fb046 100644
--- a/modules/claim/front/search-panel/index.js
+++ b/modules/claim/front/search-panel/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
-ngModule.component('vnClaimSearchPanel', {
+ngModule.vnComponent('vnClaimSearchPanel', {
template: require('./index.html'),
controller: SearchPanel
});
diff --git a/modules/claim/front/summary/index.js b/modules/claim/front/summary/index.js
index 6e62252d5..6991e0975 100644
--- a/modules/claim/front/summary/index.js
+++ b/modules/claim/front/summary/index.js
@@ -45,7 +45,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope', 'vnFile'];
-ngModule.component('vnClaimSummary', {
+ngModule.vnComponent('vnClaimSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/claim/front/summary/index.spec.js b/modules/claim/front/summary/index.spec.js
index b6e03d929..d6300b30a 100644
--- a/modules/claim/front/summary/index.spec.js
+++ b/modules/claim/front/summary/index.spec.js
@@ -9,7 +9,7 @@ describe('Claim', () => {
beforeEach(ngModule('claim'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
const $element = angular.element(' ');
@@ -20,8 +20,7 @@ describe('Claim', () => {
describe('getSummary()', () => {
it('should perform a query to set summary', () => {
- $httpBackend.when('GET', `Claims/1/getSummary`).respond(200, 24);
- $httpBackend.expect('GET', `Claims/1/getSummary`);
+ $httpBackend.expect('GET', `Claims/1/getSummary`).respond(200, 24);
controller.getSummary();
$httpBackend.flush();
diff --git a/modules/client/back/methods/client/consumption.js b/modules/client/back/methods/client/consumption.js
index cb5b39c29..8430c4661 100644
--- a/modules/client/back/methods/client/consumption.js
+++ b/modules/client/back/methods/client/consumption.js
@@ -17,20 +17,20 @@ module.exports = Self => {
type: 'String',
description: `If it's and integer searchs by id, otherwise it searchs by name`
}, {
- arg: 'itemFk',
- type: 'Integer',
+ arg: 'itemId',
+ type: 'Number',
description: 'Item id'
}, {
- arg: 'categoryFk',
- type: 'Integer',
+ arg: 'categoryId',
+ type: 'Number',
description: 'Category id'
}, {
- arg: 'typeFk',
- type: 'Integer',
+ arg: 'typeId',
+ type: 'Number',
description: 'Item type id',
}, {
- arg: 'buyerFk',
- type: 'Integer',
+ arg: 'buyerId',
+ type: 'Number',
description: 'Buyer id'
}, {
arg: 'from',
@@ -75,6 +75,10 @@ module.exports = Self => {
return {'it.id': value};
case 'buyerId':
return {'it.workerFk': value};
+ case 'from':
+ return {'t.shipped': {gte: value}};
+ case 'to':
+ return {'t.shipped': {lte: value}};
}
});
filter = mergeFilters(filter, {where});
diff --git a/modules/client/back/methods/client/specs/consumption.spec.js b/modules/client/back/methods/client/specs/consumption.spec.js
index e7a42a8da..30a0572b3 100644
--- a/modules/client/back/methods/client/specs/consumption.spec.js
+++ b/modules/client/back/methods/client/specs/consumption.spec.js
@@ -37,4 +37,24 @@ describe('client consumption() filter', () => {
expect(secondRow.quantity).toEqual(15);
expect(thirdRow.quantity).toEqual(20);
});
+
+ it('should return a list of tickets from the item id 4', async() => {
+ const ctx = {req: {accessToken: {userId: 9}},
+ args: {
+ itemId: 4
+ }
+ };
+ const filter = {
+ where: {
+ clientFk: 101
+ },
+ order: 'itemTypeFk, itemName, itemSize'
+ };
+ const result = await app.models.Client.consumption(ctx, filter);
+
+ const expectedItemId = 4;
+ const firstRow = result[0];
+
+ expect(firstRow.itemFk).toEqual(expectedItemId);
+ });
});
diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js
index 18519d440..1483af48b 100644
--- a/modules/client/back/methods/client/specs/getCard.spec.js
+++ b/modules/client/back/methods/client/specs/getCard.spec.js
@@ -7,6 +7,6 @@ describe('Client get', () => {
expect(result.id).toEqual(101);
expect(result.name).toEqual('Bruce Wayne');
- expect(result.debt).toEqual(889.38);
+ expect(result.debt).toEqual(879.38);
});
});
diff --git a/modules/client/back/methods/client/specs/getDebt.spec.js b/modules/client/back/methods/client/specs/getDebt.spec.js
index 9e539c219..60696e344 100644
--- a/modules/client/back/methods/client/specs/getDebt.spec.js
+++ b/modules/client/back/methods/client/specs/getDebt.spec.js
@@ -4,7 +4,7 @@ describe('client getDebt()', () => {
it('should return the client debt', async() => {
let result = await app.models.Client.getDebt(101);
- expect(result.debt).toEqual(889.38);
+ expect(result.debt).toEqual(879.38);
});
});
diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js
index e4ebd9c67..3c79060a8 100644
--- a/modules/client/back/methods/client/specs/summary.spec.js
+++ b/modules/client/back/methods/client/specs/summary.spec.js
@@ -17,7 +17,7 @@ describe('client summary()', () => {
it('should return a summary object containing debt', async() => {
let result = await app.models.Client.summary(101);
- expect(result.debt.debt).toEqual(889.38);
+ expect(result.debt.debt).toEqual(879.38);
});
it('should return a summary object containing averageInvoiced', async() => {
diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js
index 532d72811..b32249d4b 100644
--- a/modules/client/back/methods/receipt/filter.js
+++ b/modules/client/back/methods/receipt/filter.js
@@ -42,11 +42,11 @@ module.exports = Self => {
r.workerFk,
c.code company,
r.created,
- r.invoiceFk ref,
+ r.invoiceFk description,
NULL debit,
r.amountPaid credit,
r.bankFk,
- u.nickname userNickname,
+ u.name userName,
r.clientFk,
FALSE hasPdf,
FALSE isInvoice
diff --git a/modules/client/front/address/create/index.js b/modules/client/front/address/create/index.js
index 79774cf93..02c98ab3b 100644
--- a/modules/client/front/address/create/index.js
+++ b/modules/client/front/address/create/index.js
@@ -79,7 +79,7 @@ export default class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientAddressCreate', {
+ngModule.vnComponent('vnClientAddressCreate', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/address/create/index.spec.js b/modules/client/front/address/create/index.spec.js
index 4f332e75e..1a4340115 100644
--- a/modules/client/front/address/create/index.spec.js
+++ b/modules/client/front/address/create/index.spec.js
@@ -11,7 +11,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
$state = _$state_;
diff --git a/modules/client/front/address/edit/index.js b/modules/client/front/address/edit/index.js
index 58bca6322..363621327 100644
--- a/modules/client/front/address/edit/index.js
+++ b/modules/client/front/address/edit/index.js
@@ -81,7 +81,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnClientAddressEdit', {
+ngModule.vnComponent('vnClientAddressEdit', {
template: require('./index.html'),
controller: Controller,
require: {
diff --git a/modules/client/front/address/edit/index.spec.js b/modules/client/front/address/edit/index.spec.js
index c4c1a78b5..f763495ac 100644
--- a/modules/client/front/address/edit/index.spec.js
+++ b/modules/client/front/address/edit/index.spec.js
@@ -10,7 +10,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
$state = _$state_;
diff --git a/modules/client/front/address/index/index.html b/modules/client/front/address/index/index.html
index bd5d10fd2..51b310128 100644
--- a/modules/client/front/address/index/index.html
+++ b/modules/client/front/address/index/index.html
@@ -46,7 +46,11 @@
style="overflow: hidden; min-width: 14em;">
{{::address.nickname}} - #{{::address.id}}
{{::address.street}}
- {{::address.city}}, {{::address.province.name}}
+
+ {{::address.postalCode}} -
+ {{::address.city}},
+ {{::address.province.name}}
+
{{::address.phone}}
,
{{::address.mobile}}
diff --git a/modules/client/front/address/index/index.js b/modules/client/front/address/index/index.js
index 6a9d7507b..3a2b5dfa8 100644
--- a/modules/client/front/address/index/index.js
+++ b/modules/client/front/address/index/index.js
@@ -16,7 +16,8 @@ class Controller extends Section {
'provinceFk',
'phone',
'mobile',
- 'isEqualizated'
+ 'isEqualizated',
+ 'postalCode'
],
order: [
'isDefaultAddress DESC',
@@ -50,7 +51,7 @@ class Controller extends Section {
if (res.data) {
this.client.defaultAddressFk = res.data.defaultAddressFk;
this.sortAddresses();
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ this.vnApp.showSuccess(this.$t('Data saved!'));
}
});
}
@@ -80,7 +81,7 @@ class Controller extends Section {
}
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientAddressIndex', {
+ngModule.vnComponent('vnClientAddressIndex', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js
index 4240e8629..c7b4985c8 100644
--- a/modules/client/front/address/index/index.spec.js
+++ b/modules/client/front/address/index/index.spec.js
@@ -10,7 +10,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => {
$stateParams = _$stateParams_;
$stateParams.id = 1;
$httpBackend = _$httpBackend_;
@@ -28,8 +28,7 @@ describe('Client', () => {
let data = {defaultAddressFk: address.id};
let expectedResult = {defaultAddressFk: address.id};
- $httpBackend.when('PATCH', `Clients/1`, data).respond(200, expectedResult);
- $httpBackend.expect('PATCH', `Clients/1`, data);
+ $httpBackend.expect('PATCH', `Clients/1`, data).respond(200, expectedResult);
controller.setDefault(address);
$httpBackend.flush();
diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html
index 506e86f4b..6cfdc0666 100644
--- a/modules/client/front/balance/create/index.html
+++ b/modules/client/front/balance/create/index.html
@@ -17,11 +17,17 @@
+ fields="['accountingTypeFk']"
+ include="{relation: 'accountingType'}"
+ order="id"
+ ng-model="$ctrl.receipt.bankFk"
+ search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}"
+ selection="$ctrl.bankSelection">
+ {{id}}: {{bank}}
+
+
+
+
diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js
index 880774f55..8b01cab4a 100644
--- a/modules/client/front/balance/create/index.js
+++ b/modules/client/front/balance/create/index.js
@@ -50,6 +50,19 @@ class Controller extends Dialog {
return this.receipt.description;
}
+ get bankSelection() {
+ return this._bankSelection;
+ }
+
+ set bankSelection(value) {
+ this._bankSelection = value;
+
+ if (value) {
+ const accountingType = value.accountingType;
+ this.receipt.description = accountingType && accountingType.receiptDescription;
+ }
+ }
+
getAmountPaid() {
const filter = {
where: {
diff --git a/modules/client/front/balance/create/index.spec.js b/modules/client/front/balance/create/index.spec.js
new file mode 100644
index 000000000..11fdb1040
--- /dev/null
+++ b/modules/client/front/balance/create/index.spec.js
@@ -0,0 +1,76 @@
+import './index';
+
+describe('Client', () => {
+ describe('Component vnClientBalancCreate', () => {
+ let controller;
+ let $httpBackend;
+ let $httpParamSerializer;
+
+ beforeEach(ngModule('client'));
+
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
+ $httpBackend = _$httpBackend_;
+ $httpParamSerializer = _$httpParamSerializer_;
+ let $scope = $rootScope.$new();
+ const $element = angular.element(' ');
+ const $transclude = {
+ $$boundTransclude: {
+ $$slots: []
+ }
+ };
+ controller = $componentController('vnClientBalanceCreate', {$element, $scope, $transclude});
+ controller.receipt = {
+ clientFk: 101,
+ companyFk: 442
+ };
+ }));
+
+ describe('bankSelection() setter', () => {
+ it('should set the receipt description property', () => {
+ controller.bankSelection = {
+ id: 1,
+ bank: 'Cash',
+ accountingType: {
+ id: 2,
+ receiptDescription: 'Cash'
+ }
+ };
+
+ expect(controller.receipt.description).toEqual('Cash');
+ });
+ });
+
+ describe('getAmountPaid()', () => {
+ it('should make an http GET query and then set the receipt amountPaid property', () => {
+ controller.$params = {id: 101};
+ const receipt = controller.receipt;
+ const filter = {
+ where: {
+ clientFk: 101,
+ companyFk: 442
+ }
+ };
+ const serializedParams = $httpParamSerializer({filter});
+ $httpBackend.expect('GET', `ClientRisks?${serializedParams}`,).respond([{amount: 20}]);
+ controller.getAmountPaid();
+ $httpBackend.flush();
+
+ expect(receipt.amountPaid).toEqual(20);
+ });
+ });
+
+ describe('responseHandler()', () => {
+ it('should make an http POST query and then call to the parent responseHandler() method', () => {
+ jest.spyOn(controller.vnApp, 'showSuccess');
+
+ controller.$params = {id: 101};
+
+ $httpBackend.expect('POST', `Receipts`,).respond({id: 1});
+ controller.responseHandler('accept');
+ $httpBackend.flush();
+
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
+ });
+ });
+ });
+});
diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html
index 1ad7efad9..cf0c07cfc 100644
--- a/modules/client/front/balance/index/index.html
+++ b/modules/client/front/balance/index/index.html
@@ -68,25 +68,33 @@
- {{::balance.userNickname}}
+ {{::balance.userName}}
-
-
-
- {{'BILL' | translate: {ref: balance.ref} }}
-
-
- {{::balance.ref}}
-
-
-
+
+
+
+
+ {{'BILL' | translate: {ref: balance.description} }}
+
+
+ {{balance.description}}
+
+
+
+
+
+
+
+
{{::balance.bankFk}}
{{::balance.debit | currency: 'EUR':2}}
{{::balance.credit | currency: 'EUR':2}}
diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js
index 582456d85..7e09e018c 100644
--- a/modules/client/front/balance/index/index.js
+++ b/modules/client/front/balance/index/index.js
@@ -39,6 +39,10 @@ class Controller extends Section {
this.getBalances();
}
+ get isAdministrative() {
+ return this.aclService.hasAny(['administrative']);
+ }
+
getData() {
return this.$.model.applyFilter(null, {
clientId: this.$params.id,
@@ -58,7 +62,7 @@ class Controller extends Section {
return balance.companyFk === selectedCompany;
});
- return currentBalance.amount;
+ return currentBalance && currentBalance.amount;
}
getBalances() {
@@ -79,11 +83,18 @@ class Controller extends Section {
this.$.invoiceOutDescriptor.show(event.target, balance.id);
}
+
+ changeDescription(balance) {
+ const params = {description: balance.description};
+ const endpoint = `Receipts/${balance.id}`;
+ this.$http.patch(endpoint, params)
+ .then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
+ }
}
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientBalanceIndex', {
+ngModule.vnComponent('vnClientBalanceIndex', {
template: require('./index.html'),
controller: Controller,
});
diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js
index 6a7a6e321..bdbea3846 100644
--- a/modules/client/front/balance/index/index.spec.js
+++ b/modules/client/front/balance/index/index.spec.js
@@ -3,10 +3,12 @@ import './index';
describe('Client', () => {
describe('Component vnClientBalanceIndex', () => {
let controller;
+ let $httpBackend;
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
+ $httpBackend = _$httpBackend_;
let $scope = $rootScope.$new();
const $element = angular.element(' ');
controller = $componentController('vnClientBalanceIndex', {$element, $scope});
@@ -133,5 +135,21 @@ describe('Client', () => {
expect(controller.getBalances).toHaveBeenCalledWith();
});
});
+
+ describe('changeDescription()', () => {
+ it('should make an http PATCH query', () => {
+ const expectedParams = {description: 'Web'};
+
+ $httpBackend.expect('PATCH', `Receipts/1`, expectedParams).respond(200);
+ controller.changeDescription({
+ id: 1,
+ description: 'Web',
+ accountingType: {
+ description: 'Cash'
+ }
+ });
+ $httpBackend.flush();
+ });
+ });
});
});
diff --git a/modules/client/front/basic-data/index.js b/modules/client/front/basic-data/index.js
index 5d491ec75..3dc7dbc2d 100644
--- a/modules/client/front/basic-data/index.js
+++ b/modules/client/front/basic-data/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
-ngModule.component('vnClientBasicData', {
+ngModule.vnComponent('vnClientBasicData', {
template: require('./index.html'),
controller: Section,
bindings: {
diff --git a/modules/client/front/billing-data/index.js b/modules/client/front/billing-data/index.js
index 589c4f528..2dda347b9 100644
--- a/modules/client/front/billing-data/index.js
+++ b/modules/client/front/billing-data/index.js
@@ -77,7 +77,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnClientBillingData', {
+ngModule.vnComponent('vnClientBillingData', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/billing-data/index.spec.js b/modules/client/front/billing-data/index.spec.js
index 1b295abeb..dd44bd0fa 100644
--- a/modules/client/front/billing-data/index.spec.js
+++ b/modules/client/front/billing-data/index.spec.js
@@ -9,7 +9,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
let $element = angular.element(' ');
$httpBackend = _$httpBackend_;
vnApp = _vnApp_;
diff --git a/modules/client/front/card/index.js b/modules/client/front/card/index.js
index 5aacc83ea..76a4711d1 100644
--- a/modules/client/front/card/index.js
+++ b/modules/client/front/card/index.js
@@ -8,7 +8,7 @@ export default class Controller extends ModuleCard {
}
}
-ngModule.component('vnClientCard', {
+ngModule.vnComponent('vnClientCard', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/card/index.spec.js b/modules/client/front/card/index.spec.js
index 72272fe89..979497253 100644
--- a/modules/client/front/card/index.spec.js
+++ b/modules/client/front/card/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('
');
diff --git a/modules/client/front/consumption-search-panel/index.js b/modules/client/front/consumption-search-panel/index.js
index 9b9354a93..685c0c1f5 100644
--- a/modules/client/front/consumption-search-panel/index.js
+++ b/modules/client/front/consumption-search-panel/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
-ngModule.component('vnConsumptionSearchPanel', {
+ngModule.vnComponent('vnConsumptionSearchPanel', {
template: require('./index.html'),
controller: SearchPanel
});
diff --git a/modules/client/front/consumption/index.js b/modules/client/front/consumption/index.js
index 4b075abb9..e36e94682 100644
--- a/modules/client/front/consumption/index.js
+++ b/modules/client/front/consumption/index.js
@@ -57,7 +57,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail'];
-ngModule.component('vnClientConsumption', {
+ngModule.vnComponent('vnClientConsumption', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/consumption/index.spec.js b/modules/client/front/consumption/index.spec.js
index d76bc1e76..9fe92fee1 100644
--- a/modules/client/front/consumption/index.spec.js
+++ b/modules/client/front/consumption/index.spec.js
@@ -10,7 +10,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => {
$scope = $rootScope.$new();
$httpParamSerializer = _$httpParamSerializer_;
$httpBackend = _$httpBackend_;
diff --git a/modules/client/front/contact/index.js b/modules/client/front/contact/index.js
index 4f29ddb8c..d79c7645a 100644
--- a/modules/client/front/contact/index.js
+++ b/modules/client/front/contact/index.js
@@ -5,7 +5,7 @@ class Controller extends Section {
add() {
this.$.model.insert({
clientFk: this.client.id,
- name: this.$translate.instant('Phone'),
+ name: this.$t('Phone'),
phone: null
});
}
@@ -19,7 +19,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClientContact', {
+ngModule.vnComponent('vnClientContact', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/create/index.js b/modules/client/front/create/index.js
index 4f7ce4104..d8ded6560 100644
--- a/modules/client/front/create/index.js
+++ b/modules/client/front/create/index.js
@@ -86,7 +86,7 @@ export default class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientCreate', {
+ngModule.vnComponent('vnClientCreate', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/create/index.spec.js b/modules/client/front/create/index.spec.js
index c6c31c084..24fc80d21 100644
--- a/modules/client/front/create/index.spec.js
+++ b/modules/client/front/create/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
+ beforeEach(inject(($componentController, $rootScope, _$state_) => {
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = {
diff --git a/modules/client/front/credit-insurance/create/index.js b/modules/client/front/credit-insurance/create/index.js
index 5ea2a8039..83dc18806 100644
--- a/modules/client/front/credit-insurance/create/index.js
+++ b/modules/client/front/credit-insurance/create/index.js
@@ -11,7 +11,7 @@ class Controller extends Section {
onSubmit() {
if (this.$.form.$invalid)
- return this.vnApp.showError(this.$translate.instant('Some fields are invalid'));
+ return this.vnApp.showError(this.$t('Some fields are invalid'));
let query = `creditClassifications/createWithInsurance`;
let data = this.creditClassification;
@@ -28,7 +28,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientCreditInsuranceCreate', {
+ngModule.vnComponent('vnClientCreditInsuranceCreate', {
template: require('./index.html'),
controller: Controller,
require: {
diff --git a/modules/client/front/credit-insurance/create/index.spec.js b/modules/client/front/credit-insurance/create/index.spec.js
index 29bd2c11e..83cec62f8 100644
--- a/modules/client/front/credit-insurance/create/index.spec.js
+++ b/modules/client/front/credit-insurance/create/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
$scope.form = {
diff --git a/modules/client/front/credit-insurance/index/index.html b/modules/client/front/credit-insurance/index/index.html
index d2bf1fef6..b3ebb070d 100644
--- a/modules/client/front/credit-insurance/index/index.html
+++ b/modules/client/front/credit-insurance/index/index.html
@@ -60,7 +60,7 @@
\ No newline at end of file
diff --git a/modules/client/front/credit-insurance/index/index.js b/modules/client/front/credit-insurance/index/index.js
index e386444f4..5f59c918a 100644
--- a/modules/client/front/credit-insurance/index/index.js
+++ b/modules/client/front/credit-insurance/index/index.js
@@ -51,17 +51,15 @@ class Controller extends Section {
this.$.closeContract.show();
}
- returnDialog(response) {
- if (response === 'accept') {
- let params = {finished: Date.now()};
- this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => {
- this._getClassifications(this.client.id);
- });
- }
+ returnDialog() {
+ let params = {finished: Date.now()};
+ this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => {
+ this._getClassifications(this.client.id);
+ });
}
}
-ngModule.component('vnClientCreditInsuranceIndex', {
+ngModule.vnComponent('vnClientCreditInsuranceIndex', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/credit-insurance/index/index.spec.js b/modules/client/front/credit-insurance/index/index.spec.js
index bed58a7d6..678301f28 100644
--- a/modules/client/front/credit-insurance/index/index.spec.js
+++ b/modules/client/front/credit-insurance/index/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
@@ -77,9 +77,8 @@ describe('Client', () => {
it('should call the returnDialog method and perform a PATCH query, then call _getClassifications method', () => {
jest.spyOn(controller, '_getClassifications').mockReturnThis();
controller.classificationId = 1;
- $httpBackend.when('PATCH', `CreditClassifications/1`).respond(200);
- $httpBackend.expect('PATCH', `CreditClassifications/1`);
- controller.returnDialog('accept');
+ $httpBackend.expect('PATCH', `CreditClassifications/1`).respond(200);
+ controller.returnDialog();
$httpBackend.flush();
expect(controller._getClassifications).toHaveBeenCalledWith(101);
diff --git a/modules/client/front/credit-insurance/insurance/create/index.js b/modules/client/front/credit-insurance/insurance/create/index.js
index 2363cac76..94de53352 100644
--- a/modules/client/front/credit-insurance/insurance/create/index.js
+++ b/modules/client/front/credit-insurance/insurance/create/index.js
@@ -21,7 +21,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientCreditInsuranceInsuranceCreate', {
+ngModule.vnComponent('vnClientCreditInsuranceInsuranceCreate', {
template: require('./index.html'),
controller: Controller,
require: {
diff --git a/modules/client/front/credit-insurance/insurance/index/index.js b/modules/client/front/credit-insurance/insurance/index/index.js
index f78d06785..193a0b088 100644
--- a/modules/client/front/credit-insurance/insurance/index/index.js
+++ b/modules/client/front/credit-insurance/insurance/index/index.js
@@ -29,7 +29,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientCreditInsuranceInsuranceIndex', {
+ngModule.vnComponent('vnClientCreditInsuranceInsuranceIndex', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/credit-insurance/insurance/index/index.spec.js b/modules/client/front/credit-insurance/insurance/index/index.spec.js
index 490d6a924..34e557fa4 100644
--- a/modules/client/front/credit-insurance/insurance/index/index.spec.js
+++ b/modules/client/front/credit-insurance/insurance/index/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
const $element = angular.element(' ');
diff --git a/modules/client/front/credit/create/index.html b/modules/client/front/credit/create/index.html
index c77c1556c..e3160a2ae 100644
--- a/modules/client/front/credit/create/index.html
+++ b/modules/client/front/credit/create/index.html
@@ -25,7 +25,7 @@
diff --git a/modules/client/front/credit/create/index.js b/modules/client/front/credit/create/index.js
index 049c206b3..3c1d376ed 100644
--- a/modules/client/front/credit/create/index.js
+++ b/modules/client/front/credit/create/index.js
@@ -16,9 +16,8 @@ class Controller extends Section {
this.goToIndex();
}
- returnDialog(response) {
- if (response === 'accept')
- this.addCredit();
+ returnDialog() {
+ this.addCredit();
}
goToIndex() {
@@ -34,7 +33,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClientCreditCreate', {
+ngModule.vnComponent('vnClientCreditCreate', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/credit/create/index.spec.js b/modules/client/front/credit/create/index.spec.js
index a69fb64a9..2fda0af65 100644
--- a/modules/client/front/credit/create/index.spec.js
+++ b/modules/client/front/credit/create/index.spec.js
@@ -10,7 +10,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope, _$state_) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _$state_) => {
$scope = $rootScope.$new();
$scope.confirmation = {show: () => {
return {
@@ -75,7 +75,7 @@ describe('Client', () => {
describe('returnDialog()', () => {
it('should call addCredit() when is called with accept', () => {
jest.spyOn(controller, 'addCredit');
- controller.returnDialog('accept');
+ controller.returnDialog();
expect(controller.addCredit).toHaveBeenCalledWith();
});
diff --git a/modules/client/front/credit/index/index.js b/modules/client/front/credit/index/index.js
index bea30b2d1..151aa35d6 100644
--- a/modules/client/front/credit/index/index.js
+++ b/modules/client/front/credit/index/index.js
@@ -25,7 +25,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientCreditIndex', {
+ngModule.vnComponent('vnClientCreditIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/dms/create/index.js b/modules/client/front/dms/create/index.js
index 0422ab6a6..3c3f20100 100644
--- a/modules/client/front/dms/create/index.js
+++ b/modules/client/front/dms/create/index.js
@@ -33,7 +33,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
- return this.$translate.instant('ContentTypesInfo', {
+ return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@@ -51,7 +51,7 @@ class Controller extends Section {
warehouseId: warehouseId,
companyId: companyId,
dmsTypeId: dmsType.id,
- description: this.$translate.instant('ClientFileDescription', {
+ description: this.$t('ClientFileDescription', {
dmsTypeName: dmsType.name,
clientId: this.client.id,
clientName: this.client.name
@@ -83,7 +83,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('client.card.dms.index');
}
@@ -104,7 +104,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientDmsCreate', {
+ngModule.vnComponent('vnClientDmsCreate', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/dms/create/index.spec.js b/modules/client/front/dms/create/index.spec.js
index 0f0e2cb09..0ed3f6671 100644
--- a/modules/client/front/dms/create/index.spec.js
+++ b/modules/client/front/dms/create/index.spec.js
@@ -9,7 +9,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_;
@@ -39,8 +39,7 @@ describe('Client', () => {
where: {code: 'paymentsLaw'}
}};
let serializedParams = $httpParamSerializer(params);
- $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'});
- $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`);
+ $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'});
controller.setDefaultParams();
$httpBackend.flush();
@@ -63,8 +62,7 @@ describe('Client', () => {
describe('getAllowedContentTypes()', () => {
it('should make an HTTP GET request to get the allowed content types', () => {
const expectedResponse = ['image/png', 'image/jpg'];
- $httpBackend.when('GET', `clientDms/allowedContentTypes`).respond(expectedResponse);
- $httpBackend.expect('GET', `clientDms/allowedContentTypes`);
+ $httpBackend.expect('GET', `clientDms/allowedContentTypes`).respond(expectedResponse);
controller.getAllowedContentTypes();
$httpBackend.flush();
diff --git a/modules/client/front/dms/edit/index.js b/modules/client/front/dms/edit/index.js
index dedd67e3f..2b8a7046d 100644
--- a/modules/client/front/dms/edit/index.js
+++ b/modules/client/front/dms/edit/index.js
@@ -24,7 +24,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
- return this.$translate.instant('ContentTypesInfo', {
+ return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@@ -67,7 +67,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('client.card.dms.index');
}
@@ -85,7 +85,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClientDmsEdit', {
+ngModule.vnComponent('vnClientDmsEdit', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/dms/edit/index.spec.js b/modules/client/front/dms/edit/index.spec.js
index f4aaf52f8..e52ab7f7b 100644
--- a/modules/client/front/dms/edit/index.spec.js
+++ b/modules/client/front/dms/edit/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
const $element = angular.element(' ');
@@ -45,7 +45,6 @@ describe('Client', () => {
hasFileAttached: false
};
- $httpBackend.when('GET', `Dms/${dmsId}`).respond(expectedResponse);
$httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse);
controller.setDefaultParams();
$httpBackend.flush();
@@ -70,8 +69,7 @@ describe('Client', () => {
describe('getAllowedContentTypes()', () => {
it('should make an HTTP GET request to get the allowed content types', () => {
const expectedResponse = ['image/png', 'image/jpg'];
- $httpBackend.when('GET', `clientDms/allowedContentTypes`).respond(expectedResponse);
- $httpBackend.expect('GET', `clientDms/allowedContentTypes`);
+ $httpBackend.expect('GET', `clientDms/allowedContentTypes`).respond(expectedResponse);
controller.getAllowedContentTypes();
$httpBackend.flush();
diff --git a/modules/client/front/dms/index/index.js b/modules/client/front/dms/index/index.js
index c80b65c9f..c65de39e4 100644
--- a/modules/client/front/dms/index/index.js
+++ b/modules/client/front/dms/index/index.js
@@ -58,7 +58,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope', 'vnFile'];
-ngModule.component('vnClientDmsIndex', {
+ngModule.vnComponent('vnClientDmsIndex', {
template: require('./index.html'),
controller: Controller,
});
diff --git a/modules/client/front/dms/index/index.spec.js b/modules/client/front/dms/index/index.spec.js
index e94cca806..71c8d74a9 100644
--- a/modules/client/front/dms/index/index.spec.js
+++ b/modules/client/front/dms/index/index.spec.js
@@ -9,7 +9,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
controller = $componentController('vnClientDmsIndex', {$element: null, $scope});
diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js
index 92e27e54f..30c7d7656 100644
--- a/modules/client/front/fiscal-data/index.js
+++ b/modules/client/front/fiscal-data/index.js
@@ -65,7 +65,7 @@ export default class Controller extends Section {
onAcceptEt() {
const query = `Clients/${this.client.id}/addressesPropagateRe`;
return this.$http.patch(query, {isEqualizated: this.client.isEqualizated}).then(
- () => this.vnApp.showMessage(this.$translate.instant('Equivalent tax spreaded'))
+ () => this.vnApp.showMessage(this.$t('Equivalent tax spreaded'))
);
}
@@ -162,7 +162,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnClientFiscalData', {
+ngModule.vnComponent('vnClientFiscalData', {
template: require('./index.html'),
controller: Controller,
require: {card: '^vnClientCard'},
diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js
index 29608303c..e028d01f3 100644
--- a/modules/client/front/fiscal-data/index.spec.js
+++ b/modules/client/front/fiscal-data/index.spec.js
@@ -10,7 +10,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
$scope.watcher = watcher;
@@ -126,8 +126,7 @@ describe('Client', () => {
describe('onAcceptEt()', () => {
it('should request to patch the propagation of tax status', () => {
controller.client = {id: 123, isEqualizated: false};
- $httpBackend.when('PATCH', `Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done');
- $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated});
+ $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done');
controller.onAcceptEt();
$httpBackend.flush();
});
diff --git a/modules/client/front/greuge/create/index.js b/modules/client/front/greuge/create/index.js
index 3154d15f0..baf9f6a49 100644
--- a/modules/client/front/greuge/create/index.js
+++ b/modules/client/front/greuge/create/index.js
@@ -28,7 +28,7 @@ class Controller extends Section {
}
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientGreugeCreate', {
+ngModule.vnComponent('vnClientGreugeCreate', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/greuge/create/index.spec.js b/modules/client/front/greuge/create/index.spec.js
index cb52ae2a7..2d900d258 100644
--- a/modules/client/front/greuge/create/index.spec.js
+++ b/modules/client/front/greuge/create/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
+ beforeEach(inject(($componentController, $rootScope, _$state_) => {
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = {
diff --git a/modules/client/front/greuge/index/index.js b/modules/client/front/greuge/index/index.js
index bacb93544..2451167a4 100644
--- a/modules/client/front/greuge/index/index.js
+++ b/modules/client/front/greuge/index/index.js
@@ -20,7 +20,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientGreugeIndex', {
+ngModule.vnComponent('vnClientGreugeIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html
index 6a64954aa..7493ecace 100644
--- a/modules/client/front/index/index.html
+++ b/modules/client/front/index/index.html
@@ -65,5 +65,4 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/modules/client/front/index/index.js b/modules/client/front/index/index.js
index f5400e05a..07d4a8803 100644
--- a/modules/client/front/index/index.js
+++ b/modules/client/front/index/index.js
@@ -21,7 +21,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnClientIndex', {
+ngModule.vnComponent('vnClientIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/index/index.spec.js b/modules/client/front/index/index.spec.js
index 110db5e6a..4fc2c4f8c 100644
--- a/modules/client/front/index/index.spec.js
+++ b/modules/client/front/index/index.spec.js
@@ -7,7 +7,7 @@ describe('Client index', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope) => {
+ beforeEach(inject(($componentController, _$state_, $rootScope) => {
$state = _$state_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
diff --git a/modules/client/front/log/index.js b/modules/client/front/log/index.js
index e4cac6e58..f4aa99bfd 100644
--- a/modules/client/front/log/index.js
+++ b/modules/client/front/log/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
-ngModule.component('vnClientLog', {
+ngModule.vnComponent('vnClientLog', {
template: require('./index.html'),
controller: Section,
});
diff --git a/modules/client/front/mandate/index.js b/modules/client/front/mandate/index.js
index 640678e42..114e2b570 100644
--- a/modules/client/front/mandate/index.js
+++ b/modules/client/front/mandate/index.js
@@ -24,7 +24,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientMandate', {
+ngModule.vnComponent('vnClientMandate', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/note/create/index.js b/modules/client/front/note/create/index.js
index 108aba407..c540c3a0b 100644
--- a/modules/client/front/note/create/index.js
+++ b/modules/client/front/note/create/index.js
@@ -15,7 +15,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnNoteCreate', {
+ngModule.vnComponent('vnNoteCreate', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/note/create/index.spec.js b/modules/client/front/note/create/index.spec.js
index 0dc515b1e..117aa0720 100644
--- a/modules/client/front/note/create/index.spec.js
+++ b/modules/client/front/note/create/index.spec.js
@@ -7,7 +7,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$state_) => {
+ beforeEach(inject(($componentController, _$state_) => {
$state = _$state_;
$state.params.id = '1234';
const $element = angular.element(' ');
diff --git a/modules/client/front/note/index/index.js b/modules/client/front/note/index/index.js
index 654c460e4..ed15db671 100644
--- a/modules/client/front/note/index/index.js
+++ b/modules/client/front/note/index/index.js
@@ -13,7 +13,7 @@ export default class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientNote', {
+ngModule.vnComponent('vnClientNote', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/postcode/index.js b/modules/client/front/postcode/index.js
index c05ea0518..aca7a44d3 100644
--- a/modules/client/front/postcode/index.js
+++ b/modules/client/front/postcode/index.js
@@ -35,18 +35,18 @@ class Controller extends Component {
throw new Error(`The town can't be empty`);
this.$http.patch(`postcodes`, this.data).then(res => {
- this.vnApp.showMessage(this.$translate.instant('The postcode has been saved'));
+ this.vnApp.showMessage(this.$t('The postcode has been saved'));
this.emit('response', {$response: res.data});
});
} catch (e) {
- this.vnApp.showError(this.$translate.instant(e.message));
+ this.vnApp.showError(this.$t(e.message));
return false;
}
return true;
}
}
-ngModule.component('vnClientPostcode', {
+ngModule.vnComponent('vnClientPostcode', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/postcode/index.spec.js b/modules/client/front/postcode/index.spec.js
index 2cefb6985..8778fd9b0 100644
--- a/modules/client/front/postcode/index.spec.js
+++ b/modules/client/front/postcode/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
@@ -22,8 +22,7 @@ describe('Client', () => {
controller.data = {townFk: 1, provinceFk: 1, countryFk: 1, code: '46460'};
jest.spyOn(controller.vnApp, 'showMessage');
- $httpBackend.when('PATCH', `postcodes`, params).respond(200, params);
- $httpBackend.expect('PATCH', `postcodes`, params).respond(params);
+ $httpBackend.expect('PATCH', `postcodes`, params).respond(200, params);
controller.onAccept();
$httpBackend.flush();
diff --git a/modules/client/front/recovery/create/index.js b/modules/client/front/recovery/create/index.js
index aa378203b..4fd05eaa0 100644
--- a/modules/client/front/recovery/create/index.js
+++ b/modules/client/front/recovery/create/index.js
@@ -28,7 +28,7 @@ class Controller extends Section {
}
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientRecoveryCreate', {
+ngModule.vnComponent('vnClientRecoveryCreate', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/recovery/create/index.spec.js b/modules/client/front/recovery/create/index.spec.js
index d2635ee8d..ec9054140 100644
--- a/modules/client/front/recovery/create/index.spec.js
+++ b/modules/client/front/recovery/create/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
+ beforeEach(inject(($componentController, $rootScope, _$state_) => {
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = {
diff --git a/modules/client/front/recovery/index/index.js b/modules/client/front/recovery/index/index.js
index f82430982..d53ded805 100644
--- a/modules/client/front/recovery/index/index.js
+++ b/modules/client/front/recovery/index/index.js
@@ -12,7 +12,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClientRecoveryIndex', {
+ngModule.vnComponent('vnClientRecoveryIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/sample/create/index.js b/modules/client/front/sample/create/index.js
index d1dfd3ff5..bc2cee39d 100644
--- a/modules/client/front/sample/create/index.js
+++ b/modules/client/front/sample/create/index.js
@@ -53,7 +53,7 @@ class Controller extends Section {
sendSample() {
this.send(false, () => {
- this.vnApp.showSuccess(this.$translate.instant('Notification sent!'));
+ this.vnApp.showSuccess(this.$t('Notification sent!'));
this.$state.go('client.card.sample.index');
});
}
@@ -66,13 +66,13 @@ class Controller extends Section {
};
if (!params.recipient)
- return this.vnApp.showError(this.$translate.instant('Email cannot be blank'));
+ return this.vnApp.showError(this.$t('Email cannot be blank'));
if (!sampleType)
- return this.vnApp.showError(this.$translate.instant('Choose a sample'));
+ return this.vnApp.showError(this.$t('Choose a sample'));
if (sampleType.hasCompany && !this.clientSample.companyFk)
- return this.vnApp.showError(this.$translate.instant('Choose a company'));
+ return this.vnApp.showError(this.$t('Choose a company'));
if (sampleType.hasCompany)
params.companyId = this.clientSample.companyFk;
@@ -85,7 +85,7 @@ class Controller extends Section {
}
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientSampleCreate', {
+ngModule.vnComponent('vnClientSampleCreate', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js
index af7f2f3ff..40fa237b6 100644
--- a/modules/client/front/sample/create/index.spec.js
+++ b/modules/client/front/sample/create/index.spec.js
@@ -11,7 +11,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope, _$state_, _$httpParamSerializer_) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _$state_, _$httpParamSerializer_) => {
$scope = $rootScope.$new();
$scope.sampleType = {};
$scope.watcher = {
diff --git a/modules/client/front/sample/index/index.js b/modules/client/front/sample/index/index.js
index c5e8a72cd..e93c2d2dc 100644
--- a/modules/client/front/sample/index/index.js
+++ b/modules/client/front/sample/index/index.js
@@ -33,7 +33,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClientSampleIndex', {
+ngModule.vnComponent('vnClientSampleIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/search-panel/index.js b/modules/client/front/search-panel/index.js
index 8c30982f5..bdbbcdaef 100644
--- a/modules/client/front/search-panel/index.js
+++ b/modules/client/front/search-panel/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
-ngModule.component('vnClientSearchPanel', {
+ngModule.vnComponent('vnClientSearchPanel', {
template: require('./index.html'),
controller: SearchPanel
});
diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html
index fb2f1dfff..6915942c2 100644
--- a/modules/client/front/sms/index.html
+++ b/modules/client/front/sms/index.html
@@ -1,6 +1,6 @@
+ on-accept="$ctrl.onResponse()">
Send SMS
diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js
index 3dfdda8a3..701ee39af 100644
--- a/modules/client/front/sms/index.js
+++ b/modules/client/front/sms/index.js
@@ -16,25 +16,23 @@ class Controller extends Section {
return maxLength - textAreaLength;
}
- onResponse(response) {
- if (response === 'accept') {
- try {
- if (!this.sms.destination)
- throw new Error(`The destination can't be empty`);
- if (!this.sms.message)
- throw new Error(`The message can't be empty`);
- if (this.charactersRemaining() < 0)
- throw new Error(`The message it's too long`);
+ onResponse() {
+ try {
+ if (!this.sms.destination)
+ throw new Error(`The destination can't be empty`);
+ if (!this.sms.message)
+ throw new Error(`The message can't be empty`);
+ if (this.charactersRemaining() < 0)
+ throw new Error(`The message it's too long`);
- this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => {
- this.vnApp.showMessage(this.$translate.instant('SMS sent!'));
+ this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => {
+ this.vnApp.showMessage(this.$t('SMS sent!'));
- if (res.data) this.emit('send', {response: res.data});
- });
- } catch (e) {
- this.vnApp.showError(this.$translate.instant(e.message));
- return false;
- }
+ if (res.data) this.emit('send', {response: res.data});
+ });
+ } catch (e) {
+ this.vnApp.showError(this.$t(e.message));
+ return false;
}
return true;
}
@@ -42,7 +40,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope', '$http', '$translate', 'vnApp'];
-ngModule.component('vnClientSms', {
+ngModule.vnComponent('vnClientSms', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js
index a7b4cd3df..3462bf681 100644
--- a/modules/client/front/sms/index.spec.js
+++ b/modules/client/front/sms/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
let $scope = $rootScope.$new();
$element = angular.element(' ');
@@ -30,7 +30,7 @@ describe('Client', () => {
jest.spyOn(controller.vnApp, 'showMessage');
$httpBackend.expect('POST', `Clients/101/sendSms`, params).respond(200, params);
- controller.onResponse('accept');
+ controller.onResponse();
$httpBackend.flush();
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!');
diff --git a/modules/client/front/summary/index.js b/modules/client/front/summary/index.js
index 4dd299903..5737e2df4 100644
--- a/modules/client/front/summary/index.js
+++ b/modules/client/front/summary/index.js
@@ -38,7 +38,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClientSummary', {
+ngModule.vnComponent('vnClientSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/summary/index.spec.js b/modules/client/front/summary/index.spec.js
index 1c747d25a..05491267c 100644
--- a/modules/client/front/summary/index.spec.js
+++ b/modules/client/front/summary/index.spec.js
@@ -8,7 +8,7 @@ describe('Client', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
@@ -21,8 +21,7 @@ describe('Client', () => {
let res = {name: 'Superman', classifications: []};
jest.spyOn(controller, 'sumRisk').mockReturnThis();
- $httpBackend.when('GET', `Clients/101/summary`).respond(200, res);
- $httpBackend.expect('GET', `Clients/101/summary`);
+ $httpBackend.expect('GET', `Clients/101/summary`).respond(200, res);
controller.$onChanges();
$httpBackend.flush();
diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html
index 590e823d3..f7488dbdf 100644
--- a/modules/client/front/web-access/index.html
+++ b/modules/client/front/web-access/index.html
@@ -34,7 +34,7 @@
+ on-accept="$ctrl.onPassChange()">
{
- this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
- });
- } catch (e) {
- this.vnApp.showError(this.$translate.instant(e.message));
+ this.$http.patch(`Accounts/${this.client.id}`, account).then(res => {
+ this.vnApp.showSuccess(this.$t('Data saved!'));
+ });
+ } catch (e) {
+ this.vnApp.showError(this.$t(e.message));
- return false;
- }
+ return false;
}
return true;
@@ -64,7 +62,7 @@ export default class Controller extends Section {
}
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnClientWebAccess', {
+ngModule.vnComponent('vnClientWebAccess', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js
index 0ed3345d1..73c4f1043 100644
--- a/modules/client/front/web-access/index.spec.js
+++ b/modules/client/front/web-access/index.spec.js
@@ -8,7 +8,7 @@ describe('Component VnClientWebAccess', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
vnApp = _vnApp_;
@@ -57,8 +57,7 @@ describe('Component VnClientWebAccess', () => {
expect(controller.canEnableCheckBox).toBeTruthy();
- $httpBackend.when('GET', `Clients/${controller.client.id}/isValidClient`).respond(false);
- $httpBackend.expectGET(`Clients/${controller.client.id}/isValidClient`);
+ $httpBackend.expectGET(`Clients/${controller.client.id}/isValidClient`).respond(false);
controller.checkConditions();
$httpBackend.flush();
@@ -83,9 +82,8 @@ describe('Component VnClientWebAccess', () => {
controller.newPassword = 'm24x8';
controller.repeatPassword = 'm24x8';
controller.canChangePassword = true;
- $httpBackend.when('PATCH', 'Accounts/1234').respond('done');
- $httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'});
- controller.onPassChange('accept');
+ $httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'}).respond('done');
+ controller.onPassChange();
$httpBackend.flush();
});
@@ -94,7 +92,7 @@ describe('Component VnClientWebAccess', () => {
controller.client = {id: '1234'};
controller.newPassword = '';
controller.canChangePassword = true;
- controller.onPassChange('accept');
+ controller.onPassChange();
expect(vnApp.showError).toHaveBeenCalledWith(`You must enter a new password`);
});
@@ -106,7 +104,7 @@ describe('Component VnClientWebAccess', () => {
controller.newPassword = 'm24x8';
controller.canChangePassword = true;
controller.repeatPassword = 'notMatchingPassword';
- controller.onPassChange('accept');
+ controller.onPassChange();
expect(vnApp.showError).toHaveBeenCalledWith(`Passwords don't match`);
});
diff --git a/modules/client/front/web-payment/index.js b/modules/client/front/web-payment/index.js
index c68abf49e..00d0adc4d 100644
--- a/modules/client/front/web-payment/index.js
+++ b/modules/client/front/web-payment/index.js
@@ -21,7 +21,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnClientWebPayment', {
+ngModule.vnComponent('vnClientWebPayment', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/client/front/web-payment/index.spec.js b/modules/client/front/web-payment/index.spec.js
index ee07f2fff..ee7d6c717 100644
--- a/modules/client/front/web-payment/index.spec.js
+++ b/modules/client/front/web-payment/index.spec.js
@@ -9,7 +9,7 @@ describe('Component vnClientWebPayment', () => {
beforeEach(ngModule('client'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
$scope = $rootScope.$new();
$scope.model = crudModel;
$httpBackend = _$httpBackend_;
@@ -25,8 +25,7 @@ describe('Component vnClientWebPayment', () => {
let query = 'Clients/confirmTransaction';
controller.confirm(transaction);
- $httpBackend.when('POST', query, transaction).respond('ok');
- $httpBackend.expect('POST', query, transaction);
+ $httpBackend.expect('POST', query, transaction).respond('ok');
$httpBackend.flush();
});
});
diff --git a/modules/entry/front/buy/index.js b/modules/entry/front/buy/index.js
index 674243eb1..00a8421fb 100644
--- a/modules/entry/front/buy/index.js
+++ b/modules/entry/front/buy/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
-ngModule.component('vnEntryBuy', {
+ngModule.vnComponent('vnEntryBuy', {
template: require('./index.html'),
controller: Section,
bindings: {
diff --git a/modules/entry/front/card/index.js b/modules/entry/front/card/index.js
index 83f47c83d..f9ab6187c 100644
--- a/modules/entry/front/card/index.js
+++ b/modules/entry/front/card/index.js
@@ -50,7 +50,7 @@ class Controller extends ModuleCard {
}
}
-ngModule.component('vnEntryCard', {
+ngModule.vnComponent('vnEntryCard', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/entry/front/descriptor/index.html b/modules/entry/front/descriptor/index.html
index f0d4491ac..1470eccf4 100644
--- a/modules/entry/front/descriptor/index.html
+++ b/modules/entry/front/descriptor/index.html
@@ -10,9 +10,6 @@
-
-
diff --git a/modules/entry/front/index/index.js b/modules/entry/front/index/index.js
index 60d70afcb..759ce2724 100644
--- a/modules/entry/front/index/index.js
+++ b/modules/entry/front/index/index.js
@@ -3,7 +3,7 @@ import Section from 'salix/components/section';
export default class Controller extends Section {}
-ngModule.component('vnEntryIndex', {
+ngModule.vnComponent('vnEntryIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/entry/front/log/index.js b/modules/entry/front/log/index.js
index d045f2035..73218f4de 100644
--- a/modules/entry/front/log/index.js
+++ b/modules/entry/front/log/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
-ngModule.component('vnEntryLog', {
+ngModule.vnComponent('vnEntryLog', {
template: require('./index.html'),
controller: Section,
});
diff --git a/modules/entry/front/search-panel/index.js b/modules/entry/front/search-panel/index.js
index d728fe5e8..e87f31056 100644
--- a/modules/entry/front/search-panel/index.js
+++ b/modules/entry/front/search-panel/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
-ngModule.component('vnEntrySearchPanel', {
+ngModule.vnComponent('vnEntrySearchPanel', {
template: require('./index.html'),
controller: SearchPanel
});
diff --git a/modules/entry/front/summary/index.js b/modules/entry/front/summary/index.js
index 94eaf1791..f0b4c62b3 100644
--- a/modules/entry/front/summary/index.js
+++ b/modules/entry/front/summary/index.js
@@ -21,7 +21,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnEntrySummary', {
+ngModule.vnComponent('vnEntrySummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/entry/front/summary/index.spec.js b/modules/entry/front/summary/index.spec.js
index a59bb8009..a2d25d0d6 100644
--- a/modules/entry/front/summary/index.spec.js
+++ b/modules/entry/front/summary/index.spec.js
@@ -9,7 +9,7 @@ describe('component vnEntrySummary', () => {
$translateProvider.translations('en', {});
}));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(`
`);
diff --git a/modules/invoiceOut/front/card/index.js b/modules/invoiceOut/front/card/index.js
index 0ad91f4c2..f718f22ae 100644
--- a/modules/invoiceOut/front/card/index.js
+++ b/modules/invoiceOut/front/card/index.js
@@ -32,7 +32,7 @@ class Controller extends ModuleCard {
}
}
-ngModule.component('vnInvoiceOutCard', {
+ngModule.vnComponent('vnInvoiceOutCard', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/invoiceOut/front/index/index.js b/modules/invoiceOut/front/index/index.js
index 17eb44fec..c884fb90b 100644
--- a/modules/invoiceOut/front/index/index.js
+++ b/modules/invoiceOut/front/index/index.js
@@ -13,7 +13,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnInvoiceOutIndex', {
+ngModule.vnComponent('vnInvoiceOutIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/invoiceOut/front/search-panel/index.js b/modules/invoiceOut/front/search-panel/index.js
index 1ca545ec7..a77d479ca 100644
--- a/modules/invoiceOut/front/search-panel/index.js
+++ b/modules/invoiceOut/front/search-panel/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
-ngModule.component('vnInvoiceSearchPanel', {
+ngModule.vnComponent('vnInvoiceSearchPanel', {
template: require('./index.html'),
controller: SearchPanel
});
diff --git a/modules/invoiceOut/front/summary/index.js b/modules/invoiceOut/front/summary/index.js
index ef76768de..dd4237850 100644
--- a/modules/invoiceOut/front/summary/index.js
+++ b/modules/invoiceOut/front/summary/index.js
@@ -19,7 +19,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnInvoiceOutSummary', {
+ngModule.vnComponent('vnInvoiceOutSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/invoiceOut/front/summary/index.spec.js b/modules/invoiceOut/front/summary/index.spec.js
index ac6c40bcf..fadf0ad89 100644
--- a/modules/invoiceOut/front/summary/index.spec.js
+++ b/modules/invoiceOut/front/summary/index.spec.js
@@ -8,7 +8,7 @@ describe('InvoiceOut', () => {
beforeEach(ngModule('invoiceOut'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element('
');
@@ -19,7 +19,6 @@ describe('InvoiceOut', () => {
describe('getSummary()', () => {
it('should perform a query to set summary', () => {
$httpBackend.when('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for');
- $httpBackend.expect('GET', `InvoiceOuts/1/summary`);
controller.getSummary();
$httpBackend.flush();
diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js
index 372648dd6..420b357a5 100644
--- a/modules/item/back/methods/item-image-queue/downloadImages.js
+++ b/modules/item/back/methods/item-image-queue/downloadImages.js
@@ -20,37 +20,66 @@ module.exports = Self => {
const models = Self.app.models;
try {
- const imageQueue = await Self.find({limit: 25});
- const rootPath = models.Image.getPath();
- const tempPath = path.join(rootPath, 'temp');
+ const tempPath = path.join('/tmp/salix-image');
// Create temporary path
await fs.mkdir(tempPath, {recursive: true});
- for (let image of imageQueue) {
+ const timer = setInterval(async() => {
+ const image = await Self.findOne({where: {error: null}});
+
+ // Exit loop
+ if (!image) return clearInterval(timer);
+
const fileName = `${image.itemFk}.png`;
const filePath = path.join(tempPath, fileName);
- const file = fs.createWriteStream(filePath);
- https.get(image.url, async response => {
- response.pipe(file);
+ const writeStream = fs.createWriteStream(filePath);
+ writeStream.on('open', () => {
+ https.get(image.url, async response => {
+ if (response.statusCode != 200) {
+ const error = new Error(`Could not download the image. Status code ${response.statusCode}`);
+
+ return await errorHandler(image.itemFk, error, filePath);
+ }
+
+ response.pipe(writeStream);
+ }).on('error', async error => {
+ await errorHandler(image.itemFk, error, filePath);
+ });
});
- file.on('finish', async function() {
- await models.Image.registerImage('catalog', fileName, filePath);
- await image.destroy();
+ writeStream.on('error', async error => {
+ await errorHandler(image.itemFk, error, filePath);
});
- file.on('error', err => {
- fs.unlink(filePath);
-
- throw err;
+ writeStream.on('finish', async function() {
+ try {
+ await models.Image.registerImage('catalog', fileName, filePath);
+ await image.destroy();
+ } catch (error) {
+ await errorHandler(image.itemFk, error, filePath);
+ }
});
+ }, 1000);
+ } catch (error) {
+ throw new Error('Try-catch error: ', error);
+ }
+
+ async function errorHandler(rowId, error, filePath) {
+ try {
+ const row = await Self.findById(rowId);
+
+ if (!row)
+ throw new Error(`Could not update due error ${error}`);
+
+ await row.updateAttribute('error', error);
+
+ if (filePath && fs.existsSync(filePath))
+ await fs.unlink(filePath);
+ } catch (err) {
+ throw new Error(`ErrorHandler error: ${err}`);
}
-
- return imageQueue;
- } catch (e) {
- throw e;
}
};
};
diff --git a/modules/item/back/methods/item/getLastEntries.js b/modules/item/back/methods/item/getLastEntries.js
deleted file mode 100644
index a438afcb6..000000000
--- a/modules/item/back/methods/item/getLastEntries.js
+++ /dev/null
@@ -1,28 +0,0 @@
-module.exports = Self => {
- Self.remoteMethod('getLastEntries', {
- description: 'Returns last entries',
- accessType: 'READ',
- accepts: [{
- arg: 'filter',
- type: 'object',
- required: true,
- description: 'itemFk, id'
- }],
- returns: {
- type: 'Array',
- root: true
- },
- http: {
- path: `/getLastEntries`,
- verb: 'GET'
- }
- });
-
- Self.getLastEntries = async filter => {
- let where = filter.where;
- let query = `CALL vn.itemLastEntries(?, ?)`;
- let [lastEntries] = await Self.rawSql(query, [where.itemFk, where.date]);
-
- return lastEntries;
- };
-};
diff --git a/modules/item/back/methods/item/lastEntriesFilter.js b/modules/item/back/methods/item/lastEntriesFilter.js
new file mode 100644
index 000000000..63e154b9e
--- /dev/null
+++ b/modules/item/back/methods/item/lastEntriesFilter.js
@@ -0,0 +1,62 @@
+
+const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
+
+module.exports = Self => {
+ Self.remoteMethod('lastEntriesFilter', {
+ description: 'Returns last entries',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'filter',
+ type: 'object',
+ required: true,
+ description: 'itemFk, id'
+ }],
+ returns: {
+ type: 'Array',
+ root: true
+ },
+ http: {
+ path: `/lastEntriesFilter`,
+ verb: 'GET'
+ }
+ });
+
+ Self.lastEntriesFilter = async filter => {
+ const conn = Self.dataSource.connector;
+ const stmt = new ParameterizedSQL(
+ `SELECT
+ w.id AS warehouseFk,
+ w.name AS warehouse,
+ tr.landed,
+ b.id AS buyFk,
+ b.entryFk,
+ b.isIgnored,
+ b.price2,
+ b.price3,
+ b.stickers,
+ b.packing,
+ b.grouping,
+ b.groupingMode,
+ b.weight,
+ i.stems,
+ b.quantity,
+ b.buyingValue,
+ b.packageFk ,
+ s.id AS supplierFk,
+ s.name AS supplier
+ FROM itemType it
+ RIGHT JOIN (entry e
+ LEFT JOIN supplier s ON s.id = e.supplierFk
+ RIGHT JOIN buy b ON b.entryFk = e.id
+ LEFT JOIN item i ON i.id = b.itemFk
+ LEFT JOIN ink ON ink.id = i.inkFk
+ LEFT JOIN travel tr ON tr.id = e.travelFk
+ LEFT JOIN warehouse w ON w.id = tr.warehouseInFk
+ LEFT JOIN origin o ON o.id = i.originFk
+ ) ON it.id = i.typeFk
+ LEFT JOIN edi.ekt ek ON b.ektFk = ek.id`);
+ stmt.merge(conn.makeSuffix(filter));
+
+ return conn.executeStmt(stmt);
+ };
+};
diff --git a/modules/item/back/methods/item/specs/getLastEntries.spec.js b/modules/item/back/methods/item/specs/getLastEntries.spec.js
deleted file mode 100644
index 5c996d8e3..000000000
--- a/modules/item/back/methods/item/specs/getLastEntries.spec.js
+++ /dev/null
@@ -1,22 +0,0 @@
-const app = require('vn-loopback/server/server');
-
-describe('item getLastEntries()', () => {
- it('should return one entry for a given item', async() => {
- let date = new Date();
- let filter = {where: {itemFk: 1, date: date}};
- let result = await app.models.Item.getLastEntries(filter);
-
- expect(result.length).toEqual(1);
- });
-
- it('should return five entries for a given item', async() => {
- let date = new Date();
-
- date.setMonth(date.getMonth() - 2, 1);
-
- let filter = {where: {itemFk: 1, date: date}};
- let result = await app.models.Item.getLastEntries(filter);
-
- expect(result.length).toEqual(5);
- });
-});
diff --git a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js
new file mode 100644
index 000000000..f64bfed8a
--- /dev/null
+++ b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js
@@ -0,0 +1,24 @@
+const app = require('vn-loopback/server/server');
+
+describe('item lastEntriesFilter()', () => {
+ const minDate = new Date(value);
+ minHour.setHours(0, 0, 0, 0);
+ const maxDate = new Date(value);
+ maxHour.setHours(23, 59, 59, 59);
+
+ it('should return one entry for a given item', async() => {
+ const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}};
+ const result = await app.models.Item.lastEntriesFilter(filter);
+
+ expect(result.length).toEqual(1);
+ });
+
+ it('should return five entries for a given item', async() => {
+ minDate.setMonth(minDate.getMonth() - 2, 1);
+
+ const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}};
+ const result = await app.models.Item.lastEntriesFilter(filter);
+
+ expect(result.length).toEqual(5);
+ });
+});
diff --git a/modules/item/back/models/item-image-queue.json b/modules/item/back/models/item-image-queue.json
index 61cb7b018..6e248ac96 100644
--- a/modules/item/back/models/item-image-queue.json
+++ b/modules/item/back/models/item-image-queue.json
@@ -16,6 +16,10 @@
"url": {
"type": "String",
"required": true
+ },
+ "error": {
+ "type": "String",
+ "required": true
}
},
"relations": {
diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js
index d273404ea..9ddd056e6 100644
--- a/modules/item/back/models/item.js
+++ b/modules/item/back/models/item.js
@@ -5,7 +5,7 @@ module.exports = Self => {
require('../methods/item/clone')(Self);
require('../methods/item/updateTaxes')(Self);
require('../methods/item/getBalance')(Self);
- require('../methods/item/getLastEntries')(Self);
+ require('../methods/item/lastEntriesFilter')(Self);
require('../methods/item/getSummary')(Self);
require('../methods/item/getCard')(Self);
require('../methods/item/regularize')(Self);
diff --git a/modules/item/front/barcode/index.js b/modules/item/front/barcode/index.js
index d9e17a42a..4ceb87b9d 100644
--- a/modules/item/front/barcode/index.js
+++ b/modules/item/front/barcode/index.js
@@ -11,7 +11,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnItemBarcode', {
+ngModule.vnComponent('vnItemBarcode', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html
index 7b3504b3c..99146deb0 100644
--- a/modules/item/front/basic-data/index.html
+++ b/modules/item/front/basic-data/index.html
@@ -109,6 +109,14 @@
ng-model="$ctrl.item.density"
rule>
+
+
{
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
diff --git a/modules/item/front/botanical/index.js b/modules/item/front/botanical/index.js
index 03c62a0e3..61eed3ce8 100644
--- a/modules/item/front/botanical/index.js
+++ b/modules/item/front/botanical/index.js
@@ -26,7 +26,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnItemBotanical', {
+ngModule.vnComponent('vnItemBotanical', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/botanical/index.spec.js b/modules/item/front/botanical/index.spec.js
index 1cf79bbb3..24e48e4ae 100644
--- a/modules/item/front/botanical/index.spec.js
+++ b/modules/item/front/botanical/index.spec.js
@@ -8,7 +8,7 @@ describe('ItemBotanical', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js
index 12167500f..8b32e030b 100644
--- a/modules/item/front/card/index.js
+++ b/modules/item/front/card/index.js
@@ -8,7 +8,7 @@ class Controller extends ModuleCard {
}
}
-ngModule.component('vnItemCard', {
+ngModule.vnComponent('vnItemCard', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/card/index.spec.js b/modules/item/front/card/index.spec.js
index c0ea80e69..2c97f5935 100644
--- a/modules/item/front/card/index.spec.js
+++ b/modules/item/front/card/index.spec.js
@@ -8,7 +8,7 @@ describe('Item', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('
');
diff --git a/modules/item/front/create/index.js b/modules/item/front/create/index.js
index ab51b0734..d207e6f5b 100644
--- a/modules/item/front/create/index.js
+++ b/modules/item/front/create/index.js
@@ -18,7 +18,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnItemCreate', {
+ngModule.vnComponent('vnItemCreate', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/create/index.spec.js b/modules/item/front/create/index.spec.js
index 518d5f78b..9e54988d7 100644
--- a/modules/item/front/create/index.spec.js
+++ b/modules/item/front/create/index.spec.js
@@ -8,7 +8,7 @@ describe('Item', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
+ beforeEach(inject(($componentController, $rootScope, _$state_) => {
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = {
diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js
index e1a15096a..953d203e8 100644
--- a/modules/item/front/diary/index.js
+++ b/modules/item/front/diary/index.js
@@ -67,7 +67,7 @@ class Controller extends Section {
Controller.$inject = ['$element', '$scope', '$anchorScroll', '$location'];
-ngModule.component('vnItemDiary', {
+ngModule.vnComponent('vnItemDiary', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js
index b6e50e5c5..52608cde3 100644
--- a/modules/item/front/diary/index.spec.js
+++ b/modules/item/front/diary/index.spec.js
@@ -8,7 +8,7 @@ describe('Item', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, $rootScope) => {
+ beforeEach(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
const $element = angular.element(' ');
controller = $componentController('vnItemDiary', {$element, $scope});
diff --git a/modules/item/front/fetched-tags/index.js b/modules/item/front/fetched-tags/index.js
index 9140abcf4..da18b7a7c 100644
--- a/modules/item/front/fetched-tags/index.js
+++ b/modules/item/front/fetched-tags/index.js
@@ -2,7 +2,7 @@ import ngModule from '../module';
import Component from 'core/lib/component';
import './style.scss';
-ngModule.component('vnFetchedTags', {
+ngModule.vnComponent('vnFetchedTags', {
template: require('./index.html'),
controller: Component,
bindings: {
diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js
index e852d7985..cafa3e475 100644
--- a/modules/item/front/index/index.js
+++ b/modules/item/front/index/index.js
@@ -24,7 +24,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnItemIndex', {
+ngModule.vnComponent('vnItemIndex', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/index/index.spec.js b/modules/item/front/index/index.spec.js
index f8cf07fe3..18abde581 100644
--- a/modules/item/front/index/index.spec.js
+++ b/modules/item/front/index/index.spec.js
@@ -8,7 +8,7 @@ describe('Item', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html
index 6f2dba989..f306fb4f0 100644
--- a/modules/item/front/last-entries/index.html
+++ b/modules/item/front/last-entries/index.html
@@ -1,11 +1,15 @@
+ auto-load="true"
+ order="landed DESC, buyFk DESC"
+ limit="20">
-
+
@@ -20,8 +24,8 @@
Ig
- Warehouse
- Landed
+ Warehouse
+ Landed
Entry
P.P.U
P.P.P
@@ -29,11 +33,11 @@
Packing
Grouping
Stems
- Quantity
+ Quantity
Cost
Kg.
- Cube
- Provider
+ Cube
+ Provider
@@ -70,6 +74,30 @@
-
-
+
+
+
+
+
+ Filter by selection
+
+
+ Exclude selection
+
+
+ Remove filter
+
+
+ Remove all filters
+
+
+
\ No newline at end of file
diff --git a/modules/item/front/last-entries/index.js b/modules/item/front/last-entries/index.js
index 752f1b035..11a2bf20e 100644
--- a/modules/item/front/last-entries/index.js
+++ b/modules/item/front/last-entries/index.js
@@ -6,17 +6,23 @@ class Controller extends Section {
constructor($element, $) {
super($element, $);
- let defaultDate = new Date();
- defaultDate.setDate(defaultDate.getDate() - 75);
- defaultDate.setHours(0, 0, 0, 0);
+ const from = new Date();
+ from.setDate(from.getDate() - 75);
+ from.setHours(0, 0, 0, 0);
+
+ const to = new Date();
+ to.setDate(to.getDate() + 10);
+ to.setHours(23, 59, 59, 59);
this.filter = {
where: {
itemFk: this.$params.id,
- date: defaultDate
+ shipped: {
+ between: [from, to]
+ }
}
};
- this._date = defaultDate;
+ this._date = from;
}
set date(value) {
@@ -31,11 +37,37 @@ class Controller extends Section {
get date() {
return this._date;
}
+
+ exprBuilder(param, value) {
+ switch (param) {
+ case 'id':
+ case 'quantity':
+ case 'packageFk':
+ return {[`b.${param}`]: value};
+ case 'supplierFk':
+ return {[`s.id`]: value};
+ case 'warehouseFk':
+ return {'tr.warehouseInFk': value};
+ case 'landed':
+ return {'tr.landed': {
+ between: this.dateRange(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];
+ }
}
Controller.$inject = ['$element', '$scope'];
-ngModule.component('vnItemLastEntries', {
+ngModule.vnComponent('vnItemLastEntries', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/item/front/log/index.js b/modules/item/front/log/index.js
index 4433b2460..953d48df3 100644
--- a/modules/item/front/log/index.js
+++ b/modules/item/front/log/index.js
@@ -1,7 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
-ngModule.component('vnItemLog', {
+ngModule.vnComponent('vnItemLog', {
template: require('./index.html'),
controller: Section,
});
diff --git a/modules/item/front/niche/index.js b/modules/item/front/niche/index.js
index f4e7cd0be..51621b714 100644
--- a/modules/item/front/niche/index.js
+++ b/modules/item/front/niche/index.js
@@ -11,7 +11,7 @@ export default class Controller extends Section {
}
}
-ngModule.component('vnItemNiche', {
+ngModule.vnComponent('vnItemNiche', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/request-search-panel/index.html b/modules/item/front/request-search-panel/index.html
index 453f3105b..10d5f9762 100644
--- a/modules/item/front/request-search-panel/index.html
+++ b/modules/item/front/request-search-panel/index.html
@@ -56,12 +56,14 @@
label="For me"
ng-model="filter.mine">
-
-
+
+ {{name}}
+
diff --git a/modules/item/front/request-search-panel/index.js b/modules/item/front/request-search-panel/index.js
index 07fcefd6b..823346e30 100644
--- a/modules/item/front/request-search-panel/index.js
+++ b/modules/item/front/request-search-panel/index.js
@@ -1,7 +1,19 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
-ngModule.component('vnRequestSearchPanel', {
+class Controller extends SearchPanel {
+ constructor($element, $) {
+ super($element, $);
+
+ this.states = [
+ {code: 'pending', name: this.$t('Pending')},
+ {code: 'accepted', name: this.$t('Accepted')},
+ {code: 'denied', name: this.$t('Denied')}
+ ];
+ }
+}
+
+ngModule.vnComponent('vnRequestSearchPanel', {
template: require('./index.html'),
- controller: SearchPanel
+ controller: Controller
});
diff --git a/modules/item/front/request/index.html b/modules/item/front/request/index.html
index a677d0754..29a103746 100644
--- a/modules/item/front/request/index.html
+++ b/modules/item/front/request/index.html
@@ -24,14 +24,15 @@
Ticket ID
Shipped
- Description
+ Description
Requested
Price
- Atender
- Item
+ Atender
+ Item
Achieved
- Concept
+ Concept
State
+
@@ -83,7 +84,7 @@
{{request.itemDescription}}
- {{$ctrl.getState(request.isOk)}}
+ {{$ctrl.getState(request.isOk)}}
Save
-
\ No newline at end of file
+
+
+
+
+
+ Filter by selection
+
+
+ Exclude selection
+
+
+ Remove filter
+
+
+ Remove all filters
+
+
+
\ No newline at end of file
diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js
index a5f030e78..231d5eda7 100644
--- a/modules/item/front/request/index.js
+++ b/modules/item/front/request/index.js
@@ -17,18 +17,19 @@ export default class Controller extends Section {
this.filterParams = {
mine: true,
from: today,
- to: nextWeek
+ to: nextWeek,
+ state: 'pending'
};
}
}
getState(isOk) {
if (isOk === null)
- return 'Nueva';
+ return 'Pending';
else if (isOk)
- return 'Aceptada';
+ return 'Accepted';
else
- return 'Denegada';
+ return 'Denied';
}
confirmRequest(request) {
@@ -92,9 +93,34 @@ export default class Controller extends Section {
this.vnApp.showSuccess(this.$t('Data saved!'));
});
}
+
+ exprBuilder(param, value) {
+ switch (param) {
+ case 'ticketFk':
+ case 'quantity':
+ case 'price':
+ case 'isOk':
+ return {[`tr.${param}`]: value};
+ case 'attenderName':
+ return {[`ua.name`]: value};
+ case 'shipped':
+ return {'t.shipped': {
+ between: this.dateRange(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.component('vnItemRequest', {
+ngModule.vnComponent('vnItemRequest', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/request/index.spec.js b/modules/item/front/request/index.spec.js
index 8e384b04e..0fc061023 100644
--- a/modules/item/front/request/index.spec.js
+++ b/modules/item/front/request/index.spec.js
@@ -8,7 +8,7 @@ describe('Item', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
+ beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
controller = $componentController('vnItemRequest', {$element: null, $scope});
@@ -24,17 +24,17 @@ describe('Item', () => {
let isOk = null;
let result = controller.getState(isOk);
- expect(result).toEqual('Nueva');
+ expect(result).toEqual('Pending');
isOk = 1;
result = controller.getState(isOk);
- expect(result).toEqual('Aceptada');
+ expect(result).toEqual('Accepted');
isOk = 0;
result = controller.getState(isOk);
- expect(result).toEqual('Denegada');
+ expect(result).toEqual('Denied');
});
});
diff --git a/modules/item/front/request/locale/es.yml b/modules/item/front/request/locale/es.yml
index 33710a327..c61a00130 100644
--- a/modules/item/front/request/locale/es.yml
+++ b/modules/item/front/request/locale/es.yml
@@ -3,4 +3,7 @@ Specify the reasons to deny this request: Especifica las razones para descartar
Buy requests: Peticiones de compra
Search request by id or alias: Buscar peticiones por identificador o alias
Requested: Solicitado
-Achieved: Conseguido
\ No newline at end of file
+Achieved: Conseguido
+Pending: Pendiente
+Accepted: Aceptada
+Denied: Rechazada
\ No newline at end of file
diff --git a/modules/item/front/search-panel/index.js b/modules/item/front/search-panel/index.js
index 6b3e7786d..f1a3367c4 100644
--- a/modules/item/front/search-panel/index.js
+++ b/modules/item/front/search-panel/index.js
@@ -73,7 +73,7 @@ class Controller extends SearchPanel {
}
}
-ngModule.component('vnItemSearchPanel', {
+ngModule.vnComponent('vnItemSearchPanel', {
template: require('./index.html'),
controller: Controller
});
diff --git a/modules/item/front/search-panel/index.spec.js b/modules/item/front/search-panel/index.spec.js
index cc0cf0375..0e2b7f848 100644
--- a/modules/item/front/search-panel/index.spec.js
+++ b/modules/item/front/search-panel/index.spec.js
@@ -7,7 +7,7 @@ describe('Item', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject($componentController => {
+ beforeEach(inject($componentController => {
$element = angular.element(`
`);
controller = $componentController('vnItemSearchPanel', {$element});
}));
diff --git a/modules/item/front/summary/index.js b/modules/item/front/summary/index.js
index d38f1f29a..5e441ecf1 100644
--- a/modules/item/front/summary/index.js
+++ b/modules/item/front/summary/index.js
@@ -15,7 +15,7 @@ class Controller extends Section {
}
}
-ngModule.component('vnItemSummary', {
+ngModule.vnComponent('vnItemSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
diff --git a/modules/item/front/summary/index.spec.js b/modules/item/front/summary/index.spec.js
index 069c24512..0b349194c 100644
--- a/modules/item/front/summary/index.spec.js
+++ b/modules/item/front/summary/index.spec.js
@@ -8,7 +8,7 @@ describe('Item', () => {
beforeEach(ngModule('item'));
- beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
+ beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element(' ');
@@ -19,8 +19,7 @@ describe('Item', () => {
describe('getSummary()', () => {
it('should perform a query to set summary', () => {
let data = {id: 1, name: 'Gem of mind'};
- $httpBackend.when('GET', `Items/1/getSummary`).respond(200, data);
- $httpBackend.expect('GET', `Items/1/getSummary`);
+ $httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data);
controller.getSummary();
$httpBackend.flush();
diff --git a/modules/item/front/tags/index.html b/modules/item/front/tags/index.html
index 888efd8d0..d35345451 100644
--- a/modules/item/front/tags/index.html
+++ b/modules/item/front/tags/index.html
@@ -22,7 +22,7 @@