From f0d897b6b9ffbbfe98c0dbc1638ef30c9b798729 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 1 Mar 2012 12:57:22 +0100 Subject: [PATCH] Dienstleistungen: makemodels auch speichern MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Nachtrag zu c6a4a05a9ad2ae02, Dienstleistungen müssen auch korrekt gespeichert und geladen werden. Fix zu Bug 1829 --- SL/IC.pm | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/SL/IC.pm b/SL/IC.pm index 47c5fea41..79d661837 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -164,28 +164,25 @@ sub get_part { #correct rows $form->{price_rows} = $i - 1; - unless ($form->{item} eq 'service') { - - # get makes - if ($form->{makemodel}) { - #hli - $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | . - qq|WHERE m.parts_id = ? order by m.sortorder asc|; - my @values = ($form->{id}); - $sth = $dbh->prepare($query); - $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")"); - - my $i = 1; - - while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"}, - $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array) - { - $i++; - } - $sth->finish; - $form->{makemodel_rows} = $i - 1; - + # get makes + if ($form->{makemodel}) { + #hli + $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | . + qq|WHERE m.parts_id = ? order by m.sortorder asc|; + my @values = ($form->{id}); + $sth = $dbh->prepare($query); + $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")"); + + my $i = 1; + + while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"}, + $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array) + { + $i++; } + $sth->finish; + $form->{makemodel_rows} = $i - 1; + } # get translations @@ -330,10 +327,8 @@ sub save { } $sth->finish; - if ($form->{item} ne 'service') { - # delete makemodel records - do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id})); - } + # delete makemodel records + do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id})); if ($form->{item} eq 'assembly') { # delete assembly records -- 2.20.1