From: G. Richardson Date: Thu, 28 Jul 2016 21:02:41 +0000 (+0200) Subject: $form->{item} nach $form->{part_type} umbenannt X-Git-Tag: release-3.5.4~1912 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f5abed8644dc069876b3e1cca970cb842fd50ffa;p=kivitendo-erp.git $form->{item} nach $form->{part_type} umbenannt Damit das Feld automatisch dem Datenbanknamen entspricht. --- diff --git a/SL/IC.pm b/SL/IC.pm index 942831bfa..84e913eb3 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -78,10 +78,8 @@ sub get_part { $form->{lastmtime} = $form->{mtime}; $form->{onhand} *= 1; - die "part needs a part_type" unless $form->{part_type}; # TODO from part_type enum conversion # part or service item - $form->{item} = $form->{part_type}; - if ($form->{item} eq 'assembly') { + if ($form->{part_type} eq 'assembly') { # retrieve assembly items $query = @@ -262,7 +260,7 @@ sub _save { my $priceupdate = ', priceupdate = current_date'; if ($form->{id}) { - my $trans_number = SL::TransNumber->new(type => $form->{item}, dbh => $dbh, number => $form->{partnumber}, id => $form->{id}); + my $trans_number = SL::TransNumber->new(type => $form->{part_type}, dbh => $dbh, number => $form->{partnumber}, id => $form->{id}); if (!$trans_number->is_unique) { $::lxdebug->leave_sub; return 3; @@ -275,7 +273,7 @@ sub _save { # delete makemodel records do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id})); - if ($form->{item} eq 'assembly') { + if ($form->{part_type} eq 'assembly') { # delete assembly records do_query($form, $dbh, qq|DELETE FROM assembly WHERE id = ?|, conv_i($form->{id})); } @@ -289,7 +287,7 @@ sub _save { $priceupdate = '' if (all { $previous_values->{$_} == $form->{$_} } qw(sellprice lastcost listprice)); } else { - my $trans_number = SL::TransNumber->new(type => $form->{item}, dbh => $dbh, number => $form->{partnumber}, save => 1); + my $trans_number = SL::TransNumber->new(type => $form->{part_type}, dbh => $dbh, number => $form->{partnumber}, save => 1); if ($form->{partnumber} && !$trans_number->is_unique) { $::lxdebug->leave_sub; @@ -299,7 +297,7 @@ sub _save { $form->{partnumber} ||= $trans_number->create_unique; ($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('id')|); - do_query($form, $dbh, qq|INSERT INTO parts (id, partnumber, unit, part_type) VALUES (?, ?, ?, ?)|, $form->{id}, $form->{partnumber}, $form->{unit}, $form->{item}); + do_query($form, $dbh, qq|INSERT INTO parts (id, partnumber, unit, part_type) VALUES (?, ?, ?, ?)|, $form->{id}, $form->{partnumber}, $form->{unit}, $form->{part_type}); $form->{orphaned} = 1; } @@ -310,7 +308,7 @@ sub _save { } my ($subq_inventory, $subq_expense, $subq_income); - if ($form->{"item"} eq "part") { + if ($form->{part_type} eq "part") { $subq_inventory = qq|(SELECT bg.inventory_accno_id FROM buchungsgruppen bg @@ -319,7 +317,7 @@ sub _save { $subq_inventory = "NULL"; } - if ($form->{"item"} ne "assembly") { + if ($form->{part_type} ne "assembly") { $subq_expense = qq|(SELECT tc.expense_accno_id FROM taxzone_charts tc @@ -391,7 +389,7 @@ sub _save { $form->{has_sernumber} ? 't' : 'f', $form->{not_discountable} ? 't' : 'f', $form->{microfiche}, - $form->{item}, + $form->{part_type}, conv_i($partsgroup_id), conv_i($form->{price_factor_id}), conv_i($form->{id}) @@ -458,7 +456,7 @@ sub _save { } # add assembly records - if ($form->{item} eq 'assembly') { + if ($form->{part_type} eq 'assembly') { # check additional assembly row my $i = $form->{assembly_rows}; # if last row is not empty add them diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 84fe35186..0405aa051 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -79,9 +79,9 @@ sub add { $auth->assert('part_service_assembly_edit'); - my $title = 'Add ' . ucfirst $form->{item}; + my $title = 'Add ' . ucfirst $form->{part_type}; $form->{title} = $locale->text($title); - $form->{callback} = "$form->{script}?action=add&item=$form->{item}" unless $form->{callback}; + $form->{callback} = "$form->{script}?action=add&part_type=$form->{part_type}" unless $form->{callback}; $form->{unit_changeable} = 1; IC->get_pricegroups(\%myconfig, \%$form); @@ -743,7 +743,7 @@ sub edit { $form->{"original_partnumber"} = $form->{"partnumber"}; - my $title = 'Edit ' . ucfirst $form->{item}; + my $title = 'Edit ' . ucfirst $form->{part_type}; $form->{title} = $locale->text($title); &link_part; @@ -763,8 +763,8 @@ sub link_part { map({ $form->{selectcurrency} .= "