diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/cust_pkg_detail.html | 146 | ||||
-rw-r--r-- | httemplate/edit/process/cust_pkg_detail.html | 59 | ||||
-rw-r--r-- | httemplate/pref/pref-process.html | 3 | ||||
-rw-r--r-- | httemplate/pref/pref.html | 22 | ||||
-rwxr-xr-x | httemplate/view/cust_main/packages.html | 142 |
5 files changed, 359 insertions, 13 deletions
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') %> + +<FORM ACTION="process/cust_pkg_detail.html" NAME="DetailForm" ID="DetailForm" METHOD="POST"> + +<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> +<INPUT TYPE="hidden" NAME="detailtype" VALUE="<% $detailtype %>"> + +<TABLE ID="DetailTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=1 STYLE="background-color: #cccccc"> + +% if ( $curuser->option('show_pkgnum') ) { + + <TR> + <TD ALIGN="right">Package #</TD> + <TD BGCOLOR="#ffffff"><% $pkgnum %></TD> + </TR> + +% } + + <TR> + <TD ALIGN="right">Package</TD> + <TD BGCOLOR="#ffffff"><% $part_pkg->pkg %></TD> + </TR> + + <TR> + <TD ALIGN="right">Comment</TD> + <TD BGCOLOR="#ffffff"><% $part_pkg->comment %></TD> + </TR> + + <TR> + <TD ALIGN="right">Status</TD> + <TD BGCOLOR="#ffffff"><FONT COLOR="#<% $cust_pkg->statuscolor %>"><B><% ucfirst($cust_pkg->status) %></B></FONT></TD> + </TR> + + <TR> + <TD COLSPAN=2><% ucfirst($name{$detailtype}) %>: </TD> + </TR> + +% my $row = 0; +% if ( $cgi->param('error') || $cgi->param('magic') ) { +% my $param = $cgi->Vars; +% +% for ( $row = 0; exists($param->{"detail$row"}); $row++ ) { + + <TR> + <TD></TD> + <TD> + <INPUT TYPE="text" NAME="detail<% $row %>" SIZE="60" MAXLENGTH="65" VALUE="<% $param->{"detail$row"} |h %>" rownum="<% $row %>" onkeyup = "possiblyAddRow;" > + </TD> + </TR> +% } +% +% } + +</TABLE> + +<BR> +<INPUT TYPE="submit" ID="submit" NAME="submit" VALUE="<% $title %>"> + +</FORM> + +<SCRIPT TYPE="text/javascript"> + + var rownum = <% $row %>; + + function possiblyAddRow() { + if ( ( rownum - this.getAttribute('rownum') ) == 1 ) { + addRow(); + } + } + + function addRow() { + + var table = document.getElementById('DetailTable'); + var tablebody = table.getElementsByTagName('tbody').item(0); + + var row = document.createElement('TR'); + + var empty_cell = document.createElement('TD'); + row.appendChild(empty_cell); + + var detail_cell = document.createElement('TD'); + + var detail_input = document.createElement('INPUT'); + detail_input.setAttribute('name', 'detail'+rownum); + detail_input.setAttribute('id', 'detail'+rownum); + detail_input.setAttribute('size', 60); + detail_input.setAttribute('maxLength', 65); + detail_input.setAttribute('rownum', rownum); + detail_input.onkeyup = possiblyAddRow; + detail_cell.appendChild(detail_input); + + row.appendChild(detail_cell); + + tablebody.appendChild(row); + + rownum++; + + } + +</SCRIPT> + +</BODY> +</HTML> +<%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}; + +</%init> 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') %> +<FONT COLOR="#ff0000"><B><% $error |h %></B></FONT><BR><BR> +<CENTER><INPUT TYPE="BUTTON" VALUE="OK" onClick="parent.cClick()"></CENTER> +</BODY></HTML> +% } else { +<% header($action) %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY></HTML> +% } +<%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); + +</%init> 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 </TABLE> <BR> - - + + +Development +<% ntable("#cccccc",2) %> + + <TR> + <TH>Show internal package numbers: </TH> + <TD><INPUT TYPE="checkbox" NAME="show_pkgnum" VALUE="1" <% $curuser->option('show_pkgnum') ? 'CHECKED' : '' %>></TD> + </TR> + +</TABLE> +<BR> + + % foreach my $prop (qw( height width availHeight availWidth colorDepth )) { <INPUT TYPE="hidden" NAME="<% $prop %>" VALUE=""> <SCRIPT TYPE="text/javascript"> @@ -67,11 +79,13 @@ Email Address <% include('/elements/footer.html') %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + # XSS via your own preferences? seems unlikely, but nice try anyway... -( $FS::CurrentUser::CurrentUser->option('menu_position') || 'left' ) +( $curuser->option('menu_position') || 'left' ) =~ /^(\w+)$/ or die "illegal menu_position"; my $menu_position = $1; -( $FS::CurrentUser::CurrentUser->option('email_address') ) +( $curuser->option('email_address') ) =~ /^([,\w\@.]*)$/ or die "illegal email_address"; #too late my $email_address = $1; diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 77ca1cded..5c086f225 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -13,7 +13,7 @@ 'action' => $p. 'edit/quick-charge.html?custnum='. $cust_main->custnum, 'label' => 'One-time charge', 'actionlabel' => 'One-time charge', - 'width' => 545, + 'width' => 763, }) %> <BR> @@ -76,16 +76,33 @@ Current packages <!--pkgnum: <% $cust_pkg->pkgnum %>--> <TR> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <A NAME="cust_pkg<% $cust_pkg->pkgnum %>"><% $cust_pkg->pkgnum %></A>: - <% $part_pkg->pkg %> - <% $part_pkg->comment %> - <BR> + + <TD CLASS="inv" BGCOLOR="<% $bgcolor %>"> + <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%"> + <TR> + <TD COLSPAN=2> + <A NAME="cust_pkg<% $cust_pkg->pkgnum %>" + ID ="cust_pkg<% $cust_pkg->pkgnum %>" + ><% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><% $part_pkg->pkg %></A> + - + <% $part_pkg->comment %> + </TD> + </TR> % if ( $cust_pkg->quantity > 1 ) { - Quantity: <B><% $cust_pkg->quantity %></B><BR> + <TR> + <TD COLSPAN=2> + Quantity: + <B><% $cust_pkg->quantity %></B> + </TD> + </TR> % } - <FONT SIZE=-1> + <TR> + <TD COLSPAN=2> + + <FONT SIZE=-1> + % unless ( $cust_pkg->get('cancel') ) { % if ( $curuser->access_right('Change customer package') ) { @@ -101,8 +118,117 @@ Current packages % } % } - </FONT> + </FONT> + + </TD> + </TR> + +% my $editi = $curuser->access_right('Edit customer package invoice details'); +% my $editc = $curuser->access_right('Edit customer package comments'); +% +% if ( $cust_pkg->cust_pkg_detail('I') || $cust_pkg->cust_pkg_detail('C') +% || $editi || $editc ) { +% +% my $editlink = $p. 'edit/cust_pkg_detail?pkgnum='. $cust_pkg->pkgnum. +% ';detailtype='; + + <TR> + +% if ( $cust_pkg->cust_pkg_detail('I') ) { + <TD VALIGN="top"> + <% include('/elements/table-grid.html') %> + <TR> + <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px"> + <FONT SIZE="-1"> + Invoice details +% if ( $editi && ! $cust_pkg->get('cancel') ) { + (<% include('/elements/popup_link.html', { + 'action' => $editlink. 'I', + 'label' => 'edit', + 'actionlabel' => 'Edit invoice details', + 'color' => '#333399', + 'width' => 763, + }) + %>) +% } + </FONT> + </TH> + </TR> +% foreach my $cust_pkg_detail ( $cust_pkg->cust_pkg_detail('I') ) { + <TR> + <TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD> + </TR> +% } + </TABLE> + </TD> +% } else { + <TD> +% if ( $editi && ! $cust_pkg->get('cancel') ) { + <FONT SIZE="-1"> + ( <% include('/elements/popup_link.html', { + 'action' => $editlink. 'I', + 'label' => 'Add invoice details', + 'actionlabel' => 'Add invoice details', + 'color' => '#333399', + 'width' => 763, + }) + %> ) + </FONT> +% } + </TD> +% } + +% if ( $cust_pkg->cust_pkg_detail('C') ) { + <TD VALIGN="top"> + <% include('/elements/table-grid.html') %> + <TR> + <TH BGCOLOR="#dddddd" STYLE="border-bottom: dashed 1px black; padding-bottom: 1px"> + <FONT SIZE="-1"> + Comments +% if ( $editc ) { + (<% include('/elements/popup_link.html', { + 'action' => $editlink. 'C', + 'label' => 'edit', + 'actionlabel' => 'Edit comments', + 'color' => '#333399', + 'width' => 763, + }) + %>) +% } + </FONT> + </TH> + </TR> +% foreach my $cust_pkg_detail ( $cust_pkg->cust_pkg_detail('C') ) { + <TR> + <TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD> + </TR> +% } + </TABLE> + </TD> +% } else { + <TD> +% if ( $editc ) { + <FONT SIZE="-1"> + ( <% include('/elements/popup_link.html', { + 'action' => $editlink. 'C', + 'label' => 'Add comments', + 'actionlabel' => 'Add comments', + 'color' => '#333399', + 'width' => 763, + }) + %> ) + </FONT> +% } + </TD> +% } + + </TR> +% } + + </TABLE> + </TD> + <TD CLASS="inv" BGCOLOR="<% $bgcolor %>"> <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%"> % |