summaryrefslogtreecommitdiff
path: root/httemplate/edit/svc_pbx.html
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-01-18 19:13:14 -0800
committerIvan Kohler <ivan@freeside.biz>2014-01-18 19:13:14 -0800
commit6ac45d15e85b10e3d63645c26a0a2acbad103df1 (patch)
tree79ffb548e9018b9512fe31740e6ab8911e08ff2a /httemplate/edit/svc_pbx.html
parent5fbd483ef56737fad894f18ec311a817c40054f0 (diff)
FS/FS/pbx_extension.pm
Diffstat (limited to 'httemplate/edit/svc_pbx.html')
-rw-r--r--httemplate/edit/svc_pbx.html52
1 files changed, 52 insertions, 0 deletions
diff --git a/httemplate/edit/svc_pbx.html b/httemplate/edit/svc_pbx.html
new file mode 100644
index 000000000..d973bf5e9
--- /dev/null
+++ b/httemplate/edit/svc_pbx.html
@@ -0,0 +1,52 @@
+<& elements/svc_Common.html,
+ 'table' => 'svc_pbx',
+
+ 'end_callback' => sub {
+ my( $cgi, $svc_pbx, $fields, $opt ) = @_;
+ $opt->{labels}{extensionnum} = ' ';
+ push @$fields,
+ { type => 'tablebreak-tr-title',
+ value => 'Extensions',
+ },
+ {
+ field => 'extensionnum',
+ type => 'pbx_extension',
+ o2m_table => 'pbx_extension',
+ m2_label => ' ',
+ m2_error_callback => $m2_error_callback,
+ },
+ ;
+
+ },
+
+&>
+<%init>
+
+my $m2_error_callback = sub {
+ my($cgi, $object) = @_;
+
+ #process_o2m fields in process/svc_pbx.html
+ my @fields = qw( extension pin sip_password phone_name );
+ my @gfields = ( '', map "_$_", @fields );
+
+ map {
+ if ( /^extensionnum(\d+)$/ ) {
+ my $num = $1;
+ if ( grep $cgi->param("extensionnum$num$_"), @gfields ) {
+ my $x = new FS::pbx_extension {
+ 'extensionnum' => scalar($cgi->param("extensionnum$num")),
+ map { $_ => scalar($cgi->param("extensionnum${num}_$_")) } @fields,
+ };
+ $x;
+ } else {
+ ();
+ }
+ } else {
+ ();
+ }
+ }
+ $cgi->param;
+};
+
+
+</%init>