+my (@payby, @pay_head, @pay_labels, @pay_links);
+
+my %payby = map {$_ => 1} $conf->config('payby');
+if(%payby) {
+ push @payby, 'CARD' if ($payby{'CARD'} or $payby{'DCRD'});
+ push @payby, 'CHEK' if ($payby{'CHEK'} or $payby{'DCHK'});
+}
+else {
+ @payby = ('CARD','CHEK')
+}
+
+if($opt{'payment_links'} && $curuser->access_right('Process payment') && @payby) {
+ my %label = ( CARD => 'Card',
+ CHEK => 'E-Check' );
+ push @pay_head, ({nodownload => 1}) foreach @payby;
+ $pay_head[0] = { label => 'Process',
+ nodownload => 1,
+ colspan => scalar(@payby) };
+
+ @pay_labels = (map { my $payby = $_;
+ my $label = $label{$payby};
+ sub {($payby eq $_[0]->payby) ? "<b>".emt("$label (on file)")."</b>" : emt($label)}
+ } @payby );
+
+ @pay_links = (map { [ "${p}misc/payment.cgi?payby=$_;custnum=", 'custnum' ] }
+ @payby );
+}
+
+my (@act_head, @act_blank, @act_fields, $act_align, $html_foot);
+if (delete($opt{'email_checkboxes'})) {
+ my $email_link = q!var url = toCGIString(); !;
+ $email_link .= q/if (!url) { alert('No customers selected'); return false; }; /;
+ $email_link .= q!url = '!;
+ $email_link .= "${p}misc/email-customers.html?table=cust_main";
+ $email_link .= q!' + url + '&popup=1&url=javascript%3Awindow.top.location.reload%28%29%3B'; !;
+ $email_link .= include('/elements/popup_link_onclick.html',
+ 'js_action' => 'url',
+ 'actionlabel' => 'Send Customer Email',
+ 'width' => '900',
+ 'height' => '500',
+ );
+ $html_foot = include('checkbox-foot.html',
+ label => 'Email selected customers',
+ onclick => $email_link,
+ );
+ push @act_fields, sub {
+ my $row = shift;
+ my $custnum = $row->custnum;
+ qq!<input type="checkbox" name="custnum" value="$custnum">!;
+ };
+ $act_align = 'l';
+ push @act_head, {nodownload => 1};
+ push @act_blank, '';
+}
+