diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/discount.html | 3 | ||||
-rw-r--r-- | httemplate/docs/about.html | 2 | ||||
-rw-r--r-- | httemplate/edit/cust_main-contacts.html | 1 | ||||
-rwxr-xr-x | httemplate/edit/cust_main.cgi | 4 | ||||
-rw-r--r-- | httemplate/edit/elements/edit.html | 4 | ||||
-rw-r--r-- | httemplate/elements/contact.html | 19 | ||||
-rw-r--r-- | httemplate/elements/popup_link.html | 7 | ||||
-rw-r--r-- | httemplate/elements/tr-fixed.html | 6 | ||||
-rw-r--r-- | httemplate/elements/tr-select-contact.html | 10 | ||||
-rw-r--r-- | httemplate/elements/tr-select-cust_location.html | 2 | ||||
-rw-r--r-- | httemplate/misc/email-quotation.html | 8 | ||||
-rw-r--r-- | httemplate/search/contact.html | 59 | ||||
-rw-r--r-- | httemplate/search/cust_msg.html | 4 | ||||
-rw-r--r-- | httemplate/search/prospect_main.html | 4 | ||||
-rw-r--r-- | httemplate/view/cust_main/contacts_new.html | 33 | ||||
-rw-r--r-- | httemplate/view/prospect_main.html | 5 |
16 files changed, 119 insertions, 52 deletions
diff --git a/httemplate/browse/discount.html b/httemplate/browse/discount.html index d3cf873d0..9b2298ae4 100644 --- a/httemplate/browse/discount.html +++ b/httemplate/browse/discount.html @@ -8,8 +8,9 @@ 'count_query' => 'SELECT COUNT(*) FROM discount', 'disableable' => 1, 'disabled_statuspos' => 1, - 'header' => [ 'Name', 'Class', 'Discount', ], + 'header' => [ 'Name', 'Comment', 'Class', 'Discount', ], 'fields' => [ 'name', + 'comment', 'classname', 'description', ], diff --git a/httemplate/docs/about.html b/httemplate/docs/about.html index 80d9488b6..0f173f228 100644 --- a/httemplate/docs/about.html +++ b/httemplate/docs/about.html @@ -56,7 +56,7 @@ GNU <b>Affero</b> General Public License.<BR> % unless ( $agentnum ) { <CENTER> - <FONT SIZE="-3">"" - R. Hunter</FONT> + <FONT SIZE="-3">"Half the world's a desert / Cannibals eat human brains for dessert" - D. Zero</FONT> </CENTER> % } diff --git a/httemplate/edit/cust_main-contacts.html b/httemplate/edit/cust_main-contacts.html index 9f0654608..3b7eb07d3 100644 --- a/httemplate/edit/cust_main-contacts.html +++ b/httemplate/edit/cust_main-contacts.html @@ -11,6 +11,7 @@ { 'field' => 'contactnum', 'type' => 'contact', 'colspan' => 6, + 'custnum' => $custnum, 'm2m_method' => 'cust_contact', 'm2m_dstcol' => 'contactnum', 'm2_label' => ' ', #'Contact', diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 353ae1799..da87bfca7 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -325,8 +325,8 @@ if ( $cgi->param('error') ) { $cust_main->company( $prospect_main->company ); #first contact? -> name - my @contacts = $prospect_main->contact; - my $contact = $contacts[0]; + my @prospect_contacts = $prospect_main->prospect_contact; + my $contact = $prospect_contacts[0]->contact; $cust_main->first( $contact->first ); $cust_main->set( 'last', $contact->get('last') ); #contact phone numbers? diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 9e506a731..4d5beee71 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -334,6 +334,10 @@ Example: % #any? % 'colspan' => $f->{'colspan'}, % 'required' => $f->{'required'}, +% +% #contact +% 'custnum' => $f->{'custnum'}, +% 'prospectnum' => $f->{'prospectnum'}, % ); % % $include_common{$_} = $f->{$_} foreach grep exists($f->{$_}), diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index 979c26b49..ef74481c0 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -9,7 +9,7 @@ <SELECT NAME="<%$name%>_classnum" <% $onchange %>> <OPTION VALUE=""> % my $classnum = scalar($cgi->param($name.'_classnum')) -% || $contact->classnum; +% || $X_contact->classnum; % foreach my $contact_class (@contact_class) { <OPTION VALUE="<% $contact_class->classnum %>" <% ($contact_class->classnum == $classnum) ? 'SELECTED' : '' %> @@ -40,6 +40,8 @@ % } % } elsif ( $field eq 'emailaddress' ) { % $value = join(', ', map $_->emailaddress, $contact->contact_email); +% } elsif ( $field eq 'selfservice_access' || $field eq 'comment' ) { +% $value = $X_contact->get($field); % } else { % $value = $contact->get($field); % } @@ -100,10 +102,25 @@ if ( $opt{'onchange'} ) { my @contact_class = qsearch('contact_class', { 'disabled' => '' }); my $contact; +my $X_contact; if ( $curr_value ) { $contact = qsearchs('contact', { 'contactnum' => $curr_value } ); + if ( $opt{'custnum'} ) { + $X_contact = qsearchs('cust_contact', { + 'contactnum' => $curr_value, + 'custnum' => $opt{'custnum'}, + }); + } elsif ( $opt{'prospectnum'} ) { + $X_contact = qsearchs('prospect_contact', { + 'contactnum' => $curr_value, + 'prospectnum' => $opt{'prospectnum'}, + }); + } else { + die 'neither custnum nor prospectnum specified'; + } } else { $contact = new FS::contact {}; + $X_contact = new FS::cust_contact; #arbitrary, it could be prospect_contact } my %size = ( 'title' => 12 ); diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html index e5f8c61ca..2b6b187e9 100644 --- a/httemplate/elements/popup_link.html +++ b/httemplate/elements/popup_link.html @@ -2,9 +2,9 @@ Example: - include('/elements/init_overlib.html') + <& /elements/init_overlib.html &> - include( '/elements/popup_link.html', { #hashref or a list, either way is fine + <& /elements/popup_link.html', { #hashref or a list, either way is fine #required 'action' => 'content.html', # uri for content of popup @@ -23,7 +23,8 @@ Example: 'aname' => "target", # link NAME= value, useful for #targets 'target' => '_parent', 'style' => 'css-attribute:value', - } ) + } + &> </%doc> % if ($params->{'action'} && $label) { diff --git a/httemplate/elements/tr-fixed.html b/httemplate/elements/tr-fixed.html index 6904e3b30..373c0ab3a 100644 --- a/httemplate/elements/tr-fixed.html +++ b/httemplate/elements/tr-fixed.html @@ -1,6 +1,6 @@ <% include('tr-td-label.html', @_ ) %> - <TD BGCOLOR="#dddddd" <% $style %>><% $value %></TD> + <TD BGCOLOR="#dddddd" <% $style %> <% $colspan %>><% $value %></TD> </TR> @@ -10,7 +10,9 @@ my %opt = @_; -my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; +my $style = $opt{'cell_style'} ? ' STYLE="'. $opt{'cell_style'}. '" ' : ''; + +my $colspan = $opt{'colspan'} ? ' COLSPAN="'. $opt{'colspan'}. '" ' : ''; my $value = $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'}; $value = $opt{'prefix'} . $value if defined($opt{'prefix'}); diff --git a/httemplate/elements/tr-select-contact.html b/httemplate/elements/tr-select-contact.html index e37d26d1b..0bfa8934c 100644 --- a/httemplate/elements/tr-select-contact.html +++ b/httemplate/elements/tr-select-contact.html @@ -138,8 +138,8 @@ if ( $cgi->param('error') ) { if ( length($opt{'curr_value'}) ) { $contactnum = $opt{'curr_value'}; } elsif ($prospect_main) { - my @cust_contact = $prospect_main->contact; - $contactnum = $cust_contact[0]->contactnum if scalar(@cust_contact)==1; + my @prospect_contact = $prospect_main->prospect_contact; + $contactnum = $prospect_contact[0]->contactnum if scalar(@cust_contact)==1; } else { #$cust_main $cgi->param('contactnum') =~ /^(\-?\d*)$/ or die "illegal contactnum"; $contactnum = $1; @@ -176,8 +176,10 @@ my $contact_sort = sub { }; my @contact; -push @contact, $cust_main->cust_contact if $cust_main; -push @contact, $prospect_main->contact if $prospect_main; +push @contact, map $_->contact, $cust_main->cust_contact + if $cust_main; +push @contact, map $_->contact, $prospect_main->prospect_contact + if $prospect_main; push @contact, $contact if !$cust_main && $contact && $contact->contactnum > 0 && ! grep { $_->contactnum == $contact->contactnum } @contact; diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html index abaaa5b42..7a5b43bb8 100644 --- a/httemplate/elements/tr-select-cust_location.html +++ b/httemplate/elements/tr-select-cust_location.html @@ -287,6 +287,8 @@ if ( $locationnum && $locationnum > 0 ) { $cust_location->coord_auto('Y'); my $location_sort = sub { + #enabled w/label_prefix _location # $a->locationname cmp $b->locationname + # or $a->country cmp $b->country or lc($a->city) cmp lc($b->city) or lc($a->address1) cmp lc($b->address1) diff --git a/httemplate/misc/email-quotation.html b/httemplate/misc/email-quotation.html index b93b80bb7..64e3691b5 100644 --- a/httemplate/misc/email-quotation.html +++ b/httemplate/misc/email-quotation.html @@ -16,9 +16,11 @@ % } % } -% my @contact = $quotation->custnum ? $quotation->cust_main->cust_contact -% : $quotation->prospect_main->contact; -% foreach my $contact ( @contact ) { +% my @X_contact = $quotation->custnum +% ? $quotation->cust_main->cust_contact +% : $quotation->prospect_main->prospect_contact; +% foreach my $X_contact ( @X_contact ) { +% my $contact = $X_contact->contact; % foreach my $contact_email ( $contact->contact_email ) { % $emails++; <& .emailrow, $contact_email->emailaddress, $contact->firstlast &> diff --git a/httemplate/search/contact.html b/httemplate/search/contact.html index 193349369..c3667df98 100644 --- a/httemplate/search/contact.html +++ b/httemplate/search/contact.html @@ -1,13 +1,13 @@ <& elements/search.html, title => 'Contacts', name_singular => 'contact', - query => { select => $select, + query => { select => join(', ', @select), table => 'contact', addl_from => $addl_from, hashref => \%hash, extra_sql => $extra_sql, }, - count_query => "SELECT COUNT(*) FROM contact $extra_sql", #XXX + count_query => "SELECT COUNT(*) FROM contact $addl_from $extra_sql", #XXX header => \@header, fields => \@fields, links => \@links, @@ -17,13 +17,29 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('List contacts'); -my $select = 'contact.*'; +my @select = 'contact.contactnum AS contact_contactnum'; #if we select it as bare contactnum, the multi-customer listings go away +push @select, map "contact.$_", qw( first last title ); my %hash = (); my $addl_from = ''; -my @header = ( 'First', 'Last', 'Title', ); -my @fields = ( 'first', 'last', 'title', ); -my @links = ( '', '', '' ); +my $link; #for closure in this sub, we'll define it later +my $contact_classname_sub = sub { + my $contact = shift; + my %hash = ( 'contactnum' => $contact->contact_contactnum ); + my $X_contact; + if ( $link eq 'cust_main' ) { + $X_contact = qsearchs('cust_contact', { %hash, 'custnum' => $contact->custnum } ); + } elsif ( $link eq 'prospect_main' ) { + $X_contact = qsearchs('prospect_contact', { %hash, 'prospectnum' => $contact->prospectnum } ); + } else { + die 'guru meditation #5555'; + } + $X_contact->contact_classname; +}; + +my @header = ( 'First', 'Last', 'Title', 'Type' ); +my @fields = ( 'first', 'last', 'title', $contact_classname_sub ); +my @links = ( '', '', '', '', ); my $company_link = ''; @@ -32,22 +48,30 @@ if ( $cgi->param('selfservice_access') eq 'Y' ) { } my $extra_sql = ''; -if ( $cgi->param('link') ) { +$link = $cgi->param('link'); +if ( $link ) { - my $coalesce = ', COALESCE( cust_main.company,'; my $as = ') AS prospect_or_customer'; - if ( $cgi->param('link') eq 'cust_main' ) { + if ( $link eq 'cust_main' ) { push @header, 'Customer'; - $select .= "$coalesce cust_main.first||' '||cust_main.last $as"; - $addl_from = ' LEFT JOIN cust_main USING ( custnum )'; - $extra_sql = ' custnum IS NOT NULL '; + push @select, + "COALESCE( cust_main.company, cust_main.first||' '||cust_main.last $as", + map "cust_contact.$_", qw( custnum classnum comment selfservice_access ); + $addl_from = + ' LEFT JOIN cust_contact USING ( contactnum ) '. + ' LEFT JOIN cust_main ON ( cust_contact.custnum = cust_main.custnum )'; + $extra_sql = ' cust_contact.custnum IS NOT NULL '; $company_link = [ $p.'view/cust_main.cgi?', 'custnum' ]; - } elsif ( $cgi->param('link') eq 'prospect_main' ) { + } elsif ( $link eq 'prospect_main' ) { push @header, 'Prospect'; - $select .= "$coalesce contact.first||' '||contact.last $as"; - $addl_from = ' LEFT JOIN prospect_main USING ( prospectnum )'; - $extra_sql = ' prospectnum IS NOT NULL '; + push @select, + "COALESCE( prospect_main.company, contact.first||' '||contact.last $as", + map "prospect_contact.$_", qw( prospectnum classnum comment ); + $addl_from = + ' LEFT JOIN prospect_contact USING ( contactnum ) '. + ' LEFT JOIN prospect_main ON ( prospect_contact.prospectnum = prospect_main.prospectnum )'; + $extra_sql = ' prospect_contact.prospectnum IS NOT NULL '; $company_link = [ $p.'view/prospect_main.html?', 'prospectnum' ]; } else { die "don't know how to report on contacts linked to specified table"; @@ -62,6 +86,9 @@ if ( $cgi->param('link') ) { push @header, 'Self-service'; push @fields, 'selfservice_access'; +push @header, 'Comment'; +push @fields, 'comment'; + $extra_sql = (keys(%hash) ? ' AND ' : ' WHERE '). $extra_sql if $extra_sql; diff --git a/httemplate/search/cust_msg.html b/httemplate/search/cust_msg.html index 486c7b09c..d5b865c3b 100644 --- a/httemplate/search/cust_msg.html +++ b/httemplate/search/cust_msg.html @@ -47,7 +47,7 @@ ], 'html_init' => $html_init, 'really_disable_download' => 1, - @_ + @_ #why? &> <%init> #hmm... @@ -71,7 +71,7 @@ if ( $cgi->param('msgtype') =~ /^(\w+)$/ ) { push @where, "msgtype = '$1'"; } if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - push @where, "custnum = $1"; + push @where, "cust_msg.custnum = $1"; } my ($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, ''); push @where, "(_date >= $beginning AND _date <= $ending)"; diff --git a/httemplate/search/prospect_main.html b/httemplate/search/prospect_main.html index 4798f58f2..241918b98 100644 --- a/httemplate/search/prospect_main.html +++ b/httemplate/search/prospect_main.html @@ -12,9 +12,9 @@ sub { my $pm = shift; [ map { - [ { 'data' => $_->line, }, ]; + [ { 'data'=>$_->contact->line, }, ]; } - $pm->contact + $pm->prospect_contact ]; }, ], diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html index f73483ae1..f0bc0b848 100644 --- a/httemplate/view/cust_main/contacts_new.html +++ b/httemplate/view/cust_main/contacts_new.html @@ -6,26 +6,31 @@ % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = $bgcolor2; +% my $th = '<TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">'; <TR> - <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Type</TH> - <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Contact</TH> - <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Email</TH> - <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Self-service</TH> + <%$th%>Type</TH> + <%$th%>Contact</TH> + <%$th%>Email</TH> + <%$th%>Self-service</TH> % foreach my $phone_type (@phone_type) { - <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc"><% $phone_type->typename |h %> phone</TD> + <%$th%><% $phone_type->typename |h %></TH> % } + <%$th%>Comment</TH> </TR> -% foreach my $contact ( @contacts ) { +% foreach my $cust_contact ( @cust_contacts ) { +% my $contact = $cust_contact->contact; +% my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">); + <TR> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact->contact_classname |h %></TD> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact->line |h %></TD> + <%$td%><% $cust_contact->contact_classname |h %></TD> + <%$td%><% $contact->line |h %></TD> % my @contact_email = $contact->contact_email; - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% join(', ', map $_->emailaddress, @contact_email) %></TD> + <%$td%><% join(', ', map $_->emailaddress, @contact_email) %></TD> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> -% if ( $contact->selfservice_access ) { + <%$td%> +% if ( $cust_contact->selfservice_access ) { Enabled %# <FONT SIZE="-1"><A HREF="XXX">disable</A> %# <A HREF="XXX">re-email</A></FONT> @@ -41,9 +46,11 @@ % 'contactnum' => $contact->contactnum, % 'phonetypenum' => $phone_type->phonetypenum, % }); - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD> + <%$td%><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD> % } + <%$td%><% $cust_contact->comment |h %></TD> + </TR> % if ( $bgcolor eq $bgcolor1 ) { @@ -63,6 +70,6 @@ my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'}); my( $cust_main ) = @_; #my $conf = new FS::Conf; -my @contacts = $cust_main->cust_contact; +my @cust_contacts = $cust_main->cust_contact; </%init> diff --git a/httemplate/view/prospect_main.html b/httemplate/view/prospect_main.html index 66abffcdd..a1f14a374 100644 --- a/httemplate/view/prospect_main.html +++ b/httemplate/view/prospect_main.html @@ -39,9 +39,10 @@ </TR> % } -% foreach my $contact ( $prospect_main->contact ) { +% foreach my $prospect_contact ( $prospect_main->prospect_contact ) { +% my $contact = $prospect_contact->contact; <TR> - <TD ALIGN="right"><% $contact->contact_classname %> Contact</TD> + <TD ALIGN="right"><% $prospect_contact->contact_classname %> Contact</TD> <TD BGCOLOR="#FFFFFF"><% $contact->line %></TD> </TR> %} |