RT#28246: Add more details to Change History for Discounts [actually fixed the bug]
authorJonathan Prykop <jonathan@freeside.biz>
Thu, 19 Feb 2015 21:34:47 +0000 (15:34 -0600)
committerJonathan Prykop <jonathan@freeside.biz>
Thu, 19 Feb 2015 21:34:47 +0000 (15:34 -0600)
httemplate/elements/change_history_common.html

index c858ec1..2d2c4c0 100644 (file)
@@ -191,9 +191,10 @@ my %h_table_labelsub = (
 my $discounts = {};
 my $discount_descripsub = sub {
   my($item) = @_;
-  die "Could not find part_pkg for pkgpart " . $item->pkgpart
-    unless $item->part_pkg;
-  $pkgpart{$item->pkgpart} ||= $item->part_pkg->pkg;
+  $pkgpart{$item->pkgpart} ||= qsearchs({
+    'table' => 'part_pkg',
+    'hashref' => {'pkgpart' => $item->pkgpart}
+  })->pkg;
   my $dnum = $item->discountnum;
   $discounts->{$dnum} ||= qsearchs({
     'table'=>'discount',