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} } $c->stash->{billing_profiles} = [ sort { $$a{data}{name} cmp $$b{data}{name} }
@{$$billing_profiles{result}} ]; @{$$billing_profiles{result}} ];
} else { } else {
my $product; if(defined $c->session->{voip_account}{product}) {
return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_product', my $product;
{ handle => $c->session->{voip_account}{product} }, return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_product',
\$product { handle => $c->session->{voip_account}{product} },
); \$product
$c->session->{voip_account}{product_name} = $$product{data}{name}; );
my $profile; $c->session->{voip_account}{product_name} = $$product{data}{name};
return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_billing_profile', }
{ handle => $c->session->{voip_account}{billing_profile} }, if(defined $c->session->{voip_account}{billing_profile}) {
\$profile my $profile;
); return unless $c->model('Provisioning')->call_prov( $c, 'billing', 'get_billing_profile',
$c->session->{voip_account}{billing_profile_name} = $$profile{data}{name}; { handle => $c->session->{voip_account}{billing_profile} },
\$profile
);
$c->session->{voip_account}{billing_profile_name} = $$profile{data}{name};
}
} }
$c->stash->{billing_features} = 1; $c->stash->{billing_features} = 1;
@ -185,10 +189,10 @@ sub save_account : Local {
my $billing_profile = $c->request->params->{billing_profile}; my $billing_profile = $c->request->params->{billing_profile};
$settings{billing_profile} = $billing_profile if defined $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; $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(defined $account_id) {
if($c->model('Provisioning')->call_prov( $c, 'billing', 'update_voip_account', if($c->model('Provisioning')->call_prov( $c, 'billing', 'update_voip_account',
{ id => $account_id, { id => $account_id,

@ -17,7 +17,13 @@
[% UNLESS Catalyst.session.admin.read_only %] [% UNLESS Catalyst.session.admin.read_only %]
<div class="p1"> <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> </div>
[% END %] [% END %]

@ -242,8 +242,17 @@
[% IF preference.value %]checked="checked"[% END %] /> [% IF preference.value %]checked="checked"[% END %] />
</td> </td>
</tr> </tr>
[% ELSIF preference.key == "prepaid" [% ELSIF preference.key == "prepaid" %]
|| preference.key == "has_extension" %] [% 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> <tr>
<td class="tdkey">[% preference.key %]:</td> <td class="tdkey">[% preference.key %]:</td>
<td> <td>

Loading…
Cancel
Save