From a29e87197c593e4e6b9eb8e66bf03ea61006a5af Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 5 Mar 2007 19:48:16 +0000 Subject: Fixed a problem with the %opts hash getting skewed (specifically $opt{'value'} == 'label') when $cgi->param('agentnum') was unset. --- httemplate/search/report_cust_bill.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/report_cust_bill.html b/httemplate/search/report_cust_bill.html index 4fa09f96c..74b96cc90 100644 --- a/httemplate/search/report_cust_bill.html +++ b/httemplate/search/report_cust_bill.html @@ -5,7 +5,7 @@ <% include( '/elements/tr-select-agent.html', - $cgi->param('agentnum'), + $cgi->param('agentnum') ? $cgi->param('agentnum') : '', 'label' => 'Invoices for agent: ', ) %> -- cgit v1.2.1 From d11f7c132bb3f235980ecc9a98617fcb853f08f3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 6 Mar 2007 01:59:30 +0000 Subject: fix status colors in mozilla --- httemplate/search/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index e87fe36d7..d66d16172 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -380,7 +380,7 @@ - + % -- cgit v1.2.1 From a79f6e69559ec438a178f73b8b4d51d6f12c0d36 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Mar 2007 04:13:27 +0000 Subject: move POP to browse template; whew, its paged --- httemplate/browse/svc_acct_pop.cgi | 129 +++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 64 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index 306d02afb..44bc651cf 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -1,73 +1,74 @@ -<% include("/elements/header.html",'Access Number Listing', menubar( 'Main Menu' => $p )) %> -Points of Presence

-Add new Access Number

-<% table() %> -
- - - - - - - - -% -%foreach my $svc_acct_pop ( sort { -% #$a->getfield('popnum') <=> $b->getfield('popnum') -% $a->state cmp $b->state || $a->city cmp $b->city -% || $a->ac <=> $b->ac || $a->exch <=> $b->exch || $a->loc <=> $b->loc -%} qsearch('svc_acct_pop',{}) ) { -% -% my $svc_acct_pop_link = $p . 'edit/svc_acct_pop.cgi?'. $svc_acct_pop->popnum; -% -% $accounts_sth->execute($svc_acct_pop->popnum) or die $accounts_sth->errstr; -% my $num_accounts = $accounts_sth->fetchrow_arrayref->[0]; -% -% my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum='. $svc_acct_pop->popnum; -% -% +<% include( 'elements/browse.html', + 'title' => 'Access Numbers', + 'html_init' => $html_init, + 'name_singular' => 'access number', + 'query' => $query, + 'count_query' => $count_query, + 'header' => [ + '#', + 'City', + 'State', + 'Area code', + 'Exchange', + 'Local', + 'Accounts', + ], + 'fields' => [ + 'popnum', + 'city', + 'state', + 'ac', + 'exch', + 'loc', + $num_accounts_sub, + ], + 'align' => 'rllrrrr', + ) +%> +<%init> - - - - - - - - - -% } +my $query = { 'select' => '*, + ( SELECT COUNT(*) FROM svc_acct + WHERE svc_acct.popnum = svc_acct_pop.popnum + ) AS num_accounts + ', + 'table' => 'svc_acct_pop', + #'hashref' => { 'disabled' => '' }, + 'extra_sql' => 'ORDER BY state, city, ac, exch, loc', + }; +my $count_query = "SELECT COUNT(*) FROM svc_acct_pop"; # WHERE DISABLED IS NULL OR DISABLED = ''"; - - -
><% $custnum %>>><% ucfirst($status) %>><% ucfirst($status) %> ><% "$last, $first" %> ><% $pcompany %>
CityStateArea codeExchangeLocalAccounts
- <% $svc_acct_pop->popnum %> - <% $svc_acct_pop->city %> - <% $svc_acct_pop->state %> - <% $svc_acct_pop->ac %> - <% $svc_acct_pop->exch %> - <% $svc_acct_pop->loc %> - <% $num_accounts %> -% if ( $num_accounts ) { - -% } +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - active -% if ( $num_accounts ) { - -% } +my $html_init = qq! + Add new Access Number +

+!; -
- - -<%init> +my $svc_acct_pop_link = [ $p.'edit/svc_acct_pop.cgi?', 'popnum' ]; -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum='; -my $accounts_sth = dbh->prepare("SELECT COUNT(*) FROM svc_acct - WHERE popnum = ? ") - or die dbh->errstr; +my $num_accounts_sub = sub { + my $svc_acct_pop = shift; + [ + [ + { 'data' => ''. + $svc_acct_pop->get('num_accounts'). + '', + 'align' => 'right', + }, + { 'data' => 'active', + 'align' => 'left', + 'link' => ( $svc_acct_pop->get('num_accounts') + ? $svc_acct_link. $svc_acct_pop->popnum + : '' + ), + }, + ], + ]; +}; -- cgit v1.2.1 From 062cc0711149b9872d761560aaf4bac08f7801eb Mon Sep 17 00:00:00 2001 From: khoff Date: Thu, 15 Mar 2007 20:08:12 +0000 Subject: Set input form MAXLENGTH attributes to match actual field sizes. --- httemplate/edit/part_virtual_field.cgi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_virtual_field.cgi b/httemplate/edit/part_virtual_field.cgi index 9dda4ebf9..6fc908b2c 100644 --- a/httemplate/edit/part_virtual_field.cgi +++ b/httemplate/edit/part_virtual_field.cgi @@ -42,7 +42,7 @@ Field #<%$vfieldpart or "(NEW)"%>

<%ntable("#cccccc",2)%> Name - @@ -54,7 +54,7 @@ Field #<%$vfieldpart or "(NEW)"%>

% % my $dbdef = dbdef; # ick % #foreach my $dbtable (sort { $a cmp $b } $dbdef->tables) { -% foreach my $dbtable (qw( svc_broadband )) { +% foreach my $dbtable (qw( svc_broadband router )) { % if ($dbtable !~ /^h_/ % and $dbdef->table($dbtable)->primary_key) { @@ -74,7 +74,7 @@ Field #<%$vfieldpart or "(NEW)"%>

Label - -- cgit v1.2.1 From 7b3d074cbb694330334469510548d98eebe196ed Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 16 Mar 2007 01:35:55 +0000 Subject: vonage click2call integration should not be sitewide, especially now that we have user prefs --- httemplate/elements/phonenumber.html | 27 ++++++++++----- httemplate/pref/pref.html | 64 +++++++++++++++++++++++++----------- 2 files changed, 62 insertions(+), 29 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/phonenumber.html b/httemplate/elements/phonenumber.html index ffbd8c100..b1ae2aa2a 100644 --- a/httemplate/elements/phonenumber.html +++ b/httemplate/elements/phonenumber.html @@ -1,22 +1,31 @@ -% -% my( $number, %opt ) = @_; -% my $conf = new FS::Conf; -% ( my $snumber = $number ) =~ s/\D//g; -% - + % if ( length($number) ) { <% $number %> -% if ( $opt{'callable'} && $conf->config('vonage-username') ) { - Call this number -% } +% if ( $opt{'callable'} && $curuser->option('vonage-username') ) { + + Call this number + +% } +% % } else {   + % } +<%init> + +my( $number, %opt ) = @_; +( my $snumber = $number ) =~ s/\D//g; + +my $curuser = $FS::CurrentUser::CurrentUser; + +( my $vonage_number = $curuser->option('vonage-fromnumber') ) =~ s/\D//g; +$vonage_number =~ /^1/ or $vonage_number = "1$vonage_number"; + diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index 507a897d7..229ac0e62 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -8,39 +8,63 @@ Change password (leave blank for no change) <% ntable("#cccccc",2) %> - - Current password: - - + + Current password: + + - - New password: - - + + New password: + + - - Re-enter new password: - - + + Re-enter new password: + +
+ Interface <% ntable("#cccccc",2) %> - - Menu location: - - > Left
- > Top
- - - + + Menu location: + + > Left
+ > Top
+ + +
+ +Vonage integration (see Click2Call) +<% ntable("#cccccc",2) %> + + + Vonage phone number + + + + + Vonage username + + + + + Vonage password + + + + +
+ + % foreach my $prop (qw( height width availHeight availWidth colorDepth )) { + +<% include('/elements/xmlhttp.html', + 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi', + 'subs' => [qw( custnum_search )], + ) +%> + +% my $fh = $cgi->upload('csvfile'); +% my $csv = new Text::CSV_XS; +% my $skip_fuzzies = $cgi->param('fuzzies') ? 0 : 1; +% +% if ( defined($fh) ) { + + + + + + + + +% my $agentnum => scalar($cgi->param('agentnum')), +% my $line; +% my $row = 0; +% while ( defined($line=<$fh>) ) { +% chomp $line; +% $line =~ s/^(.*)(#!).*/$1/; +% +% $csv->parse($line) or die "can't parse line: " . $csv->error_input(); +% my $custnum = 0; +% my @values = $csv->fields(); +% my $last = shift @values; +% if ($last =~ /^\s*(\d+)\s*$/ ) { +% $custnum = $1; +% $last = shift @values; +% } +% my $first = shift @values; +% my $note = join ' ', @values; +% next unless ( $last || $first || $note ); +% my @cust_main = (); +% warn "searching for: $last, $first" if ($first || $last); +% if ($custnum) { +% @cust_main = qsearch('cust_main', { 'custnum' => $custnum }); +% } else { +% @cust_main = FS::cust_main::smart_search( +% 'search' => "$last, $first", +% 'no_fuzzy_on_exact' => $skip_fuzzies, +% ) +% if ($first || $last); +% } +% + + + + + + + +% $row++; +% } +
Cust #CustomerLastFirstNote to be added
+ + + + + + + + <% $first %> + + + <% $last %> + + + <% $note %> + +
+ + + Preview mode +% } else { + No file supplied +% } + + + + diff --git a/httemplate/misc/cust_main_note-import.html b/httemplate/misc/cust_main_note-import.html new file mode 100644 index 000000000..67f49f326 --- /dev/null +++ b/httemplate/misc/cust_main_note-import.html @@ -0,0 +1,32 @@ +<% include("/elements/header.html",'Batch Customer Note Import') %> + +
+ +Import a CSV file containing customer notes records. +

+ +File format is CSV, with the following field order: [custnum], last, first, notefield1, notefield2, notefield3... +
+The optional custnum field is identified by being numeric. +Anything after the character sequence #! is ignored. +

+ +<% &ntable("#cccccc") %> + + + CSV filename + + + + Include additional possibilites when exact match is found + + + + +

+ + +
+ +<% include('/elements/footer.html') %> + diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi new file mode 100644 index 000000000..af06ae95e --- /dev/null +++ b/httemplate/misc/process/cust_main_note-import.cgi @@ -0,0 +1,66 @@ +<% include("/elements/header.html", "Batch Customer Note Import $op") %> + +The following items <% $op eq 'Preview' ? 'would not be' : 'were not' %> imported. (See below for imported items) +
+%  foreach my $row (@uninserted) {
+%    $csv->combine( (map{ $row->{$_} } qw(last first note) ),
+%                   $row->{error} ? ('#!', $row->{error}) : (),
+%                 );
+<% $csv->string %>
+%  }
+
+ +The following items <% $op eq 'Preview' ? 'would be' : 'were' %> imported. (See above for unimported items) + +
+%  foreach my $row (@inserted) {
+%    $csv->combine( (map{ $row->{$_} } qw(custnum last first note) ),
+%                   ('#!', $row->{name}),
+%                 );
+<% $csv->string %>
+%  }
+
+ +<%init> +my $date = time; +my $otaker = $FS::CurrentUser::CurrentUser->username; +my $csv = new Text::CSV_XS; + +my $param = $cgi->Vars; + +my $op = $param->{preview} ? "Preview" : "Results"; + +my @inserted = (); +my @uninserted = (); +for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { + if ( $param->{"custnum$row"} ) { + my $cust_main_note = new FS::cust_main_note { + 'custnum' => $param->{"custnum$row"}, + '_date' => $date, + 'otaker' => $otaker, + 'comments' => $param->{"note$row"}, + }; + my $error = ''; + $error = $cust_main_note->insert unless ($op eq "Preview"); + my $result = { 'custnum' => $param->{"custnum$row"}, + 'last' => $param->{"last$row"}, + 'first' => $param->{"first$row"}, + 'note' => $param->{"note$row"}, + 'name' => $param->{"name$row"}, + 'error' => $error, + }; + if ($error) { + push @uninserted, $result; + }else{ + push @inserted, $result; + } + }else{ + push @uninserted, { 'custnum' => '', + 'last' => $param->{"last$row"}, + 'first' => $param->{"first$row"}, + 'note' => $param->{"note$row"}, + 'error' => '', + }; + } +} + -- cgit v1.2.1 From ac0ffef1dd511febd1ffa851dfd8b3772b968b09 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 20 Mar 2007 20:01:03 +0000 Subject: tie note import into menu --- httemplate/elements/menu.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 9565ff2d0..a58f25add 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -187,6 +187,7 @@ $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ] tie my %tools_importing, 'Tie::IxHash', 'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ], + 'Import customer notes from CSV file' => [ $fsurl.'misc/cust_main_note-import.html', '' ], 'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ], 'Import Call Detail Records (CDRs) from CSV file' => [ $fsurl.'misc/cdr-import.html', '' ], ; -- cgit v1.2.1 From 9f4b217a918ce2fd00138fb91f50ee21a2a77bae Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 20 Mar 2007 20:11:07 +0000 Subject: acls on new import --- httemplate/misc/cust_main_note-import.cgi | 7 +++++++ httemplate/misc/cust_main_note-import.html | 9 ++++++++- httemplate/misc/process/cust_main_note-import.cgi | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/cust_main_note-import.cgi b/httemplate/misc/cust_main_note-import.cgi index 07b922f6c..690ca783d 100644 --- a/httemplate/misc/cust_main_note-import.cgi +++ b/httemplate/misc/cust_main_note-import.cgi @@ -198,3 +198,10 @@ + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + + diff --git a/httemplate/misc/cust_main_note-import.html b/httemplate/misc/cust_main_note-import.html index 67f49f326..d8fefa732 100644 --- a/httemplate/misc/cust_main_note-import.html +++ b/httemplate/misc/cust_main_note-import.html @@ -5,7 +5,7 @@ Import a CSV file containing customer notes records.

-File format is CSV, with the following field order: [custnum], last, first, notefield1, notefield2, notefield3... +File format is CSV, with the following field order: [custnum,] last, first, notefield1, notefield2, notefield3...
The optional custnum field is identified by being numeric. Anything after the character sequence #! is ignored. @@ -30,3 +30,10 @@ Anything after the character sequence #! is ignored. <% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + + + diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi index af06ae95e..efc6224d0 100644 --- a/httemplate/misc/process/cust_main_note-import.cgi +++ b/httemplate/misc/process/cust_main_note-import.cgi @@ -22,6 +22,10 @@ The following items <% $op eq 'Preview' ? 'would be' : 'were' %> imported. (See <%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + my $date = time; my $otaker = $FS::CurrentUser::CurrentUser->username; my $csv = new Text::CSV_XS; -- cgit v1.2.1