X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Felements%2Fsvc_devices.html;fp=httemplate%2Fview%2Felements%2Fsvc_devices.html;h=d71c82f07d0dc5185b67097a31cdd57f54d37f2f;hb=c9678906cb89a0c05a67d8118898202b64f84fd6;hp=0000000000000000000000000000000000000000;hpb=a87829a0945ad5199b8676756c3186a7139d086d;p=freeside.git
diff --git a/httemplate/view/elements/svc_devices.html b/httemplate/view/elements/svc_devices.html
new file mode 100644
index 000000000..d71c82f07
--- /dev/null
+++ b/httemplate/view/elements/svc_devices.html
@@ -0,0 +1,102 @@
+<%doc>
+
+#Example:
+
+ include( 'elements/svc_devices.html',
+ #required
+ 'svc_x' => $svc_phone, #or $svc_dsl
+ 'table' => 'phone_device', #or dsl_device
+
+ #optional
+ 'no_edit' => 0, #set true to turn off edit link
+ )
+
+%doc>
+<% $devices %>
+<%init>
+
+ my %opt = @_;
+ my $table = $opt{'table'}; #part_device, dsl_device
+ my $svc_x = $opt{'svc_x'};
+
+ my $devices = '';
+
+ my $num_part_device = 0;
+ if ( $table eq 'phone_device' ) {
+ my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device")
+ #WHERE disabled = '' OR disabled IS NULL;");
+ or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ $num_part_device = $sth->fetchrow_arrayref->[0];
+}
+
+ my @devices = $svc_x->$table();
+
+ #should move the below to proper mason code above instead of making $devices
+ if ( @devices || $num_part_device || $table eq 'dsl_device' ) {
+ my $svcnum = $svc_x->svcnum;
+ $devices .=
+ qq[Devices (Add device)
];
+ if ( @devices ) {
+
+ $devices .= qq!
+
+ !;
+
+
+ $devices .=
+ include('/elements/table-grid.html').
+ '