fix otaker getting inserted and messing up discount reports; upgrade fixes db, RT...
authorivan <ivan>
Wed, 12 Jan 2011 06:26:42 +0000 (06:26 +0000)
committerivan <ivan>
Wed, 12 Jan 2011 06:26:42 +0000 (06:26 +0000)
FS/FS/cust_pkg.pm
FS/FS/cust_pkg_discount.pm
httemplate/edit/process/cust_pkg_discount.html

index 324dbba..d960445 100644 (file)
@@ -2506,7 +2506,6 @@ sub insert_discount {
     'discountnum' => $self->discountnum,
     'months_used' => 0,
     'end_date'    => '', #XXX
-    'otaker'      => $self->otaker,
     #for the create a new discount case
     '_type'       => $self->discountnum__type,
     'amount'      => $self->discountnum_amount,
index 3770a2b..7b6b203 100644 (file)
@@ -165,10 +165,13 @@ sub check {
     || $self->ut_float('months_used') #actually decimal, but this will do
     || $self->ut_numbern('end_date')
     || $self->ut_alphan('otaker')
+    || $self->ut_numbern('usernum')
     || $self->ut_enum('disabled', [ '', 'Y' ] )
   ;
   return $error if $error;
 
+  $self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
+
   $self->SUPER::check;
 }
 
index e3249d7..ad9842a 100644 (file)
@@ -34,7 +34,6 @@ my $cust_pkg_discount = new FS::cust_pkg_discount {
   'discountnum' => scalar($cgi->param('discountnum')),
   'months_used' => 0,
   'end_date'    => '', #XXX
-  'otaker'      => $curuser->username,
   #for the create a new discount case
   '_type'       => scalar($cgi->param('discountnum__type')),
   'amount'      => scalar($cgi->param('discountnum_amount')),