]> wagnertech.de Git - mfinanz.git/blobdiff - SL/IC.pm
Änderungen für die Aufklappmenüs Forderungen und Verbindlichkeiten verhindern, ...
[mfinanz.git] / SL / IC.pm
index bad463e5a8cd6c639d46ad978935fdc027b487ca..e3b33d7c7bdf77675e52c02b9df45a72cc8a10e5 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -288,7 +288,7 @@ sub save {
   my ($self, $myconfig, $form) = @_;
   my @values;
   # connect to database, turn off AutoCommit
-  my $dbh = $form->dbconnect_noauto($myconfig);
+  my $dbh = $form->get_standard_dbh;
 
   # save the part
   # make up a unique handle and store in partnumber field
@@ -593,7 +593,6 @@ sub save {
 
   # commit
   my $rc = $dbh->commit;
-  $dbh->disconnect;
 
   $main::lxdebug->leave_sub();
 
@@ -671,7 +670,7 @@ sub delete {
 
   my %columns = ( "assembly" => "id", "parts" => "id" );
 
-  for my $table (qw(prices partstax makemodel inventory assembly license translation parts)) {
+  for my $table (qw(prices partstax makemodel inventory assembly translation parts)) {
     my $column = defined($columns{$table}) ? $columns{$table} : "parts_id";
     do_query($form, $dbh, qq|DELETE FROM $table WHERE $column = ?|, @values);
   }
@@ -703,16 +702,17 @@ sub assembly_item {
     push(@values, '%' . $form->{"${column}_$i"} . '%');
   }
 
-  if ($form->{"id_${i}"}) {
-    $where .= qq| AND p.id = ?|;
-    push @values, $form->{"id_${i}"};
-  }
-
   if ($form->{id}) {
     $where .= qq| AND NOT (p.id = ?)|;
     push(@values, conv_i($form->{id}));
   }
 
+  # Search for part ID overrides all other criteria.
+  if ($form->{"id_${i}"}) {
+    $where  = qq|p.id = ?|;
+    @values = ($form->{"id_${i}"});
+  }
+
   if ($form->{partnumber}) {
     $where .= qq| ORDER BY p.partnumber|;
   } else {
@@ -912,6 +912,12 @@ sub all_parts {
     }
   }
 
+  if ($form->{"partsgroup_id"}) {
+    $form->{"l_partsgroup"} = '1'; # show the column
+    push @where_tokens, "pg.id = ?";
+    push @bind_vars, $form->{"partsgroup_id"};
+  }
+
   foreach (@like_filters) {
     next unless $form->{$_};
     $form->{"l_$_"} = '1'; # show the column