Esempio n. 1
0
?>
</th>
						</tr>
					</thead>

					<tbody>
					<?php 
$iscrm = false;
$helper = new redhelper();
/**
 * redCRM includes
 */
if ($helper->isredCRM()) {
    if (ENABLE_ITEM_TRACKING_SYSTEM) {
        $iscrm = true;
        $crmHelper = new crmHelper();
        $crmSupplierOrderHelper = new crmSupplierOrderHelper();
        $stockWhere = USE_STOCKROOM ? " 1=1" : " stockroom_id = " . DEFAULT_STOCKROOM;
        $stockroom_list = $crmHelper->getStockroom('stockroom_id AS value,stockroom_name AS text', "1", $stockWhere);
        $stockroomname = $stockroom_list[0]->text;
        $data = new stdClass();
        $data->product_id = $this->detail->product_id;
        $data->property_id = 0;
        $data->subproperty_id = 0;
        if ($section == 'property') {
            $data->property_id = $section_id;
        } elseif ($section == 'subproperty') {
            // Get data for property id.
            $subattribute_data = $this->getAttibuteSubProperty($section_id);
            $data->property_id = $subattribute_data[0]->subattribute_id;
            $data->subproperty_id = $section_id;
Esempio n. 2
0
 /**
  * check redCRM is installed or not.
  *
  * TODO: set session variable 'isredcrmuser'
  * Set as boolean - check login user is redCRM contact person as well
  *
  * @return   boolean
  *
  * @since    1.0
  */
 public function isredCRM()
 {
     $session = JFactory::getSession();
     // Get redshop from joomla component table
     $isredCRM = $session->get('isredCRM');
     if (is_null($isredCRM) && !empty($isredCRM)) {
         $query = "SELECT extension_id FROM `#__extensions` WHERE `element` LIKE '%com_redcrm%'";
         $this->_db->setQuery($query);
         $this->_isredCRM = $this->_db->loadResult();
     }
     $redcrm_path = JPATH_ADMINISTRATOR . '/components/com_redcrm';
     if (!is_dir($redcrm_path) && !$this->_isredCRM) {
         $this->_isredCRM = false;
     } else {
         $user = JFactory::getUser();
         require_once JPATH_ADMINISTRATOR . '/components/com_redcrm/helpers/configuration.php';
         $crmConfig = new crmConfig();
         $crmConfig->config();
         require_once JPATH_ADMINISTRATOR . '/components/com_redcrm/helpers/helper.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_redcrm/helpers/debitor.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_redcrm/helpers/product.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_redcrm/helpers/supplier_order.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_redcrm/helpers/order.php';
         $crmHelper = new crmHelper();
         $session = JFactory::getSession();
         if ($crmHelper->isredCRMUser($user->id)) {
             $session->set('isredcrmuser', true);
         } else {
             $session->set('isredcrmuser', false);
         }
         $session->set('isredcrmuser_debitor', $crmHelper->isredCRMUserdebitor($user->id));
         $this->_isredCRM = true;
     }
     $session->set('isredCRM', $this->_isredCRM);
     return $this->_isredCRM;
 }
Esempio n. 3
0
 public function getShippingAddress($user_id = 0)
 {
     $helper = new redhelper();
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     // Get redCRM Contact person session array
     $isredcrmuser = $session->get('isredcrmuser', false);
     $isredcrmuser_debitor = $session->get('isredcrmuser_debitor', false);
     $app = JFactory::getApplication();
     $is_admin = $app->isAdmin();
     if ($user_id == 0) {
         $user_id = $user->id;
     }
     if ($helper->isredCRM()) {
         $crmHelper = new crmHelper();
         $crmDebitorHelper = new crmDebitorHelper();
         /*
          * function will check loign redshop user
          * is redCRM contact person or not
          *
          * @return: joomla user of redSHOP shipping user belong to contact person
          */
         $crmuserssid = 0;
         $crmusers = array();
         if ($isredcrmuser) {
             $contact_person = $crmDebitorHelper->getContactPersons(0, 0, 0, $user_id);
             $contact_person = $contact_person[0];
             $crmuserssid = $contact_person->shipping_id;
             $crmusers = $crmHelper->getShippingUserId(0, $crmuserssid);
         }
         $list = array();
         if (count($crmusers) > 0) {
             $crmusersinfo = '';
             JArrayHelper::toInteger($crmusers);
             $crmusersinfo = implode(",", $crmusers);
             $query = 'SELECT ui.*,IFNULL(destination_name,CONCAT(firstname," ",lastname)) AS text FROM ' . $this->_table_prefix . 'users_info as ui' . ' LEFT JOIN ' . $this->_table_prefix_crm . 'shipping as rcs ON rcs.users_info_id = ui.users_info_id ' . ' WHERE address_type like "ST" ' . ' AND ui.users_info_id IN (' . $crmusersinfo . ') ';
         } else {
             if (!$is_admin) {
                 $isredcrmuser_debitor = explode(',', $isredcrmuser_debitor);
                 JArrayHelper::toInteger($isredcrmuser_debitor);
                 $isredcrmuser_debitor = implode(',', $isredcrmuser_debitor);
                 $query = 'SELECT ui.*,IFNULL(destination_name,CONCAT(firstname," ",lastname)) AS text FROM ' . $this->_table_prefix . 'users_info as ui' . ' LEFT JOIN #__redcrm_shipping as rcs ON rcs.users_info_id = ui.users_info_id ' . ' WHERE address_type like "ST" AND rcs.destination_name!="" ' . ' AND rcs.debitor_id IN (' . $isredcrmuser_debitor . ') ';
             } else {
                 $query = 'SELECT ui.*,IFNULL(destination_name,CONCAT(firstname," ",lastname)) AS text FROM ' . $this->_table_prefix . 'users_info as ui' . ' LEFT JOIN #__redcrm_shipping as rcs ON rcs.users_info_id = ui.users_info_id ' . ' WHERE address_type like "ST" ' . ' AND ui.user_id  = ' . (int) $user_id;
             }
         }
         $this->_db->setQuery($query);
         $list = $this->_db->loadObjectlist();
         return $list;
     }
     $query = 'SELECT *,CONCAT(firstname," ",lastname) AS text FROM ' . $this->_table_prefix . 'users_info ' . 'WHERE address_type="ST" ' . 'AND user_id = ' . (int) $user_id;
     $this->_db->setQuery($query);
     $list = $this->_db->loadObjectlist();
     return $list;
 }