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 88-100 sub process { Link Here
88
            my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
88
            my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
89
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
89
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
90
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
90
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
91
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode,
91
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
92
                {
92
                context => $args->{context},
93
                    source => $args->{source},
93
            });
94
                    categorycode => $args->{categorycode},
95
                    userid => $args->{userid},
96
                }
97
            );
98
        };
94
        };
99
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
95
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
100
            push @messages, {
96
            push @messages, {
Lines 137-148 sub enqueue { Link Here
137
    return unless exists $args->{mmtid};
133
    return unless exists $args->{mmtid};
138
    return unless exists $args->{record_ids};
134
    return unless exists $args->{record_ids};
139
135
140
    my $mmtid = $args->{mmtid};
141
    my @record_ids = @{ $args->{record_ids} };
142
143
    $self->SUPER::enqueue({
136
    $self->SUPER::enqueue({
144
        job_size => scalar @record_ids,
137
        job_size => scalar @{$args->{record_ids}},
145
        job_args => {mmtid => $mmtid, record_ids => \@record_ids,}
138
        job_args => $args,
146
    });
139
    });
147
}
140
}
148
141
(-)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