diff --git a/lib/NGCP/Panel/Controller/Billing.pm b/lib/NGCP/Panel/Controller/Billing.pm index b6ffa35676..9278e01261 100644 --- a/lib/NGCP/Panel/Controller/Billing.pm +++ b/lib/NGCP/Panel/Controller/Billing.pm @@ -139,7 +139,8 @@ sub fees_base :Chained('fees_list') :PathPart('') :CaptureArgs(1) { return; } $c->stash(fee => {$res->get_columns}); #get_columns should not be used - $c->stash->{fee}->{'billing_zone.id'} = $res->billing_zone->id; + $c->stash->{fee}->{'billing_zone.id'} = $res->billing_zone->id + if (defined $res->billing_zone); $c->stash(fee_result => $res); } @@ -199,7 +200,7 @@ sub fees_edit :Chained('fees_base') :PathPart('edit') :Args(0) { ); if($posted && $form->validated) { $c->stash->{'fee_result'} - ->update($form->fif() ); + ->update($form->custom_get_values_to_update() ); $c->flash(messages => [{type => 'success', text => 'Billing Profile successfully changed!'}]); $c->response->redirect($c->uri_for($c->stash->{profile}->{id}, 'fees')); return; @@ -307,8 +308,20 @@ Show a modal to add a new billing_fee. =head2 fees_edit +Show a modal to edit a billing_fee. + =head2 fees_delete +Delete a billing_fee. + +=head2 zones_list + +basis for billing zones. part of a certain billing profile. + +=head2 zones_ajax + +sends a JSON representation of billing_zones und the current billing profile. + =head1 AUTHOR Gerhard Jungwirth C<< >> diff --git a/lib/NGCP/Panel/Form/BillingFee.pm b/lib/NGCP/Panel/Form/BillingFee.pm index f8538fe8c2..35e8bec71f 100644 --- a/lib/NGCP/Panel/Form/BillingFee.pm +++ b/lib/NGCP/Panel/Form/BillingFee.pm @@ -100,13 +100,25 @@ has_block 'actions' => ( sub custom_get_values { my ($self) = @_; - #TODO: this has sideeffects: the value remains changed, is this bad? - my $hashvalues = $self->value; + my $hashvalues = {%{$self->value}}; #prevents sideeffects foreach my $val(values %$hashvalues) { $val = '' unless defined($val); } return $hashvalues; } +sub custom_get_values_to_update { + my ($self) = @_; + my $hashvalues = { %{$self->value} }; #prevents sideeffects + foreach my $val(values %$hashvalues) { + $val = '' unless defined($val); + } + $hashvalues->{billing_zone_id} = defined $hashvalues->{billing_zone}->{id} ? + $hashvalues->{billing_zone}->{id}+0 : + ''; + delete $hashvalues->{billing_zone}; + return $hashvalues; +} + 1; # vim: set tabstop=4 expandtab: diff --git a/share/templates/widgets/admin_billing_overview.tt b/share/templates/widgets/admin_billing_overview.tt index b6acdb53d9..848708d69b 100644 --- a/share/templates/widgets/admin_billing_overview.tt +++ b/share/templates/widgets/admin_billing_overview.tt @@ -14,7 +14,7 @@
- Configure + Configure