示例#1
0
 function saveentity($module_name, $fileid = '')
 {
     $date_start = $this->column_fields['date_start'];
     $due_date = $this->column_fields['due_date'];
     $start = DateTimeField::convertToDBTimeZone($this->column_fields['date_start'] . ' ' . $this->column_fields['time_start']);
     $this->column_fields['date_start'] = $start->format(DateTimeField::getPHPDateFormat());
     $end = DateTimeField::convertToDBTimeZone($this->column_fields['due_date'] . ' ' . $this->column_fields['time_end']);
     $this->column_fields['due_date'] = $end->format(DateTimeField::getPHPDateFormat());
     parent::saveentity($module_name, $fileid = '');
     $this->column_fields['date_start'] = $date_start;
     $this->column_fields['due_date'] = $due_date;
 }
示例#2
0
文件: SaveAjax.php 项目: Wasage/werpa
<?php

chdir(dirname(__FILE__) . '/../..');
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/Process/Process.php';
header("Content-type: application/json; charset=urf-8");
$moduleName = $_POST['module'];
$recordId = $_POST['record'];
$operationMode = $_POST['mode'];
$incomeData = $_POST['data'];
switch ($operationMode) {
    case 'saveBpmn':
        $moduleModel = Vtiger_CRMEntity::getInstance($moduleName);
        echo json_encode($moduleModel->saveFromBpmn($recordId, $incomeData));
        break;
}
 /**
  * Move the related records of the specified list of id's to the given record.
  * @param String This module name
  * @param Array List of Entity Id's from which related records need to be transfered
  * @param Integer Id of the the Record to which the related records are to be moved
  */
 function transferRelatedRecords($module, $transferEntityIds, $entityId)
 {
     $adb = PearDatabase::getInstance();
     $log = vglobal('log');
     $log->debug("Entering function transferRelatedRecords ({$module}, {$transferEntityIds}, {$entityId})");
     $rel_table_arr = array("Documents" => "vtiger_senotesrel", "Attachments" => "vtiger_seattachmentsrel");
     $tbl_field_arr = array("vtiger_senotesrel" => "notesid", "vtiger_seattachmentsrel" => "attachmentsid");
     $entity_tbl_field_arr = array("vtiger_senotesrel" => "crmid", "vtiger_seattachmentsrel" => "crmid");
     foreach ($transferEntityIds as $transferId) {
         foreach ($rel_table_arr as $rel_module => $rel_table) {
             $id_field = $tbl_field_arr[$rel_table];
             $entity_id_field = $entity_tbl_field_arr[$rel_table];
             // IN clause to avoid duplicate entries
             $sel_result = $adb->pquery("select {$id_field} from {$rel_table} where {$entity_id_field}=? " . " and {$id_field} not in (select {$id_field} from {$rel_table} where {$entity_id_field}=?)", array($transferId, $entityId));
             $res_cnt = $adb->num_rows($sel_result);
             if ($res_cnt > 0) {
                 for ($i = 0; $i < $res_cnt; $i++) {
                     $id_field_value = $adb->query_result($sel_result, $i, $id_field);
                     $adb->pquery("update {$rel_table} set {$entity_id_field}=? where {$entity_id_field}=? and {$id_field}=?", array($entityId, $transferId, $id_field_value));
                 }
             }
         }
     }
     parent::transferRelatedRecords($module, $transferEntityIds, $entityId);
     $log->debug("Exiting transferRelatedRecords...");
 }
示例#4
0
 public function getJoinClause($tableName)
 {
     if ($tableName == 'vtiger_recurring_info') {
         return 'LEFT JOIN';
     }
     return parent::getJoinClause($tableName);
 }