Lines 110-147
if ( $op eq 'add_form' ) {
Link Here
|
110 |
} |
110 |
} |
111 |
|
111 |
|
112 |
elsif ( $op eq 'cud-add_validate' ) { |
112 |
elsif ( $op eq 'cud-add_validate' ) { |
|
|
113 |
EXIT_IF: { |
113 |
## add or modify a budget period (confirmation) |
114 |
## add or modify a budget period (confirmation) |
114 |
|
115 |
|
115 |
## update budget period data |
116 |
my $budget_period_startdate = $input->param('budget_period_startdate'); |
116 |
if ( $budget_period_id ne '' ) { |
117 |
my $budget_period_enddate = $input->param('budget_period_enddate'); |
117 |
# Grab the previous values so we can log them |
118 |
my $action = $budget_period_id ne '' ? 'modify' : 'add'; |
118 |
my $budgetperiod_old=GetBudgetPeriod($budget_period_id); |
119 |
|
119 |
$$budget_period_hashref{$_}||=0 for qw(budget_period_active budget_period_locked); |
120 |
if ( $budget_period_startdate eq '' || $budget_period_enddate eq '' ) { |
120 |
my $status=ModBudgetPeriod($budget_period_hashref); |
121 |
|
121 |
# Log the budget modification |
122 |
$template->param( |
122 |
if (C4::Context->preference("AcquisitionLog")) { |
123 |
failed_add_validate => 1, |
123 |
my $diff = 0 - ($budgetperiod_old->{budget_period_total} - $budget_period_hashref->{budget_period_total}); |
124 |
action => $action |
124 |
my $infos = { |
|
|
125 |
budget_period_startdate => $input->param('budget_period_startdate'), |
126 |
budget_period_enddate => $input->param('budget_period_enddate'), |
127 |
budget_period_total => $budget_period_hashref->{budget_period_total}, |
128 |
budget_period_startdate_old => $budgetperiod_old->{budget_period_startdate}, |
129 |
budget_period_enddate_old => $budgetperiod_old->{budget_period_enddate}, |
130 |
budget_period_total_old => $budgetperiod_old->{budget_period_total}, |
131 |
budget_period_total_change => $diff |
132 |
}; |
133 |
logaction( |
134 |
'ACQUISITIONS', |
135 |
'MODIFY_BUDGET', |
136 |
$budget_period_id, |
137 |
encode_json($infos) |
138 |
); |
125 |
); |
|
|
126 |
|
127 |
$op = 'else'; |
128 |
last EXIT_IF; |
139 |
} |
129 |
} |
|
|
130 |
|
131 |
## update budget period data |
132 |
if ( $action eq 'modify' ) { |
133 |
|
134 |
# Grab the previous values so we can log them |
135 |
my $budgetperiod_old = GetBudgetPeriod($budget_period_id); |
136 |
$$budget_period_hashref{$_} ||= 0 for qw(budget_period_active budget_period_locked); |
137 |
my $status = ModBudgetPeriod($budget_period_hashref); |
138 |
|
139 |
# Log the budget modification |
140 |
if ( C4::Context->preference("AcquisitionLog") ) { |
141 |
my $diff = |
142 |
0 - ( $budgetperiod_old->{budget_period_total} - $budget_period_hashref->{budget_period_total} ); |
143 |
my $infos = { |
144 |
budget_period_startdate => $budget_period_startdate, |
145 |
budget_period_enddate => $budget_period_enddate, |
146 |
budget_period_total => $budget_period_hashref->{budget_period_total}, |
147 |
budget_period_startdate_old => $budgetperiod_old->{budget_period_startdate}, |
148 |
budget_period_enddate_old => $budgetperiod_old->{budget_period_enddate}, |
149 |
budget_period_total_old => $budgetperiod_old->{budget_period_total}, |
150 |
budget_period_total_change => $diff |
151 |
}; |
152 |
logaction( |
153 |
'ACQUISITIONS', |
154 |
'MODIFY_BUDGET', |
155 |
$budget_period_id, |
156 |
encode_json($infos) |
157 |
); |
158 |
} |
159 |
} else { # ELSE ITS AN ADD |
160 |
my $budget_period_id = AddBudgetPeriod($budget_period_hashref); |
161 |
} |
162 |
$op = 'else'; |
140 |
} |
163 |
} |
141 |
else { # ELSE ITS AN ADD |
|
|
142 |
my $budget_period_id=AddBudgetPeriod($budget_period_hashref); |
143 |
} |
144 |
$op='else'; |
145 |
} |
164 |
} |
146 |
|
165 |
|
147 |
#-------------------------------------------------- |
166 |
#-------------------------------------------------- |