Revision 0d190035
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
471 | 471 |
# delete price records |
472 | 472 |
do_query($form, $dbh, qq|DELETE FROM prices WHERE parts_id = ?|, conv_i($form->{id})); |
473 | 473 |
|
474 |
$query = qq|INSERT INTO prices (parts_id, pricegroup_id, price) VALUES(?, ?, ?)|; |
|
475 |
$sth = prepare_query($form, $dbh, $query); |
|
476 |
|
|
474 | 477 |
# insert price records only if different to sellprice |
475 | 478 |
for my $i (1 .. $form->{price_rows}) { |
476 | 479 |
my $price = $form->parse_amount($myconfig, $form->{"price_$i"}); |
477 |
if ($price == 0) { |
|
478 |
$form->{"price_$i"} = $form->{sellprice}; |
|
479 |
} |
|
480 |
if ( |
|
481 |
( $price |
|
482 |
|| $form->{"klass_$i"} |
|
483 |
|| $form->{"pricegroup_id_$i"}) |
|
484 |
and $price != $form->{sellprice} |
|
485 |
) { |
|
486 |
#$klass = $form->parse_amount($myconfig, $form->{"klass_$i"}); |
|
487 |
$query = qq|INSERT INTO prices (parts_id, pricegroup_id, price) | . |
|
488 |
qq|VALUES(?, ?, ?)|; |
|
489 |
@values = (conv_i($form->{id}), conv_i($form->{"pricegroup_id_$i"}), $price); |
|
490 |
do_query($form, $dbh, $query, @values); |
|
491 |
} |
|
480 |
next unless $price && ($price != $form->{sellprice}); |
|
481 |
|
|
482 |
@values = (conv_i($form->{id}), conv_i($form->{"pricegroup_id_$i"}), $price); |
|
483 |
do_statement($form, $sth, $query, @values); |
|
492 | 484 |
} |
493 | 485 |
|
486 |
$sth->finish; |
|
487 |
|
|
494 | 488 |
# insert makemodel records |
495 | 489 |
my $lastupdate = ''; |
496 | 490 |
my $value = 0; |
Auch abrufbar als: Unified diff
Refactoring: Preisgruppenpreise speichern
Siehe #1873.