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

(-)a/C4/ImportBatch.pm (-1 / +11 lines)
Lines 591-596 sub BatchCommitRecords { Link Here
591
                             WHERE import_batch_id = ?");
591
                             WHERE import_batch_id = ?");
592
    $sth->execute($batch_id);
592
    $sth->execute($batch_id);
593
    my $marcflavour = C4::Context->preference('marcflavour');
593
    my $marcflavour = C4::Context->preference('marcflavour');
594
595
    my $userenv = C4::Context->userenv;
596
    my $logged_in_patron = Koha::Patrons->find( $userenv->{number} );
597
594
    my $rec_num = 0;
598
    my $rec_num = 0;
595
    while (my $rowref = $sth->fetchrow_hashref) {
599
    while (my $rowref = $sth->fetchrow_hashref) {
596
        $record_type = $rowref->{'record_type'};
600
        $record_type = $rowref->{'record_type'};
Lines 664-670 sub BatchCommitRecords { Link Here
664
                }
668
                }
665
                $oldxml = $old_marc->as_xml($marc_type);
669
                $oldxml = $old_marc->as_xml($marc_type);
666
670
667
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {context => {source => 'batchimport'}});
671
                ModBiblio($marc_record, $recordid, $oldbiblio->frameworkcode, {
672
                    context => {
673
                        source => 'batchimport',
674
                        categorycode => $logged_in_patron->categorycode,
675
                        userid => $logged_in_patron->userid
676
                    },
677
                });
668
                $query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead
678
                $query = "UPDATE import_biblios SET matched_biblionumber = ? WHERE import_record_id = ?"; # FIXME call SetMatchedBiblionumber instead
669
679
670
                if ($item_result eq 'create_new' || $item_result eq 'replace') {
680
                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 150-164 if ( $op eq 'form' ) { Link Here
150
    my @record_ids = $input->multi_param('record_id');
150
    my @record_ids = $input->multi_param('record_id');
151
151
152
    try {
152
    try {
153
        my $patron = Koha::Patrons->find( $loggedinuser );
153
        my $params = {
154
        my $params = {
154
            mmtid       => $mmtid,
155
            mmtid       => $mmtid,
155
            record_ids  => \@record_ids,
156
            record_ids  => \@record_ids,
157
            context => {
158
                source => 'batchmod',
159
                categorycode => $patron->categorycode,
160
                userid => $patron->userid
161
            }
156
        };
162
        };
157
163
158
        my $patron = Koha::Patrons->find( $loggedinuser );
159
        my $job_id =
164
        my $job_id =
160
          $recordtype eq 'biblio'
165
          $recordtype eq 'biblio'
161
          ? Koha::BackgroundJob::BatchUpdateBiblio->new->enqueue($params, { source => 'batchmod', categorycode => $patron->categorycode, userid => $patron->userid })
166
          ? Koha::BackgroundJob::BatchUpdateBiblio->new->enqueue($params)
162
          : Koha::BackgroundJob::BatchUpdateAuthority->new->enqueue($params);
167
          : Koha::BackgroundJob::BatchUpdateAuthority->new->enqueue($params);
163
168
164
        $template->param(
169
        $template->param(
165
- 

Return to bug 14957