[freeside-commits] branch master updated. ee7bb8218d50ca38148427c9b24a8decbd3ace86

Ivan ivan at 420.am
Sat Sep 7 17:39:02 PDT 2013


The branch, master has been updated
       via  ee7bb8218d50ca38148427c9b24a8decbd3ace86 (commit)
      from  ecd1baba392d971b49a50f133349f85aaec548a0 (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 ee7bb8218d50ca38148427c9b24a8decbd3ace86
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Sep 7 17:39:00 2013 -0700

    start svc_alarm, RT#23694

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 019ea21..2783ada 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -302,6 +302,7 @@ tie my %rights, 'Tie::IxHash',
     'Services: PBXs',
     'Services: Ports',
     'Services: Mailing lists',
+    'Services: Alarm services',
     'Services: External services',
     'Usage: RADIUS sessions',
     'Usage: Call Detail Records (CDRs)',
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index 88198dd..08cce16 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -352,6 +352,7 @@ if ( -e $addl_handler_use_file ) {
   use FS::vend_pay;
   use FS::vend_bill_pay;
   use FS::sales_pkg_class;
+  use FS::svc_alarm;
   # Sammath Naur
 
   if ( $FS::Mason::addl_handler_use ) {
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 87a14aa..66752da 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -4250,6 +4250,22 @@ sub tables_hashref {
       'index' => [],
     },
 
+    'svc_alarm' => {
+      'columns' => [
+        'svcnum',          'int',      '',      '', '', '', 
+        'alarm_system', 'varchar',     '', $char_d, '', '', # dropdowns?
+        'alarm_type',   'varchar',     '', $char_d, '', '', #
+        'acctnum',      'varchar',     '', $char_d, '', '',
+        '_password',    'varchar',     '', $char_d, '', '',
+        'location',     'varchar', 'NULL', $char_d, '', '',
+        #cs
+        #rep
+      ],
+      'primary_key' => 'svcnum',
+      'unique' => [], #system/type/acctnum??
+      'index'  => [],
+    },
+
     'svc_cable' => {
       'columns' => [
         'svcnum',         'int',     '',      '', '', '', 
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 85334ed..289660f 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -187,7 +187,8 @@ sub _upgrade_data { # class method
 
   my @all_groups = qsearch('access_group', {});
 
-  tie my %onetime, 'Tie::IxHash',
+  #tie my %onetime, 'Tie::IxHash',
+  my @onetime = (
     'List customers'                      => 'List all customers',
     'List all customers'                  => 'Advanced customer search',
     'List packages'                       => 'Summarize packages',
@@ -224,6 +225,8 @@ sub _upgrade_data { # class method
     'Services: Hardware' => 'Services: Hardware: Advanced search',
     'Services: Phone numbers' => 'Services: Phone numbers: Advanced search',
 
+    'Services: Accounts' => 'Services: Alarm services',
+
     'List rating data' => [ 'Usage: RADIUS sessions',
                             'Usage: Call Detail Records (CDRs)',
                             'Usage: Unrateable CDRs',
@@ -236,13 +239,18 @@ sub _upgrade_data { # class method
     'Services: Accounts' => 'Services: Cable Subscribers',
     'Bulk change customer packages' => 'Bulk move customer services',
     'Configuration' => 'Edit sales people',
-;
+  );
+
+#  foreach my $old_acl ( keys %onetime ) {
+#
+#    my @new_acl = ref($onetime{$old_acl})
+#                    ? @{ $onetime{$old_acl} }
+#                    :  ( $onetime{$old_acl} );
 
-  foreach my $old_acl ( keys %onetime ) {
+  while ( @onetime ) {
 
-    my @new_acl = ref($onetime{$old_acl})
-                    ? @{ $onetime{$old_acl} }
-                    :  ( $onetime{$old_acl} );
+    my( $old_acl, $new_acl ) = splice(@onetime, 0, 2);
+    my @new_acl = ref($new_acl) ? @$new_acl : ( $new_acl );
 
     foreach my $new_acl ( @new_acl ) {
 
diff --git a/FS/FS/h_svc_alarm.pm b/FS/FS/h_svc_alarm.pm
new file mode 100644
index 0000000..b1bd236
--- /dev/null
+++ b/FS/FS/h_svc_alarm.pm
@@ -0,0 +1,32 @@
+package FS::h_svc_alarm;
+
+use strict;
+use vars qw( @ISA );
+use FS::h_Common;
+use FS::svc_alarm;
+
+ at ISA = qw( FS::h_Common FS::svc_alarm );
+
+sub table { 'h_svc_alarm' };
+
+=head1 NAME
+
+FS::h_svc_alarm - Historical Alarm service objects
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+An FS::h_svc_alarm object represents a historical alarm service subscriber.
+FS::h_svc_alarm inherits from FS::h_Common and FS::svc_alarm.
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+L<FS::h_Common>, L<FS::svc_alarm>, L<FS::Record>
+
+=cut
+
+1;
+
diff --git a/FS/FS/svc_alarm.pm b/FS/FS/svc_alarm.pm
new file mode 100644
index 0000000..6318914
--- /dev/null
+++ b/FS/FS/svc_alarm.pm
@@ -0,0 +1,142 @@
+package FS::svc_alarm;
+
+use strict;
+use base qw( FS::svc_Common );
+use FS::Record; # qw( qsearch qsearchs );
+
+=head1 NAME
+
+FS::svc_alarm - Object methods for svc_alarm records
+
+=head1 SYNOPSIS
+
+  use FS::svc_alarm;
+
+  $record = new FS::svc_alarm \%hash;
+  $record = new FS::svc_alarm { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::svc_alarm object represents an alarm service.  FS::svc_alarm inherits
+from FS::svc_Common.
+
+The following fields are currently supported:
+
+=over 4
+
+=item svcnum - Primary key
+
+=item alarm_system - Alarm System
+
+=item alarm_type = Alarm Type
+
+=item acctnum - Account number
+
+=item _password - Password
+
+=item location - Location on property
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new svc_dish object.
+
+=cut
+
+sub table { 'svc_alarm'; }
+
+sub table_info {
+  my %opts = ( 'type' => 'text', 
+               #'disable_select' => 1,
+               'disable_inventory' => 1,
+             );
+  {
+    'name'           => 'Alarm service',
+    'sorts'          => 'acctnum',
+    'display_weight' => 80,
+    'cancel_weight'  => 85,
+    'fields' => {
+      'svcnum'    => { label => 'Service' },
+      'alarm_system'   => { label => 'Alarm System', %opts },
+      'alarm_type'   => { label => 'Alarm Type', %opts },
+      'acctnum'   => { label => 'Account #', %opts },
+      '_password' => { label => 'Password', %opts },
+      'location'  => { label => 'Location', %opts },
+    },
+  };
+}
+
+sub label {
+  my $self = shift;
+  $self->acctnum;
+}
+
+sub search_sql {
+  my($class, $string) = @_;
+  $class->search_sql_field('acctnum', $string);
+}
+
+=item insert
+
+Adds this record to the database.  If there is an error, returns the error,
+otherwise returns false.
+
+=item delete
+
+Delete this record from the database.
+
+=item replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database.  If there is an error,
+returns the error, otherwise returns false.
+
+# the replace method can be inherited from FS::Record
+
+=item check
+
+Checks all fields to make sure this is a valid service.  If there is
+an error, returns the error, otherwise returns false.  Called by the insert
+and replace methods.
+
+=cut
+
+sub check {
+  my $self = shift;
+
+  my $x = $self->setfixed;
+  return $x unless ref $x;
+
+  my $error = 
+    $self->ut_numbern('svcnum')
+    || $self->ut_text('acctnum')
+    || $self->ut_numbern('installdate')
+    || $self->ut_anything('note')
+  ;
+  return $error if $error;
+
+  $self->SUPER::check;
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<FS::Record>, L<FS::svc_Common>, schema.html from the base documentation.
+
+=cut
+
+1;
+  
diff --git a/FS/FS/svc_mailinglist.pm b/FS/FS/svc_mailinglist.pm
index ba297ee..8cab398 100644
--- a/FS/FS/svc_mailinglist.pm
+++ b/FS/FS/svc_mailinglist.pm
@@ -88,7 +88,7 @@ sub table { 'svc_mailinglist'; }
 sub table_info {
   {
     'name' => 'Mailing list',
-    'display_weight' => 80,
+    'display_weight' => 31,
     'cancel_weight'  => 55,
     'fields' => {
       'username' => { 'label' => 'List address',
diff --git a/FS/MANIFEST b/FS/MANIFEST
index 1bb5cbd..eb237c3 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -718,3 +718,5 @@ FS/vend_bill_pay.pm
 t/vend_bill_pay.t
 FS/sales_pkg_class.pm
 t/sales_pkg_class.t
+FS/svc_alarm.pm
+t/svc_alarm.t
diff --git a/FS/t/svc_alarm.t b/FS/t/svc_alarm.t
new file mode 100644
index 0000000..dbe7712
--- /dev/null
+++ b/FS/t/svc_alarm.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n" }
+END {print "not ok 1\n" unless $loaded;}
+use FS::svc_alarm;
+$loaded=1;
+print "ok 1\n";

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

Summary of changes:
 FS/FS/AccessRight.pm                |    1 +
 FS/FS/Mason.pm                      |    1 +
 FS/FS/Schema.pm                     |   16 +++++++++++
 FS/FS/access_right.pm               |   20 +++++++++----
 FS/FS/h_svc_alarm.pm                |   32 ++++++++++++++++++++++
 FS/FS/{svc_dish.pm => svc_alarm.pm} |   51 ++++++++++++++++++++---------------
 FS/FS/svc_mailinglist.pm            |    2 +-
 FS/MANIFEST                         |    2 +
 FS/t/{ConfItem.t => svc_alarm.t}    |    2 +-
 9 files changed, 97 insertions(+), 30 deletions(-)
 create mode 100644 FS/FS/h_svc_alarm.pm
 copy FS/FS/{svc_dish.pm => svc_alarm.pm} (62%)
 copy FS/t/{ConfItem.t => svc_alarm.t} (84%)




More information about the freeside-commits mailing list