[Koha-bugs] [Bug 14969] Remove C4::Dates from serials/*.pl files

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Nov 10 12:43:36 CET 2015


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

Jonathan Druart <jonathan.druart at bugs.koha-community.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Signed Off                  |Failed QA
                 CC|                            |jonathan.druart at bugs.koha-c
                   |                            |ommunity.org

--- Comment #15 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
1/ " =   "
=> Useless spaces.

2/ $tmpPlannedDate is not necessary, don't use this tmp var.

3/ my $date  = '';
my $date; #is enough

4/
+        $expirationdate = eval { output_pref( { dt => dt_from_string(
$expirationdate ), dateonly => 1, dateformat => 'iso' }); }
+            if ( $expirationdate );
+
+        next unless ( $expirationdate );
+
         $subscription->{expirationdate} = $expirationdate;
-        next if $expirationdate !~ /\d{4}-\d{2}-\d{2}/; # next if not in ISO
format.

This change is not needed.

5/
-             Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) &&

I don't understand why you removed this line.


There are still other some inconsistencies, I would like to know what
methodology you use to replace these occurrences.
For instance format_date always expect an iso formatted date, but you replace
these occurrences with
  output_pref( { dt => dt_from_string( $date ), dateonly => 1 })
you should specify the dateformat param to dt_from_string.

And sometimes you replace them with

$date = eval { dt_from_string( $date ) } if $date;
$date = output_pref( { dt => $date, dateonly => 1 } ) if $date;

The changes are coming complicated and more and more errors are found on the QA
step.
I would like to see a migration plan with a test file to highlight the changes
you are doing.
If I remember correctly, I have attached a file doing that some weeks ago (but
don't find it anymore). We need to test several values:
undef, empty string, valid date, invalid date

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


More information about the Koha-bugs mailing list