X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/47da14db313eaeb6cd2d260dc60e1c56a9437efc..cd6bfeee2bf076f15f9fdf57806a7c42bdf1760e:/bin/mozilla/io.pl diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 9f5cadf24..f8c660d2a 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -126,8 +126,6 @@ sub _check_io_auth { sub display_row { $main::lxdebug->enter_sub(); - _check_io_auth(); - my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; @@ -373,8 +371,9 @@ sub display_row { } } - my $edit_prices = $main::auth->assert('edit_prices', 1) && (!$::form->{"active_price_source_$i"} || !$price || $price->editable); - my $edit_discounts = $main::auth->assert('edit_prices', 1) && !$::form->{"active_discount_source_$i"}; + my $right_to_edit_prices = (!$is_purchase && $main::auth->assert('sales_edit_prices', 1)) || ($is_purchase && $main::auth->assert('purchase_edit_prices', 1)); + my $edit_prices = $right_to_edit_prices && (!$::form->{"active_price_source_$i"} || !$price || $price->editable); + my $edit_discounts = $right_to_edit_prices && !$::form->{"active_discount_source_$i"}; $column_data{sellprice} = (!$edit_prices) ? $cgi->hidden( -name => "sellprice_$i", -id => "sellprice_$i", -value => $sellprice_value) . $sellprice_value : $cgi->textfield(-name => "sellprice_$i", -id => "sellprice_$i", -size => 10, -class => "numeric", -value => $sellprice_value); @@ -1655,8 +1654,6 @@ sub relink_accounts { my $form = $main::form; my %myconfig = %main::myconfig; - _check_io_auth(); - $form->{"taxaccounts"} =~ s/\s*$//; $form->{"taxaccounts"} =~ s/^\s*//; foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) { @@ -1899,12 +1896,19 @@ sub _make_record_item { if ($obj->meta->column($method)->isa('Rose::DB::Object::Metadata::Column::Date')) { $obj->${\"$method\_as_date"}($value); } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::(?:Numeric|Float|DoublePrecsion)$/) { - $obj->${\"$method\_as_number"}($value); + $obj->${\"$method\_as_number"}(($value // '') eq '' ? undef : $value); } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::Boolean$/) { $obj->$method(!!$value); + } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::(?:Big)?(?:Int(?:eger)?|Serial)$/) { + $obj->$method(($value // '') eq '' ? undef : $value * 1); } else { $obj->$method($value); } + + if ($method eq 'discount') { + $obj->discount($obj->discount / 100.0); + } + } else { $obj->{__additional_form_attributes}{$method} = $value; } @@ -1950,9 +1954,11 @@ sub _make_record { if ($obj->meta->column($method)->isa('Rose::DB::Object::Metadata::Column::Date')) { $obj->${\"$method\_as_date"}($::form->{$method}); } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::(?:Numeric|Float|DoublePrecsion)$/) { - $obj->${\"$method\_as_number"}($::form->{$method}); + $obj->${\"$method\_as_number"}(($::form->{$method} // '') eq '' ? undef : $::form->{$method}); } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::Boolean$/) { $obj->$method(!!$::form->{$method}); + } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::(?:Big)?(?:Int(?:eger)?|Serial)$/) { + $obj->$method(($::form->{$method} // '') eq '' ? undef : $::form->{$method} * 1); } else { $obj->$method($::form->{$method}); } @@ -2054,6 +2060,9 @@ sub show_sales_purchase_email_dialog { $email = '' if $::form->{type} eq 'purchase_delivery_order'; + $::form->{language} = $::form->get_template_language(\%::myconfig); + $::form->{language} = "_" . $::form->{language}; + my $email_form = { to => $email, cc => $email_cc,