increase package popup width
[freeside.git] / httemplate / view / cust_main / packages.html
1 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
2
3 % my $s = 0;
4 % if ( $curuser->access_right('Order customer package') ) { 
5   <% $s++ ? ' | ' : '' %>
6   <% order_pkg_link($cust_main) %>
7 % } 
8
9 % if ( $curuser->access_right('One-time charge')
10 %        && $conf->config('payby-default') ne 'HIDE'
11 %      ) {
12 %
13   <% $s++ ? ' | ' : '' %>
14   <% popup_link('edit/quick-charge.html?custnum='. $cust_main->custnum, 'One-time charge', 'One-time charge', '#333399', 545) %>
15 % } 
16 % if ( $curuser->access_right('Bulk change customer packages') ) { 
17   <% $s++ ? ' | ' : '' %>
18   <A HREF="<% $p %>edit/cust_pkg.cgi?<% $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services)
19 % } 
20
21
22 <BR><BR>
23 % if ( @$packages ) { 
24
25 Current packages
26 % } 
27 % if ( $cust_main->num_cancelled_pkgs ) {
28 %     if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me
29 %          || ( $conf->exists('hidecancelledpackages')
30 %               && ! $cgi->param('showcancelledpackages')
31 %             )
32 %        )
33 %     {
34 %       $cgi->param('showcancelledpackages', 1);
35 %
36
37   ( <a href="<% $cgi->self_url %>">show
38 %   } else {
39 %       $cgi->param('showcancelledpackages', 0);
40 %
41
42   ( <a href="<% $cgi->self_url %>">hide
43 %   } 
44
45  cancelled packages</a> )
46 % } 
47 % if ( @$packages ) { 
48
49
50 <% include('/elements/table-grid.html') %>
51 % my $bgcolor1 = '#eeeeee';
52 %   my $bgcolor2 = '#ffffff';
53 %   my $bgcolor = '';
54
55 <TR>
56   <TH CLASS="grid" BGCOLOR="#cccccc">Package</TH>
57   <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
58   <TH CLASS="grid" BGCOLOR="#cccccc">Services</TH>
59 </TR>
60
61 %foreach my $cust_pkg (@$packages) {
62 %
63 %  my $part_pkg = $cust_pkg->part_pkg;
64 %
65 %  if ( $bgcolor eq $bgcolor1 ) {
66 %    $bgcolor = $bgcolor2;
67 %  } else {
68 %    $bgcolor = $bgcolor1;
69 %  }
70
71
72 <!--pkgnum: <% $cust_pkg->pkgnum %>-->
73 <TR>
74
75   <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
76
77     <A NAME="cust_pkg<% $cust_pkg->pkgnum %>" ID="cust_pkg<% $cust_pkg->pkgnum %>"><% $cust_pkg->pkgnum %></A>:
78     <% $part_pkg->pkg %> - <% $part_pkg->comment %>
79     <BR>
80
81     <FONT SIZE=-1>
82 % unless ( $cust_pkg->get('cancel') ) { 
83 %   my $br = 0;
84 %   if ( $curuser->access_right('Change customer package') ) { $br=1;
85
86             (&nbsp;<%pkg_change_link($cust_pkg)%>&nbsp;)
87 %   } 
88 %   if ( $curuser->access_right('Edit customer package dates') ) { $br=1;
89
90             (&nbsp;<%pkg_dates_link($cust_pkg)%>&nbsp;)
91 %   } 
92 %   if ( $curuser->access_right('Customize customer package') ) { $br=1;
93
94             (&nbsp;<%pkg_customize_link($cust_pkg,$cust_main->custnum)%>&nbsp;)
95 %   } 
96     <% $br ? '<BR>' : '' %>
97 % } 
98
99 % if ( $cust_pkg->num_cust_event
100 %      && (    $curuser->access_right('Billing event reports')
101 %           || $curuser->access_right('View customer billing events')
102 %         )
103 %    ) {
104     (&nbsp;<%pkg_event_link($cust_pkg)%>&nbsp;)
105 % }
106
107     </FONT>
108
109   </TD>
110
111   <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
112     <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
113 %
114 %  sub myfreq {
115 %    my $part_pkg = shift;
116 %    my $freq = $part_pkg->freq_pretty;
117 %    $freq =~ s/ /&nbsp;/g;
118 %    $freq;
119 %  }
120 %
121 %  #this should use cust_pkg->status and cust_pkg->statuscolor eventually
122 %
123 %  my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4;
124 %  my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%';
125 %
126 %  #false laziness w/edit/REAL_cust_pkg.cgi
127 %  my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until );
128 %  unless ( $part_pkg->is_prepaid ) {
129 %    $billed_or_prepaid = 'billed';
130 %    $last_bill_or_renewed = 'Last&nbsp;bill';
131 %    $next_bill_or_prepaid_until = 'Next&nbsp;bill';
132 %  } else {
133 %    $billed_or_prepaid = 'prepaid';
134 %    $last_bill_or_renewed = 'Renewed';
135 %    $next_bill_or_prepaid_until = 'Prepaid&nbsp;until';
136 %  }
137 %
138 %
139 % if ( $cust_pkg->get('cancel') ) { 
140  <!-- #status: cancelled -->
141
142   <TR>
143     <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#ff0000"><B>Cancelled&nbsp;</B></FONT></TD>
144     <% pkg_datestr($cust_pkg, 'cancel', $conf) %>
145   </TR>
146   <TR>
147     <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#ff0000" SIZE="-2">
148       <% $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' %>
149     </FONT></TD>
150   </TR>
151 % unless ( $cust_pkg->get('setup') ) { 
152
153
154     <TR>
155       <TD COLSPAN=<%$colspan%>>Never billed</TD>
156     </TR>
157 % } else { 
158
159
160     <TR>
161       <TD WIDTH="<%$width%>" ALIGN="right">Setup&nbsp;</TD>
162       <% pkg_datestr($cust_pkg, 'setup', $conf) %>
163     </TR>
164 % if ( $cust_pkg->get('last_bill') ) { 
165
166       <TR>
167         <TD WIDTH="<%$width%>" ALIGN="right"><% $last_bill_or_renewed %>&nbsp;</TD>
168         <% pkg_datestr($cust_pkg, 'last_bill',$conf) %>
169       </TR>
170 % } 
171 % if ( $cust_pkg->get('susp') ) { 
172
173       <TR>
174         <TD WIDTH="<%$width%>" ALIGN="right">Suspended&nbsp;</TD>
175         <% pkg_datestr($cust_pkg, 'susp', $conf) %>
176       </TR>
177 % } 
178 % } 
179 % } else { 
180 % if ( $cust_pkg->get('susp') ) { 
181  <!-- #status: suspended -->
182
183     <TR>
184       <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#FF9900"><B>Suspended</B>&nbsp;</FONT></TD>
185       <% pkg_datestr($cust_pkg, 'susp', $conf) %>
186     </TR>
187     <TR>
188       <TD WIDTH="<%$width%>" ALIGN="right"><FONT COLOR="#FF9900" SIZE="-2">
189         <% $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' %>
190       </FONT></TD>
191     </TR>
192 % unless ( $cust_pkg->get('setup') ) { 
193
194
195       <TR>
196         <TD COLSPAN=<%$colspan%>>Never billed</TD>
197       </TR>
198 % } else { 
199
200
201       <TR>
202         <TD WIDTH="<%$width%>" ALIGN="right">Setup&nbsp;</TD>
203         <% pkg_datestr($cust_pkg, 'setup', $conf) %>
204       </TR>
205 % } 
206 % if ( $cust_pkg->get('last_bill') ) { 
207
208       <TR>
209         <TD WIDTH="<%$width%>" ALIGN="right"><% $last_bill_or_renewed %>&nbsp;</TD>
210         <% pkg_datestr($cust_pkg, 'last_bill', $conf) %>
211       </TR>
212 % } 
213
214
215     <!-- # next bill ?? -->
216 % if ( $cust_pkg->get('expire') ) { 
217
218       <TR>
219         <TD WIDTH="<%$width%>" ALIGN="right">Expires&nbsp;</TD>
220         <% pkg_datestr($cust_pkg, 'expire', $conf) %>
221       </TR>
222 % } 
223
224
225     <TR>
226       <TD COLSPAN=<%$colspan%>>
227         <FONT SIZE=-1>
228 % if ( $curuser->access_right('Unsuspend customer package') ) { 
229
230             (&nbsp;<% pkg_unsuspend_link($cust_pkg) %>&nbsp;)
231 % } 
232 % if ( $curuser->access_right('Cancel customer package immediately') ) { 
233
234             (&nbsp;<% pkg_cancel_link($cust_pkg) %>&nbsp;)
235 % } 
236
237         </FONT>
238       </TD>
239     </TR>
240 % } else { 
241  <!-- #status: active -->
242 % unless ( $cust_pkg->get('setup') ) { 
243  <!-- #not setup -->
244 % unless ( $part_pkg->freq ) { 
245
246
247         <TR>
248           <TD COLSPAN=<%$colspan%>>Not&nbsp;yet&nbsp;billed&nbsp;(one-time&nbsp;charge)</TD>
249         </TR>
250
251         <TR>
252           <TD COLSPAN=<%$colspan%>>
253             <FONT SIZE=-1>
254 % if ( $curuser->access_right('Cancel customer package immediately') ) { 
255
256                 (&nbsp;<% pkg_cancel_link($cust_pkg) %>&nbsp;)
257 % } 
258
259             </FONT>
260           </TD>
261         </TR>
262 % } else { 
263
264
265         <TR>
266           <TD COLSPAN=<%$colspan%>>Not&nbsp;yet&nbsp;billed&nbsp;(<% $billed_or_prepaid %>&nbsp;<% myfreq($part_pkg) %>)</TD>
267         </TR>
268 % } 
269 % } else { 
270  <!-- #setup -->
271 % unless ( $part_pkg->freq ) { 
272
273
274         <TR>
275           <TD COLSPAN=<%$colspan%>>One-time&nbsp;charge</TD>
276         </TR>
277
278         <TR>
279           <TD WIDTH="<%$width%>" ALIGN="right">Billed&nbsp;</TD>
280           <% pkg_datestr($cust_pkg, 'setup', $conf) %>
281         </TR>
282 % } else { 
283 % if (scalar($cust_pkg->overlimit)) {
284         <TR>
285           <TD COLSPAN=<%$colspan%>><FONT COLOR="#FFD000"><B>Overlimit</B></FONT>,&nbsp;<% $billed_or_prepaid %>&nbsp;<% myfreq($part_pkg) %></TD>
286         </TR>
287 %}else{
288         <TR>
289           <TD COLSPAN=<%$colspan%>><FONT COLOR="#00CC00"><B>Active</B></FONT>,&nbsp;<% $billed_or_prepaid %>&nbsp;<% myfreq($part_pkg) %></TD>
290         </TR>
291 % } 
292         <TR>
293           <TD WIDTH="<%$width%>" ALIGN="right">Setup&nbsp;</TD>
294           <% pkg_datestr($cust_pkg, 'setup', $conf) %>
295         </TR>
296 % } 
297 % } 
298 % if ( $cust_pkg->get('last_bill') ) { 
299
300       <TR>
301         <TD WIDTH="<%$width%>" ALIGN="right"><% $last_bill_or_renewed %>&nbsp;</TD>
302         <% pkg_datestr($cust_pkg, 'last_bill', $conf) %>
303       </TR>
304 % } 
305 % if ( $cust_pkg->get('bill') ) { #next bill
306
307       <TR>
308         <TD WIDTH="<%$width%>" ALIGN="right"><% $next_bill_or_prepaid_until %>&nbsp;</TD>
309         <% pkg_datestr($cust_pkg, 'bill', $conf) %>
310       </TR>
311 % } 
312 % if ( $cust_pkg->get('adjourn') ) { 
313
314       <TR>
315         <TD WIDTH="<%$width%>" ALIGN="right">Adjourns&nbsp;</TD>
316         <% pkg_datestr($cust_pkg, 'adjourn', $conf) %>
317       </TR>
318 % } 
319 % if ( $cust_pkg->get('expire') ) { 
320
321       <TR>
322         <TD WIDTH="<%$width%>" ALIGN="right">Expires&nbsp;</TD>
323         <% pkg_datestr($cust_pkg, 'expire', $conf) %>
324       </TR>
325 % } 
326 % if ( $part_pkg->freq ) { 
327
328       <TR>
329         <TD COLSPAN=<%$colspan%>>
330           <FONT SIZE=-1>
331 % if ( $curuser->access_right('Suspend customer package') ) { 
332
333               (&nbsp;<% pkg_suspend_link($cust_pkg) %>&nbsp;)
334 % } 
335 % if ( $curuser->access_right('Suspend customer package later') ) { 
336
337               (&nbsp;<% pkg_adjourn_link($cust_pkg) %>&nbsp;)
338 % } 
339 % if ( $curuser->access_right('Cancel customer package immediately') ) { 
340
341               (&nbsp;<% pkg_cancel_link($cust_pkg) %>&nbsp;)
342 % } 
343 % if ( $curuser->access_right('Cancel customer package later') ) { 
344
345               (&nbsp;<% pkg_expire_link($cust_pkg) %>&nbsp;)
346 % } 
347
348           <FONT>
349         </TD>
350       </TR>
351 % } 
352 % } 
353 % } 
354
355
356 </TABLE>
357 </TD>
358
359 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
360   <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
361
362 %  #foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) {
363 %  foreach my $part_svc ( $cust_pkg->part_svc ) {
364
365 %    #foreach my $service (@{$svcpart->{services}}) {
366 %    foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) {
367
368       <TR>
369         <TD ALIGN="right" VALIGN="top"><% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %></TD>
370         <TD STYLE="padding-bottom:0px"><B><% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %></B></TD>
371       </TR>
372
373       <TR>
374         <TD ALIGN="right" COLSPAN="2" VALIGN="top" STYLE="padding-bottom:1px;padding-top:0px"><FONT SIZE="-2" COLOR="#FFD000">
375
376             <% $cust_svc->overlimit ? "Overlimit: ". time2str('%b %o %Y' . ($conf->exists('cust_pkg-display_times') ? ' %l:%M %P' : ''), $cust_svc->overlimit) : '' %>
377           </FONT></TD>
378       </TR>
379
380       <TR>
381         <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px;padding-top:0px"><FONT SIZE="-2">
382
383 %         if ( $curuser->access_right('Recharge customer service')
384 %              && $part_svc->svcdb eq 'svc_acct'
385 %              && (    $cust_svc->svc_x->seconds    ne ''
386 %                   || $cust_svc->svc_x->upbytes    ne ''
387 %                   || $cust_svc->svc_x->downbytes  ne ''
388 %                   || $cust_svc->svc_x->totalbytes ne ''
389 %                 )
390 %         ) { 
391             (&nbsp;<%svc_recharge_link($cust_svc)%>&nbsp;)
392 %         } 
393           </FONT></TD>
394
395           <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px;padding-top:0px"><FONT SIZE="-2">
396
397 %         if ( $curuser->access_right('Unprovision customer service') ) { 
398             (&nbsp;<%svc_unprovision_link($cust_svc)%>&nbsp;)
399 %         } 
400           </FONT></TD>
401         </TR>
402 %   } 
403
404 %   if (    ! $cust_pkg->get('cancel')
405 %        && $curuser->access_right('Provision customer service') 
406 %        && $part_svc->num_avail
407 %      ) {
408
409       <TR>
410         <TD COLSPAN=2 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
411           <B><% svc_provision_link($cust_pkg, $part_svc, $conf, $curuser) %></B>
412         </TD>
413       </TR>
414
415 %   } 
416
417 % } 
418
419 </TABLE>
420 </TD>
421 % } #end display packages
422 %
423
424
425 </TABLE>
426 % } else { 
427
428 <BR>
429 % } 
430 % if ( $cgi->param('fragment') =~ /^cust_pkg(\d+)$/ ) {
431   <SCRIPT>
432     // IE-specific hack.  other browsers listen to #fragments
433     // is this even working?  or is the #target redirection just working cause
434     // we set the URL params differently?
435     var el = document.getElementById( 'cust_pkg<% $1 %>' );
436     if ( el ) el.scrollIntoView(true);
437   </SCRIPT>
438 % }
439 <%init>
440
441 my( $cust_main ) = @_;
442 my $conf = new FS::Conf;
443
444 my $curuser = $FS::CurrentUser::CurrentUser;
445
446 my $packages = get_packages($cust_main, $conf);
447 </%init>
448 <%once>
449
450 #subroutines
451
452 sub get_packages {
453   my $cust_main = shift or return undef;
454   my $conf = shift;
455   
456   my @packages = ();
457   my $method;
458   if (  $cgi->param('showcancelledpackages') eq '0' #see if it was set by me
459      || ( $conf->exists('hidecancelledpackages')
460            && ! $cgi->param('showcancelledpackages') )
461      )
462   {
463     $method = 'ncancelled_pkgs';
464   } else {
465     $method = 'all_pkgs';
466   }
467
468   [ $cust_main->$method() ];
469 }
470   
471 sub svc_provision_link {
472   my ($cust_pkg, $part_svc, $conf, $curuser) = @_;
473   ( my $svc_nbsp = $part_svc->svc ) =~ s/\s+/&nbsp;/g;
474   my $num_avail = $part_svc->num_avail;
475   my $pkgnum_svcpart = "pkgnum=". $cust_pkg->pkgnum. ';'.
476                        "svcpart=". $part_svc->svcpart;
477   my $url;
478   if ( $part_svc->svcdb eq 'svc_external' #could be generalized
479        && $conf->exists('svc_external-skip_manual')
480   ) {
481     $url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$pkgnum_svcpart";
482   } else {
483     $url = svc_url(
484                     'm'        => $m,
485                     'action'   => 'edit',
486                     'part_svc' => $part_svc, 
487                     'query'    => $pkgnum_svcpart,
488                   );
489     #$url = "${p}edit/$svcpart->{svcdb}.cgi?$pkgnum_svcpart";
490   }
491
492   my $link = qq!<A CLASS="provision" HREF="$url">!.
493              "Provision&nbsp;$svc_nbsp&nbsp;($num_avail)</A>";
494   if ( $conf->exists('legacy_link')
495        && $curuser->access_right('View/link unlinked services')
496      )
497   {
498     $link .= '<BR>'.
499              qq!<A CLASS="provision" HREF="${p}misc/link.cgi?!.
500              qq!$pkgnum_svcpart">!.
501             "Link&nbsp;to&nbsp;legacy&nbsp;$svc_nbsp&nbsp;($num_avail)</A>";
502   }
503   $link;
504 }
505
506 sub svc_unprovision_link {
507   my $cust_svc = shift or return '';
508   qq!<A HREF="javascript:areyousure('${p}misc/unprovision.cgi?!. $cust_svc->svcnum.
509   qq!', 'Permanently unprovision and delete this service?')">Unprovision</A>!;
510 }
511
512 sub pkg_datestr {
513   my($cust_pkg, $field, $conf) = @_ or return '';
514   return '&nbsp;' unless $cust_pkg->get($field);
515   my $format = '<TD align="left"><B>%b</B></TD>'.
516                '<TD align="right"><B>&nbsp;%o,</B></TD>'.
517                '<TD align="right"><B>&nbsp;%Y</B></TD>';
518   #$format .= '&nbsp;<FONT SIZE=-3>%l:%M:%S%P&nbsp;%z</FONT>'
519   $format .= '<TD ALIGN="right"><B>&nbsp;%l</TD>'.
520              '<TD ALIGN="center"><B>:</B></TD>'.
521              '<TD ALIGN="left"><B>%M</B></TD>'.
522              '<TD ALIGN="left"><B>&nbsp;%P</B></TD>'
523     if $conf->exists('cust_pkg-display_times');
524   my $strip = time2str($format, $cust_pkg->get($field) );
525   $strip =~ s/ (\d)/$1/g;
526   $strip;
527 }
528
529 sub pkg_change_link    { pkg_popup_link('misc/change_pkg.cgi?dummy=value',
530                                           'Change&nbsp;package',
531                                           'Change',
532                                           '',
533                                           @_
534                                        );
535                        }
536
537 sub pkg_suspend_link   { pkg_popup_link( 'misc/cancel_pkg.html?method=suspend',
538                                          'Suspend&nbsp;now',
539                                          'Suspend',
540                                          '#FF9900',
541                                          @_
542                                        );
543                        }
544
545 sub pkg_adjourn_link   { pkg_popup_link( 'misc/cancel_pkg.html?method=adjourn',
546                                          'Suspend&nbsp;later',
547                                          'Adjourn',
548                                          '#CC6600',
549                                          @_
550                                        );
551                        }
552
553 sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg',    'Unsuspend',           @_ ); }
554 sub pkg_expire_link    { pkg_link('misc/expire_pkg',    'Cancel&nbsp;later',   @_ ); }
555 sub pkg_dates_link     { pkg_link('edit/REAL_cust_pkg', 'Edit&nbsp;dates',     @_ ); }
556
557 sub pkg_cancel_link    { pkg_popup_link( 'misc/cancel_pkg.html?method=cancel',
558                                          'Cancel&nbsp;now',
559                                          'Cancel',
560                                          '#ff0000',
561                                          @_
562                                        );
563                        }
564
565 sub pkg_expire_link    { pkg_popup_link( 'misc/cancel_pkg.html?method=expire',
566                                          'Cancel&nbsp;later',
567                                          'Expire', #"Cancel package $num later"
568                                          '#CC0000',
569                                          @_
570                                        );
571                        }
572
573 sub svc_recharge_link  { svc_popup_link( 'misc/recharge_svc.html',
574                                          'Recharge',
575                                          'Recharge',
576                                          '#333399',
577                                          @_
578                                        );
579                        }
580
581 sub order_pkg_link { cust_popup_link( 'misc/order_pkg.html',
582                                       'Order&nbsp;new&nbsp;package',
583                                       'Order new package',
584                                       '#333399',
585                                       @_
586                                     );
587                    }
588
589 sub pkg_event_link {
590   my($cust_pkg) = @_;
591   qq!<a href="${p}search/cust_event.html?pkgnum=!. $cust_pkg->pkgnum. qq!">!.
592   'View package events'.
593   '</a>';
594 }
595
596 sub pkg_link {
597   my($action, $label, $cust_pkg) = @_;
598   return '' unless $cust_pkg;
599   qq!<a href="$p$action.cgi?!. $cust_pkg->pkgnum. qq!">$label</a>!;
600 }
601
602 sub pkg_popup_link {
603   my($action, $label, $actionlabel, $color, $cust_pkg) = @_;
604   $action .= '&pkgnum='. $cust_pkg->pkgnum;
605   $actionlabel .= ' package '. $cust_pkg->pkgnum;
606   popup_link($action, $label, $actionlabel, $color, 768);
607 }
608
609 sub svc_popup_link {
610   my($action, $label, $actionlabel, $color, $cust_svc) = @_;
611   $action .= '?svcnum='. $cust_svc->svcnum;
612   $actionlabel .= ' service '. $cust_svc->svcnum;
613   popup_link($action, $label, $actionlabel, $color);
614 }
615
616 sub cust_popup_link {
617   my($action, $label, $actionlabel, $color, $cust_main) = @_;
618   $action .= '?'. $cust_main->custnum;
619   popup_link($action, $label, $actionlabel, $color);
620 }
621
622 sub popup_link {
623   my($action, $label, $actionlabel, $color, $width) = @_;
624   $color ||= '#333399';
625   $width ||= 540;
626   qq!<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('$p$action', $width, 336, 'pkg_or_svc_action_popup' ), CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '$color', CGCOLOR, '$color' ); return false;">$label</A>!;
627 }
628
629 sub pkg_customize_link {
630   my $cust_pkg = shift or return '';
631   my $custnum = $cust_pkg->custnum;
632   qq!<A HREF="${p}edit/part_pkg.cgi?!.
633     "keywords=$custnum;".
634     "clone=". $cust_pkg->part_pkg->pkgpart. ';'.
635     "pkgnum=". $cust_pkg->pkgnum.
636     qq!">Customize</A>!;
637 }
638
639 </%once>