Revision 8071d62e
Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
308 | 308 |
|
309 | 309 |
my ($query, $sth); |
310 | 310 |
|
311 |
my $priceupdate = ', priceupdate = current_date'; |
|
312 |
|
|
311 | 313 |
if ($form->{id}) { |
312 | 314 |
|
313 | 315 |
# get old price |
... | ... | |
338 | 340 |
# delete translations |
339 | 341 |
do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id})); |
340 | 342 |
|
343 |
# Check whether or not the prices have changed. If they haven't |
|
344 |
# then 'priceupdate' should not be updated. |
|
345 |
my $previous_values = selectfirst_hashref_query($form, $dbh, qq|SELECT * FROM parts WHERE id = ?|, conv_i($form->{id})) || {}; |
|
346 |
if ( ($previous_values->{sellprice} == $form->{sellprice}) |
|
347 |
&& ($previous_values->{lastcost} == $form->{lastcost}) |
|
348 |
&& ($previous_values->{listprice} == $form->{listprice})) { |
|
349 |
$priceupdate = ''; |
|
350 |
} |
|
351 |
|
|
341 | 352 |
} else { |
342 | 353 |
my ($count) = selectrow_query($form, $dbh, qq|SELECT COUNT(*) FROM parts WHERE partnumber = ?|, $form->{partnumber}); |
343 | 354 |
if ($count) { |
... | ... | |
393 | 404 |
sellprice = ?, |
394 | 405 |
lastcost = ?, |
395 | 406 |
weight = ?, |
396 |
priceupdate = ?, |
|
397 | 407 |
unit = ?, |
398 | 408 |
notes = ?, |
399 | 409 |
formel = ?, |
... | ... | |
415 | 425 |
microfiche = ?, |
416 | 426 |
partsgroup_id = ?, |
417 | 427 |
price_factor_id = ? |
428 |
$priceupdate |
|
418 | 429 |
WHERE id = ?|; |
419 | 430 |
@values = ($form->{partnumber}, |
420 | 431 |
$form->{description}, |
... | ... | |
424 | 435 |
$form->{sellprice}, |
425 | 436 |
$form->{lastcost}, |
426 | 437 |
$form->{weight}, |
427 |
conv_date($form->{priceupdate}), |
|
428 | 438 |
$form->{unit}, |
429 | 439 |
$form->{notes}, |
430 | 440 |
$form->{formel}, |
Auch abrufbar als: Unified diff
Bei Waren das Feld 'Erneuert am' sinnvoll behandeln.
1. Das Feld ist nun read-only; den eh nicht funktionablen Button für den Kalender entfernt.
2. Es wird beim Speichern explizit überprüft, ob sich mindestens einer der Preise verändert hat, und falls ja, so wird das Feld auf den aktuellen Datumswert gesetzt.