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

"Primary Key field missing in insert call" when viewing tickets - SMF 2.1 #98

Closed
SugarD-x opened this issue Nov 2, 2018 · 5 comments

Comments

@SugarD-x
Copy link

commented Nov 2, 2018

Description

When viewing tickets in SMF 2.1, a "primary key field missing in insert call" error is displayed instead of the ticket.

Steps to reproduce

  1. Create a ticket in SMF 2.1's version of Helpdesk.
  2. Attempt to view the ticket.

Environment (complete as necessary)

  • Version/Git revision: Latest Git copy as of this posting.
  • Database Type: MySQL
  • Database Version: 8.0.12 - MySQL Community Server - GPL

Additional information/references

This is a fresh installation of Simpledesk on SMF 2.1, and this is the first ticket I've attempted to create and view.

@SugarD-x

This comment has been minimized.

Copy link
Author

commented Nov 2, 2018

I also received this error in the forum's Error Log:

Change the method of db insert to insert or add the pk field to the columns array
Function: shd_view_ticket http://www.example.com/index.php?action=helpdesk;sa=ticket;ticket=1
/Sources/sd_source/SimpleDesk-Display.php (Line 462)

Offending SimpleDesk code: https://pastebin.com/i59pnTQm
Offending SMF 2.1 code: https://pastebin.com/2WPw9WYm

@SugarD-x

This comment has been minimized.

Copy link
Author

commented Nov 9, 2018

Any workarounds available for this issue?

@jdarwood007

This comment has been minimized.

Copy link
Member

commented Feb 3, 2019

Haven't had a chance to debug it to be sure, but in the Sources/sd_source/SimpleDesk-Display.php

	// Mark read goes here
	if (!empty($user_info['id']))
		$smcFunc['db_insert']('replace',
			'{db_prefix}helpdesk_log_read',
			array('id_ticket' => 'int', 'id_member' => 'int', 'id_msg' => 'int',),
			array($context['ticket_id'], $user_info['id'], $ticketinfo['id_last_msg'],),
			array('id_member', 'id_topic')
		);

Replace with

	if (!empty($user_info['id']))
		$smcFunc['db_insert']('replace',
			'{db_prefix}helpdesk_log_read',
			array('id_ticket' => 'int', 'id_member' => 'int', 'id_msg' => 'int',),
			array($context['ticket_id'], $user_info['id'], $ticketinfo['id_last_msg'],),
			array('id_ticket', 'id_member')
		);

Should correct the issue.

@jdarwood007 jdarwood007 self-assigned this Feb 3, 2019

@jdarwood007 jdarwood007 added the Bugs label Feb 3, 2019

@jdarwood007 jdarwood007 added this to the SMF 2.1 Compatibility milestone Feb 3, 2019

@SugarD-x

This comment has been minimized.

Copy link
Author

commented Feb 7, 2019

I appreciate the response. Unfortunately I have already upgraded my forum to SMF 2.1 RC1, so I'm not sure if this particular error is still relevant. (Previous post-Beta 3 updates before RC1 did seem to give me different errors instead). I'll be testing it out on RC1 soon to see if anything changes.

@SugarD-x

This comment has been minimized.

Copy link
Author

commented Feb 7, 2019

My apologies, this is still an issue with SMF 2.1 RC1 while emulated in SMF 2.1 Beta 4 mode. Your fix does resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.