Lines 175-193
elsif ( $op && $op eq 'mod_adj' ) {
Link Here
|
175 |
my @encumber_open = $input->multi_param('encumber_open'); |
175 |
my @encumber_open = $input->multi_param('encumber_open'); |
176 |
my %e_open = map { $_ => 1 } @encumber_open; |
176 |
my %e_open = map { $_ => 1 } @encumber_open; |
177 |
|
177 |
|
178 |
my @keys = ('adjustment', 'reason', 'budget_id', 'encumber_open'); |
178 |
my @keys = ('adjustment', 'reason', 'budget_id', 'encumber_open'); |
179 |
for( my $i=0; $i < scalar @adjustment; $i++ ){ |
179 |
for( my $i=0; $i < scalar @adjustment; $i++ ){ |
180 |
if( $adjustment_id[$i] eq 'new' ){ |
180 |
if( $adjustment_id[$i] eq 'new' ){ |
181 |
next unless ( $adjustment[$i] || $reason[$i] ); |
181 |
next unless ( $adjustment[$i] || $reason[$i] ); |
182 |
my $adj = { |
182 |
my $adj = { |
183 |
invoiceid => $invoiceid, |
183 |
invoiceid => $invoiceid, |
184 |
adjustment => $adjustment[$i], |
184 |
adjustment => $adjustment[$i], |
185 |
reason => $reason[$i], |
185 |
reason => $reason[$i], |
186 |
note => $note[$i], |
186 |
note => $note[$i], |
187 |
budget_id => $budget_id[$i] || undef, |
187 |
budget_id => $budget_id[$i] || undef, |
188 |
encumber_open => defined $e_open{ $adjustment_id[$i] } ? 1 : 0, |
188 |
encumber_open => defined $e_open{ $adjustment_id[$i] } ? 1 : 0, |
189 |
}; |
189 |
}; |
190 |
my $new_adj = Koha::Acquisition::Invoice::Adjustment->new($adj); |
190 |
my $new_adj = Koha::Acquisition::Invoice::Adjustment->new($adj); |
191 |
$new_adj->store(); |
191 |
$new_adj->store(); |
192 |
# Log this addition |
192 |
# Log this addition |
193 |
if (C4::Context->preference("AcqLog")) { |
193 |
if (C4::Context->preference("AcqLog")) { |