summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit/process')
-rw-r--r--httemplate/edit/process/discount.html17
-rw-r--r--httemplate/edit/process/quick-cust_pkg.cgi28
2 files changed, 19 insertions, 26 deletions
diff --git a/httemplate/edit/process/discount.html b/httemplate/edit/process/discount.html
index 54307b708..80dc0f5bd 100644
--- a/httemplate/edit/process/discount.html
+++ b/httemplate/edit/process/discount.html
@@ -1,7 +1,6 @@
<% include( 'elements/process.html',
'table' => 'discount',
'viewall_dir' => 'browse',
- 'precheck_callback' => $precheck_callback,
)
%>
<%init>
@@ -9,20 +8,4 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my $precheck_callback = sub {
- my( $cgi ) = @_;
-
- if ( $cgi->param('_type') eq 'Select discount type' ) {
- return 'Please select a discount type';
- } elsif ( $cgi->param('_type') eq 'Amount' ) {
- $cgi->param('percent', '0');
- return 'Amount must be greater than 0' unless $cgi->param('amount') > 0;
- } elsif ( $cgi->param('_type') eq 'Percentage' ) {
- $cgi->param('amount', '0.00');
- return 'Percentage must be greater than 0' unless $cgi->param('percent') > 0;
- }
-
- '';
-};
-
</%init>
diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi
index c60156746..a0958922e 100644
--- a/httemplate/edit/process/quick-cust_pkg.cgi
+++ b/httemplate/edit/process/quick-cust_pkg.cgi
@@ -45,17 +45,27 @@ my $refnum = $1;
$cgi->param('locationnum') =~ /^(\-?\d*)$/
or die 'illegal locationnum '. $cgi->param('locationnum');
my $locationnum = $1;
+$cgi->param('discountnum') =~ /^(\-?\d*)$/
+ or die 'illegal discountnum '. $cgi->param('discountnum');
+my $discountnum = $1;
+
my $cust_pkg = new FS::cust_pkg {
- 'custnum' => $custnum,
- 'pkgpart' => $pkgpart,
- 'start_date' => ( scalar($cgi->param('start_date'))
- ? str2time($cgi->param('start_date'))
- : ''
- ),
- 'discountnum' => scalar($cgi->param('discountnum')),
- 'refnum' => $refnum,
- 'locationnum' => $locationnum,
+ 'custnum' => $custnum,
+ 'pkgpart' => $pkgpart,
+ 'start_date' => ( scalar($cgi->param('start_date'))
+ ? str2time($cgi->param('start_date'))
+ : ''
+ ),
+ 'refnum' => $refnum,
+ 'locationnum' => $locationnum,
+ 'discountnum' => $discountnum,
+ #for the create a new discount case
+ 'discountnum__type' => scalar($cgi->param('discountnum__type')),
+ 'discountnum_amount' => scalar($cgi->param('discountnum_amount')),
+ 'discountnum_percent' => scalar($cgi->param('discountnum_percent')),
+ 'discountnum_months' => scalar($cgi->param('discountnum_months')),
+ #'discountnum_disabled' => scalar($cgi->param('discountnum_disabled')),
};
my %opt = ( 'cust_pkg' => $cust_pkg );