X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FUI%2FWeb.pm;h=d5233f88b6fa1491b6695755a1e9a741070d6a90;hb=496ac38bb92a4ddb68318909c8b9d228ddda7bfb;hp=6d6f7fbb6912f446de89f73d11e4365702e7a164;hpb=2c5bb9b8dfea90e8aac3937dfd28e3826e9c5f99;p=freeside.git diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index 6d6f7fbb6..d5233f88b 100644 --- a/FS/FS/UI/Web.pm +++ b/FS/FS/UI/Web.pm @@ -7,7 +7,7 @@ use Carp qw( confess ); use HTML::Entities; use FS::Conf; use FS::Misc::DateTime qw( parse_datetime day_end ); -use FS::Record qw(dbdef); +use FS::Record qw(dbdef qsearch); use FS::cust_main; # are sql_balance and sql_date_balance in the right module? #use vars qw(@ISA); @@ -353,6 +353,25 @@ sub cust_header { $header2method{'Cust#'} = 'display_custnum' if $conf->exists('cust_main-default_agent_custid'); +foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) { + $header2method{'Contact '.$phone_type->typename.' phone(s)'} = sub { + my $self = shift; + my $num = $phone_type->phonetypenum; + + my @phones; + foreach ($self->contact_list_name_phones) { + my $data = [ + { + 'data' => $_->first.' '.$_->last.' '.FS::contact_phone::phonenum_pretty($_), + }, + ]; + push @phones, $data if $_->phonetypenum eq $phone_type->phonetypenum; + } + return \@phones; + }; + +} + my %header2colormethod = ( 'Cust. Status' => 'cust_statuscolor', ); @@ -410,7 +429,14 @@ sub cust_sort_fields { cust_header(@_) if( @_ or !@cust_fields ); #inefficientish, but tiny lists and only run once per page - map { $_ eq 'custnum' ? 'custnum' : '' } @cust_fields; + my @sort_fields; + foreach (@cust_fields) { + if ($_ eq "custnum") { push @sort_fields, 'custnum'; } + elsif ($_ eq "contact" || $_ eq "name") { push @sort_fields, '(last, first)'; } + elsif ($_ eq "company") { push @sort_fields, 'company'; } + else { push @sort_fields, ''; } + } + return @sort_fields; } @@ -469,9 +495,9 @@ sub cust_sql_fields { =item join_cust_main [ TABLE[.CUSTNUM] ] [ LOCATION_TABLE[.LOCATIONNUM] ] Returns an SQL join phrase for the FROM clause so that the fields listed -in L will be available. Currently joins to cust_main +in L will be available. Currently joins to cust_main itself, as well as cust_location (under the aliases 'bill_location' and -'ship_location') if address fields are needed. L should have +'ship_location') if address fields are needed. L should have been called already. All of these will be left joins; if you want to exclude rows with no linked @@ -739,7 +765,7 @@ use vars qw($DEBUG); use Carp; use Storable qw(nfreeze); use MIME::Base64; -use JSON::XS; +use Cpanel::JSON::XS; use FS::UID qw(getotaker); use FS::Record qw(qsearchs); use FS::queue; @@ -893,4 +919,3 @@ sub job_status { } 1; -