HelpDeskZ Community
Creating an internal note hits a snag - Printable Version

+- HelpDeskZ Community (http://community.helpdeskz.com)
+-- Forum: HelpDeskZ 2 (http://community.helpdeskz.com/forum-3.html)
+--- Forum: Support (http://community.helpdeskz.com/forum-5.html)
+--- Thread: Creating an internal note hits a snag (/thread-2490.html)



Creating an internal note hits a snag - apidya - 04-30-2023

I have a number of custom fields, so I think it may be related to that. If you edit a ticket, click on the "Notes"-Tab and type some content, once you add the note, the system hits a snag and worst of all the ticket itself becomes unviewable. This is logged:
CRITICAL - 2023-04-30 23:16:34 --> Attempt to read property "id" on array
#0 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/app/Views/staff/ticket_view.php(205): CodeIgniter\Debug\Exceptions->errorHandler()
#1 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/framework/View/View.php(220): include('...')
#2 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/framework/View/View.php(222): CodeIgniter\View\View->CodeIgniter\View\{closure}()
#3 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/framework/Common.php(1217): CodeIgniter\View\View->render()
#4 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/app/Controllers/Staff/Tickets.php(250): view()
#5 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/framework/CodeIgniter.php(936): App\Controllers\Staff\Tickets->view()
#6 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/framework/CodeIgniter.php(432): CodeIgniter\CodeIgniter->runController()
#7 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/framework/CodeIgniter.php(333): CodeIgniter\CodeIgniter->handleRequest()
#8 /var/www/vhosts/.../httpdocs/ticketsystem/index.php(44): CodeIgniter\CodeIgniter->run()
#9 {main}

The only way of restoring access to the ticket is to physically delete the note from the hdz_ticket_notes table.


RE: Creating an internal note hits a snag - cord.schneider - 05-02-2023

(04-30-2023, 09:33 PM)apidya Wrote: CRITICAL - 2023-04-30 23:16:34 --> Attempt to read property "id" on array
#0 /var/www/vhosts/.../httpdocs/ticketsystem/hdz/app/Views/staff/ticket_view.php(205): CodeIgniter\Debug\Exceptions->errorHandler()
It looks like the error is happening at line 205 of ticket_view.php:

PHP Code:
<?php echo form_open('',['id' => 'noteForm'.$item->id],['do'=>'delete_note','note_id'=>$note->id]);?>

It's hard to say whether it's the 'noteForm'.$item->id or the $note->id that can't be referenced though. I'm not familiar with this code at all and can only suggest that you attempt to debug it.


RE: Creating an internal note hits a snag - apidya - 05-03-2023

These are the contents of $item in a ticket without custom fields:

object(stdClass)#110 (3) {
["id"]=>
string(1) "6"
["name"]=>
string(8) "Critical"
["color"]=>
string(7) "#FF0000"
}

In a ticket with custom fields, $item changes to
array(2) {
["title"]=>
string(16) "Telephone number"
["value"]=>
string(12) "0176xxxxxxxx"
}


RE: Creating an internal note hits a snag - apidya - 05-03-2023

I think I've solved the problem. In a ticket without notes, $item contained the priorities from the table hdz_priority. Since I had notes, previous code overwrote $item with the content of the custom_vars of the ticket. The usage of $item in the entire <div> Block pertaining to the notes is incorrect. There are 3 references to $item in lines 205, 207 and 219. If you change these to $note, it works properly!

Hope you can update this in your code repository Smile


RE: Creating an internal note hits a snag - cord.schneider - 05-04-2023

(05-03-2023, 01:06 PM)apidya Wrote: I think I've solved the problem. In a ticket without notes, $item contained the priorities from the table hdz_priority. Since I had notes, previous code overwrote $item with the content of the custom_vars of the ticket. The usage of $item in the entire <div> Block pertaining to the notes is incorrect. There are 3 references to $item in lines 205, 207 and 219. If you change these to $note, it works properly!

Hope you can update this in your code repository Smile
Fantastic news that you've resolved this, and feel free to create a Pull Request with the fixes. They may help others with the same problem. Unfortunately, @Andres is the only one managing the repository, and none of the other PRs have been incorporated into the repo. :-(