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

1.10 - Ticket list export outputs only two first lines #3264

Open
sistemasad opened this Issue Jul 11, 2016 · 55 comments

Comments

Projects
None yet
@sistemasad

sistemasad commented Jul 11, 2016

When you click "export" on any ticket list (opened, closed, owned, searched), the CSV generated includes only the first TWO lines.
This also affects to any the result of a search.

The apache logs shows this:
PHP Warning: mysqli_result::close(): Couldn't fetch mysqli_result in /site_1.10.rc3/include/class.orm.php on line 3076, referer: http://------------------/scp/tickets.php

osTicket 1.10.rc3
Centos 6.8 64b
mysql 5.1
php 5.6

Thank you.

@ntozier

This comment has been minimized.

Show comment
Hide comment
@ntozier

ntozier Jul 11, 2016

Contributor

by "includes only the first two lines" @sistemasad actually means the first three (3).
Seeing same behavior on my test installations.

1.10rc3
Win2012 R2 w/ IIS8.5
PHP 5.6

Contributor

ntozier commented Jul 11, 2016

by "includes only the first two lines" @sistemasad actually means the first three (3).
Seeing same behavior on my test installations.

1.10rc3
Win2012 R2 w/ IIS8.5
PHP 5.6

@filipkcz

This comment has been minimized.

Show comment
Hide comment
@filipkcz

filipkcz Aug 29, 2016

Hi, I also confirms the same issue.

osTicket 1.10.rc3
Centos 6.8 64b
mysql 5.5.50-cll, libmysql - 5.1.73
php 5.6

filipkcz commented Aug 29, 2016

Hi, I also confirms the same issue.

osTicket 1.10.rc3
Centos 6.8 64b
mysql 5.5.50-cll, libmysql - 5.1.73
php 5.6

@sistemasad

This comment has been minimized.

Show comment
Hide comment
@sistemasad

sistemasad Oct 17, 2016

Hi,
I've spent a few minutes on this.
On class.export.php file, function dumpTickets, the last instruccion is the return calling self::dumpQuery function.
The last parameter dumpQuery accepts is "$options=array". If you set this to null, tickets are exported correctly. (the other three params are sql,headers and "csv")

It seems the problem is in the options generated by this lines (the fourth param):

array('modify' => function(&$record, $keys) use ($fields) {
foreach ($fields as $k=>$f) {
if (($i = array_search($k, $keys)) !== false) {
$record[$i] = $f->export($f->to_php($record[$i]));
}
}
echo $record
return $record;

sistemasad commented Oct 17, 2016

Hi,
I've spent a few minutes on this.
On class.export.php file, function dumpTickets, the last instruccion is the return calling self::dumpQuery function.
The last parameter dumpQuery accepts is "$options=array". If you set this to null, tickets are exported correctly. (the other three params are sql,headers and "csv")

It seems the problem is in the options generated by this lines (the fourth param):

array('modify' => function(&$record, $keys) use ($fields) {
foreach ($fields as $k=>$f) {
if (($i = array_search($k, $keys)) !== false) {
$record[$i] = $f->export($f->to_php($record[$i]));
}
}
echo $record
return $record;

@thuc960

This comment has been minimized.

Show comment
Hide comment
@thuc960

thuc960 Oct 26, 2016

Please help me, my problem is same

Warning: mysqli_result::close(): Couldn't fetch mysqli_result in ................/include/class.orm.php on line 3089

Warning: mysqli_result::close(): Couldn't fetch mysqli_result in ................/include/class.orm.php on line 3089

thuc960 commented Oct 26, 2016

Please help me, my problem is same

Warning: mysqli_result::close(): Couldn't fetch mysqli_result in ................/include/class.orm.php on line 3089

Warning: mysqli_result::close(): Couldn't fetch mysqli_result in ................/include/class.orm.php on line 3089

@sistemasad

This comment has been minimized.

Show comment
Hide comment
@sistemasad

sistemasad Oct 26, 2016

thuc960,
what I did was change this return call on file class.export.php, about line 85 inside function function dumpTickets($sql, $how='csv'):

_return self::dumpQuery($tickets,
array(
'number' => __('Ticket Number'),
'created' => ('Date Created'),
'cdata.subject' => __('Subject'),
'user.name' => __('From'),
'user.default_email.address' => __('From Email'),
'cdata.:priority.priority_desc' => __('Priority'),
'dept::getLocalName' => __('Department'),
'topic::getName' => __('Help Topic'),
'source' => __('Source'),
'status::getName' =>
('Current Status'),
'lastupdate' => __('Last Updated'),
'est_duedate' => __('Due Date'),
'isoverdue' => __('Overdue'),
'isanswered' => __('Answered'),
'staff::getName' => __('Agent Assigned'),
'team::getName' => __('Team Assigned'),
'thread_count' => __('Thread Count'),
'attachment_count' => _('Attachment Count'),
) + $cdata,
$how,
array('modify' => function(&$record, $keys) use ($fields) {
foreach ($fields as $k=>$f) {
if (($i = array_search($k, $keys)) !== false) {
$record[$i] = $f->export($f->to_php($record[$i]));
}
}
echo $record
return $record;
})
);

With this (remove the last param, after $how,):

_return self::dumpQuery($tickets,
array(
'number' => __('Ticket Number'),
'created' => ('Date Created'),
'cdata.subject' => __('Subject'),
'user.name' => __('From'),
'user.default_email.address' => __('From Email'),
'cdata.:priority.priority_desc' => __('Priority'),
'dept::getLocalName' => __('Department'),
'topic::getName' => __('Help Topic'),
'source' => __('Source'),
'status::getName' =>
('Current Status'),
'lastupdate' => __('Last Updated'),
'est_duedate' => __('Due Date'),
'isoverdue' => __('Overdue'),
'isanswered' => __('Answered'),
'staff::getName' => __('Agent Assigned'),
'team::getName' => __('Team Assigned'),
'thread_count' => __('Thread Count'),
'attachment_count' => _('Attachment Count'),
) + $cdata,
$how,
null
);

BUT, not sure why this Works ;-)
Regards.

sistemasad commented Oct 26, 2016

thuc960,
what I did was change this return call on file class.export.php, about line 85 inside function function dumpTickets($sql, $how='csv'):

_return self::dumpQuery($tickets,
array(
'number' => __('Ticket Number'),
'created' => ('Date Created'),
'cdata.subject' => __('Subject'),
'user.name' => __('From'),
'user.default_email.address' => __('From Email'),
'cdata.:priority.priority_desc' => __('Priority'),
'dept::getLocalName' => __('Department'),
'topic::getName' => __('Help Topic'),
'source' => __('Source'),
'status::getName' =>
('Current Status'),
'lastupdate' => __('Last Updated'),
'est_duedate' => __('Due Date'),
'isoverdue' => __('Overdue'),
'isanswered' => __('Answered'),
'staff::getName' => __('Agent Assigned'),
'team::getName' => __('Team Assigned'),
'thread_count' => __('Thread Count'),
'attachment_count' => _('Attachment Count'),
) + $cdata,
$how,
array('modify' => function(&$record, $keys) use ($fields) {
foreach ($fields as $k=>$f) {
if (($i = array_search($k, $keys)) !== false) {
$record[$i] = $f->export($f->to_php($record[$i]));
}
}
echo $record
return $record;
})
);

With this (remove the last param, after $how,):

_return self::dumpQuery($tickets,
array(
'number' => __('Ticket Number'),
'created' => ('Date Created'),
'cdata.subject' => __('Subject'),
'user.name' => __('From'),
'user.default_email.address' => __('From Email'),
'cdata.:priority.priority_desc' => __('Priority'),
'dept::getLocalName' => __('Department'),
'topic::getName' => __('Help Topic'),
'source' => __('Source'),
'status::getName' =>
('Current Status'),
'lastupdate' => __('Last Updated'),
'est_duedate' => __('Due Date'),
'isoverdue' => __('Overdue'),
'isanswered' => __('Answered'),
'staff::getName' => __('Agent Assigned'),
'team::getName' => __('Team Assigned'),
'thread_count' => __('Thread Count'),
'attachment_count' => _('Attachment Count'),
) + $cdata,
$how,
null
);

BUT, not sure why this Works ;-)
Regards.

@sistemasad sistemasad closed this Oct 26, 2016

@sistemasad sistemasad reopened this Oct 26, 2016

@simonretter

This comment has been minimized.

Show comment
Hide comment
@simonretter

simonretter Nov 4, 2016

I have the same issues. Only 2 tickets are in the export.
Was already in RC3 and RC2 and now in the stable?!

simonretter commented Nov 4, 2016

I have the same issues. Only 2 tickets are in the export.
Was already in RC3 and RC2 and now in the stable?!

@ntozier

This comment has been minimized.

Show comment
Hide comment
@ntozier

ntozier Nov 4, 2016

Contributor

@JediKev @protich
I have just confirmed this report on my v1.10 (901e5ea) test server.

I tried the fix above, and it makes it export more, but still results in a PHP error in the log:
[04-Nov-2016 14:49:25 UTC] PHP Warning: mysqli_result::free(): Couldn't fetch mysqli_result in \support.110\include\mysqli.php on line 185

My guess is that this is where @greezybacon left off changing the source to access the DB from mysli and ORM.

Contributor

ntozier commented Nov 4, 2016

@JediKev @protich
I have just confirmed this report on my v1.10 (901e5ea) test server.

I tried the fix above, and it makes it export more, but still results in a PHP error in the log:
[04-Nov-2016 14:49:25 UTC] PHP Warning: mysqli_result::free(): Couldn't fetch mysqli_result in \support.110\include\mysqli.php on line 185

My guess is that this is where @greezybacon left off changing the source to access the DB from mysli and ORM.

@Eddie595

This comment has been minimized.

Show comment
Hide comment
@Eddie595

Eddie595 Jan 18, 2017

I have patched the file using what @sistemasad recommends, and I am able to export reports, however it looks like by doing so my custom "location" drop-down field grabs the numeric representation sometimes, and sometimes the number (comma) location. Any ideas?

Eddie595 commented Jan 18, 2017

I have patched the file using what @sistemasad recommends, and I am able to export reports, however it looks like by doing so my custom "location" drop-down field grabs the numeric representation sometimes, and sometimes the number (comma) location. Any ideas?

@pberenyi

This comment has been minimized.

Show comment
Hide comment
@pberenyi

pberenyi Feb 3, 2017

Having the same issue on 1.10 final release. Suggested patch seems to fix it.

pberenyi commented Feb 3, 2017

Having the same issue on 1.10 final release. Suggested patch seems to fix it.

@rayfoss rayfoss changed the title from osTicket 1.10-rc3 - Ticket list export outputs only two first lines to 1.10 - Ticket list export outputs only two first lines Feb 8, 2017

@rayfoss rayfoss added this to the 1.11.0 milestone Feb 8, 2017

@balojs

This comment has been minimized.

Show comment
Hide comment
@balojs

balojs Feb 9, 2017

Same problem, thanks @rayfoss

balojs commented Feb 9, 2017

Same problem, thanks @rayfoss

@HansLe

This comment has been minimized.

Show comment
Hide comment
@HansLe

HansLe Feb 15, 2017

I tried the fix above but still results in a PHP error in the log:
PHP Warning: mysqli_result::free(): Couldn't fetch mysqli_result in <path>\include\mysqli.php on line 185

HansLe commented Feb 15, 2017

I tried the fix above but still results in a PHP error in the log:
PHP Warning: mysqli_result::free(): Couldn't fetch mysqli_result in <path>\include\mysqli.php on line 185

@HansLe

This comment has been minimized.

Show comment
Hide comment
@HansLe

HansLe Feb 15, 2017

I made the call of the free() function (mysqli.php on line 185) a commented line and the export works.

HansLe commented Feb 15, 2017

I made the call of the free() function (mysqli.php on line 185) a commented line and the export works.

@tdefreest

This comment has been minimized.

Show comment
Hide comment
@tdefreest

tdefreest Mar 28, 2017

+1 I am having same problem.

@HansLe - Can you clarify? Did you solve the problem? How and where did you make the call of the free() function?

tdefreest commented Mar 28, 2017

+1 I am having same problem.

@HansLe - Can you clarify? Did you solve the problem? How and where did you make the call of the free() function?

@HansLe

This comment has been minimized.

Show comment
Hide comment
@HansLe

HansLe Mar 29, 2017

@tdefreest, my problem was solved. I commented this line (number 185):
// $__db->unbuffered_result->free();
in module include\mssqli.php

HansLe commented Mar 29, 2017

@tdefreest, my problem was solved. I commented this line (number 185):
// $__db->unbuffered_result->free();
in module include\mssqli.php

@sukhdevjadhav

This comment has been minimized.

Show comment
Hide comment
@sukhdevjadhav

sukhdevjadhav Apr 10, 2017

Issue has been resolved for me as per @sistemasad recommendation.

sukhdevjadhav commented Apr 10, 2017

Issue has been resolved for me as per @sistemasad recommendation.

@balojs

This comment has been minimized.

Show comment
Hide comment
@balojs

balojs commented Apr 25, 2017

@demenna

This comment has been minimized.

Show comment
Hide comment
@demenna

demenna May 23, 2017

Commenting the lines as per @sistemasad 's solution re-enables the export but fails to correctly write the custom fields... they appear as numbers... has anyone found a better solution?

demenna commented May 23, 2017

Commenting the lines as per @sistemasad 's solution re-enables the export but fails to correctly write the custom fields... they appear as numbers... has anyone found a better solution?

@cljcharrette

This comment has been minimized.

Show comment
Hide comment
@cljcharrette

cljcharrette May 25, 2017

I'm having the same issue as @demenna. Custom fields now export as numbers.

cljcharrette commented May 25, 2017

I'm having the same issue as @demenna. Custom fields now export as numbers.

@meinsteren

This comment has been minimized.

Show comment
Hide comment
@meinsteren

meinsteren May 30, 2017

bei mir auch.Custom fields now export as numbers.

meinsteren commented May 30, 2017

bei mir auch.Custom fields now export as numbers.

@kclubok

This comment has been minimized.

Show comment
Hide comment
@kclubok

kclubok Jun 20, 2017

The code commented out by @sistemasad is responsible for converting raw data into formatted data. It appears that the error is triggered by a bug somewhere in this code. So commenting out that code prevents the bug, but also disables the formatting logic - that is why custom fields export as numbers.

My understanding of @HansLe 's addition is that the first fix didn't prevent the problem entirely for everybody, and this was needed in addition. I have not seen that behavior myself.

What we still need is a true fix that preserves the formatting logic.

kclubok commented Jun 20, 2017

The code commented out by @sistemasad is responsible for converting raw data into formatted data. It appears that the error is triggered by a bug somewhere in this code. So commenting out that code prevents the bug, but also disables the formatting logic - that is why custom fields export as numbers.

My understanding of @HansLe 's addition is that the first fix didn't prevent the problem entirely for everybody, and this was needed in addition. I have not seen that behavior myself.

What we still need is a true fix that preserves the formatting logic.

@muddharry

This comment has been minimized.

Show comment
Hide comment
@muddharry

muddharry Jul 25, 2017

Export was working fine and exported every ticket then after modifying form ticket details to add some custom fields from using Basic Fields to Custom Lists due to no data populating in the export, we now have the data in the custom field but only get the first 2 lines in export. Thus far we have not found success backing out our changes. There is certainly something going on that needs a proper resolution and I agree the above is not a resolution and needs a proper resolution.

muddharry commented Jul 25, 2017

Export was working fine and exported every ticket then after modifying form ticket details to add some custom fields from using Basic Fields to Custom Lists due to no data populating in the export, we now have the data in the custom field but only get the first 2 lines in export. Thus far we have not found success backing out our changes. There is certainly something going on that needs a proper resolution and I agree the above is not a resolution and needs a proper resolution.

@Jamas-J

This comment has been minimized.

Show comment
Hide comment
@Jamas-J

Jamas-J Aug 5, 2017

HI everyone, sorry a bit lost with multiple tickets, so whats the solution?

Jamas-J commented Aug 5, 2017

HI everyone, sorry a bit lost with multiple tickets, so whats the solution?

@kclubok

This comment has been minimized.

Show comment
Hide comment
@kclubok

kclubok Aug 6, 2017

There is no complete solution as of yet, at least not if you want custom fields to export correctly. If you're OK with them not exporting correctly, then the comment on October 26 will point you in the right direction.

kclubok commented Aug 6, 2017

There is no complete solution as of yet, at least not if you want custom fields to export correctly. If you're OK with them not exporting correctly, then the comment on October 26 will point you in the right direction.

@razarate

This comment has been minimized.

Show comment
Hide comment
@razarate

razarate Oct 25, 2017

Well we needed this fixed so make a workaround ... maybe is not as clean as we like it but it works.

This is the full dumptickets function (workaround starts around line 83)

static function dumpTickets($sql, $how='csv') {
    // Add custom fields to the $sql statement
    $cdata = $fields = array();
    foreach (TicketForm::getInstance()->getFields() as $f) {
        // Ignore core fields
        if (in_array($f->get('name'), array('priority')))
            continue;
        // Ignore non-data fields
        elseif (!$f->hasData() || $f->isPresentationOnly())
            continue;

        $name = $f->get('name') ?: 'field_'.$f->get('id');
        $key = 'cdata.'.$name;
        $fields[$key] = $f;
        $cdata[$key] = $f->getLocal('label');
    }
    // Reset the $sql query
    $tickets = $sql->models()
        ->select_related('user', 'user__default_email', 'dept', 'staff',
            'team', 'staff', 'cdata', 'topic', 'status', 'cdata__:priority')
        ->options(QuerySet::OPT_NOCACHE)
        ->annotate(array(
            'collab_count' => TicketThread::objects()
                ->filter(array('ticket__ticket_id' => new SqlField('ticket_id', 1)))
                ->aggregate(array('count' => SqlAggregate::COUNT('collaborators__id'))),
            'attachment_count' => TicketThread::objects()
                ->filter(array('ticket__ticket_id' => new SqlField('ticket_id', 1)))
                ->filter(array('entries__attachments__inline' => 0))
                ->aggregate(array('count' => SqlAggregate::COUNT('entries__attachments__id'))),
            'thread_count' => TicketThread::objects()
                ->filter(array('ticket__ticket_id' => new SqlField('ticket_id', 1)))
                ->exclude(array('entries__flags__hasbit' => ThreadEntry::FLAG_HIDDEN))
                ->aggregate(array('count' => SqlAggregate::COUNT('entries__id'))),
        ));

    // Fetch staff information
    // FIXME: Adjust Staff model so it doesn't do extra queries
    foreach (Staff::objects() as $S)
        $S->get('junk');

    //custom list
    $sql = 'SELECT type, name FROM ost_form_field WHERE type like "list%" ';  //fields
    $query = db_query($sql);
    $type_lists = array();
    while($row = mysqli_fetch_assoc($query)){
      $type_lists[] = $row;
    }

    $list = array();
    foreach($type_lists as $type_list){
      $list_id = intval(substr($type_list['type'], 5));
      
      $sql = 'SELECT id, value FROM ost_list_items WHERE list_id = '.$list_id; //list elements
      $query = db_query($sql);
      while($row = mysqli_fetch_assoc($query)){
        $list[$type_list['name']][$row['id']] = $row['value'];
      }
    }
              
    $cambio = array('modify' => function(&$record, $keys) use ($fields, $list) {
      $fields_array = array();
      foreach($keys as $key => $row){
        if(strpos($row, 'cdata.') === 0){ 
          $fields_array[$key] = substr($row, 6);
          if(isset($list[$fields_array[$key]]))
            $fields_list[] = $key;
        }
      }
      foreach ($fields as $k=>$f) {
        if (($i = array_search($k, $keys)) !== false) {
          if(in_array($i, $fields_list)){
            $record[$i] = $list[$fields_array[$i]][intval($record[$i])];
          }else{
            $record[$i] = $f->export($f->to_php($record[$i]));
          }
        }
      }
      return $record;
    });

I hope this works for someone else .....

razarate commented Oct 25, 2017

Well we needed this fixed so make a workaround ... maybe is not as clean as we like it but it works.

This is the full dumptickets function (workaround starts around line 83)

static function dumpTickets($sql, $how='csv') {
    // Add custom fields to the $sql statement
    $cdata = $fields = array();
    foreach (TicketForm::getInstance()->getFields() as $f) {
        // Ignore core fields
        if (in_array($f->get('name'), array('priority')))
            continue;
        // Ignore non-data fields
        elseif (!$f->hasData() || $f->isPresentationOnly())
            continue;

        $name = $f->get('name') ?: 'field_'.$f->get('id');
        $key = 'cdata.'.$name;
        $fields[$key] = $f;
        $cdata[$key] = $f->getLocal('label');
    }
    // Reset the $sql query
    $tickets = $sql->models()
        ->select_related('user', 'user__default_email', 'dept', 'staff',
            'team', 'staff', 'cdata', 'topic', 'status', 'cdata__:priority')
        ->options(QuerySet::OPT_NOCACHE)
        ->annotate(array(
            'collab_count' => TicketThread::objects()
                ->filter(array('ticket__ticket_id' => new SqlField('ticket_id', 1)))
                ->aggregate(array('count' => SqlAggregate::COUNT('collaborators__id'))),
            'attachment_count' => TicketThread::objects()
                ->filter(array('ticket__ticket_id' => new SqlField('ticket_id', 1)))
                ->filter(array('entries__attachments__inline' => 0))
                ->aggregate(array('count' => SqlAggregate::COUNT('entries__attachments__id'))),
            'thread_count' => TicketThread::objects()
                ->filter(array('ticket__ticket_id' => new SqlField('ticket_id', 1)))
                ->exclude(array('entries__flags__hasbit' => ThreadEntry::FLAG_HIDDEN))
                ->aggregate(array('count' => SqlAggregate::COUNT('entries__id'))),
        ));

    // Fetch staff information
    // FIXME: Adjust Staff model so it doesn't do extra queries
    foreach (Staff::objects() as $S)
        $S->get('junk');

    //custom list
    $sql = 'SELECT type, name FROM ost_form_field WHERE type like "list%" ';  //fields
    $query = db_query($sql);
    $type_lists = array();
    while($row = mysqli_fetch_assoc($query)){
      $type_lists[] = $row;
    }

    $list = array();
    foreach($type_lists as $type_list){
      $list_id = intval(substr($type_list['type'], 5));
      
      $sql = 'SELECT id, value FROM ost_list_items WHERE list_id = '.$list_id; //list elements
      $query = db_query($sql);
      while($row = mysqli_fetch_assoc($query)){
        $list[$type_list['name']][$row['id']] = $row['value'];
      }
    }
              
    $cambio = array('modify' => function(&$record, $keys) use ($fields, $list) {
      $fields_array = array();
      foreach($keys as $key => $row){
        if(strpos($row, 'cdata.') === 0){ 
          $fields_array[$key] = substr($row, 6);
          if(isset($list[$fields_array[$key]]))
            $fields_list[] = $key;
        }
      }
      foreach ($fields as $k=>$f) {
        if (($i = array_search($k, $keys)) !== false) {
          if(in_array($i, $fields_list)){
            $record[$i] = $list[$fields_array[$i]][intval($record[$i])];
          }else{
            $record[$i] = $f->export($f->to_php($record[$i]));
          }
        }
      }
      return $record;
    });

I hope this works for someone else .....

@kclubok

This comment has been minimized.

Show comment
Hide comment
@kclubok

kclubok Oct 26, 2017

Razarate's solution worked like a charm for me - with a small modification. I think that razarate forgot to include the following essential part of the revised dumptickets function:

 return self::dumpQuery($tickets,
        array(
            'number' =>         __('Ticket Number'),
            'created' =>        __('Date Created'),
            'cdata.subject' =>  __('Subject'),
            'user.name' =>      __('From'),
            'user.default_email.address' => __('From Email'),
            'cdata.:priority.priority_desc' => __('Priority'),
            'dept::getLocalName' => __('Department'),
            'topic::getName' => __('Help Topic'),
            'source' =>         __('Source'),
            'status::getName' =>__('Current Status'),
            'lastupdate' =>     __('Last Updated'),
            'est_duedate' =>    __('Due Date'),
            'isoverdue' =>      __('Overdue'),
            'isanswered' =>     __('Answered'),
            'staff::getName' => __('Agent Assigned'),
            'team::getName' =>  __('Team Assigned'),
            'thread_count' =>   __('Thread Count'),
            'attachment_count' => __('Attachment Count'),
        ) + $cdata,
        $how,
        $cambio
        );

kclubok commented Oct 26, 2017

Razarate's solution worked like a charm for me - with a small modification. I think that razarate forgot to include the following essential part of the revised dumptickets function:

 return self::dumpQuery($tickets,
        array(
            'number' =>         __('Ticket Number'),
            'created' =>        __('Date Created'),
            'cdata.subject' =>  __('Subject'),
            'user.name' =>      __('From'),
            'user.default_email.address' => __('From Email'),
            'cdata.:priority.priority_desc' => __('Priority'),
            'dept::getLocalName' => __('Department'),
            'topic::getName' => __('Help Topic'),
            'source' =>         __('Source'),
            'status::getName' =>__('Current Status'),
            'lastupdate' =>     __('Last Updated'),
            'est_duedate' =>    __('Due Date'),
            'isoverdue' =>      __('Overdue'),
            'isanswered' =>     __('Answered'),
            'staff::getName' => __('Agent Assigned'),
            'team::getName' =>  __('Team Assigned'),
            'thread_count' =>   __('Thread Count'),
            'attachment_count' => __('Attachment Count'),
        ) + $cdata,
        $how,
        $cambio
        );
@evertvh

This comment has been minimized.

Show comment
Hide comment
@evertvh

evertvh Mar 2, 2018

Hi, is there any news on when this will be fixed in v1.10.1?

evertvh commented Mar 2, 2018

Hi, is there any news on when this will be fixed in v1.10.1?

@ntozier

This comment has been minimized.

Show comment
Hide comment
@ntozier

ntozier Mar 2, 2018

Contributor

1.10.1 is already out... so it wont e fixed in 1.10.1.
I imagine that it will likely be fixed in 1.11 when it is released.

Contributor

ntozier commented Mar 2, 2018

1.10.1 is already out... so it wont e fixed in 1.10.1.
I imagine that it will likely be fixed in 1.11 when it is released.

@elma1003

This comment has been minimized.

Show comment
Hide comment
@elma1003

elma1003 May 16, 2018

Hello,
@ntozier there are I can find class.export.php with modifications?
Many thanks!

elma1003 commented May 16, 2018

Hello,
@ntozier there are I can find class.export.php with modifications?
Many thanks!

@ntozier

This comment has been minimized.

Show comment
Hide comment
@ntozier

ntozier May 16, 2018

Contributor

@elma1003 huh?

Contributor

ntozier commented May 16, 2018

@elma1003 huh?

@elma1003

This comment has been minimized.

Show comment
Hide comment
@elma1003

elma1003 May 16, 2018

I've patched 1.10 by commenting
//->options(QuerySet::OPT_NOCACHE)
The export was working fine after this

Now I've installed v1.10.1 (9ae093d)
Export is not ok, only 3 lines.
I am trying to pach and it is not ok, nothing works
I've downloaded 1.10.2 from https://github.com/osTicket/osTicket/releases/tag/v1.10.2
but class.export.php is the same as in 1.10
Please help....

elma1003 commented May 16, 2018

I've patched 1.10 by commenting
//->options(QuerySet::OPT_NOCACHE)
The export was working fine after this

Now I've installed v1.10.1 (9ae093d)
Export is not ok, only 3 lines.
I am trying to pach and it is not ok, nothing works
I've downloaded 1.10.2 from https://github.com/osTicket/osTicket/releases/tag/v1.10.2
but class.export.php is the same as in 1.10
Please help....

@kclubok

This comment has been minimized.

Show comment
Hide comment
@kclubok

kclubok May 17, 2018

@elma1003 Have you tried using Razarate's solution?

kclubok commented May 17, 2018

@elma1003 Have you tried using Razarate's solution?

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev May 17, 2018

Member

@elma1003 @kclubok

A fix for this is included in the upcoming version of v1.11.0rc-1 (releasing soon).

@elma1003

Idk what's happening with your instance as I just commented out that line on my v1.10.1 instance an it's exporting all tickets properly.

Cheers.

Member

JediKev commented May 17, 2018

@elma1003 @kclubok

A fix for this is included in the upcoming version of v1.11.0rc-1 (releasing soon).

@elma1003

Idk what's happening with your instance as I just commented out that line on my v1.10.1 instance an it's exporting all tickets properly.

Cheers.

@evertvh

This comment has been minimized.

Show comment
Hide comment
@evertvh

evertvh May 23, 2018

Did anyone get the export - including custom fields - to work? I can't seem to figure it out.

I tried razarate's solution including kclubok's feedback, and tried the 1.11.x-version of the class.export.php file but it doesn't incluse the custom fields.

Perhaps a kind soul who did manage could post the modified class.export.php file here?

evertvh commented May 23, 2018

Did anyone get the export - including custom fields - to work? I can't seem to figure it out.

I tried razarate's solution including kclubok's feedback, and tried the 1.11.x-version of the class.export.php file but it doesn't incluse the custom fields.

Perhaps a kind soul who did manage could post the modified class.export.php file here?

@tdefreest

This comment has been minimized.

Show comment
Hide comment
@tdefreest

tdefreest Jun 8, 2018

This fixed used to work for me. Suddenly, it is no longer working. Not sure what happened?

tdefreest commented Jun 8, 2018

This fixed used to work for me. Suddenly, it is no longer working. Not sure what happened?

@kclubok

This comment has been minimized.

Show comment
Hide comment
@kclubok

kclubok Jun 8, 2018

@JediKev

Could you point us toward the commit for v.11.0rc-1 that fixes this? It would be quite helpful!

I hope that the fix is not simply commenting out that line. As mentioned before, that doesn't produce the correct behavior if there are custom list fields.

kclubok commented Jun 8, 2018

@JediKev

Could you point us toward the commit for v.11.0rc-1 that fixes this? It would be quite helpful!

I hope that the fix is not simply commenting out that line. As mentioned before, that doesn't produce the correct behavior if there are custom list fields.

@Zixt

This comment has been minimized.

Show comment
Hide comment
@Zixt

Zixt Jul 14, 2018

Still having this issue using the class.export.php file located by evertvh.

I have tried various fixes listed on this issue but no joy.

I have a modified csv format with an additional column added to show the "organisation" that each user belongs to, as detailed on the osticket forum - http://osticket.com/forum/discussion/92606/customising-ticket-csv-export-correct#latest

Zixt commented Jul 14, 2018

Still having this issue using the class.export.php file located by evertvh.

I have tried various fixes listed on this issue but no joy.

I have a modified csv format with an additional column added to show the "organisation" that each user belongs to, as detailed on the osticket forum - http://osticket.com/forum/discussion/92606/customising-ticket-csv-export-correct#latest

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Jul 14, 2018

Member

@Zixt

Thank you but we have actually addressed these issues in v1.11.0rc-1 (releasing very soon; hopefully by Monday). Along with addressing the original issue it adds the ability to customize what fields you want to export.

Cheers.

Member

JediKev commented Jul 14, 2018

@Zixt

Thank you but we have actually addressed these issues in v1.11.0rc-1 (releasing very soon; hopefully by Monday). Along with addressing the original issue it adds the ability to customize what fields you want to export.

Cheers.

@Zixt

This comment has been minimized.

Show comment
Hide comment
@Zixt

Zixt Jul 16, 2018

@JediKev

Ah okay - nice one.

Cheers.

Zixt commented Jul 16, 2018

@JediKev

Ah okay - nice one.

Cheers.

@Zixt

This comment has been minimized.

Show comment
Hide comment
@Zixt

Zixt Jul 17, 2018

Hi @JediKev

I've updated to the latest release on our installation, but I'm having some trouble customising the queue to my spec?

Apologies if this is not the correct place to ask!

I've managed to add "Organisation" to the Queue page correctly using a custom field with primary data source set to "User / Organisation / Name"

However - I have no option to add a custom field to the Export tab, and can only select from a set of predefined field headers.

Is there something I am missing?

Zixt commented Jul 17, 2018

Hi @JediKev

I've updated to the latest release on our installation, but I'm having some trouble customising the queue to my spec?

Apologies if this is not the correct place to ask!

I've managed to add "Organisation" to the Queue page correctly using a custom field with primary data source set to "User / Organisation / Name"

However - I have no option to add a custom field to the Export tab, and can only select from a set of predefined field headers.

Is there something I am missing?

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Jul 17, 2018

Member

@Zixt

This is not the place to report your issue. You would open your own issue and fill out the New Issue Template. With that being said, I will go ahead and post my response below so you at least have a quick answer. 👍

Disclaimer: The following only applies to v1.11.0rc-1

Currently, you cannot add User fields, Org fields, etc. to Custom Queue Exports as this feature is only in phase 1 (or version 1) and is limited. I believe it will be expanded more and more over time to allow all kinds of fields. You can see all the fields you can add/rearrange now under Admin Panel > Settings > Tickets > Queues > click queue name > Export > Add Other Field.

(I'm sorry I answered you wrong previously; I thought the new Exporter had the option to add those types of fields but it turns out it doesn't. At least Exports are customizable now though!)

** Side Note

You can always export a User's Organization Name by going to Agent Panel > Users > User Directory and clicking Export at the bottom.


Cheers.

Member

JediKev commented Jul 17, 2018

@Zixt

This is not the place to report your issue. You would open your own issue and fill out the New Issue Template. With that being said, I will go ahead and post my response below so you at least have a quick answer. 👍

Disclaimer: The following only applies to v1.11.0rc-1

Currently, you cannot add User fields, Org fields, etc. to Custom Queue Exports as this feature is only in phase 1 (or version 1) and is limited. I believe it will be expanded more and more over time to allow all kinds of fields. You can see all the fields you can add/rearrange now under Admin Panel > Settings > Tickets > Queues > click queue name > Export > Add Other Field.

(I'm sorry I answered you wrong previously; I thought the new Exporter had the option to add those types of fields but it turns out it doesn't. At least Exports are customizable now though!)

** Side Note

You can always export a User's Organization Name by going to Agent Panel > Users > User Directory and clicking Export at the bottom.


Cheers.

@lavdnone

This comment has been minimized.

Show comment
Hide comment
@lavdnone

lavdnone Jul 24, 2018

same " 1.10 - Ticket list export outputs only two first lines" in 1.10.4 after update from 1.10.1

this might be about it:
[SELECT A3.staff_id AS lock__staff_id, A1.staff_id AS staff_id, A1.isoverdue AS isoverdue, A1.team_id AS team_id, A1.ticket_id AS ticket_id, A1.number AS number, A4.subject AS cdata__subject, A6.address AS user__default_email__address, A1.source AS source, A7.priority_color AS cdata__:priority__priority_color, A7.priority_desc AS cdata__:priority__priority_desc, A1.status_id AS status_id, A8.name AS status__name, A8.state AS status__state, A1.dept_id AS dept_id, B0.name AS dept__name, A5.name AS user__name, A1.lastupdate AS lastupdate, A1.isanswered AS isanswered, B1.firstname AS staff__firstname, B1.lastname AS staff__lastname, B2.name AS team__name, (SELECT COUNT(R0.id) AS count FROM ost_thread Q7 JOIN ost_ticket Q8 ON (Q7.object_type = 'T' AND Q7.object_id = Q8.ticket_id) LEFT JOIN ost_thread_collaborator R0 ON (Q7.id = R0.thread_id) WHERE Q8.ticket_id = A1.ticket_id) AS collab_count, (SELECT COUNT(R1.id) AS count FROM ost_thread Q7 JOIN ost_ticket Q8 ON (Q7.object_type = 'T' AND Q7.object_id = Q8.ticket_id) LEFT JOIN ost_thread_entry R0 ON (Q7.id = R0.thread_id) LEFT JOIN ost_attachment R1 ON (R1.type = 'H' AND R0.id = R1.object_id) WHERE Q8.ticket_id = A1.ticket_id AND R1.inline = 0) AS attachment_count, (SELECT COUNT(R0.id) AS count FROM ost_thread Q7 JOIN ost_ticket Q8 ON (Q7.object_type = 'T' AND Q7.object_id = Q8.ticket_id) LEFT JOIN ost_thread_entry R0 ON (Q7.id = R0.thread_id) WHERE Q8.ticket_id = A1.ticket_id AND NOT R0.flags & 4 != 0) AS thread_count FROM ost_ticket A1 JOIN (SELECT Q7.ticket_id FROM ost_ticket Q7 JOIN ost_ticket_status Q8 ON (Q7.status_id = Q8.id) WHERE Q8.state = 'closed' AND ((Q8.state = 'open' AND (Q7.staff_id = 2 OR Q7.team_id IN (1))) OR Q7.dept_id IN ('1', '2', '3')) ORDER BY Q7.ASC LIMIT 25) A2 LEFT JOIN `ost_lock` A3 ON (A1.`lock_id` = A3.`lock_id` AND A3.`expire` > NOW()) LEFT JOIN `ost_ticket__cdata` A4 ON (A1.`ticket_id` = A4.`ticket_id`) JOIN `ost_user` A5 ON (A1.`user_id` = A5.`id`) LEFT JOIN `ost_user_email` A6 ON (A5.`default_email_id` = A6.`id`) LEFT JOIN `ost_ticket_priority` A7 ON (A4.`priority` = A7.`priority_id`) JOIN `ost_ticket_status` A8 ON (A1.`status_id` = A8.`id`) JOIN `ost_department` B0 ON (A1.`dept_id` = B0.`id`) LEFT JOIN `ost_staff` B1 ON (A1.`staff_id` = B1.`staff_id`) LEFT JOIN `ost_team` B2 ON (A1.`team_id` = B2.`team_id`) WHERE A1.`ticket_id` = A2.`ticket_id` GROUP BY A3.`staff_id`, A1.`staff_id`, A1.`isoverdue`, A1.`team_id`, A1.`ticket_id`, A1.`number`, A4.`subject`, A6.`address`, A1.`source`, A7.`priority_color`, A7.`priority_desc`, A1.`status_id`, A8.`name`, A8.`state`, A1.`dept_id`, B0.`name`, A5.`name`, A1.`lastupdate`, A1.`isanswered`, B1.`firstname`, B1.`lastname`, B2.`name` ORDER BY A1. ASC]

Unknown column 'Q7.' in 'order clause'



---- Backtrace ----

#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1054', '[SELECT A3.sta...')<br /> #1 (root)/include/class.orm.php(3136): db_query('SELECT A3.staf...', true, true)

#2 (root)/include/class.orm.php(3183): MySqlExecutor->execute()

#3 (root)/include/class.orm.php(1868): MySqlExecutor->getArray()

#4 (root)/include/class.orm.php(1818): HashArrayIterator->{closure}()

#5 (root)/include/class.orm.php(1797): CallbackSimpleIterator->next()

#6 (root)/include/class.orm.php(1806): CallbackSimpleIterator->rewind()

#7 (root)/include/class.orm.php(1463): CallbackSimpleIterator->valid()

#8 (root)/include/class.orm.php(1480): CachedResultSet->fillTo(9223372036854775807)

#9 (root)/include/class.orm.php(1489): CachedResultSet->asArray()

#10 (root)/include/staff/tickets.inc.php(570): CachedResultSet->getIterator()

#11 (root)/scp/tickets.php(495): require_once('(root)/in...')

#12 {main}

lavdnone commented Jul 24, 2018

same " 1.10 - Ticket list export outputs only two first lines" in 1.10.4 after update from 1.10.1

this might be about it:
[SELECT A3.staff_id AS lock__staff_id, A1.staff_id AS staff_id, A1.isoverdue AS isoverdue, A1.team_id AS team_id, A1.ticket_id AS ticket_id, A1.number AS number, A4.subject AS cdata__subject, A6.address AS user__default_email__address, A1.source AS source, A7.priority_color AS cdata__:priority__priority_color, A7.priority_desc AS cdata__:priority__priority_desc, A1.status_id AS status_id, A8.name AS status__name, A8.state AS status__state, A1.dept_id AS dept_id, B0.name AS dept__name, A5.name AS user__name, A1.lastupdate AS lastupdate, A1.isanswered AS isanswered, B1.firstname AS staff__firstname, B1.lastname AS staff__lastname, B2.name AS team__name, (SELECT COUNT(R0.id) AS count FROM ost_thread Q7 JOIN ost_ticket Q8 ON (Q7.object_type = 'T' AND Q7.object_id = Q8.ticket_id) LEFT JOIN ost_thread_collaborator R0 ON (Q7.id = R0.thread_id) WHERE Q8.ticket_id = A1.ticket_id) AS collab_count, (SELECT COUNT(R1.id) AS count FROM ost_thread Q7 JOIN ost_ticket Q8 ON (Q7.object_type = 'T' AND Q7.object_id = Q8.ticket_id) LEFT JOIN ost_thread_entry R0 ON (Q7.id = R0.thread_id) LEFT JOIN ost_attachment R1 ON (R1.type = 'H' AND R0.id = R1.object_id) WHERE Q8.ticket_id = A1.ticket_id AND R1.inline = 0) AS attachment_count, (SELECT COUNT(R0.id) AS count FROM ost_thread Q7 JOIN ost_ticket Q8 ON (Q7.object_type = 'T' AND Q7.object_id = Q8.ticket_id) LEFT JOIN ost_thread_entry R0 ON (Q7.id = R0.thread_id) WHERE Q8.ticket_id = A1.ticket_id AND NOT R0.flags & 4 != 0) AS thread_count FROM ost_ticket A1 JOIN (SELECT Q7.ticket_id FROM ost_ticket Q7 JOIN ost_ticket_status Q8 ON (Q7.status_id = Q8.id) WHERE Q8.state = 'closed' AND ((Q8.state = 'open' AND (Q7.staff_id = 2 OR Q7.team_id IN (1))) OR Q7.dept_id IN ('1', '2', '3')) ORDER BY Q7.ASC LIMIT 25) A2 LEFT JOIN `ost_lock` A3 ON (A1.`lock_id` = A3.`lock_id` AND A3.`expire` > NOW()) LEFT JOIN `ost_ticket__cdata` A4 ON (A1.`ticket_id` = A4.`ticket_id`) JOIN `ost_user` A5 ON (A1.`user_id` = A5.`id`) LEFT JOIN `ost_user_email` A6 ON (A5.`default_email_id` = A6.`id`) LEFT JOIN `ost_ticket_priority` A7 ON (A4.`priority` = A7.`priority_id`) JOIN `ost_ticket_status` A8 ON (A1.`status_id` = A8.`id`) JOIN `ost_department` B0 ON (A1.`dept_id` = B0.`id`) LEFT JOIN `ost_staff` B1 ON (A1.`staff_id` = B1.`staff_id`) LEFT JOIN `ost_team` B2 ON (A1.`team_id` = B2.`team_id`) WHERE A1.`ticket_id` = A2.`ticket_id` GROUP BY A3.`staff_id`, A1.`staff_id`, A1.`isoverdue`, A1.`team_id`, A1.`ticket_id`, A1.`number`, A4.`subject`, A6.`address`, A1.`source`, A7.`priority_color`, A7.`priority_desc`, A1.`status_id`, A8.`name`, A8.`state`, A1.`dept_id`, B0.`name`, A5.`name`, A1.`lastupdate`, A1.`isanswered`, B1.`firstname`, B1.`lastname`, B2.`name` ORDER BY A1. ASC]

Unknown column 'Q7.' in 'order clause'



---- Backtrace ----

#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1054', '[SELECT A3.sta...')<br /> #1 (root)/include/class.orm.php(3136): db_query('SELECT A3.staf...', true, true)

#2 (root)/include/class.orm.php(3183): MySqlExecutor->execute()

#3 (root)/include/class.orm.php(1868): MySqlExecutor->getArray()

#4 (root)/include/class.orm.php(1818): HashArrayIterator->{closure}()

#5 (root)/include/class.orm.php(1797): CallbackSimpleIterator->next()

#6 (root)/include/class.orm.php(1806): CallbackSimpleIterator->rewind()

#7 (root)/include/class.orm.php(1463): CallbackSimpleIterator->valid()

#8 (root)/include/class.orm.php(1480): CachedResultSet->fillTo(9223372036854775807)

#9 (root)/include/class.orm.php(1489): CachedResultSet->asArray()

#10 (root)/include/staff/tickets.inc.php(570): CachedResultSet->getIterator()

#11 (root)/scp/tickets.php(495): require_once('(root)/in...')

#12 {main}

@P7570

This comment has been minimized.

Show comment
Hide comment
@P7570

P7570 Jul 31, 2018

v1.11.0-rc1 export with header only.

P7570 commented Jul 31, 2018

v1.11.0-rc1 export with header only.

@stf675

This comment has been minimized.

Show comment
Hide comment
@stf675

stf675 Aug 2, 2018

1.10 upgraded to 1.11rc1

dashboard export works, ticket export: can’t find the file at http://xxxxxxxx.xxxxxxx.com/helpdesk/scp/tickets.php?a=export&queue=adhoc,ikDr5jdnAc.

stf675 commented Aug 2, 2018

1.10 upgraded to 1.11rc1

dashboard export works, ticket export: can’t find the file at http://xxxxxxxx.xxxxxxx.com/helpdesk/scp/tickets.php?a=export&queue=adhoc,ikDr5jdnAc.

jamesangi pushed a commit to jamesangi/osTicket that referenced this issue Aug 3, 2018

jamesangi pushed a commit to jamesangi/osTicket that referenced this issue Aug 3, 2018

@lavdnone

This comment has been minimized.

Show comment
Hide comment
@lavdnone

lavdnone Aug 6, 2018

1.10.4 already has this lines, same issue - just two lines in csv header and one ticket

lavdnone commented Aug 6, 2018

1.10.4 already has this lines, same issue - just two lines in csv header and one ticket

@alan1818

This comment has been minimized.

Show comment
Hide comment
@alan1818

alan1818 Aug 17, 2018

osTicket Version | v1.10.4
PHP Version | 5.6.37

Review your recommendations however I continue with the same problem, when exporting the report of tickets with "closed" status, the file only shows me 1 ticket.

alan1818 commented Aug 17, 2018

osTicket Version | v1.10.4
PHP Version | 5.6.37

Review your recommendations however I continue with the same problem, when exporting the report of tickets with "closed" status, the file only shows me 1 ticket.

@lavdnone

This comment has been minimized.

Show comment
Hide comment
@lavdnone

lavdnone Aug 29, 2018

Was working in 1.10.1
real blocker
I know everyone is on 1.11 but unless 1.11 stable is coming out next month give us the clue to fix this one

lavdnone commented Aug 29, 2018

Was working in 1.10.1
real blocker
I know everyone is on 1.11 but unless 1.11 stable is coming out next month give us the clue to fix this one

@ntozier

This comment has been minimized.

Show comment
Hide comment
@ntozier

ntozier Aug 29, 2018

Contributor

@lavdnone The fix posted by @JediKev in this thread works for me for in both 1.10.0 and 1.10.4.
#3264 (comment)

Contributor

ntozier commented Aug 29, 2018

@lavdnone The fix posted by @JediKev in this thread works for me for in both 1.10.0 and 1.10.4.
#3264 (comment)

@lavdnone

This comment has been minimized.

Show comment
Hide comment
@lavdnone

lavdnone Aug 29, 2018

Thanks, don't know how I missed it, #3264 worked

lavdnone commented Aug 29, 2018

Thanks, don't know how I missed it, #3264 worked

@ntozier

This comment has been minimized.

Show comment
Hide comment
@ntozier

ntozier Aug 29, 2018

Contributor

@lavdnone very welcome. Have a great rest of your day! :)

Contributor

ntozier commented Aug 29, 2018

@lavdnone very welcome. Have a great rest of your day! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment