public function bulkhandlerImport($type, $rawData, $replaceExisting = false) { $ret = NULL; switch ($type) { case 'usermanusers': foreach ($rawData as $data) { $user = $this->FreePBX->Userman->getUserByUsername($data['username']); if (isset($data['fax_enabled'])) { $en = $data['fax_enabled'] == "yes" ? true : ($data['fax_enabled'] == "no" ? false : null); $this->userman->setModuleSettingByID($user['id'], 'fax', 'enabled', $en); } if (isset($data['fax_attachformat'])) { $this->userman->setModuleSettingByID($user['id'], 'fax', 'attachformat', $data['fax_attachformat']); } } break; case 'usermangroups': foreach ($rawData as $data) { $group = $this->FreePBX->Userman->getGroupByUsername($data['groupname']); if (isset($data['fax_enabled'])) { $en = $data['fax_enabled'] == "yes" ? true : false; $this->userman->setModuleSettingByGID($group['id'], 'fax', 'enabled', $en); } if (isset($data['fax_attachformat'])) { $this->userman->setModuleSettingByGID($group['id'], 'fax', 'attachformat', $data['fax_attachformat']); } } break; case 'dids': $this->FreePBX->Modules->loadFunctionsInc("fax"); foreach ($rawData as $data) { $settings = array(); foreach ($data as $key => $value) { if (substr($key, 0, 4) == 'fax_') { $settingname = substr($key, 4); switch ($settingname) { default: $settings[$settingname] = $value; break; } } } fax_delete_incoming($data['extension'] . "/" . $data["cidnum"]); if (!empty($settings['enable'])) { fax_save_incoming($data["cidnum"], $data['extension'], true, $settings['detection'], $settings['detectionwait'], $settings['destination'], null); } } break; } }
function fax_hookProcess_core() { $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : ''; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; if ($display == 'did' && $action != '') { $cidnum = isset($_REQUEST['cidnum']) ? $_REQUEST['cidnum'] : ''; $extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : ''; $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : ''; $enabled = isset($_REQUEST['faxenabled']) ? $_REQUEST['faxenabled'] : 'false'; $detection = isset($_REQUEST['faxdetection']) ? $_REQUEST['faxdetection'] : ''; $detectionwait = isset($_REQUEST['faxdetectionwait']) ? $_REQUEST['faxdetectionwait'] : ''; $dest = isset($_REQUEST['gotoFAX']) ? $_REQUEST['gotoFAX'] . 'FAX' : null; $dest = isset($_REQUEST[$dest]) ? $_REQUEST[$dest] : ''; if ($enabled != 'legacy') { $legacy_email = null; } else { $legacy_email = isset($_REQUEST['legacy_email']) ? $_REQUEST['legacy_email'] : ''; } fax_delete_incoming($extdisplay); //remove mature entry on edit or delete if (($action == 'edtIncoming' || $action == 'addIncoming') && $enabled != 'false') { fax_save_incoming($cidnum, $extension, $enabled, $detection, $detectionwait, $dest, $legacy_email); } } }