diff options
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/cust_pkg-import.html | 8 | ||||
-rw-r--r-- | httemplate/misc/download-batch.cgi | 11 | ||||
-rw-r--r-- | httemplate/misc/edge_browser_check-fail_notice.html | 25 | ||||
-rw-r--r-- | httemplate/misc/edge_browser_check-header.html | 36 | ||||
-rw-r--r-- | httemplate/misc/edge_browser_check-iframe.html | 34 | ||||
-rw-r--r-- | httemplate/misc/payment.cgi | 249 | ||||
-rw-r--r-- | httemplate/misc/process/change-password.html | 17 | ||||
-rw-r--r-- | httemplate/misc/process/payment.cgi | 21 | ||||
-rwxr-xr-x | httemplate/misc/timeworked.html | 15 | ||||
-rw-r--r-- | httemplate/misc/xmlhttp-free_addresses_in_block.json.html | 18 | ||||
-rw-r--r-- | httemplate/misc/xmlhttp-validate_password.html | 4 |
11 files changed, 240 insertions, 198 deletions
diff --git a/httemplate/misc/cust_pkg-import.html b/httemplate/misc/cust_pkg-import.html index 3b200e5f3..da242a28f 100644 --- a/httemplate/misc/cust_pkg-import.html +++ b/httemplate/misc/cust_pkg-import.html @@ -36,6 +36,7 @@ Import a file containing customer packages. <OPTION VALUE="svc_acct">Account service <OPTION VALUE="svc_acct-agent_custid">Account service with agent_custid <OPTION VALUE="svc_acct-locationnum">Account service with existing location + <OPTION VALUE="svc_broadband">Broadband service <OPTION VALUE="svc_phone">Phone service <OPTION VALUE="svc_phone-agent_custid">Phone service with agent_custid <OPTION VALUE="svc_phone-locationnum">Phone service with existing location @@ -105,6 +106,9 @@ Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. <b>Account service with existing location</b> format has the following field order: <i>custnum<%$req%>, locationnum, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, username, _password, domsvc</i> <BR><BR> +<b>Broadband service</b> format has the following field order: <i>custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, ip_addr<%$req%>, description, routernum, blocknum, sectornum, speed_up, speed_down</i> +<BR><BR> + <b>Phone service</b> format has the following field order: <i>custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, countrycode, phonenum, sip_password, pin</i> <BR><BR> @@ -215,9 +219,9 @@ Field information: <li><i>quantity</i> - <li><i>setup_fee</i>: Including this fee implements per-customer custom pricing for this package, overriding package definition pricing + <li><i>setup_fee</i>: Including this implements per-customer custom pricing for this package, overriding package definition pricing - <li><i>recur_fee</i>: Including this fee implements per-customer custom pricing for this package, overriding package definition pricing + <li><i>recur_fee</i>: Including this implements per-customer custom pricing for this package, overriding package definition pricing <li><i>invoice_details</i>: Package invoice details (optionally, can include multiple lines of details separated by a vertical bar) diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index c4bc37e93..c6a0b68c3 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -20,9 +20,18 @@ elsif ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) { $opt{'format'} = $1; } -my $pay_batch = qsearchs('pay_batch', { batchnum => $batchnum } ); +my $credit_transactions = "EXISTS (SELECT 1 FROM cust_pay_batch WHERE batchnum = $batchnum AND paycode = 'C') AS arecredits"; +my $pay_batch = qsearchs({ 'select' => "*, $credit_transactions", + 'table' => 'pay_batch', + 'hashref' => { batchnum => $batchnum }, + }); die "Batch not found: '$batchnum'" if !$pay_batch; +if ($pay_batch->{Hash}->{arecredits}) { + my $export_format = "FS::pay_batch::".$opt{'format'}; + die "This format can not handle refunds." unless $export_format->can('can_handle_credits'); +} + my $exporttext = $pay_batch->export_batch(%opt); unless ($exporttext) { http_header('Content-Type' => 'text/html' ); diff --git a/httemplate/misc/edge_browser_check-fail_notice.html b/httemplate/misc/edge_browser_check-fail_notice.html new file mode 100644 index 000000000..fb42ffe8e --- /dev/null +++ b/httemplate/misc/edge_browser_check-fail_notice.html @@ -0,0 +1,25 @@ +<& /elements/header.html, "Edge browser bug" &> + +<div id="edgebug" style="border: solid 1px #888; border-radius: 4px; margin: 5em; max-width: 400px; text-align: left; padding: 0 1em; background-color: #ffe; box-shadow: 2px 2px 4px"> + <div style="text-align: center; font-size: 3em; color: #933; text-shadow: 1px 1px 2px black;"> + ⚠ + </div> + <h4 style="border-bottom: solid 1px #888; margin: 1em 0; text-align: center;"> + Edge Browser Bug + </h4> + <p> + Your copy of Microsoft Edge has a data corrupting bug. + </p> + <p> + Microsoft fixed this bug with the <b>July RS4 Windows 10 Update</b>. + Please update your copy of Windows. + </p> + <p> + Alternatively, you may choose to use + <a href="https://mozilla.org/en-US/firefox/new/">Mozilla Firefox</a> + or <a href="https://chrome.google.com">Google Chrome</a>. They + are not affected by this bug. + </p> +</div> + +<& /elements/footer.html &>
\ No newline at end of file diff --git a/httemplate/misc/edge_browser_check-header.html b/httemplate/misc/edge_browser_check-header.html new file mode 100644 index 000000000..a88962be9 --- /dev/null +++ b/httemplate/misc/edge_browser_check-header.html @@ -0,0 +1,36 @@ +% if ( $force_redirect ) { + <script type="text/javascript"> + if ( <% $DEBUG %> || /Edge\/17\.17134/.test( navigator.userAgent )) { + if ( window.location.href.indexOf("fail_notice") == -1 ) { + window.location.href = "<% $fsurl %>misc/edge_browser_check-fail_notice.html"; + } + } + </script> +% } elsif ( $do_check ) { + <iframe id="edge_browser_check_iframe" style="display:none;"></iframe> + <script type="text/javascript"> + if ( <% $DEBUG %> || /Edge\/17\.17134/.test( navigator.userAgent )) { + $("#edge_browser_check_iframe").attr( + 'src', + '<% $fsurl %>misc/edge_browser_check-iframe.html?edge_browser_check=1' + ); + } + </script> +% } +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +my $session = $FS::CurrentUser::CurrentSession; +my $sessionkey = $session->sessionkey if $session; + +my $cgi = FS::UID::cgi(); +my $DEBUG = 0; + +my $do_check = 0; +$do_check = 1 + if $curuser + && !$cgi->param('edge_browser_check') + && $sessionkey + && $curuser->get_pref('edge_bug_vulnerable') ne $sessionkey; + +my $force_redirect = $curuser->get_pref('edge_bug_vulnerable') eq 'Y' ? 1 : 0; +</%init> diff --git a/httemplate/misc/edge_browser_check-iframe.html b/httemplate/misc/edge_browser_check-iframe.html new file mode 100644 index 000000000..61ae9a0bd --- /dev/null +++ b/httemplate/misc/edge_browser_check-iframe.html @@ -0,0 +1,34 @@ +<form id="canary-form" action="<% $fsurl %>misc/edge_browser_check-iframe.html" method="POST"> +<input type="text" id="canary-result" value="<% scalar $cgi->param('edge_browser_canary') %>"> +<select name="edge_browser_canary"> + <option>test + <option>test +</select> +<input id="canary-submit" type="submit"> +</form> + +<script type="text/javascript" src="<% $fsurl %>elements/jquery.js"></script> +<script type="text/javascript"> + $( function() { + if ( ! $("#canary-result").val() ) { + $("#canary-form").submit(); + } + }); +</script> + +<%init> +my $cgi = FS::UID::cgi(); +my $curuser = $FS::CurrentUser::CurrentUser; +my $session = $FS::CurrentUser::CurrentSession; +my $sessionkey = $session->sessionkey if $session; + +if ( $curuser ) { + my $canary = $cgi->param('edge_browser_canary'); + $curuser->set_pref( + 'edge_bug_vulnerable', + + $canary eq 'test' ? $sessionkey : 'Y', + ); +} + +</%init>
\ No newline at end of file diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 5bfa29d70..77f5acd6a 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -13,8 +13,7 @@ <TABLE class="fsinnerbox"> <& /elements/tr-select-payment_options.html, - 'custnum' => $cust_main->custnum, - 'amount' => $balance, + 'cust_main' => $cust_main, 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), 'process-display' => scalar($conf->config('manual_process-display')), @@ -25,6 +24,11 @@ ? scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum)) : 0 ), + 'surcharge_flatfee' => + ( $payby eq 'CARD' + ? scalar($conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum)) + : 0 + ), &> % if ( $conf->exists('part_pkg-term_discounts') ) { @@ -97,6 +101,11 @@ function change_batch_checkbox () { $('#cust_payby').slideUp(); } } + + function enableAmountField() { + document.getElementById('amount').disabled = false; + } + </SCRIPT> % #can't quite handle CARD/CHEK on the same page yet, but very close @@ -130,186 +139,58 @@ function change_batch_checkbox () { > <TABLE class="fsinnerbox"> -% my $auto = 0; -% if ( $payby eq 'CARD' ) { -% -% my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' ); -% my $payname = $cust_main->first. ' '. $cust_main->getfield('last'); -% my $location = $cust_main->bill_location; - - <TR> - <TH ALIGN="right"><% mt('Card number') |h %></TH> - <TD COLSPAN=7> - <TABLE> - <TR> - <TD> - <INPUT TYPE="text" NAME="payinfo" SIZE=20 MAXLENGTH=19 VALUE="<%$payinfo%>"> </TD> - <TH><% mt('Exp.') |h %></TH> - <TD> - <SELECT NAME="month"> -% for ( ( map "0$_", 1 .. 9 ), 10 .. 12 ) { - - <OPTION<% $_ == $month ? ' SELECTED' : '' %>><% $_ %> -% } - - </SELECT> - </TD> - <TD> / </TD> - <TD> - <SELECT NAME="year"> -% my @a = localtime; for ( $a[5]+1900 .. $a[5]+1915 ) { - - <OPTION<% $_ == $year ? ' SELECTED' : '' %>><% $_ %> -% } - - </SELECT> - </TD> - </TR> - </TABLE> - </TD> - </TR> - <TR> - <TH ALIGN="right"><% mt('CVV2') |h %></TH> - <TD><INPUT TYPE="text" NAME="paycvv" VALUE="<% $paycvv %>" SIZE=4 MAXLENGTH=4> - (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;"><% mt('help') |h %></A>) - </TD> - </TR> - <TR> - <TH ALIGN="right"><% mt('Exact name on card') |h %></TH> - <TD><INPUT TYPE="text" SIZE=32 MAXLENGTH=80 NAME="payname" VALUE="<%$payname%>"></TD> - </TR> - - <& /elements/location.html, - 'object' => $location, - 'no_asterisks' => 1, - 'address1_label' => emt('Card billing address'), - &> - -% } elsif ( $payby eq 'CHEK' ) { -% -% my( $account, $aba, $branch, $payname, $ss, $paytype, $paystate, -% $stateid, $stateid_state ) -% = ( '', '', '', '', '', '', '', '', '' ); -% -% #false laziness w/{edit,view}/cust_main/billing.html -% my $routing_label = $conf->config('echeck-country') eq 'US' -% ? 'ABA/Routing number' -% : 'Routing number'; -% my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10; -% my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9; - - <INPUT TYPE="hidden" NAME="month" VALUE="12"> - <INPUT TYPE="hidden" NAME="year" VALUE="2037"> - <TR> - <TD ALIGN="right"><% mt('Account number') |h %></TD> - <TD><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="<%$account%>"></TD> - <TD ALIGN="right"><% mt('Type') |h %></TD> - <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } FS::cust_payby->paytypes) %></SELECT></TD> - </TR> - <TR> - <TD ALIGN="right"><% mt($routing_label) |h %></TD> - <TD> - <INPUT TYPE="text" SIZE="<% $routing_size %>" MAXLENGTH="<% $routing_maxlength %>" NAME="payinfo2" VALUE="<%$aba%>"> - (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;"><% mt('help') |h %></A>) - </TD> - </TR> -% if ( $conf->config('echeck-country') eq 'CA' ) { - <TR> - <TD ALIGN="right"><% mt('Branch number') |h %></TD> - <TD> - <INPUT TYPE="text" NAME="payinfo3" VALUE="<%$branch%>" SIZE=6 MAXLENGTH=5> - </TD> - </TR> -% } - <TR> - <TD ALIGN="right"><% mt('Bank name') |h %></TD> - <TD><INPUT TYPE="text" NAME="payname" VALUE="<%$payname%>"></TD> - </TR> - -% if ( $conf->exists('show_bankstate') ) { - <TR> - <TD ALIGN="right"><% mt('Bank state') |h %></TD> - <TD><& /elements/select-state.html, - 'disable_empty' => 0, - 'empty_label' => emt('(choose)'), - 'state' => $paystate, - 'country' => $cust_main->country, - 'prefix' => 'pay', - &> - </TD> - </TR> -% } else { - <INPUT TYPE="hidden" NAME="paystate" VALUE="<% $paystate %>"> -% } - -% if ( $conf->exists('show_ss') ) { - <TR> - <TD ALIGN="right"> - <% mt('Account holder') |h %><BR> - <% mt('Social security or tax ID #') |h %> - </TD> - <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $ss %>"></TD> - </TR> -% } else { - <INPUT TYPE="hidden" NAME="ss" VALUE="<% $ss %>"></TD> -% } - -% if ( $conf->exists('show_stateid') ) { - <TR> - <TD ALIGN="right"> - <% mt('Account holder') |h %><BR> - <% mt("Driver's license or state ID #") |h %> - </TD> - <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $stateid %>"></TD> - <TD ALIGN="right"><% mt('State') |h %></TD> - <TD><& /elements/select-state.html, - 'disable_empty' => 0, - 'empty_label' => emt('(choose)'), - 'state' => $stateid_state, - 'country' => $cust_main->country, - 'prefix' => 'stateid_', - &> - </TD> - </TR> -% } else { - <INPUT TYPE="hidden" NAME="stateid" VALUE="<% $stateid %>"> - <INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $stateid_state %>"> -% } - -% } #end CARD/CHEK-specific section - - -<TR> - <TD COLSPAN=8> - <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1"> - <% mt('Remember this information') |h %> - </TD> -</TR> - -<TR> - <TD COLSPAN=8> - <INPUT TYPE="checkbox"<% $auto ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> - <% mt("Charge future payments to this [_1] automatically",$type{$payby}) |h %> -% if ( @cust_payby ) { - <% mt('as') |h %> - <SELECT NAME="weight"> -% for ( 1 .. 1+scalar(grep { $_->payby =~ /^(CARD|CHEK)$/ } @cust_payby) ) { - <OPTION VALUE="<%$_%>"><% mt( $weight{$_} ) |h %> -% } - </SELECT> -% } else { - <INPUT TYPE="hidden" NAME="weight" VALUE="1"> -% } - </TD> -</TR> +<& /elements/cust_payby_new.html, + 'cust_payby' => \@cust_payby, + 'curr_value' => $custpaybynum, +&> </TABLE> </DIV> <BR> -<INPUT TYPE="submit" NAME="process" VALUE="<% mt('Process payment') |h %>"> +<INPUT TYPE="submit" NAME="process" ID="process" VALUE="<% mt('Process payment') |h %>" disabled="disabled" onclick="enableAmountField()"> </FORM> +<SCRIPT TYPE="text/javascript"> + +$(document).ready(function (){ + validate(); + $('<% $validate_select_fields %>').change(validate); + $('<% $validate_input_fields %>').keyup(validate); +}); + +function validate(){ + if ( + $('#amount').val() > 0 && ( + ( $('#custpaybynum').val() > 0 ) || +% if ($payby eq "CHEK") { + ( $('input[name=payinfo1]').val().length > 0 && + $('input[name=payinfo2]').val().length > 0 && + $('input[name=payname]').val().length > 0 && + $('select[name=paytype]').val().length > 0 + ) +% } +% elsif ($payby eq "CARD") { + ( $('input[name=payinfo]').val().length > 0 && + $('input[name=paycvv]').val().length > 0 && + $('input[name=payname]').val().length > 0 && + $('#city').val().length > 0 && + $('#city').val().length > 0 && + $('#state').val().length > 0 && + $('#country').val().length > 0 + ) +% } + ) + ) { + $("#process").prop("disabled", false); + } + else { + $("#process").prop("disabled", true); + } +} + +</SCRIPT> + <& /elements/footer-cust_main.html &> <%once> @@ -337,6 +218,17 @@ $cgi->param('payby') =~ /^(CARD|CHEK)$/ or die "unknown payby ". $cgi->param('payby'); my $payby = $1; +my $validate_select_fields = "#payment_option, #invoice, #custpaybynum, "; +my $validate_input_fields = "#amount, input[name=payname], "; +if ($payby eq "CHEK") { + $validate_input_fields .= "input[name=payinfo1], input[name=payinfo2]"; + $validate_select_fields .= "select[name=paytype] "; +} +elsif ($payby eq "CARD") { + $validate_input_fields .= "input[name=payinfo], input[name=paycvv], input[name=address1], #city, #zip"; + $validate_select_fields .= "#state, #country "; +} + $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum ". $cgi->param('custnum'); my $custnum = $1; @@ -350,13 +242,6 @@ my $payinfo = ''; my $conf = new FS::Conf; -#false laziness w/selfservice make_payment.html shortcut for one-country -my %states = map { $_->state => 1 } - qsearch('cust_main_county', { - 'country' => $conf->config('countrydefault') || 'US' - } ); -my @states = sort { $a cmp $b } keys %states; - my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; </%init> diff --git a/httemplate/misc/process/change-password.html b/httemplate/misc/process/change-password.html index a3e060168..1c746a4e0 100644 --- a/httemplate/misc/process/change-password.html +++ b/httemplate/misc/process/change-password.html @@ -18,7 +18,15 @@ <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %> % } % elsif ($contactnum) { - <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %> +% my $freeside_status = "Contact ".$contact->{'Hash'}->{'first'}." ".$contact->{'Hash'}->{'last'}." password updated."; + <% $cgi->redirect( -uri => popurl(3). "view/cust_main.cgi?". $cgi->param('custnum'), + -cookie => CGI::Cookie->new( + -name => 'freeside_status', + -value => mt($freeside_status), + -expires => '+5m', + ), + ) +%> % } % } @@ -30,10 +38,15 @@ <%init> my $curuser = $FS::CurrentUser::CurrentUser; +my $contact; $cgi->param('svcnum') =~ /^(\d+)$/ or die "illegal svcnum" if $cgi->param('svcnum'); my $svcnum = $1; +foreach my $prefix (grep /^(.*)(password)$/, $cgi->param) { + $cgi->param('password' => $cgi->param($prefix)); +} + $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum'); my $contactnum = $1; @@ -61,7 +74,7 @@ if ($svcnum) { $cgi->delete('password'); } elsif ($contactnum) { - my $contact = qsearchs('contact', { 'contactnum' => $contactnum } ) + $contact = qsearchs('contact', { 'contactnum' => $contactnum } ) or return { 'error' => "Contact not found" . $contactnum }; $error = $contact->is_password_allowed($newpass) diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 717d57c85..7747bcbea 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -39,6 +39,8 @@ my $cust_main = qsearchs({ 'extra_sql' => ' AND '. $curuser->agentnums_sql, }) or die "unknown custnum $custnum"; +my $invoice = ($cgi->param('invoice') =~ /^(\d+)$/) ? $cgi->param('invoice') : ''; + $cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/ or errorpage("illegal amount ". $cgi->param('amount')); my $amount = $1; @@ -90,6 +92,7 @@ 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"); } else { @@ -97,11 +100,11 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { # use new info ## - $cgi->param('year') =~ /^(\d+)$/ + $cgi->param('year') =~ /^(\d{4})/ or errorpage("illegal year ". $cgi->param('year')); $year = $1; - $cgi->param('month') =~ /^(\d+)$/ + $cgi->param('month') =~ /^(\d{2})/ or errorpage("illegal month ". $cgi->param('month')); $month = $1; @@ -208,17 +211,28 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { my $error = ''; my $paynum = ''; + if ( $cgi->param('batch') ) { $error = 'Prepayment discounts not supported with batched payments' if $discount_term; + # Invalid payment expire dates are replaced with 2037-12-01 (why?) + my $paydate = "${year}-${month}-01"; + { + use DateTime; + local $@; + eval { DateTime->new({ year => $year, month => $month, day => 1 }) }; + $paydate = '2037-12-01' if $@; + } + $error ||= $cust_main->batch_card( 'payby' => $payby, 'amount' => $amount, 'payinfo' => $payinfo, - 'paydate' => "$year-$month-01", + 'paydate' => $paydate, 'payname' => $payname, + 'invnum' => $invoice, map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}} ); @@ -241,6 +255,7 @@ if ( $cgi->param('batch') ) { 'discount_term' => $discount_term, 'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '', 'no_invnum' => 1, + 'invnum' => $invoice, map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}} ); errorpage($error) if $error; diff --git a/httemplate/misc/timeworked.html b/httemplate/misc/timeworked.html index a0cf74371..24a0f5d40 100755 --- a/httemplate/misc/timeworked.html +++ b/httemplate/misc/timeworked.html @@ -113,12 +113,15 @@ foreach my $id ( map { /^transactionid(\d+)$/; $1; } $ticket->Load($ticketmap{$id}); $ticket{$ticketmap{$id}} = $ticket->Subject; $customers{$ticketmap{$id}} = - [ map { $_->Resolver->AsString } - grep { $_->Resolver->{'fstable'} eq 'cust_main' } - grep { $_->Scheme eq 'freeside' } - map { $_->TargetURI } - @{ $ticket->_Links('Base')->ItemsArrayRef } - ]; + [ map { $_->Resolver->AsString } + grep { $_->Resolver->{'fstable'} eq 'cust_main' } + grep { $_->Scheme eq 'freeside' } + map { $_->TargetURI } + grep { $_->BaseURI->Scheme eq 'fsck.com-rt' + && $_->BaseURI->Resolver->ObjectType eq 'ticket' + } + @{ $ticket->_Links('Base')->ItemsArrayRef } + ]; } } diff --git a/httemplate/misc/xmlhttp-free_addresses_in_block.json.html b/httemplate/misc/xmlhttp-free_addresses_in_block.json.html new file mode 100644 index 000000000..801718d35 --- /dev/null +++ b/httemplate/misc/xmlhttp-free_addresses_in_block.json.html @@ -0,0 +1,18 @@ +<%doc> + Return a json array containing all free ip addresses within a given block + Unless block is larger than /24 - Does somebody really want to populate + 65k addresses into a HTML selectbox? +</%doc> +<% encode_json($json) %>\ +<%init> + +my $json = []; + +my $blocknum = $cgi->param('blocknum'); + +my $addr_block = qsearchs( addr_block => { blocknum => $blocknum }); + +$json = $addr_block->free_addrs + if ref $addr_block && $addr_block->ip_netmask >= 24; + +</%init> diff --git a/httemplate/misc/xmlhttp-validate_password.html b/httemplate/misc/xmlhttp-validate_password.html index 4d9716bb9..c53abe883 100644 --- a/httemplate/misc/xmlhttp-validate_password.html +++ b/httemplate/misc/xmlhttp-validate_password.html @@ -28,14 +28,14 @@ my $validate_password = sub { $result{'syserror'} = 'Invoked without password' unless $password; return \%result if $result{'syserror'}; - if ($arg{'contactnum'}) { + if ($arg{'contactnum'} =~ /^\d+$/) { my $contactnum = $arg{'contactnum'}; $result{'syserror'} = 'Invalid contactnum' unless $contactnum =~ /^\d*$/; return \%result if $result{'syserror'}; my $contact = $contactnum ? qsearchs('contact',{'contactnum' => $contactnum}) - : ''; + : (new FS::contact {}); $result{'error'} = $contact->is_password_allowed($password); } |