summaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
Diffstat (limited to 'rt')
-rw-r--r--rt/FREESIDE_MODIFIED7
-rw-r--r--rt/html/Elements/Header8
-rw-r--r--rt/html/Elements/PageLayout2
-rw-r--r--rt/html/Ticket/Elements/AddCustomers65
-rw-r--r--rt/html/Ticket/Elements/EditCustomers79
-rw-r--r--rt/html/Ticket/Elements/ShowCustomers40
-rw-r--r--rt/html/Ticket/Elements/ShowSummary9
-rw-r--r--rt/html/Ticket/Elements/Tabs2
-rw-r--r--rt/html/Ticket/ModifyCustomers.html49
-rw-r--r--rt/lib/RT/Interface/Web_Vendor.pm95
-rw-r--r--rt/lib/RT/URI/freeside.pm80
11 files changed, 426 insertions, 10 deletions
diff --git a/rt/FREESIDE_MODIFIED b/rt/FREESIDE_MODIFIED
index 1f3f55c62..67bcfecb8 100644
--- a/rt/FREESIDE_MODIFIED
+++ b/rt/FREESIDE_MODIFIED
@@ -3,11 +3,18 @@ sbin/rt-setup-database.in
config.layout
config.layout.in
etc/RT_SiteConfig.pm
+lib/RT/Interface/Web_Vendor.pm
lib/RT/URI/freeside.pm
html/Elements/Header
html/Elements/PageLayout
html/Elements/SimpleSearch
html/Elements/Tabs
html/Elements/Footer
+html/Ticket/Elements/AddCustomers
+html/Ticket/Elements/EditCustomers
+html/Ticket/Elements/ShowCustomers
+html/Ticket/Elements/ShowSummary
+html/Ticket/Elements/Tabs
+html/Ticket/ModifyCustomers.html
html/NoAuth/images/small-logo.png
html/NoAuth/webrt.css
diff --git a/rt/html/Elements/Header b/rt/html/Elements/Header
index 92c186bd5..38cb4bd6b 100644
--- a/rt/html/Elements/Header
+++ b/rt/html/Elements/Header
@@ -43,7 +43,7 @@ ONLOAD="
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td rowspan=2><img border=0 alt="freeside" src="<%$RT::WebImagesURL%>/small-logo.png" width="92" height="62"></td>
- <td align="left" rowspan=2><font size=7>Ticketing</font></td>
+ <td align="left" rowspan=2><font size=6><% FS::Conf->new->config('company_name') %> Ticketing</font></td>
<td align="right" valign="top">
% if ($session{'CurrentUser'} && $session{'CurrentUser'}->Id && $LoggedIn) {
<SPAN STYLE="display: none"><A HREF="#skipnav"><&|/l&>Skip Menu</&></A> |</SPAN>
@@ -67,16 +67,14 @@ ONLOAD="
<tr>
<td align=right>
<FONT SIZE="-3">
- Freeside <% $FS::VERSION %><BR>
- <A HREF="http://www.sisd.com/freeside">Freeside&nbsp;home&nbsp;page</A><BR>
+ <A HREF="http://www.sisd.com/freeside">Freeside</A>&nbsp;v<% $FS::VERSION %><BR>
<A HREF="docs/">Documentation</A><BR>
</FONT>
</td>
<td bgcolor=#000000></td>
<td align=left>
<FONT SIZE="-3">
- RT <% $RT::VERSION %><BR>
- <A HREF="http://www.bestpractical.com/rt">RT&nbsp;home&nbsp;page</A><BR>
+ <A HREF="http://www.bestpractical.com/rt">RT</A>&nbsp;v<% $RT::VERSION %><BR>
<A HREF="http://wiki.bestpractical.com/">Documentation</A><BR>
</FONT>
</td>
diff --git a/rt/html/Elements/PageLayout b/rt/html/Elements/PageLayout
index 86b6b565e..6146b807c 100644
--- a/rt/html/Elements/PageLayout
+++ b/rt/html/Elements/PageLayout
@@ -46,7 +46,7 @@
</td>
</tr>
<tr>
-<td class="whiteright" valign="top">
+<td class="mediumgrayright" valign="top">
<span class="nav">
% if ($actions) {
% my @actions;
diff --git a/rt/html/Ticket/Elements/AddCustomers b/rt/html/Ticket/Elements/AddCustomers
new file mode 100644
index 000000000..b26b3a638
--- /dev/null
+++ b/rt/html/Ticket/Elements/AddCustomers
@@ -0,0 +1,65 @@
+%# BEGIN LICENSE BLOCK
+%#
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+<BR>
+<%$msg%><br>
+
+% if (@Customers) {
+
+<br><i>(Check box to link)<i>
+<table>
+% foreach my $customer (@Customers) {
+<tr>
+ <td>
+ <input type="checkbox" name="Ticket-AddCustomer-<% $customer->custnum %>" VALUE="1" <% scalar(@Customers) == 1 ? 'CHECKED' : '' %>>
+%# <% $customer->name %>
+ <A HREF="<% $p %>view/cust_main.cgi?<% $customer->custnum %>"><% small_custview( $customer, scalar(FS::Conf->new->config('countrydefault')), 1 ) |n %>
+ </td>
+</tr>
+% }
+
+% }
+
+<%INIT>
+my ($msg);
+
+my @Customers = ();
+if ( $CustomerString ) {
+ @Customers = smart_search( 'search' => $CustomerString );
+ warn scalar(@Customers);
+}
+
+my @Services = ();
+if ($ServiceString) {
+ @Services = (); #service_search();
+}
+
+eval { use FS::CGI qw( popurl small_custview ); };
+my $p = eval { popurl(3); };
+
+</%INIT>
+
+<%ARGS>
+$CustomerString => undef
+$ServiceString => undef
+</%ARGS>
diff --git a/rt/html/Ticket/Elements/EditCustomers b/rt/html/Ticket/Elements/EditCustomers
new file mode 100644
index 000000000..49edb27b3
--- /dev/null
+++ b/rt/html/Ticket/Elements/EditCustomers
@@ -0,0 +1,79 @@
+%# BEGIN LICENSE BLOCK
+%#
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+<TABLE width=100%>
+ <TR>
+ <TD VALIGN=TOP WIDTH=50%>
+ <h3><&|/l&>Current Customers</&></h3>
+
+<table>
+ <tr>
+ <td><i><&|/l&>(Check box to disassociate)</&></i></td>
+ </tr>
+ <tr>
+ <td class="value">
+% #while (my $link = $Ticket->MemberOf->Next) {
+% foreach my $link (
+% grep { $_->TargetURI->Resolver->{'fstable'} eq 'cust_main' }
+% grep { $_->TargetURI->Scheme eq 'freeside' }
+% @{ $Ticket->_Links('Base')->ItemsArrayRef }
+% ) {
+
+ <INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>">
+%# <& ShowLink, URI => $link->TargetURI &><br>
+ <A HREF="<% $link->TargetURI->Resolver->HREF %>"><% $link->TargetURI->Resolver->AsStringLong |n %>
+ <BR>
+% }
+ </td>
+ </tr>
+</table>
+
+</TD>
+
+<TD VALIGN=TOP>
+<h3><&|/l&>New Customer Links</&></h3>
+<&|/l&>Find customer</&><BR>
+<input name="CustomerString">
+<input type=submit name="OnlySearchForCustomers" value="<&|/l&>Go!</&>">
+<br><i>cust #, last name, or company</i>
+<BR>
+%#<BR>
+%#<&|/l&>Find service</&><BR>
+%#<input name="ServiceString">
+%#<input type=submit name="OnlySearchForServices" value="<&|/l&>Go!</&>">
+%#<br><i>username, username@domain, domain, or IP address</i>
+%#<BR>
+
+<& AddCustomers, Ticket => $Ticket,
+ CustomerString => $CustomerString,
+ ServiceString => $ServiceString, &>
+
+</TD>
+</TR>
+</TABLE>
+
+<%ARGS>
+$CustomerString => undef
+$ServiceString => undef
+$Ticket => undef
+</%ARGS>
diff --git a/rt/html/Ticket/Elements/ShowCustomers b/rt/html/Ticket/Elements/ShowCustomers
new file mode 100644
index 000000000..5519d24cf
--- /dev/null
+++ b/rt/html/Ticket/Elements/ShowCustomers
@@ -0,0 +1,40 @@
+%# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am>
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+<table>
+% my $cust = 0;
+% foreach my $customerURI (
+% grep { $_->Resolver->{'fstable'} eq 'cust_main' }
+% grep { $_->Scheme eq 'freeside' }
+% map { $_->TargetURI }
+% @{ $Ticket->_Links('Base')->ItemsArrayRef }
+% ) {
+% $cust++;
+% my $cust_main = '';
+ <tr>
+ <td class="value">
+ <A HREF="<% $customerURI->Resolver->HREF %>"><% $customerURI->Resolver->AsStringLong |n %>
+ </td>
+ </tr>
+% }
+% unless ( $cust ) {
+ <tr>
+ <td class="labeltop">
+ <i>(none)<i>
+ </td>
+ </tr>
+
+% }
+</table>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
+
diff --git a/rt/html/Ticket/Elements/ShowSummary b/rt/html/Ticket/Elements/ShowSummary
index 5bcc94b41..1b9f62908 100644
--- a/rt/html/Ticket/Elements/ShowSummary
+++ b/rt/html/Ticket/Elements/ShowSummary
@@ -47,6 +47,15 @@
color => "#333399" &>
<& /Ticket/Elements/ShowPeople, Ticket => $Ticket &>
<& /Elements/TitleBoxEnd &>
+ <br>
+
+ <& /Elements/TitleBoxStart, title => loc('Customers'),
+ title_href =>"$RT::WebPath/Ticket/ModifyCustomers.html?id=".$Ticket->Id,
+ title_class=> 'inverse',
+ color => "#7f007b" &>
+ <& /Ticket/Elements/ShowCustomers, Ticket => $Ticket &>
+ <& /Elements/TitleBoxEnd &>
+
<BR>
</TD>
<TD VALIGN=TOP WIDTH="50%">
diff --git a/rt/html/Ticket/Elements/Tabs b/rt/html/Ticket/Elements/Tabs
index cba45df91..26b252707 100644
--- a/rt/html/Ticket/Elements/Tabs
+++ b/rt/html/Ticket/Elements/Tabs
@@ -101,6 +101,8 @@ my $ticket_page_tabs = {
{ title => loc('People'), path => "Ticket/ModifyPeople.html?id=" . $id, },
_E => { title => loc('Links'),
path => "Ticket/ModifyLinks.html?id=" . $id, },
+ _Eb=> { title => loc('Customers'),
+ path => "Ticket/ModifyCustomers.html?id=" . $id, },
_F => { title => loc('Jumbo'),
path => "Ticket/ModifyAll.html?id=" . $id,
seperator => 1
diff --git a/rt/html/Ticket/ModifyCustomers.html b/rt/html/Ticket/ModifyCustomers.html
new file mode 100644
index 000000000..72d103b23
--- /dev/null
+++ b/rt/html/Ticket/ModifyCustomers.html
@@ -0,0 +1,49 @@
+%# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am>
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+<& /Elements/Header, Title => loc("Customers for ticket #[_1]", $Ticket->Id) &>
+<& /Ticket/Elements/Tabs,
+ Ticket => $Ticket,
+ current_tab => "Ticket/ModifyCustomers.html?id=".$Ticket->Id,
+ Title => loc("Customers for ticket #[_1]", $Ticket->Id) &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<form action="ModifyCustomers.html" method="post">
+<input type="hidden" name="id" value="<%$Ticket->id%>">
+
+<& /Elements/TitleBoxStart, title => loc('Edit Customer Links'), color => "#7f007b"&>
+<& Elements/EditCustomers, Ticket => $Ticket, CustomerString => $CustomerString, ServiceString => $ServiceString &>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit, color => "#7f007b", Label => loc('Save Changes') &>
+</form>
+
+
+<%INIT>
+
+my @results = ();
+my $Ticket = LoadTicket($id);
+
+# if we're trying to search for customers/services and nothing else
+unless ( $OnlySearchForCustomers || $OnlySearchForServices) {
+ @results = ProcessTicketCustomers( TicketObj => $Ticket, ARGSRef => \%ARGS);
+}
+
+</%INIT>
+
+
+<%ARGS>
+$OnlySearchForCustomers => undef
+$OnlySearchForServices => undef
+$CustomerString => undef
+$ServiceString => undef
+$id => undef
+</%ARGS>
diff --git a/rt/lib/RT/Interface/Web_Vendor.pm b/rt/lib/RT/Interface/Web_Vendor.pm
new file mode 100644
index 000000000..5be20e6b9
--- /dev/null
+++ b/rt/lib/RT/Interface/Web_Vendor.pm
@@ -0,0 +1,95 @@
+# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am>
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+=head1 NAME
+
+RT::Interface::Web_Vendor
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+Freeside vendor overlay for RT::Interface::Web.
+
+=begin testing
+
+use_ok(RT::Interface::Web_Vendor);
+
+=end testing
+
+=cut
+
+#package RT::Interface::Web;
+#use strict;
+
+package HTML::Mason::Commands;
+use strict;
+
+=head2 ProcessTicketCustomers
+
+=cut
+
+sub ProcessTicketCustomers {
+ my %args = (
+ TicketObj => undef,
+ ARGSRef => undef,
+ @_
+ );
+ my @results = ();
+
+ my $Ticket = $args{'TicketObj'};
+ my $ARGSRef = $args{'ARGSRef'};
+
+ ### false laziness w/RT::Interface::Web::ProcessTicketLinks
+ # Delete links that are gone gone gone.
+ foreach my $arg ( keys %$ARGSRef ) {
+ if ( $arg =~ /DeleteLink-(.*?)-(DependsOn|MemberOf|RefersTo)-(.*)$/ ) {
+ my $base = $1;
+ my $type = $2;
+ my $target = $3;
+
+ push @results,
+ "Trying to delete: Base: $base Target: $target Type $type";
+ my ( $val, $msg ) = $Ticket->DeleteLink( Base => $base,
+ Type => $type,
+ Target => $target );
+
+ push @results, $msg;
+
+ }
+
+ }
+ ###
+
+ my @delete_custnums =
+ map { /^Ticket-AddCustomer-(\d+)$/; $1 }
+ grep { /^Ticket-AddCustomer-(\d+)$/ && $ARGSRef->{$_} }
+ keys %$ARGSRef;
+
+ my @custnums = map { /^Ticket-AddCustomer-(\d+)$/; $1 }
+ grep { /^Ticket-AddCustomer-(\d+)$/ && $ARGSRef->{$_} }
+ keys %$ARGSRef;
+
+ foreach my $custnum ( @custnums ) {
+ my( $val, $msg ) =
+ $Ticket->AddLink( 'Type' => 'MemberOf',
+ 'Target' => "freeside://freeside/cust_main/$custnum",
+ );
+ push @results, $msg;
+ }
+
+ return @results;
+
+}
+
+1;
+
diff --git a/rt/lib/RT/URI/freeside.pm b/rt/lib/RT/URI/freeside.pm
index bfb514df8..ebd24ad60 100644
--- a/rt/lib/RT/URI/freeside.pm
+++ b/rt/lib/RT/URI/freeside.pm
@@ -82,10 +82,11 @@ sub FreesideURILabel {
$label = "Freeside service ${svc}: ${tag}";
}
} elsif ($table eq 'cust_main') {
- my ($last, $first, $company) = map { $rec->getfield($_) }
- qw(last first company);
- $label = "Freeside customer ${last}, ${first}";
- $label .= ($company ne '') ? " with ${company}" : '';
+ #my ($last, $first, $company) = map { $rec->getfield($_) }
+ # qw(last first company);
+ #$label = "Freeside customer ${last}, ${first}";
+ #$label .= ($company ne '') ? " with ${company}" : '';
+ $label = "$pkey: ". $rec->name;
} else {
$label = "Freeside ${table}, ${pkeyfield} == ${pkey}";
}
@@ -103,6 +104,61 @@ sub FreesideURILabel {
}
+sub FreesideURILabelLong {
+
+ my $self = shift;
+
+ return(undef) unless (exists($self->{'fstable'}) and
+ exists($self->{'fspkey'}));
+
+ my $label;
+ my ($table, $pkey) = ($self->{'fstable'}, $self->{'fspkey'});
+
+ eval {
+ use FS::UID qw(dbh);
+ use FS::Record qw(qsearchs qsearch dbdef);
+ eval "use FS::$table;";
+ use FS::cust_svc;
+
+ my $dbdef = dbdef or die "No dbdef";
+ my $pkeyfield = $dbdef->table($table)->primary_key
+ or die "No primary key for table $table";
+
+ my $rec = qsearchs($table, { $pkeyfield => $pkey })
+ or die "Record with $pkeyfield == $pkey does not exist in table $table";
+
+ if ($table =~ /^svc_/) {
+ #if ($rec->can('cust_svc')) {
+ # my $cust_svc = $rec->cust_svc or die '$rec->cust_svc failed';
+ # my ($svc, $tag, $svcdb) = $cust_svc->label;
+ # $label = "Freeside service ${svc}: ${tag}";
+ #}
+ $label = '';
+ } elsif ($table eq 'cust_main') {
+ use FS::CGI qw(small_custview);
+ $label = small_custview( $rec,
+ scalar(FS::Conf->new->config('countrydefault')),
+ 1 #nobalance
+ );
+ } else {
+ #$label = "Freeside ${table}, ${pkeyfield} == ${pkey}";
+ $label = '';
+ }
+
+ #... other cases
+
+ };
+
+ if ($label and !$@) {
+ return($label);
+ } else {
+ warn $@;
+ return(undef);
+ }
+
+
+}
+
sub ParseURI {
my $self = shift;
my $uri = shift;
@@ -180,6 +236,22 @@ sub AsString {
}
}
+=head2 AsStringLong
+
+Return a longer (HTML) string representing the URI object.
+
+=cut
+
+sub AsStringLong {
+ my $self = shift;
+ my $prettystring;
+ if ($prettystring = $self->FreesideURILabelLong || $self->FreesideURILabel){
+ return $prettystring;
+ } else {
+ return $self->URI;
+ }
+}
+
eval "require RT::URI::base_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/URI/base_Vendor.pm});
eval "require RT::URI::base_Local";