reliabily kill off old freeside-selfservice-server processes, RT#33174
[freeside.git] / httemplate / elements / change_history_common.html
index 9e19539..9e32bef 100644 (file)
   <TH CLASS="grid" BGCOLOR="#cccccc">Description</TH>
 </TR>
 
-% foreach my $item ( sort { $a->history_date <=> $b->history_date
-%                           #|| table order
-%                           || $a->historynum <=> $b->historynum
-%                         }
-%                         @history
-%                  )
-% {
+% foreach my $item ( @history ) {
 %   my $history_other = '';
 %   my $act  = $item->history_action;
 %   if ( $act =~ /^replace/ ) {
@@ -138,7 +132,7 @@ my %action = (
 
 my %cust_pkg_date_fields = map { $_=>1 } qw(
   start_date setup bill last_bill susp adjourn cancel expire contract_end
-  change_date
+  resume change_date
 );
 
 # finding the other replace row
@@ -178,6 +172,18 @@ my $svc_labelsub = sub {
   $label. ': <b>'. encode_entities($item->label($item->history_date)). '</b>';
 };
 
+my $discounts = {};
+my $discount_labelsub = sub {
+  my($item, $label) = @_;
+  my $dnum = $item->discountnum;
+  $discounts->{$dnum} ||= qsearchs({
+    'table'=>'discount',
+    'hashref'=>{'discountnum'=>$dnum}
+  });
+  my $d = $discounts->{$dnum};
+  $label . ': <b>' . encode_entities($d->description_short) . '<b>';
+};
+
 my %h_table_labelsub = (
   'h_cust_pkg'      => $pkg_labelsub,
   'h_svc_acct'      => $svc_labelsub,
@@ -189,6 +195,7 @@ my %h_table_labelsub = (
   'h_svc_external'  => $svc_labelsub,
   'h_svc_phone'     => $svc_labelsub,
   #'h_phone_device'
+  'h_cust_pkg_discount' => $discount_labelsub,
 );
 
 my $cust_pkg_date_format = '%b %o, %Y';
@@ -196,4 +203,11 @@ $cust_pkg_date_format .= ' %l:%M:%S%P'
   if $conf->exists('cust_pkg-display_times')
   || $curuser->option('cust_pkg-display_times');
 
+@history = sort { $a->history_date <=> $b->history_date
+                  || $a->historynum <=> $b->historynum } @history;
+
+if ( $curuser->option('history_order') eq 'newest' ) {
+  @history = reverse @history;
+}
+
 </%init>