[freeside-commits] branch master updated. 62f9085f731b12a25db4418b1b9bf6fb24d01d07

Ivan ivan at 420.am
Mon Jun 3 10:17:01 PDT 2013


The branch, master has been updated
       via  62f9085f731b12a25db4418b1b9bf6fb24d01d07 (commit)
       via  e370df05d108dd71cc58d50b2eebd42ca23284d6 (commit)
       via  5f0aa2aba91b468367ea726d308253cb05f8faed (commit)
       via  169aa0275e0fda1e3c8dc459091cc16d403f72b4 (commit)
      from  5c70d9af4f7b07ccd9b67c203abd23f25218293e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 62f9085f731b12a25db4418b1b9bf6fb24d01d07
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Jun 3 10:16:59 2013 -0700

    fix per-day radius usage, RT#22699

diff --git a/FS/FS/part_pkg/sqlradacct_daily.pm b/FS/FS/part_pkg/sqlradacct_daily.pm
index d0d3e10..27fc1df 100644
--- a/FS/FS/part_pkg/sqlradacct_daily.pm
+++ b/FS/FS/part_pkg/sqlradacct_daily.pm
@@ -96,15 +96,15 @@ sub calc_recur {
   # bill that day, we didn't have a full picture of the day's usage)
   # and ending with sdate exclusive (same reason)
 
-  my($l_day, $l_mon, $l_year) = (localtime($last_bill))[3,5];
+  my($l_day, $l_mon, $l_year) = (localtime($last_bill))[3..5];
   my $day_start = timelocal(0,0,0, $l_day, $l_mon, $l_year);
 
-  my($s_day, $s_mon, $s_year) = (localtime($$sdate))[3,5];
+  my($s_day, $s_mon, $s_year) = (localtime($$sdate))[3..5];
   my $billday_start = timelocal(0,0,0, $s_day, $s_mon, $s_year);
 
   while ( $day_start < $billday_start ) {
 
-    my($day, $mon, $year) = (localtime($day_start))[3,5];
+    my($day, $mon, $year) = (localtime($day_start))[3..5];
     my $tomorrow = timelocal_nocheck(0,0,0, $day+1, $mon, $year);
 
     #afact the usage methods already use the lower bound inclusive and the upper

commit e370df05d108dd71cc58d50b2eebd42ca23284d6
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Jun 1 03:46:08 2013 -0700

    remove obsolete maestroconference stuff

diff --git a/httemplate/misc/maestro-customer_status-test.html b/httemplate/misc/maestro-customer_status-test.html
deleted file mode 100644
index 0064929..0000000
--- a/httemplate/misc/maestro-customer_status-test.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<% include('/elements/header.html', {
-             'title' => "Customer $custnum status",
-          }) %>
-
-<% include('/elements/small_custview.html', $custnum, '', 1) %>
-<BR>
-
-<table style="border:1px solid #000000">
-% foreach my $key (keys %$return) {
-%   my $value = $return->{$key};
-%   $value = join(', ', @$value) if ref($value) eq 'ARRAY';
-    <TR>
-      <TD ALIGN="right"><% $key %>:</TD>
-      <TD><B><% $value %></B></TD>
-    </TR>
-% }
-</table>
-
-<% include('/elements/footer.html') %>
-<%init>
-
-my $return;
-
-my($custnum, $svcnum) = $cgi->keywords;
-if ( $custnum =~ /^(\d+)$/ ) {
-
-  use FS::Maestro;
-  $return = FS::Maestro::customer_status($1, $svcnum);
-
-} else {
-  $return = { 'error' => 'No custnum' };
-}
-
-</%init>
diff --git a/httemplate/misc/maestro-customer_status.cgi b/httemplate/misc/maestro-customer_status.cgi
deleted file mode 100644
index ffeb53c..0000000
--- a/httemplate/misc/maestro-customer_status.cgi
+++ /dev/null
@@ -1,16 +0,0 @@
-<% $uri->query %>
-<%init>
-
-my $uri = new URI;
-
-my($custnum, $svcnum) = $cgi->keywords;
-if ( $custnum =~ /^(\d+)$/ ) {
-
-  use FS::Maestro;
-  $uri->query_form( FS::Maestro::customer_status($1) );
-
-} else {
-  $uri->query_form( { 'error' => 'No custnum' } );
-}
-
-</%init>
diff --git a/httemplate/misc/maestro-customer_status.html b/httemplate/misc/maestro-customer_status.html
deleted file mode 100644
index a872d49..0000000
--- a/httemplate/misc/maestro-customer_status.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<% encode_json( $return ) %>\
-<%init>
-
-my $return;
-
-my($custnum, $svcnum) = $cgi->keywords;
-if ( $custnum =~ /^(\d+)$/ ) {
-
-  use FS::Maestro;
-  $return = FS::Maestro::customer_status($1, $svcnum);
-
-} else {
-  $return = { 'error' => 'No custnum' };
-}
-
-</%init>

commit 5f0aa2aba91b468367ea726d308253cb05f8faed
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Jun 1 03:45:44 2013 -0700

    remove obsolete maestroconference stuff

diff --git a/FS/FS/Maestro.pm b/FS/FS/Maestro.pm
deleted file mode 100644
index 399e740..0000000
--- a/FS/FS/Maestro.pm
+++ /dev/null
@@ -1,249 +0,0 @@
-package FS::Maestro;
-
-use strict;
-use Date::Format;
-use FS::Conf;
-use FS::Record qw( qsearchs );
-use FS::cust_main;
-use FS::cust_pkg;
-use FS::part_svc;
-
-#i guess this is kind of deprecated in favor of service_status, but keeping it
-#around until they say they don't need it.
-sub customer_status {
-  my( $custnum ) = shift; #@_;
-  my $svcnum = @_ ? shift : '';
-
-  my $curuser = $FS::CurrentUser::CurrentUser;
-
-  my $cust_main = qsearchs({
-    'table'     => 'cust_main',
-    'hashref'   => { 'custnum' => $custnum },
-    'extra_sql' => ' AND '. $curuser->agentnums_sql,
-  })
-    or return { 'status' => 'E',
-                'error'  => "custnum $custnum not found" };
-
-  return service_status($svcnum) if $svcnum;
-
-  ###
-  # regular customer to maestro (single package)
-  ###
-
-  my %result = ();
-
-  my @cust_pkg = $cust_main->cust_pkg;
-
-  #things specific to the non-reseller scenario
-
-  $result{'status'} = substr($cust_main->ucfirst_status,0,1);
-
-  $result{'products'} =
-    [ map $_->pkgpart, grep !$_->get('cancel'), @cust_pkg ];
-
-  #find svc_pbx
-
-  my @cust_svc = map $_->cust_svc, @cust_pkg;
-
-  my @cust_svc_pbx =
-    grep { my($n,$l,$t) = $_->label; $t eq 'svc_pbx' }
-    @cust_svc;
-
-  if ( ! @cust_svc_pbx ) {
-    return { 'status' => 'E',
-             'error'  => "customer $custnum has no conference service" };
-  } elsif ( scalar(@cust_svc_pbx) > 1 ) {
-    return { 'status' => 'E',
-             'error'  =>
-               "customer $custnum has more than one conference".
-               " service (reseller?); specify a svcnum as a second argument",
-           };
-  }
-
-  my $cust_svc_pbx = $cust_svc_pbx[0];
-
-  my $svc_pbx = $cust_svc_pbx->svc_x;
-
-  # find "outbound service" y/n
-
-  my $conf = new FS::Conf;
-  my %outbound_pkgs = map { $_=>1 } $conf->config('mc-outbound_packages');
-  $result{'outbound_service'} =
-    scalar( grep { $outbound_pkgs{ $_->pkgpart }
-                     && !$_->get('cancel')
-                 }
-                 @cust_pkg
-          )
-    ? 1 : 0;
-
-  # find "good till" date/time stamp
-
-  my @active_cust_pkg =
-    sort { $a->bill <=> $b->bill }
-    grep { !$_->get('cancel') && $_->part_pkg->freq ne '0' }
-    @cust_pkg;
-  $result{'good_till'} = time2str('%c', $active_cust_pkg[0]->bill || time );
-
-  return { 
-    'name'    => $cust_main->name,
-    'email'   => $cust_main->invoicing_list_emailonly_scalar,
-    #'agentnum' => $cust_main->agentnum,
-    #'agent'    => $cust_main->agent->agent,
-    'max_lines'        => $svc_pbx ? $svc_pbx->max_extensions : '',
-    'max_simultaneous' => $svc_pbx ? $svc_pbx->max_simultaneous : '',
-    %result,
-  };
-
-}
-
-sub service_status {
-  my $svcnum = shift;
-
-  my $svc_pbx = qsearchs({
-    'table'      => 'svc_pbx',
-    'addl_from'  => ' LEFT JOIN cust_svc USING ( svcnum ) '.
-                    ' LEFT JOIN cust_pkg USING ( pkgnum ) ',
-    'hashref'   => { 'svcnum' => $svcnum },
-    #'extra_sql' => " AND custnum = $custnum",
-  })
-    or return { 'status' => 'E',
-                'error'  => "svcnum $svcnum not found" };
-
-  my $cust_pkg = $svc_pbx->cust_svc->cust_pkg;
-  my $cust_main = $cust_pkg->cust_main;
-
-  my %result = ();
-
-  #status in the reseller scenario
-  $result{'status'} = substr($cust_pkg->ucfirst_status,0,1);
-  $result{'status'} = 'A' if $result{'status'} eq 'N';
-
-  # find "outbound service" y/n
-  my @cust_pkg = $cust_main->cust_pkg;
-  #XXX what about outbound service per-reseller ?
-  my $conf = new FS::Conf;
-  my %outbound_pkgs = map { $_=>1 } $conf->config('mc-outbound_packages');
-  $result{'outbound_service'} =
-    scalar( grep { $outbound_pkgs{ $_->pkgpart }
-                     && !$_->get('cancel')
-                 }
-                 @cust_pkg
-          )
-    ? 1 : 0;
-
-  # find "good till" date/time stamp (this package)
-  $result{'good_till'} = time2str('%c', $cust_pkg->bill || time );
-
-  return { 
-    'custnum' => $cust_main->custnum,
-    'name'    => ( $svc_pbx->title || $cust_main->name ),
-    'email'   => $cust_main->invoicing_list_emailonly_scalar,
-    #'agentnum' => $cust_main->agentnum,
-    #'agent'    => $cust_main->agent->agent,
-    'max_lines'        => $svc_pbx->max_extensions,
-    'max_simultaneous' => $svc_pbx->max_simultaneous,
-    %result,
-  };
-
-}
-
-#some false laziness w/ MyAccount order_pkg
-sub order_pkg {
-  my $opt = ref($_[0]) ? shift : { @_ };
-
-  $opt->{'title'} = delete $opt->{'name'}
-    if !exists($opt->{'title'}) && exists($opt->{'name'});
-
-  my $custnum = $opt->{'custnum'};
-
-  my $curuser = $FS::CurrentUser::CurrentUser;
-
-  my $cust_main = qsearchs({
-    'table'     => 'cust_main',
-    'hashref'   => { 'custnum' => $custnum },
-    'extra_sql' => ' AND '. $curuser->agentnums_sql,
-  })
-    or return { 'error'  => "custnum $custnum not found" };
-
-  my $status = $cust_main->status;
-  #false laziness w/ClientAPI/Signup.pm
-
-  my $cust_pkg = new FS::cust_pkg ( {
-    'custnum' => $custnum,
-    'pkgpart' => $opt->{'pkgpart'},
-  } );
-  my $error = $cust_pkg->check;
-  return { 'error' => $error } if $error;
-
-  my @svc = ();
-  unless ( $opt->{'svcpart'} eq 'none' ) {
-
-    my $svcpart = '';
-    if ( $opt->{'svcpart'} =~ /^(\d+)$/ ) {
-      $svcpart = $1;
-    } else {
-      $svcpart = $cust_pkg->part_pkg->svcpart; #($svcdb);
-    }
-
-    my $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } );
-    return { 'error' => "Unknown svcpart $svcpart" } unless $part_svc;
-
-    my $svcdb = $part_svc->svcdb;
-
-    my %fields = (
-      'svc_acct'     => [ qw( username domsvc _password sec_phrase popnum ) ],
-      'svc_domain'   => [ qw( domain ) ],
-      'svc_phone'    => [ qw( phonenum pin sip_password phone_name ) ],
-      'svc_external' => [ qw( id title ) ],
-      'svc_pbx'      => [ qw( id title ) ],
-    );
-  
-    my $svc_x = "FS::$svcdb"->new( {
-      'svcpart'   => $svcpart,
-      map { $_ => $opt->{$_} } @{$fields{$svcdb}}
-    } );
-    
-    #snarf processing not necessary here (or probably at all, anymore)
-    
-    my $y = $svc_x->setdefault; # arguably should be in new method
-    return { 'error' => $y } if $y && !ref($y);
-  
-    $error = $svc_x->check;
-    return { 'error' => $error } if $error;
-
-    push @svc, $svc_x;
-
-  }
-
-  use Tie::RefHash;
-  tie my %hash, 'Tie::RefHash';
-  %hash = ( $cust_pkg => \@svc );
-  #msgcat
-  $error = $cust_main->order_pkgs( \%hash, 'noexport' => 1 );
-  return { 'error' => $error } if $error;
-
-# currently they're using this in the reseller scenario, so don't
-# bill the package immediately
-#  my $conf = new FS::Conf;
-#  if ( $conf->exists('signup_server-realtime') ) {
-#
-#    my $bill_error = _do_bop_realtime( $cust_main, $status );
-#
-#    if ($bill_error) {
-#      $cust_pkg->cancel('quiet'=>1);
-#      return $bill_error;
-#    } else {
-#      $cust_pkg->reexport;
-#    }
-#
-#  } else {
-    $cust_pkg->reexport;
-#  }
-
-  my $svcnum = $svc[0] ? $svc[0]->svcnum : '';
-
-  return { error=>'', pkgnum=>$cust_pkg->pkgnum, svcnum=>$svcnum };
-
-}
-
-1;
diff --git a/FS/MANIFEST b/FS/MANIFEST
index 9619122..68b4acc 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -46,7 +46,6 @@ FS/Cron/backup.pm
 FS/Cron/bill.pm
 FS/Cron/vacuum.pm
 FS/Daemon.pm
-FS/Maestro.pm
 FS/Misc.pm
 FS/Record.pm
 FS/Report.pm

commit 169aa0275e0fda1e3c8dc459091cc16d403f72b4
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Jun 1 02:26:16 2013 -0700

    fix XSS

diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi
index 88e9254..d860499 100755
--- a/httemplate/edit/cust_pkg.cgi
+++ b/httemplate/edit/cust_pkg.cgi
@@ -27,13 +27,13 @@
     <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>
+      <TD><% $all_pkg{$pkgpart} |h %> - <% $all_comment{$pkgpart} |h %></TD>
     </TR>
 %   foreach my $supp_pkg ( @{ $supp_pkgs_of{$pkgnum} } ) {
     <TR>
       <TD></TD>
       <TD></TD>
-      <TD>+ <% $all_pkg{$supp_pkg->pkgpart} %> - <% $all_comment{$supp_pkg->pkgpart} %></TD>
+      <TD>+ <% $all_pkg{$supp_pkg->pkgpart} |h %> - <% $all_comment{$supp_pkg->pkgpart} |h %></TD>
     </TR>
 %   }
 % } 
@@ -79,7 +79,7 @@ Order new packages
       <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><% $pkg{$pkgpart} |h %> - <% $comment{$pkgpart} |h %></TD>
   </TR>
 %
 %  $count ++ ;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Maestro.pm                                  |  249 ---------------------
 FS/FS/part_pkg/sqlradacct_daily.pm                |    6 +-
 FS/MANIFEST                                       |    1 -
 httemplate/edit/cust_pkg.cgi                      |    6 +-
 httemplate/misc/maestro-customer_status-test.html |   34 ---
 httemplate/misc/maestro-customer_status.cgi       |   16 --
 httemplate/misc/maestro-customer_status.html      |   16 --
 7 files changed, 6 insertions(+), 322 deletions(-)
 delete mode 100644 FS/FS/Maestro.pm
 delete mode 100644 httemplate/misc/maestro-customer_status-test.html
 delete mode 100644 httemplate/misc/maestro-customer_status.cgi
 delete mode 100644 httemplate/misc/maestro-customer_status.html




More information about the freeside-commits mailing list