diff options
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/browse/agent.cgi | 8 | ||||
-rw-r--r-- | httemplate/docs/schema.html | 8 | ||||
-rw-r--r-- | httemplate/docs/selfservice.html | 17 | ||||
-rw-r--r-- | httemplate/docs/upgrade10.html | 4 | ||||
-rw-r--r-- | httemplate/edit/prepay_credit.cgi | 56 | ||||
-rw-r--r-- | httemplate/edit/process/prepay_credit.cgi | 51 | ||||
-rw-r--r-- | httemplate/edit/process/reg_code.cgi | 5 | ||||
-rw-r--r-- | httemplate/index.html | 59 | ||||
-rw-r--r-- | httemplate/search/elements/search.html | 11 | ||||
-rw-r--r-- | httemplate/search/prepay_credit.html | 43 | ||||
-rw-r--r-- | httemplate/view/cust_main/payment_history.html | 1 |
11 files changed, 221 insertions, 42 deletions
diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 82f18bff7..d8c74d1fe 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -37,6 +37,7 @@ full offerings (via their type).<BR><BR> <TH>Customers</TH> <TH>Reports</TH> <TH>Registration Codes</TH> + <TH>Prepaid cards</TH> <TH><FONT SIZE=-1>Freq.</FONT></TH> <TH><FONT SIZE=-1>Prog.</FONT></TH> </TR> @@ -106,6 +107,13 @@ foreach my $agent ( sort { <BR><A HREF="<%=$p%>edit/reg_code.cgi?agentnum=<%= $agent->agentnum %>">Generate codes</A> </TD> + <TD> + <%= my $num_prepay_credit = $agent->num_prepay_credit %> + <% if ( $num_prepay_credit ) { %> + <A HREF="<%=$p%>search/prepay_credit.html?agentnum=<%= $agent->agentnum %>"><% } %>Unused<% if ( $num_prepay_credit ) { %></A><% } %> + <BR><A HREF="<%=$p%>edit/prepay_credit.cgi?agentnum=<%= $agent->agentnum %>">Generate cards</A> + </TD> + <TD><%= $agent->freq %></TD> <TD><%= $agent->prog %></TD> diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 63c795375..e9688756b 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -353,11 +353,13 @@ <li>nasport - port number on the NAS <li>nasnum - <a href="#nas">NAS</a> </ul> - <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a> + <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a> - prepaid cards <ul> <li>prepaynum - primary key - <li>identifier - text or numeric string used to receive this credit - <li>amount - amount of credit + <li>identifier - text or numeric string of prepaid card + <li>amount - amount of prepayment + <li>seconds - prepaid time instead of (or in addition to) monetary value + <li>agentnum - optional agent assignment for prepaid cards </ul> <li><a name="session" href="man/FS/session.html">session</a> <ul> diff --git a/httemplate/docs/selfservice.html b/httemplate/docs/selfservice.html index e533ed2ee..6d17ead3f 100644 --- a/httemplate/docs/selfservice.html +++ b/httemplate/docs/selfservice.html @@ -16,19 +16,26 @@ machine, not the backend Freeside server. On the public machine, install: <li><a href="http://search.cpan.org/search?dist=HTTP-BrowserDetect">HTTP::BrowserDetect</a> <li><a href="man/FS/SelfService.html">FS::SelfService</a> (copy the fs_selfservice/FS-SelfService directory to the external machine, then: perl Makefile.PL; make; make install) - <li><a href="man/FS/SignupClient.html">FS::SignupClient</a> (copy the fs_signup/FS-SignupClient directory to the external machine, then: perl Makefile.PL; make; make install) </ul> Then: <ul> <li>Set the <a href="../config/config.cgi#unclassified"><i>signup_server-default_agentnum</i></a> configuration value to a default <a href="../browse/agent.cgi">agent number</a>. <li>Set the <a href="../config/config.cgi#unclassified"><i>signup_server-default_refnum</i></a> to a default <a href="../browse/part_referral.cgi">advertising source</a>. <li>Add the user `freeside' to the the external machine. - <li>Copy or symlink the <pre>fs_selfservice/FS-SelfService/cgi/</pre> directory into the web server's document space, for customer self-service and reseller access. Optionally, customize the .html templates. - <li>Copy or symlink the <pre>fs_signup/FS-SignupClient/cgi/</pre> directory into the web server's document space, for signups. Optionally, customize the .html templates. + <li>Copy or symlink the <code>fs_selfservice/FS-SelfService/cgi/</code> directory into the web server's document space. Optionally, customize the .html templates. "Entry points" (useful places to link to) are: + <ul> + <li>signup.cgi - Signup + <li>selfservice.cgi - Customer self-service + <li>agent.cgi - Reseller interface + <li>passwd.cgi - Simple password-changing interface + <li>promocode.html - Promotional code pre-signup + <li>regcode.html - Registration code pre-signup + <li>stateselect.html - State selection pre-signup + </ul> <li>When linking to signup.cgi, you can include a referring custnum in the URL as follows: <code>http://public.web.server/path/signup.cgi?ref=1542</code> <li>Enable CGI execution for files with the `.cgi' extension. (with <a href="http://www.apache.org/docs/mod/mod_mime.html#addhandler">Apache</a>) <li>Create the /usr/local/freeside directory on the external machine (owned by the freeside user). - <li>touch /usr/local/freeside/fs_signupd_socket; chown freeside /usr/local/freeside/fs_signupd_socket; chmod 600 /usr/local/freeside/fs_signupd_socket + <li>touch /usr/local/freeside/selfservice_socket; chown freeside /usr/local/freeside/selfservice_socket; chmod 600 /usr/local/freeside/selfservice_socket <li>Use <a href="http://www.apache.org/docs/suexec.html">suEXEC</a> or <a href="http://www.perl.com/CPAN-local/doc/manual/html/pod/perlsec.html#Security_Bugs">setuid</a> (see <a href="install.html">install.html</a> for details) to run signup.cgi, selfservice.cgi, agent.cgi and passwd.cgi as the freeside user. <li>Append the identity.pub from the freeside user on your freeside machine to the authorized_keys file of the newly created freeside user on the external machine(s). <li>Run an instance of <pre>freeside-selfservice-server <i>user</i> <i>machine</i> <i>agentnum</i> <i>refnum</i></pre> on the Freeside machine for each external machine. @@ -42,7 +49,7 @@ Then: Optional: <ul> <li>If you create a <b>/usr/local/freeside/ieak.template</b> file on the external machine, it will be sent to IE users with MIME type <i>application/x-Internet-signup</i>. This file will be processed with <a href="http://search.cpan.org/doc/MJD/Text-Template-1.23/Template.pm">Text::Template</a> with the variables listed below available. - (an example file is included as <b>fs_signup/ieak.template</b>) See the section on <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/INS.HTM">internet settings files</a> in the <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/toc.asp">IEAK documentation</a> for more information. + (an example file is included as <b>fs_selfservice/FS-SelfService/ieak.template</b>) See the section on <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/INS.HTM">internet settings files</a> in the <a href="http://www.microsoft.com/windows/ieak/techinfo/deploy/60/en/toc.asp">IEAK documentation</a> for more information. <!-- <li>If you create a <b>/usr/local/freeside/success.html</b> file on the external machine, it will be used as the success HTML page. Although template substiutions are available, a regular HTML file will work fine here, unlike signup.html. An example file is included as <b>fs_signup/FS-SignupClient/cgi/success.html</b>--> <li>Variable substitutions available in <b>ieak.template</b> and <b>success.html</b>: <ul> diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 2a60ca44f..76c49330c 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -2,7 +2,7 @@ this is incomplete install DBD::Pg 1.32 (or, if you're using a Perl version before 5.6, you could try installing DBD::Pg 1.22 with <a href="http://420.am/~ivan/DBD-Pg-1.22-fixvercmp.patch">this patch</a> and commenting out the "use DBD::Pg 1.32" at the top of DBIx/DBSchema/DBD/Pg.pm) -install DBIx::DBSchema 0.23 +install DBIx::DBSchema 0.24 install Net::SSH 0.08 - If using Apache::ASP, add PerlSetVar RequestBinaryRead Off and PerlSetVar IncludesDir /your/freeside/document/root/ to your Apache configuration and make sure you are using Apache::ASP minimum version 2.55. - In httpd.conf, change <Files ~ \.cgi> to <Files ~ (\.cgi|\.html)> @@ -291,6 +291,8 @@ ALTER TABLE part_pkg ADD promo_code varchar(80) NULL; ALTER TABLE h_part_pkg ADD promo_code varchar(80) NULL; CREATE INDEX part_pkg2 ON part_pkg ( promo_code ); CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code ); +ALTER TABLE prepay_credit ADD agentnum integer NULL; +ALTER TABLE h_prepay_credit ADD agentnum integer NULL; On recent Pg versions: diff --git a/httemplate/edit/prepay_credit.cgi b/httemplate/edit/prepay_credit.cgi new file mode 100644 index 000000000..9cf0fc6e1 --- /dev/null +++ b/httemplate/edit/prepay_credit.cgi @@ -0,0 +1,56 @@ +<% +my $agent = ''; +my $agentnum = ''; +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $agent = qsearchs('agent', { 'agentnum' => $agentnum=$1 } ); +} + +tie my %multiplier, 'Tie::IxHash', + 1 => 'seconds', + 60 => 'minutes', + 3600 => 'hours', +; + +$cgi->param('multiplier', '60') unless $cgi->param('multiplier'); + +%> + +<%= header('Generate prepaid cards'. ($agent ? ' for '. $agent->agent : ''), + menubar( 'Main Menu' => $p, )) +%> + +<% if ( $cgi->param('error') ) { %> + <FONT SIZE="+1" COLOR="#FF0000">Error: <%= $cgi->param('error') %></FONT> +<% } %> + +<FORM ACTION="<%=popurl(1)%>process/prepay_credit.cgi" METHOD="POST" NAME="OneTrueForm" onSubmit="document.OneTrueForm.submit.disabled=true"> + +Generate +<INPUT TYPE="text" NAME="num" VALUE="<%= $cgi->param('num') || '(quantity)' %>" SIZE=10 MAXLENGTH=10 onFocus="if ( this.value == '(quantity)' ) { this.value = ''; }"> +<SELECT NAME="type"> +<% foreach (qw(alpha alphanumeric numeric)) { %> + <OPTION<%= $cgi->param('type') eq $_ ? ' SELECTED' : '' %>><%= $_ %> +<% } %> +</SELECT> + prepaid cards + +<BR>for <SELECT NAME="agentnum"><OPTION>(any agent) +<% foreach my $opt_agent ( qsearch('agent', { 'disabled' => '' } ) ) { %> + <OPTION VALUE="<%= $opt_agent->agentnum %>"<%= $opt_agent->agentnum == $agentnum ? ' SELECTED' : '' %>><%= $opt_agent->agent %> +<% } %> +</SELECT> + +<BR>Value: +$<INPUT TYPE="text" NAME="amount" SIZE=8 MAXLENGTH=7 VALUE="<%= $cgi->param('amount') %>"> +and/or +<INPUT TYPE="text" NAME="seconds" SIZE=6 MAXLENGTH=5 VALUE="<%= $cgi->param('seconds') %>"> +<SELECT NAME="multiplier"> +<% foreach my $multiplier ( keys %multiplier ) { %> + <OPTION VALUE="<%= $multiplier %>"<%= $cgi->param('multiplier') eq $multiplier ? ' SELECTED' : '' %>><%= $multiplier{$multiplier} %> +<% } %> +</SELECT> +<BR><BR> +<INPUT TYPE="submit" NAME="submit" VALUE="Generate" onSubmit="this.disabled = true"> + +</FORM></BODY></HTML> + diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi new file mode 100644 index 000000000..25ecbe079 --- /dev/null +++ b/httemplate/edit/process/prepay_credit.cgi @@ -0,0 +1,51 @@ +<% +my $hashref = {}; + +my $agent = ''; +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } ); +} + +my $error = ''; + +my $num = 0; +if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { + $num = $1; +} else { + $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); +} + +$hashref->{amount} = $cgi->param('amount'); +$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); + +$error ||= FS::prepay_credit::generate( $num, + scalar($cgi->param('type')), + $hashref + ); + +unless ( ref($error) ) { + $cgi->param('error', $error ); +%><%= + $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) +%><% } else { %> + +<%= header( "$num prepaid cards generated". + ( $agent ? ' for '.$agent->agent : '' ), + menubar( 'Main menu' => popurl(3) ) + ) +%> + +<FONT SIZE="+1"> +<% foreach my $card ( @$error ) { %> + <code><%= $card %></code> + - + <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> + <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> + <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> + <br> +<% } %> + +</FONT> + +</BODY></HTML> +<% } %> diff --git a/httemplate/edit/process/reg_code.cgi b/httemplate/edit/process/reg_code.cgi index 581ede893..4658257f3 100644 --- a/httemplate/edit/process/reg_code.cgi +++ b/httemplate/edit/process/reg_code.cgi @@ -22,11 +22,14 @@ my @pkgparts = $error ||= $agent->generate_reg_codes($num, \@pkgparts); -unless ( ref($error) ) { %><%= +unless ( ref($error) ) { + $cgi->param('error'. $error ); +%><%= $cgi->redirect(popurl(3). "edit/reg_code.cgi?". $cgi->query_string ) %><% } else { %> <%= header("$num registration codes generated for ". $agent->agent, menubar( + 'Main menu' => popurl(3), 'View all agents' => popurl(3). 'browse/agent.cgi', ) ) %> diff --git a/httemplate/index.html b/httemplate/index.html index b3b1c231a..c2676025f 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -139,26 +139,6 @@ <BR><BR><A HREF="search/report_prepaid_income.html">Prepaid Income (Unearned Revenue) Report</A> <BR><BR><A HREF="search/report_tax.html">Sales Tax Liability Report</A> <BR><BR> - <CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR> - <A NAME="admin">Administration</a> - <ul> - <LI><A HREF="browse/part_pkg.cgi">View/Edit package definitions</A> - - One or more services are grouped together into a package and - given pricing information. Customers purchase packages, not - services. -<!-- <LI><A HREF="browse/agent_type.cgi">View/Edit agent types</A> - - Agent types define groups of package definitions that you can - then assign to particular agents. - <LI><A HREF="browse/agent.cgi">View/Edit agents</A> - - Agents are resellers of your service. Agents may be limited - to a subset of your full offerings (via their type). ---> - <LI><A HREF="browse/cust_main_county.cgi">View/Edit locales and tax rates</A> - - Change tax rates, or break down a country into states, or a state - into counties and assign different tax rates to each. - <LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A> - Actions for overdue invoices - </ul> - <BR> </TD></TR> </TABLE> @@ -232,7 +212,7 @@ <BR><A HREF="misc/dump.cgi">Download database dump</A> <BR><BR><CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR> <A NAME="config" HREF="config/config-view.cgi">Configuration</a><!-- - <font size="+2" color="#ff0000">start here</font> --> - <BR><BR><A NAME="admin">Administration</a> + <BR><BR><A NAME="admin">Provisioning, services and packages</a> <ul> <LI><A HREF="browse/part_export.cgi">View/Edit exports</A> - Provisioning services to external machines, databases and APIs. @@ -242,30 +222,49 @@ - One or more services are grouped together into a package and given pricing information. Customers purchase packages, not services. + </ul> + <A NAME="admin_agent">Resellers</a> + <ul> <LI><A HREF="browse/agent_type.cgi">View/Edit agent types</A> - Agent types define groups of package definitions that you can then assign to particular agents. <LI><A HREF="browse/agent.cgi">View/Edit agents</A> - Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type). - <LI><A HREF="browse/part_referral.cgi">View/Edit advertising sources</A> - - Where a customer heard about your service. Tracked for - informational purposes. + </ul> + <A NAME="admin_billing">Billing</a> + <ul> + <LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A> + - Actions for overdue invoices + <LI><A HREF="search/prepay_credit.html">View/Edit prepaid cards</A> + - View outstanding cards, generate new cards + <LI><A HREF="browse/rate.cgi">View/Edit call rates and regions</A> + - Manage rate plans, regions and prefixes for VoIP and call billing. <LI><A HREF="browse/cust_main_county.cgi">View/Edit locales and tax rates</A> - Change tax rates, or break down a country into states, or a state into counties and assign different tax rates to each. + </ul> + <A NAME="admin_svc_acct">Dialup</a> + <ul> <LI><A HREF="browse/svc_acct_pop.cgi">View/Edit access numbers</A> - Points of Presence - <LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A> - Actions for overdue invoices - <LI><A HREF="browse/msgcat.cgi">View/Edit message catalog</A> - Change error messages and other customizable labels. - <LI><A HREF="browse/part_virtual_field.cgi">View/Edit virtual fields</A> - - Locally defined fields + </ul> + <A NAME="admin_svc_broadband">Fixed (username-less) broadband</a> + <ul> <LI><A HREF="browse/router.cgi">View/Edit routers</A> - Broadband access routers <LI><A HREF="browse/addr_block.cgi">View/Edit address blocks</A> - Manage address blocks and block assignments to broadband routers. - <LI><A HREF="browse/rate.cgi">View/Edit call rates and regions</A> - - Manage rate plans, regions and prefixes for VoIP and call billing. + </ul> + <A NAME="admin_misc">Miscellaneous</a> + <ul> + <LI><A HREF="browse/part_referral.cgi">View/Edit advertising sources</A> + - Where a customer heard about your service. Tracked for + informational purposes. + <LI><A HREF="browse/part_virtual_field.cgi">View/Edit virtual fields</A> + - Locally defined fields + <LI><A HREF="browse/msgcat.cgi">View/Edit message catalog</A> + - Change error messages and other customizable labels. </ul> <BR> </TD></TR> diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 6bd6b0363..53aa309c3 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -177,9 +177,16 @@ } else { ( my $xlsname = $opt{'name'} ) =~ s/\W//g; $opt{'name'} =~ s/s$// if $total == 1; + + my @menubar = (); + if ( $opt{'menubar'} ) { + @menubar = @{ $opt{'menubar'} }; + } else { + @menubar = ( 'Main menu' => $p ); + } %> <%= include( '/elements/header.html', $opt{'title'}, - include( '/elements/menubar.html', 'Main menu' => $p ) + include( '/elements/menubar.html', @menubar ) ) %> <% my $pager = include ( '/elements/pager.html', @@ -195,7 +202,7 @@ <TABLE> <TR> - <TD> + <TD VALIGN="bottom"> <%= $total %> total <%= $opt{'name'} %><BR> <% if ( $opt{'count_addl'} ) { %> <% my $n=0; foreach my $count ( @{$opt{'count_addl'}} ) { %> diff --git a/httemplate/search/prepay_credit.html b/httemplate/search/prepay_credit.html new file mode 100644 index 000000000..8c8f57b5a --- /dev/null +++ b/httemplate/search/prepay_credit.html @@ -0,0 +1,43 @@ +<% +my $agent = ''; +my $hashref = {}; +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $hashref->{agentnum} = $1; + $agent = qsearchs('agent', { 'agentnum' => $1 } ); +} + +my $count_query = 'SELECT COUNT(*) FROM prepay_credit'; +$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent; + +%><%= include( 'elements/search.html', + 'title' => 'Unused Prepaid Cards'. + ($agent ? ' for '. $agent->agent : ''), + 'menubar' => [ + 'Main menu' => $p, + 'Generate cards' => $p.'edit/prepay_credit.cgi', + ], + 'name' => 'prepaid cards', + 'query' => { 'table' => 'prepay_credit', + 'hashref' => $hashref, + }, + 'count_query' => $count_query, + #'redirect' => $link, + 'header' => [ '#', qw(Amount Time Agent) ], + 'fields' => [ + 'identifier', + sub { sprintf('$%.2f', shift->amount ) }, + sub { my $c = shift; $c ? duration_exact($c->seconds) : '' }, + sub { my $agent = shift->agent; + $agent ? $agent->agent : ''; + }, + ], + 'links' => [ + '', + '', + '', + sub { my $agent = shift->agent; + $agent ? [ "${p}view/agent.cgi?", 'agentnum' ] : ''; + }, + ], + ) +%> diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 0f3a98702..db01ebbcf 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -50,6 +50,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { my $target = "$payby$payinfo"; $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^CHEK$/Electronic check /; + $payby =~ s/^PREP$/Prepaid card /; $payby =~ s/^BILL$//; $payby =~ s/^(CARD|COMP)$/$1 /; my $info = $payby ? " ($payby$payinfo)" : ''; |