当前位置: 首页>>代码示例>>PHP>>正文


PHP DocumentRevision::retrieve方法代码示例

本文整理汇总了PHP中DocumentRevision::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentRevision::retrieve方法的具体用法?PHP DocumentRevision::retrieve怎么用?PHP DocumentRevision::retrieve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocumentRevision的用法示例。


在下文中一共展示了DocumentRevision::retrieve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTechnicalDescriptions

 function getTechnicalDescriptions()
 {
     $attachmentIds = explode(' ', trim($this->attachmentsequence));
     $attachments = array();
     foreach ($attachmentIds as $id) {
         $attachment_data = array();
         $revision = new DocumentRevision();
         if (!$revision->retrieve($id)) {
             $attachment = new Document();
             if ($attachment->retrieve($id)) {
                 if ($attachment->subcategory_id == 'Technical') {
                     //$attachment_data = array();
                     $attachment_data["id"] = $attachment->id;
                     $attachment_data["document_name"] = $attachment->document_name;
                     $attachment_data["document_revision_id"] = $attachment->document_revision_id;
                     //				$attachment_data["doc_status"] = 'new';
                     $attachments[] = $attachment_data;
                 }
             }
         } else {
             $attachment = new Document();
             if ($attachment->retrieve($revision->document_id)) {
                 if ($attachment->subcategory_id == 'Technical') {
                     //$attachment_data = array();
                     $attachment_data["id"] = $attachment->id;
                     $attachment_data["document_name"] = $attachment->document_name . '_rev.' . $revision->revision;
                     $attachment_data["document_revision_id"] = $revision->id;
                     //				$attachment_data["doc_status"] = 'new';
                     $attachments[] = $attachment_data;
                 }
             }
         }
     }
     return $attachments;
 }
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:35,代码来源:oqc_Product.php

示例2: testSaveAndRetrieve

 public function testSaveAndRetrieve()
 {
     error_reporting(E_ERROR | E_PARSE);
     $documentRevision = new DocumentRevision();
     $documentRevision->document_id = '1';
     $documentRevision->doc_id = '1';
     $documentRevision->doc_type = 'text';
     $documentRevision->filename = 'test';
     $documentRevision->file_ext = 'ext';
     $documentRevision->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($documentRevision->id));
     $this->assertEquals(36, strlen($documentRevision->id));
     //test document retrieve method
     $docRev = $documentRevision->retrieve($documentRevision->id);
     $this->assertEquals('1', $docRev->document_id);
     $this->assertEquals('1', $docRev->doc_id);
     $this->assertEquals('text', $docRev->doc_type);
     $this->assertEquals('test', $docRev->filename);
     $this->assertEquals('ext', $docRev->file_ext);
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $docRev->mark_deleted($docRev->id);
     $result = $docRev->retrieve($docRev->id);
     $this->assertEquals(null, $result);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:25,代码来源:DocumentRevisionTest.php

示例3: get_all_linked_attachment_revisions

function get_all_linked_attachment_revisions($attachmentsequence)
{
    $attachmentIds = explode(' ', trim($attachmentsequence));
    $attachments = array();
    foreach ($attachmentIds as $id) {
        $revision = new DocumentRevision();
        if (!$revision->retrieve($id)) {
            // if in old format try to recover by document id
            $attachment = new Document();
            if ($attachment->retrieve($id)) {
                $attachment->revision = '';
                $attachment->doc_rev_id = '';
                $attachments[] = $attachment;
            }
        } else {
            $attachment = new Document();
            if ($attachment->retrieve($revision->document_id)) {
                $attachment->revision = $revision->revision;
                $attachment->doc_rev_id = $revision->id;
                $attachments[] = $attachment;
            }
        }
    }
    return $attachments;
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:25,代码来源:Attachments.php

示例4: attachmentFromSugarBean

 /**
  * Constructs an attachment from the SugarBean that is passed in.
  *
  * @static
  * @access public
  * @param SugarBean $bean required
  * @return Attachment
  * @throws MailerException
  */
 public static function attachmentFromSugarBean(SugarBean $bean)
 {
     $filePath = null;
     $fileName = null;
     $mimeType = "";
     if ($bean instanceof Document) {
         if (empty($bean->id)) {
             throw new MailerException("Invalid Attachment: document not found", MailerException::InvalidAttachment);
         }
         $document_revision_id = $bean->document_revision_id;
         $documentRevision = new DocumentRevision();
         if (!empty($document_revision_id)) {
             $documentRevision->retrieve($bean->document_revision_id);
         }
         if (empty($document_revision_id) || $documentRevision->id != $document_revision_id) {
             throw new MailerException("Invalid Attachment: Document with Id (" . $bean->id . ")  contains an invalid or empty revision id: (" . $document_revision_id . ")", MailerException::InvalidAttachment);
         }
         $bean = $documentRevision;
     }
     $beanName = get_class($bean);
     switch ($beanName) {
         case "Note":
         case "DocumentRevision":
             $filePath = rtrim(SugarConfig::getInstance()->get('upload_dir', 'upload'), '/\\') . '/' . $bean->id;
             $fileName = empty($bean->filename) ? $bean->name : $bean->filename;
             $mimeType = empty($bean->file_mime_type) ? $mimeType : $bean->file_mime_type;
             break;
         default:
             throw new MailerException("Invalid Attachment: SugarBean '{$beanName}' not supported as an Email Attachment", MailerException::InvalidAttachment);
             break;
     }
     // Path must Exist and Must be a Regular File
     if (!is_file($filePath)) {
         throw new MailerException("Invalid Attachment: file not found: {$filePath}", MailerException::InvalidAttachment);
     }
     $attachment = new Attachment($filePath, $fileName, Encoding::Base64, $mimeType);
     return $attachment;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:47,代码来源:AttachmentPeer.php

示例5: get_module_title

 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'XTemplate/xtpl.php';
require_once 'data/Tracker.php';
require_once 'modules/Documents/Document.php';
require_once 'modules/DocumentRevisions/DocumentRevision.php';
require_once 'modules/Notes/Forms.php';
require_once 'include/upload_file.php';
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $current_user;
$focus = new DocumentRevision();
if (isset($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
$old_id = '';
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    if (!empty($focus->filename)) {
        $old_id = $focus->id;
    }
    $focus->id = "";
}
echo "\n<p>\n";
echo get_module_title('DocumentRevisions', $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->document_name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:EditView.php

示例6: die

 $bean_name = $beanList[$module];
 if (!file_exists('modules/' . $module . '/' . $bean_name . '.php')) {
     die($app_strings['ERROR_TYPE_NOT_VALID']);
 }
 require_once 'modules/' . $module . '/' . $bean_name . '.php';
 $focus = new $bean_name();
 $focus->retrieve($_REQUEST['id']);
 if (!$focus->ACLAccess('view')) {
     die($mod_strings['LBL_NO_ACCESS']);
 }
 // if
 // Pull up the document revision, if it's of type Document
 if (isset($focus->object_name) && $focus->object_name == 'Document') {
     // It's a document, get the revision that really stores this file
     $focusRevision = new DocumentRevision();
     $focusRevision->retrieve($_REQUEST['id']);
     if (empty($focusRevision->id)) {
         // This wasn't a document revision id, it's probably actually a document id, we need to grab that, get the latest revision and use that
         $focusDocument = new Document();
         $focusDocument->retrieve($_REQUEST['id']);
         $focusRevision->retrieve($focusDocument->document_revision_id);
         if (!empty($focusRevision->id)) {
             $_REQUEST['id'] = $focusRevision->id;
         }
     }
 }
 // See if it is a remote file, if so, send them that direction
 if (isset($focus->doc_url) && !empty($focus->doc_url)) {
     header('Location: ' . $focus->doc_url);
     sugar_die();
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:download.php

示例7: getDocumentRevisionNameForDisplay

 /**
  * Returns a filename based off of the logical (Sugar-side) Document name and combined with the revision. Tailor
  * this to needs created by email RFCs, filesystem name conventions, charset conventions etc.
  * @param string revId Revision ID if not latest
  * @return string formatted name
  */
 function getDocumentRevisionNameForDisplay($revId = '')
 {
     global $sugar_config;
     global $current_language;
     $localLabels = return_module_language($current_language, 'DocumentRevisions');
     // prep - get source Document
     $document = new Document();
     // use passed revision ID
     if (!empty($revId)) {
         $tempDoc = new DocumentRevision();
         $tempDoc->retrieve($revId);
     } else {
         $tempDoc = $this;
     }
     // get logical name
     $document->retrieve($tempDoc->document_id);
     $logicalName = $document->document_name;
     // get revision string
     $revString = '';
     if (!empty($tempDoc->revision)) {
         $revString = "-{$localLabels['LBL_REVISION']}_{$tempDoc->revision}";
     }
     // get extension
     $realFilename = $tempDoc->filename;
     $fileExtension_beg = strrpos($realFilename, ".");
     $fileExtension = "";
     if ($fileExtension_beg > 0) {
         $fileExtension = substr($realFilename, $fileExtension_beg + 1);
     }
     //check to see if this is a file with extension located in "badext"
     foreach ($sugar_config['upload_badext'] as $badExt) {
         if (strtolower($fileExtension) == strtolower($badExt)) {
             //if found, then append with .txt to filename and break out of lookup
             //this will make sure that the file goes out with right extension, but is stored
             //as a text in db.
             $fileExtension .= ".txt";
             break;
             // no need to look for more
         }
     }
     $fileExtension = "." . $fileExtension;
     $return = $logicalName . $revString . $fileExtension;
     // apply RFC limitations here
     if (mb_strlen($return) > 1024) {
         // do something if we find a real RFC issue
     }
     return $return;
 }
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:54,代码来源:DocumentRevision.php

示例8: handleSave


//.........这里部分代码省略.........
         $note = new Note();
         //Images are presaved above so we need to prevent duplicate files from being created.
         if (isset($preProcessedImages[$file['name']])) {
             $oldId = $preProcessedImages[$file['name']];
             $note->id = $oldId;
             $note->new_with_id = TRUE;
             $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
         }
         $i = preg_replace("/email_attachment(.+)/", '$1', $key);
         $upload_file = new UploadFile($key);
         if (isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/", $key)) {
             $note->filename = $upload_file->get_stored_file_name();
             $note->file = $upload_file;
             $note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ' . $note->file->original_file_name;
             if (isset($_REQUEST['embedded' . $i]) && !empty($_REQUEST['embedded' . $i])) {
                 if ($_REQUEST['embedded' . $i] == 'true') {
                     $note->embed_flag = true;
                 } else {
                     $note->embed_flag = false;
                 }
             }
             array_push($focus->attachments, $note);
         }
     }
     $focus->saved_attachments = array();
     foreach ($focus->attachments as $note) {
         if (!empty($note->id) && $note->new_with_id === FALSE) {
             if (empty($_REQUEST['old_id'])) {
                 array_push($focus->saved_attachments, $note);
             } else {
                 // we're duplicating a template with attachments
                 // dupe the file, create a new note, assign the note to the new template
                 $newNote = new Note();
                 $newNote->retrieve($note->id);
                 $newNote->id = create_guid();
                 $newNote->parent_id = $focus->id;
                 $newNote->new_with_id = true;
                 $newNote->date_modified = '';
                 $newNote->date_entered = '';
                 $newNoteId = $newNote->save();
                 UploadFile::duplicate_file($note->id, $newNoteId, $note->filename);
             }
             continue;
         }
         $note->parent_id = $focus->id;
         $note->parent_type = 'Emails';
         $note->file_mime_type = $note->file->mime_type;
         $note_id = $note->save();
         array_push($focus->saved_attachments, $note);
         $note->id = $note_id;
         if ($note->new_with_id === FALSE) {
             $note->file->final_move($note->id);
         } else {
             $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
         }
     }
     ////	END NEW ATTACHMENTS
     ///////////////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////////
     ////	ATTACHMENTS FROM DOCUMENTS
     $count = '';
     //_pp($_REQUEST);
     //_ppd(count($_REQUEST['document']));
     if (!empty($_REQUEST['document'])) {
         $count = count($_REQUEST['document']);
     } else {
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:67,代码来源:EmailTemplateFormBase.php

示例9: XTemplate

 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $locale;
$xtpl = new XTemplate('modules/MailMerge/Step4.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
if (!empty($_POST['document_id'])) {
    $_SESSION['MAILMERGE_DOCUMENT_ID'] = $_POST['document_id'];
}
$document_id = $_SESSION['MAILMERGE_DOCUMENT_ID'];
$revision = new DocumentRevision();
$revision->retrieve($document_id);
//$document = new Document();
//$document->retrieve($document_id);
if (!empty($_POST['selected_objects'])) {
    $selObjs = urldecode($_POST['selected_objects']);
    $_SESSION['SELECTED_OBJECTS_DEF'] = $selObjs;
}
$selObjs = $_SESSION['SELECTED_OBJECTS_DEF'];
$sel_obj = array();
parse_str(stripslashes(html_entity_decode($selObjs, ENT_QUOTES)), $sel_obj);
foreach ($sel_obj as $key => $value) {
    $sel_obj[$key] = stripslashes($value);
}
$relArray = array();
//build relationship array
foreach ($sel_obj as $key => $value) {
开发者ID:omusico,项目名称:sugar_work,代码行数:31,代码来源:Step4.php

示例10: get_document_revision

/**
 * This method is used as a result of the .htaccess lock down on the cache directory. It will allow a
 * properly authenticated user to download a document that they have proper rights to download.
 *
 * @param String $session -- Session ID returned by a previous call to login.
 * @param String $id      -- ID of the document revision to obtain
 * @return return_document_revision - this is a complex type as defined in SoapTypes.php
 */
function get_document_revision($session, $id)
{
    global $sugar_config;
    $error = new SoapError();
    if (!validate_authenticated($session)) {
        $error->set_error('invalid_login');
        return array('id' => -1, 'error' => $error->get_soap_array());
    }
    $dr = new DocumentRevision();
    $dr->retrieve($id);
    if (!empty($dr->filename)) {
        $filename = $sugar_config['upload_dir'] . "/" . $dr->id;
        $handle = sugar_fopen($filename, "r");
        $contents = fread($handle, filesize($filename));
        fclose($handle);
        $contents = base64_encode($contents);
        $fh = sugar_fopen($sugar_config['upload_dir'] . "/rogerrsmith.doc", 'w');
        fwrite($fh, base64_decode($contents));
        return array('document_revision' => array('id' => $dr->id, 'document_name' => $dr->document_name, 'revision' => $dr->revision, 'filename' => $dr->filename, 'file' => $contents), 'error' => $error->get_soap_array());
    } else {
        $error->set_error('no_records');
        return array('id' => -1, 'error' => $error->get_soap_array());
    }
}
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:32,代码来源:SoapSugarUsers.php

示例11: get_document_revision

/**
 * This method is used as a result of the .htaccess lock down on the cache directory. It will allow a
 * properly authenticated user to download a document that they have proper rights to download.
 *
 * @param String $session -- Session ID returned by a previous call to login.
 * @param String $id      -- ID of the document revision to obtain
 * @return return_document_revision - this is a complex type as defined in SoapTypes.php
 */
function get_document_revision($session, $id)
{
    global $sugar_config;
    $error = new SoapError();
    if (!validate_authenticated($session)) {
        $error->set_error('invalid_login');
        return array('id' => -1, 'error' => $error->get_soap_array());
    }
    $dr = new DocumentRevision();
    $dr->retrieve($id);
    if (!empty($dr->filename)) {
        $filename = "upload://{$dr->id}";
        $contents = base64_encode(sugar_file_get_contents($filename));
        return array('document_revision' => array('id' => $dr->id, 'document_name' => $dr->document_name, 'revision' => $dr->revision, 'filename' => $dr->filename, 'file' => $contents), 'error' => $error->get_soap_array());
    } else {
        $error->set_error('no_records');
        return array('id' => -1, 'error' => $error->get_soap_array());
    }
}
开发者ID:sunmo,项目名称:snowlotus,代码行数:27,代码来源:SoapSugarUsers.php

示例12: SoapError

 /**
  * This method is used as a result of the .htaccess lock down on the cache directory. It will allow a
  * properly authenticated user to download a document that they have proper rights to download.
  *
  * @param String $session -- Session ID returned by a previous call to login.
  * @param String $id      -- ID of the document revision to obtain
  * @return new_return_document_revision - Array String 'id' -- The ID of the document revision containing the attachment
  * 												String document_name - The name of the document
  * 												String revision - The revision value for this revision
  *                                         		String 'filename' -- The file name of the attachment
  *                                          	Binary 'file' -- The binary contents of the file.
  * @exception 'SoapFault' -- The SOAP error, if any
  */
 function get_document_revision($session, $id)
 {
     $GLOBALS['log']->info('Begin: SugarWebServiceImpl->get_document_revision');
     global $sugar_config;
     $error = new SoapError();
     if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', '', '', '', $error)) {
         $GLOBALS['log']->info('End: SugarWebServiceImpl->get_document_revision');
         return;
     }
     // if
     require_once 'modules/DocumentRevisions/DocumentRevision.php';
     $dr = new DocumentRevision();
     $dr->retrieve($id);
     if (!empty($dr->filename)) {
         $filename = $sugar_config['upload_dir'] . "/" . $dr->id;
         if (filesize($filename) > 0) {
             $contents = sugar_file_get_contents($filename);
         } else {
             $contents = '';
         }
         $contents = base64_encode($contents);
         $GLOBALS['log']->info('End: SugarWebServiceImpl->get_document_revision');
         return array('document_revision' => array('id' => $dr->id, 'document_name' => $dr->document_name, 'revision' => $dr->revision, 'filename' => $dr->filename, 'file' => $contents));
     } else {
         $error->set_error('no_records');
         self::$helperObject->setFaultObject($error);
         $GLOBALS['log']->info('End: SugarWebServiceImpl->get_document_revision');
     }
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:42,代码来源:SugarWebServiceImpl.php

示例13: new_get_document_revision

/**
 * This method is used as a result of the .htaccess lock down on the cache directory. It will allow a
 * properly authenticated user to download a document that they have proper rights to download.
 *
 * @param String $session -- Session ID returned by a previous call to login.
 * @param String $id      -- ID of the document revision to obtain
 * @return new_return_document_revision - Array String 'id' -- The ID of the document revision containing the attachment
 * 												String document_name - The name of the document
 * 												String revision - The revision value for this revision
 *                                         		String 'filename' -- The file name of the attachment
 *                                          	Binary 'file' -- The binary contents of the file.
 * @exception 'SoapFault' -- The SOAP error, if any
 */
function new_get_document_revision($session, $id)
{
    global $sugar_config;
    $error = new SoapError();
    if (!checkSessionAndModuleAccess($session, 'invalid_session', '', '', '', $error)) {
        return;
    }
    // if
    $dr = new DocumentRevision();
    $dr->retrieve($id);
    if (!empty($dr->filename)) {
        $filename = $sugar_config['upload_dir'] . "/" . $dr->id;
        $handle = sugar_fopen($filename, "r");
        $contents = fread($handle, filesize($filename));
        fclose($handle);
        $contents = base64_encode($contents);
        $fh = sugar_fopen($sugar_config['upload_dir'] . "/rogerrsmith.doc", 'w');
        fwrite($fh, base64_decode($contents));
        return array('document_revision' => array('id' => $dr->id, 'document_name' => $dr->document_name, 'revision' => $dr->revision, 'filename' => $dr->filename, 'file' => $contents));
    } else {
        $error->set_error('no_records');
        setFaultObject($error);
    }
}
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:37,代码来源:SoapSugarUsers_version2.php

示例14: handleSave


//.........这里部分代码省略.........
     $focus->attachments = array_merge($focus->attachments, $notes_list);
     //for($i = 0; $i < $max_files_upload; $i++) {
     foreach ($_FILES as $key => $file) {
         $note = new Note();
         $i = preg_replace("/email_attachment(.+)/", '$1', $key);
         $upload_file = new UploadFile($key);
         if ($upload_file == -1) {
             continue;
         }
         if (isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/", $key)) {
             $note->filename = $upload_file->get_stored_file_name();
             $note->file = $upload_file;
             $note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ' . $note->file->original_file_name;
             if (isset($_REQUEST['embedded' . $i]) && !empty($_REQUEST['embedded' . $i])) {
                 if ($_REQUEST['embedded' . $i] == 'true') {
                     $note->embed_flag = true;
                 } else {
                     $note->embed_flag = false;
                 }
             }
             array_push($focus->attachments, $note);
         }
     }
     $focus->saved_attachments = array();
     foreach ($focus->attachments as $note) {
         if (!empty($note->id)) {
             if (empty($_REQUEST['old_id'])) {
                 // to support duplication of email templates
                 array_push($focus->saved_attachments, $note);
             } else {
                 // we're duplicating a template with attachments
                 // dupe the file, create a new note, assign the note to the new template
                 $newNote = new Note();
                 $newNote->retrieve($note->id);
                 $newNote->id = create_guid();
                 $newNote->parent_id = $focus->id;
                 $newNote->new_with_id = true;
                 $newNote->date_modified = '';
                 $newNote->date_entered = '';
                 $newNoteId = $newNote->save();
                 $dupeFile = new UploadFile('duplicate');
                 $dupeFile->duplicate_file($note->id, $newNoteId, $note->filename);
             }
             continue;
         }
         $note->parent_id = $focus->id;
         $note->parent_type = 'Emails';
         $note->file_mime_type = $note->file->mime_type;
         $note_id = $note->save();
         array_push($focus->saved_attachments, $note);
         $note->id = $note_id;
         $note->file->final_move($note->id);
     }
     ////	END NEW ATTACHMENTS
     ///////////////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////////
     ////	ATTACHMENTS FROM DOCUMENTS
     $count = '';
     //_pp($_REQUEST);
     //_ppd(count($_REQUEST['document']));
     if (!empty($_REQUEST['document'])) {
         $count = count($_REQUEST['document']);
     } else {
         $count = 10;
     }
     for ($i = 0; $i < $count; $i++) {
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:67,代码来源:EmailTemplateFormBase.php

示例15: saveAttachedDocuments

 private function saveAttachedDocuments()
 {
     //	$documents = 'documents';
     //	$this->bean->load_relationship($documents);
     $sequence = array();
     if (isset($_POST["document_status"]) && !empty($_POST["document_status"])) {
         for ($i = 0; $i < count($_POST["document_status"]); $i++) {
             $document_id = $_POST['document_ids'][$i];
             if ($_POST["document_status"][$i] == 'delete') {
                 $revision = new DocumentRevision();
                 if ($revision->retrieve($_POST['document_ids'][$i])) {
                     $document_id = $revision->document_id;
                 }
                 $document = new Document();
                 $document->retrieve($document_id);
                 $changes = array('field_name' => $document->document_name, 'data_type' => 'varchar', 'before' => $document->filename, 'after' => '<deleted>');
                 global $sugar_version;
                 if (floatval(substr($sugar_version, 0, 3)) > 6.3) {
                     $this->bean->db->save_audit_records($this->bean, $changes);
                 } else {
                     $this->bean->dbManager->helper->save_audit_records($this->bean, $changes);
                 }
             } else {
                 $revision = new DocumentRevision();
                 if ($revision->retrieve($_POST['document_ids'][$i])) {
                     $document_id = $revision->document_id;
                 }
                 //		$this->bean->$documents->add($document_id); //2.1 We do not add documents here; only pdf files should be added
                 $document = new Document();
                 $document->retrieve($document_id);
                 if ($_POST["document_status"][$i] == 'new') {
                     $changes = array('field_name' => $document->document_name, 'data_type' => 'varchar', 'before' => '<n/a>', 'after' => $document->filename);
                     global $sugar_version;
                     if (floatval(substr($sugar_version, 0, 3)) > 6.3) {
                         $this->bean->db->save_audit_records($this->bean, $changes);
                     } else {
                         $this->bean->dbManager->helper->save_audit_records($this->bean, $changes);
                     }
                 }
                 $sequence[] = $_POST['document_ids'][$i];
             }
         }
     }
     $this->bean->attachmentsequence = implode(' ', $sequence);
 }
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:45,代码来源:controller.php


注:本文中的DocumentRevision::retrieve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。