public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     $moduleName = $request->getModule();
     $cvId = $request->get('cvid');
     $pageNumber = $request->get('page');
     $orderBy = $request->get('orderby');
     $sortOrder = $request->get('sortorder');
     $sourceModule = $request->get('src_module');
     $sourceField = $request->get('src_field');
     $sourceRecord = $request->get('src_record');
     $searchKey = $request->get('search_key');
     $searchValue = $request->get('search_value');
     if (empty($cvId)) {
         $cvId = '0';
     }
     if (empty($pageNumber)) {
         $pageNumber = '1';
     }
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $pageNumber);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName, $sourceModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
     if (empty($orderBy) && empty($sortOrder)) {
         $moduleInstance = CRMEntity::getInstance($moduleName);
         $orderBy = $moduleInstance->default_order_by;
         $sortOrder = $moduleInstance->default_sort_order;
     }
     if (!empty($orderBy)) {
         $listViewModel->set('orderby', $orderBy);
         $listViewModel->set('sortorder', $sortOrder);
     }
     if (!empty($sourceModule)) {
         $listViewModel->set('src_module', $sourceModule);
         $listViewModel->set('src_field', $sourceField);
         $listViewModel->set('src_record', $sourceRecord);
         $sourceRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
     }
     if (!empty($searchKey) && !empty($searchValue)) {
         $listViewModel->set('search_key', $searchKey);
         $listViewModel->set('search_value', $searchValue);
     }
     if (!$this->listViewHeaders) {
         $this->listViewHeaders = $listViewModel->getListViewHeaders();
     }
     if (!$this->listViewEntries) {
         $this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
     }
     //get the unit prices for the pricebooks based on the product currency
     $productUnitPrice = Vtiger_Functions::getUnitPrice($sourceRecord, $sourceModule);
     $productPriceDetails = getPriceDetailsForProduct($sourceRecord, $productUnitPrice, 'available', $sourceModule);
     $productCurrencyPrice = array();
     foreach ($productPriceDetails as $priceDetails) {
         $productCurrencyPrice[$priceDetails['curid']] = $priceDetails['curvalue'];
     }
     foreach ($this->listViewEntries as $recordId => $recordModel) {
         $recordDetails = $recordModel->getRawData();
         $priceBookCurrencyId = $recordDetails['currency_id'];
         $recordModel->set('unit_price', $productCurrencyPrice[$priceBookCurrencyId]);
     }
     $noOfEntries = count($this->listViewEntries);
     if (empty($sortOrder)) {
         $sortOrder = "ASC";
     }
     if ($sortOrder == "ASC") {
         $nextSortOrder = "DESC";
         $sortImage = "downArrowSmall.png";
     } else {
         $nextSortOrder = "ASC";
         $sortImage = "upArrowSmall.png";
     }
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('SOURCE_MODULE', $sourceModule);
     $viewer->assign('SOURCE_FIELD', $sourceField);
     $viewer->assign('SOURCE_RECORD', $sourceRecord);
     $viewer->assign('SOURCE_RECORD_MODEL', $sourceRecordModel);
     //PARENT_MODULE is used for only translations
     $viewer->assign('PARENT_MODULE', 'PriceBooks');
     $viewer->assign('SEARCH_KEY', $searchKey);
     $viewer->assign('SEARCH_VALUE', $searchValue);
     $viewer->assign('ORDER_BY', $orderBy);
     $viewer->assign('SORT_ORDER', $sortOrder);
     $viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
     $viewer->assign('SORT_IMAGE', $sortImage);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('PAGING_MODEL', $pagingModel);
     $viewer->assign('PAGE_NUMBER', $pageNumber);
     $viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
     $viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
     $viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
     $viewer->assign('VIEW', 'ProductPriceBookPopup');
 }
Пример #2
0
if ($retrieve_taxes) {
    for ($i = 0; $i < count($tax_details); $i++) {
        $tax_value = getProductTaxPercentage($tax_details[$i]['taxname'], $productid);
        $tax_details[$i]['percentage'] = $tax_value;
        $tax_details[$i]['check_value'] = 1;
        //if the tax is not associated with the product then we should get the default value and unchecked
        if ($tax_value == '') {
            $tax_details[$i]['check_value'] = 0;
            $tax_details[$i]['percentage'] = getTaxPercentage($tax_details[$i]['taxname']);
        }
    }
}
$smarty->assign("TAX_DETAILS", $tax_details);
//Tax handling - ends
$unit_price = $focus->column_fields['unit_price'];
$price_details = getPriceDetailsForProduct($productid, $unit_price, 'available', $currentModule);
$smarty->assign("PRICE_DETAILS", $price_details);
$base_currency = 'curname' . $product_base_currency;
$smarty->assign("BASE_CURRENCY", $base_currency);
if (isset($focus->id) && $_REQUEST['isDuplicate'] != 'true') {
    $is_parent = $focus->isparent_check();
} else {
    $is_parent = 0;
}
$smarty->assign("IS_PARENT", $is_parent);
if ($_REQUEST['return_module'] == 'Products' && isset($_REQUEST['return_action'])) {
    $return_name = getProductName($_REQUEST['return_id']);
    $smarty->assign("RETURN_NAME", $return_name);
}
if ($errormessage == 2) {
    $msg = $mod_strings['LBL_MAXIMUM_LIMIT_ERROR'];
Пример #3
0
$smarty->assign('UPDATEINFO', updateInfo($focus->id));
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if ($mod_seq_field != null) {
    $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
} else {
    $mod_seq_id = $focus->id;
}
$smarty->assign('MOD_SEQ_ID', $mod_seq_id);
//Added to display the Tax informations
$tax_details = getTaxDetailsForProduct($focus->id);
for ($i = 0; $i < count($tax_details); $i++) {
    $tax_details[$i]['percentage'] = getProductTaxPercentage($tax_details[$i]['taxname'], $focus->id);
}
$smarty->assign("TAX_DETAILS", $tax_details);
$price_details = getPriceDetailsForProduct($focus->id, $focus->unit_price, 'available_associated', $currentModule);
$smarty->assign('PRICE_DETAILS', $price_details);
$validationArray = split_validationdataArray(getDBValidationData($focus->tab_name, $tabid));
$smarty->assign('VALIDATION_DATA_FIELDNAME', $validationArray['fieldname']);
$smarty->assign('VALIDATION_DATA_FIELDDATATYPE', $validationArray['datatype']);
$smarty->assign('VALIDATION_DATA_FIELDLABEL', $validationArray['fieldlabel']);
$smarty->assign('EDIT_PERMISSION', isPermitted($currentModule, 'EditView', $record));
$smarty->assign('CHECK', $tool_buttons);
if (PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule . '_listquery'])) {
    $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
    VT_detailViewNavigation($smarty, $recordNavigationInfo, $focus->id);
}
$smarty->assign('IS_REL_LIST', isPresentRelatedLists($currentModule));
$smarty->assign('SinglePane_View', $singlepane_view);
if ($singlepane_view == 'true') {
    $related_array = getRelatedLists($currentModule, $focus);
$list_query = getListQuery("PriceBooks");
$list_query .= ' and vtiger_pricebook.active<>0  ORDER BY pricebookid DESC ';
$list_result = $adb->query($list_query);
$num_rows = $adb->num_rows($list_result);
$record_string = "Total No of PriceBooks : " . $num_rows;
//Retreiving the array of already releated products
$sql1 = "select vtiger_crmentity.crmid, vtiger_pricebookproductrel.pricebookid,vtiger_products.unit_price \n\t\t\tfrom vtiger_pricebookproductrel inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_pricebookproductrel.productid \n\t\t\tinner join vtiger_products on vtiger_products.productid=vtiger_pricebookproductrel.productid \t\t\n\t\t\twhere vtiger_crmentity.deleted=0 and vtiger_pricebookproductrel.productid=?";
$res1 = $adb->pquery($sql1, array($productid));
$num_prod_rows = $adb->num_rows($res1);
$pbk_array = array();
for ($i = 0; $i < $num_prod_rows; $i++) {
    $pbkid = $adb->query_result($res1, $i, "pricebookid");
    $pbk_array[$pbkid] = $pbkid;
}
$pro_unit_price = getUnitPrice($productid, $currentModule);
$prod_price_details = getPriceDetailsForProduct($productid, $pro_unit_price);
$prod_cur_price = array();
for ($i = 0; $i < count($prod_price_details); $i++) {
    $prod_cur_info = $prod_price_details[$i];
    $prod_cur_price[$prod_cur_info['curid']] = $prod_cur_info['curvalue'];
}
$unit_price_array = array();
$field_name_array = array();
$other_text = '
	<table border="0" cellpadding="1" cellspacing="0" width="90%" align="center">
	<form name="addToPB" method="POST" id="addToPB">
	   <tr>
		<td align="center">&nbsp;
			<input name="product_id" type="hidden" value="' . $productid . '">
			<input name="idlist" type="hidden">
			<input name="viewname" type="hidden">';
Пример #5
0
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$smarty = new vtigerCRM_Smarty();
$qcreate_array = QuickCreate("{$module}");
$validationData = $qcreate_array['data'];
$data = split_validationdataArray($validationData);
$smarty->assign("QUICKCREATE", $qcreate_array['form']);
$smarty->assign("THEME", $theme);
$smarty->assign("APP", $app_strings);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("ACTIVITY_MODE", vtlib_purify($_REQUEST['activity_mode']));
$smarty->assign("FROM", vtlib_purify($_REQUEST['from']));
$smarty->assign("URLPOPUP", str_replace('-a;', '&', $_REQUEST['pop']));
$smarty->assign("QCMODULE", getTranslatedString("SINGLE_" . $currentModule, $currentModule));
$smarty->assign("USERID", $current_user->id);
$smarty->assign("VALIDATION_DATA_FIELDNAME", $data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE", $data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL", $data['fieldlabel']);
$smarty->assign("MODULE", $currentModule);
$smarty->assign("CATEGORY", $category);
//Start - Add multi currency
$product_base_currency = fetchCurrency($current_user->id);
$price_details = getPriceDetailsForProduct('', '', 'available', $currentModule);
$smarty->assign("PRICE_DETAILS", $price_details);
$base_currency = 'curname' . $product_base_currency;
$smarty->assign("BASE_CURRENCY", $base_currency);
//End - add multi currency
$smarty->display("QuickCreate.tpl");
Пример #6
0
 /**
  * Function to get price details
  * @return <Array> List of prices
  */
 public function getPriceDetails()
 {
     $priceDetails = $this->get('priceDetails');
     if (!empty($priceDetails)) {
         return $priceDetails;
     }
     $priceDetails = getPriceDetailsForProduct($this->getId(), $this->get('unit_price'), 'available', $this->getModuleName());
     $this->set('priceDetails', $priceDetails);
     return $priceDetails;
 }