discounts, RT#6679
[freeside.git] / httemplate / view / cust_main / packages / package.html
index c56fa0b..3c486dd 100644 (file)
@@ -1,4 +1,4 @@
-<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
+<TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="top">
   <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
     <TR>
       <TD COLSPAN=2>
@@ -6,7 +6,7 @@
            ID  ="cust_pkg<% $cust_pkg->pkgnum %>"
         ><% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B></A>
         - 
-        <% $part_pkg->comment |h %>
+        <% $part_pkg->custom_comment |h %>
       </TD>
     </TR>
 
               (&nbsp;<%pkg_dates_link($cust_pkg)%>&nbsp;)
 %           } 
 %
+%           if ( $curuser->access_right('Discount customer package')
+%                && $part_pkg->can_discount
+%                && ! scalar($cust_pkg->cust_pkg_discount_active)
+%              )
+%           {
+%             $br=1;
+              (&nbsp;<%pkg_discount_link($cust_pkg)%>&nbsp;)
+%           }
+%
 %           if ( $curuser->access_right('Customize customer package') ) {
 %             $br=1;
-              (&nbsp;<%pkg_customize_link($cust_pkg,$cust_pkg->custnum)%>&nbsp;)
+              (&nbsp;<%pkg_customize_link($cust_pkg,$part_pkg)%>&nbsp;)
 %           } 
 %
             <% $br ? '<BR>' : '' %>
@@ -196,11 +205,25 @@ sub pkg_change_link {
 
 sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit&nbsp;dates', @_ ); }
 
+sub pkg_discount_link {
+  my $cust_pkg = shift or return '';
+  #my $part_pkg = shift;
+  #my $custnum = $cust_pkg->custnum;
+  include( '/elements/popup_link-cust_pkg.html',
+    'action'      => $p.'edit/cust_pkg_discount.html',
+    'label'       => 'Discount',
+    'actionlabel' => 'Discount',
+    'cust_pkg'    => $cust_pkg,
+    'width'       => 616,
+  );
+}
+
 sub pkg_customize_link {
   my $cust_pkg = shift or return '';
+  my $part_pkg = shift;
   my $custnum = $cust_pkg->custnum;
   qq!<A HREF="${p}edit/part_pkg.cgi?!.
-    "clone=". $cust_pkg->part_pkg->pkgpart. ';'.
+    "clone=". $part_pkg->pkgpart. ';'.
     "pkgnum=". $cust_pkg->pkgnum.
     qq!">Customize</A>!;
 }