fixed account creation and dsiplay for systems without billing features


			
			
				1.2@1701
			
			
		
Daniel Tiefnig 16 years ago
parent 18aef238da
commit 1fd98eace2

@ -136,18 +136,22 @@ sub detail : Local {
$c->stash->{billing_profiles} = [ sort { $$a{data}{name} cmp $$b{data}{name} }
@{$$billing_profiles{result}} ];
} else {
my $product;
return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_product',
{ handle => $c->session->{voip_account}{product} },
\$product
);
$c->session->{voip_account}{product_name} = $$product{data}{name};
my $profile;
return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_billing_profile',
{ handle => $c->session->{voip_account}{billing_profile} },
\$profile
);
$c->session->{voip_account}{billing_profile_name} = $$profile{data}{name};
if(defined $c->session->{voip_account}{product}) {
my $product;
return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_product',
{ handle => $c->session->{voip_account}{product} },
\$product
);
$c->session->{voip_account}{product_name} = $$product{data}{name};
}
if(defined $c->session->{voip_account}{billing_profile}) {
my $profile;
return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_billing_profile',
{ handle => $c->session->{voip_account}{billing_profile} },
\$profile
);
$c->session->{voip_account}{billing_profile_name} = $$profile{data}{name};
}
}
$c->stash->{billing_features} = 1;
@ -185,10 +189,10 @@ sub save_account : Local {
my $billing_profile = $c->request->params->{billing_profile};
$settings{billing_profile} = $billing_profile if defined $billing_profile;
my $customer_id = $c->request->params->{customer_id};
my $customer_id = $c->request->params->{customer_id} || undef;
$settings{customer_id} = $customer_id if defined $customer_id;
if(keys %settings) {
if(keys %settings or (!$c->config->{billing_features} and !defined $account_id)) {
if(defined $account_id) {
if($c->model('Provisioning')->call_prov( $c, 'billing', 'update_voip_account',
{ id => $account_id,

@ -17,7 +17,13 @@
[% UNLESS Catalyst.session.admin.read_only %]
<div class="p1">
<h3><a class="force_arrows" href="/account/detail?edit_account=1">Create new account</a></h3>
<h3><a class="force_arrows"
[% IF Catalyst.config.billing_features %]
href="/account/detail?edit_account=1"
[% ELSE %]
href="/account/save_account"
[% END %]
>Create new account</a></h3>
</div>
[% END %]

@ -242,8 +242,17 @@
[% IF preference.value %]checked="checked"[% END %] />
</td>
</tr>
[% ELSIF preference.key == "prepaid"
|| preference.key == "has_extension" %]
[% ELSIF preference.key == "prepaid" %]
[% IF Catalyst.config.billing_features %]
<tr>
<td class="tdkey">[% preference.key %]:</td>
<td>
<input type="checkbox" name="[% preference.key %]" class="checkbox"
disabled="disabled" [% IF preference.value %]checked="checked"[% END %] />
</td>
</tr>
[% END %]
[% ELSIF preference.key == "has_extension" %]
<tr>
<td class="tdkey">[% preference.key %]:</td>
<td>

Loading…
Cancel
Save