diff options
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-x | httemplate/edit/cust_bill_pay.cgi | 9 | ||||
-rw-r--r-- | httemplate/edit/part_export.cgi | 25 | ||||
-rwxr-xr-x | httemplate/edit/part_pkg.cgi | 15 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 19 | ||||
-rwxr-xr-x | httemplate/edit/process/domain_record.cgi | 34 | ||||
-rw-r--r-- | httemplate/edit/process/part_export.cgi | 6 | ||||
-rw-r--r-- | httemplate/edit/process/quick-charge.cgi | 32 | ||||
-rw-r--r-- | httemplate/edit/process/quick-cust_pkg.cgi | 4 | ||||
-rw-r--r-- | httemplate/edit/process/svc_www.cgi | 4 | ||||
-rwxr-xr-x | httemplate/edit/svc_forward.cgi | 133 | ||||
-rw-r--r-- | httemplate/edit/svc_www.cgi | 3 |
11 files changed, 166 insertions, 118 deletions
diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index d90659724..8cdf4509a 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -59,14 +59,13 @@ foreach my $cust_bill ( @cust_bill ) { END } -#print <<END; # if ( cust_bill == "Refund" ) { # what.form.amount.value = "$credited"; # } -#} -#</SCRIPT> -#END -print "</SCRIPT>\n"; +print <<END; +} +</SCRIPT> +END print qq!<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">!, '<OPTION VALUE="">'; diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index af89c4ead..486bd4300 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -45,15 +45,32 @@ my $widget = new HTML::Widgets::SelectLayers( if $layer; foreach my $option ( keys %{$exports->{$layer}{options}} ) { -# foreach my $option ( qw(url login password groupID ) ) { my $optinfo = $exports->{$layer}{options}{$option}; my $label = $optinfo->{label}; + my $type = defined($optinfo->{type}) ? $optinfo->{type} : 'text'; my $value = $cgi->param($option) || $part_export->option($option) || (exists $optinfo->{default} ? $optinfo->{default} : ''); - $html .= qq!<TR><TD ALIGN="right">$label</TD>!. - qq!<TD><INPUT TYPE="text" NAME="$option" VALUE="$value" SIZE=64></TD>!. - '</TR>'; + $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!; + if ( $type eq 'select' ) { + $html .= qq!<SELECT NAME="$option">!; + foreach my $select_option ( @{$optinfo->{options}} ) { + #if ( ref($select_option) ) { + #} else { + $selected = $select_option eq $value ? ' SELECTED' : ''; + $html .= qq!<OPTION VALUE="$select_option"$selected>!. + qq!$select_option</OPTION>!; + #} + } + $html .= '</SELECT>'; + } elsif ( $type eq 'textarea' ) { + $html .= qq!<TEXTAREA NAME="$option">$value</TEXTAREA>!; + } elsif ( $type eq 'text' ) { + $html .= qq!<INPUT TYPE="text" NAME="$option" VALUE="$value" SIZE=64>!; + } else { + $html .= "unknown type $type"; + } + $html .= '</TD></TR>'; } $html .= '</TABLE>'; diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index e03017db4..b6ecff2d0 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -69,7 +69,7 @@ print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; print ntable("#cccccc",2), <<END; <TR><TD ALIGN="right">Package (customer-visable)</TD><TD><INPUT TYPE="text" NAME="pkg" SIZE=32 VALUE="$hashref->{pkg}"></TD></TR> <TR><TD ALIGN="right">Comment (customer-hidden)</TD><TD><INPUT TYPE="text" NAME="comment" SIZE=32 VALUE="$hashref->{comment}"></TD></TR> -<TR><TD ALIGN="right">Frequency (months) of recurring fee</TD><TD><INPUT TYPE="text" NAME="freq" VALUE="$hashref->{freq}" SIZE=3></TD></TR> +<TR><TD ALIGN="right">Frequency (months) of recurring fee</TD><TD><INPUT TYPE="text" NAME="freq" VALUE="$hashref->{freq}" SIZE=3> <I>0=no recurring fee, 1=monthly, 3=quarterly, 12=yearly</TD></TR> <TR><TD ALIGN="right">Setup fee tax exempt</TD><TD> END @@ -89,6 +89,7 @@ print '>'; print '</TD></TR>'; my $conf = new FS::Conf; +#false laziness w/ view/cust_main.cgi quick order if ( $conf->exists('enable_taxclasses') ) { print '<TR><TD ALIGN="right">Tax class</TD><TD><SELECT NAME="taxclass">'; my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county') @@ -240,7 +241,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission_cust' => { - 'name' => 'Flat rate with recurring comission per active customer', + 'name' => 'Flat rate with recurring commission per active customer', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -248,7 +249,7 @@ tie my %plans, 'Tie::IxHash', 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, }, - 'comission_amount' => { 'name' => 'Comission amount per month (per active customer)', + 'comission_amount' => { 'name' => 'Commission amount per month (per active customer)', 'default' => 0, }, 'comission_depth' => { 'name' => 'Number of layers', @@ -261,7 +262,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission' => { - 'name' => 'Flat rate with recurring comission per (any) active package', + 'name' => 'Flat rate with recurring commission per (any) active package', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -269,7 +270,7 @@ tie my %plans, 'Tie::IxHash', 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, }, - 'comission_amount' => { 'name' => 'Comission amount per month (per active package)', + 'comission_amount' => { 'name' => 'Commission amount per month (per active package)', 'default' => 0, }, 'comission_depth' => { 'name' => 'Number of layers', @@ -282,7 +283,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission_pkg' => { - 'name' => 'Flat rate with recurring comission per (selected) active package', + 'name' => 'Flat rate with recurring commission per (selected) active package', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -290,7 +291,7 @@ tie my %plans, 'Tie::IxHash', 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, }, - 'comission_amount' => { 'name' => 'Comission amount per month (per uncancelled package)', + 'comission_amount' => { 'name' => 'Commission amount per month (per uncancelled package)', 'default' => 0, }, 'comission_depth' => { 'name' => 'Number of layers', diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index e9c571f9c..4ccb770fb 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,10 +1,17 @@ <!-- mason kludge --> <% my $part_svc; + my $clone = ''; if ( $cgi->param('error') ) { #error $part_svc = new FS::part_svc ( { map { $_, scalar($cgi->param($_)) } fields('part_svc') } ); + } elsif ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone + #$cgi->param('clone') =~ /^(\d+)$/ or die "malformed query: $query"; + $part_svc = qsearchs('part_svc', { 'svcpart'=>$1 } ) + or die "unknown svcpart: $1"; + $clone = $part_svc->svcpart; + $part_svc->svcpart(''); } elsif ( $cgi->keywords ) { #edit my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "malformed query: $query"; @@ -137,17 +144,17 @@ my %defs = ( my $columns = 3; my $count = 0; my @part_export = - grep { $layer eq FS::part_export::exporttype2svcdb($_->exporttype) } - qsearch( 'part_export', {} ); - $html .= '<BR><BR>'. table(). + map { qsearch( 'part_export', {exporttype => $_ } ) } + keys %{FS::part_export::export_info($layer)}; + $html .= '<BR><BR>'. table(). table(). "<TR><TH COLSPAN=$columns>Exports</TH></TR><TR>"; foreach my $part_export ( @part_export ) { $html .= '<TD><INPUT TYPE="checkbox"'. ' NAME="exportnum'. $part_export->exportnum. '" VALUE="1" '; $html .= 'CHECKED' if qsearchs( 'export_svc', { - exportnum => $part_export->exportnum, - svcpart => $part_svc->svcpart }); + exportnum => $part_export->exportnum, + svcpart => $clone || $part_svc->svcpart }); $html .= '> '. $part_export->exporttype. ' to '. $part_export->machine. '</TD>'; $count++; @@ -161,6 +168,7 @@ my %defs = ( ? grep { $_ ne 'svcnum' } fields($layer) : (); push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge + $part_svc->svcpart($clone) if $clone; #haha, undone below foreach my $field (@fields) { my $part_svc_column = $part_svc->part_svc_column($field); my $value = $cgi->param('error') @@ -206,6 +214,7 @@ my %defs = ( } $html .= "</TD></TR>\n"; } + $part_svc->svcpart('') if $clone; #undone $html .= "</TABLE>"; $html .= '<BR><INPUT TYPE="submit" VALUE="'. diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi new file mode 100755 index 000000000..b8c3f62a1 --- /dev/null +++ b/httemplate/edit/process/domain_record.cgi @@ -0,0 +1,34 @@ +<% + +my $recnum = $cgi->param('recnum'); + +my $old = qsearchs('agent',{'recnum'=>$recnum}) if $recnum; + +my $new = new FS::domain_record ( { + map { + $_, scalar($cgi->param($_)); + } fields('domain_record') +} ); + +my $error; +if ( $recnum ) { + $error=$new->replace($old); +} else { + $error=$new->insert; + $recnum=$new->getfield('recnum'); +} + +if ( $error ) { +# $cgi->param('error', $error); +# print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); + #no edit screen to send them back to +%> +<!-- mason kludge --> +<% + eidiot($error); +} else { + my $svcnum = $new->svcnum; + print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); +} + +%> diff --git a/httemplate/edit/process/part_export.cgi b/httemplate/edit/process/part_export.cgi index 6b4d007e4..fa009edbb 100644 --- a/httemplate/edit/process/part_export.cgi +++ b/httemplate/edit/process/part_export.cgi @@ -6,7 +6,11 @@ my $old = qsearchs('part_export', { 'exportnum'=>$exportnum } ) if $exportnum; #fixup options #warn join('-', split(',',$cgi->param('options'))); -my %options = map { $_=>$cgi->param($_) } split(',',$cgi->param('options')); +my %options = map { + my $value = $cgi->param($_); + $value =~ s/\r\n/\n/g; #browsers? (textarea) + $_ => $value; +} split(',', $cgi->param('options')); my $new = new FS::part_export ( { map { diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi new file mode 100644 index 000000000..477f58508 --- /dev/null +++ b/httemplate/edit/process/quick-charge.cgi @@ -0,0 +1,32 @@ +<% + +#untaint custnum +$cgi->param('custnum') =~ /^(\d+)$/ + or die 'illegal custnum '. $cgi->param('custnum'); +my $custnum = $1; + +$cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ + or die 'illegal amount '. $cgi->param('amount'); +my $amount = $1; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum"; + +my $error = $cust_main->charge( + $amount, + $cgi->param('pkg'), + '$'. sprintf("%.2f",$amount), + $cgi->param('taxclass') +); + +if ($error) { +%> +<!-- mason kludge --> +<% + eidiot($error); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" ); +} + +%> + diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index c663dce32..a8f5b1453 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -2,10 +2,10 @@ #untaint custnum $cgi->param('custnum') =~ /^(\d+)$/ - or eidiot 'illegal custnum '. $cgi->param('custnum'); + or die 'illegal custnum '. $cgi->param('custnum'); my $custnum = $1; $cgi->param('pkgpart') =~ /^(\d+)$/ - or eidiot 'illegal pkgpart '. $cgi->param('pkgpart'); + or die 'illegal pkgpart '. $cgi->param('pkgpart'); my $pkgpart = $1; my @cust_pkg = (); diff --git a/httemplate/edit/process/svc_www.cgi b/httemplate/edit/process/svc_www.cgi index 38d5e1c79..40913145a 100644 --- a/httemplate/edit/process/svc_www.cgi +++ b/httemplate/edit/process/svc_www.cgi @@ -5,8 +5,8 @@ my $svcnum = $1; my $old; if ( $svcnum ) { - $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } ) - or die "fatal: can't find account (svcnum $svcnum)!"; + $old = qsearchs('svc_www', { 'svcnum' => $svcnum } ) + or die "fatal: can't find website (svcnum $svcnum)!"; } else { $old = ''; } diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index 5f1466bbb..bc19fe1de 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -119,105 +119,58 @@ my($srcsvc,$dstsvc,$dst)=( #display -my $p1 = popurl(1); -print header("Mail Forward $action", '', - " onLoad=\"visualize()\""); - %> -<SCRIPT> -function visualize(what){ - if (document.getElementById) { - document.getElementById('dother').style.visibility = '<%= $dstsvc ? 'hidden' : 'visible' %>'; - } -} -function fixup(what){ - if (document.getElementById) { - if (document.getElementById('dother').style.visibility == 'hidden') { - what.dst.value=''; - } - } -} -</SCRIPT> - -<% - -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT>" - if $cgi->param('error'); +<%= header("Mail Forward $action") %> -print qq!<FORM ACTION="${p1}process/svc_forward.cgi" onSubmit="fixup(this)" METHOD=POST>!; +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> + <BR><BR> +<% } %> -#svcnum -print qq!<INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">!; -print qq!Service #<FONT SIZE=+1><B>!, $svcnum ? $svcnum : " (NEW)", "</B></FONT>"; -print qq!<BR>!; +Service #<%= $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> +Service: <B><%= $part_svc->svc %></B><BR><BR> -#pkgnum -print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!; - -#svcpart -print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!; - -#srcsvc -print qq!\n\nMail to <SELECT NAME="srcsvc" SIZE=1>!; -foreach $_ (keys %email) { - print "<OPTION", $_ eq $srcsvc ? " SELECTED" : "", - qq! VALUE="$_">$email{$_}!; -} -print "</SELECT>"; +<FORM NAME="dummy"> -#dstsvc -print qq! forwards to <SELECT NAME="dstsvc" SIZE=1 onChange="changed(this)">!; -foreach $_ (keys %email) { - print "<OPTION", $_ eq $dstsvc ? " SELECTED" : "", - qq! VALUE="$_">$email{$_}!; -} -print "<OPTION", 0 eq $dstsvc ? " SELECTED" : "", - qq! VALUE="0">(other)!; -print "</SELECT> mailbox."; - -%> - -<SCRIPT> -var selectchoice = null; -function changed(what) { - selectchoice = what.options[what.selectedIndex].value; - if (selectchoice == "0") { - if (document.getElementById) { - document.getElementById('dother').style.visibility = "visible"; - } - }else{ - if (document.getElementById) { - document.getElementById('dother').style.visibility = "hidden"; - } - } -} -if (document.getElementById) { - document.write("<DIV ID=\"dother\" STYLE=\"visibility: hidden\">"); -} -</SCRIPT> +<%= ntable("#cccccc",2) %> +<TR><TD ALIGN="right">Email to</TD><TD><SELECT NAME="srcsvc" SIZE=1> +<% foreach $_ (keys %email) { %> + <OPTION<%= $_ eq $srcsvc ? " SELECTED" : "" %> VALUE="<%= $_ %>"><%= $email{$_} %></OPTION> +<% } %> +</SELECT></TD></TR> <% -print qq! Other destination: <INPUT TYPE="text" NAME="dst" VALUE="$dst">!; + tie my %tied_email, 'Tie::IxHash', + '' => 'SELECT DESTINATION', + %email, + '0' => '(other email address)'; + my $widget = new HTML::Widgets::SelectLayers( + 'selected_layer' => $dstsvc, + 'options' => \%tied_email, + 'form_name' => 'dummy', + 'form_action' => 'process/svc_forward.cgi', + 'form_select' => ['srcsvc'], + 'html_between' => '</TD></TR></TABLE>', + 'layer_callback' => sub { + my $layer = shift; + my $html = qq!<INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">!. + qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!. + qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!. + qq!<INPUT TYPE="hidden" NAME="dstsvc" VALUE="$layer">!; + if ( $layer eq '0' ) { + $html .= ntable("#cccccc",2). + '<TR><TD ALIGN="right">Destination email</TD>'. + qq!<TD><INPUT TYPE="text" NAME="dst" VALUE="$dst"></TD>!. + '</TR></TABLE>'; + } + $html .= '<BR><INPUT TYPE="submit" VALUE="Submit">'; + $html; + }, + ); %> -<SCRIPT> -if (document.getElementById) { - document.write("</DIV>"); -} -</SCRIPT> - -<CENTER><INPUT TYPE="submit" VALUE="Submit"></CENTER> -</FORM> - -<TAG onLoad=" - if (document.getElementById) { - document.getElementById('dother').style.visibility = '<%= $dstsvc ? 'hidden' : 'visible' %>'; - document.getElementById('dlabel').style.visibility = '<%= $dstsvc ? 'hidden' : 'visible' %>'; - } -"> - - +<TR><TD ALIGN="right">Forwards to</TD> +<TD><%= $widget->html %> </BODY> </HTML> diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi index e1a914f1a..d2c9ade5c 100644 --- a/httemplate/edit/svc_www.cgi +++ b/httemplate/edit/svc_www.cgi @@ -175,5 +175,4 @@ print <<END; </BODY> </HTML> END - - +%> |