<div dir="ltr">Find `sub Next` in lib/RT/Extension/MergeUsers.pm, put logging or printing debug statements there to check what is going on.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 3, 2013 at 2:29 PM, Nathan Cutler <span dir="ltr"><<a href="mailto:presnypreklad@gmail.com" target="_blank">presnypreklad@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">> Call `print $RT_enabled_users->BuildSelectQuery, "\n";`, check SQL manually<br>
> and it is correct then move to Next function.<br>
<br>
Thanks, Ruslan. I tried your suggestion. It outputs the following<br>
SELECT statement:<br>
<br>
SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1<br>
ON ( Principals_1.id = <a href="http://main.id" target="_blank">main.id</a> ) WHERE (Principals_1.Disabled = '0')<br>
AND (Principals_1.PrincipalType = 'User') ORDER BY main.Name ASC<br>
<br>
which I cut-and-pasted into the mysql prompt. This gives me 167 rows<br>
in alphabetical order. The Perl script's output, however, shows only<br>
151 rows.<br>
<br>
I changed the SELECT statement to output just main.Name (into a file).<br>
Then, I modified my script to output just the Name of each enabled<br>
user (also to a file). And then I diffed the two resulting files. The<br>
SELECT statement yields 16 more users than the Perl script does.<br>
<br>
Here's my guess at what's happening: I'm using the MergeUsers<br>
extension. The SELECT statement ignores the fact that some of the<br>
users have been merged, and simply grabs them all. The Perl script, by<br>
contrast, attempts to get only those users that have not been merged<br>
into other users. But for some reason it fails to do this correctly,<br>
leaving out more users than it should. Significantly, it leaves out 8<br>
users at the end of the list. This would indicate that it's getting a<br>
wrong count of the number of non-merged users. Once it reaches the end<br>
of the count, it simply ignores the remaining users, even though they<br>
are non-merged.<br>
<br>
It's quite possible that I have merged 8 users. These 8 are not in the<br>
list generated by the Perl script. In addition to these 8, another 8<br>
(at the end of the alphabet) are also missing. It's very weird and it<br>
definitely smells like a bug.<br>
<br>
Any ideas appreciated.<br>
<br>
Nathan<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards, Ruslan.
</div>