Lines 52-58
use C4::Biblio qw(
Link Here
|
52 |
GetMarcPrice |
52 |
GetMarcPrice |
53 |
); |
53 |
); |
54 |
use C4::Items qw( AddItemFromMarc ); |
54 |
use C4::Items qw( AddItemFromMarc ); |
55 |
use C4::Budgets qw( GetBudgetByCode ); |
55 |
use C4::Budgets qw( GetBudgetByCode GetBudgetHierarchy ); |
56 |
|
56 |
|
57 |
use Koha::Database; |
57 |
use Koha::Database; |
58 |
use Koha::ImportBatchProfiles; |
58 |
use Koha::ImportBatchProfiles; |
Lines 651-662
sub import_batches_list {
Link Here
|
651 |
For an import batch, this function reads the files and creates all the relevant data pertaining to that file |
651 |
For an import batch, this function reads the files and creates all the relevant data pertaining to that file |
652 |
It then returns this to the template to be shown in the UI |
652 |
It then returns this to the template to be shown in the UI |
653 |
|
653 |
|
654 |
Koha::MarcOrder->import_biblios_list( $cgiparams->{'import_batch_id'} ); |
654 |
Koha::MarcOrder->import_biblios_list( $cgiparams->{'import_batch_id'}, $clear_fund ); |
655 |
|
655 |
|
656 |
=cut |
656 |
=cut |
657 |
|
657 |
|
658 |
sub import_biblios_list { |
658 |
sub import_biblios_list { |
659 |
my ( $self, $import_batch_id ) = @_; |
659 |
my ( $self, $import_batch_id, $clear_fund ) = @_; |
660 |
my $batch = GetImportBatch( $import_batch_id, 'staged' ); |
660 |
my $batch = GetImportBatch( $import_batch_id, 'staged' ); |
661 |
return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/; |
661 |
return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/; |
662 |
my $import_records = Koha::Import::Records->search( |
662 |
my $import_records = Koha::Import::Records->search( |
Lines 733-745
sub import_biblios_list {
Link Here
|
733 |
my $sort2 = $infos->{sort2} || undef; |
733 |
my $sort2 = $infos->{sort2} || undef; |
734 |
my $budget_id; |
734 |
my $budget_id; |
735 |
|
735 |
|
736 |
if ($budget_code) { |
736 |
if ( $budget_code and not $clear_fund ) { |
737 |
my $biblio_budget = GetBudgetByCode($budget_code); |
737 |
my $biblio_budget = GetBudgetByCode($budget_code); |
738 |
if ($biblio_budget) { |
738 |
if ($biblio_budget) { |
739 |
$budget_id = $biblio_budget->{budget_id}; |
739 |
$budget_id = $biblio_budget->{budget_id}; |
740 |
} |
740 |
} |
741 |
} |
741 |
} |
742 |
|
742 |
|
|
|
743 |
my %budget_loops; |
744 |
my $budgets_hierarchy = GetBudgetHierarchy; |
745 |
foreach my $r ( @{$budgets_hierarchy} ) { |
746 |
unless ( defined $budget_loops{ $r->{budget_period_id} } ) { |
747 |
$budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; |
748 |
$budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; |
749 |
$budget_loops{ $r->{budget_period_id} }->{funds} = []; |
750 |
} |
751 |
push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { |
752 |
b_id => $r->{budget_id}, |
753 |
b_txt => $r->{budget_name}, |
754 |
b_code => $r->{budget_code}, |
755 |
b_sort1_authcat => $r->{'sort1_authcat'}, |
756 |
b_sort2_authcat => $r->{'sort2_authcat'}, |
757 |
b_active => $r->{budget_period_active}, |
758 |
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, |
759 |
b_level => $r->{budget_level}, |
760 |
}; |
761 |
} |
762 |
$cellrecord{budget_loop} = \%budget_loops; |
763 |
|
743 |
# Items |
764 |
# Items |
744 |
my @itemlist = (); |
765 |
my @itemlist = (); |
745 |
my $all_items_quantity = 0; |
766 |
my $all_items_quantity = 0; |