X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pkg.cgi;h=207e4f6113aa98e163cdb5b8bdb717e2b12675ac;hb=b1dacaef3f9773c72b4c6f525d2f1e584e1432fc;hp=f03bbc26b18edab57aedc6867443f83f67ed8052;hpb=d1014a727cefa5d9813153594541f62ec15fc8b9;p=freeside.git
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index f03bbc26b..207e4f611 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -19,6 +19,7 @@
'Adjourn',
'Susp.',
'Expire',
+ 'Contract end',
'Cancel',
'Reason',
FS::UI::Web::cust_header(
@@ -59,7 +60,7 @@
#sub { time2str('%b %d %Y', shift->expire); },
#sub { time2str('%b %d %Y', shift->get('cancel')); },
( map { time_or_blank($_) }
- qw( setup last_bill bill adjourn susp expire cancel ) ),
+ qw( setup last_bill bill adjourn susp expire contract_end cancel ) ),
sub { my $self = shift;
my $return = '';
@@ -80,6 +81,18 @@
# '';
# },
sub {
+ my $cust_pkg = shift;
+ my $type = $cgi->param('_type') || '';
+ if ($type =~ /xls|csv/) {
+ my $cust_svc = $cust_pkg->primary_cust_svc;
+ if($cust_svc) {
+ return join ": ",($cust_svc->label)[0,1];
+ }
+ else {
+ return '';
+ }
+ }
+ else {
[ map {
[
{ 'data' => $_->[0]. ':',
@@ -91,9 +104,10 @@
$_->[2]. '.cgi?'. $_->[3],
},
];
- } shift->labels
+ } $cust_pkg->labels
];
- },
+ }
+ }
],
'color' => [
'',
@@ -143,7 +157,6 @@
),
'',
],
- 'extra_choices_callback'=> $extra_choices,
)
%>
<%init>
@@ -163,8 +176,9 @@ my %search_hash = ();
#some false laziness w/misc/bulk_change_pkg.cgi
$search_hash{'query'} = $cgi->keywords;
-
-for (qw( agentnum magic status classnum custom )) {
+
+#scalars
+for (qw( agentnum custnum magic status classnum custom cust_fields pkgbatch )) {
$search_hash{$_} = $cgi->param($_) if $cgi->param($_);
}
@@ -193,7 +207,7 @@ my %disable = (
'' => {},
);
-foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
+foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel active )) {
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
@@ -204,7 +218,7 @@ foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
}
-my $sql_query = FS::cust_pkg->search_sql(\%search_hash);
+my $sql_query = FS::cust_pkg->search(\%search_hash);
my $count_query = delete($sql_query->{'count_query'});
my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
@@ -253,22 +267,36 @@ sub time_or_blank {
};
}
-my $html_init = include('/elements/init_overlib.html');
-
-my $extra_choices = sub {
+my $html_init = sub {
my $query = shift;
-
- return '' unless
- $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages');
-
- '
'.
- include( '/elements/popup_link.html',
- 'label' => 'Change these packages',
- 'action' => "${p}misc/bulk_change_pkg.cgi?$query",
- 'actionlabel' => 'Change Packages',
- 'width' => 763,
- 'height' => 336,
- );
+ my $text = '';
+ my $curuser = $FS::CurrentUser::CurrentUser;
+
+ if ( $curuser->access_right('Bulk change customer packages') ) {
+ $text .= include('/elements/init_overlib.html').
+ include( '/elements/popup_link.html',
+ 'label' => 'Change these packages',
+ 'action' => "${p}misc/bulk_change_pkg.cgi?$query",
+ 'actionlabel' => 'Change Packages',
+ 'width' => 569,
+ 'height' => 210,
+ ). '
';
+
+ if ( $curuser->access_right('Edit customer package dates') ) {
+ $text .= include( '/elements/popup_link.html',
+ 'label' => 'Increment next bill date',
+ 'action' => "${p}misc/bulk_pkg_increment_bill.cgi?$query",
+ 'actionlabel' => 'Increment Bill Date',
+ 'width' => 569,
+ 'height' => 210,
+ ). '
';
+ }
+ $text .= include( '/elements/email-link.html',
+ 'search_hash' => \%search_hash,
+ 'table' => 'cust_pkg',
+ );
+ }
+ return $text;
};
%init>