|
|
|
@ -431,9 +431,9 @@ sub create_defaults :Path('create_defaults') :Args(0) :Does(ACL) :ACLDetachTo('/
|
|
|
|
contract_id => $r{contracts}->id,
|
|
|
|
contract_id => $r{contracts}->id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
my $mappings_to_create = [];
|
|
|
|
my $mappings_to_create = [];
|
|
|
|
my $resource = { $r{contracts}->get_inflated_columns };
|
|
|
|
my $resource = { $r{contracts}->get_inflated_columns };
|
|
|
|
$resource->{billing_profile_id} = 1;
|
|
|
|
$resource->{billing_profile_id} = 1;
|
|
|
|
$resource->{type} = 'reseller';
|
|
|
|
$resource->{type} = 'reseller';
|
|
|
|
NGCP::Panel::Utils::Contract::prepare_billing_mappings(
|
|
|
|
NGCP::Panel::Utils::Contract::prepare_billing_mappings(
|
|
|
|
c => $c,
|
|
|
|
c => $c,
|
|
|
|
resource => $resource,
|
|
|
|
resource => $resource,
|
|
|
|
@ -442,18 +442,18 @@ sub create_defaults :Path('create_defaults') :Args(0) :Does(ACL) :ACLDetachTo('/
|
|
|
|
err_code => sub {
|
|
|
|
err_code => sub {
|
|
|
|
my ($err) = @_;
|
|
|
|
my ($err) = @_;
|
|
|
|
die( [$err, "showdetails"] );
|
|
|
|
die( [$err, "showdetails"] );
|
|
|
|
});
|
|
|
|
});
|
|
|
|
foreach my $mapping (@$mappings_to_create) {
|
|
|
|
foreach my $mapping (@$mappings_to_create) {
|
|
|
|
$r{contracts}->billing_mappings->create($mapping);
|
|
|
|
$r{contracts}->billing_mappings->create($mapping);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$r{contracts} = NGCP::Panel::Utils::Contract::get_contract_rs(
|
|
|
|
$r{contracts} = NGCP::Panel::Utils::Contract::get_contract_rs(
|
|
|
|
schema => $c->model('DB'))->search(undef, {
|
|
|
|
schema => $c->model('DB'),
|
|
|
|
'+select' => 'billing_mappings.id',
|
|
|
|
contract_id => $r{contracts}->id )->search(undef, {
|
|
|
|
'+as' => 'bmid',
|
|
|
|
'+select' => 'billing_mappings.id',
|
|
|
|
})
|
|
|
|
'+as' => 'bmid',
|
|
|
|
->find($r{contracts}->id);
|
|
|
|
})->find($r{contracts}->id);
|
|
|
|
$r{billing_mappings} = $r{contracts}->billing_mappings;
|
|
|
|
$r{billing_mappings} = $r{contracts}->billing_mappings;
|
|
|
|
|
|
|
|
|
|
|
|
$r{admins} = $billing->resultset('admins')->create({
|
|
|
|
$r{admins} = $billing->resultset('admins')->create({
|
|
|
|
%{ $defaults{admins} },
|
|
|
|
%{ $defaults{admins} },
|
|
|
|
reseller_id => $r{resellers}->id,
|
|
|
|
reseller_id => $r{resellers}->id,
|
|
|
|
|