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


PHP Document::retrieve方法代码示例

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


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

示例3: testRevisionSave

 function testRevisionSave()
 {
     $ret = $GLOBALS['db']->query("SELECT COUNT(*) AS rowcount1 FROM document_revisions WHERE document_id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['rowcount1'], 0, 'We created an empty revision');
     $ret = $GLOBALS['db']->query("SELECT document_revision_id FROM documents WHERE id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertTrue(empty($row['document_revision_id']), 'We linked the document to a fake document_revision');
     $ds = new DocumentSoap();
     $revision_stuff = array('file' => base64_encode('Pickles has an extravagant beard of pine fur.'), 'filename' => 'a_file_about_pickles.txt', 'id' => $this->doc->id, 'revision' => '1');
     $revisionId = $ds->saveFile($revision_stuff);
     $ret = $GLOBALS['db']->query("SELECT COUNT(*) AS rowcount1 FROM document_revisions WHERE document_id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['rowcount1'], 1, 'We didn\'t create a revision when we should have');
     $ret = $GLOBALS['db']->query("SELECT document_revision_id FROM documents WHERE id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['document_revision_id'], $revisionId, 'We didn\'t link the newly created document revision to the document');
     // Double saving doesn't work because save doesn't reset the new_with_id
     $newDoc = new Document();
     $newDoc->retrieve($this->doc->id);
     $newDoc->document_revision_id = $revisionId;
     $newDoc->save(FALSE);
     $ret = $GLOBALS['db']->query("SELECT COUNT(*) AS rowcount1 FROM document_revisions WHERE document_id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['rowcount1'], 1, 'We didn\'t create a revision when we should have');
     $ret = $GLOBALS['db']->query("SELECT document_revision_id FROM documents WHERE id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['document_revision_id'], $revisionId, 'We didn\'t link the newly created document revision to the document');
 }
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:29,代码来源:Bug43560Test.php

示例4: Document

 function fill_in_relationship_fields()
 {
     parent::fill_in_relationship_fields();
     if (!empty($this->signedcontractdocument_id)) {
         $document = new Document();
         if ($document->retrieve($this->signedcontractdocument_id)) {
             $this->signedcontractdocument = $document->document_name;
         }
     }
 }
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:10,代码来源:oqc_Contract.php

示例5: getRevisionBean

function getRevisionBean()
{
    $document = new Document();
    // Dokument wiederfinden -> Todo: anhand der field_defs generisch suchen
    if ($_REQUEST['return_id'] != "" && $_REQUEST['return_id'] != "undefined") {
        $document_id = $_REQUEST['return_id'];
        if ($document->retrieve($document_id)) {
            return $document;
        }
    } else {
        die('Could not get document id!');
    }
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:13,代码来源:GetLatestRevision.php

示例6: testSaveAndGet_document_name

 public function testSaveAndGet_document_name()
 {
     error_reporting(E_ERROR | E_PARSE);
     $document = new Document();
     $document->filename = 'test';
     $document->file_url = 'test_url';
     $document->file_url_noimage = 'test_image_url';
     $document->last_rev_created_name = 'test';
     $document->category_id = '1';
     $document->subcategory_id = '1';
     $document->document_name = 'test';
     $document->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($document->id));
     $this->assertEquals(36, strlen($document->id));
     //execute Get_document_name() method and verify it gets the name correctly
     $this->assertEquals(null, $document->get_document_name(1));
     $this->assertEquals('test', $document->get_document_name($document->id));
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $document->mark_deleted($document->id);
     $result = $document->retrieve($document->id);
     $this->assertEquals(null, $result);
 }
开发者ID:recci,项目名称:SuiteCRM,代码行数:23,代码来源:DocumentTest.php

示例7: die

 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();
 }
 if (isset($focusRevision) && isset($focusRevision->doc_url) && !empty($focusRevision->doc_url)) {
     header('Location: ' . $focusRevision->doc_url);
     sugar_die();
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:download.php

示例8: 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

示例9: 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

示例10: Document

 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * All copies of the Covered Code must include on each user interface screen:
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 ********************************************************************************/
//updates the link between contract and document with latest revision of
//the document and sends the control back to calling page.
require_once 'modules/Documents/Document.php';
require_once 'include/formbase.php';
if (!empty($_REQUEST['record'])) {
    $document = new Document();
    $document->retrieve($_REQUEST['record']);
    if (!empty($document->document_revision_id) && !empty($_REQUEST['get_latest_for_id'])) {
        $query = "update linked_documents set document_revision_id='{$document->document_revision_id}', date_modified='" . gmdate("Y-m-d H:i:s") . "' where id ='{$_REQUEST['get_latest_for_id']}' ";
        $document->db->query($query);
    }
}
handleRedirect();
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:GetLatestRevision.php

示例11: Document

 ********************************************************************************/
global $mod_strings;
if (!isset($_REQUEST['record'])) {
    sugar_die($mod_strings['ERR_DELETE_RECORD']);
}
$focus = new Document();
$focus->retrieve($_REQUEST['record']);
if (!$focus->ACLAccess('Delete')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
if (isset($_REQUEST['object']) && ($_REQUEST['object'] = "documentrevision")) {
    //delete document revision.
    $focus = new DocumentRevision();
    UploadFile::unlink_file($_REQUEST['revision_id'], $_REQUEST['filename']);
} else {
    //delete document and its revisions.
    $focus = new Document();
    $focus->retrieve($_REQUEST['record']);
    $focus->load_relationships('revisions');
    $revisions = $focus->get_linked_beans('revisions', 'DocumentRevision');
    if (!empty($revisions) && is_array($revisions)) {
        foreach ($revisions as $key => $thisversion) {
            UploadFile::unlink_file($thisversion->id, $thisversion->filename);
            //mark the version deleted.
            $thisversion->mark_deleted($thisversion->id);
        }
    }
}
$focus->mark_deleted($_REQUEST['record']);
header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:Delete.php

示例12: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'modules/EmailTemplates/EmailTemplate.php';
     require_once 'modules/Documents/Document.php';
     require_once 'modules/DocumentRevisions/DocumentRevision.php';
     require_once 'modules/Notes/Note.php';
     require_once 'include/formbase.php';
     require_once 'include/upload_file.php';
     global $upload_maxsize, $upload_dir;
     global $mod_strings;
     $focus = new EmailTemplate();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if (!isset($_REQUEST['published'])) {
         $focus->published = 'off';
     }
     $return_id = $focus->save();
     ///////////////////////////////////////////////////////////////////////////////
     ////	ATTACHMENT HANDLING
     ///////////////////////////////////////////////////////////////////////////
     ////	ADDING NEW ATTACHMENTS
     $max_files_upload = 10;
     if (!empty($focus->id)) {
         $note = new Note();
         $where = "notes.parent_id='{$focus->id}'";
         if (!empty($_REQUEST['old_id'])) {
             // to support duplication of email templates
             $where .= " OR notes.parent_id='" . $_REQUEST['old_id'] . "'";
         }
         $notes_list = $note->get_full_list("", $where, true);
     }
     if (!isset($notes_list)) {
         $notes_list = array();
     }
     if (!is_array($focus->attachments)) {
         // PHP5 does not auto-create arrays(). Need to initialize it here.
         $focus->attachments = array();
     }
     $focus->attachments = array_merge($focus->attachments, $notes_list);
     for ($i = 0; $i < $max_files_upload; $i++) {
         $note = new Note();
         $upload_file = new UploadFile('email_attachment' . $i);
         if ($upload_file == -1) {
             continue;
         }
         if (isset($_FILES['email_attachment' . $i]) && $upload_file->confirm_upload()) {
             $note->filename = $upload_file->get_stored_file_name();
             $note->file = $upload_file;
             $note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ' . $note->file->original_file_name;
             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;
                 $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
     for ($i = 0; $i < 10; $i++) {
         if (isset($_REQUEST['documentId' . $i]) && !empty($_REQUEST['documentId' . $i])) {
             $doc = new Document();
             $docRev = new DocumentRevision();
             $docNote = new Note();
             $noteFile = new UploadFile('none');
             $doc->retrieve($_REQUEST['documentId' . $i]);
             $docRev->retrieve($doc->document_revision_id);
             array_push($focus->saved_attachments, $docRev);
             $docNote->name = $doc->document_name;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:101,代码来源:EmailTemplateFormBase.php

示例13: getProductCatalogVariables

 private function getProductCatalogVariables($productCatalog)
 {
     $rootCategoriesSmarty = $this->getSmartyCategories($productCatalog->getAllCategories());
     $this->insertProducts($rootCategoriesSmarty);
     $description = htmlToLatex(from_html($productCatalog->description));
     //1.7.6 TODO create error handling here
     if ($description == null) {
         $GLOBALS['log']->error('OQC: Product catalog description is null!');
         //return null;
     }
     global $timedate;
     $validfrom = $timedate->to_display_date($productCatalog->validfrom);
     $validto = $timedate->to_display_date($productCatalog->validto);
     $frontpage = null;
     $attachment = null;
     if ($productCatalog->frontpage_id != null || $productCatalog->attachment_id != null) {
         $doc = new Document();
         if ($doc->retrieve($productCatalog->frontpage_id)) {
             $frontpage = str_replace("\\", '/', TMP_DIR . DIRECTORY_SEPARATOR . $doc->document_revision_id . '.pdf');
             copy(getcwd() . DIRECTORY_SEPARATOR . getDocumentFilename($doc->document_revision_id), $frontpage);
         }
         if ($doc->retrieve($productCatalog->attachment_id)) {
             $attachment = str_replace("\\", '/', TMP_DIR . DIRECTORY_SEPARATOR . $doc->document_revision_id . '.pdf');
             copy(getcwd() . DIRECTORY_SEPARATOR . getDocumentFilename($doc->document_revision_id), $attachment);
         }
     }
     //ProductCatalog currency setup
     $currencyArray = array();
     $currency = new Currency();
     $currency_id = $currency->retrieve_id_by_name($productCatalog->currency_id);
     //$GLOBALS['log']->error('Contract variables: currency: '. var_export($currency_id,true));
     if ($currency_id) {
         $currency->retrieve($currency_id);
         $currencyArray['currency_id'] = $currency->iso4217;
         $currencyArray['currency_symbol'] = $currency->symbol;
         $currencyArray['currency_ratio'] = $currency->conversion_rate;
     } else {
         $currencyArray['currency_id'] = $currency->getDefaultISO4217();
         $currencyArray['currency_symbol'] = $currency->getDefaultCurrencySymbol();
         $currencyArray['currency_ratio'] = 1.0;
     }
     $currencyArray['currency_symbol'] = str_replace("€", '\\euro{}', $currencyArray['currency_symbol']);
     $currencyArray['currency_symbol'] = str_replace('$', '\\$', $currencyArray['currency_symbol']);
     $currencyArray['currency_symbol'] = str_replace("£", '{\\pounds}', $currencyArray['currency_symbol']);
     $currencyArray['currency_symbol'] = str_replace("¥", '{Y\\hspace*{-1.4ex}--}', $currencyArray['currency_symbol']);
     $productCatalogVariables = array('name' => $productCatalog->name, 'validfrom' => $validfrom, 'validto' => $validto, 'graphicsDir' => LATEX_GRAPHICS_DIR, 'categoriesAndProducts' => $rootCategoriesSmarty, 'description' => $description, 'frontpage' => $frontpage, 'attachment' => $attachment, 'year' => date('Y'), 'currency' => $currencyArray, 'discount' => 1.0 - $productCatalog->oqc_catalog_discount / 100);
     //$GLOBALS['log']->error('Product Catalog variables: '. var_export($productCatalogVariables,true));
     return $productCatalogVariables;
 }
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:49,代码来源:ProductCatalogPdfCreator.php

示例14: 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

示例15: handleAttachments

 /**
  * handles attachments of various kinds when sending email
  */
 function handleAttachments()
 {
     global $mod_strings;
     ///////////////////////////////////////////////////////////////////////////
     ////    ATTACHMENTS FROM DRAFTS
     if (($this->type == 'out' || $this->type == 'draft') && $this->status == 'draft' && isset($_REQUEST['record'])) {
         $this->getNotes($_REQUEST['record']);
         // cn: get notes from OLD email for use in new email
     }
     ////    END ATTACHMENTS FROM DRAFTS
     ///////////////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////////
     ////    ATTACHMENTS FROM FORWARDS
     // Bug 8034 Jenny - Need the check for type 'draft' here to handle cases where we want to save
     // forwarded messages as drafts.  We still need to save the original message's attachments.
     if (($this->type == 'out' || $this->type == 'draft') && isset($_REQUEST['origType']) && $_REQUEST['origType'] == 'forward' && isset($_REQUEST['return_id']) && !empty($_REQUEST['return_id'])) {
         $this->getNotes($_REQUEST['return_id'], true);
     }
     // cn: bug 8034 - attachments from forward/replies lost when saving in draft
     if (isset($_REQUEST['prior_attachments']) && !empty($_REQUEST['prior_attachments']) && $this->new_with_id == true) {
         $exIds = explode(",", $_REQUEST['prior_attachments']);
         if (!isset($_REQUEST['template_attachment'])) {
             $_REQUEST['template_attachment'] = array();
         }
         $_REQUEST['template_attachment'] = array_merge($_REQUEST['template_attachment'], $exIds);
     }
     ////    END ATTACHMENTS FROM FORWARDS
     ///////////////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////////
     ////	ATTACHMENTS FROM TEMPLATES
     // to preserve individual email integrity, we must dupe Notes and associated files
     // for each outbound email - good for integrity, bad for filespace
     if (isset($_REQUEST['template_attachment']) && !empty($_REQUEST['template_attachment'])) {
         $removeArr = array();
         $noteArray = array();
         if (isset($_REQUEST['temp_remove_attachment']) && !empty($_REQUEST['temp_remove_attachment'])) {
             $removeArr = $_REQUEST['temp_remove_attachment'];
         }
         foreach ($_REQUEST['template_attachment'] as $noteId) {
             if (in_array($noteId, $removeArr)) {
                 continue;
             }
             $noteTemplate = new Note();
             $noteTemplate->retrieve($noteId);
             $noteTemplate->id = create_guid();
             $noteTemplate->new_with_id = true;
             // duplicating the note with files
             $noteTemplate->parent_id = $this->id;
             $noteTemplate->parent_type = $this->module_dir;
             $noteTemplate->date_entered = '';
             $noteTemplate->save();
             $noteFile = new UploadFile('none');
             $noteFile->duplicate_file($noteId, $noteTemplate->id, $noteTemplate->filename);
             $noteArray[] = $noteTemplate;
         }
         $this->attachments = array_merge($this->attachments, $noteArray);
     }
     ////	END ATTACHMENTS FROM TEMPLATES
     ///////////////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////////
     ////	ADDING NEW ATTACHMENTS
     $max_files_upload = 10;
     // Jenny - Bug 8211 Since attachments for drafts have already been processed,
     // we don't need to re-process them.
     if ($this->status != "draft") {
         $notes_list = array();
         if (!empty($this->id) && !$this->new_with_id) {
             $note = new Note();
             $where = "notes.parent_id='{$this->id}'";
             $notes_list = $note->get_full_list("", $where, true);
         }
         $this->attachments = array_merge($this->attachments, $notes_list);
     }
     // cn: Bug 5995 - rudimentary error checking
     $filesError = array(0 => 'UPLOAD_ERR_OK - There is no error, the file uploaded with success.', 1 => 'UPLOAD_ERR_INI_SIZE - The uploaded file exceeds the upload_max_filesize directive in php.ini.', 2 => 'UPLOAD_ERR_FORM_SIZE - The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', 3 => 'UPLOAD_ERR_PARTIAL - The uploaded file was only partially uploaded.', 4 => 'UPLOAD_ERR_NO_FILE - No file was uploaded.', 5 => 'UNKNOWN ERROR', 6 => 'UPLOAD_ERR_NO_TMP_DIR - Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.', 7 => 'UPLOAD_ERR_CANT_WRITE - Failed to write file to disk. Introduced in PHP 5.1.0.');
     for ($i = 0; $i < $max_files_upload; $i++) {
         // cn: Bug 5995 - rudimentary error checking
         if (!isset($_FILES["email_attachment{$i}"])) {
             $GLOBALS['log']->debug("Email Attachment {$i} does not exist.");
             continue;
         }
         if ($_FILES['email_attachment' . $i]['error'] != 0 && $_FILES['email_attachment' . $i]['error'] != 4) {
             $GLOBALS['log']->debug('Email Attachment could not be attach due to error: ' . $filesError[$_FILES['email_attachment' . $i]['error']]);
             continue;
         }
         $note = new Note();
         $note->parent_id = $this->id;
         $note->parent_type = $this->module_dir;
         $upload_file = new UploadFile('email_attachment' . $i);
         if (empty($upload_file)) {
             continue;
         }
         if (isset($_FILES['email_attachment' . $i]) && $upload_file->confirm_upload()) {
             $note->filename = $upload_file->get_stored_file_name();
             $note->file = $upload_file;
             $note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ' . $note->file->original_file_name;
             $this->attachments[] = $note;
//.........这里部分代码省略.........
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:101,代码来源:Email.php


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