[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________.. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Notes/Note.php,v 1.15 2005/03/15 10:01:08 shaw Exp $ 17 * Description: TODO: To be written. 18 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 19 * All Rights Reserved. 20 * Contributor(s): ______________________________________.. 21 ********************************************************************************/ 22 23 include_once ('config.php'); 24 require_once ('include/logging.php'); 25 require_once ('include/database/PearDatabase.php'); 26 require_once ('data/SugarBean.php'); 27 require_once ('data/CRMEntity.php'); 28 require_once ('include/upload_file.php'); 29 30 // Note is used to store customer information. 31 class Note extends CRMEntity { 32 var $log; 33 var $db; 34 35 var $required_fields = array("name"=>1); 36 var $default_note_name_dom = array('Meeting vtiger_notes', 'Reminder'); 37 38 var $table_name = "notes"; 39 var $tab_name = Array('vtiger_crmentity','vtiger_notes','vtiger_senotesrel','vtiger_attachments'); 40 var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_notes'=>'notesid','vtiger_senotesrel'=>'notesid','vtiger_attachments'=>'attachmentsid'); 41 42 var $module_id = "notesid"; 43 var $object_name = "Note"; 44 45 var $column_fields = Array(); 46 47 var $sortby_fields = Array('notes_title','modifiedtime','contact_id','filename'); 48 49 // This is used to retrieve related vtiger_fields from form posts. 50 var $additional_column_fields = Array('', '', '', ''); 51 52 // This is the list of vtiger_fields that are in the lists. 53 var $list_fields = Array( 54 'Subject'=>Array('notes'=>'notes_title'), 55 'Contact Name'=>Array('notes'=>'contact_id'), 56 'Related to'=>Array('senotesrel'=>'crmid'), 57 'File'=>Array('notes'=>'filename'), 58 'Last Modified'=>Array('crmentity'=>'modifiedtime') 59 ); 60 var $list_fields_name = Array( 61 'Subject'=>'notes_title', 62 'Contact Name'=>'contact_id', 63 'Related to'=>'crmid', 64 'File'=>'filename', 65 'Last Modified'=>'modifiedtime' 66 ); 67 var $list_link_field= 'notes_title'; 68 69 //Added these variables which are used as default order by and sortorder in ListView 70 var $default_order_by = 'modifiedtime'; 71 var $default_sort_order = 'ASC'; 72 73 function Note() { 74 $this->log = LoggerManager::getLogger('notes'); 75 $this->log->debug("Entering Note() method ..."); 76 $this->db = new PearDatabase(); 77 $this->column_fields = getColumnFields('Notes'); 78 $this->log->debug("Exiting Note method ..."); 79 } 80 81 var $new_schema = true; 82 83 /** Function to export the notes in CSV Format 84 * @param reference variable - order by is passed when the query is executed 85 * @param reference variable - where condition is passed when the query is executed 86 * Returns Export Notes Query. 87 */ 88 function create_export_query(&$order_by, &$where) 89 { 90 global $log; 91 $log->debug("Entering create_export_query(".$order_by.",". $where.") method ..."); 92 93 include ("include/utils/ExportUtils.php"); 94 95 //To get the Permitted fields query and the permitted fields list 96 $sql = getPermittedFieldsQuery("Notes", "detail_view"); 97 $fields_list = getFieldsListFromQuery($sql); 98 99 $query = "SELECT $fields_list FROM vtiger_notes 100 inner join vtiger_crmentity 101 on vtiger_crmentity.crmid=vtiger_notes.notesid 102 LEFT JOIN vtiger_senotesrel 103 ON vtiger_senotesrel.notesid = vtiger_notes.notesid 104 LEFT JOIN vtiger_contactdetails 105 ON vtiger_notes.contact_id=vtiger_contactdetails.contactid 106 107 LEFT JOIN vtiger_crmentity vtiger_crmentityRelatedTo 108 ON vtiger_crmentityRelatedTo.crmid = vtiger_senotesrel.crmid 109 110 LEFT JOIN vtiger_leaddetails vtiger_NoteRelatedToLead 111 ON vtiger_NoteRelatedToLead.leadid = vtiger_senotesrel.crmid 112 LEFT JOIN vtiger_account vtiger_NoteRelatedToAccount 113 ON vtiger_NoteRelatedToAccount.accountid = vtiger_senotesrel.crmid 114 LEFT JOIN vtiger_potential vtiger_NoteRelatedToPotential 115 ON vtiger_NoteRelatedToPotential.potentialid = vtiger_senotesrel.crmid 116 LEFT JOIN vtiger_products vtiger_NoteRelatedToProduct 117 ON vtiger_NoteRelatedToProduct.productid = vtiger_senotesrel.crmid 118 LEFT JOIN vtiger_invoice vtiger_NoteRelatedToInvoice 119 ON vtiger_NoteRelatedToInvoice.invoiceid = vtiger_senotesrel.crmid 120 LEFT JOIN vtiger_purchaseorder vtiger_NoteRelatedToPO 121 ON vtiger_NoteRelatedToPO.purchaseorderid = vtiger_senotesrel.crmid 122 LEFT JOIN vtiger_salesorder vtiger_NoteRelatedToSO 123 ON vtiger_NoteRelatedToSO.salesorderid = vtiger_senotesrel.crmid 124 125 WHERE vtiger_crmentity.deleted=0 126 127 AND ((vtiger_senotesrel.crmid IS NULL 128 AND (vtiger_notes.contact_id = 0 129 OR vtiger_notes.contact_id IS NULL)) 130 OR vtiger_senotesrel.crmid IN (".getReadEntityIds('Leads').") 131 OR vtiger_senotesrel.crmid IN (".getReadEntityIds('Accounts').") 132 OR vtiger_senotesrel.crmid IN (".getReadEntityIds('Potentials').") 133 OR vtiger_senotesrel.crmid IN (".getReadEntityIds('Products').") 134 OR vtiger_senotesrel.crmid IN (".getReadEntityIds('Invoice').") 135 OR vtiger_senotesrel.crmid IN (".getReadEntityIds('PurchaseOrder').") 136 OR vtiger_senotesrel.crmid IN (".getReadEntityIds('SalesOrder').") 137 OR vtiger_notes.contact_id IN (".getReadEntityIds('Contacts').")) 138 139 "; 140 141 $log->debug("Exiting create_export_query method ..."); 142 return $query; 143 } 144 145 } 146 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |