sFriendlyName = 'Actions By Email'; $this->sDescription = 'Actions by Email using variables as multiple choice actions delivered by email'; $this->sFeatureFolder = 'ActionsByEmail'; $this->sSetupPage = ''; $this->iVersion = self::getFeatureVersion($namespace); $this->aWorkspaces = null; $this->aDependences = array(array('sClassName' => 'enterprise'), array('sClassName' => 'pmLicenseManager')); $this->bPrivate = parent::registerEE($this->sFeatureFolder, $this->iVersion); return $result; } public function setup() { try { // Register the extended tab for the task properties //$this->registerTaskExtendedProperty('actionsByEmail/configActionsByEmail', "Actions by Email"); //$this->registerTaskExtendedProperty('actionsByEmail/configActionsByEmail', 'Actions by Email'); //$this->registerMenu('setup', 'menusetup.php'); // Register the trigger for the hook PM_CREATE_NEW_DELEGATION if (!defined('PM_CREATE_NEW_DELEGATION')) { throw new Exception('It might be using a version of ProcessMaker which is not totally compatible with this plugin, the minimun required version is 2.0.37'); } $this->registerTrigger(PM_CREATE_NEW_DELEGATION, 'sendActionsByEmail'); // Register the external step for the tracking form //$this->registerStep('4939290144f0745f5ddb1d1019823738', 'externalStep', 'Actions by Email - Tracking Form'); // ToDo: For the next release } catch (Exception $error) { //G::SendMessageText($error->getMessage(), 'WARNING'); } } public function install() { $this->checkTables(); } public function enable() { $this->checkTables(); } public function disable() { // Nothing to do for now } /** * This method get the version of this plugin, when the plugin is packaged in the tar.gz * the file "version" in the plugin folder has this information for development purposes, * we calculate the version using git commands, because the repository is in GIT * * @param String $namespace The namespace of the plugin * @return String $version */ private static function getFeatureVersion($namespace) { return "2.0.20"; } public function checkTables() { $con = Propel::getConnection('workflow'); $stmt = $con->createStatement(); // setting the path of the sql schema files $filenameSql = PATH_PLUGINS . 'actionsByEmail/data/schema.sql'; // checking the existence of the schema file if (!file_exists($filenameSql)) { throw new Exception("File data/schema.sql doesn't exists"); } // exploding the sql query in an array $sql = explode(';', file_get_contents($filenameSql)); $stmt->executeQuery('SET FOREIGN_KEY_CHECKS = 0;'); // executing each query stored in the array foreach ($sql as $sentence) { if (trim($sentence) != '') { $stmt->executeQuery($sentence); } } } }