X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FAM.pm;h=fa6e128ea7d57424c86df0c702fa30cf3ccc0b3b;hb=86e5dc5018345f284e64dd0b414c3d2865a16c51;hp=ec4c3f00cd69dd511725a0133314f9c464a436bc;hpb=6216f7b53a81a73641a2d98ea43f363b6a615b07;p=kivitendo-erp.git diff --git a/SL/AM.pm b/SL/AM.pm index ec4c3f00c..fa6e128ea 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -594,7 +594,6 @@ sub lead { $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - $form->{ALL}; while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { push @{ $form->{ALL} }, $ref; } @@ -690,7 +689,6 @@ sub business { $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - $form->{ALL}; while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { push @{ $form->{ALL} }, $ref; } @@ -962,12 +960,13 @@ sub get_buchungsgruppe { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my $query; # connect to database my $dbh = $form->dbconnect($myconfig); if ($form->{id}) { - my $query = + $query = qq|SELECT description, inventory_accno_id, (SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno, income_accno_id_0, @@ -997,7 +996,7 @@ sub get_buchungsgruppe { $sth->finish; - my $query = + $query = qq|SELECT count(id) = 0 AS orphaned FROM parts WHERE buchungsgruppen_id = ?|; @@ -1538,7 +1537,7 @@ sub save_preferences { # save first currency in myconfig $form->{currency} = substr($form->{curr}, 0, 3); - my $myconfig = new User "$memberfile", "$form->{login}"; + $myconfig = new User "$memberfile", "$form->{login}"; foreach my $item (keys %$form) { $myconfig->{$item} = $form->{$item}; @@ -1881,6 +1880,17 @@ sub units_in_use { $main::lxdebug->leave_sub(); } +# if $a is translatable to $b, return the factor between them. +# else return 1 +sub convert_unit { + $main::lxdebug->enter_sub(2); + ($this, $a, $b, $all_units) = @_; + + $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a} && $all_units->{$b}; + $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a}{base_unit} eq $all_units->{$b}{base_unit}; + $main::lxdebug->leave_sub(2) and return $all_units->{$a}{factor} / $all_units->{$b}{factor}; +} + sub unit_select_data { $main::lxdebug->enter_sub();