[Koha-bugs] [Bug 8800] SpecifyDueDate && useDaysMode=Datedue wrong behaviour

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Oct 8 16:22:09 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8800

Paul Poulain <paul.poulain at biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Passed QA                   |Failed QA
                 CC|                            |paul.poulain at biblibre.com

--- Comment #10 from Paul Poulain <paul.poulain at biblibre.com> ---
(additionnal QA comment, this patch could have a big side effect, i'll push it
becase it's a bugfix, but I double check !)

This patch fixes a problem in 2 different places:
 * in AddIssue, if the datedue is provided, Koha calculate the next open day
(except if  useDaysMode  is set to Calendar). This sounds logical = the
librarian entering a date may have forgotten that it's a closed date, and it's
useful that Koha calculates the next open date (this part of the patch could be
considered as an ENH)
 * in CalcDueDate, called if the datedue is not provided, the patch adds a sub
to calculate the next open day if the syspref is set to Datedue. But, from a QA
pov, i'm not sure this patch is written in the proper way: in
Koha::Calendar.pm, the method addDate is here to calculate the datedue. The
next_open_day added in this patch is a duplicate of what addDate is supposed to
do.
In fact, the addDate already includes calculation:
    } elsif ( $days_mode eq 'Calendar' ) {
        if ( $unit eq 'hours' ) {
            $base_date->add_duration($add_duration);
            while ( $self->is_holiday($base_date) ) {
                $base_date->add_duration($day_dur);

            }

        } else {
            my $days = abs $add_duration->in_units('days');
            while ($days) {
                $base_date->add_duration($day_dur);
                if ( $self->is_holiday($base_date) ) {
                    next;
                } else {
                    --$days;
                }
            }
        }

If it does not work, it should be fixed here.

Overall, failing QA, sorry: the patch may fix the problem, but it's improperly
coded.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list