summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2018-01-08 15:17:11 -0600
committerMitch Jackson <mitch@freeside.biz>2018-01-08 21:35:47 -0600
commitf778bc6bc2dac6380f32dd694480508fa071f200 (patch)
treed24182af9210329b23ddec8b2a60ef332666080f
parent785a50be3011b76a5dea45003d85dd5f5eec00ce (diff)
rt# 74031 work in progress
- Add pkgnum to realestate_unit table to link customer's package to a realestate unit - Display "provision real estate unit" on customer's package screen, and show select boxes for units
-rw-r--r--FS/FS/Schema.pm6
-rw-r--r--FS/FS/svc_realestate.pm29
-rw-r--r--httemplate/edit/elements/svc_Common.html4
-rw-r--r--httemplate/elements/tr-select-realestate_unit.html40
4 files changed, 65 insertions, 14 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index f2817f5..e4e6a84 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -7639,9 +7639,10 @@ sub tables_hashref {
'realestate_unit' => {
'columns' => [
'realestatenum', 'serial', '', '', '', '',
- 'realestatelocnum', 'int', '', '', '', '',
+ 'realestatelocnum', 'int', '', '', '', '',
'agentnum', 'int', 'NULL', '', '', '',
'custnum', 'int', 'NULL', '', '', '',
+ 'pkgnum', 'int', 'NULL', '', '', '',
'unit_title', 'varchar', '', $char_d, '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
@@ -7652,7 +7653,8 @@ sub tables_hashref {
['custnum'],
['realestatelocnum'],
['disabled'],
- ['unit_title']
+ ['unit_title'],
+ ['pkgnum',]
],
'foreign_keys' => [
{columns => ['agentnum'], table => 'agent'},
diff --git a/FS/FS/svc_realestate.pm b/FS/FS/svc_realestate.pm
index 27012d0..6579821 100644
--- a/FS/FS/svc_realestate.pm
+++ b/FS/FS/svc_realestate.pm
@@ -6,6 +6,7 @@ use warnings;
use vars qw($conf);
use FS::Record qw(qsearchs qsearch dbh);
+use Tie::IxHash;
$FS::UID::callback{'FS::svc_realestate'} = sub {
$conf = new FS::Conf;
@@ -43,21 +44,27 @@ Instantiates a new svc_realestate object.
=cut
-sub table_info {{
- name => 'Real estate',
- name_plural => 'Real estate services',
- longname_plural => 'Real estate services',
- display_weight => 100,
- cancel_weight => 100,
- fields => {
- svcnum => 'Service',
+sub table_info {
+ tie my %fields, 'Tie::IxHash',
+ svc_num => 'Service',
description => 'Descriptive label',
- property => 'Real estate property',
- },
-}}
+ property => 'Real estate property';
+
+ {
+ name => 'Real estate',
+ name_plural => 'Real estate services',
+ longname_plural => 'Real estate services',
+ display_weight => 100,
+ cancel_weight => 100,
+ fields => \%fields,
+ };
+}
sub table {'svc_realestate'};
+# todo- In what context is this called? Mimic stub behavior w/o the warning
+sub label { $_[0]->svcnum }
+
=item search_sql
I have an unfounded suspicion this method serves no purpose in this context
diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html
index a4e345e..33d1c75 100644
--- a/httemplate/edit/elements/svc_Common.html
+++ b/httemplate/edit/elements/svc_Common.html
@@ -167,7 +167,9 @@
$f->{options} = [ split( /\s*,\s*/,
$columndef->columnvalue)
];
- } # shouldn't this be enforced for all 'S' fields?
+ } elsif ( $flag eq 'R' ) { # Real Estate Unit Inventory
+ $f->{type} = 'select-realestate_unit';
+ }
if ( $f->{'type'} =~ /^select-svc/ )
{
diff --git a/httemplate/elements/tr-select-realestate_unit.html b/httemplate/elements/tr-select-realestate_unit.html
new file mode 100644
index 0000000..00c568e
--- /dev/null
+++ b/httemplate/elements/tr-select-realestate_unit.html
@@ -0,0 +1,40 @@
+<%doc>
+
+Display a pair of select boxes for provisioning a realestate_unit
+- Real Estate Location
+- Real Estate Unit
+
+</%doc>
+<& tr-td-label.html, %opt &>
+<td>
+<& select-tiered.html,
+ 'tiers' => [
+ {
+ # (todo) need to filter out locations where all units are assigned
+ field => 'realestate_location',
+ table => 'realestate_location',
+ #extra_sql => "WHERE $classnum_sql",
+ name_col => 'location_title',
+ empty_label => '(all)',
+ },
+ {
+ field => 'realestate_unit',
+ table => 'realestate_unit',
+ name_col => 'unit_title',
+ value_col => 'realestatenum',
+ link_col => 'realestatelocnum',
+ #extra_sql => delete($opt{'extra_sql'}),
+ # Need to add a filter to filter-out assigned units (todo)
+ disable_empty => 1,
+ },
+ ],
+ %opt,
+ 'prefix' => $opt{'prefix'}. $opt{'field'}. '_', #after %opt so it overrides
+&>
+</td>
+</tr>
+<%init>
+
+my %opt = @_;
+
+</%init>