dolibarr-bugtrack
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-bugtrack] [Bug #1287] Wrong use day in Holiday module


From: Doliforge
Subject: [Dolibarr-bugtrack] [Bug #1287] Wrong use day in Holiday module
Date: Wed, 05 Mar 2014 12:21:50 +0100

Doliforge
Ce message ne s'affiche pas correctement?
mettez à jour vos préférences utilisateur.

Wrong use day in Holiday module

Dernières modifications

05/03/2014 12:21 (Europe/Paris)
My case :
Find number of day betwenn 21-March-2014 and 24-March-2014 Result is 4 => OK (Friday,Saturday,Sunday,Monday)
Find number of day betwenn 28-March-2014 and 31-March-2014 Result is 3 => KO. (Friday,Saturday,Sunday,Monday)

If I look into code of this function we have a basic timestamp substraction, that should give a good result, but in fact not. Is it the only case ? I don't know.

I put some trace and there is the result :

21-24 :
$timestampStart=1395356400
$timestampEnd =1395615600
$bit=0
($timestampEnd - $timestampStart)/(60*60*24) +1 - $bits = 4
floor(4) = 4

28-31 :
$timestampStart=1395961200
$timestampEnd =1396216800
$bit=0
($timestampEnd - $timestampStart)/(60*60*24) + 1 - $bits = 3.9583333333333
floor(3.9583333333333) = 3


As we do a floor on this ($timestampEnd - $timestampStart)/(60*60*24) the second result is KO

Répondre

État

 Détails
Last Modified On:  05/03/2014 12:19 Submitted by:  HENRY Florian (fhenry)
Submitted on:  05/03/2014 12:19 
Summary:  Wrong use day in Holiday module
Description:  Create a holiday resquest for 28-march-2014 morning to 31-March-2014 afternoon
the number of working day use is 1, it whould be 2
Step to reproduce bug:  Create a holiday resquest for 28-march-2014 morning to 31-March-2014 afternoon
the number of working day use is 1, it whould be 2
Detected in version:  3.5.0 Category:  Module: Holidays
Severity:  5 - Major OS Type/Version:  
PHP version:   Database type and version:  
 Etat
Status:  Open Assigned to:  Aucun
Resolution:  Aucun 

Commentaires

HENRY Florian 05/03/2014 12:21
My case :
Find number of day betwenn 21-March-2014 and 24-March-2014 Result is 4 => OK (Friday,Saturday,Sunday,Monday)
Find number of day betwenn 28-March-2014 and 31-March-2014 Result is 3 => KO. (Friday,Saturday,Sunday,Monday)

If I look into code of this function we have a basic timestamp substraction, that should give a good result, but in fact not. Is it the only case ? I don't know.

I put some trace and there is the result :

21-24 :
$timestampStart=1395356400
$timestampEnd =1395615600
$bit=0
($timestampEnd - $timestampStart)/(60*60*24) +1 - $bits = 4
floor(4) = 4

28-31 :
$timestampStart=1395961200
$timestampEnd =1396216800
$bit=0
($timestampEnd - $timestampStart)/(60*60*24) + 1 - $bits = 3.9583333333333
floor(3.9583333333333) = 3


As we do a floor on this ($timestampEnd - $timestampStart)/(60*60*24) the second result is KO


reply via email to

[Prev in Thread] Current Thread [Next in Thread]