Revision 7942a6ac
Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt
bin/mozilla/ic.pl | ||
---|---|---|
131 | 131 |
|
132 | 132 |
$auth->assert('part_service_assembly_edit'); |
133 | 133 |
|
134 |
my @errors = (); |
|
135 |
my $value_found = false; |
|
136 |
|
|
137 |
foreach my $idx (qw(sellprice listprice), (1..$form->{price_rows})) { |
|
138 |
my $name = $idx =~ m/\d/ ? $form->{"pricegroup_${idx}"} : $idx eq 'sellprice' ? $locale->text('Sell Price') : $locale->text('List Price'); |
|
139 |
my $type = $idx =~ m/\d/ ? $form->{"pricegroup_type_${idx}"} : $form->{"${idx}_type"}; |
|
140 |
my $value_idx = $idx =~ m/\d/ ? "price_${idx}" : $idx; |
|
141 |
my $value = $form->parse_amount(\%myconfig, $form->{$value_idx}); |
|
142 |
|
|
143 |
if ((0 > $value) && ($type eq 'percent')) { |
|
144 |
push @errors, $locale->text('You cannot adjust the price for pricegroup "#1" by a negative percentage.', $name); |
|
145 |
|
|
146 |
} elsif (!$value && ($form->{$value_idx} ne '')) { |
|
147 |
push @errors, $locale->text('No valid number entered for pricegroup "#1".', $name); |
|
148 |
|
|
149 |
} elsif (0 < $value) { |
|
150 |
$value_found = 1; |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
push @errors, $locale->text('No prices will be updated because no prices have been entered.') if (!$value_found); |
|
155 |
|
|
156 |
my $num_matches = IC->get_num_matches_for_priceupdate(); |
|
157 |
|
|
158 |
$form->header(); |
|
159 |
|
|
160 |
if (@errors) { |
|
161 |
$form->show_generic_error(join('<br>', @errors), 'back_button' => 1); |
|
162 |
} |
|
163 |
|
|
134 | 164 |
$form->{nextsub} = "update_prices"; |
135 |
$form->header; |
|
136 | 165 |
|
137 | 166 |
map { delete $form->{$_} } qw(action header); |
138 | 167 |
|
139 |
print $form->parse_html_template('ic/confirm_price_update', { HIDDENS => [ map { name => $_, value => $form->{$_} }, keys %$form ] }); |
|
168 |
print $form->parse_html_template('ic/confirm_price_update', { HIDDENS => [ map { name => $_, value => $form->{$_} }, keys %$form ], |
|
169 |
num_matches => $num_matches }); |
|
140 | 170 |
|
141 | 171 |
$lxdebug->leave_sub(); |
142 | 172 |
} |
... | ... | |
146 | 176 |
|
147 | 177 |
$auth->assert('part_service_assembly_edit'); |
148 | 178 |
|
149 |
if (IC->update_prices(\%myconfig, \%$form)) { |
|
150 |
$form->redirect($form->{update_count} . $locale->text('prices updated!')); |
|
179 |
my $num_updated = IC->update_prices(\%myconfig, \%$form); |
|
180 |
|
|
181 |
if (-1 != $num_updated) { |
|
182 |
$form->redirect($locale->text('#1 prices were updated.', $num_updated)); |
|
151 | 183 |
} else { |
152 | 184 |
$form->error($locale->text('Could not update prices!')); |
153 | 185 |
} |
Auch abrufbar als: Unified diff
Bessere Abfragen und (Fehler-)Meldungen bei Preisupdates.
Fix für Bugs 480.