Openbravo Issue Tracking System - Retail Modules
View Issue Details
0054007Retail ModulesDiscounts and Promotionspublic2023-11-22 22:082023-12-18 12:17
sofidossant 
SABARINATH P 
urgentmajoralways
closedfixed 
5
RR23Q1 
 
open
marvintm
OBPS
81099
No
0054007: Price Adjustment Discounts, do not follow the Avaialability tab in the webPOS
The client is testing promotions for Black Friday, and they do not apply when a day of the week is enabled in the "Avaialability" tab

Specific:
Price Adjustment: 25%
Availability:
* Day of week: Wednesday
* From : 11:15:00
*To: 11:45:00

If we analyze the .js code

const weekDay = currentDate.getDay();
..
..
const availableDateTimes = discountImpl.availableDateTimes.filter(dateTime=>{
const day = parseInt(dateTime.day, 10);
if (day === 0) {
return true;
}
if (weekDay === day || (weekDay === 0 && day === 7)) {
return true;
}
return false;

"day" contains the value 3 (Wednesday)
"weekDay" contains the value 2, which corresponds to the value Wednesday getDay()

For that reason when we apply a discount for a day of the week other than "Sunday" it does not apply...
Set up a price adjustment on 25% discounts, and Availability:
* Day of week: Wednesday
* From : 11:15:00
*To: 11:45:00

checked if we can see the discount


PLEASE , you use the hour in argentina or guatemala in the computer
Change
const weekDay = currentDate.getDay();
..
..
const availableDateTimes = discountImpl.availableDateTimes.filter(dateTime=>{
const day = parseInt(dateTime.day, 10);
if (day === 0) {
return true;
}
if (weekDay === day || (weekDay === 0 && day === 7)) {
return true;
}
return false;

"day" contiene el valor 3 ( MiƩrcoles )
"weekDay" contiene el valor 2, que se corresponde con el valor MiƩrcoles getDay()
No tags attached.
png bf_disc_02.png (137,152) 2023-11-22 22:08
https://issues.openbravo.com/file_download.php?file_id=19169&type=bug
png

png bf_disc_01.png (603,888) 2023-11-22 22:09
https://issues.openbravo.com/file_download.php?file_id=19170&type=bug
patch 54007 (2).patch (5,842) 2023-12-18 12:12
https://issues.openbravo.com/file_download.php?file_id=19221&type=bug
Issue History
2023-11-22 22:08sofidossantNew Issue
2023-11-22 22:08sofidossantAssigned To => Retail
2023-11-22 22:08sofidossantFile Added: bf_disc_02.png
2023-11-22 22:08sofidossantOBNetwork customer => OBPS
2023-11-22 22:08sofidossantSupport ticket => 81099
2023-11-22 22:08sofidossantTriggers an Emergency Pack => No
2023-11-22 22:09sofidossantFile Added: bf_disc_01.png
2023-11-23 11:30sofidossantPriorityhigh => urgent
2023-11-27 06:50SABARINATH PAssigned ToRetail => SABARINATH P
2023-11-27 11:30SABARINATH PStatusnew => scheduled
2023-11-27 14:55marvintmReview Assigned To => marvintm
2023-11-27 14:55marvintmNote Added: 0157683
2023-11-27 14:55marvintmStatusscheduled => closed
2023-11-27 14:55marvintmResolutionopen => unable to reproduce
2023-11-27 17:09sofidossantSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=27201#r27201
2023-11-27 17:09sofidossantResolutionunable to reproduce => open
2023-11-27 17:09sofidossantStatusclosed => new
2023-11-28 12:05sofidossantversionRR23Q3.1 => RR23Q1
2023-11-28 14:32hgbotMerge Request Status => open
2023-11-28 14:32hgbotNote Added: 0157761
2023-11-28 14:40SABARINATH PStatusnew => scheduled
2023-11-29 09:51hgbotNote Added: 0157788
2023-12-18 11:44sreehariAssigned ToSABARINATH P => sreehari
2023-12-18 12:09SABARINATH PAssigned Tosreehari => SABARINATH P
2023-12-18 12:11SABARINATH PNote Added: 0158292
2023-12-18 12:12SABARINATH PFile Added: 54007 (2).patch
2023-12-18 12:17SABARINATH PStatusscheduled => resolved
2023-12-18 12:17SABARINATH PResolutionopen => fixed
2023-12-18 12:17SABARINATH PStatusresolved => closed

Notes
(0157683)
marvintm   
2023-11-27 14:55   
Sorry but we haven't been able to reproduce the issue.

We define availability to one specific day of the week (for instance Monday), and then the discount is applied correctly if it is Monday, and it is not applied if it is not. It also seems to take correctly into account the hours as far as we can see.

So we need a clear explanation of how it can be reproduced, with clear steps.
(0157761)
hgbot   
2023-11-28 14:32   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/127 [^]
(0157788)
hgbot   
2023-11-29 09:51   
Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/127 [^]
(0158292)
SABARINATH P   
2023-12-18 12:11   
Attaching the patch since it doesn't required backport.