combine ticket notification scrips, #15353
[freeside.git] / httemplate / elements / select-did.html
1 <%doc>
2
3 Example:
4
5   include('/elements/select-did.html',
6             #can't actuall change from phonenum yet# 'field'   => 'phonenum',
7
8             'svcpart' => 5,
9             #OR
10             'object' => $svc_phone,
11          );
12
13 </%doc>
14 % if ( $use_selector ) {
15
16 %   if ( $export->option('restrict_selection') eq 'non-tollfree'
17 %                   || !$export->option('restrict_selection') ) {
18     <TABLE>
19
20       <TR>
21         <TD VALIGN="top">
22           <% include('/elements/select-state.html',
23                        'prefix'        => 'phonenum_', #$field.'_',
24                        'country'       => $country,
25                        'svcpart'       => $svcpart,
26                        'disable_empty' => 0,
27                        'empty_label'   => 'Select state',
28                     )
29           %>
30           <BR><FONT SIZE="-1">State</FONT>
31         </TD>
32         <TD VALIGN="top">
33           <% include('/elements/select-areacode.html',
34                        'state_prefix' => 'phonenum_', #$field.'_',
35                        'svcpart'      => $svcpart,
36                        'empty'        => 'Select area code',
37                     )
38           %>
39           <BR><FONT SIZE="-1">Area code</FONT>
40         </TD>
41         <TD VALIGN="top">
42           <% include('/elements/select-exchange.html',
43                        'svcpart' => $svcpart,
44                        'empty'   => 'Select exchange',
45                     )
46           %>
47           <BR><FONT SIZE="-1">City / Exchange</FONT>
48         </TD>
49         <TD VALIGN="top">
50           <% include('/elements/select-phonenum.html',
51                        'svcpart'  => $svcpart,
52                        'empty'    => 'Select phone number',
53                        'bulknum'  => $bulknum,
54                        'multiple' => $multiple,
55                     )
56           %>
57           <BR><FONT SIZE="-1">Phone number</FONT>
58         </TD>
59       </TR>
60
61     </TABLE>
62
63 % } 
64 %   if ( $export->option('restrict_selection') eq 'tollfree'
65 %                   || !$export->option('restrict_selection') ) {
66             <font size="-1">Toll-free</font>
67             <% include('/elements/select-phonenum.html',
68                        'svcpart' => $svcpart,
69                        'empty'   => 'Select phone number',
70                        'tollfree' => 1,
71                        'prefix' => 'tollfree',
72                        'bulknum' => 0,
73                     )
74             %>
75 %       }
76
77 %       if ( $bulknum ) {
78             <div id="bulkdid" style="padding-top: 11px">
79 %               my $i;
80 %               for($i=0; $i < $bulknum; $i++) {
81                     <div id="bulkdid_<%$i%>" style="display: none">
82                         <input type="checkbox" id="checkbox_bulkdid_<%$i%>"
83                             name="bulkdid" value="">
84                         <label for="checkbox_bulkdid_<%$i%>" 
85                             id="label_bulkdid_<%$i%>"></label>
86                     </div>
87 %               }
88             </div>
89 %       }
90
91 % } else {
92
93     <% include( '/elements/input-text.html', %opt, 'type'=>'text' ) %>
94
95 % }
96 <%init>
97
98 my %opt = @_;
99
100 my $conf = new FS::Conf;
101
102 #false laziness w/tr-select-did.html
103 #XXX make sure this comes through on errors too
104 my $svcpart  = $opt{'svcpart'}
105             || $opt{'object'}->svcpart
106             || $opt{'object'}->cust_svc->svcpart;
107
108 my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
109 die "unknown svcpart $svcpart" unless $part_svc;
110
111 my @exports = $part_svc->part_export_did;
112 if ( scalar(@exports) > 1 ) {
113   die "more than one DID-providing export attached to svcpart $svcpart";
114 }
115 my $export = '';
116 $export = $exports[0] if scalar(@exports);
117
118 my $use_selector = scalar(@exports) ? 1 : 0;
119
120 my $bulknum = $opt{'bulknum'} || 0; #Bulk DID orders via ordering system, vs.
121 my $multiple = $opt{'multiple'} || 0; #just selecting a bunch at a time
122
123 my $country  = ( $export && $export->option('country') )
124             || $conf->config('countrydefault')
125             || 'US';
126
127 #my $field = $opt{'field'} || 'phonenum';
128
129 </%init>