Revision d6369b1f
Von Moritz Bunkus vor fast 16 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
package IC;
|
||
|
||
use Data::Dumper;
|
||
use List::MoreUtils qw(all);
|
||
use YAML;
|
||
|
||
use SL::DBUtils;
|
||
... | ... | |
# Check whether or not the prices have changed. If they haven't
|
||
# then 'priceupdate' should not be updated.
|
||
my $previous_values = selectfirst_hashref_query($form, $dbh, qq|SELECT * FROM parts WHERE id = ?|, conv_i($form->{id})) || {};
|
||
if ( ($previous_values->{sellprice} == $form->{sellprice})
|
||
&& ($previous_values->{lastcost} == $form->{lastcost})
|
||
&& ($previous_values->{listprice} == $form->{listprice})) {
|
||
$priceupdate = '';
|
||
}
|
||
$priceupdate = '' if (all { $previous_values->{$_} == $form->{$_} } qw(sellprice lastcost listprice));
|
||
|
||
} else {
|
||
my ($count) = selectrow_query($form, $dbh, qq|SELECT COUNT(*) FROM parts WHERE partnumber = ?|, $form->{partnumber});
|
Auch abrufbar als: Unified diff
List::MoreUtils für kompakteren Code benutzen.