From 8071d62eaa795e93df270802dacece6533d5044d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 18 May 2009 08:59:39 +0000 Subject: [PATCH] Bei Waren das Feld 'Erneuert am' sinnvoll behandeln. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- SL/IC.pm | 14 ++++++++++++-- templates/webpages/ic/form_header_de.html | 3 +-- templates/webpages/ic/form_header_master.html | 3 +-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/SL/IC.pm b/SL/IC.pm index a9360346f..fdeecc473 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -308,6 +308,8 @@ sub save { my ($query, $sth); + my $priceupdate = ', priceupdate = current_date'; + if ($form->{id}) { # get old price @@ -338,6 +340,15 @@ sub save { # 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) { @@ -393,7 +404,6 @@ sub save { sellprice = ?, lastcost = ?, weight = ?, - priceupdate = ?, unit = ?, notes = ?, formel = ?, @@ -415,6 +425,7 @@ sub save { microfiche = ?, partsgroup_id = ?, price_factor_id = ? + $priceupdate WHERE id = ?|; @values = ($form->{partnumber}, $form->{description}, @@ -424,7 +435,6 @@ sub save { $form->{sellprice}, $form->{lastcost}, $form->{weight}, - conv_date($form->{priceupdate}), $form->{unit}, $form->{notes}, $form->{formel}, diff --git a/templates/webpages/ic/form_header_de.html b/templates/webpages/ic/form_header_de.html index 7a14a5aa3..c7e3146f5 100644 --- a/templates/webpages/ic/form_header_de.html +++ b/templates/webpages/ic/form_header_de.html @@ -146,8 +146,7 @@ Erneuert am - - + diff --git a/templates/webpages/ic/form_header_master.html b/templates/webpages/ic/form_header_master.html index bbb87d3fd..2d2f94757 100644 --- a/templates/webpages/ic/form_header_master.html +++ b/templates/webpages/ic/form_header_master.html @@ -146,8 +146,7 @@ Updated - - + -- 2.20.1