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.
+ my $priceupdate = ', priceupdate = current_date';
+
if ($form->{id}) {
# get old price
if ($form->{id}) {
# get old price
# delete translations
do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id}));
# delete translations
do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id}));
+ # 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 = '';
+ }
+
} else {
my ($count) = selectrow_query($form, $dbh, qq|SELECT COUNT(*) FROM parts WHERE partnumber = ?|, $form->{partnumber});
if ($count) {
} else {
my ($count) = selectrow_query($form, $dbh, qq|SELECT COUNT(*) FROM parts WHERE partnumber = ?|, $form->{partnumber});
if ($count) {
sellprice = ?,
lastcost = ?,
weight = ?,
sellprice = ?,
lastcost = ?,
weight = ?,
unit = ?,
notes = ?,
formel = ?,
unit = ?,
notes = ?,
formel = ?,
microfiche = ?,
partsgroup_id = ?,
price_factor_id = ?
microfiche = ?,
partsgroup_id = ?,
price_factor_id = ?
WHERE id = ?|;
@values = ($form->{partnumber},
$form->{description},
WHERE id = ?|;
@values = ($form->{partnumber},
$form->{description},
$form->{sellprice},
$form->{lastcost},
$form->{weight},
$form->{sellprice},
$form->{lastcost},
$form->{weight},
- conv_date($form->{priceupdate}),
$form->{unit},
$form->{notes},
$form->{formel},
$form->{unit},
$form->{notes},
$form->{formel},
<tr>
<th align="right" nowrap="true">Erneuert am</th>
<td>
<tr>
<th align="right" nowrap="true">Erneuert am</th>
<td>
- <input name="priceupdate" id="priceupdate" size="11" title="[% HTML.escape(dateformat) %]" value="[% HTML.escape(priceupdate) %]">
- <input type="button" name="priceupdate" id="trigger1" value="?">
+ <input name="priceupdate" id="priceupdate" size="11" title="[% HTML.escape(dateformat) %]" value="[% HTML.escape(priceupdate) %]" readonly>
<tr>
<th align="right" nowrap="true"><translate>Updated</translate></th>
<td>
<tr>
<th align="right" nowrap="true"><translate>Updated</translate></th>
<td>
- <input name="priceupdate" id="priceupdate" size="11" title="[% HTML.escape(dateformat) %]" value="[% HTML.escape(priceupdate) %]">
- <input type="button" name="priceupdate" id="trigger1" value="?">
+ <input name="priceupdate" id="priceupdate" size="11" title="[% HTML.escape(dateformat) %]" value="[% HTML.escape(priceupdate) %]" readonly>