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


PHP DocumentRevision::save方法代码示例

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


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

示例1: saveFile

 function saveFile($document, $portal = false)
 {
     global $sugar_config;
     $focus = new Document();
     if (!empty($document['id'])) {
         $focus->retrieve($document['id']);
     } else {
         return '-1';
     }
     if (!empty($document['file'])) {
         $decodedFile = base64_decode($document['file']);
         $this->upload_file->set_for_soap($document['filename'], $decodedFile);
         $ext_pos = strrpos($this->upload_file->stored_file_name, ".");
         $this->upload_file->file_ext = substr($this->upload_file->stored_file_name, $ext_pos + 1);
         if (in_array($this->upload_file->file_ext, $sugar_config['upload_badext'])) {
             $this->upload_file->stored_file_name .= ".txt";
             $this->upload_file->file_ext = "txt";
         }
         $revision = new DocumentRevision();
         $revision->filename = $this->upload_file->get_stored_file_name();
         $revision->file_mime_type = $this->upload_file->getMimeSoap($revision->filename);
         $revision->file_ext = $this->upload_file->file_ext;
         //$revision->document_name = ;
         $revision->revision = $document['revision'];
         $revision->document_id = $document['id'];
         $revision->save();
         $focus->document_revision_id = $revision->id;
         $focus->save();
         $return_id = $revision->id;
         $this->upload_file->final_move($revision->id);
     } else {
         return '-1';
     }
     return $return_id;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:35,代码来源:DocumentSoap.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: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user');
     $this->relate_doc = new Document();
     $this->relate_doc->document_name = 'Relate doc';
     $this->relate_doc->save();
     $this->parent_doc = new Document();
     $this->parent_doc->document_name = 'Parent doc';
     $this->parent_doc->related_doc_id = $this->relate_doc->id;
     $this->parent_doc->save();
     $this->revision = new DocumentRevision();
     $this->revision->revision = 1;
     $this->revision->doc_id = $this->relate_doc->id;
     $this->revision->save();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:17,代码来源:Bug61144Test.php

示例4: save

 function save($check_notify = false)
 {
     if (empty($this->id) || $this->new_with_id) {
         if (!empty($this->uploadfile)) {
             $this->filename = $this->uploadfile;
             if (empty($this->id)) {
                 $this->id = create_guid();
                 $this->new_with_id = true;
             }
             $Revision = new DocumentRevision();
             //save revision.
             $Revision->change_log = translate('DEF_CREATE_LOG', 'Documents');
             $Revision->revision = $this->revision;
             $Revision->document_id = $this->id;
             $Revision->filename = $this->filename;
             $Revision->file_ext = $this->file_ext;
             $Revision->file_mime_type = $this->file_mime_type;
             $Revision->save();
             //Move file saved during populatefrompost to match the revision id rather than document id
             rename(UploadFile::get_url($this->filename, $this->id), UploadFile::get_url($this->filename, $Revision->id));
             //update document with latest revision id
             $this->process_save_dates = false;
             //make sure that conversion does not happen again.
             $this->document_revision_id = $Revision->id;
         }
         //set relationship field values if contract_id is passed (via subpanel create)
         if (!empty($_POST['contract_id'])) {
             $save_revision['document_revision_id'] = $this->document_revision_id;
             $this->load_relationship('contracts');
             $this->contracts->add($_POST['contract_id'], $save_revision);
         }
         if (isset($_POST['load_signed_id']) and !empty($_POST['load_signed_id'])) {
             $query = "update linked_documents set deleted=1 where id='" . $_POST['load_signed_id'] . "'";
             $this->db->query($query);
         }
     }
     return parent::save($check_notify);
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:38,代码来源:Document.php

示例5: save

 function save($check_notify = false)
 {
     if (empty($this->doc_type)) {
         $this->doc_type = 'Sugar';
     }
     if (empty($this->id) || $this->new_with_id) {
         if (empty($this->id)) {
             $this->id = create_guid();
             $this->new_with_id = true;
         }
         if (isset($_REQUEST) && isset($_REQUEST['duplicateSave']) && $_REQUEST['duplicateSave'] == true && isset($_REQUEST['filename_old_doctype'])) {
             $this->doc_type = $_REQUEST['filename_old_doctype'];
             $isDuplicate = true;
         } else {
             $isDuplicate = false;
         }
         $Revision = new DocumentRevision();
         //save revision.
         $Revision->in_workflow = true;
         $Revision->not_use_rel_in_req = true;
         $Revision->new_rel_id = $this->id;
         $Revision->new_rel_relname = 'Documents';
         $Revision->change_log = translate('DEF_CREATE_LOG', 'Documents');
         $Revision->revision = $this->revision;
         $Revision->document_id = $this->id;
         $Revision->filename = $this->filename;
         if (isset($this->file_ext)) {
             $Revision->file_ext = $this->file_ext;
         }
         if (isset($this->file_mime_type)) {
             $Revision->file_mime_type = $this->file_mime_type;
         }
         $Revision->doc_type = $this->doc_type;
         if (isset($this->doc_id)) {
             $Revision->doc_id = $this->doc_id;
         }
         if (isset($this->doc_url)) {
             $Revision->doc_url = $this->doc_url;
         }
         $Revision->id = create_guid();
         $Revision->new_with_id = true;
         $createRevision = false;
         //Move file saved during populatefrompost to match the revision id rather than document id
         if (!empty($_FILES['filename_file'])) {
             rename("upload://{$this->id}", "upload://{$Revision->id}");
             $createRevision = true;
         } else {
             if ($isDuplicate && (empty($this->doc_type) || $this->doc_type == 'Sugar')) {
                 // Looks like we need to duplicate a file, this is tricky
                 $oldDocument = new Document();
                 $oldDocument->retrieve($_REQUEST['duplicateId']);
                 $old_name = "upload://{$oldDocument->document_revision_id}";
                 $new_name = "upload://{$Revision->id}";
                 $GLOBALS['log']->debug("Attempting to copy from {$old_name} to {$new_name}");
                 copy($old_name, $new_name);
                 $createRevision = true;
             }
         }
         // For external documents, we just need to make sure we have a doc_id
         if (!empty($this->doc_id) && $this->doc_type != 'Sugar') {
             $createRevision = true;
         }
         if ($createRevision) {
             $Revision->save();
             //update document with latest revision id
             $this->process_save_dates = false;
             //make sure that conversion does not happen again.
             $this->document_revision_id = $Revision->id;
         }
         //set relationship field values if contract_id is passed (via subpanel create)
         if (!empty($_POST['contract_id'])) {
             $save_revision['document_revision_id'] = $this->document_revision_id;
             $this->load_relationship('contracts');
             $this->contracts->add($_POST['contract_id'], $save_revision);
         }
         if (isset($_POST['load_signed_id']) and !empty($_POST['load_signed_id'])) {
             $query = "update linked_documents set deleted=1 where id='" . $_POST['load_signed_id'] . "'";
             $this->db->query($query);
         }
     }
     return parent::save($check_notify);
 }
开发者ID:omusico,项目名称:SelkirkCRM,代码行数:82,代码来源:Document.php

示例6: createNewRevision

 private function createNewRevision($productCatalog, &$document)
 {
     global $timedate;
     global $app_list_strings;
     $productCatalogFilename = $this->categoryPagesToPdf($productCatalog);
     if (!$productCatalogFilename) {
         $GLOBALS['log']->fatal('OQC: Failed to create new catalog revision');
         return false;
     }
     $revision = new DocumentRevision();
     if (!$revision->retrieve($document->document_revision_id)) {
         $revision->document_id = $document->id;
         $revision->revision = 0;
     }
     $revision->revision = $revision->revision + 1;
     if (DEBUG_PDF_CREATION) {
         $revision->file_mime_type = 'text/plain';
         $revision->file_ext = 'log';
         $revision->filename = $app_list_strings['oqc']['pdf']['common']['filenamePrefixCatalog'] . "_" . date("Ymd") . "_{$revision->revision}.log";
     } else {
         $revision->file_mime_type = 'application/pdf';
         $revision->file_ext = 'pdf';
         $revision->filename = $app_list_strings['oqc']['pdf']['common']['filenamePrefixCatalog'] . "_" . date("Ymd") . "_{$revision->revision}.pdf";
     }
     // set fields to null in order to correctly generate new values
     $revision->date_entered = '';
     $revision->date_modified = '';
     //$revision->filename = $app_list_strings['oqc']['pdf']['common']['filenamePrefixCatalog'] . "_" . date("Ymd") . "_{$revision->revision}.pdf";
     $revision->id = '';
     $revision->save();
     rename($productCatalogFilename, getDocumentFilename($revision->id));
     $document->document_revision_id = $revision->id;
     return true;
 }
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:34,代码来源:ProductCatalogPdfCreator.php

示例7: KBDocumentRevision

 $kbdoc->status_id = 'Published';
 $kbdoc->team_id = 1;
 $kbdoc->assigned_user_id = 'seed_will_id';
 $kbdoc->active_date = $v['start_date'];
 $kbdoc->exp_date = $v['exp_date'];
 $kbdoc->is_external_article = 1;
 $kbdoc->save();
 $kbdocRevision = new KBDocumentRevision();
 $kbdocRevision->change_log = translate('DEF_CREATE_LOG', 'KBDocuments');
 $kbdocRevision->revision = '1';
 $kbdocRevision->kbdocument_id = $kbdoc->id;
 $kbdocRevision->latest = true;
 $kbdocRevision->save();
 $docRevision = new DocumentRevision();
 $docRevision->filename = $kbdoc->kbdocument_name;
 $docRevision->save();
 $kbdocContent = new KBContent();
 $kbdocContent->document_revision_id = $docRevision->id;
 $kbdocContent->team_id = $kbdoc->team_id;
 $kbdocContent->kbdocument_body = $v['body'];
 $kbdocContent->save();
 $kbdocRevision->kbcontent_id = $kbdocContent->id;
 $kbdocRevision->document_revision_id = $docRevision->id;
 $kbdocRevision->save();
 $kbdoc->kbdocument_revision_id = $kbdocRevision->id;
 $kbdoc->save();
 foreach ($v['tags'] as $tag) {
     $kbdocKBTag = new KBDocumentKBTag();
     $kbdocKBTag->kbtag_id = array_search($tag, $kbtags_hash);
     $kbdocKBTag->kbdocument_id = $kbdoc->id;
     $kbdocKBTag->team_id = $kbdoc->team_id;
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:populateSeedData.php

示例8: gen_prosmotr

function gen_prosmotr()
{
    require_once 'custom/include/PHPWord/PHPWord.php';
    $bean = loadBean('Meetings');
    $bean->retrieve($_REQUEST['record']);
    $user = loadBean('Users');
    // получаем реелтора
    $user->retrieve($bean->assigned_user_id);
    $client = loadBean($bean->parent_type);
    // получаем клиента
    $client->retrieve($bean->parent_id);
    $realty = loadBean('Realty');
    // получаем объект
    $realty->retrieve($bean->realty_id);
    /*$client = loadBean('Contacts');// получаем клиента
    	$client->retrieve($bean->contact_id);*/
    $doc = new Document();
    // создаем запись в документах и описание файла к нему
    $doc->id = create_guid();
    $doc->new_with_id = true;
    $doc->document_name = "Просмотровый лист по показу {$bean->name}";
    $doc->status_id = "Active";
    $doc_rev = new DocumentRevision();
    $doc_rev->filename = "просмотровый лист - {$bean->name}.docx";
    $doc_rev->file_ext = "docx";
    $doc_rev->file_mime_type = "application/octet-stream";
    $doc_rev->revision = "1";
    $doc_rev->document_id = $doc->id;
    $doc_rev->save();
    $doc->document_revision_id = $doc_rev->id;
    $doc->save();
    /*$client->load_relationship('documents'); // цепляем документ к клиенту
    	$client->documents->add($doc->id,array());*/
    //Set table cells style
    $cellStyle = array('borderTopSize' => 1, 'borderTopColor' => '000000', 'borderLeftSize' => 1, 'borderLeftColor' => '000000', 'borderRightSize' => 1, 'borderRightColor' => '000000', 'borderBottomSize' => 1, 'borderBottomColor' => '000000');
    // New Word Document
    $PHPWord = new PHPWord();
    // New portrait section
    $section = $PHPWord->createSection();
    //Add title
    $section->addText('Просмотровый лист', array('size' => 18, 'bold' => true), array('align' => 'center'));
    // Add table
    $table = $section->addTable();
    $table->addRow();
    // Add Cell
    $table->addCell(1750, $cellStyle)->addText("Дата и время");
    $table->addCell(1750, $cellStyle)->addText("Адрес");
    $table->addCell(1750, $cellStyle)->addText("Описание");
    $table->addCell(1750, $cellStyle)->addText("Объект");
    $table->addCell(1750, $cellStyle)->addText("Клиент");
    $table->addCell(1750, $cellStyle)->addText("Риэлтор");
    $table->addRow();
    $table->addCell(1750, $cellStyle)->addText($bean->date_start);
    $table->addCell(1750, $cellStyle)->addText($bean->location);
    $table->addCell(1750, $cellStyle)->addText($bean->description);
    $table->addCell(1750, $cellStyle)->addText($realty->name);
    $table->addCell(1750, $cellStyle)->addText($client->first_name . ' ' . $client->last_name);
    $table->addCell(1750, $cellStyle)->addText($user->first_name . ' ' . $user->last_name);
    // Save File
    $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
    $objWriter->save("upload/{$doc_rev->id}");
    echo "<h1>Просмотровый лист создан</h1><br/>\n\t\t<a href='index.php?entryPoint=download&id={$doc_rev->id}&type=Documents'>Скачать файл</a><br/>\n\t\t<a href='index.php?module=Documents&action=DetailView&record={$doc->id}'>Перейти в документ</a><hr/>\n\t\t<a href='index.php?module=Meetings&action=DetailView&record={$_REQUEST['record']}'>Вернуться в карточку показа</a>\n\t\t";
}
开发者ID:omusico,项目名称:sugar_work,代码行数:63,代码来源:prosmotr.php

示例9: switch

        $Revision->filename = $old_revision->filename;
        $Revision->file_mime_type = $old_revision->file_mime_type;
        $Revision->file_ext = $old_revision->file_ext;
    }
}
if (isset($Document->id)) {
    //save document
    $return_id = $Document->save();
} else {
    //save document
    $return_id = $Document->save();
    //save revision.
    $Revision->change_log = $mod_strings['DEF_CREATE_LOG'];
    $Revision->revision = $Document->revision;
    $Revision->document_id = $Document->id;
    $Revision->save();
    //update document with latest revision id
    $Document->process_save_dates = false;
    //make sure that conversion does not happen again.
    $Document->document_revision_id = $Revision->id;
    $Document->save();
    //set relationship field values if parent_id is passed.
    //this happens only in the new mode because document edit view
    //does not have a way to change the parent.
    //also we want to stamp the document revision only once.
    if (!empty($_POST['parent_id']) && !empty($_POST['parent_type'])) {
        $save_revision['document_revision_id'] = $Document->document_revision_id;
        switch (strtolower($_POST['parent_type'])) {
            case "contracts":
                $Document->load_relationship('contracts');
                $Document->contracts->add($_POST['parent_id'], $save_revision);
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:Save.php

示例10: createNewRevision

function createNewRevision($contract, &$document)
{
    // TODO add some logic to select different templates for Contracts/Quotes/Additions
    //1. Get template paths. 2. get contract/services variables.3 Proceed to fetching partial templates. 4. Proceed to fetching main template and creating pdf file.
    if ($contract->oqc_template == null) {
        $beanName = substr(trim($contract->object_name), 4);
        $templatePaths = getTemplatesPath($beanName);
    } else {
        $templatePaths = getTemplatesPath($contract->oqc_template);
    }
    $pdfData = getPdfVariables($contract);
    $segmentFilenames = array();
    $segmentFilenames['titlePage'] = titlePageToLatex($pdfData, $templatePaths);
    $segmentFilenames['textBlocks'] = textBlocksToLatex($contract, $pdfData, $templatePaths);
    //if ($segmentFilenames['textBlocks'] == null ) {
    //$GLOBALS['log']->fatal('OQC: TextBloks are empty or You do not have html2tex convertor installed!');
    //return null;
    //	}
    $segmentFilenames['services'] = servicesToLatex($pdfData, $templatePaths);
    $contractFilename = null;
    $contractFilename = templateToPdf($templatePaths["CONTRACT_TEMPLATE"], $segmentFilenames);
    if ($contractFilename == null) {
        //$GLOBALS['log']->fatal('OQC: You likely do not have PDFLATEX package installed!');
        return null;
    }
    if (DEBUG_PDF_CREATION) {
        $contractWithAttachmentsFilename = $contractFilename;
        // Add information about pdftk to the log file
        $returnTestValue = null;
        $outputArray = array();
        $returnTestValue = execute(PDFTK, '--version', $outputArray);
        $GLOBALS['log']->error('createNewRevision: pdftk $returnTestValue is: ' . $returnTestValue);
        if (!empty($outputArray)) {
            $addString = "\n\rpdftk --version output: \n\r" . implode("\n", $outputArray);
        } else {
            $addString = "\n\rpdftk --version output: null \nreturn value: {$returnTestValue}";
        }
        sugar_file_put_contents($contractWithAttachmentsFilename, $addString, FILE_APPEND | LOCK_EX);
    } else {
        $contractWithAttachmentsFilename = attachDocuments($contract, $contractFilename);
        if ($contractWithAttachmentsFilename == null) {
            $GLOBALS['log']->fatal('OQC: You likely do not have PDFTK package installed!');
            $contractWithAttachmentsFilename = $contractFilename;
        }
    }
    // unlink segmentFilenames
    foreach ($segmentFilenames as $filename) {
        unlink($filename);
    }
    $revision = new DocumentRevision();
    $revision->document_id = $document->id;
    $revision->revision = $contract->version;
    //1.7.6 Make document version the same as seed
    if (DEBUG_PDF_CREATION) {
        $revision->file_mime_type = 'text/plain';
        $revision->file_ext = 'log';
        $revision->filename = $document->category_id . '_' . $contract->svnumber . '_v' . $revision->revision . '.log';
    } else {
        $revision->file_mime_type = 'application/pdf';
        $revision->file_ext = 'pdf';
        $revision->filename = $document->category_id . '_' . $contract->svnumber . '_v' . $revision->revision . '.pdf';
    }
    $revision->save();
    rename($contractWithAttachmentsFilename, getDocumentFilename($revision->id));
    $document->document_revision_id = $revision->id;
    //$document->save();
    return true;
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:68,代码来源:oqc_CreatePdf.php


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