[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Fri Sep 16 21:00:22 UTC 2016


 sc/source/core/tool/interpr2.cxx |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 13ba2592254c861dafa337121902168d83f610bd
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Fri Sep 9 13:18:42 2016 +0200

    tdf#101541 function WORKDAY.INTL not working properly
    
    When holidays are adjacent to weekend days, wrong results occurred.
    
    Change-Id: I9ec86e00f1a62ea941ff70617a1b448601aff9cc
    Reviewed-on: https://gerrit.libreoffice.org/28771
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 5e9d5eeb8a33fdcc500377d9eace40b5f5a7f750)
    Reviewed-on: https://gerrit.libreoffice.org/28970
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 773eaba..38523e5 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -538,14 +538,16 @@ void ScInterpreter::ScWorkday_MS()
                     size_t nRef = 0;
                     while ( nDays )
                     {
-                        while ( nRef < nMax && nSortArray.at( nRef ) < nDate )
-                            nRef++;
-                        if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate ) || nRef >= nMax )
-                             nDays--;
-
                         do
+                        {
                             ++nDate;
+                        }
                         while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s)
+
+                        while ( nRef < nMax && nSortArray.at( nRef ) < nDate )
+                            nRef++;
+                        if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate ) || nRef >= nMax )
+                            nDays--;
                     }
                 }
                 else
@@ -553,14 +555,16 @@ void ScInterpreter::ScWorkday_MS()
                     sal_Int16 nRef = nMax - 1;
                     while ( nDays )
                     {
+                        do
+                        {
+                          --nDate;
+                        }
+                        while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s)
+
                         while ( nRef >= 0 && nSortArray.at( nRef ) > nDate )
                             nRef--;
                         if ( !( nRef >= 0 && nSortArray.at( nRef ) == nDate ) || nRef < 0 )
                              nDays++;
-
-                        do
-                          --nDate;
-                        while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s)
                     }
                 }
                 PushDouble( ( double ) ( nDate - nNullDate ) );


More information about the Libreoffice-commits mailing list