]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Bei Waren das Feld 'Erneuert am' sinnvoll behandeln.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 18 May 2009 08:59:39 +0000 (08:59 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 18 May 2009 08:59:39 +0000 (08:59 +0000)
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
templates/webpages/ic/form_header_de.html
templates/webpages/ic/form_header_master.html

index a9360346f2e32481d598f2943b9b6ca1600b864f..fdeecc473b8af30c9ab252a78e84c027c73b0ce8 100644 (file)
--- 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},
index 7a14a5aa3d55d3493855ddc276e9bfdbe5d78cf4..c7e3146f5371f8330ca24fa4a467ce38715c5092 100644 (file)
           <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>
            </td>
           </tr>
 
index bbb87d3fd4ff59c569b2cc925cd6c5269368423a..2d2f947572d3367e0ddcd72ce40814ea4a67b110 100644 (file)
           <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>
            </td>
           </tr>