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

(-)a/C4/Biblio.pm (-5 / +3 lines)
Lines 113-118 use Koha::Plugins; Link Here
113
use Koha::RecordProcessor;
113
use Koha::RecordProcessor;
114
use Koha::SearchEngine;
114
use Koha::SearchEngine;
115
use Koha::SearchEngine::Indexer;
115
use Koha::SearchEngine::Indexer;
116
use Koha::SimpleMARC;
116
use Koha::Libraries;
117
use Koha::Libraries;
117
use Koha::Util::MARC;
118
use Koha::Util::MARC;
118
119
Lines 2831-2842 sub ModBiblioMarc { Link Here
2831
        }
2832
        }
2832
    }
2833
    }
2833
2834
2834
    #enhancement 5374: update transaction date (005) for marc21/unimarc
2835
    # Insert/update transaction time (005) for marc21/unimarc
2835
    if($encoding =~ /MARC21|UNIMARC/) {
2836
    if($encoding =~ /MARC21|UNIMARC/) {
2836
      my @a= (localtime) [5,4,3,2,1,0]; $a[0]+=1900; $a[1]++;
2837
        Koha::SimpleMARC::update_last_transaction_time( { record => $record } );
2837
        # YY MM DD HH MM SS (update year and month)
2838
      my $f005= $record->field('005');
2839
      $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005;
2840
    }
2838
    }
2841
2839
2842
    if ( C4::Context->preference('StripWhitespaceChars') ) {
2840
    if ( C4::Context->preference('StripWhitespaceChars') ) {
(-)a/t/db_dependent/Biblio.t (-2 / +16 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 20;
20
use Test::More tests => 21;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
use List::MoreUtils qw( uniq );
23
use List::MoreUtils qw( uniq );
Lines 1022-1027 subtest 'ModBiblio on invalid record' => sub { Link Here
1022
    );
1022
    );
1023
};
1023
};
1024
1024
1025
subtest 'AddBiblio/ModBiblio calling ModBiblioMarc for field 005' => sub {
1026
    plan tests => 2;
1027
1028
    my $marc_record    = MARC::Record->new;
1029
    my ($biblionumber) = C4::Biblio::AddBiblio( $marc_record, '' );
1030
    my $biblio         = Koha::Biblios->find($biblionumber);
1031
1032
    my $field = $biblio->metadata->record->field('005');
1033
    ok( $field && $field->data, 'Record contains field 005 after AddBiblio' );
1034
    $marc_record = MARC::Record->new;
1035
    C4::Biblio::ModBiblio( $marc_record, $biblionumber, '' );
1036
    $field = $biblio->metadata->record->field('005');
1037
    ok( $field && $field->data, 'Record contains field 005 after ModBiblio' );
1038
};
1039
1025
# Cleanup
1040
# Cleanup
1026
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
1041
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
1027
$schema->storage->txn_rollback;
1042
$schema->storage->txn_rollback;
1028
- 

Return to bug 35993