From 92eb0dcaf696fa84c2fe7d2141dafe6661b8cfdd Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 8 Sep 2008 02:47:20 +0000 Subject: add package invoice details & comments, RT#3810 --- httemplate/edit/cust_pkg_detail.html | 146 +++++++++++++++++++++++++++ httemplate/edit/process/cust_pkg_detail.html | 59 +++++++++++ httemplate/pref/pref-process.html | 3 +- httemplate/pref/pref.html | 22 +++- httemplate/view/cust_main/packages.html | 142 ++++++++++++++++++++++++-- 5 files changed, 359 insertions(+), 13 deletions(-) create mode 100644 httemplate/edit/cust_pkg_detail.html create mode 100644 httemplate/edit/process/cust_pkg_detail.html (limited to 'httemplate') diff --git a/httemplate/edit/cust_pkg_detail.html b/httemplate/edit/cust_pkg_detail.html new file mode 100644 index 000000000..1e4c80250 --- /dev/null +++ b/httemplate/edit/cust_pkg_detail.html @@ -0,0 +1,146 @@ +<% include("/elements/header-popup.html", $title, '', + ( $cgi->param('error') ? '' : 'onload="addRow()"' ), + ) +%> + +%# <% include('/elements/error.html') %> + +
+ + + + + + +% if ( $curuser->option('show_pkgnum') ) { + + + + + + +% } + + + + + + + + + + + + + + + + + + + + +% my $row = 0; +% if ( $cgi->param('error') || $cgi->param('magic') ) { +% my $param = $cgi->Vars; +% +% for ( $row = 0; exists($param->{"detail$row"}); $row++ ) { + + + + + +% } +% +% } + +
Package #<% $pkgnum %>
Package<% $part_pkg->pkg %>
Comment<% $part_pkg->comment %>
Status<% ucfirst($cust_pkg->status) %>
<% ucfirst($name{$detailtype}) %>:
+ " rownum="<% $row %>" onkeyup = "possiblyAddRow;" > +
+ +
+ + +
+ + + + + +<%init> + +my %access_right = ( + 'I' => 'Edit customer package invoice details', + 'C' => 'Edit customer package comments', +); + +my %name = ( + 'I' => 'invoice details', + 'C' => 'package comments', +); + +my $curuser = $FS::CurrentUser::CurrentUser; + +$cgi->param('detailtype') =~ /^(\w)$/ or die 'illegal detailtype'; +my $detailtype = $1; + +my $right = $access_right{$detailtype}; +die "access denied" + unless $curuser->access_right($right); + +$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum'; +my $pkgnum = $1; + +my $cust_pkg = qsearchs({ + 'table' => 'cust_pkg', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'pkgnum' => $pkgnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}); + +my $part_pkg = $cust_pkg->part_pkg; + +my @details = $cust_pkg->cust_pkg_detail($detailtype); + +my $title = ( scalar(@details) ? 'Edit ' : 'Add ' ). $name{$detailtype}; + + diff --git a/httemplate/edit/process/cust_pkg_detail.html b/httemplate/edit/process/cust_pkg_detail.html new file mode 100644 index 000000000..132ff63c5 --- /dev/null +++ b/httemplate/edit/process/cust_pkg_detail.html @@ -0,0 +1,59 @@ +% if ( $error ) { +<% header('Error') %> +<% $error |h %>

+
+ +% } else { +<% header($action) %> + + +% } +<%init> + +my %access_right = ( + 'I' => 'Edit customer package invoice details', + 'C' => 'Edit customer package comments', +); + +my %name = ( + 'I' => 'invoice details', + 'C' => 'package comments', +); + +my $curuser = $FS::CurrentUser::CurrentUser; + +$cgi->param('detailtype') =~ /^(\w)$/ or die 'illegal detailtype'; +my $detailtype = $1; + +my $right = $access_right{$detailtype}; +die "access denied" + unless $curuser->access_right($right); + +$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum'; +my $pkgnum = $1; + +my $cust_pkg = qsearchs({ + 'table' => 'cust_pkg', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'pkgnum' => $pkgnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}); + + +my @orig_details = $cust_pkg->cust_pkg_detail($detailtype); + +my $action = ucfirst($name{$detailtype}). + ( scalar(@orig_details) ? ' changed ' : ' added ' ); + +my $param = $cgi->Vars; +my @details = (); +for ( my $row = 0; exists($param->{"detail$row"}); $row++ ) { + push @details, $param->{"detail$row"} + if $param->{"detail$row"} =~ /\S/; +} + +my $error = $cust_pkg->set_cust_pkg_detail($detailtype, @details); + + diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index 704286568..93d73e00a 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -28,7 +28,8 @@ % } % % #XXX autogen -% my @paramlist = qw( menu_position email_address +% my @paramlist = qw( menu_position show_pkgnum +% email_address % height width availHeight availWidth colorDepth % ); % diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index ec8aefd80..77f8cec68 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -53,8 +53,20 @@ Email Address
- - + + +Development +<% ntable("#cccccc",2) %> + + + Show internal package numbers: + option('show_pkgnum') ? 'CHECKED' : '' %>> + + + +
+ + % foreach my $prop (qw( height width availHeight availWidth colorDepth )) {