diff --git a/db/changes/10420-valentines/00-defaultViewConfig.sql b/db/changes/10420-valentines/00-defaultViewConfig.sql
new file mode 100644
index 000000000..c65c1f403
--- /dev/null
+++ b/db/changes/10420-valentines/00-defaultViewConfig.sql
@@ -0,0 +1,3 @@
+UPDATE salix.defaultViewConfig
+ SET `columns`='{"intrastat":false,"stemMultiplier":false,"landed":false,"producer":false}'
+ WHERE tableCode ='itemsIndex';
diff --git a/db/changes/10420-valentines/00-state.sql b/db/changes/10420-valentines/00-state.sql
new file mode 100644
index 000000000..590be6964
--- /dev/null
+++ b/db/changes/10420-valentines/00-state.sql
@@ -0,0 +1,26 @@
+ALTER TABLE `vn`.`state` ADD classColor varchar(12) NULL;
+
+UPDATE `vn`.`state` s
+ SET s.classColor = 'warning'
+ WHERE s.alertLevel = 1;
+
+UPDATE `vn`.`state` s
+ SET s.classColor = 'alert'
+ WHERE s.alertLevel = 0;
+
+UPDATE `vn`.`state` s
+ SET s.classColor = 'success'
+ WHERE s.code LIKE 'OK';
+
+UPDATE `vn`.`state` s
+ SET s.classColor = 'notice'
+ WHERE s.code LIKE 'FREE';
+
+UPDATE `vn`.`state` s
+ SET s.classColor = 'success'
+ WHERE s.order >= 4
+ AND (s.alertLevel = 0 OR s.alertLevel = 1);
+
+UPDATE `vn`.`state` s
+ SET s.classColor = 'warning'
+ WHERE s.code IN ('PREVIOUS_PREPARATION', 'PREPARED', 'ON_PREPARATION', 'ON_CHECKING', 'CHECKED');
diff --git a/db/changes/10420-valentines/delete.keep b/db/changes/10420-valentines/delete.keep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/e2e/paths/05-ticket/06_basic_data_steps.spec.js b/e2e/paths/05-ticket/06_basic_data_steps.spec.js
index 7a09edf06..fa118c25d 100644
--- a/e2e/paths/05-ticket/06_basic_data_steps.spec.js
+++ b/e2e/paths/05-ticket/06_basic_data_steps.spec.js
@@ -94,7 +94,7 @@ describe('Ticket Edit basic data path', () => {
it(`should split ticket without negatives`, async() => {
const newAgency = 'Silla247';
const newDate = new Date();
- newDate.setDate(newDate.getDate() + 1);
+ newDate.setDate(newDate.getDate() - 1);
await page.accessToSearchResult('14');
await page.accessToSection('ticket.card.basicData.stepOne');
diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js
index 16f23433b..f4b0c26a2 100644
--- a/modules/claim/back/methods/claim/filter.js
+++ b/modules/claim/back/methods/claim/filter.js
@@ -82,6 +82,7 @@ module.exports = Self => {
Self.filter = async(ctx, filter, options) => {
const conn = Self.dataSource.connector;
const myOptions = {};
+ let to;
if (typeof options == 'object')
Object.assign(myOptions, options);
@@ -109,7 +110,11 @@ module.exports = Self => {
case 'attenderFk':
return {'cl.workerFk': value};
case 'created':
- return {'cl.created': value};
+ value.setHours(0, 0, 0, 0);
+ to = new Date(value);
+ to.setHours(23, 59, 59, 999);
+
+ return {'cl.created': {between: [value, to]}};
}
});
diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js
index 98e78c7aa..5755de69b 100644
--- a/modules/item/back/methods/item/filter.js
+++ b/modules/item/back/methods/item/filter.js
@@ -161,6 +161,7 @@ module.exports = Self => {
i.stemMultiplier,
i.typeFk,
i.isFloramondo,
+ pr.name AS producer,
it.name AS typeName,
it.workerFk AS buyerFk,
u.name AS userName,
diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html
index 816777a74..750dbfc4d 100644
--- a/modules/item/front/index/index.html
+++ b/modules/item/front/index/index.html
@@ -54,6 +54,9 @@
Active
|
+
+ Producer
+ |
Landed
|
@@ -122,6 +125,7 @@
ng-model="::item.isActive">
+ {{::item.producer | dashIfEmpty}} |
{{::item.landed | date:'dd/MM/yyyy'}} |
diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js
index 915027c3c..d9e00305d 100644
--- a/modules/item/front/index/index.js
+++ b/modules/item/front/index/index.js
@@ -81,6 +81,8 @@ class Controller extends Section {
return {'intr.description': value};
case 'name':
return {'i.name': {like: `%${value}%`}};
+ case 'producer':
+ return {'pr.name': {like: `%${value}%`}};
case 'id':
case 'size':
case 'subname':
diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js
index 047095abc..d67c5c3fc 100644
--- a/modules/monitor/back/methods/sales-monitor/salesFilter.js
+++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js
@@ -194,6 +194,7 @@ module.exports = Self => {
z.hour AS zoneLanding,
z.name AS zoneName,
z.id AS zoneFk,
+ st.classColor,
TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour,
TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour,
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour
diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html
index 23253259a..76b9219ee 100644
--- a/modules/monitor/front/index/tickets/index.html
+++ b/modules/monitor/front/index/tickets/index.html
@@ -171,7 +171,7 @@
+ class="chip {{::ticket.classColor}}">
{{::ticket.state}}
|
diff --git a/modules/monitor/front/index/tickets/index.js b/modules/monitor/front/index/tickets/index.js
index 2614fd2dc..58b56bbc5 100644
--- a/modules/monitor/front/index/tickets/index.js
+++ b/modules/monitor/front/index/tickets/index.js
@@ -118,17 +118,6 @@ export default class Controller extends Section {
return 'success';
}
- stateColor(ticket) {
- if (ticket.alertLevelCode === 'OK')
- return 'success';
- else if (ticket.alertLevelCode === 'FREE')
- return 'notice';
- else if (ticket.alertLevel === 1)
- return 'warning';
- else if (ticket.alertLevel === 0)
- return 'alert';
- }
-
totalPriceColor(ticket) {
const total = parseInt(ticket.totalWithVat);
if (total > 0 && total < 50)
diff --git a/modules/monitor/front/index/tickets/index.spec.js b/modules/monitor/front/index/tickets/index.spec.js
index fb507dbbc..5d42743c1 100644
--- a/modules/monitor/front/index/tickets/index.spec.js
+++ b/modules/monitor/front/index/tickets/index.spec.js
@@ -89,32 +89,6 @@ describe('Component vnMonitorSalesTickets', () => {
});
});
- describe('stateColor()', () => {
- it('should return "success" when the alertLevelCode property is "OK"', () => {
- const result = controller.stateColor({alertLevelCode: 'OK'});
-
- expect(result).toEqual('success');
- });
-
- it('should return "notice" when the alertLevelCode property is "FREE"', () => {
- const result = controller.stateColor({alertLevelCode: 'FREE'});
-
- expect(result).toEqual('notice');
- });
-
- it('should return "warning" when the alertLevel property is "1', () => {
- const result = controller.stateColor({alertLevel: 1});
-
- expect(result).toEqual('warning');
- });
-
- it('should return "alert" when the alertLevel property is "0"', () => {
- const result = controller.stateColor({alertLevel: 0});
-
- expect(result).toEqual('alert');
- });
- });
-
describe('totalPriceColor()', () => {
it('should return "warning" when the ticket amount is less than 50€', () => {
const result = controller.totalPriceColor({totalWithVat: '8.50'});
diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js
index 0fa26c9ea..2294e6d25 100644
--- a/modules/ticket/back/methods/ticket/componentUpdate.js
+++ b/modules/ticket/back/methods/ticket/componentUpdate.js
@@ -138,9 +138,8 @@ module.exports = Self => {
const params = [args.id, args.shipped, args.warehouseFk];
const [salesMovable] = await Self.rawSql(query, params, myOptions);
- const saleMovable = sale.movable ? sale.movable : 0;
+ const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
- const salesNewTicket = salesMovable.filter(sale => saleMovable >= sale.quantity);
if (salesNewTicket.length) {
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
args.id = newTicket.id;
diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js
index d47fabd51..e0ffac55a 100644
--- a/modules/ticket/back/methods/ticket/priceDifference.js
+++ b/modules/ticket/back/methods/ticket/priceDifference.js
@@ -112,7 +112,7 @@ module.exports = Self => {
// Get items movable
const ticketOrigin = await models.Ticket.findById(args.id, null, myOptions);
- const differenceShipped = ticketOrigin.shipped.getTime() != args.shipped.getTime();
+ const differenceShipped = ticketOrigin.shipped.getTime() > args.shipped.getTime();
const differenceWarehouse = ticketOrigin.warehouseFk != args.warehouseId;
salesObj.haveDifferences = differenceShipped || differenceWarehouse;
diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html
index 3b0c71160..273706c9f 100644
--- a/print/templates/email/buyer-week-waste/buyer-week-waste.html
+++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html
@@ -51,8 +51,8 @@