[Rt-commit] rt branch, 4.4/default-value-in-limit-to-members-of-group, created. rt-4.4.4-148-g516aa424fd

? sunnavy sunnavy at bestpractical.com
Fri Nov 13 17:04:43 EST 2020


The branch, 4.4/default-value-in-limit-to-members-of-group has been created
        at  516aa424fd3ad1fd9b00fc02080829325baf0bbb (commit)

- Log -----------------------------------------------------------------
commit 516aa424fd3ad1fd9b00fc02080829325baf0bbb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Nov 14 05:47:04 2020 +0800

    Fall back GroupId to 0 to get rid of SQL syntax error
    
    When RT::Group::MembersObj was called by an unloaded(no id bound) group
    object, the generated invalid SQL would be:
    
        SELECT main.* FROM GroupMembers main  WHERE (main.GroupId = )  ORDER BY main.id ASC
    
    This commit fixes it to:
    
        SELECT main.* FROM GroupMembers main  WHERE (main.GroupId = 0)  ORDER BY main.id ASC
    
    which is valid and also does the correct thing(no results).

diff --git a/lib/RT/GroupMembers.pm b/lib/RT/GroupMembers.pm
index 1625f1cbf4..106e80990b 100644
--- a/lib/RT/GroupMembers.pm
+++ b/lib/RT/GroupMembers.pm
@@ -147,7 +147,7 @@ sub LimitToMembersOfGroup {
     my $group = shift;
 
     return ($self->Limit( 
-                         VALUE => $group,
+                         VALUE => $group || 0,
                          FIELD => 'GroupId',
                          ENTRYAGGREGATOR => 'OR',
                          QUOTEVALUE => 0

-----------------------------------------------------------------------


More information about the rt-commit mailing list