[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
Ivan,,,
ivan at wavetail.420.am
Sat Feb 7 18:05:28 PST 2009
Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv1782/httemplate/elements
Modified Files:
tr-select-agent_types.html select-agent_types.html
select-cust-part_pkg.html select-part_pkg.html
select-table.html
Log Message:
further work on agents editing own packages: allow them to see (but not edit) global packages for their type, RT#1331
Index: select-agent_types.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-agent_types.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- select-agent_types.html 15 Apr 2008 13:42:40 -0000 1.1
+++ select-agent_types.html 8 Feb 2009 02:05:25 -0000 1.2
@@ -1,5 +1,5 @@
%# if ( $cgi->param('clone') ) { #XXX
-% if ( $opt{'disable'} ) {
+% if ( $opt{'disabled'} ) {
<INPUT TYPE="hidden" NAME="agent_type" VALUE="">
Index: select-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-table.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- select-table.html 24 Jan 2009 21:04:17 -0000 1.13
+++ select-table.html 8 Feb 2009 02:05:25 -0000 1.14
@@ -24,6 +24,7 @@
'extra_sql' => '',
'agent_virt' => 0, #set true and make sure the result is JOINed to
#something with agentnum (usually cust_main)
+ 'agent_null' => 0, #set true to always show un-agented entries
'agent_null_right' => '', #right to see un-agented entries
#or
'records' => \@records, #instead of search params
@@ -120,7 +121,8 @@
$extra_sql .=
( $extra_sql =~ /WHERE/i || scalar(keys %$hashref ) ? ' AND ' : ' WHERE ' ).
$FS::CurrentUser::CurrentUser->agentnums_sql(
- 'null_right' => $opt{'agent_null_right'}
+ 'null' => $opt{'agent_null'},
+ 'null_right' => $opt{'agent_null_right'},
);
}
Index: tr-select-agent_types.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-agent_types.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tr-select-agent_types.html 15 Apr 2008 13:42:40 -0000 1.1
+++ tr-select-agent_types.html 8 Feb 2009 02:05:25 -0000 1.2
@@ -1,4 +1,4 @@
-% unless ( $opt{'disable'} || scalar(@all_agent_types) == 1 ) {
+% unless ( $opt{'disabled'} || scalar(@all_agent_types) == 1 ) {
<% include('/elements/tr-justtitle.html', value=>'Agent (reseller) types') %>
Index: select-part_pkg.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-part_pkg.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- select-part_pkg.html 13 Apr 2008 20:35:09 -0000 1.1
+++ select-part_pkg.html 8 Feb 2009 02:05:25 -0000 1.2
@@ -17,6 +17,8 @@
<% include( '/elements/select-table.html',
'table' => 'part_pkg',
+ 'agent_virt' => 1,
+ 'agent_null' => 1,
'name_col' => 'pkg',
'empty_label' => 'Select package', #should this be the default?
'label_callback' => sub { shift->pkg_comment },
@@ -31,4 +33,20 @@
$opt{'records'} = delete $opt{'part_pkg'}
if $opt{'part_pkg'};
+#false laziness w/browse/part_pkg.cgi
+my $agentnums = join(',', $FS::CurrentUser::CurrentUser->agentnums);
+
+$opt{'extra_sql'} .=
+ " AND ( agentnum IS NOT NULL
+ OR 0 < ( SELECT COUNT(*)
+ FROM type_pkgs
+ LEFT JOIN agent_type USING ( typenum )
+ LEFT JOIN agent AS typeagent USING ( typenum )
+ WHERE type_pkgs.pkgpart = part_pkg.pkgpart
+ AND typeagent.agentnum IN ($agentnums)
+ )
+ )
+ ";
+#eofalse
+
</%init>
Index: select-cust-part_pkg.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-cust-part_pkg.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- select-cust-part_pkg.html 13 Apr 2008 20:35:09 -0000 1.2
+++ select-cust-part_pkg.html 8 Feb 2009 02:05:25 -0000 1.3
@@ -32,8 +32,10 @@
or die "cust_main not specified";
$opt{'extra_sql'} .=
- ' AND 0 < ( SELECT COUNT(*) FROM type_pkgs '.
- ' WHERE typenum = '. $cust_main->agent->typenum.
- ' AND type_pkgs.pkgpart = part_pkg.pkgpart )';
+ ' AND ( agentnum IS NOT NULL '.
+ ' OR 0 < ( SELECT COUNT(*) FROM type_pkgs '.
+ ' WHERE typenum = '. $cust_main->agent->typenum.
+ ' AND type_pkgs.pkgpart = part_pkg.pkgpart )'.
+ ' )';
</%init>
More information about the freeside-commits
mailing list