Lines 106-112
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) {
Link Here
|
106 |
$timestamp .= 'Z'; |
106 |
$timestamp .= 'Z'; |
107 |
$timestamp =~ s/ /T/; |
107 |
$timestamp =~ s/ /T/; |
108 |
my $biblio = Koha::Biblios->find($biblionumber); |
108 |
my $biblio = Koha::Biblios->find($biblionumber); |
109 |
$record = $biblio->metadata->record; |
109 |
$record = $biblio->metadata_record; |
110 |
my $record_transformed = $record->clone; |
110 |
my $record_transformed = $record->clone; |
111 |
$record_transformed->delete_fields( $record_transformed->field('952')); |
111 |
$record_transformed->delete_fields( $record_transformed->field('952')); |
112 |
$record_transformed = XMLin($record_transformed->as_xml_record); |
112 |
$record_transformed = XMLin($record_transformed->as_xml_record); |
Lines 394-400
subtest 'Bug 19725: OAI-PMH ListRecords and ListIdentifiers should use biblio_me
Link Here
|
394 |
# Modify record to trigger auto update of timestamp |
394 |
# Modify record to trigger auto update of timestamp |
395 |
(my $biblionumber = $marcxml[0]->{header}->{identifier}) =~ s/^.*:(.*)/$1/; |
395 |
(my $biblionumber = $marcxml[0]->{header}->{identifier}) =~ s/^.*:(.*)/$1/; |
396 |
my $biblio = Koha::Biblios->find($biblionumber); |
396 |
my $biblio = Koha::Biblios->find($biblionumber); |
397 |
my $record = $biblio->metadata->record; |
397 |
my $record = $biblio->metadata_record; |
398 |
$record->append_fields(MARC::Field->new(999, '', '', z => '_')); |
398 |
$record->append_fields(MARC::Field->new(999, '', '', z => '_')); |
399 |
ModBiblio( $record, $biblionumber ); |
399 |
ModBiblio( $record, $biblionumber ); |
400 |
my $from_dt = dt_from_string( |
400 |
my $from_dt = dt_from_string( |
Lines 546-553
subtest 'Tests for OpacHiddenItems' => sub {
Link Here
|
546 |
datestamp => $utc_timestamp, |
546 |
datestamp => $utc_timestamp, |
547 |
identifier => 'TEST:' . $item->biblionumber |
547 |
identifier => 'TEST:' . $item->biblionumber |
548 |
}, |
548 |
}, |
549 |
metadata => |
549 |
metadata => { |
550 |
{ record => XMLin( $biblio->metadata->record( { embed_items => 1, opac => 1 } )->as_xml_record() ) } |
550 |
record => |
|
|
551 |
XMLin( $biblio->metadata_record( { embed_items => 1, interface => 'opac' } )->as_xml_record() ) |
552 |
} |
551 |
} |
553 |
} |
552 |
}; |
554 |
}; |
553 |
my $expected_hidden = { |
555 |
my $expected_hidden = { |
Lines 648-674
subtest 'Tests for timestamp handling' => sub {
Link Here
|
648 |
my $expected = { |
650 |
my $expected = { |
649 |
record => { |
651 |
record => { |
650 |
header => { |
652 |
header => { |
651 |
datestamp => $utc_timestamp, |
653 |
datestamp => $utc_timestamp, |
652 |
identifier => 'TEST:' . $biblio1->biblionumber |
654 |
identifier => 'TEST:' . $biblio1->biblionumber |
653 |
}, |
655 |
}, |
654 |
metadata => { |
656 |
metadata => { |
655 |
record => XMLin( |
657 |
record => |
656 |
$biblio1->metadata->record({ embed_items => 1, opac => 1})->as_xml_record() |
658 |
XMLin( $biblio1->metadata_record( { embed_items => 1, interface => 'opac' } )->as_xml_record() ) |
657 |
) |
|
|
658 |
} |
659 |
} |
659 |
} |
660 |
} |
660 |
}; |
661 |
}; |
661 |
my $expected_no_items = { |
662 |
my $expected_no_items = { |
662 |
record => { |
663 |
record => { |
663 |
header => { |
664 |
header => { |
664 |
datestamp => $utc_timestamp, |
665 |
datestamp => $utc_timestamp, |
665 |
identifier => 'TEST:' . $biblio1->biblionumber |
666 |
identifier => 'TEST:' . $biblio1->biblionumber |
666 |
}, |
667 |
}, |
667 |
metadata => { |
668 |
metadata => { record => XMLin( $biblio1->metadata_record( { interface => 'opac' } )->as_xml_record() ) } |
668 |
record => XMLin( |
|
|
669 |
$biblio1->metadata->record({opac => 1})->as_xml_record() |
670 |
) |
671 |
} |
672 |
} |
669 |
} |
673 |
}; |
670 |
}; |
674 |
|
671 |
|
Lines 724-732
subtest 'Tests for timestamp handling' => sub {
Link Here
|
724 |
$sth_item->execute($timestamp, $item2->itemnumber); |
721 |
$sth_item->execute($timestamp, $item2->itemnumber); |
725 |
|
722 |
|
726 |
$expected->{record}{header}{datestamp} = $utc_timestamp; |
723 |
$expected->{record}{header}{datestamp} = $utc_timestamp; |
727 |
$expected->{record}{metadata}{record} = XMLin( |
724 |
$expected->{record}{metadata}{record} = |
728 |
$biblio1->metadata->record({ embed_items => 1, opac => 1})->as_xml_record() |
725 |
XMLin( $biblio1->metadata_record( { embed_items => 1, interface => 'opac' } )->as_xml_record() ); |
729 |
); |
|
|
730 |
|
726 |
|
731 |
test_query( |
727 |
test_query( |
732 |
'ListRecords - biblio with two items', |
728 |
'ListRecords - biblio with two items', |
Lines 790-798
subtest 'Tests for timestamp handling' => sub {
Link Here
|
790 |
$sth_del_item->execute($timestamp, $item1->itemnumber); |
786 |
$sth_del_item->execute($timestamp, $item1->itemnumber); |
791 |
|
787 |
|
792 |
$expected->{record}{header}{datestamp} = $utc_timestamp; |
788 |
$expected->{record}{header}{datestamp} = $utc_timestamp; |
793 |
$expected->{record}{metadata}{record} = XMLin( |
789 |
$expected->{record}{metadata}{record} = |
794 |
$biblio1->metadata->record({ embed_items => 1, opac => 1})->as_xml_record() |
790 |
XMLin( $biblio1->metadata_record( { embed_items => 1, interface => 'opac' } )->as_xml_record() ); |
795 |
); |
|
|
796 |
|
791 |
|
797 |
test_query( |
792 |
test_query( |
798 |
'ListRecords - biblio with existing and deleted item', |
793 |
'ListRecords - biblio with existing and deleted item', |
Lines 819-827
subtest 'Tests for timestamp handling' => sub {
Link Here
|
819 |
$item2->safe_delete({ skip_record_index =>1 }); |
814 |
$item2->safe_delete({ skip_record_index =>1 }); |
820 |
$sth_del_item->execute($timestamp, $item2->itemnumber); |
815 |
$sth_del_item->execute($timestamp, $item2->itemnumber); |
821 |
|
816 |
|
822 |
$expected->{record}{metadata}{record} = XMLin( |
817 |
$expected->{record}{metadata}{record} = |
823 |
$biblio1->metadata->record({ embed_items => 1, opac => 1})->as_xml_record() |
818 |
XMLin( $biblio1->metadata_record( { embed_items => 1, interface => 'opac' } )->as_xml_record() ); |
824 |
); |
|
|
825 |
|
819 |
|
826 |
test_query( |
820 |
test_query( |
827 |
'ListRecords - biblio with two deleted items', |
821 |
'ListRecords - biblio with two deleted items', |
Lines 898-909
subtest 'Tests for timestamp handling' => sub {
Link Here
|
898 |
$expected_header->{record}, |
892 |
$expected_header->{record}, |
899 |
{ |
893 |
{ |
900 |
header => { |
894 |
header => { |
901 |
datestamp => $utc_timestamp, |
895 |
datestamp => $utc_timestamp, |
902 |
identifier => 'TEST:' . $biblio2->biblionumber |
896 |
identifier => 'TEST:' . $biblio2->biblionumber |
903 |
}, |
897 |
}, |
904 |
metadata => { |
898 |
metadata => { |
905 |
record => XMLin( |
899 |
record => XMLin( |
906 |
$biblio2->metadata->record({ embed_items => 1, opac => 1})->as_xml_record() |
900 |
$biblio2->metadata_record( { embed_items => 1, interface => 'opac' } )->as_xml_record() |
907 |
) |
901 |
) |
908 |
} |
902 |
} |
909 |
} |
903 |
} |
Lines 914-927
subtest 'Tests for timestamp handling' => sub {
Link Here
|
914 |
$expected_header->{record}, |
908 |
$expected_header->{record}, |
915 |
{ |
909 |
{ |
916 |
header => { |
910 |
header => { |
917 |
datestamp => $utc_timestamp, |
911 |
datestamp => $utc_timestamp, |
918 |
identifier => 'TEST:' . $biblio2->biblionumber |
912 |
identifier => 'TEST:' . $biblio2->biblionumber |
919 |
}, |
913 |
}, |
920 |
metadata => { |
914 |
metadata => { record => XMLin( $biblio2->metadata_record( { interface => 'opac' } )->as_xml_record() ) } |
921 |
record => XMLin( |
|
|
922 |
$biblio2->metadata->record->as_xml_record() |
923 |
) |
924 |
} |
925 |
} |
915 |
} |
926 |
] |
916 |
] |
927 |
}; |
917 |
}; |
928 |
- |
|
|