[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 12 include_once ('config.php'); 13 require_once ('include/logging.php'); 14 require_once ('include/database/PearDatabase.php'); 15 require_once ('data/SugarBean.php'); 16 require_once ('data/CRMEntity.php'); 17 require_once ('include/utils/utils.php'); 18 require_once ('include/RelatedListView.php'); 19 require_once ('user_privileges/default_module_view.php'); 20 21 class Vendors extends CRMEntity { 22 var $log; 23 var $db; 24 25 var $tab_name = Array('vtiger_crmentity','vtiger_vendor','vtiger_vendorcf'); 26 var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_vendor'=>'vendorid','vtiger_vendorcf'=>'vendorid'); 27 var $column_fields = Array(); 28 29 var $sortby_fields = Array('vendorname','category'); 30 31 // This is the list of vtiger_fields that are in the lists. 32 var $list_fields = Array( 33 'Vendor Name'=>Array('vendor'=>'vendorname'), 34 'Phone'=>Array('vendor'=>'phone'), 35 'Email'=>Array('vendor'=>'email'), 36 'Category'=>Array('vendor'=>'category') 37 ); 38 var $list_fields_name = Array( 39 'Vendor Name'=>'vendorname', 40 'Phone'=>'phone', 41 'Email'=>'email', 42 'Category'=>'category' 43 ); 44 var $list_link_field= 'vendorname'; 45 46 var $search_fields = Array( 47 'Vendor Name'=>Array('vendor'=>'vendorname'), 48 'Phone'=>Array('vendor'=>'phone') 49 ); 50 var $search_fields_name = Array( 51 'Vendor Name'=>'vendorname', 52 'Phone'=>'phone' 53 ); 54 55 //Added these variables which are used as default order by and sortorder in ListView 56 var $default_order_by = 'vendorname'; 57 var $default_sort_order = 'ASC'; 58 59 /** Constructor which will set the column_fields in this object 60 */ 61 function Vendors() { 62 $this->log =LoggerManager::getLogger('vendor'); 63 $this->log->debug("Entering Vendors() method ..."); 64 $this->db = new PearDatabase(); 65 $this->column_fields = getColumnFields('Vendors'); 66 $this->log->debug("Exiting Vendor method ..."); 67 } 68 69 function save_module($module) 70 { 71 } 72 73 /** function used to get the list of products which are related to the vendor 74 * @param int $id - vendor id 75 * @return array - array which will be returned from the function GetRelatedList 76 */ 77 function get_products($id) 78 { 79 global $log,$singlepane_view; 80 $log->debug("Entering get_products(".$id.") method ..."); 81 global $app_strings; 82 require_once ('modules/Products/Products.php'); 83 $focus = new Products(); 84 85 $button = ''; 86 87 if($singlepane_view == 'true') 88 $returnset = '&return_module=Vendors&return_action=DetailView&return_id='.$id; 89 else 90 $returnset = '&return_module=Vendors&return_action=CallRelatedList&return_id='.$id; 91 92 $query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid,vtiger_vendor.vendorname from vtiger_products inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid left outer join vtiger_vendor on vtiger_vendor.vendorid = vtiger_products.vendor_id where vtiger_vendor.vendorid = '.$id.' and vtiger_crmentity.deleted = 0'; 93 $log->debug("Exiting get_products method ..."); 94 return GetRelatedList('Vendors','Products',$focus,$query,$button,$returnset); 95 } 96 97 /** function used to get the list of purchase orders which are related to the vendor 98 * @param int $id - vendor id 99 * @return array - array which will be returned from the function GetRelatedList 100 */ 101 function get_purchase_orders($id) 102 { 103 global $log,$singlepane_view; 104 $log->debug("Entering get_purchase_orders(".$id.") method ..."); 105 global $app_strings; 106 require_once ('modules/PurchaseOrder/PurchaseOrder.php'); 107 $focus = new PurchaseOrder(); 108 109 $button = ''; 110 111 if($singlepane_view == 'true') 112 $returnset = '&return_module=Vendors&return_action=DetailView&return_id='.$id; 113 else 114 $returnset = '&return_module=Vendors&return_action=CallRelatedList&return_id='.$id; 115 116 $query = "select vtiger_users.user_name,vtiger_groups.groupname,vtiger_crmentity.*, vtiger_purchaseorder.*,vtiger_vendor.vendorname from vtiger_purchaseorder inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_purchaseorder.purchaseorderid left outer join vtiger_vendor on vtiger_purchaseorder.vendorid=vtiger_vendor.vendorid left join vtiger_pogrouprelation on vtiger_purchaseorder.purchaseorderid=vtiger_pogrouprelation.purchaseorderid left join vtiger_groups on vtiger_groups.groupname=vtiger_pogrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 and vtiger_purchaseorder.vendorid=".$id; 117 $log->debug("Exiting get_purchase_orders method ..."); 118 return GetRelatedList('Vendors','PurchaseOrder',$focus,$query,$button,$returnset); 119 } 120 121 /** function used to get the list of contacts which are related to the vendor 122 * @param int $id - vendor id 123 * @return array - array which will be returned from the function GetRelatedList 124 */ 125 function get_contacts($id) 126 { 127 global $log,$singlepane_view; 128 $log->debug("Entering get_contacts(".$id.") method ..."); 129 global $app_strings; 130 require_once ('modules/Contacts/Contacts.php'); 131 $focus = new Contacts(); 132 133 $button = ''; 134 if($singlepane_view == 'true') 135 $returnset = '&return_module=Vendors&return_action=DetailView&return_id='.$id; 136 else 137 $returnset = '&return_module=Vendors&return_action=CallRelatedList&return_id='.$id; 138 139 $query = 'SELECT vtiger_users.user_name,vtiger_groups.groupname,vtiger_contactdetails.*, vtiger_crmentity.crmid, vtiger_crmentity.smownerid,vtiger_vendorcontactrel.vendorid from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid inner join vtiger_vendorcontactrel on vtiger_vendorcontactrel.contactid=vtiger_contactdetails.contactid left join vtiger_contactgrouprelation on vtiger_contactdetails.contactid=vtiger_contactgrouprelation.contactid left join vtiger_groups on vtiger_groups.groupname=vtiger_contactgrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 and vtiger_vendorcontactrel.vendorid = '.$id; 140 $log->debug("Exiting get_contacts method ..."); 141 return GetRelatedList('Vendors','Contacts',$focus,$query,$button,$returnset); 142 143 } 144 } 145 ?>
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 |