projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
172673b
)
enhance contacts: contact classes, RT#16819
author
Ivan Kohler
<ivan@freeside.biz>
Sat, 24 Mar 2012 22:40:03 +0000
(15:40 -0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Sat, 24 Mar 2012 22:40:03 +0000
(15:40 -0700)
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/contact.pm
patch
|
blob
|
history
httemplate/browse/contact_class.html
patch
|
blob
|
history
httemplate/edit/contact_class.html
patch
|
blob
|
history
httemplate/edit/process/prospect_main.html
patch
|
blob
|
history
httemplate/elements/menu.html
patch
|
blob
|
history
httemplate/view/prospect_main.html
patch
|
blob
|
history
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
67b6823
..
ab853e6
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-981,6
+981,7
@@
sub tables_hashref {
'prospectnum', 'int', 'NULL', '', '', '',
'custnum', 'int', 'NULL', '', '', '',
'locationnum', 'int', 'NULL', '', '', '', #not yet
'prospectnum', 'int', 'NULL', '', '', '',
'custnum', 'int', 'NULL', '', '', '',
'locationnum', 'int', 'NULL', '', '', '', #not yet
+ 'classnum', 'int', 'NULL', '', '', '',
# 'titlenum', 'int', 'NULL', '', '', '', #eg Mr. Mrs. Dr. Rev.
'last', 'varchar', '', $char_d, '', '',
# 'middle', 'varchar', 'NULL', $char_d, '', '',
# 'titlenum', 'int', 'NULL', '', '', '', #eg Mr. Mrs. Dr. Rev.
'last', 'varchar', '', $char_d, '', '',
# 'middle', 'varchar', 'NULL', $char_d, '', '',
diff --git
a/FS/FS/contact.pm
b/FS/FS/contact.pm
index
0b50dcc
..
f84af42
100644
(file)
--- a/
FS/FS/contact.pm
+++ b/
FS/FS/contact.pm
@@
-5,6
+5,7
@@
use base qw( FS::Record );
use FS::Record qw( qsearch qsearchs dbh );
use FS::prospect_main;
use FS::cust_main;
use FS::Record qw( qsearch qsearchs dbh );
use FS::prospect_main;
use FS::cust_main;
+use FS::contact_class;
use FS::cust_location;
use FS::contact_phone;
use FS::contact_email;
use FS::cust_location;
use FS::contact_phone;
use FS::contact_email;
@@
-322,8
+323,9
@@
sub check {
my $error =
$self->ut_numbern('contactnum')
|| $self->ut_foreign_keyn('prospectnum', 'prospect_main', 'prospectnum')
my $error =
$self->ut_numbern('contactnum')
|| $self->ut_foreign_keyn('prospectnum', 'prospect_main', 'prospectnum')
- || $self->ut_foreign_keyn('custnum',
'cust_main',
'custnum')
+ || $self->ut_foreign_keyn('custnum',
'cust_main',
'custnum')
|| $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
|| $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
+ || $self->ut_foreign_keyn('classnum', 'contact_class', 'classnum')
|| $self->ut_textn('last')
|| $self->ut_textn('first')
|| $self->ut_textn('title')
|| $self->ut_textn('last')
|| $self->ut_textn('first')
|| $self->ut_textn('title')
@@
-357,6
+359,18
@@
sub cust_location {
qsearchs('cust_location', { 'locationnum' => $self->locationnum } );
}
qsearchs('cust_location', { 'locationnum' => $self->locationnum } );
}
+sub contact_class {
+ my $self = shift;
+ return '' unless $self->classnum;
+ qsearchs('contact_class', { 'classnum' => $self->classnum } );
+}
+
+sub contact_classname {
+ my $self = shift;
+ my $contact_class = $self->contact_class or return '';
+ $contact_class->classname;
+}
+
sub contact_phone {
my $self = shift;
qsearch('contact_phone', { 'contactnum' => $self->contactnum } );
sub contact_phone {
my $self = shift;
qsearch('contact_phone', { 'contactnum' => $self->contactnum } );
diff --git
a/httemplate/browse/contact_class.html
b/httemplate/browse/contact_class.html
index
88df24b
..
58215a0
100644
(file)
--- a/
httemplate/browse/contact_class.html
+++ b/
httemplate/browse/contact_class.html
@@
-1,7
+1,7
@@
<% include( 'elements/browse.html',
<% include( 'elements/browse.html',
- 'title' => 'Contact
class
es',
+ 'title' => 'Contact
typ
es',
'html_init' => $html_init,
'html_init' => $html_init,
- 'name' => 'contact
class
es',
+ 'name' => 'contact
typ
es',
'disableable' => 1,
'disabled_statuspos' => 1,
'query' => { 'table' => 'contact_class',
'disableable' => 1,
'disabled_statuspos' => 1,
'query' => { 'table' => 'contact_class',
@@
-21,7
+21,7
@@
die "access denied"
my $html_init =
'Contact classes define types for contacts.<BR><BR>'.
my $html_init =
'Contact classes define types for contacts.<BR><BR>'.
- qq!<A HREF="${p}edit/contact_class.html"><I>Add a contact
class
</I></A><BR><BR>!;
+ qq!<A HREF="${p}edit/contact_class.html"><I>Add a contact
type
</I></A><BR><BR>!;
my $count_query = 'SELECT COUNT(*) FROM contact_class';
my $count_query = 'SELECT COUNT(*) FROM contact_class';
diff --git
a/httemplate/edit/contact_class.html
b/httemplate/edit/contact_class.html
index
2e0965d
..
1ab52e5
100644
(file)
--- a/
httemplate/edit/contact_class.html
+++ b/
httemplate/edit/contact_class.html
@@
-1,6
+1,10
@@
<% include( 'elements/class_Common.html',
<% include( 'elements/class_Common.html',
- 'name' => 'Contact
Class
',
+ 'name' => 'Contact
Type
',
'table' => 'contact_class',
'nocat' => 1,
'table' => 'contact_class',
'nocat' => 1,
+ 'addl_labels' => { 'classnum' => 'Type number',
+ 'classname' => 'Type name',
+ 'disabled' => 'Disable type',
+ },
)
%>
)
%>
diff --git
a/httemplate/edit/process/prospect_main.html
b/httemplate/edit/process/prospect_main.html
index
49481d4
..
7c8cc27
100644
(file)
--- a/
httemplate/edit/process/prospect_main.html
+++ b/
httemplate/edit/process/prospect_main.html
@@
-34,7
+34,7
@@
my $args_callback = sub {
};
};
-my @contact_fields = qw( first last title comment emailaddress );
+my @contact_fields = qw(
classnum
first last title comment emailaddress );
foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) {
push @contact_fields, 'phonetypenum'.$phone_type->phonetypenum;
}
foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) {
push @contact_fields, 'phonetypenum'.$phone_type->phonetypenum;
}
diff --git
a/httemplate/elements/menu.html
b/httemplate/elements/menu.html
index
f096dd8
..
3b0969f
100644
(file)
--- a/
httemplate/elements/menu.html
+++ b/
httemplate/elements/menu.html
@@
-492,7
+492,7
@@
tie my %config_cust, 'Tie::IxHash',
'Customer classes' => [ $fsurl.'browse/cust_class.html', 'Customer classes define groups of customers for reporting.' ],
'Customer categories' => [ $fsurl.'browse/cust_category.html', 'Customer categories define groups of customer classes.' ],
'separator' => '', #its a separator!
'Customer classes' => [ $fsurl.'browse/cust_class.html', 'Customer classes define groups of customers for reporting.' ],
'Customer categories' => [ $fsurl.'browse/cust_category.html', 'Customer categories define groups of customer classes.' ],
'separator' => '', #its a separator!
- 'Contact
classes' => [ $fsurl.'browse/contact_class.html', 'Contact classes define types for contacts.' ],
+ 'Contact
types' => [ $fsurl.'browse/contact_class.html', ''], #XXX useful description
;
$config_cust{'Note classes'} = [ $fsurl.'browse/cust_note_class.html', 'Note classes define groups of customer notes for reporting.' ]
;
$config_cust{'Note classes'} = [ $fsurl.'browse/cust_note_class.html', 'Note classes define groups of customer notes for reporting.' ]
diff --git
a/httemplate/view/prospect_main.html
b/httemplate/view/prospect_main.html
index
1c81956
..
9e85348
100644
(file)
--- a/
httemplate/view/prospect_main.html
+++ b/
httemplate/view/prospect_main.html
@@
-32,7
+32,7
@@
% foreach my $contact ( $prospect_main->contact ) {
<TR>
% foreach my $contact ( $prospect_main->contact ) {
<TR>
- <TD ALIGN="right">Contact</TD>
+ <TD ALIGN="right">
<% $contact->contact_classname %>
Contact</TD>
<TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
</TR>
%}
<TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
</TR>
%}