plugin-autocloser icon indicating copy to clipboard operation
plugin-autocloser copied to clipboard

[feat] Parse error, syntax error for 1.9 API

Open mckaygerhard opened this issue 7 years ago • 17 comments

i wnat to adapt or test/support the 1.9 api, please can provide me some help ..? what the difference?

i read the README and said that send a issue request.. i can code something.. not expert but i make great efforts when i need

mckaygerhard avatar Dec 31 '17 06:12 mckaygerhard

with the pull clonemeagain/attachment_preview#24 this works with 1.9 but i must test better tomorrow i'll report feedback..

i'll open a feature request or question, i mean, could be this made with the "on demand refresh" event with a crontask..

mckaygerhard avatar Jan 02 '18 23:01 mckaygerhard

This plugin does not depend on the attachment_preview plugin. It works independently, generally via CLI cron calls. If it works, then it works, but I thought the osTicket API itself had changed, therefore the way it accessed the tickets and the state it manages would be different.

clonemeagain avatar Jan 02 '18 23:01 clonemeagain

i'll revise better, maybe was due i'm very tired yesterday je je, i'll revised better tonight and reports feedback here

mckaygerhard avatar Jan 03 '18 13:01 mckaygerhard

now tested property, got this error:

Parse error: syntax error, unexpected '.' in /home/jennifer/Devel/simpleticket109/include/plugins/autocloser/config.php on line 218

The live that compares php version are not proper and not requuired due you property merge all setting with a loop, also the check of php version will fail in a mayority of cases as the documentation sugests ..

but solvin by removing those lines, there's a new error, mayor diference api due a includen non-existing class:

Warning: require_once(/home/jennifer/Devel/simpleticket109/include/class.message.php): 
failed to open stream: No such file or directory in /home/jennifer/Devel/simpleticket109/include/plugins/autocloser/config.php on line 4

this class seems are from osticket 1.10 but in osticket 1.9 are present, due if you (as can see in the hole class) import the file class, got a redeclaration error:

Fatal error: Cannot redeclare class Message in /home/jennifer/Devel/simpleticket109/include/class.message.php on line 30

so the solution its to only include when osticket 1.10 are present, i'm working on a solution due there's many bugs around a "vage" declaratin of version in osticke software

mckaygerhard avatar Jan 04 '18 01:01 mckaygerhard

by sustitued corretly the canned responses object gettin by canned class now i got a problem with the rest of abstrac representation objects in staff class:

Fatal error: Call to undefined method Staff::objects() in /home/jennifer/Devel/simpleticket109/include/plugins/autocloser/config.php on line 82

now i'm very tyred and cannot see some way to solve it..

mckaygerhard avatar Jan 04 '18 01:01 mckaygerhard

i got it, i must fill the combobox select input with a staff array. but it's late in my country i must sleep a while, i'll check it but i cannot retrieve the staff list whitout a nasty query.. help me when you can

mckaygerhard avatar Jan 04 '18 01:01 mckaygerhard

ogm, i can fill the select combo but now the settings does not are stored or are not saved, set DEBUG to true also set log to DEBUG in the hoe osticket and no log about something using autocron..

mckaygerhard avatar Jan 04 '18 01:01 mckaygerhard

I wouldn't call it a "bug" if it works fine on 1.10, and you want it rewritten for 1.9 mate. ;-) That's pretty cheeky.

This task will take a fair amount of work, and might benefit from being a seperate version entirely, rather than attempting to make it work as-is for both. Surely the number of 1.9 users are decreasing in volume.

Two versions... Could check the version once, load the correct file? Might even be possible in plugin.php

'plugin' => (MAJOR_VERSION >= '1.10') ? 'class.CloserPlugin.php:CloserPlugin' : 'class.CloserPlugin-1.9.php:CloserPlugin'

Will have to try it and find out.

For config.php: The TicketStatus::objects() call will either work or need to be rewritten as a db_query.. same with Staff::objects() and likely Canned::getCannedResponses(), not sure when ::objects() got added to VSM.

And we'd have to rewrite splat again as a loop, making sure you appropriately dereference the group array's back into the single settings array, then you'll have to delete and reinstall the plugin to see if the changes worked.

For class.CloserPlugin.php: Looks like the first dangerzone is line 100, TicketStatus::lookup(), could be replaced with new TicketStatus($id_from_config); maybe. If TicketStatus existed in 1.9. .. hmm, it does! https://github.com/osTicket/osTicket/blob/1.9.x/include/class.list.php#L779 It doesn't work the same though.

The next issue is the Ticket::logEvent() method is very different. In 1.10, you send a state and array of status to it. .. this is not the case with 1.9. Primitive, two text strings only. So, that will need to be checked.

Find tickets to close method should still work, it's a wrapper around a db_query call..

post_reply though.. based on the idea of a Robot acting on behalf of staff, not sure. Looks like ::lookup might need to be changed to new Staff($robot).. hmm. Ticket::getAssignee() method of 1.9 returns a text-string rather than an Object of class Staff or Team.. that's less useful. Not sure if a TicketOwner object is equivalent to a Recipient..

The extra methods are for injecting $variables into the reply, (defined from line 345 etc). They likely aren't necessary to rewrite for a 1.9 version.

clonemeagain avatar Jan 04 '18 03:01 clonemeagain

hi @clonemeagain i change the title and you are great, Your answer is full of a very careful policy, since you do not reject the work but at the same time you know that when time passes it will no longer be necessary because it lacks sense, I am impressed by the fact that it is not a negative answer, really thanks for your effort

now let's talk about the issue:

This task will take a fair amount of work, and might benefit from being a seperate version entirely,

making two veruions are too much work, please read the following part:

Two versions... Could check the version once, load the correct file? Might even be possible in plugin.php

it's better simple cheks, could be make, i dont remenber (i see it yesterday by the way) there's a string that said the osticket verion that can be checked, the includes are the same, easy, if the file does not exist, does no include it!

Now, and likely Canned::getCannedResponses() and TicketStatus are present in 1.9, and many of the ::objects abstraction already.. just in diferent way.. to avoid as much possible the making of a query due the tables are different beetween versions..

Ticket::getAssignee() method of 1.9 returns a text-string rather than an Object of class Staff or Team.. that's less useful. Not sure if a TicketOwner object is equivalent to a Recipient..

Jus lest's check if the variable its an object, if not lets use it directly event extraction of a reference..

now maybe you thinking "separate its better" well in first time, i'm user not programer, and its very great that one file are the same for all need's like the ANYDESK project respect the teamviewer if you noted, teamviewer are very complicated, different verions for differents systems, etc etc, in the case of anydesk, one file to rule them all... that's why i not like that separation..

of course some work must be do, but think abou it in the future, some one more else will see the code and bring us help again..

mckaygerhard avatar Jan 04 '18 12:01 mckaygerhard

Well, compiled programs are able to concatenate large amounts of source files into one executable, giving the best of both.. PHP being interpreted generally doesn't, unless compiled into a phar, which we could do.

clonemeagain avatar Jan 05 '18 03:01 clonemeagain

its too much work currently, i appreciate but i see the code and i not have the enought skills to perform great pieces in that code, can ajust and make great test in production environment and some patches but pretty understand the compelte overall of your work..

please if you will do some work i'll track all the changes and will pay close attention each night

mckaygerhard avatar Jan 05 '18 03:01 mckaygerhard

hi @clonemeagain , sorry for late, i upraded the php to 5.4 in development machines.. this plugin give me some curious due its a great feature autoclose the very late tickets opened..

now with corrected php version i got again the same result:

Warning: require_once(/home/jennifer/Devel/simpleticket109/include/class.message.php): 
failed to open stream: No such file or directory in /home/jennifer/Devel/simpleticket109/include/plugins/autocloser/config.php on line 4

as from osticket 1.10 but in osticket 1.9 are present, due if you (as can see in the hole class) import the file class, got a redeclaration error:

Fatal error: Cannot redeclare class Message in /home/jennifer/Devel/simpleticket109/include/class.message.php on line 30

due some changes, message has now a own class in 1.10 in 1.9 was different.. so we can detect by get the version info from osticket (in 1.9 the string always got devel or git in the string) so.. but i search for that call and i not found..

mckaygerhard avatar Jan 27 '18 05:01 mckaygerhard

Hey chief, I had forgotten a bit.. then my office flooded a bit. :-1: would not recommend.

I'll be back in action soon though.

clonemeagain avatar Jan 31 '18 00:01 clonemeagain

yeah dont worry i understand.. i'm some busy too.. the preview plugins are so great.. all of your plugins are working now except for this "autoclose" that its the other great one i wish too, i discovered that i not have enough skills je je, well i still trying to capture the id, discovered another form, post feedback later when i have a time

mckaygerhard avatar Jan 31 '18 18:01 mckaygerhard

hi @clonemeagain , we both are very busy, just advertise that in other osticker plugin project i see that can be detected the version of the installation.. the string returned are something like: "1.8-git" with the git commit aside.. so in the include we can detect if a 1.8 string or 1.9 string are present.. and include proper files..

i start some code in few days, due i'm busy too and feedback here..

mckaygerhard avatar Feb 09 '18 01:02 mckaygerhard

hi @clonemeagain long time without pas here.. i'm back with my osticket and i love 1.9 after tried 1.10 (1.10 has some great features but it's un-integrated into many software without pain) so i must use 1.9 for a while..

so then noted that since commit b5ae451567a3a9a4f79ab19e2781816ea8138cbf you posted that php version must be 5.6, but the error pointed in #21 are not happened to me in 1.10 maybe i used a lder release of 1.10 (due responsive theme)...

i cannot track what sintax was changed to use php 5.4 respect 5.6 can you pointed in right direction? please remenber that i not so smart in php like you..

mckaygerhard avatar Nov 03 '18 03:11 mckaygerhard

Hey chief, I tend to forget myself, but there is a list: http://php.net/manual/en/migration56.incompatible.php

Yeah, you might have to wait for responsive creators to update if you rely on that.

clonemeagain avatar Nov 05 '18 20:11 clonemeagain