Hi all!
I've maded a plugin for automatically add time to a task while editing tickets.. developed for 1.14 (php 7.x) it works flawlessy also in 1.15.. now I've upgraded both installations to 1.17 and the plugin first block the migration (php8 conversion needed) then it cant be enabled again because it makes somewhat crash in the core..
as you can see from the logs it hangs in the function inside Staff class.. called by getStaffMembers.. There is no parameters to be set so I assume that there are problems with $cfg global var inside staff members.. do I have to initialize somewhat inside plugin code?

PHP Fatal error: Uncaught Error: Call to a member function getAgentNameFormat() on null in /home/ostckt/public_html/include/class.staff.php:1050
Stack trace:
#0 /home/ostckt/public_html/include/class.staff.php(1065): Staff::getsortby()
#1 /home/ostckt/public_html/include/class.staff.php(1004): Staff::nsort()
#2 /home/ostckt/public_html/include/plugins/autotask/config.php(35): Staff::getStaffMembers()
#3 /home/ostckt/public_html/include/class.plugin.php(22): AutoTaskPluginConfig->getOptions()
#4 /home/ostckt/public_html/include/class.plugin.php(1086): PluginConfig->__construct()
#5 /home/ostckt/public_html/include/class.plugin.php(788): PluginInstance->getConfig()
#6 /home/ostckt/public_html/include/class.plugin.php(1161): Plugin->getConfig()
#7 /home/ostckt/public_html/include/class.plugin.php(202): PluginInstance->bootstrap()
#8 /home/ostckt/public_html/include/class.osticket.php(668): PluginManager->bootstrap()
#9 /home/ostckt/public_html/main.inc.php(33): osTicket::start()
#10 /home/ostckt/public_html/scp/staff.inc.php(20): require_once('...')
#11 /home/ostckt/public_html/scp/admin.inc.php(16): require_once('...')
#12 /home/ostckt/public_html/scp/helptopics.php(16): require('...')
#13 {main}
thrown in /home/ostckt/public_html/include/class.staff.php on line 1050, referer: https://support.demoplugin.com/scp/forms.php

Thanks to all

    david6

    I would assume either Staff::getStaffMembers(), Staff::nsort(), or Staff::getsortby() is not returning results and you can't call getAgentNameFormat() on NULL. Since this is a customization you're on your own.

    Cheers.

      KevinTheJedi
      Hi Kevin, I know that I'm on my own.. it wasn't either a complain or bug posting 🙂
      Maybe someone know the differences in plugin structure from a version to another and could give me an hint...
      getStaffMembers works until I got the plugin activated.. I populate a select with those values in the plugin config page, until I turn it on.. then boom! It doesn't work anymore making all the system respond with a white page.
      considering this block of instructions inside my config.php getOptions

      $agents = Staff::getStaffMembers();
      $topics = Topic::getHelpTopics();

      $format = $format ?: $cfg->getAgentNameFormat();
      on row 1050 of class.staff there is that comparison, $cfg here is null.. how is that possible if in the previous row there is global $cfg?

      There is only one instance configurated in my plugin-instance page. (the upgrader originally creates three)

      I'll dig it out in a test environment but in the meantime if someone knows why it happens it would be sooo nice to be hinted

      Thanks a lot

        david6

        Then it seems $cfg is not available in that scope. You can look at the updates we did to core plugins to get an idea of what you can do.

        Cheers.

        Write a Reply...