[freeside-commits] branch FREESIDE_3_BRANCH updated. 837b5d7c27ae2b6502d86146456f8a3cfb06f8c0
Ivan
ivan at 420.am
Fri Jun 7 01:36:03 PDT 2013
The branch, FREESIDE_3_BRANCH has been updated
via 837b5d7c27ae2b6502d86146456f8a3cfb06f8c0 (commit)
from e695b4913b96dc0a9ff9ec7de96b64b4e33c9163 (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 837b5d7c27ae2b6502d86146456f8a3cfb06f8c0
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Jun 7 01:36:00 2013 -0700
add fields to svc_phone: SMS provider, SMS provider acct#, max simultaneous calls
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 2967c83..ba7c75b 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -3551,8 +3551,9 @@ sub tables_hashref {
'cdr_carrier' => {
'columns' => [
- 'carrierid' => 'serial', '', '', '', '',
- 'carriername' => 'varchar', '', $char_d, '', '',
+ 'carrierid' => 'serial', '', '', '', '',
+ 'carriername' => 'varchar', '', $char_d, '', '',
+ 'disabled' => 'char', 'NULL', 1, '', '',
],
'primary_key' => 'carrierid',
'unique' => [],
@@ -3683,31 +3684,34 @@ sub tables_hashref {
'svc_phone' => {
'columns' => [
- 'svcnum', 'int', '', '', '', '',
- 'countrycode', 'varchar', '', 3, '', '',
- 'phonenum', 'varchar', '', 25, '', '', #12 ?
- 'sim_imsi', 'varchar', 'NULL', 15, '', '',
- 'pin', 'varchar', 'NULL', $char_d, '', '',
- 'sip_password', 'varchar', 'NULL', $char_d, '', '',
- 'phone_name', 'varchar', 'NULL', $char_d, '', '',
- 'pbxsvc', 'int', 'NULL', '', '', '',
- 'domsvc', 'int', 'NULL', '', '', '',
- 'locationnum', 'int', 'NULL', '', '', '',
- 'forwarddst', 'varchar', 'NULL', 15, '', '',
- 'email', 'varchar', 'NULL', 255, '', '',
- 'lnp_status', 'varchar', 'NULL', $char_d, '', '',
- 'portable', 'char', 'NULL', 1, '', '',
- 'lrn', 'char', 'NULL', 10, '', '',
- 'lnp_desired_due_date', 'int', 'NULL', '', '', '',
- 'lnp_due_date', 'int', 'NULL', '', '', '',
- 'lnp_other_provider', 'varchar', 'NULL', $char_d, '', '',
- 'lnp_other_provider_account', 'varchar', 'NULL', $char_d, '', '',
- 'lnp_reject_reason', 'varchar', 'NULL', $char_d, '', '',
+ 'svcnum', 'int', '', '', '', '',
+ 'countrycode', 'varchar', '', 3, '', '',
+ 'phonenum', 'varchar', '', 25, '', '', #12 ?
+ 'sim_imsi', 'varchar', 'NULL', 15, '', '',
+ 'pin', 'varchar', 'NULL', $char_d, '', '',
+ 'sip_password', 'varchar', 'NULL', $char_d, '', '',
+ 'phone_name', 'varchar', 'NULL', $char_d, '', '',
+ 'pbxsvc', 'int', 'NULL', '', '', '',
+ 'domsvc', 'int', 'NULL', '', '', '',
+ 'locationnum', 'int', 'NULL', '', '', '',
+ 'forwarddst', 'varchar', 'NULL', 15, '', '',
+ 'email', 'varchar', 'NULL', 255, '', '',
+ 'lnp_status', 'varchar', 'NULL', $char_d, '', '',
+ 'portable', 'char', 'NULL', 1, '', '',
+ 'lrn', 'char', 'NULL', 10, '', '',
+ 'lnp_desired_due_date', 'int', 'NULL', '', '', '',
+ 'lnp_due_date', 'int', 'NULL', '', '', '',
+ 'lnp_other_provider', 'varchar', 'NULL', $char_d, '', '',
+ 'lnp_other_provider_account', 'varchar', 'NULL', $char_d, '', '',
+ 'lnp_reject_reason', 'varchar', 'NULL', $char_d, '', '',
+ 'sms_carrierid', 'int', 'NULL', '', '', '',
+ 'sms_account', 'varchar', 'NULL', '', '', '',
+ 'max_simultaneous', 'int', 'NULL', '', '', '',
],
'primary_key' => 'svcnum',
- 'unique' => [],
+ 'unique' => [ [ 'sms_carrierid', 'sms_account'] ],
'index' => [ ['countrycode', 'phonenum'], ['pbxsvc'], ['domsvc'],
- ['locationnum'],
+ ['locationnum'], ['sms_carrierid'],
],
},
diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm
index bab8537..5cd5312 100644
--- a/FS/FS/svc_phone.pm
+++ b/FS/FS/svc_phone.pm
@@ -173,6 +173,15 @@ sub table_info {
select_label => 'domain',
disable_inventory => 1,
},
+ 'sms_carrierid' => { label => 'SMS Carrier',
+ type => 'select',
+ select_table => 'cdr_carrier',
+ select_key => 'carrierid',
+ select_label => 'carriername',
+ disable_inventory => 1,
+ },
+ 'sms_account' => { label => 'SMS Carrier Account', },
+ 'max_simultaneous' => { label=>'Maximum number of simultaneous users' },
'locationnum' => {
label => 'E911 location',
disable_inventory => 1,
@@ -477,6 +486,9 @@ sub check {
|| $self->ut_textn('phone_name')
|| $self->ut_foreign_keyn('pbxsvc', 'svc_pbx', 'svcnum' )
|| $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' )
+ || $self->ut_foreign_keyn('sms_carrierid', 'cdr_carrier', 'carrierid' )
+ || $self->ut_alphan('sms_account')
+ || $self->ut_numbern('max_simultaneous')
|| $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
|| $self->ut_numbern('forwarddst')
|| $self->ut_textn('email')
@@ -637,6 +649,26 @@ sub radius_groups {
();
}
+=item sms_cdr_carrier
+
+=cut
+
+sub sms_cdr_carrier {
+ my $self = shift;
+ return '' unless $self->sms_carrierid;
+ qsearchs('cdr_carrier', { 'carrierid' => $self->sms_carrierid } );
+}
+
+=item sms_carriername
+
+=cut
+
+sub sms_carriername {
+ my $self = shift;
+ my $cdr_carrier = $self->sms_cdr_carrier or return '';
+ $cdr_carrier->carriername;
+}
+
=item phone_device
Returns any FS::phone_device records associated with this service.
diff --git a/httemplate/browse/cdr_carrier.html b/httemplate/browse/cdr_carrier.html
new file mode 100644
index 0000000..3ec95f3
--- /dev/null
+++ b/httemplate/browse/cdr_carrier.html
@@ -0,0 +1,22 @@
+<& elements/browse.html,
+ 'title' => 'Carriers',
+ 'name_singular' => 'carrier',
+ 'menubar' => [ 'Add a new carrier' =>
+ $p.'edit/cdr_carrier.html',
+ ],
+ 'query' => { 'table' => 'cdr_carrier', },
+ 'count_query' => 'SELECT COUNT(*) FROM cdr_carrier',
+ 'header' => [ 'Carrier', ],
+ 'fields' => [ 'carriername', ],
+ 'links' => [ $link, ],
+ 'disableable' => 1,
+ 'disabled_statuspos' => 1,
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $link = [ "${p}edit/cdr_carrier.html?", 'carrierid' ];
+
+</%init>
diff --git a/httemplate/edit/cdr_carrier.html b/httemplate/edit/cdr_carrier.html
new file mode 100644
index 0000000..47a358a
--- /dev/null
+++ b/httemplate/edit/cdr_carrier.html
@@ -0,0 +1,19 @@
+<& elements/edit.html,
+ 'table' => 'cdr_carrier',
+ 'name_singular' => 'carrier',
+ 'fields' => [
+ { field=>'carriername', type=>'text', size=>20 },
+ { field=>'disabled', type=>'checkbox', value=>'Y' },
+ ],
+ 'labels' => { 'carrierid' => 'Carrier',
+ 'carriername' => 'Carrier',
+ 'disabled' => 'Disabled',
+ },
+ 'viewall_dir' => 'browse',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/process/cdr_carrier.html b/httemplate/edit/process/cdr_carrier.html
new file mode 100644
index 0000000..72f0186
--- /dev/null
+++ b/httemplate/edit/process/cdr_carrier.html
@@ -0,0 +1,10 @@
+<& elements/process.html,
+ 'table' => 'cdr_carrier',
+ 'viewall_dir' => 'browse',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi
index 13bbe82..d48e635 100644
--- a/httemplate/edit/svc_phone.cgi
+++ b/httemplate/edit/svc_phone.cgi
@@ -121,6 +121,25 @@ my $begin_callback = sub {
;
}
+ if ( ! $bulk ) {
+
+ push @$fields,
+ {
+ type => 'tablebreak-tr-title',
+ value => 'Carrier Information',
+ colspan => 8,
+ },
+ { field => 'sms_carrierid',
+ label => 'SMS Carrier',
+ type => 'select-cdr_carrier',
+ },
+ 'sms_account',
+ 'max_simultaneous',
+ ;
+
+ }
+
};
+
</%init>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index c2ea023..cb8f613 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -500,6 +500,7 @@ tie my %config_broadband, 'Tie::IxHash',
tie my %config_phone, 'Tie::IxHash',
'View/Edit phone device types' => [ $fsurl.'browse/part_device.html', 'Phone device types' ],
'View/Edit bulk DID vendors' => [ $fsurl.'browse/did_vendor.html', 'Bulk DID vendors' ],
+ 'View/Edit Carriers' => [ $fsurl.'browse/cdr_carrier.html', 'Carriers' ],
;
tie my %config_radius, 'Tie::IxHash',
diff --git a/httemplate/elements/select-cdr_carrier.html b/httemplate/elements/select-cdr_carrier.html
new file mode 100644
index 0000000..a9dc54f
--- /dev/null
+++ b/httemplate/elements/select-cdr_carrier.html
@@ -0,0 +1,19 @@
+<% include( '/elements/select-table.html',
+ 'table' => 'cdr_carrier',
+ 'name_col' => 'carriername',
+ 'empty_label' => '(none)',
+ %opt,
+ )
+%>
+<%init>
+
+my( %opt ) = @_;
+
+$opt{'records'} = delete $opt{'cdr_carrier'}
+ if $opt{'cdr_carrier'};
+
+my %hash = ( 'disabled' => '', );
+
+$opt{'records'} ||= [ qsearch( 'cdr_carrier', \%hash ) ];
+
+</%init>
diff --git a/httemplate/elements/tr-select-cdr_carrier.html b/httemplate/elements/tr-select-cdr_carrier.html
new file mode 100644
index 0000000..b39a4d4
--- /dev/null
+++ b/httemplate/elements/tr-select-cdr_carrier.html
@@ -0,0 +1,27 @@
+% if ( scalar(@{ $opt{'cdr_carrier'} }) == 0 ) {
+
+ <INPUT TYPE="hidden" NAME="<% $opt{'field'} || 'carrierid' %>" VALUE="">
+
+% } else {
+
+ <TR>
+ <TD ALIGN="right"><% $opt{'label'} || 'Carrier' %></TD>
+ <TD>
+ <% include( '/elements/select-cdr_carrier.html',
+ %opt,
+ )
+ %>
+ </TD>
+ </TR>
+
+% }
+
+<%init>
+
+my( %opt ) = @_;
+
+my %hash = ( 'disabled' => '', );
+
+$opt{'cdr_carrier'} ||= [ qsearch( 'cdr_carrier', \%hash ) ];
+
+</%init>
diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi
index 408364a..ccd9ae7 100644
--- a/httemplate/view/svc_phone.cgi
+++ b/httemplate/view/svc_phone.cgi
@@ -31,15 +31,26 @@ if ( $conf->exists('showpasswords') ) {
push @fields, qw( pin phone_name forwarddst email );
+push @fields, { field => 'sms_carrierid',
+ #type=>'cdr_carrier',
+ value_callback => sub {
+ $_[0]->sms_carriername,
+ },
+ },
+ 'sms_account',
+ 'max_simultaneous',
+;
+
if ( $conf->exists('svc_phone-lnp') ) {
-push @fields, 'lnp_status',
- 'lnp_reject_reason',
- { field => 'portable', type => 'checkbox', },
- 'lrn',
- { field => 'lnp_desired_due_date', type => 'date', },
- { field => 'lnp_due_date', type => 'date', },
- 'lnp_other_provider',
- 'lnp_other_provider_account';
+ push @fields, 'lnp_status',
+ 'lnp_reject_reason',
+ { field => 'portable', type => 'checkbox', },
+ 'lrn',
+ { field => 'lnp_desired_due_date', type => 'date', },
+ { field => 'lnp_due_date', type => 'date', },
+ 'lnp_other_provider',
+ 'lnp_other_provider_account',
+ ;
}
my $html_foot = sub {
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Schema.pm | 52 +++++++++++---------
FS/FS/svc_phone.pm | 32 ++++++++++++
httemplate/browse/cdr_carrier.html | 22 ++++++++
httemplate/edit/cdr_carrier.html | 19 +++++++
.../edit/process/{rate.cgi => cdr_carrier.html} | 7 ++-
httemplate/edit/svc_phone.cgi | 19 +++++++
httemplate/elements/menu.html | 1 +
httemplate/elements/select-cdr_carrier.html | 19 +++++++
httemplate/elements/tr-select-cdr_carrier.html | 27 ++++++++++
httemplate/view/svc_phone.cgi | 27 +++++++---
10 files changed, 190 insertions(+), 35 deletions(-)
create mode 100644 httemplate/browse/cdr_carrier.html
create mode 100644 httemplate/edit/cdr_carrier.html
copy httemplate/edit/process/{rate.cgi => cdr_carrier.html} (52%)
mode change 100755 => 100644
create mode 100644 httemplate/elements/select-cdr_carrier.html
create mode 100644 httemplate/elements/tr-select-cdr_carrier.html
More information about the freeside-commits
mailing list