Koha/acqui
Jonathan Druart 0489f9d72f Bug 13601: Fix special case in basket.pl
There is a badly managed date in acqui/basket.pl:
if the date is 15/01/2015 (metric format), it will become
2015-1-15 after the following line:
  $estimateddeliverydate = "$year-$month-$day";
Add_Delta_Days is used at several place, and the ouput is forced to
display date on 4 digits and month/day on 2 digits.
This patch does the same thing for $estimateddeliverydate.

Note that I previously developed a patch to take this format into account (with missing 0)
in Koha::DateUtils::dt_from_string, but I don't think it's a good idea
to manage bad formated dates.
We will certainly find some issues after previous patches, but it will permit to catch
them!
IMO it's preferable than to keep them hidden.

The patch was:
    diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm
    index 5fe2653..4434a67 100644
    --- a/Koha/DateUtils.pm
    +++ b/Koha/DateUtils.pm
    @@ -72,17 +72,17 @@ sub dt_from_string {
             my $fallback_re = qr|
                 (?<year>\d{4})
                 -
    -            (?<month>\d{2})
    +            (?<month>\d{1,2})
                 -
    -            (?<day>\d{2})
    +            (?<day>\d{1,2})
             |xms;

             if ( $date_format eq 'metric' ) {
                 # metric format is "dd/mm/yyyy[ hh:mm:ss]"
                 $regex = qr|
    -                (?<day>\d{2})
    +                (?<day>\d{1,2})
                     /
    -                (?<month>\d{2})
    +                (?<month>\d{1,2})
                     /
                     (?<year>\d{4})
                 |xms;
    @@ -90,9 +90,9 @@ sub dt_from_string {
             elsif ( $date_format eq 'us' ) {
                 # us format is "mm/dd/yyyy[ hh:mm:ss]"
                 $regex = qr|
    -                (?<month>\d{2})
    +                (?<month>\d{1,2})
                     /
    -                (?<day>\d{2})
    +                (?<day>\d{1,2})
                     /
                     (?<year>\d{4})
                 |xms;
    diff --git a/t/DateUtils.t b/t/DateUtils.t
    index 886e1d6..0877240 100755
    --- a/t/DateUtils.t
    +++ b/t/DateUtils.t
    @@ -189,3 +189,8 @@ is( output_pref( { dt => $dt } ), '31/01/2015 12:34', 'dt_from_string should mat
     # date before 1900
     $dt = dt_from_string('01/01/1900');
     is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string should manage date < 1900' );
    +
    +# missing 0
    +$dt = dt_from_string('1/1/2015');
    +is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/2015', 'dt_from_string should generate a DT object even if 0 are missing' );

Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 13:40:03 -03:00
..
pdfformat Bug 12979: Fix error on layout3pagesfr 2014-11-07 15:03:36 -03:00
acqui-home.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
add_user_search.pl Bug 13021: guarantor search - main patch 2015-03-19 14:19:34 -03:00
addorder.pl Bug 12648: Link patrons to an order 2015-03-11 11:47:30 -03:00
addorderiso2709.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
ajax-getauthvaluedropbox.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
basket.pl Bug 13601: Fix special case in basket.pl 2015-03-30 13:40:03 -03:00
basketgroup.pl Bug 12975: Use the centralize VAT and prices calculation - basketgroup.pl 2015-02-05 14:41:32 -03:00
basketheader.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
booksellers.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
cancelorder.pl Bug 7162: Factorize code for order cancellation (QA fixes) 2014-10-30 00:44:16 -03:00
check_budget_total.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
check_duplicate_barcode_ajax.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
check_uniqueness.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
currency.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
finishreceive.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
histsearch.pl Bug 12944: Search orders by basket creator 2015-02-09 15:48:12 -03:00
invoice-files.pl
invoice.pl Bug 12976: Fix the footer if several tax rate exist 2015-02-19 09:46:35 -03:00
invoices.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
lateorders-export.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
lateorders.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
modordernotes.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
neworderbiblio.pl Bug 12323 [SIGNED OFF] - Acquisitions search results fixed in order of biblionumber 2015-02-10 11:12:54 -03:00
neworderempty.pl Bug 12648: Link patrons to an order 2015-03-11 11:47:30 -03:00
newordersubscription.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
newordersuggestion.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
ordered.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
orderreceive.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
parcel.pl Bug 13320: Move price calculation from tt to pl 2015-02-04 15:16:09 -03:00
parcels.pl Bug 4402: Date filter on parcels.tt required db date format 2015-03-15 08:56:06 -03:00
spent.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
supplier.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
transferorder.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
uncertainprice.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
updatesupplier.pl Bug 11944: use CGI( -utf8 ) everywhere 2015-01-13 13:07:21 -03:00
z3950_search.pl Bug 12896: Move the bookseller-related code into Koha::Acquisition::Bookseller 2014-12-31 14:15:58 -03:00