diff options
author | cvs2git <cvs2git> | 2010-11-05 19:05:57 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2010-11-05 19:05:57 +0000 |
commit | aaf8baf3662e16e9414de236a39f8801a8c41b01 (patch) | |
tree | 2cda603e4311b3e80f79b93d9bcce3a7c7c2d053 /httemplate/elements | |
parent | 995a145c931164347683071c95c6754379d36604 (diff) | |
parent | 9b2de4257b6a2877434008188e52b8ef71ff339d (diff) |
This commit was manufactured by cvs2svn to create branch
'FREESIDE_2_1_BRANCH'.
Diffstat (limited to 'httemplate/elements')
22 files changed, 580 insertions, 42 deletions
diff --git a/httemplate/elements/city.html b/httemplate/elements/city.html index 61d0578..956d353 100644 --- a/httemplate/elements/city.html +++ b/httemplate/elements/city.html @@ -64,7 +64,7 @@ Example: <%$pre%>city_select_changed(what.form.<% $pre %>city_select); what.form.<% $pre %>city.style.display = 'none'; what.form.<% $pre %>city_select.style.display = ''; - } else { + } else if ( what.form.<% $pre %>city.style.display == 'none' ) { // turn on the text city, turn off the select what.form.<%$ pre %>city.value = saved_<%$pre%>city; what.form.<% $pre %>city.style.display = ''; diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index a7a33b1..eea3694 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -5,12 +5,38 @@ <TABLE> <TR> % foreach my $field ( @fields ) { +% +% my $value = ''; +% if ( $field =~ /^phonetypenum(\d+)$/ ) { +% my $contact_phone = qsearchs('contact_phone', { +% 'contactnum' => $curr_value, +% 'phonetypenum' => $1, +% }); +% if ( $contact_phone ) { +% $value = $contact_phone->phonenum; +% $value .= 'x'.$contact_phone->extension +% if $contact_phone->extension; +% $value = '+'. $contact_phone->countrycode. " $value" +% if $contact_phone->countrycode +% && $contact_phone->countrycode ne '1'; +% } +% } elsif ( $field eq 'emailaddress' ) { +% #XXX multiple not yet supported +% my $contact_email = qsearchs('contact_email', { +% 'contactnum' => $curr_value, +% }); +% $value = $contact_email->emailaddress if $contact_email; +% } else { +% $value = $contact->get($field); +% } + <TD> - <INPUT TYPE = "text" - NAME = "<%$name%>_<%$field%>" - ID = "<%$id%>_<%$field%>" + <INPUT TYPE = "text" + NAME = "<%$name%>_<%$field%>" + ID = "<%$id%>_<%$field%>" + SIZE = "<% $size{$field} || 15 %>" VALUE = "<% scalar($cgi->param($name."_$field")) - || $contact->get($field) |h %>" + || $value |h %>" <% $onchange %> ><BR> <FONT SIZE="-1"><% $label{$field} %></FONT> @@ -45,12 +71,25 @@ if ( $curr_value ) { $contact = new FS::contact {}; } +my %size = ( 'title' => 12 ); + tie my %label, 'Tie::IxHash', - 'first' => 'First name', - 'last' => 'Last name', - 'title' => 'Title/Position', - 'comment' => 'Comment', + 'first' => 'First name', + 'last' => 'Last name', + 'title' => 'Title/Position', + 'emailaddress' => 'Email', ; + +my $first = 0; +foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) { + next if $phone_type->typename eq 'Home'; + my $f = 'phonetypenum'.$phone_type->phonetypenum; + $label{$f} = $phone_type->typename. ' phone'; + $size{$f} = $first++ ? 11 : 15; +} + +$label{'comment'} = 'Comment'; + my @fields = keys %label; </%init> diff --git a/httemplate/elements/customer-table.html b/httemplate/elements/customer-table.html index f00419f..3c3f8b2 100644 --- a/httemplate/elements/customer-table.html +++ b/httemplate/elements/customer-table.html @@ -22,6 +22,7 @@ Example: ### 'name_singular' => 'customer', #label + 'custnum_update_callback' => 'name_of_js_callback' #passed a rownum #listrefs 'types' => ['immutable', ''], # immutable or ''/text @@ -98,6 +99,9 @@ Example: if ( name.length > 0 ) { customer.value = name; customer.setAttribute('magic', 'nosearch'); +% if ( $opt{custnum_update_callback} ) { + <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>') +% } } else { customer.value = 'Not found'; customer.style.color = '#ff0000'; @@ -162,6 +166,9 @@ Example: customer_obj.style.display = ''; customer_select.style.display = 'none'; +% if ( $opt{custnum_update_callback} ) { + <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>') +% } } else { @@ -223,6 +230,10 @@ Example: this.style.display = 'none'; customer_obj.style.display = ''; +% if ( $opt{custnum_update_callback} ) { + <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>') +% } + } } @@ -314,7 +325,7 @@ Example: > % } elsif ($types->[$col] eq 'immutable') { <% $font %><% $value %><% $font ? '</FONT>' : '' %> - <INPUT TYPE="hidden" NAME="<% $name %>" VALUE="<% $value %>" > + <INPUT TYPE="hidden" ID="<% $name %>" NAME="<% $name %>" VALUE="<% $value %>" > % } else { Cannot represent unknown type: <% $types->[$col] %> % } diff --git a/httemplate/elements/email-link.html b/httemplate/elements/email-link.html new file mode 100644 index 0000000..692e5bc --- /dev/null +++ b/httemplate/elements/email-link.html @@ -0,0 +1,16 @@ +% if ( $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices') ) { +<A HREF="<%$p%>misc/email-customers.html?table=<%$table%>&<%$query%>"><%$label%></A> +% } +<%init> +my %opt = @_; +my $table = $opt{'table'}; +my $search_hash = $opt{'search_hash'}; +die "'table' required" if !$table; +die "'search_hash' required" if !$search_hash; + +my $uri = new URI; +$uri->query_form($search_hash); +my $query = $uri->query; +my $label = ($opt{'label'} || 'Email a notice to these customers'); +</%init> + diff --git a/httemplate/elements/freeside.css b/httemplate/elements/freeside.css index dfb56e9..6cb1503 100644 --- a/httemplate/elements/freeside.css +++ b/httemplate/elements/freeside.css @@ -16,7 +16,7 @@ a[href]:hover { color: #7e0079; } -textarea, input[type="text"] { +textarea, input[type="text"], input[type="password"] { border: 1px solid #666666; padding: 1px; -moz-border-radius: 2px; @@ -24,7 +24,7 @@ textarea, input[type="text"] { border-radius: 2px; } -textarea:hover, input[type="text"]:hover { +textarea:hover, input[type="text"]:hover, input[type="password"]:hover { border: 1px solid #7e0079; padding: 1px; -moz-border-radius: 2px; @@ -32,7 +32,7 @@ textarea:hover, input[type="text"]:hover { border-radius: 2px; } -textarea:focus, input[type="text"]:focus { +textarea:focus, input[type="text"]:focus, input[type="password"]:focus { background-color: #ffffdd; border: 1px solid #7e0079; -moz-border-radius: 2px; @@ -40,6 +40,16 @@ textarea:focus, input[type="text"]:focus { border-radius: 2px; } +.fsdisabled { + background-color: #dddddd; + color: #666666; + border: 1px solid #999999; + padding: 1px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; +} + input[type="reset"], input[type="submit"], input[type="button"] { background-color: #dddddd; border: 1px solid #666666; @@ -173,6 +183,43 @@ div.fstabcontainer { filter: progid:DXImageTransform.Microsoft.Shadow(color='#666666', Direction=135, Strength=2); } +.fscontainer { + overflow:hidden; + display:inline-block; +} +.fscontainer { + display:block; +} + +.fsbox { + + float:left; + + background-color:#ffffff; + + padding:8px; + border-top:1px solid #7e0079; + border-left:1px solid #7e0079; + border-right:1px solid #7e0079; + border-bottom:1px solid #7e0079; + -moz-border-radius-bottomleft:8px; + -moz-border-radius-bottomright:8px; + -webkit-border-radius-bottomleft:8px; + -webkit-border-radius-bottomright:8px; + border-radius-bottomleft:8px; + border-radius-bottomright:8px; + -moz-box-shadow: #666666 1px 1px 2px; + -webkit-box-shadow: #666666 1px 1px 2px; + box-shadow: #666666 1px 1px 2px; + filter: progid:DXImageTransform.Microsoft.Shadow(color='#666666', Direction=135, Strength=2); +} + +.fsbox .fsbox-title { + /*float:left;*/ + font-size:150%; + font-weight:bold; +} + .background { background-color:#f8f8f8; } diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index 90ab0b7..c83529e 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -15,7 +15,6 @@ Example: #old-style include( '/elements/header.html', 'Title', $menubar, $etc, $head); - </%doc> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> %#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -43,8 +42,8 @@ Example: <% $head |n %> </HEAD> - <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0; margin-right:0"> - <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0; padding-right:4"> + <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px"> + <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px"> <tr> <td BGCOLOR="#ffffff"><IMG BORDER=0 ALT="freeside" HEIGHT="36" SRC="<%$fsurl%>view/REAL_logo.cgi"></td> <td align=left BGCOLOR="#ffffff"> <!-- valign="top" --> diff --git a/httemplate/elements/input-date-field.html b/httemplate/elements/input-date-field.html new file mode 100644 index 0000000..2a9bc1d --- /dev/null +++ b/httemplate/elements/input-date-field.html @@ -0,0 +1,50 @@ +% if(!$noinit) { +<LINK REL="stylesheet" TYPE="text/css" HREF="<%$fsurl%>elements/calendar-win2k-2.css" TITLE="win2k-2"> +<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar_stripped.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-en.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-setup.js"></SCRIPT> +% } + +<INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% $value %>"> +<IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $name %>_button" STYLE="cursor: pointer" TITLE="Select date"> + +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "<% $name %>_text", + ifFormat: "<% $format %>", + button: "<% $name %>_button", + align: "BR" + }); +</SCRIPT> + +<%init> + +my($name, $value, $format, $usedatetime, $noinit); +if ( ref($_[0]) ) { + my $opt = shift; + $name = $opt->{'name'}; + $value = $opt->{'value'}; + $format = $opt->{'format'}; + $usedatetime = $opt->{'usedatetime'}; + $noinit = $opt->{'noinit'}; +} else { + ($name, $value, $format, $usedatetime) = @_; +} + +my $conf = new FS::Conf; + +$format ||= $conf->config('date_format') || '%m/%d/%Y'; + +if ( $value =~ /\S/ ) { + if ( $usedatetime ) { + my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating'); + $value = $dt->strftime($format); + } elsif ( $value =~ /^\d+$/ ) { + $value = time2str($format, $value); + } +} else { + $value = ''; +} + +</%init> + diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index a5bcdeb..1909d90 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -185,11 +185,16 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) { ]; } - if ( $svcdb eq 'svc_acct' ) { + if ( $svcdb eq 'svc_acct' || $svcdb eq 'svc_broadband' ) { $report_svc{"Advanced $lcsname reports"} = [ $fsurl."search/report_$svcdb.html", '' ]; } + if ( $svcdb eq 'svc_phone' ) { + $report_svc{"Avaialble phone numbers (DIDs)"} = + [ $fsurl."search/phone_avail.html", '' ]; + } + $report_services{$name} = [ \%report_svc, $longname ]; } @@ -207,7 +212,9 @@ if ( $curuser->access_right('Financial reports') ) { $report_packages{'separator2'} = ''; } $report_packages{'All customer packages'} = [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ]; +$report_packages{'Package summary'} = [ $fsurl.'search/cust_pkg_summary.html', 'Show package sales summary', ]; $report_packages{'Suspended customer packages'} = [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ]; +$report_packages{'Suspension summary'} = [ $fsurl.'search/cust_pkg_susp.html', 'Show suspension activity', ]; $report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ]; $report_packages{'FCC Form 477 packages'} = [ $fsurl.'search/report_477.html', 'Summarize packages by census tract for particular types' ] if $conf->exists('cust_main-require_censustract'); @@ -257,6 +264,7 @@ $report_payments{'Pending Payments'} = [ $fsurl.'search/cust_pay_pending.html?ma if $curuser->access_right('View customer pending payments'); $report_payments{'Voided Payments'} = [ $fsurl.'search/report_cust_pay.html?void=1', 'Voided payment report (by type and/or date range)' ] if $curuser->access_right('View customer pending payments'); +$report_payments{'Unapplied Payments'} = [ $fsurl.'search/report_cust_pay.html?unapplied=1', 'Unapplied payment report (by type and/or date range)' ]; $report_payments{'Payment Batches'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ] if $conf->exists('batch-enable') || $conf->config('batch-enable_payby'); $report_payments{'Unapplied Payment Aging'} = [ $fsurl.'search/report_unapplied_cust_pay.html', 'Unapplied payment aging report' ]; @@ -270,7 +278,9 @@ if($curuser->access_right('Financial reports')) { 'Rated Call Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg_detail.html', 'Sales report and graph (by agent, package class, usage class and/or date range)' ], 'Employee Commission Report' => [ $fsurl.'search/report_employee_commission.html', '' ], 'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ], + 'Unapplied Credits' => [ $fsurl.'search/report_cust_credit.html?unapplied=1', 'Unapplied credit report (by type and/or date range)' ], 'Refund Report' => [ $fsurl.'search/report_cust_refund.html', 'Refund report (by type and/or date range)' ], + 'Unapplied Refunds' => [ $fsurl.'search/report_cust_refund.html?unapplied=1', 'Unapplied refund report (by type and/or date range)' ], 'Package Costs Report' => [ $fsurl.'graph/report_cust_pkg_cost.html', 'Package setup and recurring costs graph' ], ); $report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ]; @@ -317,6 +327,7 @@ $report_menu{'SQL Query'} = [ $fsurl.'search/report_sql.html', 'SQL Query' ] tie my %tools_importing, 'Tie::IxHash', 'Customers' => [ $fsurl.'misc/cust_main-import.cgi', '' ], + 'Customer packages' => [ $fsurl.'misc/cust_pkg-import.html', '' ], 'Customer comments from CSV file' => [ $fsurl.'misc/cust_main_note-import.html', '' ], 'One-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ], 'Payments from CSV file' => [ $fsurl.'misc/cust_pay-import.cgi', '' ], @@ -358,11 +369,13 @@ $tools_menu{'Process payment batches'} = [ $fsurl.'search/pay_batch.cgi?magic=_d if ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') ) && $curuser->access_right('Process batches'); $tools_menu{'Process invoice batches'} = [ $fsurl.'search/bill_batch.cgi' ] - if ( $conf->exists('invoice_print_pdf') ); + if $conf->exists('invoice_print_pdf'); $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ] if $curuser->access_right('Job queue'); $tools_menu{'Ticketing'} = [ \%tools_ticketing, 'Ticketing tools' ] if $conf->config('ticket_system'); +$tools_menu{'Business card scan'} = [ $fsurl.'edit/prospect_main-upload.html' ] + if $curuser->access_right('New prospect'); $tools_menu{'Time Queue'} = [ $fsurl.'search/report_timeworked.html', 'View pending support time' ] if $curuser->access_right('Time queue'); $tools_menu{'Attachments'} = [ $fsurl.'browse/cust_attachment.html', 'View customer attachments' ] @@ -398,7 +411,7 @@ if ( $curuser->access_right('Configuration') ) { #package grouping sub-menu? $config_pkg{'Package classes'} = [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for taxation, ordering convenience and reporting.' ]; - $config_pkg{'Package categories'} = [ $fsurl.'browse/pkg_category.html', 'Package categories define groups of package classes.' ]; + $config_pkg{'Package categories'} = [ $fsurl.'browse/pkg_category.html', 'Package categories define groups of package classes, for invoice sections.' ]; $config_pkg{'Package report classes'} = [ $fsurl.'browse/part_pkg_report_option.html', 'Package classes define optional groups of packages for reporting only.' ]; #eo package grouping sub-menu @@ -531,8 +544,8 @@ my $wiki = 'http://www.freeside.biz/mediawiki/index.php'; my $doc_link = $conf->config('support-key') ? "$wiki/Supported:Documentation" : $curuser->access_right('Configuration') - ? "$wiki/Freeside:1.9:Documentation" - : "$wiki/Freeside:1.9:Documentation:User"; + ? "$wiki/Freeside:2.1:Documentation" + : "$wiki/Freeside:2.1:Documentation:User"; eval "use RT;" if $conf->config('ticket_system') eq 'RT_Internal'; diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html index 49b624c..fbb6ce3 100644 --- a/httemplate/elements/popup_link.html +++ b/httemplate/elements/popup_link.html @@ -11,7 +11,7 @@ Example: 'label' => 'click me', # text of <A> tag #strongly recommended - 'actionlabel => 'You clicked', # popup title + 'actionlabel' => 'You clicked', # popup title #opt 'width' => 540, diff --git a/httemplate/elements/search-cust_main.html b/httemplate/elements/search-cust_main.html index 317922d..e8c645e 100644 --- a/httemplate/elements/search-cust_main.html +++ b/httemplate/elements/search-cust_main.html @@ -11,7 +11,7 @@ Example: ); </%doc> -<INPUT TYPE="hidden" NAME="<% $field %>" VALUE="<% $value %>"> +<INPUT TYPE="hidden" NAME="<% $field %>" ID="<% $field %>" VALUE="<% $value %>"> <!-- some false laziness w/ misc/batch-cust_pay.html, though not as bad as i'd thought at first... --> @@ -60,6 +60,9 @@ Example: function smart_<% $field %>_search(what) { + if ( <% $field %>_search_active ) + return; + var customer = what.value; if ( customer == 'searching...' || customer == '' diff --git a/httemplate/elements/select-discount_term.html b/httemplate/elements/select-discount_term.html new file mode 100644 index 0000000..26d877a --- /dev/null +++ b/httemplate/elements/select-discount_term.html @@ -0,0 +1,32 @@ +% if ( scalar(@discount_term) ) { + <SELECT NAME="discount_term"> + <OPTION VALUE="">1 month +% foreach my $discount_term (@discount_term) { +% my $sel = ( $cgi->param('discount_term') == $discount_term ) ? 'SELECTED' : ''; + <OPTION <% $sel %> VALUE="<% $discount_term %>"><% $discount_term. " months" %> +% } + </SELECT> +% } +<%init> + +my %opt = @_; + +my $cgi = $opt{'cgi'}; + +my @discount_term; +if ( $opt{discount_term} ) { + + @discount_term = @{ $opt{discount_term} }; + +} else { + + my $custnum = $opt{'custnum'}; + + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum\n"; + + @discount_term = $cust_main->discount_terms; + +} + +</%init> diff --git a/httemplate/elements/select-month_year.html b/httemplate/elements/select-month_year.html index 34476bc..cbf90b6 100644 --- a/httemplate/elements/select-month_year.html +++ b/httemplate/elements/select-month_year.html @@ -12,7 +12,7 @@ % if ( $opt{'show_month_abbr'} ) { % @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); % } else { -% @mon = ( 1 .. 12 ); +% @mon = ( ( map "0$_", 1 .. 9 ), 10 .. 12 ), % } % % my $date = $opt{'selected_date'} || ''; diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html index 9b358e2..2d60fde 100644 --- a/httemplate/elements/select-state.html +++ b/httemplate/elements/select-state.html @@ -32,7 +32,7 @@ Example: % foreach my $state ( keys %states ) { - <OPTION VALUE="<% $state |h %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %> + <OPTION VALUE="<% $state |h %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' |h %> % } diff --git a/httemplate/elements/select-terms.html b/httemplate/elements/select-terms.html index 52f9fb5..1ca586e 100644 --- a/httemplate/elements/select-terms.html +++ b/httemplate/elements/select-terms.html @@ -33,7 +33,7 @@ my $empty_label = my $empty_value = $opt{'empty_value'} || ''; my @terms = ( 'Payable upon receipt', - ( map "Net $_", 0, 10, 15, 20, 30, 45, 60 ), + ( map "Net $_", 0, 10, 15, 20, 30, 45, 60, 90 ), ); my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); diff --git a/httemplate/elements/select-user.html b/httemplate/elements/select-user.html index bdb92e7..ec2341b 100644 --- a/httemplate/elements/select-user.html +++ b/httemplate/elements/select-user.html @@ -4,8 +4,11 @@ <OPTION VALUE="">all</OPTION> % } -% foreach my $otaker ( @{ $opt{'otakers'} } ) { - <OPTION VALUE="<% shift(@{$opt{'usernums'}}) %>"><% $otaker %></OPTION> +% foreach my $usernum ( +% sort { $opt{'access_user'}->{$a} cmp $opt{'access_user'}->{$b} } +% keys %{ $opt{'access_user'} } +% ) { + <OPTION VALUE="<%$usernum%>"><% $opt{'access_user'}->{$usernum} %></OPTION> % } </SELECT> @@ -14,15 +17,15 @@ my %opt = @_; -unless ( $opt{'otakers'} ) { +unless ( $opt{'access_user'} ) { - my $sth = dbh->prepare("SELECT username,usernum FROM access_user". - " WHERE disabled = '' or disabled IS NULL") - or die dbh->errstr; + my $sth = dbh->prepare(" + SELECT usernum, username FROM access_user + WHERE disabled = '' or disabled IS NULL + ") or die dbh->errstr; $sth->execute or die $sth->errstr; - for($sth->fetchall_arrayref) { - $opt{'otakers'} = [ map { $_->[0] } @$_ ]; - $opt{'usernums'} = [ map { $_->[1] } @$_ ]; + while ( my $row = $sth->fetchrow_arrayref ) { + $opt{'access_user'}->{$row->[0]} = $row->[1]; } } diff --git a/httemplate/elements/standardize_locations.html b/httemplate/elements/standardize_locations.html new file mode 100644 index 0000000..9f8b71c --- /dev/null +++ b/httemplate/elements/standardize_locations.html @@ -0,0 +1,18 @@ +<% include('/elements/init_overlib.html') %> + +<% include( '/elements/xmlhttp.html', + 'url' => $p.'misc/xmlhttp-cust_main-address_standardize.html', + 'subs' => [ 'address_standardize' ], + #'method' => 'POST', #could get too long? + ) +%> + +<SCRIPT TYPE="text/javascript"> + <% include('/elements/standardize_locations.js', %options) %> +</SCRIPT> + +<%init> + +my (%options) = @_; + +</%init> diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js new file mode 100644 index 0000000..e6a4aa6 --- /dev/null +++ b/httemplate/elements/standardize_locations.js @@ -0,0 +1,278 @@ +function standardize_locations() { + + var cf = document.<% $formname %>; + + var state_el = cf.elements['<% $main_prefix %>state']; + var ship_state_el = cf.elements['<% $ship_prefix %>state']; + + var address_info = new Array( +% if ( $onlyship ) { + 'onlyship', 1, +% } else { +% if ( $withfirm ) { + 'company', cf.elements['<% $main_prefix %>company'].value, +% } + 'address1', cf.elements['<% $main_prefix %>address1'].value, + 'address2', cf.elements['<% $main_prefix %>address2'].value, + 'city', cf.elements['<% $main_prefix %>city'].value, + 'state', state_el.options[ state_el.selectedIndex ].value, + 'zip', cf.elements['<% $main_prefix %>zip'].value, +% } +% if ( $withfirm ) { + 'ship_company', cf.elements['<% $ship_prefix %>company'].value, +% } + 'ship_address1', cf.elements['<% $ship_prefix %>address1'].value, + 'ship_address2', cf.elements['<% $ship_prefix %>address2'].value, + 'ship_city', cf.elements['<% $ship_prefix %>city'].value, + 'ship_state', ship_state_el.options[ ship_state_el.selectedIndex ].value, + 'ship_zip', cf.elements['<% $ship_prefix %>zip'].value + ); + + address_standardize( address_info, update_address ); + +} + +var standardize_address; + +function update_address(arg) { + + var argsHash = eval('(' + arg + ')'); + + var changed = argsHash['address_standardized']; + var ship_changed = argsHash['ship_address_standardized']; + var error = argsHash['error']; + var ship_error = argsHash['ship_error']; + + + //yay closures + standardize_address = function () { + + var cf = document.<% $formname %>; + var state_el = cf.elements['<% $main_prefix %>state']; + var ship_state_el = cf.elements['<% $ship_prefix %>state']; + +% if ( !$onlyship ) { + if ( changed ) { +% if ( $withfirm ) { + cf.elements['<% $main_prefix %>company'].value = argsHash['new_company']; +% } + cf.elements['<% $main_prefix %>address1'].value = argsHash['new_address1']; + cf.elements['<% $main_prefix %>address2'].value = argsHash['new_address2']; + cf.elements['<% $main_prefix %>city'].value = argsHash['new_city']; + setselect(cf.elements['<% $main_prefix %>state'], argsHash['new_state']); + cf.elements['<% $main_prefix %>zip'].value = argsHash['new_zip']; + } +% } + + if ( ship_changed ) { +% if ( $withfirm ) { + cf.elements['<% $ship_prefix %>company'].value = argsHash['new_ship_company']; +% } + cf.elements['<% $ship_prefix %>address1'].value = argsHash['new_ship_address1']; + cf.elements['<% $ship_prefix %>address2'].value = argsHash['new_ship_address2']; + cf.elements['<% $ship_prefix %>city'].value = argsHash['new_ship_city']; + setselect(cf.elements['<% $ship_prefix %>state'], argsHash['new_ship_state']); + cf.elements['<% $ship_prefix %>zip'].value = argsHash['new_ship_zip']; + } + + post_standardization(); + + } + + + + if ( changed || ship_changed ) { + +% if ( $conf->exists('cust_main-auto_standardize_address') ) { + + standardize_address(); + +% } else { + + // popup a confirmation popup + + var confirm_change = + '<CENTER><BR><B>Confirm address standardization</B><BR><BR>' + + '<TABLE>'; + + if ( changed ) { + + confirm_change = confirm_change + + '<TR><TH>Entered billing address</TH>' + + '<TH>Standardized billing address</TH></TR>'; + // + '<TR><TD> </TD><TD> </TD></TR>'; + + if ( argsHash['company'] || argsHash['new_company'] ) { + confirm_change = confirm_change + + '<TR><TD>' + argsHash['company'] + + '</TD><TD>' + argsHash['new_company'] + '</TD></TR>'; + } + + confirm_change = confirm_change + + '<TR><TD>' + argsHash['address1'] + + '</TD><TD>' + argsHash['new_address1'] + '</TD></TR>' + + '<TR><TD>' + argsHash['address2'] + + '</TD><TD>' + argsHash['new_address2'] + '</TD></TR>' + + '<TR><TD>' + argsHash['city'] + ', ' + argsHash['state'] + ' ' + argsHash['zip'] + + '</TD><TD>' + argsHash['new_city'] + ', ' + argsHash['new_state'] + ' ' + argsHash['new_zip'] + '</TD></TR>' + + '<TR><TD> </TD><TD> </TD></TR>'; + + } + + if ( ship_changed ) { + + confirm_change = confirm_change + + '<TR><TH>Entered service address</TH>' + + '<TH>Standardized service address</TH></TR>'; + // + '<TR><TD> </TD><TD> </TD></TR>'; + + if ( argsHash['ship_company'] || argsHash['new_ship_company'] ) { + confirm_change = confirm_change + + '<TR><TD>' + argsHash['ship_company'] + + '</TD><TD>' + argsHash['new_ship_company'] + '</TD></TR>'; + } + + confirm_change = confirm_change + + '<TR><TD>' + argsHash['ship_address1'] + + '</TD><TD>' + argsHash['new_ship_address1'] + '</TD></TR>' + + '<TR><TD>' + argsHash['ship_address2'] + + '</TD><TD>' + argsHash['new_ship_address2'] + '</TD></TR>' + + '<TR><TD>' + argsHash['ship_city'] + ', ' + argsHash['ship_state'] + ' ' + argsHash['ship_zip'] + + '</TD><TD>' + argsHash['new_ship_city'] + ', ' + argsHash['new_ship_state'] + ' ' + argsHash['new_ship_zip'] + '</TD></TR>' + + '<TR><TD> </TD><TD> </TD></TR>'; + + } + + var addresses = 'address'; + var height = 268; + if ( changed && ship_changed ) { + addresses = 'addresses'; + height = 396; // #what + } + + confirm_change = confirm_change + + '<TR><TD>' + + '<BUTTON TYPE="button" onClick="post_standardization();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered ' + addresses + '</BUTTON>' + + '</TD><TD>' + + '<BUTTON TYPE="button" onClick="standardize_address();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized ' + addresses + '</BUTTON>' + + '</TD></TR>' + + '<TR><TD COLSPAN=2 ALIGN="center">' + + '<BUTTON TYPE="button" onClick="document.<% $formname %>.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' + + + '</TABLE></CENTER>'; + + overlib( confirm_change, CAPTION, 'Confirm address standardization', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, height, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); + +% } + + } else { + + post_standardization(); + + } + + +} + +function post_standardization() { + + var cf = document.<% $formname %>; + +% if ( $conf->exists('enable_taxproducts') ) { + + if ( new String(cf.elements['<% $taxpre %>zip'].value).length < 10 ) + { + + var country_el = cf.elements['<% $taxpre %>country']; + var country = country_el.options[ country_el.selectedIndex ].value; + var geocode = cf.elements['geocode'].value; + + if ( country == 'CA' || country == 'US' ) { + + var state_el = cf.elements['<% $taxpre %>state']; + var state = state_el.options[ state_el.selectedIndex ].value; + + var url = "<% $p %>/misc/choose_tax_location.html" + + "?data_vendor=cch-zip" + + ";city=" + cf.elements['<% $taxpre %>city'].value + + ";state=" + state + + ";zip=" + cf.elements['<% $taxpre %>zip'].value + + ";country=" + country + + ";geocode=" + geocode + + ";formname=" + '<% $formname %>' + + ";"; + + // popup a chooser + OLgetAJAX( url, update_geocode, 300 ); + + } else { + + cf.elements['geocode'].value = 'DEFAULT'; + <% $post_geocode %>; + + } + + } else { + + cf.elements['geocode'].value = ''; + <% $post_geocode %>; + + } + +% } else { + + <% $post_geocode %>; + +% } + +} + +function update_geocode() { + + //yay closures + set_geocode = function (what) { + + var cf = document.<% $formname %>; + + //alert(what.options[what.selectedIndex].value); + var argsHash = eval('(' + what.options[what.selectedIndex].value + ')'); + cf.elements['<% $taxpre %>city'].value = argsHash['city']; + setselect(cf.elements['<% $taxpre %>state'], argsHash['state']); + cf.elements['<% $taxpre %>zip'].value = argsHash['zip']; + cf.elements['geocode'].value = argsHash['geocode']; + <% $post_geocode %>; + + } + + // popup a chooser + + overlib( OLresponseAJAX, CAPTION, 'Select tax location', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); + +} + +function setselect(el, value) { + + for ( var s = 0; s < el.options.length; s++ ) { + if ( el.options[s].value == value ) { + el.selectedIndex = s; + } + } + +} +<%init> + +my %opt = @_; +my $conf = new FS::Conf; + +my $withfirm = 1; + +my $formname = $opt{form} || 'CustomerForm'; +my $onlyship = $opt{onlyship} || ''; +my $main_prefix = $opt{main_prefix} || ''; +my $ship_prefix = $opt{ship_prefix} || ($onlyship ? '' : 'ship_'); +my $taxpre = $main_prefix; +$taxpre = $ship_prefix if ( $conf->exists('tax-ship_address') || $onlyship ); +my $post_geocode = $opt{callback} || 'post_geocode();'; +$withfirm = 0 if $opt{no_company}; + +</%init> diff --git a/httemplate/elements/table-grid.html b/httemplate/elements/table-grid.html index e1e6c36..4d7deea 100644 --- a/httemplate/elements/table-grid.html +++ b/httemplate/elements/table-grid.html @@ -1,8 +1,7 @@ <STYLE TYPE="text/css"> -.grid table { border: solid; empty-cells: show } -.grid TH { padding-left: 3px; padding-right: 3px; border: 1px solid #dddddd; border-bottom: dashed 1px black; border-right: none } -.grid TD { padding-left: 3px; padding-right: 3px; empty-cells: show; border: 1px solid #cccccc; border-bottom: none; border-right: none } +.grid TH { padding-left: 3px; padding-right: 3px; padding-bottom: 2px; border: none; empty-cells: show } +.grid TD { padding-left: 3px; padding-right: 3px; padding-bottom: 2px; border: none; empty-cells: show } .inv table { border: none } .inv TH { border: none } @@ -10,7 +9,7 @@ </STYLE> -<TABLE CLASS="grid" CELLSPACING=<% $opt{cellspacing} %> CELLPADDING=<% $opt{cellpadding} %> BORDER=1 BORDERCOLOR="#000000" <% $opt{bgcolor} %> STYLE="border: solid 1px black; empty-cells: show"> +<TABLE CLASS="grid" CELLSPACING=<% $opt{cellspacing} %> CELLPADDING=<% $opt{cellpadding} %> <% $opt{bgcolor} %> STYLE="border: 1px solid #cccccc;"> <%init> diff --git a/httemplate/elements/tr-pkg_svc.html b/httemplate/elements/tr-pkg_svc.html index e66bdf7..e68ed4a 100644 --- a/httemplate/elements/tr-pkg_svc.html +++ b/httemplate/elements/tr-pkg_svc.html @@ -84,7 +84,7 @@ my @part_svc = qsearch('part_svc', {}, '', $where); #my $q_part_pkg = $clone_part_pkg || $part_pkg; #my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc; -my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc; +my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc('disable_linked'=>1); my @fixups = (); my $count = 0; diff --git a/httemplate/elements/tr-select-cust_tag.html b/httemplate/elements/tr-select-cust_tag.html index d88f3a8..b2b6d96 100644 --- a/httemplate/elements/tr-select-cust_tag.html +++ b/httemplate/elements/tr-select-cust_tag.html @@ -1,4 +1,4 @@ -% if ( $curuser->access_right('Edit customer tags') && @part_tag ) { +% if ( ($curuser->access_right('Edit customer tags') && @part_tag) || $is_report ) { <TR> <TD ALIGN="right"><% $opt{'label'} || 'Tags' %></TD> @@ -25,6 +25,7 @@ my $curuser = $FS::CurrentUser::CurrentUser; my %opt = @_; my $cgi = $opt{'cgi'}; +my $is_report = $opt{'is_report'}; my @curr_tagnum = (); if ( $cgi->param('error') ) { diff --git a/httemplate/elements/tr-select-discount_term.html b/httemplate/elements/tr-select-discount_term.html new file mode 100644 index 0000000..5858267 --- /dev/null +++ b/httemplate/elements/tr-select-discount_term.html @@ -0,0 +1,25 @@ +% if ( scalar(@discount_term) ) { + <TR> + <TD ALIGN="right">Prepayment for</TD> + <TD COLSPAN=2> + <% include('select-discount_term.html', + 'discount_term' => \@discount_term, + 'cgi' => $opt{'cgi'}, + ) + %> + </TD> + </TR> + +% } + +<%init> +my %opt = @_; + +my $custnum = $opt{'custnum'}; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum\n"; + +my @discount_term = $cust_main->discount_terms; + +</%init> diff --git a/httemplate/elements/xmlhttp.html b/httemplate/elements/xmlhttp.html index 2df3c42..ac6f991 100644 --- a/httemplate/elements/xmlhttp.html +++ b/httemplate/elements/xmlhttp.html @@ -58,7 +58,11 @@ Example: return; if (xmlhttp.status != 200) { - alert(xmlhttp.status + " status connecting to " + url); + if ( xmlhttp.status != 0 ) { + //not warning on the 0 errors, they pop up when navagating away + // from the page + alert(xmlhttp.status + " status connecting to " + url); + } } else { var data = xmlhttp.responseText; //alert('received response: ' + data); |