Display billing profile name instead of id. WIP.

agranig/1_0_subfix
Andreas Granig 12 years ago
parent ecaf685e11
commit be0cea94be

@ -36,9 +36,17 @@ sub contract_list :Chained('/') :PathPart('contract') :CaptureArgs(0) {
})->get_column('id')->as_query, })->get_column('id')->as_query,
}, },
},{ },{
'join' => 'billing_mappings', 'join' => {
'+select' => 'billing_mappings.billing_profile_id', 'billing_mappings' => 'billing_profile',
'+as' => 'billing_profile', },
'+select' => [
'billing_mappings.billing_profile_id',
'billing_profile.name as billing_profile_name',
],
'+as' => [
'billing_profile',
'billing_profile_name',
],
}); });
$c->stash(contract_select_rs => $rs); $c->stash(contract_select_rs => $rs);
@ -189,11 +197,15 @@ sub delete :Chained('base') :PathPart('delete') :Args(0) {
sub ajax :Chained('contract_list') :PathPart('ajax') :Args(0) { sub ajax :Chained('contract_list') :PathPart('ajax') :Args(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
my $rs = $c->stash->{contract_select_rs}; my $rs = $c->stash->{contract_select_rs}->search({},{
'+select' => 'billing_profile.name',
'+as' => 'billing_profile_name',
'join' => {billing_mappings => 'billing_profile'},
});
$c->forward( "/ajax_process_resultset", [$rs, $c->forward( "/ajax_process_resultset", [$rs,
["id","contact_id","billing_profile","status"], ["id","contact_id","billing_profile_name","status"],
[]]); [2, 3]]);
$c->detach( $c->view("JSON") ); $c->detach( $c->view("JSON") );
} }
@ -297,12 +309,14 @@ sub customer_ajax :Chained('customer_list') :PathPart('ajax') :Args(0) {
my $rs = $base_rs->search({ my $rs = $base_rs->search({
'product_id' => undef, 'product_id' => undef,
}, { }, {
'join' => {'billing_mappings' => 'product'}, 'join' => {
'billing_mappings' => 'product',
},
}); });
$c->forward( "/ajax_process_resultset", [$rs, $c->forward( "/ajax_process_resultset", [$rs,
["id","contact_id","billing_profile","status"], ["id","contact_id","billing_profile_name","status"],
[3]]); [2, 3]]);
$c->detach( $c->view("JSON") ); $c->detach( $c->view("JSON") );
} }

@ -3,8 +3,8 @@
helper.name = 'Customers'; helper.name = 'Customers';
helper.data = contracts; helper.data = contracts;
helper.messages = messages; helper.messages = messages;
helper.column_titles = [ '#', 'Contact #', 'Billing Profile #', 'Status' ]; helper.column_titles = [ '#', 'Contact #', 'Billing Profile', 'Status' ];
helper.column_fields = [ 'id', 'contact_id', 'billing_profile', 'status' ]; helper.column_fields = [ 'id', 'contact_id', 'billing_profile_name', 'status' ];
helper.close_target = close_target; helper.close_target = close_target;
helper.create_flag = create_flag; helper.create_flag = create_flag;

Loading…
Cancel
Save