Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in system log #246

Closed
fictionedge opened this issue Nov 29, 2013 · 11 comments · Fixed by #520
Closed

Error in system log #246

fictionedge opened this issue Nov 29, 2013 · 11 comments · Fixed by #520
Labels

Comments

@fictionedge
Copy link

Is this a bug in the program?

DB Error #1582

[SELECT T1.dept_name, FORMAT(AVG(DATEDIFF(B2.created, B1.created)), 1) AS ResponseTime FROM ost_department T1 LEFT JOIN ost_ticket T2 ON (T2.dept_id=T1.dept_id) LEFT JOIN ost_ticket_thread B2 ON (B2.ticket_id = T2.ticket_id AND B2.thread_type="R") LEFT JOIN ost_ticket_thread B1 ON (B2.pid = B1.id) LEFT JOIN ost_staff S1 ON (S1.staff_id=B2.staff_id) WHERE T1.dept_id IN (1, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42) AND B1.created BETWEEN FROM_UNIXTIME() AND FROM_UNIXTIME(1385462136) GROUP BY T1.dept_id ORDER BY T1.dept_name] Incorrect parameter count in the call to native function 'FROM_UNIXTIME'

---- Backtrace ----
#0 (root)/include/mysqli.php(125): osTicket->logDBError('DB Error #1582', '[SELECT T1.dept...')
#1 (root)/include/ajax.reports.php(136): db_query('SELECT T1.dept_...')
#2 (root)/include/ajax.reports.php(162): OverviewReportAjaxAPI->getData()
#3 [internal function]: OverviewReportAjaxAPI->getTabularData()
#4 (root)/include/class.dispatcher.php(140): call_user_func_array(Array, Array)
#5 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('table', Array)
#6 (root)/include/class.dispatcher.php(118): Dispatcher->resolve('table', Array)
#7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/report/overvie...', NULL)
#8 (root)/scp/ajax.php(90): Dispatcher->resolve('/report/overvie...')
#9 {main}

@greezybacon
Copy link
Contributor

Looks like a bug to me

@greezybacon
Copy link
Contributor

Looks like $start is not initialized correctly in this block of code in ajax.reports.php, starting on line 37

    function getData() {
        global $thisstaff;

        if(($start = $this->get('start', 'last month'))) {
            $stop = $this->get('stop', 'now');
            if (substr($stop, 0, 1) == '+')
                $stop = $start . $stop;
        } else {
            $start = 'last month';
            $stop = 'now';
        }   

        $start = 'FROM_UNIXTIME('.strtotime($start).')';
        $stop = 'FROM_UNIXTIME('.strtotime($stop).')';

@warsylep
Copy link

I have the exact same issue (varying the querie) when i try to change the time span of the chart in the dashboard page.

[SELECT T1.dept_name,
                FORMAT(AVG(DATEDIFF(T2.closed, T2.created)),1) AS ServiceTime
            FROM ost_department T1
                LEFT JOIN ost_ticket T2 ON (T2.dept_id=T1.dept_id)
                LEFT JOIN ost_staff S1 ON (S1.staff_id=T2.staff_id)
            WHERE T1.dept_id IN (1,4,5) AND T2.closed BETWEEN FROM_UNIXTIME() AND FROM_UNIXTIME(1388162001)
            GROUP BY T1.dept_id
            ORDER BY T1.dept_name]

Incorrect parameter count in the call to native function 'FROM_UNIXTIME'<br />
<br />
---- Backtrace ----<br />
#0 (root)/include/mysqli.php(125): osTicket->logDBError('DB Error #1582', '[SELECT T1.dept...')<br />
#1 (root)/include/ajax.reports.php(136): db_query('SELECT T1.dept_...')<br />
#2 (root)/include/ajax.reports.php(162): OverviewReportAjaxAPI->getData()<br />
#3 [internal function]: OverviewReportAjaxAPI->getTabularData()<br />
#4 (root)/include/class.dispatcher.php(140): call_user_func_array(Array, Array)<br />
#5 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('table', Array)<br />
#6 (root)/include/class.dispatcher.php(118): Dispatcher->resolve('table', Array)<br />
#7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/report/overvie...', NULL)<br />
#8 (root)/scp/ajax.php(90): Dispatcher->resolve('/report/overvie...')<br />
#9 {main}

@nakuld21
Copy link

is there a solution for this yet ?

@rafdeleu
Copy link

rafdeleu commented Feb 3, 2014

We are having the same issue. Is there any sollution for this?

@greezybacon
Copy link
Contributor

Can someone verify if #520 fixes the issue?

@warsylep
Copy link

warsylep commented Feb 4, 2014

From my tests i can confirm that it fixes the issue.
Thank you @greezybacon and @protich .

@nakuld21
Copy link

nakuld21 commented Feb 4, 2014

Can you send the exact steps, I'm not good in php n stuff. Thanks
On 4 Feb, 2014 5:31 pm, "warsylep" notifications@github.com wrote:

From my tests i can confirm that it fixes the issue.
Thank you @greezybacon https://github.com/greezybacon and @protichhttps://github.com/protich.

Reply to this email directly or view it on GitHubhttps://github.com//issues/246#issuecomment-34043028
.

@warsylep
Copy link

warsylep commented Feb 4, 2014

@nakuld21
Dirty fix:
Backup your ajax.reports.php file located in /include/ and replace it with this one.
https://github.com/greezybacon/osTicket-1.8/blob/issue/report-timeframe/include/ajax.reports.php

@nakuld21
Copy link

nakuld21 commented Feb 4, 2014

Thanks , I'll test it out
On 4 Feb, 2014 6:13 pm, "warsylep" notifications@github.com wrote:

@nakuld21 https://github.com/nakuld21
Dirty fix:
Backup your ajax.reports.php file located in /include/ and replace it with
this one.

https://github.com/greezybacon/osTicket-1.8/blob/issue/report-timeframe/include/ajax.reports.php

Reply to this email directly or view it on GitHubhttps://github.com//issues/246#issuecomment-34045920
.

@rafdeleu
Copy link

rafdeleu commented Feb 4, 2014

works, tnx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants