projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix agent override of invoice_omit_due_date, RT#73002
[freeside.git]
/
httemplate
/
elements
/
checkboxes-table.html
diff --git
a/httemplate/elements/checkboxes-table.html
b/httemplate/elements/checkboxes-table.html
index
cdfa58e
..
d3bbab4
100644
(file)
--- a/
httemplate/elements/checkboxes-table.html
+++ b/
httemplate/elements/checkboxes-table.html
@@
-28,9
+28,9
@@
% my $target_pkey = dbdef->table($opt{'target_table'})->primary_key;
%
% my( $source_pkey, $sourcenum, $source_obj );
% my $target_pkey = dbdef->table($opt{'target_table'})->primary_key;
%
% my( $source_pkey, $sourcenum, $source_obj );
-% if ( $opt{'source_obj'} ) {
+% if ( $opt{'source_obj'}
|| $opt{'object'}
) {
%
%
-% $source_obj = $opt{'source_obj'};
+% $source_obj = $opt{'source_obj'}
|| $opt{'object'}
;
% #$source_table = $source_obj->dbdef_table->table;
% $source_pkey = $source_obj->dbdef_table->primary_key;
% $sourcenum = $source_obj->$source_pkey();
% #$source_table = $source_obj->dbdef_table->table;
% $source_pkey = $source_obj->dbdef_table->primary_key;
% $sourcenum = $source_obj->$source_pkey();
@@
-46,13
+46,19
@@
%
% my $hashref = $opt{'hashref'} || {};
%
%
% my $hashref = $opt{'hashref'} || {};
%
-% my $extra_sql = '';
+% my $extra_sql = $opt{'extra_sql'} || '';
+%
+% if ( $opt{'agent_virt'} ) {
+% $extra_sql .= ' AND' . $FS::CurrentUser::CurrentUser->agentnums_sql(
+% 'null_right' => $opt{'agent_null_right'}
+% );
+% }
%
% if ( $opt{'disable-able'} ) {
% $hashref->{'disabled'} = '';
%
% $extra_sql .= ( $sourcenum && $source_pkey )
%
% if ( $opt{'disable-able'} ) {
% $hashref->{'disabled'} = '';
%
% $extra_sql .= ( $sourcenum && $source_pkey )
-% ? "OR $source_pkey = $sourcenum"
+% ? "
OR $source_pkey = $sourcenum"
% : '';
% }
%
% : '';
% }
%
@@
-63,6
+69,7
@@
% 'select' => $opt{'target_table'}. '.*',
% 'addl_from' => "LEFT JOIN $opt{'link_table'} USING ( $target_pkey )",
% 'extra_sql' => $extra_sql,
% 'select' => $opt{'target_table'}. '.*',
% 'addl_from' => "LEFT JOIN $opt{'link_table'} USING ( $target_pkey )",
% 'extra_sql' => $extra_sql,
+% 'order_by' => $opt{'order_by'},
% })
% ) {
%
% })
% ) {
%
@@
-75,6
+82,14
@@
% ? 'CHECKED'
% : '';
%
% ? 'CHECKED'
% : '';
%
+% } elsif ( !$sourcenum ) { # newly created object, has no links yet
+%
+% if ( ref($opt{'default'}) ) {
+% $checked = $opt{'default'}->{$targetnum} ? 'CHECKED' : '';
+% } else {
+% $checked = $opt{'default'} ? 'CHECKED' : ''
+% }
+%
% } else {
%
% $checked = qsearchs( $opt{'link_table'}, {
% } else {
%
% $checked = qsearchs( $opt{'link_table'}, {
@@
-88,17
+103,12
@@
%
%
%
%
-
- <INPUT TYPE="checkbox" NAME="<% $target_pkey. $targetnum %>" <% $checked %> VALUE="ON">
+% my $color_col = $opt{'color_col'};
+ <INPUT TYPE="checkbox" NAME="<% $target_pkey. $targetnum %>" <% $checked %> VALUE="ON">
<DIV STYLE="display:inline; background-color: #<% $color_col ? $target_obj->$color_col : '' %>">
% if ( $opt{'target_link'} ) {
% if ( $opt{'target_link'} ) {
-
-
<A HREF="<% $opt{'target_link'} %><% $targetnum %>">
<A HREF="<% $opt{'target_link'} %><% $targetnum %>">
-%
-%
% }
%
% }
%
-<% $targetnum %>:
% if ( $opt{'name_callback'} ) {
% if ( $opt{'name_callback'} ) {
@@
-108,7
+118,7
@@
%
%
- <% $target_obj->$name_col() %><% $opt{'target_link'} ? '</A>' : '' %>
+ <% $target_obj->$name_col() %><
/DIV><
% $opt{'target_link'} ? '</A>' : '' %>
% }
% if ( $opt{'disable-able'} ) {
% }
% if ( $opt{'disable-able'} ) {