Verhindern, dass Lieferscheine mehrfach ein- bzw. ausgelagert werden können
[kivitendo-erp.git] / SL / IC.pm
index ac3d6f2..cf7c99c 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -502,7 +502,7 @@ sub save {
       if (($form->{"make_$i"}) || ($form->{"model_$i"})) {
         #hli
         $value = $form->parse_amount($myconfig, $form->{"lastcost_$i"});
-        if ($value == $form->{"old_lastcost_$i"})
+        if ($value == $form->parse_amount($myconfig, $form->{"old_lastcost_$i"}))
         {
             if ($form->{"lastupdate_$i"} eq "") {
                 $lastupdate = 'now()';
@@ -583,10 +583,11 @@ sub save {
     }
   }
 
-  CVar->save_custom_variables('dbh'       => $dbh,
-                              'module'    => 'IC',
-                              'trans_id'  => $form->{id},
-                              'variables' => $form);
+  CVar->save_custom_variables(dbh           => $dbh,
+                              module        => 'IC',
+                              trans_id      => $form->{id},
+                              variables     => $form,
+                              save_validity => 1);
 
   # commit
   my $rc = $dbh->commit;
@@ -1662,7 +1663,7 @@ sub prepare_parts_for_printing {
   }
 
   my $placeholders = join ', ', ('?') x scalar(@part_ids);
-  my $query        = qq|SELECT mm.parts_id, mm.model, v.name AS make
+  my $query        = qq|SELECT mm.parts_id, mm.model, mm.lastcost, v.name AS make
                         FROM makemodel mm
                         LEFT JOIN vendor v ON (mm.make = v.id)
                         WHERE mm.parts_id IN ($placeholders)|;