From 7c319f1608fd3459c992eda7743696fc745fccf1 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Jul 2003 11:09:33 +0000 Subject: - better description of payment search - some clarification of services/packages vs. service/package definitions in browse/part_{svc,pkg}.cgi - package definition report by # of active customer packages (with links to customer package listing) --- httemplate/browse/part_pkg.cgi | 60 +++++++++++++++++++++++++++++++++++------- httemplate/browse/part_svc.cgi | 4 +-- httemplate/index.html | 7 ++--- httemplate/search/cust_pkg.cgi | 14 +++++++++- 4 files changed, 70 insertions(+), 15 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 58422c67d..7b9436cee 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -11,15 +11,35 @@ if ( $cgi->param('showdisabled') ) { my @part_pkg = qsearch('part_pkg', \%search ); my $total = scalar(@part_pkg); +my $sortby; +my %num_active_cust_pkg; +if ( $cgi->param('active') ) { + my $active_sth = dbh->prepare( + 'SELECT COUNT(*) FROM cust_pkg WHERE pkgpart = ?'. + ' AND ( cancel IS NULL OR cancel = 0 )'. + ' AND ( susp IS NULL OR susp = 0 )' + ) or die dbh->errstr; + foreach my $part_pkg ( @part_pkg ) { + $active_sth->execute($part_pkg->pkgpart) or die $active_sth->errstr; + $num_active_cust_pkg{$part_pkg->pkgpart} = + $active_sth->fetchrow_arrayref->[0]; + } + $sortby = \*active_cust_pkg_sort; +} else { + $sortby = \*pkgpart_sort; +} + %> <%= header("Package Definition Listing",menubar( 'Main Menu' => $p )) %> -One or more services are grouped together into a package and given pricing -information. Customers purchase packages rather than purchase services -directly.

-Add a new package definition -

+<% unless ( $cgi->param('active') ) { %> + One or more service definitions are grouped together into a package + definition and given pricing information. Customers purchase packages + rather than purchase services directly.

+ Add a new package definition +

+<% } %> -<%= $total %> packages +<%= $total %> package definitions <% if ( $cgi->param('showdisabled') ) { $cgi->param('showdisabled', 0); @@ -34,6 +54,10 @@ print &table(), < Package Comment +END +print ' Customer
packages
' + if $cgi->param('active'); +print <Freq. Plan Data @@ -42,9 +66,7 @@ print &table(), < END -foreach my $part_pkg ( sort { - $a->getfield('pkgpart') <=> $b->getfield('pkgpart') -} @part_pkg ) { +foreach my $part_pkg ( sort $sortby @part_pkg ) { my($hashref)=$part_pkg->hashref; my(@pkg_svc)=grep $_->getfield('quantity'), qsearch('pkg_svc',{'pkgpart'=> $hashref->{pkgpart} }); @@ -73,6 +95,16 @@ END print <$hashref->{pkg} $hashref->{comment} +END + if ( $cgi->param('active') ) { + print " "; + print ''. + $num_active_cust_pkg{$hashref->{'pkgpart'}}. + qq! active!; + # suspended/cancelled + print ''; + } + print <$hashref->{freq} $hashref->{plan} $plandata @@ -99,4 +131,14 @@ print < END + + +sub pkgpart_sort { + $a->pkgpart <=> $b->pkgpart; +} + +sub active_cust_pkg_sort { + $num_active_cust_pkg{$b->pkgpart} <=> $num_active_cust_pkg{$a->pkgpart}; +} + %> diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index ee7a2622a..7c83924a2 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -23,7 +23,7 @@ function part_export_areyousure(href) { } - Services are items you offer to your customers.

+ Service definitions are the templates for items you offer to your customers.

Add a new service definition<% if ( @part_svc ) { %> or  - -Field #<%=$routerfieldpart or "(NEW)"%>

- -<%=ntable("#cccccc",2)%> - - Name - - - - Length - - - - check_block - - - - list_source - - -
- -
- -

-If you don't understand what check_block and -list_source mean, LEAVE THEM BLANK. We mean it. - - - - diff --git a/httemplate/edit/part_sb_field.cgi b/httemplate/edit/part_sb_field.cgi deleted file mode 100644 index 9e0cc9e4f..000000000 --- a/httemplate/edit/part_sb_field.cgi +++ /dev/null @@ -1,79 +0,0 @@ - -<% -my ($sbfieldpart, $part_sb_field); - -if ( $cgi->param('error') ) { - $part_sb_field = new FS::part_sb_field ( { - map { $_, scalar($cgi->param($_)) } fields('part_sb_field')}); - $sbfieldpart = $part_sb_field->sbfieldpart; -} else { - my($query) = $cgi->keywords; - if ( $query =~ /^(\d+)$/ ) { #editing - $sbfieldpart=$1; - $part_sb_field=qsearchs('part_sb_field', - {'sbfieldpart' => $sbfieldpart}) - or die "Unknown sbfieldpart!"; - - } else { #adding - $part_sb_field = new FS::part_sb_field({}); - } -} -my $action = $part_sb_field->sbfieldpart ? 'Edit' : 'Add'; - -my $p1 = popurl(1); -print header("$action svc_broadband Extended Field Definition", ''); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); -%> -
- - - - -Field #<%=$sbfieldpart or "(NEW)"%>

- -<%=ntable("#cccccc",2)%> - - Name - - - - Length - - - - Service - - - check_block - - - - list_source - - -
- -
- -

-If you don't understand what check_block and -list_source mean, LEAVE THEM BLANK. We mean it. - - - - -- cgit v1.2.1 From 58d44fbe5eb9ab32e6d87063a4a3b22ddba9a828 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 5 Aug 2003 00:20:51 +0000 Subject: Virtual field merge --- httemplate/browse/part_svc.cgi | 10 ++-- httemplate/browse/part_virtual_field.cgi | 39 +++++++++++++ httemplate/browse/router.cgi | 25 +++++---- httemplate/docs/upgrade10.html | 54 +++++++----------- httemplate/edit/part_svc.cgi | 72 +++++++++++++++++------- httemplate/edit/part_virtual_field.cgi | 92 +++++++++++++++++++++++++++++++ httemplate/edit/process/router.cgi | 41 ++------------ httemplate/edit/process/svc_broadband.cgi | 36 +----------- httemplate/edit/router.cgi | 42 ++++---------- httemplate/edit/svc_acct.cgi | 12 +++- httemplate/edit/svc_broadband.cgi | 34 +++--------- httemplate/edit/svc_www.cgi | 12 +++- httemplate/index.html | 8 +-- httemplate/view/svc_acct.cgi | 18 +++++- httemplate/view/svc_broadband.cgi | 24 ++------ httemplate/view/svc_forward.cgi | 9 ++- httemplate/view/svc_www.cgi | 11 +++- 17 files changed, 303 insertions(+), 236 deletions(-) create mode 100644 httemplate/browse/part_virtual_field.cgi create mode 100644 httemplate/edit/part_virtual_field.cgi (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 7c83924a2..3fece2925 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -53,12 +53,13 @@ function part_export_areyousure(href) { <% foreach my $part_svc ( @part_svc ) { my $hashref = $part_svc->hashref; my $svcdb = $hashref->{svcdb}; - my @dfields = fields($svcdb); + my $svc_x = "FS::$svcdb"->new( { svcpart => $part_svc->svcpart } ); + my @dfields = $svc_x->fields; push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge my @fields = - grep { $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } - @dfields; - + grep { $svc_x->pvf($_) + or $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } + @dfields ; my $rowspan = scalar(@fields) || 1; my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}"; %> @@ -96,6 +97,7 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export <% if ( $flag eq "D" ) { print "Default"; } elsif ( $flag eq "F" ) { print "Fixed"; } + elsif ( not $flag ) { } else { print "(Unknown!)"; } %> <%= $part_svc->part_svc_column($field)->columnvalue%> diff --git a/httemplate/browse/part_virtual_field.cgi b/httemplate/browse/part_virtual_field.cgi new file mode 100644 index 000000000..9bb5c1373 --- /dev/null +++ b/httemplate/browse/part_virtual_field.cgi @@ -0,0 +1,39 @@ +<%= header('Virtual field definitions', menubar('Main Menu' => $p)) %> +<% + +my %pvfs; +my $block; +my $p2 = popurl(2); +my $dbtable; + +foreach (qsearch('part_virtual_field', {})) { + push @{ $pvfs{$_->dbtable} }, $_; +} +%> + +<% if ($cgi->param('error')) { %> + Error: <%=$cgi->param('error')%> +

+<% } %> + +Add a new field

+ +<% foreach $dbtable (sort { $a cmp $b } keys (%pvfs)) { %> +

<%=$dbtable%>

+ +<%=table()%> +Field nameDescription +<% foreach $pvf (sort {$a->name cmp $b->name} @{ $pvfs{$dbtable} }) { %> + + + + + <%=$pvf->name%> + <%=$pvf->label%> + +<% } %> + +<% } %> + + + diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 8864936d9..a9ec6fd61 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -14,21 +14,22 @@ my $p2 = popurl(2); Add a new router

<%=table()%> - -<% foreach $router (sort {$a->routernum <=> $b->routernum} @router) { %> - - + Router name + Address block(s) + +<% foreach $router (sort {$a->routernum <=> $b->routernum} @router) { + my @addr_block = $router->addr_block; +%> + + <%=$router->routername%> - + + <% foreach my $block ( @addr_block ) { %> + <%=$block->NetAddr%>
+ <% } %> + <% } %> diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 1035510db..4c2c17b85 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -14,6 +14,24 @@ CREATE TABLE cust_bill_pkg_detail ( ); CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum ); +CREATE TABLE part_virtual_field ( + vfieldpart int NOT NULL, + dbtable varchar(32) NOT NULL, + name varchar(32) NOT NULL, + check_block text, + list_source text, + length integer, + label varchar(80), + PRIMARY KEY (vfieldpart) +); + +CREATE TABLE virtual_field ( + recnum integer NOT NULL, + vfieldpart integer NOT NULL, + value varchar(128) NOT NULL, + PRIMARY KEY (vfieldpart, recnum) +); + CREATE TABLE router ( routernum serial, routername varchar(80), @@ -26,22 +44,6 @@ CREATE TABLE part_svc_router ( routernum int NOT NULL ); -CREATE TABLE part_router_field ( - routerfieldpart serial, - name varchar(80), - length int NOT NULL, - check_block text, - list_source text, - PRIMARY KEY (routerfieldpart) -); - -CREATE TABLE router_field ( - routerfieldpart int NOT NULL, - routernum int NOT NULL, - value varchar(128) -); -CREATE UNIQUE INDEX router_field1 ON router_field ( routerfieldpart, routernum ); - CREATE TABLE addr_block ( blocknum serial, routernum int NOT NULL, @@ -51,24 +53,6 @@ CREATE TABLE addr_block ( ); CREATE UNIQUE INDEX addr_block1 ON addr_block ( blocknum, routernum ); -CREATE TABLE part_sb_field ( - sbfieldpart serial, - svcpart int NOT NULL, - name varchar(80) NOT NULL, - length int NOT NULL, - check_block text NULL, - list_source text NULL, - PRIMARY key (sbfieldpart) -); -CREATE UNIQUE INDEX part_sb_field1 ON part_sb_field ( sbfieldpart, svcpart ); - -CREATE TABLE sb_field ( - sbfieldpart int NOT NULL, - svcnum int NOT NULL, - value varchar(128) -); -CREATE UNIQUE INDEX sb_field1 ON sb_field ( sbfieldpart, svcnum ); - CREATE TABLE svc_broadband ( svcnum int NOT NULL, blocknum int NOT NULL, @@ -112,7 +96,7 @@ optionally: mandatory again: dbdef-create username -create-history-tables username cust_bill_pkg_detail router part_svc_router part_router_field router_field addr_block part_sb_field sb_field svc_broadband +create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband dbdef-create username diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index d4bb4704c..45e0b6ffe 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -65,6 +65,9 @@ blank slipip as well as a fixed shell something like /bin/true or

<% + +my %vfields; + #these might belong somewhere else for other user interfaces #pry need to eventually create stuff that's shared amount UIs my %defs = ( @@ -109,29 +112,43 @@ my %defs = ( 'dstsvc' => 'service to which mail is to be forwarded', 'dst' => 'someone@another.domain.com to use when dstsvc is 0', }, - 'svc_charge' => { - 'amount' => 'amount', - }, - 'svc_wo' => { - 'worker' => 'Worker', - '_date' => 'Date', - }, +# 'svc_charge' => { +# 'amount' => 'amount', +# }, +# 'svc_wo' => { +# 'worker' => 'Worker', +# '_date' => 'Date', +# }, 'svc_www' => { #'recnum' => '', #'usersvc' => '', }, 'svc_broadband' => { - 'actypenum' => 'This is the actypenum that refers to the type of AC that can be provisioned for this service. This field must be set fixed.', 'speed_down' => 'Maximum download speed for this service in Kbps. 0 denotes unlimited.', 'speed_up' => 'Maximum upload speed for this service in Kbps. 0 denotes unlimited.', - 'acnum' => 'acnum of a specific AC that this service is restricted to. Not required', 'ip_addr' => 'IP address. Leave blank for automatic assignment.', - 'ip_netmask' => 'Mask length, aka. netmask bits. (Eg. 255.255.255.0 == 24)', - 'mac_addr' => 'MAC address which is used by some ACs for access control. Specified by 6 colon seperated hex octets. (Eg. 00:00:0a:bc:1a:2b)', - 'location' => 'Defines the physically location at which this service was installed. This is not necessarily the billing address', + 'blocknum' => 'Address block.', }, ); + foreach $svcdb (keys(%defs)) { + my $self = "FS::$svcdb"->new; + $vfields{$svcdb} = {}; + foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them + my $pvf = $self->pvf($field); + my @list = $pvf->list; + if (scalar @list) { + $defs{$svcdb}->{$field} = { desc => $pvf->label, + type => 'select', + select_list => \@list }; + } else { + $defs{$svcdb}->{$field} = $pvf->label; + } #endif + $vfields{$svcdb}->{$field} = $pvf; + warn "\$vfields{$svcdb}->{$field} = $pvf"; + } #next $field + } #next $svcdb + my @dbs = $hashref->{svcdb} ? ( $hashref->{svcdb} ) : qw( svc_acct svc_domain svc_forward svc_www svc_broadband ); @@ -157,7 +174,7 @@ my %defs = ( $html .= '

'. table(). table(). "Exports"; foreach my $part_export ( @part_export ) { - $html .= 'svcpart ) #null svcpart search causing error @@ -202,19 +219,27 @@ my %defs = ( qq!Default ". qq!Fixed ". - '
'; + ' CHECKED'x($flag eq 'F'). ">Fixed "; + $html .= '
'; } if ( ref($def) ) { if ( $def->{type} eq 'select' ) { $html .= qq!'; } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { $html .= FS::svc_acct::radius_usergroup_selector( @@ -229,6 +254,11 @@ my %defs = ( $html .= qq!!; } + + if($vfields{$layer}->{$field}) { + $html .= qq!
Excluded "; + } $html .= "\n"; } $part_svc->svcpart('') if $clone; #undone diff --git a/httemplate/edit/part_virtual_field.cgi b/httemplate/edit/part_virtual_field.cgi new file mode 100644 index 000000000..8bc84387f --- /dev/null +++ b/httemplate/edit/part_virtual_field.cgi @@ -0,0 +1,92 @@ + +<% +my ($vfieldpart, $part_virtual_field); + +if ( $cgi->param('error') ) { + $part_virtual_field = new FS::part_virtual_field ( { + map { $_, scalar($cgi->param($_)) } fields('part_virtual_field')}); + $vfieldpart = $part_virtual_field->vfieldpart; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $vfieldpart=$1; + $part_virtual_field=qsearchs('part_virtual_field', + {'vfieldpart' => $vfieldpart}) + or die "Unknown vfieldpart!"; + + } else { #adding + $part_virtual_field = new FS::part_virtual_field({}); + } +} +my $action = $part_virtual_field->vfieldpart ? 'Edit' : 'Add'; + +my $p1 = popurl(1); +print header("$action Virtual Field Definition", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); +%> +
+ + + + +Field #<%=$vfieldpart or "(NEW)"%>

+ +<%=ntable("#cccccc",2)%> + + Name + + + + Table + <% if ($action eq 'Add') { %> + <% + } else { # Edit + %><%=$part_virtual_field->dbtable%> + + <% } %> + + + Label + + + + Length + + + + Check + + + + List source + + +
+ +
+ +

+If you don't understand what check_block and +list_source mean, LEAVE THEM BLANK. We mean it. + + + + diff --git a/httemplate/edit/process/router.cgi b/httemplate/edit/process/router.cgi index 1b7fc3805..7e40c48a7 100644 --- a/httemplate/edit/process/router.cgi +++ b/httemplate/edit/process/router.cgi @@ -19,19 +19,16 @@ my $error = ''; my $routernum = $cgi->param('routernum'); my $routername = $cgi->param('routername'); my $old = qsearchs('router', { routernum => $routernum }); -my @old_rf; my @old_psr; my $new = new FS::router { - routernum => $routernum, - routername => $routername, - svcnum => 0 - }; + map { + ($_, scalar($cgi->param($_))); + } fields('router') +}; if($old) { - if($old->routername ne $new->routername) { - $error = $new->replace($old); - } #else do nothing + $error = $new->replace($old); } else { $error = $new->insert; $routernum = $new->routernum; @@ -49,21 +46,6 @@ if ($old) { } } check($error); - @old_rf = $old->router_field; - foreach $rf (@old_rf) { - if(my $new_val = $cgi->param('rf_'.$rf->routerfieldpart)) { - if($new_val ne $rf->value) { - my $new_rf = new FS::router_field - { routernum => $routernum, - value => $new_val, - routerfieldpart => $rf->routerfieldpart }; - $error = $new_rf->replace($rf); - } #else do nothing - } else { - $error = $rf->delete; - } - check($error); - } } foreach($cgi->param) { @@ -77,23 +59,10 @@ foreach($cgi->param) { $error = $new_psr->insert; } check($error); - } elsif($cgi->param($_) ne '' and /^rf_(\d+)$/) { - my $part = $1; - if(my @x = grep {$_->routerfieldpart == $part} @old_rf) { - # already handled all of these - } else { - my $new_rf = new FS::router_field - { routernum => $routernum, - value => $cgi->param('rf_'.$part), - routerfieldpart => $part }; - $error = $new_rf->insert; - check($error); - } } } - # Yay, everything worked! $dbh->commit or die $dbh->errstr; print $cgi->redirect(popurl(3). "browse/router.cgi"); diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi index ab8b9f9d8..4912a3a9f 100644 --- a/httemplate/edit/process/svc_broadband.cgi +++ b/httemplate/edit/process/svc_broadband.cgi @@ -9,11 +9,10 @@ my $dbh = FS::UID::dbh; $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; my $svcnum = $1; -my $old; my @old_sbf; +my $old; if ( $svcnum ) { $old = qsearchs('svc_broadband', { 'svcnum' => $svcnum } ) or die "fatal: can't find broadband service (svcnum $svcnum)!"; - @old_sbf = $old->sb_field; } else { $old = ''; } @@ -32,39 +31,6 @@ if ( $svcnum ) { $svcnum = $new->svcnum; } -unless ($error) { - my $sb_field; - - foreach ($cgi->param) { - #warn "\$cgi->param $_: " . $cgi->param($_); - if(/^sbf_(\d+)/) { - my $part = $1; - #warn "\$part $part"; - $sb_field = new FS::sb_field - { svcnum => $svcnum, - value => $cgi->param($_), - sbfieldpart => $part }; - if (my @x = grep { $_->sbfieldpart eq $part } @old_sbf) { - #if (my $old_sb_field = (grep { $_->sbfieldpart eq $part} @old_Sbf)[0]) { - #warn "array: " . scalar(@x); - if (length($sb_field->value) && ($sb_field->value ne $x[0]->value)) { - #warn "replacing " . $x[0]->value . " with " . $sb_field->value; - $error = $sb_field->replace($x[0]); - #$error = $sb_field->replace($old_sb_field); - } elsif (length($sb_field->value) == 0) { - #warn "delete"; - $error = $x[0]->delete; - } - } else { - if (length($sb_field->value) > 0) { - #warn "insert"; - $error = $sb_field->insert; - } - # else do nothing - } - } - } -} if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/edit/router.cgi b/httemplate/edit/router.cgi index b524c6494..5c365a21e 100755 --- a/httemplate/edit/router.cgi +++ b/httemplate/edit/router.cgi @@ -16,7 +16,6 @@ if ( $cgi->keywords ) { my $routernum = $router->routernum; my $action = $routernum ? 'Edit' : 'Add'; -my $hashref = $router->hashref; print header("$action Router", menubar( 'Main Menu' => "$p", @@ -28,10 +27,13 @@ if($cgi->param('error')) { <% } %>
+ + + Router #<%=$routernum or "(NEW)"%> -

Name +

Name

Custom fields: @@ -39,35 +41,11 @@ Custom fields: <%=table() %> <% -# I know, I know. Massive false laziness with edit/svc_broadband.cgi. But -# Kristian won't let me generalize the custom field mechanism to every table in -# the database, so this is what we get. -# -- MW - -my @part_router_field = qsearch('part_router_field', { }); -my %rf = map { $_->part_router_field->name, $_->value } $router->router_field; -foreach (sort { $a->name cmp $b->name } @part_router_field) { - %> - - <%=$_->name%> - <% - if(my @opts = $_->list_values) { - %> - <% } else { %> - length ? 'SIZE="'.$_->length.'"' : ''%>> - <% } %> - -<% } %> +foreach my $field ($router->virtual_fields) { + print $router->pvf($field)->widget('HTML', 'edit', + $router->getfield($field)); +} +%> @@ -81,7 +59,7 @@ foreach my $part_svc ( qsearch('part_svc', { svcdb => 'svc_broadband',
$part_svc->svcpart, - routernum => $routernum } ) ? 'CHECKED' : ''%> VALUE="ON"> + routernum => $routernum } ) ? ' CHECKED' : ''%> VALUE="ON"> <%=$part_svc->svcpart%>: <%=$part_svc->svc%> <% } %> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 4420bb609..44606d9a0 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -35,8 +35,6 @@ if ( $cgi->param('error') ) { } else { #adding - $svc_acct = new FS::svc_acct({}); - foreach $_ (split(/-/,$query)) { $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; @@ -44,6 +42,8 @@ if ( $cgi->param('error') ) { $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); die "No part_svc entry for svcpart $svcpart!" unless $part_svc; + $svc_acct = new FS::svc_acct({svcpart => $svcpart}); + $svcnum=''; #set gecos @@ -281,6 +281,14 @@ if ( $part_svc->part_svc_column('usergroup')->columnflag eq "F" ) { } print ''; +foreach $field ($svc_acct->virtual_fields) { + if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { + # If the flag is X, it won't even show up in $svc_acct->virtual_fields. + print $svc_acct->pvf($field)->widget('HTML', 'edit', + $svc_acct->getfield($field)); + } +} + #submit print qq!
!; diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index ee7f8becf..6828791c0 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -36,8 +36,6 @@ if ( $cgi->param('error') ) { } else { #adding - $svc_broadband = new FS::svc_broadband({}); - foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; @@ -45,7 +43,7 @@ if ( $cgi->param('error') ) { $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; - $svc_broadband->setfield('svcpart', $svcpart); + $svc_broadband = new FS::svc_broadband({ svcpart => $svcpart }); $svcnum=''; @@ -159,30 +157,12 @@ Service #<%=$svcnum ? $svcnum : "(NEW)"%>

<% } %> <% - - my @part_sb_field = qsearch('part_sb_field', { svcpart => $svcpart }); - my $sbf_hashref = $svc_broadband->sb_field_hashref($svcpart); - foreach (sort { $a->name cmp $b->name } @part_sb_field) { - %> - - <%=$_->name%> - <% - if(my @opts = $_->list_values) { - %> - - <% } else { %> - length ? 'SIZE="'.$_->length.'"' : ''%>> - <% } %> - - -<% } %> +foreach $field ($svc_broadband->virtual_fields) { + if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { + print $svc_broadband->pvf($field)->widget('HTML', 'edit', + $svc_broadband->getfield($field)); + } +} %>
diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi index d2c9ade5c..043af610b 100644 --- a/httemplate/edit/svc_www.cgi +++ b/httemplate/edit/svc_www.cgi @@ -29,12 +29,12 @@ if ( $cgi->param('error') ) { } else { #adding - $svc_www = new FS::svc_www({}); - foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; } + $svc_www = new FS::svc_www { svcpart => $svcpart }; + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; @@ -167,6 +167,14 @@ foreach $_ (keys %username) { } print ""; +foreach $field ($svc_www->virtual_fields) { + if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { + # If the flag is X, it won't even show up in $svc_acct->virtual_fields. + print $svc_www->pvf($field)->widget('HTML', 'edit', + $svc_www->getfield($field)); + } +} + print '
'; print < freeside main menu - version %%%VERSION%%% + version 1.5.0pre2
Freeside home page
Documentation @@ -199,10 +199,8 @@ - Points of Presence
  • View/Edit invoice events - Actions for overdue invoices
  • View/Edit message catalog - Change error messages and other customizable labels. -
  • View/Edit custom svc_broadband fields - - Custom broadband service fields for site-specific export/informational data. -
  • View/Edit custom router fields - - Custom router fields for site-specific export data. +
  • View/Edit virtual fields + - Locally defined fields
  • View/Edit routers - Broadband access routers
  • View/Edit address blocks diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 599c1d8b9..4e01db341 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -172,7 +172,7 @@ if ($svc_acct->slipip) { : $svc_acct->slipip ). ""; my($attribute); - foreach $attribute ( grep /^radius_/, fields('svc_acct') ) { + foreach $attribute ( grep /^radius_/, $svc_acct->fields ) { #warn $attribute; $attribute =~ /^radius_(.*)$/; my $pattribute = $FS::raddb::attrib{$1}; @@ -180,7 +180,7 @@ if ($svc_acct->slipip) { "". $svc_acct->getfield($attribute). ""; } - foreach $attribute ( grep /^rc_/, fields('svc_acct') ) { + foreach $attribute ( grep /^rc_/, $svc_acct->fields ) { #warn $attribute; $attribute =~ /^rc_(.*)$/; my $pattribute = $FS::raddb::attrib{$1}; @@ -195,7 +195,19 @@ if ($svc_acct->slipip) { print 'RADIUS groups'. join('
    ', $svc_acct->radius_groups). ''; -print '

    '; +# Can this be abstracted further? Maybe a library function like +# widget('HTML', 'view', $svc_acct) ? It would definitely make UI +# style management easier. + +foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { + print $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)), + "\n"; +} +%> + +<% + +print '

    '; print join("\n", $conf->config('svc_acct-notes') ). '

    '. joblisting({'svcnum'=>$svcnum}, 1). ''; diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 164b5b22c..677a4b058 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -64,26 +64,12 @@ print header('Broadband Service View', menubar( qq!$ip_addr!. ''; +foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) { + print $svc_broadband->pvf($_)->widget('HTML', 'view', + $svc_broadband->getfield($_)), "\n"; +} -# foreach my $sb_field -# ( qsearch('sb_field', { svcnum => $svcnum }) ) { -# my $part_sb_field = qsearchs('part_sb_field', -# { sbfieldpart => $sb_field->sbfieldpart }); -# print q!! . $part_sb_field->name . -# q!! . $sb_field->value . -# q!!; -# } -# print ''; - - - my $sb_field = $svc_broadband->sb_field_hashref; - foreach (sort { $a cmp $b } keys(%{$sb_field})) { - print q!! . $_ . - q!! . $sb_field->{$_} . - q!!; - } - print ''; - +print ''; print '
    '. joblisting({'svcnum'=>$svcnum}, 1). '' diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index c8d1d6213..5d619de54 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -61,7 +61,14 @@ print qq!Edit this information!. qq!Email to!. qq!$source!. qq!Forwards to !. - qq!$destination!. + qq!$destination!; + +foreach (sort { $a cmp $b } $svc_forward->virtual_fields) { + print $svc_forward->pvf($_)->widget('HTML', 'view', $svc_forward->getfield($_)), + "\n"; +} + +print qq! !. '
    '. joblisting({'svcnum'=>$svcnum}, 1). '' ; diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index 442614491..7a716b4b8 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -47,8 +47,15 @@ print header('Website View', menubar( qq!Website name!. qq!$www!. qq!Account!. - qq!$email!. - ''. + qq!$email!; + +foreach (sort { $a cmp $b } $svc_www->virtual_fields) { + print $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)), + "\n"; +} + + +print ''. '
    '. joblisting({'svcnum'=>$svcnum}, 1). '' ; -- cgit v1.2.1 From d38d8201fb8d7f18b199cf8805c17c0121dd1288 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 5 Aug 2003 00:32:35 +0000 Subject: Fixed %%%VERSION%%% tag --- httemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 1895f2912..3e87af716 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -11,7 +11,7 @@ freeside main menu - version 1.5.0pre2 + version %%%VERSION%%%
    Freeside home page
    Documentation -- cgit v1.2.1 From 117a674a7e37ff2f4f90fcf34710dfad288ac8a9 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Aug 2003 21:00:43 +0000 Subject: doh, revert stuff that shouldn't have been checked in --- httemplate/browse/part_pkg.cgi | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 7b9436cee..2a167e8d6 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -24,7 +24,9 @@ if ( $cgi->param('active') ) { $num_active_cust_pkg{$part_pkg->pkgpart} = $active_sth->fetchrow_arrayref->[0]; } - $sortby = \*active_cust_pkg_sort; + $sortby = sub { + $num_active_cust_pkg{$b->pkgpart} <=> $num_active_cust_pkg{$a->pkgpart}; + }; } else { $sortby = \*pkgpart_sort; } @@ -132,13 +134,8 @@ print < END - sub pkgpart_sort { $a->pkgpart <=> $b->pkgpart; } -sub active_cust_pkg_sort { - $num_active_cust_pkg{$b->pkgpart} <=> $num_active_cust_pkg{$a->pkgpart}; -} - %> -- cgit v1.2.1 From abf5c5442afce5198f6289840791c96f58254e85 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 7 Aug 2003 12:47:27 +0000 Subject: - switch to mason by default - minimum mason version 1.1 (and doc) - evaluate .html files with mason/asp - turn on profiling with mason like with Apache::ASP (redirects not working) - (start of) includes --- httemplate/autohandler | 23 +++++++++++++++++++++++ httemplate/docs/install.html | 10 +++++----- httemplate/docs/upgrade10.html | 2 +- httemplate/index.html | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 httemplate/autohandler (limited to 'httemplate') diff --git a/httemplate/autohandler b/httemplate/autohandler new file mode 100644 index 000000000..e6e50d5bd --- /dev/null +++ b/httemplate/autohandler @@ -0,0 +1,23 @@ +% $m->call_next; + +<%init> + dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); + + +<%filter> + +my $profile = ''; +if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { + + #if contenttype is text/html!! **FIXME** + + $profile = '
    '. ("\n"x4096). encode_entities(dbh->sprintProfile()).
    +               #"\n\n". &sprintAutoProfile(). '
    '; + "\n\n". ''; + #endif + + dbh->{'private_profile'} = {}; +} + +s/(<\/BODY>[\s\n]*<\/HTML>[\s\n]*)$/$profile$1/i; + diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 54614ccb3..463575c53 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -130,8 +130,8 @@ cp htetc/global.asa /usr/local/etc/freeside/asp-global/global.asa
     PerlModule Apache::ASP
     <Directory /usr/local/apache/htdocs/freeside-asp>
    -<Files ~ (\.cgi)>
    -AddHandler perl-script .cgi
    +<Files ~ (\.cgi|\.html)>
    +SetHandler perl-script
     PerlHandler Apache::ASP
     </Files>
     <Perl>
    @@ -145,7 +145,7 @@ PerlSetVar Debug 2
         
    • Run make masondocs
    • Copy masondocs/ to your web server's document space. (For example: /usr/local/apache/htdocs/freeside-mason) -
    • Copy htetc/handler.pl to /usr/local/etc/freeside (use htetc/handler.pl-1.0x for Mason versions before 1.10). +
    • Copy htetc/handler.pl to /usr/local/etc/freeside
    • Edit handler.pl and:
      • set an appropriate comp_root, such as /usr/local/apache/htdocs/freeside-mason @@ -156,8 +156,8 @@ PerlSetVar Debug 2
         PerlModule HTML::Mason
         <Directory /usr/local/apache/htdocs/freeside-mason>
        -<Files ~ (\.cgi)>
        -AddHandler perl-script .cgi
        +<Files ~ (\.cgi|.html)>
        +SetHandler perl-script
         PerlHandler HTML::Mason
         </Files>
         <Perl>
        diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html
        index 4c2c17b85..d7a8c7468 100644
        --- a/httemplate/docs/upgrade10.html
        +++ b/httemplate/docs/upgrade10.html
        @@ -99,6 +99,6 @@ dbdef-create username
         create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband
         dbdef-create username
         
        -
        +apache - fix  sections to include .html also
         
         
        diff --git a/httemplate/index.html b/httemplate/index.html index 3e87af716..99b321f30 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -12,7 +12,7 @@ freeside main menu version %%%VERSION%%% -
        Freeside home page +
        Freeside home page
        Documentation -- cgit v1.2.1 From 69ecd0e15d3de36b56ad133d5ae57dcddc53c63e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 7 Aug 2003 13:08:00 +0000 Subject: - turn on profiling with mason like with Apache::ASP (redirects now working) - fix mason error with new view/cust_main.cgi UI --- httemplate/view/cust_main.cgi | 195 ++++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 92 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index c36c9e265..f1afdb570 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -370,7 +370,7 @@ print qq!
        Packages !, #get package info -my $packages = get_packages($cust_main); +my $packages = get_packages($cust_main, $conf); if ( @$packages ) { %> @@ -401,27 +401,27 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <%=$pkg->{pkg}%> - <%=$pkg->{comment}%> ( <%=pkg_details_link($pkg)%> )
        <% unless ($pkg->{cancel}) { %> ( <%=pkg_change_link($pkg)%> ) - ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg)%> ) + ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$custnum)%> ) <% } %> <% #foreach (qw(setup last_bill next_bill susp expire cancel)) { - # print qq! ! . pkg_datestr($pkg,$_) . qq!\n!; + # print qq! ! . pkg_datestr($pkg,$_,$conf) . qq!\n!; #} print "". &itable(''); - #move - my %freq = ( - 1 => 'monthly', - 2 => 'bi-monthly', - 3 => 'quarterly', - 6 => 'semi-annually', - 12 => 'annually', - 24 => 'bi-annually', - 36 => 'tri-annually', - ); - sub freq { + + my %freq = ( #move this + 1 => 'monthly', + 2 => 'bi-monthly', + 3 => 'quarterly', + 6 => 'semi-annually', + 12 => 'annually', + 24 => 'bi-annually', + 36 => 'tri-annually', + ); + my $freq = shift; exists $freq{$freq} ? $freq{$freq} : "every $freq months"; } @@ -431,17 +431,17 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { if ( $pkg->{cancel} ) { #status: cancelled print 'Cancelled '. - ''. pkg_datestr($pkg,'cancel'). ''; + ''. pkg_datestr($pkg,'cancel',$conf). ''; unless ( $pkg->{setup} ) { print 'Never billed'; } else { print "Setup ". - pkg_datestr($pkg, 'setup'). ''; + pkg_datestr($pkg, 'setup',$conf). ''; print "Last bill ". - pkg_datestr($pkg, 'last_bill'). '' + pkg_datestr($pkg, 'last_bill',$conf). '' if $pkg->{'last_bill'}; print "Suspended ". - pkg_datestr($pkg, 'susp'). '' + pkg_datestr($pkg, 'susp',$conf). '' if $pkg->{'susp'}; } @@ -449,19 +449,19 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { if ( $pkg->{susp} ) { #status: suspended print 'Suspended '. - ''. pkg_datestr($pkg,'susp'). ''; + ''. pkg_datestr($pkg,'susp',$conf). ''; unless ( $pkg->{setup} ) { print 'Never billed'; } else { print "Setup ". - pkg_datestr($pkg, 'setup'). ''; + pkg_datestr($pkg, 'setup',$conf). ''; } print "Last bill ". - pkg_datestr($pkg, 'last_bill'). '' + pkg_datestr($pkg, 'last_bill',$conf). '' if $pkg->{'last_bill'}; # next bill ?? print "Expires ". - pkg_datestr($pkg, 'expire'). '' + pkg_datestr($pkg, 'expire',$conf). '' if $pkg->{'expire'}; print '( '. pkg_unsuspend_link($pkg). ' | '. pkg_cancel_link($pkg). ' )'; @@ -484,24 +484,24 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { unless ( $pkg->{freq} ) { print "One-time charge". 'Billed '. - pkg_datestr($pkg,'setup'). ''; + pkg_datestr($pkg,'setup',$conf). ''; } else { print 'Active'. ', billed '. freq($pkg->{freq}). ''. 'Setup '. - pkg_datestr($pkg, 'setup'). ''; + pkg_datestr($pkg, 'setup',$conf). ''; } } print "Last bill ". - pkg_datestr($pkg, 'last_bill'). '' + pkg_datestr($pkg, 'last_bill',$conf). '' if $pkg->{'last_bill'}; print "Next bill ". - pkg_datestr($pkg, 'next_bill'). '' + pkg_datestr($pkg, 'next_bill',$conf). '' if $pkg->{'next_bill'}; print "Expires ". - pkg_datestr($pkg, 'expire'). '' + pkg_datestr($pkg, 'expire',$conf). '' if $pkg->{'expire'}; if ( $pkg->{freq} ) { print '( '. pkg_suspend_link($pkg). @@ -767,82 +767,92 @@ sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0]; } sub get_packages { - -my $cust_main = shift or return undef; - -my @packages = (); - -foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->ncancelled_pkgs) - : ($cust_main->all_pkgs))) { - - my $part_pkg = $cust_pkg->part_pkg; - - my %pkg = (); - $pkg{pkgnum} = $cust_pkg->pkgnum; - $pkg{pkg} = $part_pkg->pkg; - $pkg{pkgpart} = $part_pkg->pkgpart; - $pkg{comment} = $part_pkg->getfield('comment'); - $pkg{freq} = $part_pkg->freq; - $pkg{setup} = $cust_pkg->getfield('setup'); - $pkg{last_bill} = $cust_pkg->getfield('last_bill'); - $pkg{next_bill} = $cust_pkg->getfield('bill'); - $pkg{susp} = $cust_pkg->getfield('susp'); - $pkg{expire} = $cust_pkg->getfield('expire'); - $pkg{cancel} = $cust_pkg->getfield('cancel'); - - $pkg{svcparts} = []; - - foreach my $pkg_svc (qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart })) { - - next if ($pkg_svc->quantity == 0); - - my $part_svc = qsearchs('part_svc', { 'svcpart' => $pkg_svc->svcpart }); - - my $svcpart = {}; - $svcpart->{svcpart} = $part_svc->svcpart; - $svcpart->{svc} = $part_svc->svc; - $svcpart->{svcdb} = $part_svc->svcdb; - $svcpart->{quantity} = $pkg_svc->quantity; - $svcpart->{count} = 0; - - $svcpart->{services} = []; - - foreach my $cust_svc (qsearch('cust_svc', { 'pkgnum' => $cust_pkg->pkgnum, - 'svcpart' => $part_svc->svcpart } )) { - - my $svc = {}; - $svc->{svcnum} = $cust_svc->svcnum; - $svc->{label} = ($cust_svc->label)[1]; - - push @{$svcpart->{services}}, $svc; - - $svcpart->{count}++; - + my $cust_main = shift or return undef; + my $conf = shift; + + my @packages = (); + + foreach my $cust_pkg ( + $conf->exists('hidecancelledpackages') + ? $cust_main->ncancelled_pkgs + : $cust_main->all_pkgs + ) { + + my $part_pkg = $cust_pkg->part_pkg; + + my %pkg = (); + $pkg{pkgnum} = $cust_pkg->pkgnum; + $pkg{pkg} = $part_pkg->pkg; + $pkg{pkgpart} = $part_pkg->pkgpart; + $pkg{comment} = $part_pkg->getfield('comment'); + $pkg{freq} = $part_pkg->freq; + $pkg{setup} = $cust_pkg->getfield('setup'); + $pkg{last_bill} = $cust_pkg->getfield('last_bill'); + $pkg{next_bill} = $cust_pkg->getfield('bill'); + $pkg{susp} = $cust_pkg->getfield('susp'); + $pkg{expire} = $cust_pkg->getfield('expire'); + $pkg{cancel} = $cust_pkg->getfield('cancel'); + + $pkg{svcparts} = []; + + foreach my $pkg_svc ( + qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart }) + ) { + + next if ($pkg_svc->quantity == 0); + + my $part_svc = qsearchs('part_svc', { 'svcpart' => $pkg_svc->svcpart }); + + my $svcpart = {}; + $svcpart->{svcpart} = $part_svc->svcpart; + $svcpart->{svc} = $part_svc->svc; + $svcpart->{svcdb} = $part_svc->svcdb; + $svcpart->{quantity} = $pkg_svc->quantity; + $svcpart->{count} = 0; + + $svcpart->{services} = []; + + foreach my $cust_svc ( + qsearch( 'cust_svc', { + 'pkgnum' => $cust_pkg->pkgnum, + 'svcpart' => $part_svc->svcpart, + } + ) + ) { + + my $svc = {}; + $svc->{svcnum} = $cust_svc->svcnum; + $svc->{label} = ($cust_svc->label)[1]; + + push @{$svcpart->{services}}, $svc; + + $svcpart->{count}++; + + } + + push @{$pkg{svcparts}}, $svcpart; + } - - push @{$pkg{svcparts}}, $svcpart; - + + push @packages, \%pkg; + } - - push @packages, \%pkg; - -} - -return \@packages; + + return \@packages; } sub svc_link { - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svcpart->{svc}!; + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svcpart->{svc}!; } sub svc_label_link { - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svc->{label}!; + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svc->{label}!; } @@ -875,7 +885,7 @@ sub pkgsort_pkgnum_cancel { } sub pkg_datestr { - my($pkg, $field) = @_ or return ''; + my($pkg, $field, $conf) = @_ or return ''; return ' ' unless $pkg->{$field}; my $format = $conf->exists('pkg_showtimes') ? '%D %l:%M:%S%P %z' @@ -916,6 +926,7 @@ sub pkg_dates_link { sub pkg_customize_link { my $pkg = shift or return ''; + my $custnum = shift; return qq!Customize!; } -- cgit v1.2.1 From ef7bb336cc67f127fb1d77532ad3da1369c0ae36 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Aug 2003 02:02:41 +0000 Subject: - fix Mason profiling to pass-through images (for graph/) - fix graph/money-time.cgi use of $m interfering with Mason - fix graph/money-time-graph.cgi to set content-type in a Mason/ASP-independant fashion - (beginning of) includes! - (beginning of) moving SQL search to including generic elements/search.html - fix global.asa typo - fix masonize to not prepend an extraneous blank line (breaking graph/money-time-graph.cgi) --- httemplate/autohandler | 6 ++---- httemplate/graph/money_time-graph.cgi | 14 +++++++------- httemplate/graph/money_time.cgi | 12 ++++++------ httemplate/search/elements/search.html | 8 ++++++++ httemplate/search/sql.html | 8 ++++++++ 5 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 httemplate/search/elements/search.html create mode 100644 httemplate/search/sql.html (limited to 'httemplate') diff --git a/httemplate/autohandler b/httemplate/autohandler index e6e50d5bd..2bd3adffd 100644 --- a/httemplate/autohandler +++ b/httemplate/autohandler @@ -1,20 +1,18 @@ % $m->call_next; - <%init> dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); - <%filter> my $profile = ''; if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { - #if contenttype is text/html!! **FIXME** + if ( lc($r->content_type) eq 'text/html' ) { $profile = '
        '. ("\n"x4096). encode_entities(dbh->sprintProfile()).
                        #"\n\n". &sprintAutoProfile(). '
        '; "\n\n". '
    '; - #endif + } dbh->{'private_profile'} = {}; } diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi index 944019a7a..76f1bd7bd 100755 --- a/httemplate/graph/money_time-graph.cgi +++ b/httemplate/graph/money_time-graph.cgi @@ -62,14 +62,14 @@ while ( $syear < $eyear || ( $syear == $eyear && $smonth < $emonth ) ) { my $refunded = $refunded_sth->fetchrow_arrayref->[0] || 0; #horrible local kludge that doesn't even really work right - my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND 0 < ( select count(*) from cust_bill_pkg, cust_pkg, part_pkg WHERE cust_bill.invnum = cust_bill_pkg.invnum AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%' )"; + my $expenses_sql2 = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND 0 < ( select count(*) from cust_bill_pkg, cust_pkg, part_pkg WHERE cust_bill.invnum = cust_bill_pkg.invnum AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%' )"; -# my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill_pkg, cust_bill, cust_pkg, part_pkg WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill.invnum = cust_bill_pkg.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%'"; - my $expenses_sth = dbh->prepare($expenses_sql) or die dbh->errstr; - $expenses_sth->execute or die $expenses_sth->errstr; - my $expenses = $expenses_sth->fetchrow_arrayref->[0] || 0; +# my $expenses_sql2 = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill_pkg, cust_bill, cust_pkg, part_pkg WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill.invnum = cust_bill_pkg.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%'"; + my $expenses_sth2 = dbh->prepare($expenses_sql2) or die dbh->errstr; + $expenses_sth2->execute or die $expenses_sth2->errstr; + my $expenses2 = $expenses_sth2->fetchrow_arrayref->[0] || 0; - push @{$data{cash}}, $paid-$refunded-$expenses; + push @{$data{cash}}, $paid-$refunded-$expenses2; } @@ -101,7 +101,7 @@ my @data = ( \@labels, #$chart->cgi_png(\@data); http_header('Content-Type' => 'image/png' ); -$Response->{ContentType} = 'image/png'; +#$Response->{ContentType} = 'image/png'; $chart->_set_colors(); diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi index e24157ccb..de8f6ee0c 100644 --- a/httemplate/graph/money_time.cgi +++ b/httemplate/graph/money_time.cgi @@ -1,4 +1,4 @@ - <% #my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @@ -32,9 +32,9 @@ my $emonth = $cgi->param('emonth') || $curmon+1; Cashflow (payments - refunds)

    From <% } %> to +
    SQL query: SELECT

    diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index fba8ee815..fbedcaa26 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -1,8 +1,59 @@ <% -my $conf = new FS::Conf; -my $maxrecords = $conf->config('maxsearchrecordsperpage'); + my %opt = @_; + unless (exists($opt{'count_query'}) && length($opt{'count_query'})) { + ( $opt{'count_query'} = $opt{'query'} ) =~ + s/^\s*SELECT\s*(.*)\s+FROM\s/SELECT COUNT(*) FROM /i; + } -my $limit = $maxrecords ? "LIMIT $maxrecords" : ''; + my $conf = new FS::Conf; + my $maxrecords = $conf->config('maxsearchrecordsperpage'); + my $limit = $maxrecords ? "LIMIT $maxrecords" : ''; + + my $offset = $cgi->param('offset') || 0; + $limit .= " OFFSET $offset" if $offset; + + my $count_sth = dbh->prepare($opt{'count_query'}) + or die "Error preparing $opt{'count_query'}: ". dbh->errstr; + $count_sth->execute + or die "Error executing $opt{'count_query'}: ". $count_sth->errstr; + my $total = $count_sth->fetchrow_arrayref->[0]; + + my $sth = dbh->prepare("$opt{'query'} $limit") + or die "Error preparing $opt{'query'}: ". dbh->errstr; + $sth->execute + or die "Error executing $opt{'query'}: ". $sth->errstr; + + #can get # of rows without fetching them all? + my $rows = $sth->fetchall_arrayref; + +%> + +<% my $pager = include ( '/elements/pager.html', + 'offset' => $offset, + 'num_rows' => scalar(@$rows), + 'total' => $total, + 'maxrecords' => $maxrecords, + ); %> + +<%= $total %> total <%= $opt{'name'} %>

    <%= $pager %> +<%= include( '/elements/table.html' ) %> + + <% foreach ( @{$sth->{NAME}} ) { %> + <%= $_ %> + <% } %> + + <% foreach my $row ( @$rows ) { %> + + <% foreach ( @$row ) { %> + <%= $_ %> + <% } %> + + <% } %> + + +<%= $pager %> + + diff --git a/httemplate/search/sql.cgi b/httemplate/search/sql.cgi deleted file mode 100755 index b83ef039f..000000000 --- a/httemplate/search/sql.cgi +++ /dev/null @@ -1,76 +0,0 @@ -<% - -my $conf = new FS::Conf; -my $maxrecords = $conf->config('maxsearchrecordsperpage'); - -my $limit = ''; -$limit .= "LIMIT $maxrecords" if $maxrecords; - -my $offset = $cgi->param('offset') || 0; -$limit .= " OFFSET $offset" if $offset; - -my $total; - -my $sql = $cgi->param('sql'); -$sql =~ s/^\s*SELECT//i; - -my $count_sql = $sql; -$count_sql =~ s/^(.*)\s+FROM\s/COUNT(*) FROM /i; - -my $sth = dbh->prepare("SELECT $count_sql") - or eidiot dbh->errstr. " doing $count_sql\n"; -$sth->execute or eidiot "Error executing \"$count_sql\": ". $sth->errstr; - -$total = $sth->fetchrow_arrayref->[0]; - -my $sth = dbh->prepare("SELECT $sql $limit") - or eidiot dbh->errstr. " doing $sql\n"; -$sth->execute or eidiot "Error executing \"$sql\": ". $sth->errstr; -my $rows = $sth->fetchall_arrayref; - -%> - -<% - - #begin pager - my $pager = ''; - if ( $total != scalar(@$rows) && $maxrecords ) { - unless ( $offset == 0 ) { - $cgi->param('offset', $offset - $maxrecords); - $pager .= 'Previous '; - } - my $poff; - my $page; - for ( $poff = 0; $poff < $total; $poff += $maxrecords ) { - $page++; - if ( $offset == $poff ) { - $pager .= qq!$page !; - } else { - $cgi->param('offset', $poff); - $pager .= qq!$page !; - } - } - unless ( $offset + $maxrecords > $total ) { - $cgi->param('offset', $offset + $maxrecords); - $pager .= 'Next '; - } - } - #end pager - - print header('Query Results', menubar('Main Menu'=>$p) ). - "$total total rows

    $pager". table(). - ""; - print "$_" foreach @{$sth->{NAME}}; - print ""; - - foreach $row ( @$rows ) { - print ""; - print "$_" foreach @$row; - print ""; - } - - print "$pager"; - -%> diff --git a/httemplate/search/sql.html b/httemplate/search/sql.html index e61ce1538..7d7fc0890 100644 --- a/httemplate/search/sql.html +++ b/httemplate/search/sql.html @@ -1,8 +1,12 @@ -<%= include( '/elements/header', 'Query Results', - include( '/elements/menubar', 'Main Menu' => $p ) +<%= include( '/elements/header.html', 'Query Results', + include( '/elements/menubar.html', 'Main Menu' => $p ) + ) %> + <%= include( 'elements/search.html', - 'name' => 'rows', - + 'name' => 'rows', + 'query' => 'SELECT '. ( $cgi->param('sql') + || eidiot('Empty query') ), + ) %> -- cgit v1.2.1 From cf8b6e93f3e4e024be25e19abae9f8819fc86435 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Aug 2003 05:54:57 +0000 Subject: - fix possible glitch with Mason on account view screen --- httemplate/view/svc_acct.cgi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 4e01db341..78c3a3809 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -74,9 +74,9 @@ if ( $part_svc->part_export('sqlradius') ) { } my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); - my $h = int($seconds/3600); - my $m = int( ($seconds%3600) / 60 ); - my $s = $seconds%60; + my $hour = int($seconds/3600); + my $min = int( ($seconds%3600) / 60 ); + my $sec = $seconds%60; my $input = $svc_acct->attribute_since_sqlradacct( $last_bill, time, 'AcctInputOctets' @@ -86,7 +86,7 @@ if ( $part_svc->part_export('sqlradius') ) { ) / 1048576; if ( $seconds ) { - print "Online $hh $mm $ss"; + print "Online $hourh $minm $secs"; } else { print 'Has not logged on'; } -- cgit v1.2.1 From c0e55cc3cd861b082b1318829cdd0780fe8b934c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Sep 2003 23:06:45 +0000 Subject: list extraneous services, closes: #213 --- httemplate/view/cust_main.cgi | 63 ++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index f1afdb570..fb3f0f111 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -793,8 +793,8 @@ sub get_packages { $pkg{expire} = $cust_pkg->getfield('expire'); $pkg{cancel} = $cust_pkg->getfield('cancel'); - $pkg{svcparts} = []; - + my %svcparts = (); + foreach my $pkg_svc ( qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart }) ) { @@ -811,29 +811,44 @@ sub get_packages { $svcpart->{count} = 0; $svcpart->{services} = []; - - foreach my $cust_svc ( - qsearch( 'cust_svc', { - 'pkgnum' => $cust_pkg->pkgnum, - 'svcpart' => $part_svc->svcpart, - } - ) - ) { - - my $svc = {}; - $svc->{svcnum} = $cust_svc->svcnum; - $svc->{label} = ($cust_svc->label)[1]; - - push @{$svcpart->{services}}, $svc; - - $svcpart->{count}++; - - } - - push @{$pkg{svcparts}}, $svcpart; - + + $svcparts{$svcpart->{svcpart}} = $svcpart; + } - + + foreach my $cust_svc ( + qsearch( 'cust_svc', { + 'pkgnum' => $cust_pkg->pkgnum, + #'svcpart' => $part_svc->svcpart, + } + ) + ) { + + warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; + my $svc = { + 'svcnum' => $cust_svc->svcnum, + 'label' => ($cust_svc->label)[1], + }; + + #false laziness with above, to catch extraneous services. whole + #damn thing should be OO... + my $svcpart = ( $svcparts{$cust_svc->svcpart} ||= { + 'svcpart' => $cust_svc->svcpart, + 'svc' => $cust_svc->part_svc->svc, + 'svcdb' => $cust_svc->part_svc->svcdb, + 'quantity' => 0, + 'count' => 0, + 'services' => [], + } ); + + push @{$svcpart->{services}}, $svc; + + $svcpart->{count}++; + + } + + $pkg{svcparts} = [ values %svcparts ]; + push @packages, \%pkg; } -- cgit v1.2.1 From 032f01f95762edfb8dac47c95309f0f98ced223c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Sep 2003 02:31:24 +0000 Subject: -w-safe and run under a 1.4 schema too --- httemplate/edit/part_svc.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 45e0b6ffe..18319b341 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -131,7 +131,7 @@ my %defs = ( }, ); - foreach $svcdb (keys(%defs)) { + foreach my $svcdb (grep dbdef->table($_), keys %defs ) { my $self = "FS::$svcdb"->new; $vfields{$svcdb} = {}; foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them @@ -153,7 +153,7 @@ my %defs = ( ? ( $hashref->{svcdb} ) : qw( svc_acct svc_domain svc_forward svc_www svc_broadband ); - tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } @dbs; + tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } grep dbdef->table($_), @dbs; my $widget = new HTML::Widgets::SelectLayers( #'selected_layer' => $p_svcdb, 'selected_layer' => $hashref->{svcdb} || 'svc_acct', -- cgit v1.2.1 From b487a58e0f36136dbd714916f98a4eaed2373bb0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 6 Sep 2003 07:20:59 +0000 Subject: hide display of disabled packages from agent type browse --- httemplate/browse/agent_type.cgi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 5a8438589..c61208c83 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -17,9 +17,11 @@ agents.

    foreach my $agent_type ( sort { $a->getfield('typenum') <=> $b->getfield('typenum') } qsearch('agent_type',{}) ) { - my($hashref)=$agent_type->hashref; - my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} }); - my($rowspan)=scalar(@type_pkgs); + my $hashref = $agent_type->hashref; + #more efficient to do this with SQL... + my @type_pkgs = grep { ! $_->part_pkg->disabled } + qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} }); + my $rowspan = scalar(@type_pkgs); $rowspan = int($rowspan/2+0.5) ; print < -- cgit v1.2.1 From 32ba5c8d264479a302c1524165d708ce11243d69 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 15 Sep 2003 21:33:03 +0000 Subject: package search skips cancelled packages when searching by date range --- httemplate/search/cust_pkg.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 8b2fd0ca0..f735fbf42 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -33,6 +33,8 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $range .= ( $range ? ' AND ' : ' WHERE ' ). " bill <= $ending "; } + $range .= ( $range ? 'AND ' : ' WHERE ' ). '( cancel IS NULL OR cancel = 0 )'; + #false laziness with below my $statement = "SELECT COUNT(*) FROM cust_pkg $range"; warn $statement; -- cgit v1.2.1 From a68758a95e760e50ad99a2a2e0885d2aa9cf907a Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Sep 2003 10:46:35 +0000 Subject: include info on number of active/cancelled customers in agent browse --- httemplate/browse/agent.cgi | 75 +++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 26 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index cff111ca4..adeb78dbd 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,15 +1,30 @@ + <% -#Begin silliness -# -#use FS::UI::CGI; -#use FS::UI::agent; -# -#$ui = new FS::UI::agent; -#$ui->browse; -#exit; -#__END__ -#End silliness + + #bad false laziness with search/cust_main.cgi (also needs fixing up for + #old mysql) + my $ncancelled = " + 0 < ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + AND ( cust_pkg.cancel IS NULL + OR cust_pkg.cancel = 0 + ) + ) + OR 0 = ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + ) + "; + + my $ncancelled_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main + WHERE agentnum = ? + AND $ncancelled ") + or die dbh->errstr; + + my $total_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main + WHERE agentnum = ? ") + or die dbh->errstr; + %> <%= header('Agent Listing', menubar( @@ -25,6 +40,7 @@ full offerings (via their type).

    Agent Type + Customers Freq. Prog. @@ -36,28 +52,35 @@ foreach my $agent ( sort { #$a->getfield('agentnum') <=> $b->getfield('agentnum') $a->getfield('agent') cmp $b->getfield('agent') } qsearch('agent',{}) ) { - my($hashref)=$agent->hashref; - my($typenum)=$hashref->{typenum}; - my($agent_type)=qsearchs('agent_type',{'typenum'=>$typenum}); - my($atype)=$agent_type->getfield('atype'); - print <execute($agent->agentnum) or die $ncancelled_sth->errstr; + my $num_ncancelled = $ncancelled_sth->fetchrow_arrayref->[0]; + + $total_sth->execute($agent->agentnum) or die $total_sth->errstr; + my $num_total = $total_sth->fetchrow_arrayref->[0]; + + my $num_cancelled = $num_total - $num_ncancelled; + +%> + - - $hashref->{agentnum} - - $hashref->{agent} - $atype + + <%= $agent->agentnum %> + + <%= $agent->agent %> + <%= $agent->agent_type->atype %> + + <%= $num_ncancelled %> + active +
    <%= $num_cancelled %> + cancelled + $hashref->{freq} $hashref->{prog} -END -} +<% } %> -print < -END - -%> -- cgit v1.2.1 From ea1e0de8c51ea562308c20416e1f3fcb719a8847 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Sep 2003 10:52:28 +0000 Subject: oops --- httemplate/browse/agent.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index adeb78dbd..79f6c3dcf 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -75,8 +75,8 @@ foreach my $agent ( sort {
    <%= $num_cancelled %> cancelled - $hashref->{freq} - $hashref->{prog} + <%= $agent->freq %> + <%= $agent->prog %> <% } %> -- cgit v1.2.1 From 86c14f830b8d7e996bb84a0ad6a89f26816ea5b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 19 Sep 2003 10:07:18 +0000 Subject: move signup server functions to self-service server. fix provisioning & immediate suspension of declined signups. --- httemplate/docs/index.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html index b57b06feb..648cb985b 100644 --- a/httemplate/docs/index.html +++ b/httemplate/docs/index.html @@ -9,6 +9,7 @@
  • Upgrading from 1.3.0 to 1.3.1
  • Upgrading from 1.3.1 to 1.4.0
  • Upgrading from 1.4.0 to 1.4.1 +
  • Upgrading from 1.4.1 to 1.4.2
  • Upgrading from 1.4.1 (or 1.4.2?) to 1.5.0 -<% +<%= header("Pending credit card batch", menubar( 'Main Menu' => $p,)) %> + +
    + +Download batch in format +

    -print header("Pending credit card batch", menubar( - 'Main Menu' => $p, -# 'Add new referral' => "../edit/part_referral.cgi", -)), &table(), < # inv# @@ -14,39 +19,35 @@ print header("Pending credit card batch", menubar( Exp Amount -END - -foreach my $cust_pay_batch ( sort { - $a->getfield('paybatchnum') <=> $b->getfield('paybatchnum') -} qsearch('cust_pay_batch',{}) ) { -# my $date = time2str( "%a %b %e %T %Y", $queue->_date ); -# my $status = $hashref->{status}; -# if ( $status eq 'failed' || $status eq 'locked' ) { -# $status .= -# qq! ( retry |!. -# qq! remove )!; -# } - my $cardnum = $cust_pay_batch->{cardnum}; - $cardnum =~ s/.{4}$/xxxx/; - print <paybatchnum <=> $b->paybatchnum } + qsearch('cust_pay_batch', {} ) +) { + my $cardnum = $cust_pay_batch->cardnum; + #$cardnum =~ s/.{4}$/xxxx/; + $cardnum = 'x'x(length($cardnum)-4). substr($cardnum,(length($cardnum)-4)); + + $cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; + my( $mon, $year ) = ( $2, $1 ); + $mon = "0$mon" if $mon < 10; + my $exp = "$mon/$year"; + +%> + - $cust_pay_batch->{paybatchnum} - $cust_pay_batch->{invnum} - $cust_pay_batch->{custnum} - $cust_pay_batch->{last}, $cust_pay_batch->{last} - $cust_pay_batch->{payname} - $cardnum - $cust_pay_batch->{exp} - \$$cust_pay_batch->{amount} + <%= $cust_pay_batch->paybatchnum %> + <%= $cust_pay_batch->invnum %> + <%= $cust_pay_batch->custnum %> + <%= $cust_pay_batch->get('last'). ', '. $cust_pay_batch->first %> + <%= $cust_pay_batch->payname %> + <%= $cardnum %> + <%= $exp %> + $<%= $cust_pay_batch->amount %> -END -} +<% } %> -print < -END - -%> -- cgit v1.2.1 From cd6707b49e29d62397c1e4107803965282ee0115 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 01:22:48 +0000 Subject: preliminary batch download --- httemplate/misc/download-batch.cgi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 httemplate/misc/download-batch.cgi (limited to 'httemplate') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi new file mode 100644 index 000000000..3803c8464 --- /dev/null +++ b/httemplate/misc/download-batch.cgi @@ -0,0 +1,16 @@ +<% + +http_header('Content-Type' => 'text/comma-separated-values'); + +for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } + qsearch('cust_pay_batch', {} ) +) { + +$cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; +my( $mon, $y ) = ( $2, $1 ); +$mon = "0$mon" if $mon < 10; +my $exp = "$mon$y"; + +%> +,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> +<% } %> -- cgit v1.2.1 From 95b6fff06bd55cfc97647b056cb321b1b57c2d78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 06:52:30 +0000 Subject: eliminate extraneous newlines --- httemplate/misc/download-batch.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 3803c8464..5ee12f174 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -11,6 +11,5 @@ my( $mon, $y ) = ( $2, $1 ); $mon = "0$mon" if $mon < 10; my $exp = "$mon$y"; -%> -,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> +%>,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> <% } %> -- cgit v1.2.1 From 8ba4df7e0fab1faa2032b8311a195d297502e4b2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 07:31:27 +0000 Subject: remove trancode from batching --- httemplate/misc/download-batch.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 5ee12f174..ecb80d256 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,6 +1,6 @@ <% -http_header('Content-Type' => 'text/comma-separated-values'); +http_header('Content-Type' => 'text/comma-separated-values' ); for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } qsearch('cust_pay_batch', {} ) -- cgit v1.2.1 From 50ae1571b51626d2dd1cb878b94dff6fec747408 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Sep 2003 01:30:37 +0000 Subject: fix boolean precedence error leading to inaccurate results on the new customer status list --- httemplate/browse/agent.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 79f6c3dcf..0d808cd0d 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -18,7 +18,7 @@ my $ncancelled_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main WHERE agentnum = ? - AND $ncancelled ") + AND ( $ncancelled ) ") or die dbh->errstr; my $total_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main -- cgit v1.2.1 From ead5b6fc593ed0d9777a2e390a761110f5731a28 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 09:39:46 +0000 Subject: update upgrade docs for bind exports --- httemplate/docs/upgrade9.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html index 24d1cce42..6a8fd965d 100644 --- a/httemplate/docs/upgrade9.html +++ b/httemplate/docs/upgrade9.html @@ -21,6 +21,8 @@ CREATE INDEX part_pkg1 ON part_pkg ( disabled ); CREATE INDEX part_svc1 ON part_svc ( disabled ); CREATE INDEX cust_bill2 ON cust_bill ( _date ); -
  • If you want to use ACH (electronic checks), you will need to make changes to your database. The easiest way to make these changes is to dump your database (with pg_dump), change the payinfo field in the cust_pay, cust_refund, h_cust_pay and h_cust_refund tables from varchar(16) to varchar(80), reload the database from the dump, and run dbdef-create +
  • If you want to use ACH (electronic checks), you will need to make changes to your database. The easiest way to make these changes is to dump your database (with pg_dump), change the payinfo field in the cust_pay, cust_refund, h_cust_pay and h_cust_refund tables from varchar(16) to varchar(80), reload the database from the dump. +
  • If you will be doing bind exports you should make additional changes to your database. Follow the directions above to dump the database and change the reczone and recdata fields in the domain_record and h_domain_record tables from varchar(80) to varchar(255). +
  • If you made changes to your db schema from a dump as listed above run dbdef-create.
  • Restart Apache and freeside-queued. -- cgit v1.2.1 From f5ea7f4cc190dcb399bb19615ac8f48e19b9fa3d Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 09:40:05 +0000 Subject: 1.4.2 upgrade --- httemplate/docs/upgrade-1.4.2.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 httemplate/docs/upgrade-1.4.2.html (limited to 'httemplate') diff --git a/httemplate/docs/upgrade-1.4.2.html b/httemplate/docs/upgrade-1.4.2.html new file mode 100644 index 000000000..cf3d0de39 --- /dev/null +++ b/httemplate/docs/upgrade-1.4.2.html @@ -0,0 +1,15 @@ + + Upgrading to 1.4.2 + + +

    Upgrading to 1.4.2 from 1.4.1

    +
      +
    • If migrating from less than 1.4.1, see these instructions first. +
    • Back up your data and current Freeside installation. +
    • Install Locale::SubCountry +
    • Run make aspdocs or make masondocs. +
    • Copy aspdocs/ or masondocs/ to your web server's document space. +
    • Run make install-perl-modules. +
    • The signup server and password server are deprecated in 1.4.2. Their functionality has been incorperated into the self-service server. Edit or reinstall your init script appropriately, and set the "signup_server-default_agentnum" and "signup_server-default_refnum" configuration options appropriately. The FS::SignupClient interface is still available as a compatibility wrapper. You should be able to continue to use your current signup.cgi. +
    • Restart Apache and freeside-queued. + -- cgit v1.2.1