Exemplo n.º 1
0
 function registerCustomWebservices($operations)
 {
     global $adb;
     foreach ($operations as $operation_name => $operation_info) {
         $checkres = $adb->pquery("SELECT operationid FROM vtiger_ws_operation WHERE name=?", array($operation_name));
         if ($checkres && $adb->num_rows($checkres) < 1) {
             $operation_id = $adb->getUniqueId('vtiger_ws_operation');
             $operation_res = $adb->pquery("INSERT INTO vtiger_ws_operation (operationid, name, handler_path, handler_method, type, prelogin) \n\t\t\t\t\tVALUES (?,?,?,?,?,?)", array($operation_id, $operation_name, $operation_info['file'], $operation_info['handler'], $operation_info['reqtype'], $operation_info['prelogin']));
             $operation_parameters = $operation_info['parameters'];
             $parameter_index = 0;
             foreach ($operation_parameters as $parameter_name => $parameter_type) {
                 $adb->pquery("INSERT INTO vtiger_ws_operation_parameters (operationid, name, type, sequence) \n\t\t\t\t\t\tVALUES(?,?,?,?)", array($operation_id, $parameter_name, $parameter_type, $parameter_index + 1));
                 ++$parameter_index;
             }
             Vtiger_Utils::Log("Opearation {$operation_name} enabled successfully.");
         } else {
             Vtiger_Utils::Log("Operation {$operation_name} already exists.");
         }
     }
 }
 /**
  * Helper function to log messages
  * @param String Message to log
  * @param Boolean true appends linebreak, false to avoid it
  * @access private
  */
 static function log($message, $delim = true)
 {
     Vtiger_Utils::Log($message, $delim);
 }
Exemplo n.º 3
0
 /**
  * Remove relation between the field and modules (UIType 10)
  * @param Array List of module names
  */
 function unsetRelatedModules($moduleNames)
 {
     global $adb;
     foreach ($moduleNames as $relmodule) {
         $adb->pquery('DELETE FROM vtiger_fieldmodulerel WHERE fieldid=? AND module=? AND relmodule = ?', array($this->id, $this->getModuleName(), $relmodule));
         Vtiger_Utils::Log("Unsetting {$this->name} relation with {$relmodule} ... DONE");
     }
     return true;
 }
Exemplo n.º 4
0
 /**
  * Funkcja sprawdza czy wszystkie wymagane parametry funkcji zostały podane. 
  * W razie braku wszystkich parametrów dopisuje do logu odpowiednią informację
  *
  * @param array $parameterList lista parametrów
  * @param int $numMandatoryArg liczba wymaganych paramtrów przez funkcję
  * @return bool W zależności od tego czy wszystkie paramtry zostały podane (true) czy nie (false)
  */
 private static function checkArg($parameterList, $numMandatoryArg)
 {
     vglobal('Vtiger_Utils_Log', TRUE);
     for ($i = 0; $i < $numMandatoryArg; $i++) {
         if (empty($parameterList[$i])) {
             $i++;
             Vtiger_Utils::Log($i . ' function parameter is empty');
             return FALSE;
         }
     }
     return TRUE;
 }
Exemplo n.º 5
0
 function register()
 {
     $adb = PearDatabase::getInstance();
     $checkresult = $adb->pquery("SELECT 1 FROM vtiger_ws_operation WHERE name = ?", array($this->opName));
     if ($adb->num_rows($checkresult)) {
         return;
     }
     Vtiger_Utils::Log("Enabling webservice operation {$this->opName}", true);
     $operationid = vtws_addWebserviceOperation($this->opName, $this->opFile, $this->opClass, $this->opType);
     for ($index = 0; $index < count($this->parameters); ++$index) {
         vtws_addWebserviceOperationParam($operationid, $this->parameters[$index]['name'], $this->parameters[$index]['type'], $index + 1);
     }
 }