diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-10-04 20:25:37 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-10-04 20:25:37 -0700 |
| commit | 0af38652da3b3be7da2d35b048285ef6f2194e1a (patch) | |
| tree | c43e871e406a11ad9ddca7f5af225f8e5e507000 /httemplate/misc | |
| parent | a8e1cb65cd92239721b8e81ef9fdf99f60fb3c3c (diff) | |
| parent | 51b5bd15c154065a9a0f521565bd6187609c8348 (diff) | |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/misc')
| -rw-r--r-- | httemplate/misc/cust_main-import.cgi | 6 | ||||
| -rw-r--r-- | httemplate/misc/order_pkg.html | 64 | ||||
| -rw-r--r-- | httemplate/misc/payment.cgi | 26 | ||||
| -rwxr-xr-x | httemplate/misc/process/void-cust_bill.html | 26 | ||||
| -rwxr-xr-x | httemplate/misc/timeworked.html | 2 | ||||
| -rwxr-xr-x | httemplate/misc/unvoid-cust_bill_void.html | 25 | ||||
| -rwxr-xr-x | httemplate/misc/unvoid-cust_pay_void.cgi | 2 | ||||
| -rw-r--r-- | httemplate/misc/void-cust_bill.html | 45 | ||||
| -rwxr-xr-x | httemplate/misc/void-cust_pay.cgi | 2 | ||||
| -rw-r--r-- | httemplate/misc/xmlhttp-cust_main-search.cgi | 2 |
10 files changed, 161 insertions, 39 deletions
diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 74f9b4c89..d56feaccf 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -36,6 +36,7 @@ Import a file containing customer records. <OPTION VALUE="svc_external">External service <OPTION VALUE="svc_external_svc_phone">External service and phone service <OPTION VALUE="birthdates-acct_phone_hardware">Birthdates and account, phone and hardware services + <OPTION VALUE="national_id-acct_phone">National ID, plus account and phone services </SELECT> </TD> </TR> @@ -110,6 +111,9 @@ Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. <b>Birthdates and account, phone and hardware services</b> format has the following field order: <i>agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, birthdate, spouse_birthdate, payinfo, paycvv, paydate, invoicing_list, pkgpart, next_bill_date, username, _password, countrycode, phonenum, sip_password, pin, typenum, ip_addr, hw_addr, serial</i> <BR><BR> +<b>National ID, plus account and phone services</b> format has the following field order: <i>agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, national_id, payinfo, paycvv, paydate, invoicing_list, pkgpart, next_bill_date, username, _password, slipip, countrycode, phonenum, sip_password, pin</i> +<BR><BR> + <%$req%> Required fields <BR><BR> @@ -135,6 +139,8 @@ advertising source table. <li><i>username</i> and <i>_password</i> are required if <i>pkgpart</i> is specified. (Extended and Extended plus company formats) + <li><i>slipip</i>: IP address + <li><i>id</i>: External service id, integer <li><i>title</i>: External service identifier, text diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 7aa024a34..c5f4509ab 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -1,4 +1,6 @@ -<& /elements/header-popup.html, mt('Order new package') &> +<& /elements/header-popup.html, $quotationnum ? mt('Add package to quotation') + : mt('Order new package') +&> <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2"> <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT> @@ -11,8 +13,10 @@ <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST"> -<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main->custnum %>"> +<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main ? $cust_main->custnum : '' %>"> +<INPUT TYPE="hidden" NAME="prospectnum" VALUE="<% $prospect_main ? $prospect_main->prospectnum : '' %>"> <INPUT TYPE="hidden" NAME="qualnum" VALUE="<% scalar($cgi->param('qualnum')) |h %>"> +<INPUT TYPE="hidden" NAME="quotationnum" VALUE="<% $quotationnum %>"> % if ( $svcpart ) { <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>"> % } @@ -26,9 +30,10 @@ </TR> % } else { <& /elements/tr-select-cust-part_pkg.html, - 'curr_value' => $pkgpart, - 'classnum' => -1, - 'cust_main' => $cust_main, + 'curr_value' => $pkgpart, + 'classnum' => -1, + 'cust_main' => $cust_main, + 'prospect_main' => $prospect_main, &> % } @@ -39,6 +44,8 @@ <INPUT TYPE="text" NAME="quantity" SIZE=4 VALUE="<% $quantity %>"> </TD> </TR> +% } else { + <INPUT TYPE="hidden" NAME="quantity" VALUE="1"> % } <TR> @@ -54,7 +61,7 @@ </TD> </TR> -% if ( $cust_main->payby =~ /^(CARD|CHEK)$/ ) { +% if ( $cust_main && $cust_main->payby =~ /^(CARD|CHEK)$/ ) { % my $what = lc(FS::payby->shortname($cust_main->payby)); <TR> <TH ALIGN="right"><% mt("Disable automatic $what charge") |h %> </TH> @@ -97,8 +104,9 @@ % } else { <& /elements/tr-select-cust_location.html, - 'cgi' => $cgi, - 'cust_main' => $cust_main, + 'cgi' => $cgi, + 'cust_main' => $cust_main, + 'prospect_main' => $prospect_main, &> % } @@ -152,20 +160,42 @@ die "access denied" my $conf = new FS::Conf; my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -$cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum"; -my $custnum = $1; -my $cust_main = qsearchs({ - 'table' => 'cust_main', - 'hashref' => { 'custnum' => $custnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -}); +my $cust_main = ''; +if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + my $custnum = $1; + $cust_main = qsearchs({ + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $custnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, + }); +} + +my $prospect_main = ''; +if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) { + my $prospectnum = $1; + $prospect_main = qsearchs({ + 'table' => 'prospect_main', + 'hashref' => { 'prospectnum' => $prospectnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, + }); +} + +my $quotationnum = ''; +if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) { + $quotationnum = $1; +} + +die 'no custnum or prospectnum' unless $cust_main || $prospect_main; my $part_pkg = ''; if ( $cgi->param('lock_pkgpart') ) { $part_pkg = qsearchs({ 'table' => 'part_pkg', 'hashref' => { 'pkgpart' => scalar($cgi->param('lock_pkgpart')) }, - 'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ), + 'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql( + $cust_main ? $cust_main->agent + : $prospect_main->agent + ), }) or die "unknown pkgpart ". $cgi->param('lock_pkgpart'); } @@ -179,7 +209,7 @@ if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) { my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi? my $start_date = ''; -if( ! $conf->exists('order_pkg-no_start_date') ) { +if( ! $conf->exists('order_pkg-no_start_date') && $cust_main ) { $start_date = $cust_main->next_bill_date; $start_date = $start_date ? time2str($format, $start_date) : ''; } diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 1ae15b930..5b9f63dc0 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -12,11 +12,12 @@ <& /elements/tr-amount_fee.html, 'amount' => $amount, - 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart')), + 'process-pkgpart' => + scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), 'process-display' => scalar($conf->config('manual_process-display')), - 'process-skip-first' => $conf->exists('manual_process-skip_first'), + 'process-skip_first' => $conf->exists('manual_process-skip_first'), 'num_payments' => scalar($cust_main->cust_pay), - 'post_fee_callback' => $post_fee_callback, + 'surcharge_percentage' => scalar($conf->config('credit-card-surcharge-percentage')), &> <& /elements/tr-select-discount_term.html, @@ -78,7 +79,7 @@ </TR> <& /elements/location.html, - 'object' => $cust_main, #XXX errors??? + 'object' => $cust_main->bill_location, 'no_asterisks' => 1, 'address1_label' => emt('Card billing address'), &> @@ -251,6 +252,10 @@ my $custnum = $1; my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } ); die "unknown custnum $custnum" unless $cust_main; +my $location = $cust_main->bill_location; +# no proper error handling on this anyway, but when we have it, +# remember to repopulate fields in $location + my $balance = $cust_main->balance; my $payinfo = ''; @@ -269,19 +274,6 @@ if ( $balance > 0 ) { $amount = $balance; } -my $post_fee_callback = sub { - my( $amountref ) = @_; - - return unless $$amountref > 0; - - my $conf = new FS::Conf; - - my $cc_surcharge_pct = $conf->config('credit-card-surcharge-percentage'); - $$amountref += $$amountref * $cc_surcharge_pct/100 if $cc_surcharge_pct > 0; - - $$amountref = sprintf("%.2f", $$amountref); -}; - my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; </%init> diff --git a/httemplate/misc/process/void-cust_bill.html b/httemplate/misc/process/void-cust_bill.html new file mode 100755 index 000000000..899901a50 --- /dev/null +++ b/httemplate/misc/process/void-cust_bill.html @@ -0,0 +1,26 @@ +%if ( $error ) { +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(1). "void-cust_bill.html?". $cgi->query_string ) %> +%} else { +<& /elements/header-popup.html, 'Invoice voided' &> +<SCRIPT TYPE="text/javascript"> + window.top.location.reload(); +</SCRIPT> +</BODY></HTML> +%} +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Void invoices'); + +#untaint invnum +$cgi->param('invnum') =~ /^(\d+)$/ || die "Illegal invnum"; +my $invnum = $1; + +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); + +my $custnum = $cust_bill->custnum; + +my $error = $cust_bill->void( $cgi->param('reason') ); + +</%init> diff --git a/httemplate/misc/timeworked.html b/httemplate/misc/timeworked.html index 672fad8d6..e4392825c 100755 --- a/httemplate/misc/timeworked.html +++ b/httemplate/misc/timeworked.html @@ -99,8 +99,6 @@ my(%ticketmap, %ticket, %customers); my $title = 'Assign Time Worked'; tie %ticketmap, 'Tie::IxHash'; -RT::Init(); - my $CurrentUser = RT::CurrentUser->new(); $CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username); diff --git a/httemplate/misc/unvoid-cust_bill_void.html b/httemplate/misc/unvoid-cust_bill_void.html new file mode 100755 index 000000000..f61416549 --- /dev/null +++ b/httemplate/misc/unvoid-cust_bill_void.html @@ -0,0 +1,25 @@ +%if ( $error ) { +% errorpage($error); +%} else { +% my $show = $curuser->default_customer_view =~ /^(jumbo|payment_history)$/ +% ? '' +% : ';show=payment_history'; +<% $cgi->redirect($p. "view/cust_main.cgi?custnum=$custnum$show" ) %> +%} +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Unvoid invoices'); + +#untaint invnum +$cgi->param('invnum') =~ /^(\d+)$/ || die "Illegal invnum"; +my $invnum = $1; + +my $cust_bill_void = qsearchs('cust_bill_void', { 'invnum' => $invnum } ); +my $custnum = $cust_bill_void->custnum; + +my $error = $cust_bill_void->unvoid; + +</%init> diff --git a/httemplate/misc/unvoid-cust_pay_void.cgi b/httemplate/misc/unvoid-cust_pay_void.cgi index 91fe1c223..4726ee576 100755 --- a/httemplate/misc/unvoid-cust_pay_void.cgi +++ b/httemplate/misc/unvoid-cust_pay_void.cgi @@ -6,7 +6,7 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Unvoid'); + unless $FS::CurrentUser::CurrentUser->access_right('Unvoid payments'); #untaint paynum my($query) = $cgi->keywords; diff --git a/httemplate/misc/void-cust_bill.html b/httemplate/misc/void-cust_bill.html new file mode 100644 index 000000000..1608fd051 --- /dev/null +++ b/httemplate/misc/void-cust_bill.html @@ -0,0 +1,45 @@ +<& /elements/header-popup.html, mt('Void invoice') &> + +<% include('/elements/error.html') %> + +<% emt('Are you sure you want to void this invoice?') %> +<BR><BR> + +<% emt("Invoice #[_1] ([_2])",$cust_bill->display_invnum, $money_char. $cust_bill->owed) %> +<BR><BR> + +<FORM METHOD="POST" ACTION="process/void-cust_bill.html"> +<INPUT TYPE="hidden" NAME="invnum" VALUE="<% $invnum %>"> + +<% ntable("#cccccc", 2) %> +<TR> + <TD ALIGN="right">Reason</TD> + <TD><INPUT TYPE="text" NAME="reason" VALUE="<% $cgi->param('reason') |h %>"></TD> +</TR> + +</TABLE> + +<BR> +<CENTER> +<BUTTON TYPE="submit">Yes, void invoice</BUTTON> \ +<BUTTON TYPE="button" onClick="parent.cClick();">No, do not void invoice</BUTTON> +</CENTER> + +</FORM> +</BODY> +</HTML> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Void invoices'); + +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + +#untaint invnum +$cgi->param('invnum') =~ /^(\d+)$/ || die "Illegal invnum"; +my $invnum = $1; + +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); + +</%init> diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi index 7b484e93e..31b7a6201 100755 --- a/httemplate/misc/void-cust_pay.cgi +++ b/httemplate/misc/void-cust_pay.cgi @@ -12,7 +12,7 @@ my $paynum = $1; my $cust_pay = qsearchs('cust_pay',{'paynum'=>$paynum}); -my $right = 'Regular void'; +my $right = 'Void payments'; $right = 'Credit card void' if $cust_pay->payby eq 'CARD'; $right = 'Echeck void' if $cust_pay->payby eq 'CHEK'; diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 16f7cd2bc..acf7e70e2 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -10,7 +10,7 @@ % % my $string = $cgi->param('arg'); % my @cust_main = smart_search( 'search' => $string, -% 'no_fuzzy_on_exact' => 1, #pref? +% 'no_fuzzy_on_exact' => ! $FS::CurrentUser::CurrentUser->option('enable_fuzzy_on_exact'), % ); % my $return = [ map [ $_->custnum, % $_->name, |
