MT#3855 Fix empty contract tab on Reseller details

When the reseller has a wrong contract assigned to
him, this contract is not shown because it has already
been filtered out in the Contract controller. In favor
of usability now show it anyway.

Also only present correct contracts on edit/create
resellers in the first place.

See (Mantis:3855#c25797)
apogrebennyk/3_1_force_outbound
Gerhard Jungwirth 12 years ago
parent 7945805883
commit b2bcac6fec

@ -338,9 +338,11 @@ sub reseller_ajax_contract_filter :Chained('reseller_list') :PathPart('ajax/cont
return;
}
my $rs = $c->stash->{reseller_rs}->search_rs({
'me.id' => $contract_id,
});
my $rs = NGCP::Panel::Utils::Contract::get_contract_rs(
schema => $c->model('DB'))
->search_rs({
'me.id' => $contract_id,
});
my $contract_columns = NGCP::Panel::Utils::Datatables::set_columns($c, [
{ name => "id", search => 1, title => "#" },
{ name => "external_id", search => 1, title => "External #" },

@ -308,12 +308,16 @@ sub ajax_contract :Chained('list_reseller') :PathPart('ajax_contract') :Args(0)
$_->get_column('contract_id')
} else {}
} $c->stash->{resellers}->all;
my $free_contracts = $c->model('DB')
->resultset('contracts')
my $free_contracts = NGCP::Panel::Utils::Contract::get_contract_rs(
schema => $c->model('DB'))
->search_rs({
'me.status' => { '!=' => 'terminated' },
'me.id' => { 'not in' => \@used_contracts }
});
'me.id' => { 'not in' => \@used_contracts },
'product.class' => 'reseller',
},{
join => { 'billing_mappings' => 'product'},
}
);
NGCP::Panel::Utils::Datatables::process($c, $free_contracts, $c->stash->{contract_dt_columns});
$c->detach( $c->view("JSON") );
}

Loading…
Cancel
Save