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

(-)a/svc/bib (-7 / +7 lines)
Lines 26-31 use C4::Auth qw( check_api_auth ); Link Here
26
use C4::Biblio qw( GetFrameworkCode );
26
use C4::Biblio qw( GetFrameworkCode );
27
use C4::Items;
27
use C4::Items;
28
use XML::Simple;
28
use XML::Simple;
29
use Koha::Biblios;
29
30
30
my $query = CGI->new;
31
my $query = CGI->new;
31
binmode STDOUT, ':encoding(UTF-8)';
32
binmode STDOUT, ':encoding(UTF-8)';
Lines 65-73 exit 0; Link Here
65
sub fetch_bib {
66
sub fetch_bib {
66
    my $query = shift;
67
    my $query = shift;
67
    my $biblionumber = shift;
68
    my $biblionumber = shift;
68
    my $record = C4::Biblio::GetMarcBiblio({
69
    my $biblio = Koha::Biblios->find( $biblionumber );
69
        biblionumber => $biblionumber,
70
    my $record = $biblio->metadata->record({ embed_items => scalar $query->param('items') });
70
        embed_items  => scalar $query->param('items') });
71
    if  (defined $record) {
71
    if  (defined $record) {
72
        print $query->header(-type => 'text/xml',-charset => 'utf-8',);
72
        print $query->header(-type => 'text/xml',-charset => 'utf-8',);
73
        print $record->as_xml_record();
73
        print $record->as_xml_record();
Lines 79-85 sub fetch_bib { Link Here
79
sub update_bib {
79
sub update_bib {
80
    my $query = shift;
80
    my $query = shift;
81
    my $biblionumber = shift;
81
    my $biblionumber = shift;
82
    my $old_record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
82
    my $biblio = Koha::Biblios->find( $biblionumber );
83
    my $old_record = $biblio->metadata->record;
83
    my $frameworkcode = $query->url_param('frameworkcode') // GetFrameworkCode($biblionumber);
84
    my $frameworkcode = $query->url_param('frameworkcode') // GetFrameworkCode($biblionumber);
84
    unless  (defined $old_record) {
85
    unless  (defined $old_record) {
85
        print $query->header(-type => 'text/xml', -status => '404 Not Found');
86
        print $query->header(-type => 'text/xml', -status => '404 Not Found');
Lines 115-123 sub update_bib { Link Here
115
        }
116
        }
116
117
117
        C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode );
118
        C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode );
118
        my $new_record = C4::Biblio::GetMarcBiblio({
119
        my $biblio = Koha::Biblios->find( $biblionumber );
119
            biblionumber => $biblionumber,
120
        my $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') });
120
            embed_items  => scalar $query->url_param('items') });
121
121
122
        $result->{'status'} = "ok";
122
        $result->{'status'} = "ok";
123
        $result->{'biblionumber'} = $biblionumber;
123
        $result->{'biblionumber'} = $biblionumber;
(-)a/svc/new_bib (-4 / +6 lines)
Lines 27-32 use C4::Items; Link Here
27
use XML::Simple;
27
use XML::Simple;
28
use C4::Charset;
28
use C4::Charset;
29
29
30
use Koha::Biblios;
31
30
my $query = CGI->new;
32
my $query = CGI->new;
31
binmode STDOUT, ':encoding(UTF-8)';
33
binmode STDOUT, ':encoding(UTF-8)';
32
34
Lines 75-81 sub add_bib { Link Here
75
            $record->delete_field($field);
77
            $record->delete_field($field);
76
        }
78
        }
77
        my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, $frameworkcode );
79
        my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, $frameworkcode );
78
        my $new_record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
80
        my $biblio = Koha::Biblios->find( $biblionumber );
81
        my $new_record = $biblio->metadata->record;
79
        if ( $query->url_param('items') ) {
82
        if ( $query->url_param('items') ) {
80
            foreach my $field ( $fullrecord->field($itemtag) ) {
83
            foreach my $field ( $fullrecord->field($itemtag) ) {
81
                my $one_item_record = $new_record->clone();
84
                my $one_item_record = $new_record->clone();
Lines 84-92 sub add_bib { Link Here
84
            }
87
            }
85
        }
88
        }
86
89
87
        $new_record = C4::Biblio::GetMarcBiblio({
90
        $biblio = Koha::Biblios->find( $biblionumber );
88
            biblionumber => $biblionumber,
91
        $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') });
89
            embed_items  => scalar $query->url_param('items') });
90
        $result->{'status'} = "ok";
92
        $result->{'status'} = "ok";
91
        $result->{'biblionumber'} = $biblionumber;
93
        $result->{'biblionumber'} = $biblionumber;
92
        my $xml = $new_record->as_xml_record();
94
        my $xml = $new_record->as_xml_record();
(-)a/svc/records/preview (-2 / +3 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
use CGI;
21
use CGI;
22
use C4::Auth qw( get_template_and_user );
22
use C4::Auth qw( get_template_and_user );
23
use C4::Biblio qw( GetMarcBiblio ApplyMarcOverlayRules );
23
use C4::Biblio qw( ApplyMarcOverlayRules );
24
use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate );
24
use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate );
25
use C4::Output qw( output_html_with_http_headers );
25
use C4::Output qw( output_html_with_http_headers );
26
26
Lines 35-41 my $mmtid = $query->param('mmtid'); # Marc modification template id Link Here
35
35
36
my $record;
36
my $record;
37
if ( $record_type eq 'biblio' ) {
37
if ( $record_type eq 'biblio' ) {
38
    $record = GetMarcBiblio({ biblionumber => $record_id });
38
    my $biblio = Koha::Biblios->find( $record_id );
39
    my $record = $biblio->metadata->record;
39
} else {
40
} else {
40
    my $authority = Koha::MetadataRecord::Authority->get_from_authid( $record_id );
41
    my $authority = Koha::MetadataRecord::Authority->get_from_authid( $record_id );
41
    $record = $authority->record;
42
    $record = $authority->record;
(-)a/t/db_dependent/00-strict.t (-18 / +1 lines)
Lines 14-37 use lib("misc/translator"); Link Here
14
use lib("installer");
14
use lib("installer");
15
15
16
my @dirs = (
16
my @dirs = (
17
    'acqui',             'admin',
17
    'svc/records'
18
    'authorities',       'basket',
19
    'catalogue',         'cataloguing',
20
    'changelanguage.pl', 'circ',
21
    'debian',            'docs',
22
    'errors',            'fix-perl-path.PL', 'help.pl',
23
    'installer',         'koha_perl_deps.pl',
24
    'kohaversion.pl',    'labels',
25
    'mainpage.pl',       'Makefile.PL',
26
    'members',           'misc',
27
    'offline_circ',      'opac',
28
    'patroncards',       'reports',
29
    'reserve',           'reviews',
30
    'rewrite-config.PL', 'rotating_collections',
31
    'serials',           'services',
32
    'skel',              'suggestion',
33
    'svc',               'tags',
34
    'tools',             'virtualshelves'
35
);
18
);
36
19
37
$Test::Strict::TEST_STRICT = 0;
20
$Test::Strict::TEST_STRICT = 0;
(-)a/t/db_dependent/OAI/Sets.t (-5 / +5 lines)
Lines 24-30 use Test::Warn; Link Here
24
use MARC::Record;
24
use MARC::Record;
25
25
26
use Koha::Database;
26
use Koha::Database;
27
use C4::Biblio qw( GetMarcBiblio );
28
use C4::OAI::Sets qw( AddOAISet GetOAISets GetOAISet GetOAISetBySpec ModOAISet ModOAISetMappings GetOAISetsMappings GetOAISetMappings AddOAISetsBiblios GetOAISetsBiblio ModOAISetsBiblios DelOAISet DelOAISetsBiblio UpdateOAISetsBiblio CalcOAISetsBiblio );
27
use C4::OAI::Sets qw( AddOAISet GetOAISets GetOAISet GetOAISetBySpec ModOAISet ModOAISetMappings GetOAISetsMappings GetOAISetMappings AddOAISetsBiblios GetOAISetsBiblio ModOAISetsBiblios DelOAISet DelOAISetsBiblio UpdateOAISetsBiblio CalcOAISetsBiblio );
29
28
30
use t::lib::TestBuilder;
29
use t::lib::TestBuilder;
Lines 551-557 my $biblio_VH = $builder->build_sample_biblio({ author => 'Victor Hugo' }); Link Here
551
my $biblionumberVH = $biblio_VH->biblionumber;
550
my $biblionumberVH = $biblio_VH->biblionumber;
552
551
553
#Update
552
#Update
554
my $record = GetMarcBiblio({ biblionumber => $biblionumberVH });
553
my $biblio = Koha::Biblios->find( $biblionumberVH );
554
my $record = $biblio->metadata->record;
555
UpdateOAISetsBiblio($biblionumberVH, $record);
555
UpdateOAISetsBiblio($biblionumberVH, $record);
556
556
557
#is biblio attached to setVH ?
557
#is biblio attached to setVH ?
Lines 595-601 subtest 'OAI-PMH:AutoUpdateSetsEmbedItemData' => sub { Link Here
595
    );
595
    );
596
596
597
    #Update
597
    #Update
598
    my $recordFIC = GetMarcBiblio( { biblionumber => $biblio_FIC->biblionumber } );
598
    my $recordFIC = $biblio_FIC->metadata->record;
599
    UpdateOAISetsBiblio( $biblio_FIC->biblionumber, $recordFIC );
599
    UpdateOAISetsBiblio( $biblio_FIC->biblionumber, $recordFIC );
600
600
601
    #is biblio attached to setFIC ?
601
    #is biblio attached to setFIC ?
Lines 660-666 my $biblio_NotVH = $builder->build_sample_biblio({ author => 'Sponge, Bob' }); Link Here
660
my $biblionumberNotVH = $biblio_NotVH->biblionumber;
660
my $biblionumberNotVH = $biblio_NotVH->biblionumber;
661
661
662
#Update
662
#Update
663
$record = GetMarcBiblio({ biblionumber => $biblionumberNotVH });
663
$biblio = Koha::Biblios->find( $biblionumberNotVH );
664
$record = $biblio->metadata->record;
664
UpdateOAISetsBiblio($biblionumberNotVH, $record);
665
UpdateOAISetsBiblio($biblionumberNotVH, $record);
665
666
666
my @setsNotEq = CalcOAISetsBiblio($record);
667
my @setsNotEq = CalcOAISetsBiblio($record);
667
- 

Return to bug 29697