Hi list,
I'm currently investigating an issue and I think I found a bug. I'm not experienced enough in Perl to know for sure I'm right.
Can someone please confirm that I identified the cause of the problem correctly and, if so, adivce on what I should do next? Post in
bugs.otrs.org?
Version: v3.1.10
Symptoms:
- For some companies, the open ticket count is wrong when shown in AgentTicketZoom, Customer Information "widget". This information appears with a small icon and the text "Open tickets (#)", at the bottom of the aforementioned widget. # is supposed to show the number of tickets opened for current ticket's CustomerID (I know OTRS can also filter by ticket's customer user but I haven't enabled this).
Investigation:
- I enabled query logging on MySQL and saw that the value passed on the
WHERE condition for CustomerID was wrong. This particular CustomerID
contains multiple consecutive spaces. Instead of the correct
value ("some company name - 12345"; notice it contains
double spaces between the first three words) the WHERE condition had a faulty value, with the
double spaces replaced with a single space ("some company name -
12345"). The result was 0 instead of the correct ticket
count.
- I saw in OTRS's sources that the faulty count is computed through a call to Kernel::System::TicketSearch > TicketSearch(), made from Kernel::Output::HTML::CustomerUserGenericTicket > Run()
- In Kernel::System::TicketSearch > TicketSearch(), CustomerID's entry in WHERE is computed in a loop by calling Kernel::System::DB > QueryCondition(). In QueryCondition(), the value for the condition is processed by this code:
# remove double spaces
$Param{Value} =~ s/\s+/ /g;