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

(-)a/C4/ImportBatch.pm (-1 / +11 lines)
Lines 602-607 sub BatchCommitRecords { Link Here
602
                             WHERE import_batch_id = ?");
602
                             WHERE import_batch_id = ?");
603
    $sth->execute($batch_id);
603
    $sth->execute($batch_id);
604
    my $marcflavour = C4::Context->preference('marcflavour');
604
    my $marcflavour = C4::Context->preference('marcflavour');
605
606
    my $userenv = C4::Context->userenv;
607
    my $logged_in_patron = Koha::Patrons->find( $userenv->{number} );
608
605
    my $rec_num = 0;
609
    my $rec_num = 0;
606
    while (my $rowref = $sth->fetchrow_hashref) {
610
    while (my $rowref = $sth->fetchrow_hashref) {
607
        $record_type = $rowref->{'record_type'};
611
        $record_type = $rowref->{'record_type'};
Lines 675-681 sub BatchCommitRecords { Link Here
675
                }
679
                }
676
                $oldxml = $old_marc->as_xml($marc_type);
680
                $oldxml = $old_marc->as_xml($marc_type);
677
681
678
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {context => {source => 'batchimport'}});
682
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {
683
                    context => {
684
                        source => 'batchimport',
685
                        categorycode => $logged_in_patron->categorycode,
686
                        userid => $logged_in_patron->userid
687
                    },
688
                });
679
                $query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead
689
                $query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead
680
690
681
                if ($item_result eq 'create_new' || $item_result eq 'replace') {
691
                if ($item_result eq 'create_new' || $item_result eq 'replace') {
(-)a/Koha/BackgroundJob/BatchUpdateBiblio.pm (-12 / +5 lines)
Lines 91-103 sub process { Link Here
91
            my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
91
            my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
92
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
92
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
93
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
93
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
94
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode,
94
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
95
                {
95
                context => $args->{context},
96
                    source => $args->{source},
96
            });
97
                    categorycode => $args->{categorycode},
98
                    userid => $args->{userid},
99
                }
100
            );
101
        };
97
        };
102
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
98
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
103
            push @messages, {
99
            push @messages, {
Lines 140-151 sub enqueue { Link Here
140
    return unless exists $args->{mmtid};
136
    return unless exists $args->{mmtid};
141
    return unless exists $args->{record_ids};
137
    return unless exists $args->{record_ids};
142
138
143
    my $mmtid = $args->{mmtid};
144
    my @record_ids = @{ $args->{record_ids} };
145
146
    $self->SUPER::enqueue({
139
    $self->SUPER::enqueue({
147
        job_size => scalar @record_ids,
140
        job_size => scalar @{$args->{record_ids}},
148
        job_args => {mmtid => $mmtid, record_ids => \@record_ids,}
141
        job_args => $args,
149
    });
142
    });
150
}
143
}
151
144
(-)a/tools/batch_record_modification.pl (-3 / +7 lines)
Lines 157-171 if ( $op eq 'form' ) { Link Here
157
    my @record_ids = $input->multi_param('record_id');
157
    my @record_ids = $input->multi_param('record_id');
158
158
159
    try {
159
    try {
160
        my $patron = Koha::Patrons->find( $loggedinuser );
160
        my $params = {
161
        my $params = {
161
            mmtid       => $mmtid,
162
            mmtid       => $mmtid,
162
            record_ids  => \@record_ids,
163
            record_ids  => \@record_ids,
164
            context => {
165
                source => 'batchmod',
166
                categorycode => $patron->categorycode,
167
                userid => $patron->userid
168
            }
163
        };
169
        };
164
170
165
        my $patron = Koha::Patrons->find( $loggedinuser );
166
        my $job_id =
171
        my $job_id =
167
          $recordtype eq 'biblio'
172
          $recordtype eq 'biblio'
168
          ? Koha::BackgroundJob::BatchUpdateBiblio->new->enqueue($params, { source => 'batchmod', categorycode => $patron->categorycode, userid => $patron->userid })
173
          ? Koha::BackgroundJob::BatchUpdateBiblio->new->enqueue($params)
169
          : Koha::BackgroundJob::BatchUpdateAuthority->new->enqueue($params);
174
          : Koha::BackgroundJob::BatchUpdateAuthority->new->enqueue($params);
170
175
171
        $template->param(
176
        $template->param(
172
- 

Return to bug 14957