summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorivan <ivan>2010-02-05 02:39:31 +0000
committerivan <ivan>2010-02-05 02:39:31 +0000
commit8a0204b4a129a3c26dcca18ba401b2de26d22d2b (patch)
treeacc110c2e41d74fefa6c038c6b0d414865fb29b2 /httemplate/edit
parent4cacb3fa439b56fc7c9a742b69ec3f6ffd660433 (diff)
discounts, RT#6679
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/cust_pkg_discount.html3
-rw-r--r--httemplate/edit/discount.html2
-rw-r--r--httemplate/edit/process/discount.html17
-rw-r--r--httemplate/edit/process/quick-cust_pkg.cgi28
4 files changed, 22 insertions, 28 deletions
diff --git a/httemplate/edit/cust_pkg_discount.html b/httemplate/edit/cust_pkg_discount.html
index 22d8c632f..0bb84b8f2 100755
--- a/httemplate/edit/cust_pkg_discount.html
+++ b/httemplate/edit/cust_pkg_discount.html
@@ -28,7 +28,8 @@
<% include('/elements/tr-select-discount.html',
'empty_label' => ( $pkgdiscountnum ? '' : 'Select discount' ),
- 'onchange' => 'enable_discount_pkg',
+ 'onchange' => 'enable_discount_pkg()',
+ 'cgi' => $cgi,
)
%>
diff --git a/httemplate/edit/discount.html b/httemplate/edit/discount.html
index 4f440b2cb..6e0d8e1a7 100644
--- a/httemplate/edit/discount.html
+++ b/httemplate/edit/discount.html
@@ -29,7 +29,7 @@
'_type' => 'Type&nbsp;',
'amount' => 'Amount&nbsp;',
'percent' => 'Percentage&nbsp;',
- 'months' => '# of Months',
+ 'months' => 'Duration (months)',
},
'viewall_dir' => 'browse',
'new_callback' => $new_callback,
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 );