[Koha-bugs] [Bug 14954] Remove C4::Dates from holiday related files in folder tools

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Oct 28 16:30:48 CET 2015


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

--- Comment #10 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Comment on attachment 44077
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=44077
Bug 14954 - Remove C4::Dates from holiday related files in folder tools

Review of attachment 44077:
 --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=14954&attachment=44077)
-----------------------------------------------------------------

Looking at the patch, some changes smell false.
I might be wrong.

::: C4/Calendar.pm
@@ +707,5 @@
>  
>  sub addDate {
>      my ($self, $startdate, $offset) = @_;
> +    $startdate = eval { output_pref( { dt => dt_from_string( $startdate ), dateonly => 1, dateformat => 'iso' } ); };
> +    my ( $year, $month, $day) = split( "-", $startdate );

$startdate is already a dt!

@@ +730,5 @@
>  	} else { ## ($daysMode eq 'Days') 
>          ($year, $month, $day) = &Date::Calc::Add_Delta_Days($year, $month, $day, $offset );
>      }
> +    my $date_ret = sprintf(ISO_DATE_FORMAT,$year,$month,$day);
> +    $date_ret =  eval { output_pref( { dt => dt_from_string( $date_ret), dateonly => 1, dateformat => 'iso' } ); };

This looks wrong, $date_ret is not in the pref format (what dt_from_string is
expecting).
There is a fallback on iso, but when you know the format is iso, you have to
provide it.

@@ +736,3 @@
>  }
>  
>  =head2 daysBetween

This subroutine is not used anywhere, prefer to remove it before this patch.

::: tools/holidays.pl
@@ +49,3 @@
>  # if the url has an invalid date default to 'now.'
> +$calendardate = output_pref( { dt => $calendarinput_dt, dateonly => 1 } );
> +$keydate = output_pref( { dt => $calendarinput_dt, dateonly => 1, dateformat => 'iso' } );

That's not what it was done before.

@@ +132,4 @@
>  my $single_holidays = $calendar->get_single_holidays();
>  my @holidays;
>  foreach my $yearMonthDay (keys %$single_holidays) {
> +    my $holidaydate = eval { dt_from_string( $single_holidays->{$yearMonthDay}{date} ) };

specify iso.

@@ +136,4 @@
>      my %holiday;
>      %holiday = (KEY => $yearMonthDay,
>                  DATE_SORT => $single_holidays->{$yearMonthDay}{date},
> +                DATE => output_pref( { dt => $holidaydate, dateonly => 1, dateformat => 'iso' } ),

before the output was "syspref"

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


More information about the Koha-bugs mailing list