diff options
Diffstat (limited to 'httemplate/edit')
23 files changed, 343 insertions, 88 deletions
diff --git a/httemplate/edit/agent_payment_gateway.html b/httemplate/edit/agent_payment_gateway.html index 6d15164ac..38411f12e 100644 --- a/httemplate/edit/agent_payment_gateway.html +++ b/httemplate/edit/agent_payment_gateway.html @@ -18,9 +18,12 @@ Use gateway <SELECT NAME="gatewaynum"> <OPTION VALUE="<% $payment_gateway->gatewaynum %>"><% $payment_gateway->gateway_module %> (<% $payment_gateway->gateway_username %>) % } - </SELECT> -<BR><BR> +<BR> + +<INPUT TYPE="checkbox" NAME="cardtype" VALUE="ACH"> for ACH only. +<BR> +<BR> <INPUT TYPE="submit" VALUE="Add gateway override"> </FORM> diff --git a/httemplate/edit/bulk-cust_pkg.html b/httemplate/edit/bulk-cust_pkg.html index 2ff38ca53..8a082f47f 100644 --- a/httemplate/edit/bulk-cust_pkg.html +++ b/httemplate/edit/bulk-cust_pkg.html @@ -19,24 +19,18 @@ function areyousure() { } </SCRIPT> <FORM NAME="OneTrueForm"> -% #false laziness with bulk-cust_svc.html -% $cgi->param('pkgpart') =~ /^(\d+)$/ -% or die "illegal pkgpart: ". $cgi->param('pkgpart'); -% -% my $old_pkgpart = $1; -% my $src_part_pkg = qsearchs('part_pkg', { 'pkgpart' => $old_pkgpart } ) -% or die "unknown pkgpart: $old_pkgpart"; -% +% foreach my $src_part_pkg (@src_part_pkg) { + <INPUT NAME="old_pkgpart" TYPE="hidden" VALUE="<% $src_part_pkg->pkgpart %>"> + Change <B><% $src_part_pkg->pkg_comment |h %></B><BR> +% } -<INPUT NAME="old_pkgpart" TYPE="hidden" VALUE="<% $old_pkgpart %>"> -Change <B><% $src_part_pkg->pkg_comment %></B><BR> - +<BR> to new package definition <SELECT NAME="new_pkgpart"> % foreach my $dest_part_pkg ( qsearch('part_pkg', { 'disabled' => '' } ) ) { - <OPTION VALUE="<% $dest_part_pkg->pkgpart %>"><% $dest_part_pkg->pkgpart %>: <% $dest_part_pkg->pkg %> + <OPTION VALUE="<% $dest_part_pkg->pkgpart %>"><% $dest_part_pkg->pkgpart %>: <% $dest_part_pkg->pkg |h %> % } </SELECT> @@ -57,4 +51,18 @@ to new package definition die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my @src_part_pkg = (); +foreach my $pkgpart ( $cgi->multi_param('pkgpart') ) { + + $pkgpart =~ /^(\d+)$/ + or die "illegal pkgpart: $pkgpart"; + + my $old_pkgpart = $1; + my $src_part_pkg = qsearchs('part_pkg', { 'pkgpart' => $old_pkgpart } ) + or die "unknown pkgpart: $old_pkgpart"; + + push @src_part_pkg, $src_part_pkg; + +} + </%init> diff --git a/httemplate/edit/cust_main-contacts.html b/httemplate/edit/cust_main-contacts.html index 3b7eb07d3..317257b3b 100644 --- a/httemplate/edit/cust_main-contacts.html +++ b/httemplate/edit/cust_main-contacts.html @@ -1,13 +1,35 @@ +<%doc> + +Hmm, this is now entirely redundant with edit/cust_main/contacts_new.html, and +this one isn't being maintained well. :/ + +</%doc> + +<SCRIPT> + function checkPasswordValidation(fieldid) { + var validationResult = document.getElementById(fieldid+'_result').innerHTML; + if (validationResult.match(/Password valid!/)) { + return true; + } + else { + return false; + } + } +</SCRIPT> + +<& '/elements/validate_password_js.html', &> + <& elements/edit.html, - 'name_singular' => 'customer contacts', #yes, we're editing all of them - 'table' => 'cust_main', - 'post_url' => popurl(1). 'process/cust_main-contacts.html', - 'no_pkey_display' => 1, - 'labels' => { - 'contactnum' => ' ', #'Contact', - #'locationnum' => ' ', - }, - 'fields' => [ + 'name_singular' => 'customer contacts', #yes, we're editing all of them + 'table' => 'cust_main', + 'post_url' => popurl(1). 'process/cust_main-contacts.html', + 'no_pkey_display' => 1, + 'submit_id' => 'submit', + 'labels' => { + 'contactnum' => ' ', #'Contact', + #'locationnum' => ' ', + }, + 'fields' => [ { 'field' => 'contactnum', 'type' => 'contact', 'colspan' => 6, @@ -18,11 +40,12 @@ 'm2_error_callback' => $m2_error_callback, }, ], - #'new_callback' => $new_callback, - #'edit_callback' => $edit_callback, - #'error_callback' => $error_callback, - 'agent_virt' => 1, - 'menubar' => [], #remove "view all" link + #'new_callback' => $new_callback, + #'edit_callback' => $edit_callback, + #'error_callback' => $error_callback, + 'agent_virt' => 1, + 'html_table_class' => 'fsinnerbox', + 'menubar' => [], #remove "view all" link #XXX it would be nice if this could instead be after the error but before # the table @@ -38,6 +61,13 @@ my $curuser = $FS::CurrentUser::CurrentUser; my $conf = new FS::Conf; +if ( $cgi->param('redirect') ) { + my $session = $cgi->param('redirect'); + my $pref = $curuser->option("redirect$session"); + die "unknown redirect session $session\n" unless length($pref); + $cgi = new CGI($pref); +} + my $custnum; if ( $cgi->param('error') ) { $custnum = scalar($cgi->param('custnum')); @@ -77,7 +107,7 @@ my $m2_error_callback = sub { my($cgi, $object) = @_; #process_o2m fields in process/cust_main-contacts.html - my @fields = qw( first last title comment ); + my @fields = FS::contact->cgi_contact_fields; my @gfields = ( '', map "_$_", @fields ); map { diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 05bf4377a..3cc55f348 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -111,7 +111,7 @@ function samechanged(what) { </SCRIPT> -<& cust_main/contacts_new.html, 'cust_main'=>$cust_main, &> +<& cust_main/contacts_new.html, 'cust_main'=>$cust_main, 'submit_id'=>'submitButton', &> %# billing info <& cust_main/billing.html, $cust_main, @@ -286,7 +286,7 @@ if ( $cgi->param('error') ) { $cust_main->paycvv($paycvv); } @invoicing_list = $cust_main->invoicing_list; - $ss = $conf->exists('unmask_ss') ? $cust_main->ss : $cust_main->masked('ss'); + $ss = $cust_main->masked('ss'); $stateid = $cust_main->masked('stateid'); } else { #new customer diff --git a/httemplate/edit/cust_main/contacts_new.html b/httemplate/edit/cust_main/contacts_new.html index 1171e7df4..90314258d 100644 --- a/httemplate/edit/cust_main/contacts_new.html +++ b/httemplate/edit/cust_main/contacts_new.html @@ -1,3 +1,17 @@ +<SCRIPT> + function checkPasswordValidation(fieldid) { + var validationResult = document.getElementById(fieldid+'_result').innerHTML; + if (validationResult.match(/Password valid!/)) { + return true; + } + else { + return false; + } + } +</SCRIPT> + +<& '/elements/validate_password_js.html', &> + <DIV ID="contacts_div" STYLE="display:<% $display %>"> <BR> <FONT CLASS="fsinnerbox-title">Contacts</FONT> @@ -5,6 +19,7 @@ 'embed' => $opt{cust_main}, 'table' => 'cust_main', 'agent_virt' => 1, + 'submit_id' => $opt{submit_id}, 'html_table_class' => 'fsinnerbox', 'labels' => { 'contactnum' => '', #'Contact', #'locationnum' => ' ', diff --git a/httemplate/edit/cust_main/name.html b/httemplate/edit/cust_main/name.html index 713f54cdb..0319cf027 100644 --- a/httemplate/edit/cust_main/name.html +++ b/httemplate/edit/cust_main/name.html @@ -1,7 +1,17 @@ <%def .namepart> -% my ($field, $value, $label, $extra) = @_; +% my ($field, $value, $label, $extra, $unmask_field) = @_; <DIV STYLE="display: inline-block" ID="<% $field %>_input"> <INPUT TYPE="text" NAME="<% $field %>" VALUE="<% $value |h %>" <%$extra%>> +% if ( +% $value +% && ref $unmask_field +% && $FS::CurrentUser::CurrentUser->access_right( $unmask_field->{access_right} ) +% ) { + <& /elements/link-replace_element_text.html, { + target_id => $unmask_field->{target_id}, + replace_text => $unmask_field->{replace_text}, + } &> +% } <BR><FONT SIZE="-1" COLOR="#333333"><% emt($label) %></FONT> </DIV> </%def> @@ -13,7 +23,11 @@ <& .namepart, 'first', $cust_main->first, 'First' &> % if ( $conf->exists('show_ss') ) { - <& .namepart, 'ss', $ss, 'SS#', "SIZE=11" &> + <& .namepart, 'ss', $ss, 'SS#', "SIZE=11 ID='ss'", { + target_id => 'ss', + replace_text => $cust_main->ss, + access_right => 'Unmask customer SSN', + } &> % } else { <INPUT TYPE="hidden" NAME="ss" VALUE="<% $ss %>"> % } @@ -47,7 +61,7 @@ my $agentnum = $cust_main->agentnum if $cust_main->custnum; my $conf = FS::Conf->new; my $ss; -if ( $cgi->param('error') or $conf->exists('unmask_ss') ) { +if ( $cgi->param('error') ) { $ss = $cust_main->ss; } else { $ss = $cust_main->masked('ss'); diff --git a/httemplate/edit/cust_main/stateid.html b/httemplate/edit/cust_main/stateid.html index 3500d631c..0f288099b 100644 --- a/httemplate/edit/cust_main/stateid.html +++ b/httemplate/edit/cust_main/stateid.html @@ -1,7 +1,12 @@ % if ( $conf->exists('show_stateid') ) { <TR> <TH ALIGN="right"><% $stateid_label %></TH> - <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $stateid %>" SIZE=12></TD> + <TD> + <INPUT TYPE="text" NAME="stateid" VALUE="<% $stateid %>" SIZE=12 ID="stateid"> +% if ( $stateid && $FS::CurrentUser::CurrentUser->access_right( 'Unmask customer DL' )) { + <& /elements/link-replace_element_text.html, {target_id => 'stateid', replace_text => $cust_main->stateid} &> +% } + </TD> <TD><& /elements/select-state.html, state => $cust_main->stateid_state, country => $cust_main->country, # how does this work on new customer? diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi index e1975ed70..f3dec98e1 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -34,7 +34,7 @@ % } <BR>Payment - <% ntable("#cccccc", 2) %> + <TABLE class="fsinnerbox"> <TR> <TD ALIGN="right">Amount</TD><TD BGCOLOR="#ffffff">$<% $cust_pay->paid %></TD> @@ -85,7 +85,8 @@ <BR>Refund -<% ntable("#cccccc", 2) %> + +<TABLE class="fsinnerbox"> <TR> <TD ALIGN="right">Date</TD> @@ -102,9 +103,23 @@ <TD ALIGN="right">Check #</TD> <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<% $payinfo %>" SIZE=10></TD> </TR> + </TABLE> % } -% elsif ($payby eq 'CHEK') { +% elsif ($payby eq 'CHEK' || $payby eq 'CARD') { % +<SCRIPT TYPE="text/javascript"> + function cust_payby_changed (what) { + var custpaybynum = what.options[what.selectedIndex].value + if ( custpaybynum == '' || custpaybynum == '0' ) { + //what.form.payinfo.disabled = false; + $('#cust_payby').slideDown(); + } else { + //what.form.payinfo.value = ''; + //what.form.payinfo.disabled = true; + $('#cust_payby').slideUp(); + } + } +</SCRIPT> % my @cust_payby = (); % if ( $payby eq 'CARD' ) { % @cust_payby = $cust_main->cust_payby('CARD','DCRD'); @@ -117,16 +132,58 @@ % my $custpaybynum = length(scalar($cgi->param('custpaybynum'))) % ? scalar($cgi->param('custpaybynum')) % : scalar(@cust_payby) && $cust_payby[0]->custpaybynum; -<& /elements/tr-select-cust_payby.html, + +% if ($cust_pay) { + <INPUT TYPE="hidden" NAME="payinfo" VALUE="<% $payinfo %>" SIZE=10> +% } +% else { + <& /elements/tr-select-cust_payby.html, 'cust_payby' => \@cust_payby, 'curr_value' => $custpaybynum, 'onchange' => 'cust_payby_changed(this)', -&> - <INPUT TYPE="hidden" NAME="batch" VALUE="1"> + &> +% } + +% if ( $conf->exists("batch-enable") +% || grep $payby eq $_, $conf->config('batch-enable_payby') +% ) { +% if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) { + <INPUT TYPE="hidden" NAME="batch" VALUE="1"> +% } else { + <TR> + <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="batch" VALUE="1" ID="batch" <% ($batchnum || $batch) ? 'checked' : '' %> ></TD> + <TH ALIGN="left"> <% mt('Add to current batch') |h %></TH> + </TR> +% } +% } + + </TABLE> +<P> + +% if ( !$cust_pay ) { +<DIV ID="cust_payby" + <% $custpaybynum ? 'STYLE="display:none"' + : '' + %> +> +<TABLE class="fsinnerbox"> + + <& /elements/cust_payby_new.html, + 'cust_payby' => \@cust_payby, + 'curr_value' => $custpaybynum, + &> + +</TABLE> +</DIV> +% } # end if cust_pay + % } else { <INPUT TYPE="hidden" NAME="payinfo" VALUE=""> + </TABLE> % } +<P> +<TABLE class="fsinnerbox"> <& /elements/tr-select-reason.html, 'field' => 'reasonnum', 'reason_class' => 'F', @@ -159,16 +216,18 @@ my $payby = $cgi->param('payby'); my $payinfo = $cgi->param('payinfo'); my $reason = $cgi->param('reason'); my $link = $cgi->param('popup') ? 'popup' : ''; +my $batch = $cgi->param('batch'); die "access denied" unless $FS::CurrentUser::CurrentUser->refund_access_right($payby); -my( $paynum, $cust_pay ) = ( '', '' ); +my( $paynum, $cust_pay, $batchnum ) = ( '', '', '' ); if ( $cgi->param('paynum') =~ /^(\d+)$/ ) { $paynum = $1; $cust_pay = qsearchs('cust_pay', { paynum=>$paynum } ) or die "unknown payment # $paynum"; $refund ||= $cust_pay->unrefunded; + $batchnum = $cust_pay->batchnum; if ( $custnum ) { die "payment # $paynum is not for specified customer # $custnum" unless $custnum == $cust_pay->custnum; diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 8ba703a2f..1d472099b 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -114,6 +114,9 @@ Example: #we're in a popup (no title/menu/searchboxes) 'popup' => 1, + #if you need to access the submit button + 'submit_id' => 'mysubmitbuttonid', + #we're embedded (rows only: no header at all, no html_init, no error # display, no <FORM>, no hidden fields for table name or primary key, no # display of primary key, no submit button, no html_foot, no footer) @@ -398,6 +401,8 @@ Example: % % my $layer_prefix_on = ''; % +% my $submitid = $opt{submit_id} ? $opt{submit_id} : ''; +% % my $include_sub = sub { % my %opt = @_; % @@ -422,6 +427,7 @@ Example: % 'field' => "$field$fieldnum", % 'id' => "$field$fieldnum", #separate? % 'label_id' => $field."_label$fieldnum", #don't want field0_label0... +% 'submit_id' => $submitid, % %include_common, % %opt, % ); @@ -669,7 +675,7 @@ Example: var newrow = <% include(@layer_opt, html_only=>1) |js_string %>; % #until the rest have html/js_only -% if ( ($type eq 'selectlayers') || ($type eq 'selectlayersx') || ($type =~ /^select-cgp_rule_/) ) { +% if ( ($type eq 'selectlayers') || ($type eq 'selectlayersx') || ($type =~ /^select-cgp_rule_/) || ($type eq 'contact') ) { var newfunc = <% include(@layer_opt, js_only=>1) |js_string %>; % } else { var newfunc = ''; diff --git a/httemplate/edit/elements/part_export/broadband_snmp_get.html b/httemplate/edit/elements/part_export/broadband_snmp_get.html index faf179acc..a426e617d 100644 --- a/httemplate/edit/elements/part_export/broadband_snmp_get.html +++ b/httemplate/edit/elements/part_export/broadband_snmp_get.html @@ -45,20 +45,23 @@ function receive_mib_get(obj, rownum) { </script> <table bgcolor="#cccccc" border=0 cellspacing=3> -<TR><TH>Object ID</TH></TR> +<TR><TH>Object Name</TH><TH>Object ID</TH></TR> <TR id="broadband_snmp_get_template"> <TD> + <INPUT NAME="oid_name" ID="oid_name" SIZE="25"> + </TD> + <TD> <INPUT NAME="oid" ID="oid" SIZE="54"> <INPUT TYPE="button" VALUE="..." ID="openselector" onclick="open_select_mib_get(this)"> </TD> </TR> <& /elements/auto-table.html, template_row => 'broadband_snmp_get_template', - fieldorder => ['oid'], + fieldorder => ['oid_name','oid'], data => \@data, table => 'snmp', &> -<INPUT TYPE="hidden" NAME="multi_options" VALUE="snmp_oid"> +<INPUT TYPE="hidden" NAME="multi_options" VALUE="snmp_oid,snmp_oid_name"> <& foot.html, %opt &> <%init> my %opt = @_; @@ -73,11 +76,13 @@ foreach my $field ( qw(snmp_version snmp_community snmp_timeout) ) { } my @oids = split("\n", $part_export->option('snmp_oid')); +my @oid_names = split("\n", $part_export->option('snmp_oid_name')); my @data; while (@oids) { my @thisrow = (shift(@oids)); - push @data, \@thisrow if grep length($_), @thisrow; + my $name = shift(@oid_names); + push @data, [$name, \@thisrow] if grep length($_), @thisrow; } my $popup_name = 'popup-'.time."-$$-".rand() * 2**32; diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 816f3428b..bdbce7c79 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -15,6 +15,7 @@ To be called from part_svc.cgi. # don't allow the 'inventory' flags (M, A) to be chosen for # fields that aren't free-text my $inv_sub = sub { $_[0]->{disable_inventory} || $_[0]->{type} ne 'text' }; + tie my %flag, 'Tie::IxHash', '' => { 'desc' => 'No default', 'condition' => sub { 0 } }, 'D' => { 'desc' => 'Default', @@ -38,6 +39,9 @@ tie my %flag, 'Tie::IxHash', 'H' => { 'desc' => 'Select from hardware class', 'condition' => sub { $_[0]->{type} ne 'select-hardware' }, }, + 'P' => { 'desc' => 'From package FCC 477 information', + 'condition' => sub { $_[0]->{type} ne 'fcc_477_speed' }, # get values from package fcc 477 information + }, 'X' => { 'desc' => 'Excluded', 'condition' => sub { 1 }, # obsolete }, @@ -202,6 +206,20 @@ my %communigate_fields = ( % $mode = 'hardware'; % $multiple = 0; % } +% +% if ( $def->{'type'} eq 'fcc_477_speed' ) { +% if ($field eq 'speed_up') { + <SPAN ID="<% $name %>_select"> + upstream speed + <INPUT TYPE="hidden" ID="<% $name %>_select" NAME="<% $name %>_classnum" VALUE="up"> + </SPAN> +% } elsif ($field eq 'speed_down') { + <SPAN ID="<% $name %>_select"> + downstream speed + <INPUT TYPE="hidden" ID="<% $name %>_select" NAME="<% $name %>_classnum" VALUE="down"> + </SPAN> +% } +% } else { <& /elements/select-table.html, 'field' => $name.'_classnum', 'id' => $name.'_select', @@ -211,6 +229,7 @@ my %communigate_fields = ( 'empty_label' => "Select $mode class", 'multiple' => $multiple, &> +% } % } </TD> <TD> diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index a4e345e40..e1c309080 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -169,6 +169,16 @@ ]; } # shouldn't this be enforced for all 'S' fields? + elsif ( $flag eq 'P' ) { #form fcc_477 values + $f->{type} = 'fixed'; + my $cust_pkg = FS::Record::qsearchs({ + 'table' => 'cust_pkg', + 'hashref' => { 'pkgnum' => $object->{Hash}->{pkgnum} } + }); + my $fcc_record = $cust_pkg->fcc_477_record('broadband_'.$columndef->columnvalue.'stream') if $cust_pkg; + $f->{'value'} = $fcc_record->{Hash}->{optionvalue} ? $fcc_record->{Hash}->{optionvalue} * 1000 : ''; + } # end 477 values + if ( $f->{'type'} =~ /^select-svc/ ) { $f->{'include_opt_callback'} = diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 5411feb5f..f6ec208be 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -290,6 +290,20 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= ' CHECKED' if $part_export->no_suspend eq 'Y'; $html .= '></TD></TR>'; + foreach my $script ( keys %{$exports->{$layer}{scripts}} ) { + $html .= '<TR><TD ALIGN="left" COLSPAN=2>' . + include('/elements/progress-init.html', + $part_export->exporttype, + [ $script.'_exportnum', $script.'_script' ], + rooturl().'view/svc_export/run_script.cgi', + rooturl().'edit/part_export.cgi?'.$part_export->{Hash}->{exportnum}, + $script, + ) . + '<INPUT TYPE="hidden" NAME="'.$script.'_exportnum" VALUE="'.$part_export->{Hash}->{exportnum}.'"> + <INPUT TYPE="hidden" NAME="'.$script.'_script" VALUE="'.$script.'"> + <A HREF="#" onClick="'.$script.'process();">'.$exports->{$layer}{scripts}{$script}->{html_label}.'</A></TD></TR>'; + } + $html .= '</TABLE>'; # false laziness with config_element above diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index fed21256f..49c1c03d8 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -107,7 +107,7 @@ function flag_changed(obj) { select.multiple = false; } } - } else if ( newflag == 'M' || newflag == 'A' || newflag == 'H' ) { + } else if ( newflag == 'M' || newflag == 'A' || newflag == 'H' || newflag == 'P' ) { // these all require a class selection if ( select ) { select.disabled = false; @@ -120,7 +120,7 @@ function flag_changed(obj) { } var required = document.getElementById(layer + '__' + field + '_required'); if (required && !required.disabledinit) { - if (newflag == "F") { + if (newflag == "F" || newflag =="P") { required.checked = false; required.disabled = true; } else { diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index fcd210f83..c27262017 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -11,7 +11,7 @@ 'target_table' => 'access_group', }, 'precheck_callback' => \&precheck_callback, - #'post_new_object_callback' => \&post_new_object_callback, + 'post_new_object_callback' => \&post_new_object_callback, 'noerror_callback' => \&noerror_callback, ) %> @@ -38,24 +38,22 @@ sub precheck_callback { return ''; } -#sub post_new_object_callback { -# my( $cgi, $access_user ) = @_; -# -# if ( length($cgi->param('_password')) ) { -# my $password = scalar($cgi->param('_password')); -# my $error = $access_user->is_password_allowed($password); -# #XXX and then bubble the error back up to the UI -# } -#} +sub post_new_object_callback { + my( $cgi, $access_user ) = @_; + + return '' unless length($cgi->param('_password')); + + my $password = scalar($cgi->param('_password')); + my $error = $access_user->is_password_allowed($password); + return $error if $error; + + $access_user->change_password_fields($password); + ''; +} sub noerror_callback { my( $cgi, $access_user ) = @_; - if ( length($cgi->param('_password')) ) { - my $password = scalar($cgi->param('_password')); - $access_user->change_password($password); - } - #handle installer checkbox my @sched_item = $access_user->sched_item; my $sched_item = $sched_item[0]; diff --git a/httemplate/edit/process/cust_main-contacts.html b/httemplate/edit/process/cust_main-contacts.html index 5b8319f5a..6b7f1c2db 100644 --- a/httemplate/edit/process/cust_main-contacts.html +++ b/httemplate/edit/process/cust_main-contacts.html @@ -8,7 +8,7 @@ </%doc> <% include('elements/process.html', 'table' => 'cust_main', - 'error_redirect' => popurl(3). 'edit/cust_main-contacts.html?', + 'error_redirect' => popurl(3). 'edit/cust_main-contacts.html', 'agent_virt' => 1, 'skip_process' => 1, #we don't want to make any changes to cust_main 'precheck_callback' => $precheck_callback, diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index 0a3d55036..1f96456e0 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -53,7 +53,7 @@ if ( $error ) { 'CHEK' => 'electronic check (ACH)', ); -my( $cust_payby, $payinfo, $paycvv, $month, $year, $payname ); +my( $cust_pay, $cust_payby, $payinfo, $paycvv, $month, $year, $payname ); my $paymask = ''; if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { @@ -71,6 +71,18 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { $paycvv = $cust_payby->paycvv; # pass it if we got it, running a transaction will clear it ( $month, $year ) = $cust_payby->paydate_mon_year; $payname = $cust_payby->payname; + $cgi->param(-name=>"paytype", -value=>$cust_payby->paytype) unless $cgi->param("paytype"); + +} elsif ( $cgi->param('paynum') > 0) { + + $cust_pay = qsearchs({ + 'table' => 'cust_pay', + 'hashref' => { 'paynum' => $cgi->param('paynum') }, + 'select' => 'cust_pay.*, cust_pay_batch.payname ', + 'addl_from' => "left join cust_pay_batch on cust_pay_batch.batchnum = cust_pay.batchnum and cust_pay_batch.custnum = $custnum ", + }); + $payinfo = $cust_pay->payinfo; + $payname = $cust_pay->payname; } else { @@ -192,16 +204,19 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { my $refund = "$1$2"; $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; my $paynum = $1; - my $paydate = $cgi->param('exp_year'). '-'. $cgi->param('exp_month'). '-01'; - $options{'paydate'} = $paydate if $paydate =~ /^\d{2,4}-\d{1,2}-01$/; + my $paydate; + unless ($paynum) { + if ($cust_payby->paydate) { $paydate = "$year-$month-01"; } + else { $paydate = "2037-12-01"; } + } if ( $cgi->param('batch') ) { - + $paydate = "2037-12-01" unless $paydate; $error ||= $cust_main->batch_card( 'payby' => $payby, 'amount' => $refund, 'payinfo' => $payinfo, - 'paydate' => "$year-$month-01", + 'paydate' => $paydate, 'payname' => $payname, 'paycode' => 'C', map { $_ => scalar($cgi->param($_)) } @@ -209,28 +224,23 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { ); errorpage($error) if $error; -#### post refund ##### my %hash = map { $_, scalar($cgi->param($_)) } fields('cust_refund'); - $paynum = $cgi->param('paynum'); - $paynum =~ /^(\d*)$/ or die "Illegal paynum!"; - if ($paynum) { - my $cust_pay = qsearchs('cust_pay',{ 'paynum' => $paynum }); - die "Could not find paynum $paynum" unless $cust_pay; - $error = $cust_pay->refund(\%hash); - } else { - my $new = new FS::cust_refund ( \%hash ); - $error = $new->insert; - } - # if not a batch refund run realtime. + + my $new = new FS::cust_refund ( { 'paynum' => $paynum, + %hash, + } ); + $error = $new->insert; + + # if not a batch refund run realtime. } else { $error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund, 'paynum' => $paynum, 'reasonnum' => scalar($cgi->param('reasonnum')), %options ); } -} else { +} else { # run cash refund. my %hash = map { $_, scalar($cgi->param($_)) } fields('cust_refund'); diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 76722c960..d2b037053 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -80,8 +80,12 @@ Example: 'precheck_callback' => sub { my( $cgi ) = @_; }, #after the new object is created + #return an error string or empty for no error 'post_new_object_callback' => sub { my( $cgi, $object ) = @_; }, + #run right before replacing (not run for inserts) + 'edit_callback' => sub { my( $new, $old ) = @_; }, + #after everything's inserted 'noerror_callback' => sub { my( $cgi, $object ) = @_; }, @@ -89,6 +93,9 @@ Example: # for use with tables that are FS::option_Common (among other things) 'args_callback' => sub { my( $cgi, $object ) = @_; }, + # if no errors after package insert or replace will update services attached to package. + 'update_svc' => sub { my( $cgi, $object ) = @_; }, + 'debug' => 1, #turns on debugging output #agent virtualization @@ -273,7 +280,7 @@ foreach my $value ( @values ) { } if ( $opt{'post_new_object_callback'} ) { - &{ $opt{'post_new_object_callback'} }( $cgi, $new ); + $error ||= &{ $opt{'post_new_object_callback'} }( $cgi, $new ); } if ( $opt{'agent_virt'} ) { @@ -438,6 +445,12 @@ foreach my $value ( @values ) { } } + if ( !$error and $opt{'update_svc'} ) { + my @args = (); + @args = &{ $opt{'args_callback'} }( $cgi, $new ) if $opt{'args_callback'}; + $error = &{ $opt{'update_svc'} }( $cgi, $new, @args ); + } + if ( $error ) { $cgi->param('error', $error); @@ -459,6 +472,14 @@ foreach my $value ( @values ) { } +if ($class eq "FS::tower") { + foreach my $part_svc_broadband_export ( FS::tower_sector->part_export_svc_broadband ) { + if ($part_svc_broadband_export and $part_svc_broadband_export->can('export_tower_sector')) { + $error = $part_svc_broadband_export->export_tower_sector($new); + } + } +} + # set up redirect URLs my $redirect; diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index c4d150ba1..376491089 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -9,6 +9,7 @@ 'edit_ext' => 'cgi', 'precheck_callback' => $precheck_callback, 'args_callback' => $args_callback, + 'update_svc' => $update_svc, 'process_locale' => 'pkg', 'process_m2m' => \@process_m2m, 'process_o2m' => \@process_o2m, @@ -199,6 +200,38 @@ my $args_callback = sub { }; +## update services upon package change. +my $update_svc = sub { + my $cgi = shift @_; + my $new = shift @_; + my %args = @_; + my $error; + + my @svcs = $new->pkg_svc(); + +## update broadband services getting their up and down speeds from package fcc_477 options + foreach my $svc_part(@svcs) { + my @part_svc_column = qsearch('part_svc_column',{ 'svcpart' => $svc_part->{Hash}->{svcpart}, 'columnflag' => 'P' }); + + if ($svc_part->{Hash}->{svcdb} eq "svc_broadband" && (keys %{ $args{fcc_options} }) && @part_svc_column ) { + ## find provisioned services to update + my @svc_svcdb = qsearch({ + 'table' => 'svc_broadband', + 'select' => 'svc_broadband.*, cust_svc.svcpart', + 'addl_from' => 'LEFT JOIN cust_svc USING (svcnum) LEFT JOIN cust_pkg USING (pkgnum)', + 'extra_sql' => " WHERE cust_svc.svcpart = '".$svc_part->{Hash}->{svcpart}."' AND cust_pkg.pkgpart = '".$svc_part->{Hash}->{pkgpart}."'", + }); + foreach my $svc (@svc_svcdb) { + next if ($svc->{Hash}->{speed_down} == $args{fcc_options}->{broadband_downstream} * 1000 && $svc->{Hash}->{speed_up} == $args{fcc_options}->{broadband_upstream} * 1000); + $svc->{Hash}->{speed_down} = $args{fcc_options}->{broadband_downstream} * 1000; + $svc->{Hash}->{speed_up} = $args{fcc_options}->{broadband_upstream} * 1000; + $error = $svc->replace(); + } + } + } + return $error; +}; + my $redirect_callback = sub { #my( $cgi, $new ) = @_; return '' unless $custnum; diff --git a/httemplate/edit/process/saved_search.html b/httemplate/edit/process/saved_search.html index 7ae7e0d78..51e40edad 100644 --- a/httemplate/edit/process/saved_search.html +++ b/httemplate/edit/process/saved_search.html @@ -10,6 +10,8 @@ my $callback = sub { $obj->usernum( $FS::CurrentUser::CurrentUser->usernum ); # if this would change it from its existing owner, replace_check # will refuse + + ''; #no error }; </%init> diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html index cfbb4ffa3..8f62c4bec 100644 --- a/httemplate/edit/process/tower.html +++ b/httemplate/edit/process/tower.html @@ -6,7 +6,7 @@ sectorname ip_addr height freq_mhz direction width downtilt v_width db_high db_low power line_loss antenna_gain hardware_typenum - sector_range + sector_range up_rate_limit down_rate_limit )], }, &> diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index 81c694aa5..bcf55fe11 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -100,7 +100,7 @@ END ; my @fields = ( - qw( description speed_down speed_up ), + qw( description speed_down speed_up speed_test_down speed_test_up speed_test_latency), { field=>'sectornum', type=>'select-tower_sector', }, { field=>'routernum', type=>'select-router_block_ip', include_opt_callback => sub { @@ -179,7 +179,6 @@ my $svc_field_callback = sub { my $columndef = $part_svc->part_svc_column($fieldref->{'field'}); if ($fieldref->{field} eq 'usergroup' && $columndef->columnflag eq 'F') { - $fieldref->{'formatted_value'} = [ $object->radius_groups('long_description') ]; } diff --git a/httemplate/edit/tower.html b/httemplate/edit/tower.html index 946a1405e..dfebc0031 100644 --- a/httemplate/edit/tower.html +++ b/httemplate/edit/tower.html @@ -13,6 +13,8 @@ 'altitude', 'height', 'veg_height', + 'up_rate_limit', + 'down_rate_limit', # { field => 'sectornum', # type => 'tower_sector', # o2m_table => 'tower_sector', @@ -35,6 +37,8 @@ 'height' => 'Tower height (feet)', 'veg_height' => 'Vegetation height (feet)', 'color' => 'Color', + 'up_rate_limit' => 'Up Rate Limit(Kbps)', + 'down_rate_limit' => 'Down Rate Limit(Kbps)', }, &> <%init> @@ -43,7 +47,7 @@ my $m2_error_callback = sub { # reconstruct the list my ($cgi, $object) = @_; my @fields = qw( - sectorname ip_addr height freq_mhz direction width tilt v_width db_high db_low sector_range + sectorname ip_addr height freq_mhz direction width tilt v_width db_high db_low sector_range up_rate_limit down_rate_limit ); map { |