View | Details | Raw Unified | Return to bug 13707
Collapse All | Expand All

(-)a/C4/Biblio.pm (+2 lines)
Lines 2589-2594 sub UpdateDatereceived { Link Here
2589
2589
2590
    my $bibdata;
2590
    my $bibdata;
2591
    unless (ref $biblionumberOrBibliodata) { #We have a SCALAR, eg. a biblionumber.
2591
    unless (ref $biblionumberOrBibliodata) { #We have a SCALAR, eg. a biblionumber.
2592
        return 'NO_BIBLIONUMBER' unless defined $biblionumberOrBibliodata;
2592
        my @biblioitems = C4::Biblio::GetBiblioItemByBiblioNumber($biblionumberOrBibliodata);
2593
        my @biblioitems = C4::Biblio::GetBiblioItemByBiblioNumber($biblionumberOrBibliodata);
2593
        $bibdata = $biblioitems[0];
2594
        $bibdata = $biblioitems[0];
2594
    }
2595
    }
Lines 2603-2608 sub UpdateDatereceived { Link Here
2603
    }
2604
    }
2604
    #Use the given DateTime or Use Now()
2605
    #Use the given DateTime or Use Now()
2605
    $datereceived = ($datereceived) ? $datereceived->iso8601() : DateTime->now( time_zone => C4::Context->tz() )->iso8601();
2606
    $datereceived = ($datereceived) ? $datereceived->iso8601() : DateTime->now( time_zone => C4::Context->tz() )->iso8601();
2607
    $datereceived =~ s/T/ / if defined $datereceived;
2606
2608
2607
    #Make sure to only update the datereceived for the Biblio if it hasn't been set yet.
2609
    #Make sure to only update the datereceived for the Biblio if it hasn't been set yet.
2608
    if ($bibdata->{datereceived}) {
2610
    if ($bibdata->{datereceived}) {
(-)a/C4/Items.pm (-1 / +1 lines)
Lines 2070-2076 sub _mod_item_dates { # date formatting for date fields in item hash Link Here
2070
2070
2071
        my $newstr;
2071
        my $newstr;
2072
        if( defined $dt  && ref($dt) eq 'DateTime' ) {
2072
        if( defined $dt  && ref($dt) eq 'DateTime' ) {
2073
            if( $key =~ /datetime/ ) {
2073
            if( $key =~ /datetime|datereceived/ ) {
2074
                $newstr = DateTime::Format::MySQL->format_datetime($dt);
2074
                $newstr = DateTime::Format::MySQL->format_datetime($dt);
2075
            } else {
2075
            } else {
2076
                $newstr = DateTime::Format::MySQL->format_date($dt);
2076
                $newstr = DateTime::Format::MySQL->format_date($dt);
(-)a/t/db_dependent/Datereceived.t (-2 / +2 lines)
Lines 109-114 my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = C4::Items::AddItem( Link Here
109
        holdingbranch    => 'MPL',
109
        holdingbranch    => 'MPL',
110
        barcode          => 'R00000342',
110
        barcode          => 'R00000342',
111
        replacementprice => 12.00,
111
        replacementprice => 12.00,
112
        itype            => 'BK',
112
        datereceived     => $datereceivedIso,
113
        datereceived     => $datereceivedIso,
113
    },
114
    },
114
    $biblionumber
115
    $biblionumber
Lines 199-202 ok( ($error eq 'NOT_DATETIME'), Link Here
199
       "Searchable datereceived: ERROR, Not a DateTime caught.");
200
       "Searchable datereceived: ERROR, Not a DateTime caught.");
200
201
201
202
202
$dbh->rollback();
203
$dbh->rollback();
203
- 

Return to bug 13707