diff options
author | ivan <ivan> | 2006-05-14 16:47:31 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-05-14 16:47:31 +0000 |
commit | 2c757d7db4cb6a7b9655de13206fcc84fb7ce61f (patch) | |
tree | f01088bb60d49ee0dd3dd796d57abe219c321f7b /httemplate/edit | |
parent | c46235292c6bf929615ac28fc48c1d5609ce4590 (diff) |
first part of ACL and re-skinning work and some other small stuff
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/access_group.html | 10 | ||||
-rw-r--r-- | httemplate/edit/access_user.html | 37 | ||||
-rwxr-xr-x | httemplate/edit/agent_type.cgi | 52 | ||||
-rwxr-xr-x | httemplate/edit/cust_bill_pay.cgi | 87 | ||||
-rwxr-xr-x | httemplate/edit/cust_credit.cgi | 71 | ||||
-rwxr-xr-x | httemplate/edit/cust_credit_bill.cgi | 90 | ||||
-rwxr-xr-x | httemplate/edit/cust_main.cgi | 105 | ||||
-rwxr-xr-x | httemplate/edit/cust_pkg.cgi | 136 | ||||
-rw-r--r-- | httemplate/edit/elements/edit.html | 36 | ||||
-rwxr-xr-x | httemplate/edit/part_referral.cgi | 36 | ||||
-rw-r--r-- | httemplate/edit/part_virtual_field.cgi | 19 | ||||
-rw-r--r-- | httemplate/edit/process/access_group.html | 5 | ||||
-rw-r--r-- | httemplate/edit/process/access_user.html | 8 | ||||
-rwxr-xr-x | httemplate/edit/process/agent_type.cgi | 39 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_bill_pay.cgi | 16 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_credit.cgi | 17 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_credit_bill.cgi | 16 | ||||
-rw-r--r-- | httemplate/edit/process/elements/process.html | 19 | ||||
-rwxr-xr-x | httemplate/edit/svc_domain.cgi | 55 |
19 files changed, 488 insertions, 366 deletions
diff --git a/httemplate/edit/access_group.html b/httemplate/edit/access_group.html new file mode 100644 index 000000000..11b8df7bc --- /dev/null +++ b/httemplate/edit/access_group.html @@ -0,0 +1,10 @@ +<%= include( 'elements/edit.html', + 'name' => 'Internal Access Group', + 'table' => 'access_group', + 'labels' => { + 'groupnum' => 'Group number', + 'groupname' => 'Group name', + }, + 'viewall_dir' => 'browse', + ) +%> diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html new file mode 100644 index 000000000..2b19dbf7b --- /dev/null +++ b/httemplate/edit/access_user.html @@ -0,0 +1,37 @@ +<%= include( 'elements/edit.html', + 'name' => 'Internal User', + 'table' => 'access_user', + 'fields' => [ + 'username', + { field=>'_password', type=>'password' }, + 'last', + 'first', + ], + 'labels' => { + 'usernum' => 'User number', + 'username' => 'Username', + '_password' => 'Password', + 'last' => 'Last name', + 'first' => 'First name', + }, + 'viewall_dir' => 'browse', + 'html_bottom' => + sub { + my $access_user = shift; + + '<BR>Internal Access Groups<BR>'. + ntable("#cccccc",2). + '<TR><TD>'. + include( '/elements/checkboxes-table.html', + 'source_obj' => $access_user, + 'link_table' => 'access_usergroup', + 'target_table' => 'access_group', + 'name_col' => 'groupname', + 'target_link' => $p.'edit/access_group.html?', + #'disable-able' => 1, + ). + '</TR></TD></TABLE>' + ; + }, + ) +%> diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index 944ddd0d0..f5afd3a96 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -14,9 +14,7 @@ if ( $cgi->param('error') ) { } my $action = $agent_type->typenum ? 'Edit' : 'Add'; -%> - -<%= include("/elements/header.html","$action Agent Type", menubar( +%><%= include("/elements/header.html","$action Agent Type", menubar( 'Main Menu' => "$p", 'View all agent types' => "${p}browse/agent_type.cgi", )) @@ -29,47 +27,29 @@ my $action = $agent_type->typenum ? 'Edit' : 'Add'; <FORM ACTION="<%= popurl(1) %>process/agent_type.cgi" METHOD=POST> <INPUT TYPE="hidden" NAME="typenum" VALUE="<%= $agent_type->typenum %>"> Agent Type #<%= $agent_type->typenum || "(NEW)" %> -<BR><BR> +<BR> Agent Type <INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<%= $agent_type->atype %>"> <BR><BR> Select which packages agents of this type may sell to customers<BR> - -<% foreach my $part_pkg ( - qsearch({ 'table' => 'part_pkg', - 'hashref' => { 'disabled' => '' }, - 'select' => 'part_pkg.*', - 'addl_from' => 'LEFT JOIN type_pkgs USING ( pkgpart )', - 'extra_sql' => ( $agent_type->typenum - ? 'OR typenum = '. $agent_type->typenum - : '' - ), - }) - ) { +<%= ntable("#cccccc", 2) %><TR><TD> +<%= include('/elements/checkboxes-table.html', + 'source_obj' => $agent_type, + 'link_table' => 'type_pkgs', + 'target_table' => 'part_pkg', + 'name_callback' => sub { $_[0]->pkg. ' - '. $_[0]->comment; }, + 'target_link' => $p.'edit/part_pkg.cgi?', + 'disable-able' => 1, + + ) %> - - <BR> - <INPUT TYPE="checkbox" NAME="pkgpart<%= $part_pkg->pkgpart %>" <%= - qsearchs('type_pkgs',{ - 'typenum' => $agent_type->typenum, - 'pkgpart' => $part_pkg->pkgpart, - }) - ? 'CHECKED ' - : '' - %> VALUE="ON"> - - <A HREF="<%= $p %>edit/part_pkg.cgi?<%= $part_pkg->pkgpart %>"><%= $part_pkg->pkgpart %>: - <%= $part_pkg->pkg %> - <%= $part_pkg->comment %></A> - <%= $part_pkg->disabled =~ /^Y/i ? ' (DISABLED)' : '' %> - -<% } %> - -<BR><BR> +</TD></TR></TABLE> +<BR> <INPUT TYPE="submit" VALUE="<%= $agent_type->typenum ? "Apply changes" : "Add agent type" %>"> </FORM> - </BODY> -</HTML> + +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index 24bce308a..9d3bdd8cb 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,4 +1,3 @@ -<!-- mason kludge --> <% my($paynum, $amount, $invnum); @@ -18,78 +17,76 @@ my $otaker = getotaker; my $p1 = popurl(1); -print header("Apply Payment", ''); -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT><BR><BR>" - if $cgi->param('error'); -print <<END; - <FORM ACTION="${p1}process/cust_bill_pay.cgi" METHOD=POST> -END +%><%= header("Apply Payment", '') %> +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> + <BR><BR> +<% } %> + +<FORM ACTION="<%= $p1 %>process/cust_bill_pay.cgi" METHOD=POST> + +<% my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); die "payment $paynum not found!" unless $cust_pay; my $unapplied = $cust_pay->unapplied; +%> + +Payment #<B><%= $paynum %></B> +<INPUT TYPE="hidden" NAME="paynum" VALUE="<%= $paynum %>"> -print "Payment # <B>$paynum</B>". - qq!<INPUT TYPE="hidden" NAME="paynum" VALUE="$paynum">!. - '<BR>Date: <B>'. time2str("%D", $cust_pay->_date). '</B>'. - '<BR>Amount: $<B>'. $cust_pay->paid. '</B>'. - "<BR>Unapplied amount: \$<B>$unapplied</B>" - ; +<BR>Date: <B><%= time2str("%D", $cust_pay->_date) %></B> +<BR>Amount: $<B><%= $cust_pay->paid %></B> + +<BR>Unapplied amount: $<B><%= $unapplied %></B> + +<% my @cust_bill = grep $_->owed != 0, qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } ); -print <<END; +%> + <SCRIPT> function changed(what) { cust_bill = what.options[what.selectedIndex].value; -END -foreach my $cust_bill ( @cust_bill ) { +<% foreach my $cust_bill ( @cust_bill ) { my $invnum = $cust_bill->invnum; my $changeto = $cust_bill->owed < $unapplied ? $cust_bill->owed : $unapplied; - print <<END; +%> if ( cust_bill == $invnum ) { - what.form.amount.value = "$changeto"; + what.form.amount.value = "<%= $changeto %>"; } -END -} +<% } %> -print <<END; if ( cust_bill == "Refund" ) { - what.form.amount.value = "$unapplied"; + what.form.amount.value = "<%= $unapplied %>"; } } </SCRIPT> -END - -print qq!<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">!, - '<OPTION VALUE="">'; -foreach my $cust_bill ( @cust_bill ) { - print '<OPTION'. ( $cust_bill->invnum eq $invnum ? ' SELECTED' : '' ). - ' VALUE="'. $cust_bill->invnum. '">'. $cust_bill->invnum. - ' - '. time2str("%D",$cust_bill->_date). - ' - $'. $cust_bill->owed; -} -print qq!<OPTION VALUE="Refund">Refund!; -print "</SELECT>"; -print qq!<BR>Amount \$<INPUT TYPE="text" NAME="amount" VALUE="$amount" SIZE=8 MAXLENGTH=8>!; +<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)"> +<OPTION VALUE=""> + +<% foreach my $cust_bill ( @cust_bill ) { %> + + <OPTION<%= $cust_bill->invnum eq $invnum ? ' SELECTED' : '' %> VALUE="<%= $cust_bill->invnum %>"><%= $cust_bill->invnum %> - <%= time2str("%D", $cust_bill->_date) %> - $<%= $cust_bill->owed %> + +<% } %> + +<OPTION VALUE="Refund">Refund +</SELECT> + +<BR>Amount $<INPUT TYPE="text" NAME="amount" VALUE="<%= $amount %>" SIZE=8 MAXLENGTH=8> -print <<END; <BR> -<INPUT TYPE="submit" VALUE="Apply"> -END +<CENTER><INPUT TYPE="submit" VALUE="Apply"></CENTER> -print <<END; +</FORM> - </FORM> - </BODY> +</BODY> </HTML> -END - -%> diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index aae0df2fc..946b1087b 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,4 +1,3 @@ -<!-- mason kludge --> <% my $conf = new FS::Conf; @@ -25,39 +24,57 @@ my $otaker = getotaker; my $p1 = popurl(1); -print header("Post Credit", ''); -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT>" - if $cgi->param('error'); -print <<END, small_custview($custnum, $conf->config('countrydefault')); - <FORM ACTION="${p1}process/cust_credit.cgi" METHOD=POST> - <INPUT TYPE="hidden" NAME="crednum" VALUE=""> - <INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum"> - <INPUT TYPE="hidden" NAME="paybatch" VALUE=""> - <INPUT TYPE="hidden" NAME="_date" VALUE="$_date"> - <INPUT TYPE="hidden" NAME="credited" VALUE=""> - <INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker"> -END - -print '<BR><BR>Credit'. ntable("#cccccc", 2). - '<TR><TD ALIGN="right">Date</TD><TD BGCOLOR="#ffffff">'. - time2str("%D",$_date). '</TD></TR>'; - -print qq!<TR><TD ALIGN="right">Amount</TD><TD BGCOLOR="#ffffff">\$<INPUT TYPE="text" NAME="amount" VALUE="$amount" SIZE=8 MAXLENGTH=8></TD></TR>!; +%> + +<%= header("Post Credit", '') %> + +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> + <BR><BR> +<% } %> + +<!-- <%= small_custview($custnum, $conf->config('countrydefault')) %> --> + +<FORM ACTION="<%= $p1 %>process/cust_credit.cgi" METHOD=POST> +<INPUT TYPE="hidden" NAME="crednum" VALUE=""> +<INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>"> +<INPUT TYPE="hidden" NAME="paybatch" VALUE=""> +<INPUT TYPE="hidden" NAME="_date" VALUE="<%= $_date %>"> +<INPUT TYPE="hidden" NAME="credited" VALUE=""> +<INPUT TYPE="hidden" NAME="otaker" VALUE="<%= $otaker %>"> + +Credit + +<%= ntable("#cccccc", 2) %> + <TR> + <TD ALIGN="right">Date</TD> + <TD BGCOLOR="#ffffff"><%= time2str("%D",$_date) %></TD> + </TR> + + <TR> + <TD ALIGN="right">Amount</TD> + <TD BGCOLOR="#ffffff">$<INPUT TYPE="text" NAME="amount" VALUE="<%= $amount %>" SIZE=8 MAXLENGTH=8></TD> + </TR> + +<% #print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="$refund">Also post refund!; +%> -print qq!<TR><TD ALIGN="right">Reason</TD><TD BGCOLOR="#ffffff"><INPUT TYPE="text" NAME="reason" VALUE="$reason"></TD></TR>!; + <TR> + <TD ALIGN="right">Reason</TD> + <TD BGCOLOR="#ffffff"><INPUT TYPE="text" NAME="reason" VALUE="<%= $reason %>" SIZE=32></TD> + </TR> -print qq!<TR><TD ALIGN="right">Auto-apply<BR>to invoices</TD><TD><SELECT NAME="apply"><OPTION VALUE="yes" SELECTED>yes<OPTION>no</SELECT></TD>!; + <TR> + <TD ALIGN="right">Auto-apply<BR>to invoices</TD> + <TD><SELECT NAME="apply"><OPTION VALUE="yes" SELECTED>yes<OPTION>no</SELECT></TD> + </TR> -print <<END; </TABLE> + <BR> -<INPUT TYPE="submit" VALUE="Post credit"> +<CENTER><INPUT TYPE="submit" VALUE="Post credit"></CENTER> </FORM> </BODY> </HTML> -END - -%> diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index 1a97e1312..409ea3c25 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,4 +1,3 @@ -<!-- mason kludge --> <% my($crednum, $amount, $invnum); @@ -23,79 +22,78 @@ my $otaker = getotaker; my $p1 = popurl(1); -print header("Apply Credit", ''); -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT><BR><BR>" - if $cgi->param('error'); -print <<END; - <FORM ACTION="${p1}process/cust_credit_bill.cgi" METHOD=POST> -END +%><%= header("Apply Credit", '') %> +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> + <BR><BR> +<% } %> + +<FORM ACTION="<%= $p1 %>process/cust_credit_bill.cgi" METHOD=POST> + +<% my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); die "credit $crednum not found!" unless $cust_credit; my $credited = $cust_credit->credited; +%> + +Credit #<B><%= $crednum %></B> +<INPUT TYPE="hidden" NAME="crednum" VALUE="<%= $crednum %>"> + +<BR>Date: <B><%= time2str("%D", $cust_credit->_date) %></B> -print "Credit # <B>$crednum</B>". - qq!<INPUT TYPE="hidden" NAME="crednum" VALUE="$crednum">!. - '<BR>Date: <B>'. time2str("%D", $cust_credit->_date). '</B>'. - '<BR>Amount: $<B>'. $cust_credit->amount. '</B>'. - "<BR>Unapplied amount: \$<B>$credited</B>". - '<BR>Reason: <B>'. $cust_credit->reason. '</B>' - ; +<BR>Amount: $<B><%= $cust_credit->amount %></B> +<BR>Unapplied amount: $<B><%= $credited %></B> + +<BR>Reason: <B><%= $cust_credit->reason %></B> + +<% my @cust_bill = grep $_->owed != 0, qsearch('cust_bill', { 'custnum' => $cust_credit->custnum } ); -print <<END; +%> + <SCRIPT> function changed(what) { cust_bill = what.options[what.selectedIndex].value; -END -foreach my $cust_bill ( @cust_bill ) { +<% foreach my $cust_bill ( @cust_bill ) { my $invnum = $cust_bill->invnum; my $changeto = $cust_bill->owed < $cust_credit->credited ? $cust_bill->owed : $cust_credit->credited; - print <<END; +%> if ( cust_bill == $invnum ) { - what.form.amount.value = "$changeto"; + what.form.amount.value = "<%= $changeto %>"; } -END -} +<% } %> -print <<END; if ( cust_bill == "Refund" ) { - what.form.amount.value = "$credited"; + what.form.amount.value = "<%= $credited %>"; } } </SCRIPT> -END - -print qq!<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">!, - '<OPTION VALUE="">'; -foreach my $cust_bill ( @cust_bill ) { - print '<OPTION'. ( $cust_bill->invnum eq $invnum ? ' SELECTED' : '' ). - ' VALUE="'. $cust_bill->invnum. '">'. $cust_bill->invnum. - ' - '. time2str("%D",$cust_bill->_date). - ' - $'. $cust_bill->owed; -} -print qq!<OPTION VALUE="Refund">Refund!; -print "</SELECT>"; -print qq!<BR>Amount \$<INPUT TYPE="text" NAME="amount" VALUE="$amount" SIZE=8 MAXLENGTH=8>!; +<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)"> +<OPTION VALUE=""> + +<% foreach my $cust_bill ( @cust_bill ) { %> + +<OPTION<%= $cust_bill->invnum eq $invnum ? ' SELECTED' : '' %> VALUE="<%= $cust_bill->invnum %>"><%= $cust_bill->invnum %> - <%= time2str("%D",$cust_bill->_date) %> - $<%= $cust_bill->owed %> + +<% } %> + +<OPTION VALUE="Refund">Refund +</SELECT> + +<BR>Amount $<INPUT TYPE="text" NAME="amount" VALUE="<%= $amount %>" SIZE=8 MAXLENGTH=8> -print <<END; <BR> -<INPUT TYPE="submit" VALUE="Apply"> -END +<CENTER><INPUT TYPE="submit" VALUE="Apply"></CENTER> -print <<END; +</FORM> - </FORM> - </BODY> +</BODY> </HTML> -END - -%> diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 80fec9359..bb2a8618e 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -397,49 +397,66 @@ unless ( $custnum ) { if ( @part_pkg ) { -# print "<BR><BR>First package", &itable("#cccccc", "0 ALIGN=LEFT"), -#apiabuse & undesirable wrapping - print "<BR>First package", &ntable("#cccccc"), - qq!<TR><TD COLSPAN=2><SELECT NAME="pkgpart_svcpart">!; - - print qq!<OPTION VALUE="">(none)!; - - foreach my $part_pkg ( @part_pkg ) { - print qq!<OPTION VALUE="!, -# $part_pkg->pkgpart. "_". $pkgpart{ $part_pkg->pkgpart }, '"'; - $part_pkg->pkgpart. "_". $part_pkg->svcpart('svc_acct'), '"'; - print " SELECTED" if $saved_pkgpart && ( $part_pkg->pkgpart == $saved_pkgpart ); - print ">", $part_pkg->pkg, " - ", $part_pkg->comment; - } - print "</SELECT></TD></TR>"; - - #false laziness: (mostly) copied from edit/svc_acct.cgi - #$ulen = $svc_acct->dbdef_table->column('username')->length; - my $ulen = dbdef->table('svc_acct')->column('username')->length; - my $ulen2 = $ulen+2; - my $passwordmax = $conf->config('passwordmax') || 8; - my $pmax2 = $passwordmax + 2; - print <<END; -<TR><TD ALIGN="right">Username</TD> -<TD><INPUT TYPE="text" NAME="username" VALUE="$username" SIZE=$ulen2 MAXLENGTH=$ulen></TD></TR> -<TR><TD ALIGN="right">Password</TD> -<TD><INPUT TYPE="text" NAME="_password" VALUE="$password" SIZE=$pmax2 MAXLENGTH=$passwordmax> -(blank to generate)</TD></TR> -END - - print '<TR><TD ALIGN="right">Access number</TD><TD>' - . - &FS::svc_acct_pop::popselector($popnum). - '</TD></TR></TABLE>' - ; - } -} + # print "<BR><BR>First package", &itable("#cccccc", "0 ALIGN=LEFT"), + #apiabuse & undesirable wrapping + + %> + <BR>First package + <%= ntable("#cccccc") %> + + <TR> + <TD COLSPAN=2> + <SELECT NAME="pkgpart_svcpart"> + <OPTION VALUE="">(none) + + <% foreach my $part_pkg ( @part_pkg ) { %> + + <OPTION VALUE="<%= $part_pkg->pkgpart. "_". $part_pkg->svcpart('svc_acct') %>"<%= ( $saved_pkgpart && $part_pkg->pkgpart == $saved_pkgpart ) ? ' SELECTED' : '' %>><%= $part_pkg->pkg. " - ". $part_pkg->comment %> + + <% } %> + </SELECT> + </TD> + </TR> + + <% + #false laziness: (mostly) copied from edit/svc_acct.cgi + #$ulen = $svc_acct->dbdef_table->column('username')->length; + my $ulen = dbdef->table('svc_acct')->column('username')->length; + my $ulen2 = $ulen+2; + my $passwordmax = $conf->config('passwordmax') || 8; + my $pmax2 = $passwordmax + 2; + %> + + <TR> + <TD ALIGN="right">Username</TD> + <TD> + <INPUT TYPE="text" NAME="username" VALUE="<%= $username %>" SIZE=<%= $ulen2 %> MAXLENGTH=<%= $ulen %>> + </TD> + </TR> + + <TR> + <TD ALIGN="right">Password</TD> + <TD> + <INPUT TYPE="text" NAME="_password" VALUE="<%= $password %>" SIZE=<%= $pmax2 %> MAXLENGTH=<%= $passwordmax %>> + (blank to generate) + </TD> + </TR> + + <TR> + <TD ALIGN="right">Access number</TD> + <TD><%= FS::svc_acct_pop::popselector($popnum) %></TD> + </TR> + </TABLE> + + <% } %> + +<% } %> -my $otaker = $cust_main->otaker; -print qq!<INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker">!, - qq!<BR><INPUT TYPE="submit" NAME="submit" VALUE="!, - $custnum ? "Apply Changes" : "Add Customer", qq!"><BR>!, - "</FORM></DIV></BODY></HTML>", -; +<INPUT TYPE="hidden" NAME="otaker" VALUE="<%= $cust_main->otaker %>"> +<BR> +<INPUT TYPE="submit" NAME="submit" VALUE="<%= $custnum ? "Apply Changes" : "Add Customer" %>"> +<BR> +</FORM> + +<%= include('/elements/footer.html') %> -%> diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index ce1c86612..174d4dde1 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,4 +1,3 @@ -<!-- mason kludge --> <% my %pkg = (); @@ -29,48 +28,62 @@ if ( $cgi->param('error') ) { } my $p1 = popurl(1); -print header("Add/Edit Packages", ''); -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT>" - if $cgi->param('error'); +%><%= include('/elements/header.html', "Add/Edit Packages", '') %> -print qq!<FORM ACTION="${p1}process/cust_pkg.cgi" METHOD=POST>!; +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> +<% } %> -print qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!; +<FORM ACTION="<%= $p1 %>process/cust_pkg.cgi" METHOD=POST> +<INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>"> + +<% #current packages -my @cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); +my @cust_pkg = qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ); if (@cust_pkg) { - print <<END; -Current packages - select to remove (services are moved to a new package below) -<TABLE> - <TR STYLE="background-color: #cccccc;"> - <TH COLSPAN="2">Pkg #</TH> - <TH>Package description</TH> - </TR> -<BR><BR> -END +%> + + Current packages - select to remove (services are moved to a new package below) + <TABLE> + <TR STYLE="background-color: #cccccc;"> + <TH COLSPAN="2">Pkg #</TH> + <TH>Package description</TH> + </TR> + <BR><BR> - foreach (sort { $all_pkg{$a->getfield('pkgpart')} cmp $all_pkg{$b->getfield('pkgpart')} } @cust_pkg) { + <% + + foreach ( sort { $all_pkg{ $a->getfield('pkgpart') } + cmp $all_pkg{ $b->getfield('pkgpart') } + } + @cust_pkg + ) + { my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') ); my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : ''; - print <<END; - <TR> - <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="$pkgnum"${checked}></TD> - <TD ALIGN="right">$pkgnum:</TD>\n - <TD>$all_pkg{$pkgpart} - $all_comment{$pkgpart}</TD> - </TR> -END - } - print qq!</TABLE><BR><BR>!; -} -print <<END; -Order new packages<BR><BR> -END + %> + + <TR> + <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="<%= $pkgnum %>"<%= $checked %>></TD> + <TD ALIGN="right"><%= $pkgnum %>:</TD> + <TD><%= $all_pkg{$pkgpart} %> - <%= $all_comment{$pkgpart} %></TD> + </TR> + + <% } %> + + </TABLE> + <BR><BR> +<% } %> + +Order new packages +<BR><BR> + +<% my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); @@ -79,13 +92,15 @@ my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) } my $count = 0; my $pkgparts = 0; -print <<END; +%> + <TABLE> <TR STYLE="background-color: #cccccc;"> <TH>Qty.</TH> <TH COLSPAN="2">Package Description</TH> </TR> -END + +<% #foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} } keys(%agent_pkgs) ) { @@ -93,38 +108,43 @@ foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} } next unless exists $pkg{$pkgpart}; #skip disabled ones #print qq!<TR>! if ( $count == 0 ); my $value = $cgi->param("pkg$pkgpart") || 0; - print <<END; +%> + <TR> - <TD><INPUT TYPE="text" NAME="pkg$pkgpart" VALUE="$value" SIZE="2" MAXLENGTH="2"></TD> - <TD ALIGN="right">$pkgpart:</TD> - <TD>$pkg{$pkgpart} - $comment{$pkgpart}</TD> + <TD> + <INPUT TYPE="text" NAME="<%= "pkg$pkgpart" %>" VALUE="<%= $value %>" SIZE="2" MAXLENGTH="2"> + </TD> + <TD ALIGN="right"><%= $pkgpart %>:</TD> + <TD><%= $pkg{$pkgpart} %> - <%= $comment{$pkgpart}%></TD> </TR> -END + +<% $count ++ ; #if ( $count == 2 ) { # print qq!</TR>\n! ; # $count = 0; #} } -print qq!</TABLE>!; - -unless ( $pkgparts ) { - my $p2 = popurl(2); - my $typenum = $agent->typenum; - my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } ); - my $atype = $agent_type->atype; - print <<END; -(No <a href="${p2}browse/part_pkg.cgi">package definitions</a>, or agent type -<a href="${p2}edit/agent_type.cgi?$typenum">$atype</a> not allowed to purchase -any packages.) -END -} +%> -#submit -print <<END; -<P><INPUT TYPE="submit" VALUE="Order"> - </FORM> - </BODY> -</HTML> -END +</TABLE> + +<% unless ( $pkgparts ) { + my $p2 = popurl(2); + my $typenum = $agent->typenum; + my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } ); + my $atype = $agent_type->atype; %> + + (No <A HREF="<%= $p2 %>browse/part_pkg.cgi">package definitions</A>, + or agent type + <A HREF="<%= $p2 %>edit/agent_type.cgi?<%= $typenum %>"><%= $atype %></a> + is not allowed to purchase any packages.) + +<% } %> + +<P><INPUT TYPE="submit" VALUE="Order"> + +</FORM> + +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 5486b4b00..120c03a3c 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -17,6 +17,13 @@ # 'menubar' => '', #menubar arrayref # # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # + # 'html_bottom' => '', #string + # 'html_bottom' => sub { + # my $object = shift; + # # ... + # "html_string"; + # }, my(%opt) = @_; @@ -27,6 +34,7 @@ my $fields = $opt{'fields'} #|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ]; || [ grep { $_ ne $pkey } fields($table) ]; + #my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields; my $object; if ( $cgi->param('error') ) { @@ -63,10 +71,7 @@ ); } -%> - - -<%= include("/elements/header.html", $title, +%><%= include("/elements/header.html", $title, include( '/elements/menubar.html', @menubar ) ) %> @@ -86,7 +91,18 @@ <%= ntable("#cccccc",2) %> -<% foreach my $field ( @$fields ) { %> +<% foreach my $f ( @$fields ) { + + my( $field, $type); + if ( ref($f) ) { + $field = $f->{'field'}, + $type = $f->{'type'} || 'text', + } else { + $field = $f; + $type = 'text'; + } + +%> <TR> @@ -98,12 +114,11 @@ </TD> <% - #just text in one size for now... eventually more options for - # uneditable, hidden, <SELECT>, etc. fields + #eventually more options for <SELECT>, etc. fields %> <TD> - <INPUT TYPE="text" NAME="<%= $field %>" VALUE="<%= $object->$field() %>"> + <INPUT TYPE="<%= $type %>" NAME="<%= $field %>" VALUE="<%= $object->$field() %>"> <TD> </TR> @@ -112,6 +127,11 @@ </TABLE> +<%= ref( $opt{'html_bottom'} ) + ? &{ $opt{'html_bottom'} }( $object ) + : $opt{'html_bottom'} +%> + <BR> <INPUT TYPE="submit" VALUE="<%= $object->$pkey() ? "Apply changes" : "Add $opt{'name'}" %>"> diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi index f784dfa3e..dce1e6394 100755 --- a/httemplate/edit/part_referral.cgi +++ b/httemplate/edit/part_referral.cgi @@ -1,4 +1,3 @@ -<!-- mason kludge --> <% my $part_referral; @@ -17,32 +16,29 @@ my $action = $part_referral->refnum ? 'Edit' : 'Add'; my $hashref = $part_referral->hashref; my $p1 = popurl(1); -print header("$action Advertising source", menubar( + +%><%= include('/elements/header.html', "$action Advertising source", menubar( 'Main Menu' => popurl(2), 'View all advertising sources' => popurl(2). "browse/part_referral.cgi", -)); +)) %> + +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> +<% } %> -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT>" - if $cgi->param('error'); +<FORM ACTION="<%= $p1 %>process/part_referral.cgi" METHOD=POST> -print qq!<FORM ACTION="${p1}process/part_referral.cgi" METHOD=POST>!; +<INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $hashref->{refnum} %>"> -print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$hashref->{refnum}">!; +<% #print "Referral #", $hashref->{refnum} ? $hashref->{refnum} : "(NEW)"; +%> -print <<END; -Advertising source <INPUT TYPE="text" NAME="referral" SIZE=32 VALUE="$hashref->{referral}"> -END +Advertising source <INPUT TYPE="text" NAME="referral" SIZE=32 VALUE="<%= $hashref->{referral} %>"> -print qq!<BR><INPUT TYPE="submit" VALUE="!, - $hashref->{refnum} ? "Apply changes" : "Add advertising source", - qq!">!; +<BR> +<INPUT TYPE="submit" VALUE="<%= $hashref->{refnum} ? "Apply changes" : "Add advertising source" %>"> -print <<END; - </FORM> - </BODY> -</HTML> -END +</FORM> -%> +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/part_virtual_field.cgi b/httemplate/edit/part_virtual_field.cgi index fb10321e8..7b2c768a7 100644 --- a/httemplate/edit/part_virtual_field.cgi +++ b/httemplate/edit/part_virtual_field.cgi @@ -1,4 +1,3 @@ -<!-- mason kludge --> <% my ($vfieldpart, $part_virtual_field); @@ -21,12 +20,14 @@ if ( $cgi->param('error') ) { my $action = $part_virtual_field->vfieldpart ? 'Edit' : 'Add'; my $p1 = popurl(1); -print header("$action Virtual Field Definition", ''); -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT>" - if $cgi->param('error'); -%> +%><%= include('/elements/header.html', "$action Virtual Field Definition") %> + +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> + <BR><BR> +<% } %> + <FORM ACTION="<%=$p1%>process/generic.cgi" METHOD="POST"> <INPUT TYPE="hidden" NAME="table" VALUE="part_virtual_field"> @@ -83,10 +84,8 @@ Field #<B><%=$vfieldpart or "(NEW)"%></B><BR><BR> </FORM> -<BR><BR> +<BR> <FONT SIZE=-2>If you don't understand what <I>check_block</I> and <I>list_source</I> mean, <B>LEAVE THEM BLANK</B>. We mean it.</FONT> - -</BODY> -</HTML> +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html new file mode 100644 index 000000000..e8c6d07b1 --- /dev/null +++ b/httemplate/edit/process/access_group.html @@ -0,0 +1,5 @@ +<%= include( 'elements/process.html', + 'table' => 'access_group', + 'viewall_dir' => 'browse', + ) +%> diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html new file mode 100644 index 000000000..a6c2a36b1 --- /dev/null +++ b/httemplate/edit/process/access_user.html @@ -0,0 +1,8 @@ +<%= include( 'elements/process.html', + 'table' => 'access_user', + 'viewall_dir' => 'browse', + 'process_m2m' => { 'link_table' => 'access_usergroup', + 'target_table' => 'access_group', + }, + ) +%> diff --git a/httemplate/edit/process/agent_type.cgi b/httemplate/edit/process/agent_type.cgi index 516594573..fd8ca8833 100755 --- a/httemplate/edit/process/agent_type.cgi +++ b/httemplate/edit/process/agent_type.cgi @@ -11,43 +11,24 @@ my $new = new FS::agent_type ( { my $error; if ( $typenum ) { - $error=$new->replace($old); + $error = $new->replace($old); } else { - $error=$new->insert; - $typenum=$new->getfield('typenum'); + $error = $new->insert; + $typenum = $new->getfield('typenum'); } +#$error ||= $new->process_m2m( ); if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); } else { - #false laziness w/ edit/process/part_svc.cgi - foreach my $part_pkg (qsearch('part_pkg',{})) { - my($pkgpart)=$part_pkg->getfield('pkgpart'); - - my($type_pkgs)=qsearchs('type_pkgs',{ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, - }); - if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) { - my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below. - $error=$d_type_pkgs->delete; - die $error if $error; - - } elsif ( $cgi->param("pkgpart$pkgpart") - && ! $type_pkgs - ) { - #ok to clobber it now (but bad form nonetheless?) - $type_pkgs=new FS::type_pkgs ({ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, - }); - $error= $type_pkgs->insert; - die $error if $error; - } - - } + my $error = $new->process_m2m( + 'link_table' => 'type_pkgs', + 'target_table' => 'part_pkg', + 'params' => scalar($cgi->Vars) + ); + die $error if $error; print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); } diff --git a/httemplate/edit/process/cust_bill_pay.cgi b/httemplate/edit/process/cust_bill_pay.cgi index 0025b16b5..fc668bb07 100755 --- a/httemplate/edit/process/cust_bill_pay.cgi +++ b/httemplate/edit/process/cust_bill_pay.cgi @@ -33,11 +33,19 @@ if ($cgi->param('invnum') =~ /^Refund$/) { my $error = $new->insert; if ( $error ) { + $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ); + %><%= $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ) %><% + } else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Payment application sucessful') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + + </BODY></HTML> -%> +<% } %> diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 85bfd4489..6a4ef194a 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -13,14 +13,23 @@ my $error = $new->insert; if ( $error ) { $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ); + + %><%= $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ) %><% + } else { + if ( $cgi->param('apply') eq 'yes' ) { my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) or die "unknown custnum $custnum"; $cust_main->apply_credits; } - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Credit sucessful') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + + </BODY></HTML> -%> +<% } %> diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 28f892f62..3b759536f 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -34,11 +34,19 @@ if ($cgi->param('invnum') =~ /^Refund$/) { my $error = $new->insert; if ( $error ) { + $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ); + %><%= $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %><% + } else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Credit application sucessful') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + + </BODY></HTML> -%> +<% } %> diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 83ff6f728..59ad35ee4 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -2,10 +2,21 @@ # options example... # + ### + ##req + ## # 'table' => + # # #? 'primary_key' => #required when the dbdef doesn't know...??? # #? 'fields' => [] + # + ### + ##opt + ### # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # 'process_m2m' => { 'link_table' => 'link_table_name', + # 'target_table' => 'target_table_name', + # }. my(%opt) = @_; @@ -31,12 +42,16 @@ if ( $pkeyvalue ) { $error = $new->replace($old); } else { - warn $new; $error = $new->insert; - warn $error; $pkeyvalue = $new->getfield($pkey); } + if ( !$error && $opt{'process_m2m'} ) { + $error = $new->process_m2m( %{ $opt{'process_m2m'} }, + 'params' => scalar($cgi->Vars), + ); + } + if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index ca0e3398f..f47ba0a8f 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -1,4 +1,3 @@ -<!-- mason kludge --> <% my($svcnum, $pkgnum, $svcpart, $kludge_action, $purpose, $part_svc, @@ -66,33 +65,31 @@ my $otaker = getotaker; my $domain = $svc_domain->domain; my $p1 = popurl(1); -print header("$action $svc", ''); - -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT>" - if $cgi->param('error'); - -print <<END; - <FORM ACTION="${p1}process/svc_domain.cgi" METHOD=POST> - <INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum"> - <INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum"> - <INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart"> -END - -print qq!<INPUT TYPE="radio" NAME="action" VALUE="N"!; -print ' CHECKED' if $kludge_action eq 'N'; -print qq!>New!; -print qq!<BR><INPUT TYPE="radio" NAME="action" VALUE="M"!; -print ' CHECKED' if $kludge_action eq 'M'; -print qq!>Transfer!; - -print <<END; -<P>Domain <INPUT TYPE="text" NAME="domain" VALUE="$domain" SIZE=28 MAXLENGTH=63> -<BR>Purpose/Description: <INPUT TYPE="text" NAME="purpose" VALUE="$purpose" SIZE=64> -<P><INPUT TYPE="submit" VALUE="Submit"> - </FORM> - </BODY> -</HTML> -END %> + +<%= include('/elements/header.html', "$action $svc", '') %> + +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> +<% } %> + +<FORM ACTION="<%= $p1 %>process/svc_domain.cgi" METHOD=POST> +<INPUT TYPE="hidden" NAME="svcnum" VALUE="<%= $svcnum %>"> +<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>"> +<INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $svcpart %>"> + +<INPUT TYPE="radio" NAME="action" VALUE="N"<%= $kludge_action eq 'N' ? ' CHECKED' : '' %>>New +<BR> + +<INPUT TYPE="radio" NAME="action" VALUE="M"<%= $kludge_action eq 'M' ? ' CHECKED' : '' %>>Transfer + +<P>Domain <INPUT TYPE="text" NAME="domain" VALUE="<%= $domain %>" SIZE=28 MAXLENGTH=63> + +<BR>Purpose/Description: <INPUT TYPE="text" NAME="purpose" VALUE="<%= $purpose %>" SIZE=64> + +<P><INPUT TYPE="submit" VALUE="Submit"> + +</FORM> + +<%= include('/elements/footer.html') %> |