Add a few lines of code to Bulkimport.class.php

Not sure I fthis is thr correct place but I am wondering what is the process for requesting a code update to a PHP module for FreePBX. In the bulkhandler module there is Bulkimport.class.php which currently works for importing DIDs and Extensions. I was looking for a way to import contacts and found that this can be done using fwconsole bulkimport if I added the following to Bulkimport.class.php inside the switch statement under “protected function execute(InputInterface $input, OutputInterface $output)”

case 'contacts':
            $output->writeln('Importing contacts');
            $ret = \FreePBX::Bulkhandler()->import('contacts', $data, $replace);

Than I can call: fwconsole bulkimport --type=contacts contacts.csv --replace

I create the contacts.csv from a script running from crontab which pulls data from Active Directory and I use to populate the phonebook on the enduser phones.
The problem is this changes the signature and I get the red security warnig bar, I would like to avoid this.

You can do it from the GUI

While you are correct that it can be done form the GUI I was looking for a scriptable way to do so, I guess I should have been more clear in my original post. I have several locations and in each location I have all locations in the phonebook on each phone. While there is not a lot of turnover, there there is enough that to have to do the updates manually would be more than anyone in my department would like to do. The way I have it now I run a script nightly via cron on each PBX that does an ldap query against the master Active Directoy and compares the new list to the old list and if there are any changes it load the new list into the phonebook. That way the AD is the source of authority for many things, the phonebook being only one. So, to do this on every PBX, everytime we add a new person or someone leaves, would be burdensome. To make this happen I had to add the above switch case to the Bulkimport.class.php. I guess I could build my own module from Bulkimport but then I would need to know how to go about getting it signed so that the warning does not appear at the top of all the GUI pages. Either way and I would be a very happy camper.

Sangoma requires a code donation form. Fill that out and submit your code in a Feature Request.

Thank You. Ya, I found that shortly after my last post. Will be doinfg so shortly as that woill solve a number of problems.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.