[freeside-commits] freeside/FS/FS/ClientAPI Signup.pm,1.46,1.47
Ivan,,,
ivan at wavetail.420.am
Sat Feb 7 18:05:28 PST 2009
- Previous message: [freeside-commits] freeside/httemplate/elements tr-select-agent_types.html, 1.1, 1.2 select-agent_types.html, 1.1, 1.2 select-cust-part_pkg.html, 1.2, 1.3 select-part_pkg.html, 1.1, 1.2 select-table.html, 1.13, 1.14
- Next message: [freeside-commits] freeside/httemplate/browse part_pkg.cgi, 1.47, 1.48
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail.420.am:/tmp/cvs-serv1782/FS/FS/ClientAPI
Modified Files:
Signup.pm
Log Message:
further work on agents editing own packages: allow them to see (but not edit) global packages for their type, RT#1331
Index: Signup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/Signup.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- Signup.pm 21 Jul 2008 22:34:34 -0000 1.46
+++ Signup.pm 8 Feb 2009 02:05:26 -0000 1.47
@@ -48,15 +48,20 @@
my $agentnum2part_pkg =
{
map {
- my $href = $_->pkgpart_hashref;
- $_->agentnum =>
+ my $agent = $_;
+ my $href = $agent->pkgpart_hashref;
+ $agent->agentnum =>
[
map { { 'payby' => [ $_->payby ],
'freq_pretty' => $_->freq_pretty,
'options' => { $_->options },
%{$_->hashref}
} }
- grep { $_->svcpart($svc_x) && $href->{ $_->pkgpart } }
+ grep { $_->svcpart($svc_x)
+ && ( $href->{ $_->pkgpart }
+ || $_->agentnum == $agent->agentnum
+ )
+ }
qsearch( 'part_pkg', { 'disabled' => '' } )
];
} qsearch('agent', { 'disabled' => '' })
@@ -73,12 +78,16 @@
};
warn "label: ". Dumper($label). "\n" if $DEBUG > 2;
+ my @agent_fields = qw( agentnum agent );
+
$signup_info_cache = {
'cust_main_county' => [ map $_->hashref,
qsearch('cust_main_county', {} )
],
- 'agent' => [ map $_->hashref,
+ 'agent' => [ map { my $agent = $_;
+ map { $_ => $agent->get($_) } @agent_fields;
+ }
qsearch('agent', { 'disabled' => '' } )
],
@@ -123,6 +132,22 @@
'signup_service' => $svc_x,
'default_svcpart' => scalar($conf->config('signup_server-default_svcpart')),
+ 'head' => join("\n", $conf->config('selfservice-head') ),
+ 'body_header' => join("\n", $conf->config('selfservice-body_header') ),
+ 'body_footer' => join("\n", $conf->config('selfservice-body_footer') ),
+ 'body_bgcolor' => scalar( $conf->config('selfservice-body_bgcolor') ),
+ 'box_bgcolor' => scalar( $conf->config('selfservice-box_bgcolor') ),
+
+ 'company_name' => scalar($conf->config('company_name')),
+
+ #per-agent?
+ 'agent_ship_address' => scalar($conf->exists('agent-ship_address')),
+
+ 'no_company' => scalar($conf->exists('signup-no_company')),
+ 'require_phone' => scalar($conf->exists('cust_main-require_phone')),
+ 'recommend_daytime' => scalar($conf->exists('signup-recommend_daytime')),
+ 'recommend_email' => scalar($conf->exists('signup-recommend_email')),
+
};
$cache->set('signup_info_cache', $signup_info_cache);
@@ -270,6 +295,19 @@
];
warn "$me done setting agent-specific adv. source list\n" if $DEBUG > 1;
+ my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
+
+ $signup_info->{'agent_name'} = $agent->agent;
+
+ $signup_info->{'company_name'} = $conf->config('company_name', $agentnum);
+
+ if ( $signup_info->{'agent_ship_address'} && $agent->agent_custnum ) {
+ my $cust_main = $agent->agent_cust_main;
+ my $prefix = length($cust_main->ship_last) ? 'ship_' : '';
+ $signup_info->{"ship_$_"} = $cust_main->get("$prefix$_")
+ foreach qw( address1 city county state zip country );
+ }
+
}
# else {
# delete $signup_info->{'part_pkg'};
@@ -381,6 +419,19 @@
} );
+ my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
+ if ( $conf->exists('agent_ship_address') && $agent->agent_custnum ) {
+ my $agent_cust_main = $agent->agent_cust_main;
+ my $prefix = length($agent_cust_main->ship_last) ? 'ship_' : '';
+ $cust_main->set("ship_$_", $agent_cust_main->get("$prefix$_") )
+ foreach qw( address1 city county state zip country );
+
+ $cust_main->set("ship_$_", $cust_main->get($_))
+ foreach qw( last first );
+
+ }
+
+
return { 'error' => "Illegal payment type" }
unless grep { $_ eq $packet->{'payby'} }
$conf->config('signup_server-payby');
- Previous message: [freeside-commits] freeside/httemplate/elements tr-select-agent_types.html, 1.1, 1.2 select-agent_types.html, 1.1, 1.2 select-cust-part_pkg.html, 1.2, 1.3 select-part_pkg.html, 1.1, 1.2 select-table.html, 1.13, 1.14
- Next message: [freeside-commits] freeside/httemplate/browse part_pkg.cgi, 1.47, 1.48
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list