This commit was generated by cvs2svn to compensate for changes in r6252,
[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 %  #my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4;
123 %  #my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%';
124 %
125 %  #false laziness w/edit/REAL_cust_pkg.cgi
126 %  my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until );
127 %  unless ( $part_pkg->is_prepaid ) {
128 %    $billed_or_prepaid = 'billed';
129 %    $last_bill_or_renewed = 'Last&nbsp;bill';
130 %    $next_bill_or_prepaid_until = 'Next&nbsp;bill';
131 %  } else {
132 %    $billed_or_prepaid = 'prepaid';
133 %    $last_bill_or_renewed = 'Renewed';
134 %    $next_bill_or_prepaid_until = 'Prepaid&nbsp;until';
135 %  }
136 %
137 %
138 % if ( $cust_pkg->get('cancel') ) { #status: cancelled
139
140     <% pkg_status_row($cust_pkg, 'Cancelled', 'cancel', 'color'=>'FF0000' ) %>
141
142     <% pkg_status_row_colspan(
143          ( $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' ), '',
144          'align' => 'right', 'color' => 'ff0000', 'size' => '-2',
145        )
146     %>
147
148 %   unless ( $cust_pkg->get('setup') ) { 
149
150         <% pkg_status_row_colspan('Never billed') %>
151
152 %   } else { 
153
154        <% pkg_status_row( $cust_pkg, 'Setup', 'setup' ) %>
155        <% pkg_status_row_changed( $cust_pkg ) %>
156        <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill' ) %>
157        <% pkg_status_row_if( $cust_pkg, 'Suspended', 'susp' ) %>
158
159 %   } 
160 %
161 % } else { 
162 %
163 %   if ( $cust_pkg->get('susp') ) { #status: suspended
164
165     <% pkg_status_row( $cust_pkg, 'Suspended', 'susp', 'color'=>'FF9900' ) %>
166
167     <% pkg_status_row_colspan(
168          ( $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' ), '',
169          'align' => 'right', 'color' => 'FF9900', 'size' => '-2',
170        )
171     %>
172
173 %   unless ( $cust_pkg->get('setup') ) { 
174       <% pkg_status_row_colspan('Never billed') %>
175 %   } else { 
176       <% pkg_status_row($cust_pkg, 'Setup', 'setup' ) %>
177 %   } 
178
179     <% pkg_status_row_changed( $cust_pkg ) %>
180     <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill' ) %>
181 %   # pkg_status_row($cust_pkg, 'Next bill', 'bill')
182     <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire' ) %>
183
184     <TR>
185       <TD COLSPAN=<%$colspan%>>
186         <FONT SIZE=-1>
187 %         if ( $curuser->access_right('Unsuspend customer package') ) { 
188             (&nbsp;<% pkg_unsuspend_link($cust_pkg) %>&nbsp;)
189 %         } 
190 %         if ( $curuser->access_right('Cancel customer package immediately') ) {
191             (&nbsp;<% pkg_cancel_link($cust_pkg) %>&nbsp;)
192 %         } 
193         </FONT>
194       </TD>
195     </TR>
196
197 %   } else { #status: active
198 %
199 %     unless ( $cust_pkg->get('setup') ) { #not setup
200 %
201 %       unless ( $part_pkg->freq ) { 
202
203           <% pkg_status_row_colspan('Not&nbsp;yet&nbsp;billed&nbsp;(one-time&nbsp;charge)') %>
204
205           <TR>
206             <TD COLSPAN=<%$colspan%>>
207               <FONT SIZE=-1>
208 %               if ( $curuser->access_right('Cancel customer package immediately') ) { 
209                   (&nbsp;<% pkg_cancel_link($cust_pkg) %>&nbsp;)
210 %               } 
211               </FONT>
212             </TD>
213           </TR>
214
215 %       } else { 
216
217          <% pkg_status_row_colspan("Not&nbsp;yet&nbsp;billed&nbsp;($billed_or_prepaid&nbsp;". myfreq($part_pkg). ')' ) %>
218
219 %       } 
220 %
221 %     } else { #setup
222 %
223 %       unless ( $part_pkg->freq ) { 
224
225           <% pkg_status_row_colspan('One-time&nbsp;charge') %>
226
227           <% pkg_status_row($cust_pkg, 'Billed', 'setup') %>
228
229 %       } else { 
230 %
231 %         if (scalar($cust_pkg->overlimit)) {
232
233             <% pkg_status_row_colspan(
234                  'Overlimit',
235                  $billed_or_prepaid. '&nbsp;'. myfreq($part_pkg),
236                  'color' => 'FFD000',
237                )
238             %>
239
240 %         } else {
241             <% pkg_status_row_colspan(
242                  'Active',
243                  $billed_or_prepaid. '&nbsp;'. myfreq($part_pkg),
244                  'color' => '00CC00',
245                )
246             %>
247 %         } 
248
249           <% pkg_status_row($cust_pkg, 'Setup', 'setup') %>
250
251 %       } 
252 %
253 %     } 
254
255       <% pkg_status_row_changed( $cust_pkg ) %>
256       <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill' ) %>
257       <% pkg_status_row_if( $cust_pkg, $next_bill_or_prepaid_until, 'bill' ) %>
258       <% pkg_status_row_if( $cust_pkg, 'Will suspend on', 'adjourn' ) %>
259       <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire' ) %>
260
261 %     if ( $part_pkg->freq ) { 
262
263         <TR>
264           <TD COLSPAN=<%$colspan%>>
265             <FONT SIZE=-1>
266 %             if ( $curuser->access_right('Suspend customer package') ) { 
267                 (&nbsp;<% pkg_suspend_link($cust_pkg) %>&nbsp;)
268 %             } 
269 %             if ( $curuser->access_right('Suspend customer package later') ) { 
270                 (&nbsp;<% pkg_adjourn_link($cust_pkg) %>&nbsp;)
271 %             } 
272 %             if ( $curuser->access_right('Cancel customer package immediately') ) { 
273                 (&nbsp;<% pkg_cancel_link($cust_pkg) %>&nbsp;)
274 %             } 
275 %             if ( $curuser->access_right('Cancel customer package later') ) { 
276                 (&nbsp;<% pkg_expire_link($cust_pkg) %>&nbsp;)
277 %             } 
278
279             <FONT>
280           </TD>
281         </TR>
282 %     }
283 %
284 %   } 
285 % } 
286
287 </TABLE>
288 </TD>
289
290 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
291   <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
292
293 %  #foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) {
294 %  foreach my $part_svc ( $cust_pkg->part_svc ) {
295
296 %    #foreach my $service (@{$svcpart->{services}}) {
297 %    foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) {
298
299       <TR>
300         <TD ALIGN="right" VALIGN="top"><% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %></TD>
301         <TD STYLE="padding-bottom:0px"><B><% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %></B></TD>
302       </TR>
303
304       <TR>
305         <TD ALIGN="right" COLSPAN="2" VALIGN="top" STYLE="padding-bottom:1px;padding-top:0px"><FONT SIZE="-2" COLOR="#FFD000">
306
307             <% $cust_svc->overlimit ? "Overlimit: ". time2str('%b %o %Y' . ($conf->exists('cust_pkg-display_times') ? ' %l:%M %P' : ''), $cust_svc->overlimit) : '' %>
308           </FONT></TD>
309       </TR>
310
311       <TR>
312         <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px;padding-top:0px"><FONT SIZE="-2">
313
314 %         if ( $curuser->access_right('Recharge customer service')
315 %              && $part_svc->svcdb eq 'svc_acct'
316 %              && (    $cust_svc->svc_x->seconds    ne ''
317 %                   || $cust_svc->svc_x->upbytes    ne ''
318 %                   || $cust_svc->svc_x->downbytes  ne ''
319 %                   || $cust_svc->svc_x->totalbytes ne ''
320 %                 )
321 %         ) { 
322             (&nbsp;<%svc_recharge_link($cust_svc)%>&nbsp;)
323 %         } 
324           </FONT></TD>
325
326           <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px;padding-top:0px"><FONT SIZE="-2">
327
328 %         if ( $curuser->access_right('Unprovision customer service') ) { 
329             (&nbsp;<%svc_unprovision_link($cust_svc)%>&nbsp;)
330 %         } 
331           </FONT></TD>
332         </TR>
333 %   } 
334
335 %   if (    ! $cust_pkg->get('cancel')
336 %        && $curuser->access_right('Provision customer service') 
337 %        && $part_svc->num_avail
338 %      ) {
339
340       <TR>
341         <TD COLSPAN=2 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
342           <B><% svc_provision_link($cust_pkg, $part_svc, $conf, $curuser) %></B>
343         </TD>
344       </TR>
345
346 %   } 
347
348 % } 
349
350 </TABLE>
351 </TD>
352 % } #end display packages
353 %
354
355
356 </TABLE>
357 % } else { 
358
359 <BR>
360 % } 
361 % if ( $cgi->param('fragment') =~ /^cust_pkg(\d+)$/ ) {
362   <SCRIPT>
363     // IE-specific hack.  other browsers listen to #fragments
364     // is this even working?  or is the #target redirection just working cause
365     // we set the URL params differently?
366     var el = document.getElementById( 'cust_pkg<% $1 %>' );
367     if ( el ) el.scrollIntoView(true);
368   </SCRIPT>
369 % }
370 <%init>
371
372 my( $cust_main ) = @_;
373 my $conf = new FS::Conf;
374
375 my $curuser = $FS::CurrentUser::CurrentUser;
376
377 my $packages = get_packages($cust_main, $conf);
378
379 my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4;
380 my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%';
381
382 sub pkg_status_row {
383   my( $cust_pkg, $title, $field, %opt ) = @_;
384
385   my $color = $opt{'color'};
386
387   my $html = qq(<TR><TD WIDTH="<%$width%>" ALIGN="right">);
388   $html   .= qq(<FONT COLOR="#$color"><B>) if length($color);
389   $html   .= qq($title&nbsp;);
390   $html   .= qq(</B></FONT>) if length($color);
391   $html   .= qq(</TD>);
392   $html   .= pkg_datestr($cust_pkg, $field, $conf).'</TR>';
393
394   $html;
395 }
396
397 sub pkg_status_row_if {
398   my( $cust_pkg, $title, $field, %opt ) = @_;
399   $cust_pkg->get($field) ? pkg_status_row(@_) : '';
400 }
401
402 sub pkg_status_row_changed {
403   my($cust_pkg) = @_;
404   return '' unless $cust_pkg->change_date;
405   my $html = pkg_status_row( $cust_pkg, 'Package&nbsp;changed', 'change_date' );
406   my $old = $cust_pkg->old_cust_pkg;
407   if ( $old ) {
408     my $part_pkg = $old->part_pkg;
409     my $label = 'Changed from '. $cust_pkg->change_pkgnum. ': '.
410                 $part_pkg->pkg. ' - '. $part_pkg->comment;
411     $html .= pkg_status_row_colspan( $label, '', size=>'-1', align=>'right' );
412   }
413   $html;
414 }
415
416 sub pkg_status_row_colspan {
417   my($title, $addl, %opt) = @_;
418
419   my $align = $opt{'align'} ? 'ALIGN="'. $opt{'align'}.'"' : '';
420   my $color = $opt{'color'} ? 'COLOR="#'.$opt{'color'}.'"' : '';
421   my $size  = $opt{'size'}  ? 'SIZE="'.  $opt{'size'}. '"' : '';
422
423   my $html = qq(<TR><TD COLSPAN=$colspan $align>);
424   $html   .= qq(<FONT $color $size>) if length($color) || $size;
425   $html   .= qq(<B>) if $color && !$size;
426   $html   .= $title;
427   $html   .= qq(</B>) if $color && !$size;
428   $html   .= qq(</FONT>) if length($color) || $size;
429   $html   .= ",&nbsp;$addl" if length($addl);
430   $html   .= qq(</TD></TR>);
431
432   $html;
433
434 }
435
436 </%init>
437 <%once>
438
439 #subroutines
440
441 sub get_packages {
442   my $cust_main = shift or return undef;
443   my $conf = shift;
444   
445   my @packages = ();
446   my $method;
447   if (  $cgi->param('showcancelledpackages') eq '0' #see if it was set by me
448      || ( $conf->exists('hidecancelledpackages')
449            && ! $cgi->param('showcancelledpackages') )
450      )
451   {
452     $method = 'ncancelled_pkgs';
453   } else {
454     $method = 'all_pkgs';
455   }
456
457   [ $cust_main->$method() ];
458 }
459
460 sub svc_provision_link {
461   my ($cust_pkg, $part_svc, $conf, $curuser) = @_;
462   ( my $svc_nbsp = $part_svc->svc ) =~ s/\s+/&nbsp;/g;
463   my $num_avail = $part_svc->num_avail;
464   my $pkgnum_svcpart = "pkgnum=". $cust_pkg->pkgnum. ';'.
465                        "svcpart=". $part_svc->svcpart;
466   my $url;
467   if ( $part_svc->svcdb eq 'svc_external' #could be generalized
468        && $conf->exists('svc_external-skip_manual')
469   ) {
470     $url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$pkgnum_svcpart";
471   } else {
472     $url = svc_url(
473                     'm'        => $m,
474                     'action'   => 'edit',
475                     'part_svc' => $part_svc, 
476                     'query'    => $pkgnum_svcpart,
477                   );
478     #$url = "${p}edit/$svcpart->{svcdb}.cgi?$pkgnum_svcpart";
479   }
480
481   my $link = qq!<A CLASS="provision" HREF="$url">!.
482              "Provision&nbsp;$svc_nbsp&nbsp;($num_avail)</A>";
483   if ( $conf->exists('legacy_link')
484        && $curuser->access_right('View/link unlinked services')
485      )
486   {
487     $link .= '<BR>'.
488              qq!<A CLASS="provision" HREF="${p}misc/link.cgi?!.
489              qq!$pkgnum_svcpart">!.
490             "Link&nbsp;to&nbsp;legacy&nbsp;$svc_nbsp&nbsp;($num_avail)</A>";
491   }
492   $link;
493 }
494
495 sub svc_unprovision_link {
496   my $cust_svc = shift or return '';
497   qq!<A HREF="javascript:areyousure('${p}misc/unprovision.cgi?!. $cust_svc->svcnum.
498   qq!', 'Permanently unprovision and delete this service?')">Unprovision</A>!;
499 }
500
501 sub pkg_datestr {
502   my($cust_pkg, $field, $conf) = @_ or return '';
503   return '&nbsp;' unless $cust_pkg->get($field);
504   my $format = '<TD align="left"><B>%b</B></TD>'.
505                '<TD align="right"><B>&nbsp;%o,</B></TD>'.
506                '<TD align="right"><B>&nbsp;%Y</B></TD>';
507   #$format .= '&nbsp;<FONT SIZE=-3>%l:%M:%S%P&nbsp;%z</FONT>'
508   $format .= '<TD ALIGN="right"><B>&nbsp;%l</TD>'.
509              '<TD ALIGN="center"><B>:</B></TD>'.
510              '<TD ALIGN="left"><B>%M</B></TD>'.
511              '<TD ALIGN="left"><B>&nbsp;%P</B></TD>'
512     if $conf->exists('cust_pkg-display_times');
513   my $strip = time2str($format, $cust_pkg->get($field) );
514   $strip =~ s/ (\d)/$1/g;
515   $strip;
516 }
517
518 sub pkg_change_link    { pkg_popup_link('misc/change_pkg.cgi?dummy=value',
519                                           'Change&nbsp;package',
520                                           'Change',
521                                           '',
522                                           @_
523                                        );
524                        }
525
526 sub pkg_suspend_link   { pkg_popup_link( 'misc/cancel_pkg.html?method=suspend',
527                                          'Suspend&nbsp;now',
528                                          'Suspend',
529                                          '#FF9900',
530                                          @_
531                                        );
532                        }
533
534 sub pkg_adjourn_link   { pkg_popup_link( 'misc/cancel_pkg.html?method=adjourn',
535                                          'Suspend&nbsp;later',
536                                          'Adjourn',
537                                          '#CC6600',
538                                          @_
539                                        );
540                        }
541
542 sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg',    'Unsuspend',           @_ ); }
543 sub pkg_expire_link    { pkg_link('misc/expire_pkg',    'Cancel&nbsp;later',   @_ ); }
544 sub pkg_dates_link     { pkg_link('edit/REAL_cust_pkg', 'Edit&nbsp;dates',     @_ ); }
545
546 sub pkg_cancel_link    { pkg_popup_link( 'misc/cancel_pkg.html?method=cancel',
547                                          'Cancel&nbsp;now',
548                                          'Cancel',
549                                          '#ff0000',
550                                          @_
551                                        );
552                        }
553
554 sub pkg_expire_link    { pkg_popup_link( 'misc/cancel_pkg.html?method=expire',
555                                          'Cancel&nbsp;later',
556                                          'Expire', #"Cancel package $num later"
557                                          '#CC0000',
558                                          @_
559                                        );
560                        }
561
562 sub svc_recharge_link  { svc_popup_link( 'misc/recharge_svc.html',
563                                          'Recharge',
564                                          'Recharge',
565                                          '#333399',
566                                          @_
567                                        );
568                        }
569
570 sub order_pkg_link { cust_popup_link( 'misc/order_pkg.html',
571                                       'Order&nbsp;new&nbsp;package',
572                                       'Order new package',
573                                       '#333399',
574                                       @_
575                                     );
576                    }
577
578 sub pkg_event_link {
579   my($cust_pkg) = @_;
580   qq!<a href="${p}search/cust_event.html?pkgnum=!. $cust_pkg->pkgnum. qq!">!.
581   'View package events'.
582   '</a>';
583 }
584
585 sub pkg_link {
586   my($action, $label, $cust_pkg) = @_;
587   return '' unless $cust_pkg;
588   qq!<a href="$p$action.cgi?!. $cust_pkg->pkgnum. qq!">$label</a>!;
589 }
590
591 sub pkg_popup_link {
592   my($action, $label, $actionlabel, $color, $cust_pkg) = @_;
593   $action .= '&pkgnum='. $cust_pkg->pkgnum;
594   $actionlabel .= ' package '. $cust_pkg->pkgnum;
595   popup_link($action, $label, $actionlabel, $color, 768);
596 }
597
598 sub svc_popup_link {
599   my($action, $label, $actionlabel, $color, $cust_svc) = @_;
600   $action .= '?svcnum='. $cust_svc->svcnum;
601   $actionlabel .= ' service '. $cust_svc->svcnum;
602   popup_link($action, $label, $actionlabel, $color);
603 }
604
605 sub cust_popup_link {
606   my($action, $label, $actionlabel, $color, $cust_main) = @_;
607   $action .= '?'. $cust_main->custnum;
608   popup_link($action, $label, $actionlabel, $color);
609 }
610
611 sub popup_link {
612   my($action, $label, $actionlabel, $color, $width) = @_;
613   $color ||= '#333399';
614   $width ||= 540;
615   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>!;
616 }
617
618 sub pkg_customize_link {
619   my $cust_pkg = shift or return '';
620   my $custnum = $cust_pkg->custnum;
621   qq!<A HREF="${p}edit/part_pkg.cgi?!.
622     "keywords=$custnum;".
623     "clone=". $cust_pkg->part_pkg->pkgpart. ';'.
624     "pkgnum=". $cust_pkg->pkgnum.
625     qq!">Customize</A>!;
626 }
627
628 </%once>