Ejemplo n.º 1
0
 /**
  * Function which returns the Draft Model
  * @return MailManager_Model_DraftEmail
  */
 function connectorWithModel()
 {
     if ($this->mMailboxModel === false) {
         $this->mMailboxModel = MailManager_Model_DraftEmail::getInstance();
     }
     return $this->mMailboxModel;
 }
Ejemplo n.º 2
0
 function getTotalDraftCount()
 {
     global $adb, $current_user;
     if (empty(self::$totalDraftCount)) {
         $DraftRes = $query = "SELECT * FROM Emails where email_flag='SAVED';";
         $draftMails = vtws_query($query, $current_user);
         self::$totalDraftCount = count($draftMails);
         return self::$totalDraftCount;
     } else {
         return self::$totalDraftCount;
     }
 }
Ejemplo n.º 3
0
<?php

/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
require_once 'modules/MailManager/src/controllers/DraftController.php';
require_once 'data/CRMEntity.php';
require_once 'include/Zend/Json.php';
$draft = new MailManager_Model_DraftEmail();
if (!empty($_REQUEST['entityid']) && !empty($_REQUEST['parentid'])) {
    global $current_user, $adb, $currentModule;
    $entityId = vtlib_purify($_REQUEST['entityid']);
    if (!MailManager::checkModuleReadAccessForCurrentUser('Documents')) {
        $errorMessage = getTranslatedString('LBL_READ_ACCESS_FOR', $currentModule) . " " . getTranslatedString('Documents') . " " . getTranslatedString('LBL_MODULE_DENIED', $currentModule);
        $res = $adb->pquery("SELECT filename, filesize FROM vtiger_notes WHERE notesid = ?", array($entityId));
        $fileName = $adb->query_result($res, 0, 'filename');
        $size = $adb->query_result($res, 0, 'filesize');
        echo Zend_Json::encode(array('success' => true, 'error' => $errorMessage, 'name' => $fileName, 'size' => $size));
        exit;
    }
    $document = CRMEntity::getInstance('Documents');
    $document->retrieve_entity_info($entityId, 'Documents');
    $parentId = vtlib_purify($_REQUEST['parentid']);
    $draft->saveEmailDocumentRel($parentId, $entityId);
    //link the attachment to emails
    $attachRes = $adb->pquery("SELECT attachmentsid FROM vtiger_seattachmentsrel WHERE crmid = ?", array($entityId));