Skip to content

Doesn't work with 1.11 or 1.12 - Plans to update to latest osTicket versions? #11

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

Open
nminaker opened this issue Jul 11, 2019 · 22 comments

Comments

@nminaker
Copy link

Hi there,

I'm running osTicket v 1.11 and I tried your plugin (which seems like a great addition to the core functionality), but it throws an exception. So I was just wondering if you were planning to update this plugin to function in the newest versions?

This is the error I get when I add mentions into a ticket.
[Thu Jul 11 13:16:43.299811 2019] [php7:error] [pid 19673] [client 10.0.50.64:59867] PHP Fatal error: Uncaught InvalidArgumentException: User expected in /var/www/html/osticket/include/class.user.php:1369\nStack trace:\n#0 /var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(92): UserList->add(Object(Staff))\n#1 /var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(48): MentionerPlugin->checkThreadTextForMentions(Object(MessageThreadEntry))\n#2 /var/www/html/osticket/include/class.signal.php(98): MentionerPlugin->{closure}(Object(MessageThreadEntry), NULL)\n#3 /var/www/html/osticket/include/class.thread.php(1671): Signal::send('threadentry.cre...', Object(MessageThreadEntry))\n#4 /var/www/html/osticket/include/class.thread.php(1677): ThreadEntry::create(Array)\n#5 /var/www/html/osticket/include/class.thread.php(2748): ThreadEntry::add(Array)\n#6 /var/www/html/osticket/include/class.thread.php(2963): MessageThreadEntry::add(Array, Array)\n#7 /var/www/html/osticket/include/class.ticket.php(2700): ObjectThread->addMessage(Array, Array)\n#8 /var/www/html/osticket/tickets.php(89): in /var/www/html/osticket/include/class.user.php on line 1369, referer: https://help.esgsolutions.com/tickets.php

@clonemeagain
Copy link
Owner

clonemeagain commented Jul 11, 2019 via email

@nminaker
Copy link
Author

nminaker commented Jul 12, 2019 via email

@clonemeagain
Copy link
Owner

clonemeagain commented Jul 12, 2019 via email

@mckaygerhard
Copy link

hi @clonemeagain long time from last.. ostiket before 1.10 not have way to check corrected version.. so will be a pain.. in some weeks i can make some test and report feedback here!

@clonemeagain
Copy link
Owner

Hey Chief, still haven't upgraded our instance yet, business priorities have changed and I've got minimal time for open source projects now. Frustrating. But if you're able to, a pull request would be welcomed

@mckaygerhard
Copy link

take easy @clonemeagain i understand! time day it's precious now! right? i'm in same behaviour.. pufff very very frustrating.. but i'll make some space and try to made a pull request!

plesase stay alert .. thanks dude!

@AdamDempsey
Copy link

While not a proper fix the bodge below gets staff mentions working again in latest version of osTicket (tested in v1.14.1).

Line 85, change from

$stafflist = new UserList ();

to

$stafflist = new StaffList ();

At the very bottom add the below (it's the UserList definition from class.user.php in osTicket v1.10.1)

class StaffList extends ListObject
implements TemplateVariable {

    function __toString() {
        return $this->getNames();
    }

    function getNames() {
        $list = array();
        foreach($this->storage as $user) {
            if (is_object($user))
                $list [] = $user->getName();
        }
        return $list ? implode(', ', $list) : '';
    }

    function getFull() {
        $list = array();
        foreach($this->storage as $user) {
            if (is_object($user))
                $list[] = sprintf("%s <%s>", $user->getName(), $user->getEmail());
        }

        return $list ? implode(', ', $list) : '';
    }

    function getEmails() {
        $list = array();
        foreach($this->storage as $user) {
            if (is_object($user))
                $list[] = $user->getEmail();
        }
        return $list ? implode(', ', $list) : '';
    }

    static function getVarScope() {
        return array(
            'names' => __('List of names'),
            'emails' => __('List of email addresses'),
            'full' => __('List of names and email addresses'),
        );
    }
}

@DanielKng
Copy link

@AdamDempsey We got 1.14.1 running and I added your Code. It works, and users can be added as collaborators, thanks!
However, if i enable the "Use #mentions for ticket notifications"-Option i´ll get an HTTP 500 error.
But the internal notice will still be posted, however no e-mail is being send.
Any idea?

@wgalafassijr
Copy link

@AdamDempsey We got 1.14.1 running and I added your Code. It works, and users can be added as collaborators, thanks!
However, if i enable the "Use #mentions for ticket notifications"-Option i´ll get an HTTP 500 error.
But the internal notice will still be posted, however no e-mail is being send.
Any idea?

same issue here with v1.14.1 when use mentions (#user)

@mckaygerhard
Copy link

hi @AdamDempsey @DanielKng and @wgalafassijr , your code @AdamDempsey seems works but need two tings:

  1. a version check to property stil works with current stable version due 1.14 are just so new..
  2. the change use the name from staf so 500 error are due $stafflist doe snot have the staf name..

so @clonemeagain as you said before logn time ago, staff object aren't users anymore! due the change does no included the people listed in the user database (only staff).. it fails if you search for some of the staff members.. i do not remenber right now the format of.. but like array we must merged and dischard the duplicates (one person in user list also can be the same in staff lits)

this seems all the logic must be include in a function that first try the user database and if the mentioned tag are not foud try them the staff databe users.

@huuduchp95
Copy link

@AdamDempsey We got 1.14.1 running and I added your Code. It works, and users can be added as collaborators, thanks!
However, if i enable the "Use #mentions for ticket notifications"-Option i´ll get an HTTP 500 error.
But the internal notice will still be posted, however no e-mail is being send.
Any idea?

We're also installing it on osTicket v1.14.2 and got the same error when using #function. Really look forward to a way to solve this problem! If someone has a way to solve it, please kindly guide. Thanks a lot!

@jimbodeman
Copy link

Also installed on OSTicket v1.14.1 and got the same error using the #agent function. Really want to use this on internal notes which doesn't work with @agent as, even with the code above added, a new user is created and added as a collaborator. The user doesn't get notified about new internal notes.

@jevansfbcmb
Copy link

@clonemeagain Have you managed to have a look at getting the # mentions working with 1.14.x?

@drewlcruz
Copy link

I am on 1.14.1 and able to get # notification emails after changing the following:
Line 371 from private function notifyStaffOfMention(ThreadEntry $entry, UserList $recipients) { to private function notifyStaffOfMention(ThreadEntry $entry, StaffList $recipients) {

@wgalafassijr
Copy link

I am on 1.14.1 and able to get # notification emails after changing the following:
Line 371 from private function notifyStaffOfMention(ThreadEntry $entry, UserList $recipients) { to private function notifyStaffOfMention(ThreadEntry $entry, StaffList $recipients) {

Worked for me too with this change. Thank you.

@clonemeagain
Copy link
Owner

Need to write a version check then branch it. If someone has already done that I'm happy to merge their PR

@Newboie
Copy link

Newboie commented Mar 11, 2021

@clonemeagain

that would be more then awesome <3
We have also issues using your awesome plugin with v1.15.1 - if it would work, it would be such a great help :)

Adding collaborators over "@" works without a problem, but trying to use "#" for E-Mail notifications gives us this after creating the comment-post:

**Fatal error:** Uncaught InvalidArgumentException: User expected in /var/www/vhosts/xyz.com/httpdocs/include/class.user.php:1460 Stack trace:
#0 /var/www/vhosts/xyz.com/httpdocs/include/plugins/mentioner/class.MentionerPlugin.php(92): UserList->add(Object(Staff))
#1 /var/www/vhosts/xyz.com/httpdocs/include/plugins/mentioner/class.MentionerPlugin.php(48): MentionerPlugin->checkThreadTextForMentions(Object(ResponseThreadEntry))
#2 /var/www/vhosts/xyz.com/httpdocs/include/class.signal.php(98): MentionerPlugin->{closure}(Object(ResponseThreadEntry), NULL)
#3 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(1806): Signal::send('threadentry.cre...', Object(ResponseThreadEntry))
#4 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(1812): ThreadEntry::create(Array)
#5 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(2992): ThreadEntry::add(Array)
#6 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(3175): Respons in /var/www/vhosts/xyz.com/httpdocs/include/class.user.php on line 1460

@JVC-MSF-OCB
Copy link

@mckaygerhard
Copy link

i am using it only in older versions.. why i must upgrade if are workinig.. and there's not security issues.. for that i can patch the code.. its php!

@VonSchnitzel
Copy link

Has anyone had any luck getting this to work with v1.16.x? Tried the above fixes but the #mentions are still throwing an error. Just get an internal server error 500. Interestingly nothing shows up in any php logs.

@XKa-MSF-OCB
Copy link

Hello @VonSchnitzel
Have you already seen #15 ?
Have you already tried the forked version at https://github.com/bobweston/osticket-plugin-mentioner ?
Hope this may help.

@VonSchnitzel
Copy link

Hey @XKa-MSF-OCB . Thanks yeah I tried your fix for the function and also just tried directly from bobweston's fork. Interestingly using the forked version gave me an actual PHP error this time:

Uncaught InvalidArgumentException: User expected in /include/class.user.php:1476

Not sure what's causing this or how to fix it but it must be something unique to our setup if it works for others.

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

No branches or pull requests