Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

user_id null when creating a ticket from email [SOLVED]

The first time a ticket is created through email, it creates a ticket in TICKET_TABLE whith the corresponding user_id number

The second time a ticket is created through email by the same user, it creates the ticket with user_id = null


I found the problem, in "class.ticket.php" line 2276, in the statement:
INSERT INTO '.TICKET_TABLE.'

it uses:
user_id='.db_input($user->id)

instead of:
user_id='.db_input($user->getId())

Please, include this fix in the next release of osTicket
Thanks, Mariano
Tagged:

Comments

  • If you can replicate this behavior I would recommend that you open an issue on github.

    https://github.com/osTicket/osTicket-1.8

    Also, moving thread to Troubleshooting and Problems as it doesn't appear to be Suggestions or Feedback.
  • That fix doesn't make any sense to me. The getId() method, defined in class.user.php, line 54, returns $this->id; so it should effectively be the same as $user->id.
  • I wrote  $user->id  and  $user->getId()   values just before the INSERT, and they had different values (only getId() had a value  and id was 0)


    The $user object is created in class.ticket.php, line 2117
    $user=TicketUser::lookupByEmail($vars['email'])

    In class.client.php, line 123
        static function lookupByEmail($email) {
            if (!($user=User::lookup(array('emails__address' => $email))))
                return null;
            return new EndUser($user);
        }

    the email already exists in the DB, so it creates an EndUser instance
    In class.client.php, line 185
        function getId() {
            //We ONLY care about user ID at the ticket level
            if ($this->user instanceof Collaborator)
                return $this->user->getUserId();
            return $this->user->getId();
        }
Sign In or Register to comment.