diff options
Diffstat (limited to 'httemplate/edit')
21 files changed, 223 insertions, 44 deletions
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index 18d4415c6..29c8ca63f 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -128,16 +128,19 @@ </FORM> <% include('/elements/footer.html') %> +<%shared> +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +my $format = $date_format. ' %T %z (%Z)'; + +</%shared> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates'); -my $conf = new FS::Conf; -my $date_format = $conf->config('date_format') || '%m/%d/%Y'; - -my $format = $date_format. ' %T %z (%Z)'; my $error = ''; my( $pkgnum, $cust_pkg ); diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index 73488ef9a..1f52b4789 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -7,16 +7,18 @@ { field=>'_password2', type=>'password' }, 'last', 'first', + { field=>'user_custnum', type=>'search-cust_main', }, { field=>'disabled', type=>'checkbox', value=>'Y' }, ], 'labels' => { - 'usernum' => 'User number', - 'username' => 'Username', - '_password' => 'Password', - '_password2'=> 'Re-enter Password', - 'last' => 'Last name', - 'first' => 'First name', - 'disabled' => 'Disable employee', + 'usernum' => 'User number', + 'username' => 'Username', + '_password' => 'Password', + '_password2 '=> 'Re-enter Password', + 'last' => 'Last name', + 'first' => 'First name', + 'user_custnum' => 'Customer (optional)', + 'disabled' => 'Disable employee', }, 'edit_callback' => sub { my( $c, $o ) = @_; $o->set('_password', ''); diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 5d06f3c04..1a06d9497 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -225,7 +225,6 @@ function post_standardization() { } else { - cf.elements['geocode'].value = ''; post_geocode(); } diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index 3d6c4862d..d1d436851 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -78,7 +78,7 @@ 'name' => 'signupdate', 'value' => $cust_main->signupdate, 'label' => 'Signup date', - 'format' => $conf->config('date_format') || "%m/%d/%Y", + 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ), }) %> % } diff --git a/httemplate/edit/cust_main_note.cgi b/httemplate/edit/cust_main_note.cgi index 6c6a1a9a0..e2501cb54 100755 --- a/httemplate/edit/cust_main_note.cgi +++ b/httemplate/edit/cust_main_note.cgi @@ -6,11 +6,11 @@ <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> <INPUT TYPE="hidden" NAME="notenum" VALUE="<% $notenum %>"> - -<BR><BR> -<TEXTAREA NAME="comment" ROWS="12" COLS="60"> -<% $comment %> -</TEXTAREA> +<% include('/elements/htmlarea.html', 'field' => 'comment', + 'curr_value' => $comment) %> +% #<TEXTAREA NAME="comment" ROWS="12" COLS="60"> +% # <% $comment %> +% #</TEXTAREA> <BR><BR> <INPUT TYPE="submit" VALUE="<% $notenum ? "Apply Changes" : "Add Note" %>"> @@ -33,6 +33,8 @@ if ( $cgi->param('error') ) { $comment = $note->comments; } +$comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor + $cgi->param('custnum') =~ /^(\d+)$/ or die "illeagl custnum"; my $custnum = $1; diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 8c88852ae..1a1023cbd 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -40,7 +40,7 @@ Example: 'disabled' => 0, 'onchange' => 'javascript_function', - 'include_opt_callback' => sub { #my $ = @_; + 'include_opt_callback' => sub { my $object = @_; ( 'option' => 'value', ); }, @@ -296,11 +296,15 @@ Example: % % if ( $type eq 'tablebreak-tr-title' ) { % $include_common{'table_id'} = 'TableNumber'. $tablenum++; +% } +% if ( $type eq 'tablebreak-tr-title' || $type eq 'title' ) { % $include_common{'colspan'} = $f->{colspan} if $f->{colspan}; % } % % if ( $f->{include_opt_callback} ) { -% %include_common = ( %include_common, &{ $f->{include_opt_callback} } ); +% %include_common = ( %include_common, +% &{ $f->{include_opt_callback} }( $object ) +% ); % } % % my $layer_prefix_on = ''; diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index 2e98a1b25..36950b2c9 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -34,12 +34,14 @@ 'new_hashref_callback' => sub { #my( $cgi, $svc_x ) = @_; - { svcpart => $svcpart }; + { pkgnum => $pkgnum, + svcpart => $svcpart, + }; }, 'new_callback' => sub { - my( $cgi, $svc_x, $fields, $opt ) = @_;; + my( $cgi, $svc_x, $fields, $opt ) = @_; $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart }); die "No part_svc entry!" unless $part_svc; @@ -48,6 +50,13 @@ #$svcnum=''; + if ( my $cb = $opt{'svc_new_callback'} ) { + my $cust_pkg = $pkgnum + ? qsearchs('cust_pkg', {pkgnum=>$pkgnum}) + : ''; #? + &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt); + } + $svc_x->set_default_and_fixed; }, @@ -92,6 +101,11 @@ }; } + if ( $f->{'field'} eq 'custnum' && $pkgnum ) { + my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}); + $object->set('custnum', $cust_pkg->custnum); + } + }, 'html_init' => sub { @@ -141,11 +155,13 @@ sub label_fixup { my( $part_svc, $opt ) = @_; + $opt->{'name'} ||= $part_svc->svc; + my $svcdb = $part_svc->svcdb; require "FS/$svcdb.pm"; if ( UNIVERSAL::can("FS::$svcdb", 'table_info') ) { - $opt->{'name'} ||= "FS::$svcdb"->table_info->{'name'}; + #$opt->{'name'} ||= "FS::$svcdb"->table_info->{'name'}; my $fields = "FS::$svcdb"->table_info->{'fields'}; $opt->{'fields'} ||= [ grep { $_ ne 'svcnum' } keys %$fields ]; @@ -165,7 +181,7 @@ sub label_fixup { my $labels = $opt->{labels}; # with -> here foreach my $field ( keys %{ $opt->{labels} } ) { my $col = $part_svc->part_svc_column($field); - $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\S*$/; + $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\s*$/; } } diff --git a/httemplate/edit/mailinglistmember.html b/httemplate/edit/mailinglistmember.html new file mode 100644 index 000000000..2391cb697 --- /dev/null +++ b/httemplate/edit/mailinglistmember.html @@ -0,0 +1,25 @@ +<% include( 'elements/edit.html', + 'name_singular' => 'member', + 'table' => 'mailinglistmember', + 'popup' => 1, + 'fields' => [ + { field=>'listnum', type=>'hidden', }, + { field=>'svcnum', type=>'hidden', }, #not yet + { field=>'contactemailnum', type=>'hidden', }, #not yet + { field=>'email', type=>'text', }, + ], + 'labels' => { 'membernum' => 'Member', + 'email' => 'Email address', + }, + 'new_callback' => $new_callback, + ) +%> +<%init> + +my $new_callback = sub { + #my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; + my( $cgi, $object ) = @_; + $object->listnum( $cgi->param('listnum') ); +}; + +</%init> diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index a02545f84..f9818c4f9 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -162,15 +162,17 @@ { type => 'columnend' }, - { 'type' => $census ? 'tablebreak-tr-title' - : 'hidden', + { 'type' => $report_option ? 'tablebreak-tr-title' + : 'hidden', 'value' => 'Optional report classes', 'field' => 'census_title', }, { 'field' => 'report_option', - 'type' => $census ? 'select-table' : 'hidden', + 'type' => $report_option ? 'select-table' + : 'hidden', 'table' => 'part_pkg_report_option', 'name_col' => 'name', + 'hashref' => { 'disabled' => '' }, 'multiple' => 1, }, @@ -256,7 +258,7 @@ my $sth = dbh->prepare("SELECT COUNT(*) FROM part_pkg_report_option". " WHERE disabled IS NULL OR disabled = '' ") or die dbh->errstr; $sth->execute or die $sth->errstr; -my $census = $sth->fetchrow_arrayref->[0]; +my $report_option = $sth->fetchrow_arrayref->[0]; #XXX # - tr-part_pkg_freq: month_increments_only (from price plans) @@ -409,7 +411,6 @@ my $m2_error_callback_maker = sub { my $link_type = shift; #yay closures return sub { my( $cgi, $object ) = @_; - my $num; map { if ( /^${link_type}_dst_pkgpart(\d+)$/ && diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 51925c0c5..98ed9fec1 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -15,7 +15,8 @@ Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref-> Service definitions are the templates for items you offer to your customers. <UL><LI>svc_acct - Accounts - anything with a username (Mailboxes, PPP accounts, shell accounts, RADIUS entries for broadband, etc.) <LI>svc_domain - Domains - <LI>svc_forward - mail forwarding + <LI>svc_forward - Mail forwarding + <LI>svc_mailinglist - Mailing list <LI>svc_www - Virtual domain website <LI>svc_broadband - Broadband/High-speed Internet service (always-on) <LI>svc_phone - Customer phone numbers diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 22aab44e8..b5796ebf5 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -39,14 +39,15 @@ push @errors, '_setup_areyousure' && ! $cgi->param('setup_areyousure'); # and it wasn't confirmed push @errors, '_start' - if $hash{'start_date'} && $old->start_date # if a start date was added - && $hash{'setup'}; # but there's a setup date + if $hash{'start_date'} && !$old->start_date # if a start date was added + && $hash{'setup'}; # but there's a setup date my $new; my $error; if ( @errors ) { $error = join(',', @errors); } else { + warn join(',',%hash); $new = new FS::cust_pkg \%hash; $error = $new->replace($old); } diff --git a/httemplate/edit/process/mailinglistmember.html b/httemplate/edit/process/mailinglistmember.html new file mode 100644 index 000000000..f1842b8ef --- /dev/null +++ b/httemplate/edit/process/mailinglistmember.html @@ -0,0 +1,6 @@ +<% include( 'elements/process.html', + 'table' => 'mailinglistmember', + 'popup_reload' => 'Member added', + ) +%> +%#XXX ACL diff --git a/httemplate/edit/process/part_device.html b/httemplate/edit/process/part_device.html index 399991fc8..2b7e1da49 100644 --- a/httemplate/edit/process/part_device.html +++ b/httemplate/edit/process/part_device.html @@ -1,10 +1,6 @@ <% include( 'elements/process.html', 'table' => 'part_device', 'viewall_dir' => 'browse', - 'process_m2m' => { - 'link_table' => 'export_device', - 'target_table' => 'part_export', - }, ) %> <%init> diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi index 882991e9d..8036f7388 100755 --- a/httemplate/edit/process/rate_region.cgi +++ b/httemplate/edit/process/rate_region.cgi @@ -39,7 +39,7 @@ my @dest_detail = map { new FS::rate_detail { 'ratenum' => $ratenum, map { $_ => $cgi->param("$_$ratenum") } - qw( min_included min_charge sec_granularity classnum ) + qw( min_included conn_charge conn_sec min_charge sec_granularity classnum ) }; } qsearch('rate', {} ); diff --git a/httemplate/edit/process/svc_mailinglist.html b/httemplate/edit/process/svc_mailinglist.html new file mode 100644 index 000000000..580f6ccbd --- /dev/null +++ b/httemplate/edit/process/svc_mailinglist.html @@ -0,0 +1,11 @@ +<% include( 'elements/svc_Common.html', + 'table' => 'svc_mailinglist', + 'fields' => [ fields('svc_mailinglist'), 'listname' ], + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +</%init> diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html index 27a703cdf..e02ec5ccc 100644 --- a/httemplate/edit/process/svc_phone.html +++ b/httemplate/edit/process/svc_phone.html @@ -1,5 +1,6 @@ <% include( 'elements/svc_Common.html', 'table' => 'svc_phone', + 'args_callback' => $args_callback, ) %> <%init> @@ -7,4 +8,22 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? +my $args_callback = sub { + my( $cgi, $object ) = @_; + + my %opt = (); + if ( $cgi->param('locationnum') == -1 ) { + my $cust_location = new FS::cust_location { + map { $_ => scalar($cgi->param($_)) } + qw( custnum address1 address2 city county state zip country ) + }; + $opt{'cust_location'} = $cust_location; + } + + %opt; + +}; + + + </%init> diff --git a/httemplate/edit/rate_detail.html b/httemplate/edit/rate_detail.html index dd8c3f6b3..869ace8d4 100644 --- a/httemplate/edit/rate_detail.html +++ b/httemplate/edit/rate_detail.html @@ -6,6 +6,8 @@ 'dest_regionname' => 'Region', 'dest_prefixes_short' => 'Prefix(es)', 'min_included' => 'Included minutes/calls', + 'conn_charge' => 'Connection charge', + 'conn_sec' => 'For', 'min_charge' => 'Charge per minute/call', 'sec_granularity' => 'Granularity', 'classnum' => 'Usage class', @@ -17,6 +19,13 @@ { field=>'dest_regionname', type=>'fixed', }, { field=>'dest_prefixes_short', type=>'fixed', }, { field=>'min_included', type=>'text', size=>5 }, + { field=>'conn_charge', type=>'money', size=>4 }, + { field =>'conn_sec', + type =>'select', + options => [ keys %conn_secs ], + labels => \%conn_secs, + disable_empty => 1, + }, { field=>'min_charge', type=>'money', size=>4 }, { field =>'sec_granularity', type =>'select', @@ -38,9 +47,9 @@ <%once> tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); </%once> - <%init> my $conf = new FS::Conf; diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index 9ca3a3569..f77c0dbe7 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -52,6 +52,12 @@ <FONT SIZE=-1>Included<BR>minutes/calls</FONT> </TH> <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge for</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> <FONT SIZE=-1>Charge per<BR>minute/call</FONT> </TH> <TH CLASS="grid" BGCOLOR="#cccccc"> @@ -88,7 +94,20 @@ </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - $<INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% $cgi->param("min_charge$n") || $rate_detail->min_charge |h %>"> + <%$money_char%><INPUT TYPE="text" SIZE=9 NAME="conn_charge<%$n%>" VALUE="<% $cgi->param("conn_charge$n") || $rate_detail->conn_charge |h %>"> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <SELECT NAME="conn_sec<%$n%>"> +% foreach my $conn_sec ( keys %conn_secs ) { +% my $curr_value = $cgi->param("conn_sec$n") || $rate_detail->conn_sec; +% my $selected = ($conn_sec==$curr_value) ? ' SELECTED' : ''; + <OPTION VALUE="<% $conn_sec %>" <%$selected%>><% $conn_secs{$conn_sec} %></OPTION> +% } + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <%$money_char%><INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% $cgi->param("min_charge$n") || $rate_detail->min_charge |h %>"> </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> @@ -125,12 +144,19 @@ </FORM> <% include('/elements/footer.html') %> +<%once> + +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); +</%once> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + my $rate_region; if ( $cgi->param('error') ) { $rate_region = new FS::rate_region ( { diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index 8a108f891..b11fec7a7 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -63,12 +63,12 @@ my $callback = sub { if $fieldref->{field} eq 'blocknum'; $fieldref->{value} = $object->addr_block->label - if $fieldref->{field} eq 'block_label'; + if $fieldref->{field} eq 'block_label' && $object->addr_block; } else { if ($fieldref->{field} eq 'block_label') { - if ($fixedblock) { + if ($fixedblock && $object->addr_block) { $object->blocknum($fixedblock); $fieldref->{value} = $object->addr_block->label; }else{ @@ -93,7 +93,8 @@ my $callback = sub { && $FS::CurrentUser::CurrentUser->agentnum($_->agentnum) } map { $_->addr_block } $object->allowed_routers; - my @options = map { $_->blocknum } @addr_block; + my @options = map { $_->blocknum } + sort { $a->label cmp $b->label } @addr_block; my %option_labels = map { ( $_->blocknum => $_->label ) } @addr_block; $fieldref->{type} = 'select'; $fieldref->{options} = \@options; diff --git a/httemplate/edit/svc_mailinglist.cgi b/httemplate/edit/svc_mailinglist.cgi new file mode 100644 index 000000000..c7c739daa --- /dev/null +++ b/httemplate/edit/svc_mailinglist.cgi @@ -0,0 +1,25 @@ +<% include( 'elements/svc_Common.html', + 'table' => 'svc_mailinglist', + 'fields' => \@fields, + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +my @fields = ( + 'username', + { field=>'domsvc', type=>'select-svc-domain', + #label => 'List address domain', + }, + { field=>'listnum', type=>'hidden', }, + { field=>'listname', type=>'text', }, + { field=>'reply_to', type=>'checkbox', value=>'Y' }, + { field=>'remove_from', type=>'checkbox', value=>'Y' }, + { field=>'reject_auto', type=>'checkbox', value=>'Y' }, + { field=>'remove_to_and_cc', type=>'checkbox', value=>'Y' }, + +); + +</%init> diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi index 3c7b75249..b77d96233 100644 --- a/httemplate/edit/svc_phone.cgi +++ b/httemplate/edit/svc_phone.cgi @@ -1,8 +1,8 @@ <% include( 'elements/svc_Common.html', - 'name' => 'Phone number', 'table' => 'svc_phone', 'fields' => \@fields, 'labels' => { + 'svcnum' => 'Service', 'countrycode' => 'Country code', 'phonenum' => 'Phone number', 'domsvc' => 'Domain', @@ -10,7 +10,12 @@ 'pin' => 'Voicemail PIN', 'phone_name' => 'Name', 'pbxsvc' => 'PBX', + 'locationnum' => 'E911 location', }, + 'svc_new_callback' => sub { + my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_; + $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg; + }, ) %> <%init> @@ -39,7 +44,34 @@ push @fields, { field => 'pbxsvc', }, 'sip_password', 'pin', - 'phone_name', + { field => 'phone_name', + type => 'text', + maxlength => $conf->config('svc_phone-phone_name-max_length'), + }, + + { value => 'E911 Information', + type => 'tablebreak-tr-title', + colspan => 7, + }, + { field => 'locationnum', + type => 'select-cust_location', + label => 'E911 location', + include_opt_callback => sub { + my $svc_phone = shift; + my $pkgnum = $svc_phone->get('pkgnum') + || $cgi->param('pkgnum') + || $svc_phone->cust_svc->pkgnum; #hua? + #cross agent location exposure? sheesh + my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}); + my $cust_main = $cust_pkg ? $cust_pkg->cust_main : ''; + ( 'no_bold' => 1, + 'cust_pkg' => $cust_pkg, + 'cust_main' => $cust_main, + ); + }, + }, + { field => 'custnum', type=> 'hidden' }, #for new cust_locations ; + </%init> |