[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Vendors/ -> Vendor.php (source)

   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 Vendor 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 Vendor() {
  62          $this->log =LoggerManager::getLogger('vendor');
  63          $this->log->debug("Entering Vendor() method ...");
  64          $this->db = new PearDatabase();
  65          $this->column_fields = getColumnFields('Vendors');
  66          $this->log->debug("Exiting Vendor method ...");
  67      }
  68  
  69      /**    function used to get the list of products which are related to the vendor
  70       *    @param int $id - vendor id
  71       *    @return array - array which will be returned from the function GetRelatedList
  72       */
  73  	function get_products($id)
  74      {
  75          global $log,$singlepane_view;
  76          $log->debug("Entering get_products(".$id.") method ...");
  77          global $app_strings;
  78          require_once ('modules/Products/Product.php');
  79          $focus = new Product();
  80  
  81          $button = '';
  82  
  83          if($singlepane_view == 'true')
  84              $returnset = '&return_module=Vendors&return_action=DetailView&return_id='.$id;
  85          else
  86              $returnset = '&return_module=Vendors&return_action=CallRelatedList&return_id='.$id;
  87  
  88          $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';
  89          $log->debug("Exiting get_products method ...");
  90          return GetRelatedList('Vendors','Products',$focus,$query,$button,$returnset);
  91      }
  92  
  93      /**    function used to get the list of purchase orders which are related to the vendor
  94       *    @param int $id - vendor id
  95       *    @return array - array which will be returned from the function GetRelatedList
  96       */
  97  	function get_purchase_orders($id)
  98      {
  99          global $log,$singlepane_view;
 100          $log->debug("Entering get_purchase_orders(".$id.") method ...");
 101          global $app_strings;
 102          require_once ('modules/PurchaseOrder/PurchaseOrder.php');
 103          $focus = new Order();
 104  
 105          $button = '';
 106  
 107          if($singlepane_view == 'true')
 108              $returnset = '&return_module=Vendors&return_action=DetailView&return_id='.$id;
 109          else
 110              $returnset = '&return_module=Vendors&return_action=CallRelatedList&return_id='.$id;
 111  
 112          $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;
 113          $log->debug("Exiting get_purchase_orders method ...");
 114          return GetRelatedList('Vendors','PurchaseOrder',$focus,$query,$button,$returnset);
 115      }
 116  
 117      /**    function used to get the list of contacts which are related to the vendor
 118       *    @param int $id - vendor id
 119       *    @return array - array which will be returned from the function GetRelatedList
 120       */
 121  	function get_contacts($id)
 122      {
 123          global $log,$singlepane_view;
 124          $log->debug("Entering get_contacts(".$id.") method ...");
 125          global $app_strings;
 126          require_once ('modules/Contacts/Contact.php');
 127          $focus = new Contact();
 128  
 129          $button = '';
 130          if($singlepane_view == 'true')
 131              $returnset = '&return_module=Vendors&return_action=DetailView&return_id='.$id;
 132          else
 133              $returnset = '&return_module=Vendors&return_action=CallRelatedList&return_id='.$id;
 134  
 135          $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;
 136          $log->debug("Exiting get_contacts method ...");
 137          return GetRelatedList('Vendors','Contacts',$focus,$query,$button,$returnset);
 138  
 139      }
 140  }
 141  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7