[freeside-commits] branch master updated. b236325052e32facaad168cbf0f370eebd4fd1f9

Ivan ivan at 420.am
Sun Jan 18 14:39:59 PST 2015


The branch, master has been updated
       via  b236325052e32facaad168cbf0f370eebd4fd1f9 (commit)
       via  96623c3c471fda6935bd57efeaa0ad484285b74b (commit)
       via  7d6db2c0fed3624edeb29de8890e982f743ff158 (commit)
       via  844cadb72e5e37ba0c78ffc8b6f2eded669b2226 (commit)
      from  82f76d01660b785f6c4ea13ba547c93c1c2c404d (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 b236325052e32facaad168cbf0f370eebd4fd1f9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Jan 18 14:39:58 2015 -0800

    fully-qualify

diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index e459172..8199ba1 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -1384,7 +1384,7 @@ sub search {
 
   #custnum
   if ( $params->{'custnum'} =~ /^(\d+)$/ && $1 ) {
-    push @where, "custnum = $1";
+    push @where, "cust_pkg.custnum = $1";
   }
 
   #customer status

commit 96623c3c471fda6935bd57efeaa0ad484285b74b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Jan 18 14:38:29 2015 -0800

    doc

diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm
index 0eaab83..44d3bee 100644
--- a/FS/FS/access_user.pm
+++ b/FS/FS/access_user.pm
@@ -40,17 +40,37 @@ inherits from FS::Record.  The following fields are currently supported:
 
 =over 4
 
-=item usernum - primary key
+=item usernum
 
-=item username - 
+primary key
 
-=item _password - 
+=item username
 
-=item last -
+=item _password
 
-=item first -
+=item _password_encoding
 
-=item disabled - empty or 'Y'
+Empty or bcrypt
+
+=item last
+
+Last name
+
+=item first
+
+First name
+
+=item user_custnum
+
+Master customer for this employee (for commissions)
+
+=item report_salesnum
+
+Default sales person for this employee (for reports)
+
+=item disabled
+
+Empty or 'Y'
 
 =back
 

commit 7d6db2c0fed3624edeb29de8890e982f743ff158
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Jan 18 14:37:26 2015 -0800

    DRY

diff --git a/FS/FS/AuthCookieHandler.pm b/FS/FS/AuthCookieHandler.pm
index b571e47..93d8ea6 100644
--- a/FS/FS/AuthCookieHandler.pm
+++ b/FS/FS/AuthCookieHandler.pm
@@ -6,6 +6,12 @@ use FS::UID qw( adminsuidsetup preuser_setup );
 use FS::CurrentUser;
 use FS::Auth;
 
+#Apache 2.2 and below
+sub useragent_ip {
+  my( $self, $r ) = @_;
+  $r->connection->remote_ip;
+}
+
 sub authen_cred {
   my( $self, $r, $username, $password ) = @_;
 
@@ -14,11 +20,11 @@ sub authen_cred {
   my $info = {};
 
   unless ( FS::Auth->authenticate($username, $password, $info) ) {
-    warn "failed auth $username from ". $r->connection->remote_ip. "\n";
+    warn "failed auth $username from ". $self->useragent_ip($r). "\n";
     return undef;
   }
 
-  warn "authenticated $username from ". $r->connection->remote_ip. "\n";
+  warn "authenticated $username from ". $self->useragent_ip($r). "\n";
 
   FS::CurrentUser->load_user( $username,
                               'autocreate' => FS::Auth->auth_class->autocreate,
@@ -36,7 +42,7 @@ sub authen_ses_key {
   my $curuser = FS::CurrentUser->load_user_session( $sessionkey );
 
   unless ( $curuser ) {
-    warn "bad session $sessionkey from ". $r->connection->remote_ip. "\n";
+    warn "bad session $sessionkey from ". $self->useragent_ip($r). "\n";
     return undef;
   }
 
diff --git a/FS/FS/AuthCookieHandler24.pm b/FS/FS/AuthCookieHandler24.pm
index fa24890..d65934f 100644
--- a/FS/FS/AuthCookieHandler24.pm
+++ b/FS/FS/AuthCookieHandler24.pm
@@ -1,46 +1,12 @@
 package FS::AuthCookieHandler24;
-use base qw( Apache2::AuthCookie );
+use base qw( FS::AuthCookieHandler );
 
 use strict;
-use FS::UID qw( adminsuidsetup preuser_setup );
-use FS::CurrentUser;
-use FS::Auth;
 
-sub authen_cred {
-  my( $self, $r, $username, $password ) = @_;
-
-  preuser_setup();
-
-  my $info = {};
-
-  unless ( FS::Auth->authenticate($username, $password, $info) ) {
-    warn "failed auth $username from ". $r->useragent_ip. "\n";
-    return undef;
-  }
-
-  warn "authenticated $username from ". $r->useragent_ip. "\n";
-
-  FS::CurrentUser->load_user( $username,
-                              'autocreate' => FS::Auth->auth_class->autocreate,
-                              %$info,
-                            );
-
-  FS::CurrentUser->new_session;
-}
-
-sub authen_ses_key {
-  my( $self, $r, $sessionkey ) = @_;
-
-  preuser_setup();
-
-  my $curuser = FS::CurrentUser->load_user_session( $sessionkey );
-
-  unless ( $curuser ) {
-    warn "bad session $sessionkey from ". $r->useragent_ip. "\n";
-    return undef;
-  }
-
-  $curuser->username;
+#Apache 2.4+ / Apache2::AuthCookie 3.19+
+sub useragent_ip {
+  my( $self, $r ) = @_;
+  $r->useragent_ip;
 }
 
 1;

commit 844cadb72e5e37ba0c78ffc8b6f2eded669b2226
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Jan 18 14:35:16 2015 -0800

    qualify columns by default in 4.x (experiment?), RT#20688, RT#22232

diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 0810a7e..991c56e 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -45,7 +45,7 @@ our $nowarn_classload = 0;
 our $no_update_diff = 0;
 our $no_history = 0;
 
-our $qsearch_qualify_columns = 0;
+our $qsearch_qualify_columns = 1;
 
 our $no_check_foreign = 1; #well, not inefficiently in perl by default anymore
 
diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm
index 78b8b0f..56a666e 100644
--- a/FS/FS/cust_bill_pkg.pm
+++ b/FS/FS/cust_bill_pkg.pm
@@ -1204,6 +1204,7 @@ sub upgrade_tax_location {
     # It's either the bill or ship address of the customer as of the
     # invoice date-of-insertion.  (Not necessarily the invoice date.)
     my $date = $h_cust_bill->history_date;
+    local($FS::Record::qsearch_qualify_columns) = 0;
     my $h_cust_main = qsearchs('h_cust_main',
         { custnum   => $custnum },
         FS::h_cust_main->sql_h_searchs($date)
@@ -1257,6 +1258,7 @@ sub upgrade_tax_location {
 
       } else {
         # (pkgparts really shouldn't change, right?)
+        local($FS::Record::qsearch_qualify_columns) = 0;
         my $h_cust_pkg = qsearchs('h_cust_pkg', { pkgnum => $pkgnum },
           FS::h_cust_pkg->sql_h_searchs($date)
         );
@@ -1276,6 +1278,7 @@ sub upgrade_tax_location {
         }
 
         if (!exists $pkgpart_taxclass{$pkgpart}) {
+          local($FS::Record::qsearch_qualify_columns) = 0;
           my $h_part_pkg = qsearchs('h_part_pkg', { pkgpart => $pkgpart },
             FS::h_part_pkg->sql_h_searchs($date)
           );
@@ -1310,6 +1313,7 @@ sub upgrade_tax_location {
     # Get any per-customer taxname exemptions that were in effect.
     my %exempt_cust_taxname;
     foreach (keys %all_tax_names) {
+     local($FS::Record::qsearch_qualify_columns) = 0;
       my $h_exemption = qsearchs('h_cust_main_exemption', {
           'custnum' => $custnum,
           'taxname' => $_,
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index d8fda3e..d55bd7b 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2934,12 +2934,16 @@ sub h_cust_svc {
     if $DEBUG;
 
   my ($end, $start, $mode) = @_;
+
+  local($FS::Record::qsearch_qualify_columns) = 0;
+
   my @cust_svc = $self->_sort_cust_svc(
     [ qsearch( 'h_cust_svc',
       { 'pkgnum' => $self->pkgnum, },  
       FS::h_cust_svc->sql_h_search(@_),  
     ) ]
   );
+
   if ( defined($mode) && $mode eq 'I' ) {
     my %hidden_svcpart = map { $_->svcpart => $_->hidden } $self->part_svc;
     return grep { !$hidden_svcpart{$_->svcpart} } @cust_svc;
diff --git a/FS/FS/h_cust_svc.pm b/FS/FS/h_cust_svc.pm
index d280d53..7b565ad 100644
--- a/FS/FS/h_cust_svc.pm
+++ b/FS/FS/h_cust_svc.pm
@@ -98,6 +98,7 @@ sub h_svc_x {
 
   warn "requiring FS/h_$svcdb.pm" if $DEBUG;
   require "FS/h_$svcdb.pm";
+  local($FS::Record::qsearch_qualify_columns) = 0;
   my $svc_x = qsearchs(
     "h_$svcdb",
     { 'svcnum' => $self->svcnum, },
diff --git a/FS/FS/h_svc_Radius_Mixin.pm b/FS/FS/h_svc_Radius_Mixin.pm
index af29770..c0c6d4b 100644
--- a/FS/FS/h_svc_Radius_Mixin.pm
+++ b/FS/FS/h_svc_Radius_Mixin.pm
@@ -6,6 +6,7 @@ use FS::h_radius_usergroup;
 
 sub h_usergroup {
   my $self = shift;
+  local($FS::Record::qsearch_qualify_columns) = 0;
   map { $_->groupnum } 
     qsearch( 'h_radius_usergroup',
              { svcnum => $self->svcnum },
diff --git a/FS/FS/h_svc_acct.pm b/FS/FS/h_svc_acct.pm
index f525f82..6e127a2 100644
--- a/FS/FS/h_svc_acct.pm
+++ b/FS/FS/h_svc_acct.pm
@@ -28,6 +28,7 @@ FS::h_svc_acct - Historical account objects
 
 sub svc_domain {
   my $self = shift;
+  local($FS::Record::qsearch_qualify_columns) = 0;
   qsearchs( 'h_svc_domain',
             { 'svcnum' => $self->domsvc },
             FS::h_svc_domain->sql_h_searchs(@_),
diff --git a/FS/FS/h_svc_forward.pm b/FS/FS/h_svc_forward.pm
index 25b2039..7f6a5cc 100644
--- a/FS/FS/h_svc_forward.pm
+++ b/FS/FS/h_svc_forward.pm
@@ -32,6 +32,9 @@ FS::h_svc_forward - Historical mail forwarding alias objects
 
 sub srcsvc_acct {
   my $self = shift;
+
+  local($FS::Record::qsearch_qualify_columns) = 0;
+
   my $h_svc_acct = qsearchs(
     'h_svc_acct',
     { 'svcnum' => $self->srcsvc },
@@ -52,6 +55,9 @@ sub srcsvc_acct {
 
 sub dstsvc_acct {
   my $self = shift;
+
+  local($FS::Record::qsearch_qualify_columns) = 0;
+
   my $h_svc_acct = qsearchs(
     'h_svc_acct',
     { 'svcnum' => $self->dstsvc },
diff --git a/FS/FS/h_svc_www.pm b/FS/FS/h_svc_www.pm
index 2a3b6dc..e719f1b 100644
--- a/FS/FS/h_svc_www.pm
+++ b/FS/FS/h_svc_www.pm
@@ -33,6 +33,7 @@ sub domain_record {
 
   carp 'Called FS::h_svc_www->domain_record on svcnum ' . $self->svcnum if $DEBUG;
 
+  local($FS::Record::qsearch_qualify_columns) = 0;
   my $domain_record = qsearchs(
     'h_domain_record',
     { 'recnum' => $self->recnum },
diff --git a/FS/bin/freeside-censustract-update b/FS/bin/freeside-censustract-update
index af9ad74..f9b6d11 100644
--- a/FS/bin/freeside-censustract-update
+++ b/FS/bin/freeside-censustract-update
@@ -26,6 +26,7 @@ $date ||= time;
 # Find all locations that, as of $date, did not have 
 # censusyear = the current year.  This includes those 
 # that have no censusyear.
+local($FS::Record::qsearch_qualify_columns) = 0;
 my %h_cust_location = map { $_->locationnum => $_ }
   qsearch(
     'h_cust_location',
diff --git a/httemplate/search/h_inventory_item.html b/httemplate/search/h_inventory_item.html
index b0f9b8a..b5cac9e 100644
--- a/httemplate/search/h_inventory_item.html
+++ b/httemplate/search/h_inventory_item.html
@@ -60,6 +60,7 @@ my %agent = ('agentnum' => $agentnum) if $agentnum;
 my %class = ('classnum' => $classnum) if $classnum;
 
 my @rows = ( map {[ (0) x $numdays ]} @labels);
+local($FS::Record::qsearch_qualify_columns) = 0;
 my $opening_balance = scalar(
   qsearch('h_inventory_item', 
           { 'svcnum' => '',

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

Summary of changes:
 FS/FS/AuthCookieHandler.pm              |   12 ++++++---
 FS/FS/AuthCookieHandler24.pm            |   44 ++++---------------------------
 FS/FS/Record.pm                         |    2 +-
 FS/FS/access_user.pm                    |   32 +++++++++++++++++-----
 FS/FS/cust_bill_pkg.pm                  |    4 +++
 FS/FS/cust_pkg.pm                       |    4 +++
 FS/FS/h_cust_svc.pm                     |    1 +
 FS/FS/h_svc_Radius_Mixin.pm             |    1 +
 FS/FS/h_svc_acct.pm                     |    1 +
 FS/FS/h_svc_forward.pm                  |    6 +++++
 FS/FS/h_svc_www.pm                      |    1 +
 FS/FS/svc_Common.pm                     |    2 +-
 FS/bin/freeside-censustract-update      |    1 +
 httemplate/search/h_inventory_item.html |    1 +
 14 files changed, 62 insertions(+), 50 deletions(-)




More information about the freeside-commits mailing list