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

(-)a/acqui/addorderiso2709.pl (-3 / +30 lines)
Lines 175-181 if ($op eq ""){ Link Here
175
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
175
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
176
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
176
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
177
        my $c_discount = shift ( @discount);
177
        my $c_discount = shift ( @discount);
178
        $c_discount = $c_discount / 100 if $c_discount > 1;
178
        $c_discount = $c_discount / 100 if $c_discount && $c_discount > 1;
179
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
179
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
180
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
180
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
181
181
Lines 197-202 if ($op eq ""){ Link Here
197
            }
197
            }
198
            ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
198
            ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
199
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
199
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
200
201
            #We need to provide information to koha.import_record_matches to tell Koha that this import_record matches the
202
            #just AddBiblio'd biblio. This is necessary to prevent adding the same import_record to koha.biblio many times.
203
            SetImportRecordBiblioMatch($biblio->{'import_record_id'}, $biblionumber);
204
200
            # 2nd add authorities if applicable
205
            # 2nd add authorities if applicable
201
            if (C4::Context->preference("BiblioAddsAuthorities")){
206
            if (C4::Context->preference("BiblioAddsAuthorities")){
202
                my $headings_linked =BiblioAutoLink($marcrecord, $cgiparams->{'frameworkcode'});
207
                my $headings_linked =BiblioAutoLink($marcrecord, $cgiparams->{'frameworkcode'});
Lines 357-363 sub import_biblios_list { Link Here
357
    my ($template, $import_batch_id) = @_;
362
    my ($template, $import_batch_id) = @_;
358
    my $batch = GetImportBatch($import_batch_id,'staged');
363
    my $batch = GetImportBatch($import_batch_id,'staged');
359
    return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/;
364
    return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/;
360
    my $biblios = GetImportRecordsRange($import_batch_id,'','',$batch->{import_status});
365
    my $biblios = GetImportRecordsRange($import_batch_id,'','',undef);
361
    my @list = ();
366
    my @list = ();
362
367
363
    foreach my $biblio (@$biblios) {
368
    foreach my $biblio (@$biblios) {
Lines 403-408 sub import_biblios_list { Link Here
403
        $cellrecord{sort1} = $sort1 || '';
408
        $cellrecord{sort1} = $sort1 || '';
404
        $cellrecord{sort2} = $sort2 || '';
409
        $cellrecord{sort2} = $sort2 || '';
405
410
411
        get_matched_cellrecord_items( \%cellrecord );
412
406
        push @list, \%cellrecord;
413
        push @list, \%cellrecord;
407
    }
414
    }
408
    my $num_records = $batch->{'num_records'};
415
    my $num_records = $batch->{'num_records'};
Lines 463-468 sub add_matcher_list { Link Here
463
    $template->param(available_matchers => \@matchers);
470
    $template->param(available_matchers => \@matchers);
464
}
471
}
465
472
473
#Get the Items already in Koha for this import_record.
474
#A summary of them is displayed for the user.
475
sub get_matched_cellrecord_items {
476
    my $cellrecord = shift;
477
478
    if ($cellrecord->{match_biblionumber}) {
479
        my $itemsCountByBranch = C4::Items::GetItemsCountByBranch( $cellrecord->{match_biblionumber} );
480
        my $loginBranchcode = $template->{VARS}->{LoginBranchcode};
481
        my $totalItemsCount = 0;
482
        my @availabilityMap;
483
        foreach my $homebranch (sort keys %$itemsCountByBranch) {
484
            push (@availabilityMap, $homebranch.' = '.$itemsCountByBranch->{ $homebranch }->{ count });
485
            $totalItemsCount += $itemsCountByBranch->{ $homebranch }->{ count };
486
        }
487
        my $loginBranchcount = $itemsCountByBranch->{ $loginBranchcode }->{ count };
488
        $cellrecord->{loginBranchItemsCount} = $loginBranchcount || '0';
489
        $cellrecord->{totalItemsCount} = $totalItemsCount;
490
        $cellrecord->{availabilityMap} = join("\n", @availabilityMap);
491
    }
492
}
493
466
sub get_infos_syspref {
494
sub get_infos_syspref {
467
    my ($record, $field_list) = @_;
495
    my ($record, $field_list) = @_;
468
    my $syspref = C4::Context->preference('MarcFieldsToOrder');
496
    my $syspref = C4::Context->preference('MarcFieldsToOrder');
469
- 

Return to bug 13182