更新到 5.2 正式版后第一次 SVN 提交。

yuchenghu@hawebs.net


git-svn-id: https://svn.code.sf.net/p/hawebs/svn@631 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-11-17 01:20:29 +00:00
parent 4d16fc224b
commit 479df644a8
22 changed files with 1517 additions and 0 deletions
@@ -0,0 +1,90 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('Smarty_setup.php');
//Redirecting Header for single page layout
require_once('user_privileges/default_module_view.php');
global $singlepane_view;
$currentmodule = vtlib_purify($_REQUEST['module']);
$RECORD = vtlib_purify($_REQUEST['record']);
$category = getParentTab();
if($singlepane_view == 'true' && $_REQUEST['action'] == 'CallRelatedList' ) {
header("Location:index.php?action=DetailView&module=$currentmodule&record=$RECORD&parenttab=$category");
} else {
$focus = CRMEntity::getInstance($currentmodule);
if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {
$focus->retrieve_entity_info($RECORD,$currentmodule);
$focus->id = $RECORD;
$focus->name=$focus->column_fields['bookname'];
$log->debug("PriceBook id =".$focus->id);
$log->debug("PriceBook Name =".$focus->name);
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
$related_array=getRelatedLists($currentModule,$focus);
global $mod_strings;
global $app_strings;
global $theme, $currentModule;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
if(isset($focus->name))
$smarty->assign("NAME", $focus->name);
$smarty->assign("CATEGORY",$category);
if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
$smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode']));
}
$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
$smarty->assign("ID",$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);
// END
$smarty->assign("CURRENCY_ID",$focus->column_fields['currency_id']);
$smarty->assign("MODULE",$currentmodule);
$smarty->assign("RELATEDLISTS", $related_array);
require_once('include/ListView/RelatedListViewSession.php');
if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
$relationId = vtlib_purify($_REQUEST['relation_id']);
RelatedListViewSession::addRelatedModuleToSession($relationId,
vtlib_purify($_REQUEST['selected_header']));
}
$open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
$smarty->assign("SELECTEDHEADERS", $open_related_modules);
$smarty->assign("SINGLE_MOD",$app_strings['PriceBook']);
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
$smarty->assign("MOD",$mod_strings);
$smarty->assign("APP",$app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
$smarty->display("RelatedListContents.tpl");
else
$smarty->display("RelatedLists.tpl");
}
?>
@@ -0,0 +1,14 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
include('modules/CustomView/index.php');
?>
@@ -0,0 +1,51 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header$
* Description: Deletes an Account record and then redirects the browser to the
* defined return URL.
********************************************************************************/
require_once('modules/PriceBooks/PriceBooks.php');
global $mod_strings;
require_once('include/logging.php');
$log = LoggerManager::getLogger('product_delete');
$focus = new PriceBooks();
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if(!isset($_REQUEST['record']))
die($mod_strings['ERR_DELETE_RECORD']);
//Added to delete the pricebook from Product related list
if($_REQUEST['record'] != '' && $_REQUEST['return_id'] != '' && $_REQUEST['module'] == 'PriceBooks'
&& ($_REQUEST['return_module'] == 'Products' || $_REQUEST['return_module'] == 'Services'))
{
$pricebookid = $_REQUEST['record'];
$productid = $_REQUEST['return_id'];
$adb->pquery("delete from vtiger_pricebookproductrel where pricebookid=? and productid=?", array($pricebookid, $productid));
}
if($_REQUEST['module'] == $_REQUEST['return_module'])
$focus->mark_deleted($_REQUEST['record']);
$parenttab = getParentTab();
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action'])."&record=".vtlib_purify($_REQUEST['return_id'])."&parenttab=$parenttab$url");
?>
@@ -0,0 +1,122 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('Smarty_setup.php');
require_once('include/utils/utils.php');
require_once('user_privileges/default_module_view.php');
$focus = CRMEntity::getInstance($currentModule);
if(isset($_REQUEST['record']) && isset($_REQUEST['record']))
{
$focus->retrieve_entity_info($_REQUEST['record'],"PriceBooks");
$focus->id = $_REQUEST['record'];
$focus->name = $focus->column_fields['bookname'];
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
{
$focus->id = "";
}
global $app_strings,$mod_strings,$theme,$currentModule,$singlepane_view;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields));
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$smarty->assign("CUSTOMFIELD", $cust_fld);
if(isPermitted("PriceBooks","PriceBookEditView",$_REQUEST['record']) == 'yes')
$smarty->assign("EDIT_DUPLICATE","permitted");
if(isPermitted("PriceBooks","DeletePriceBook",$_REQUEST['record']) == 'yes')
$smarty->assign("DELETE","permitted");
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$smarty->assign("ID", vtlib_purify($_REQUEST['record']));
// 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);
// END
$smarty->assign("NAME", $focus->name);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$tabid = getTabid("PriceBooks");
$validationData = getDBValidationData($focus->tab_name,$tabid);
$data = split_validationdataArray($validationData);
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$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("SINGLE_MOD", 'PriceBook');
$smarty->assign("CURRENCY_ID",$focus->column_fields['currency_id']);
$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record']));
if($singlepane_view == 'true')
{
$related_array = getRelatedLists($currentModule,$focus);
$smarty->assign("RELATEDLISTS", $related_array);
require_once('include/ListView/RelatedListViewSession.php');
if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']),
vtlib_purify($_REQUEST['selected_header']));
}
$open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
$smarty->assign("SELECTEDHEADERS", $open_related_modules);
}
$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule));
$smarty->assign("SinglePane_View", $singlepane_view);
if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){
$recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id);
}
// Record Change Notification
$focus->markAsViewed($current_user->id);
// END
// Gather the custom link information to display
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE'=>$currentModule, 'RECORD'=>$focus->id, 'ACTION'=>vtlib_purify($_REQUEST['action']));
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('DETAILVIEWBASIC','DETAILVIEW','DETAILVIEWWIDGET'), $customlink_params));
// END
$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true));
$smarty->display("Inventory/InventoryDetailView.tpl");
?>
@@ -0,0 +1,48 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
require_once('include/logging.php');
require_once('modules/PriceBooks/PriceBooks.php');
require_once('include/database/PearDatabase.php');
global $adb;
$local_log =& LoggerManager::getLogger('PriceBooksAjax');
global $currentModule;
$modObj = CRMEntity::getInstance($currentModule);
$ajaxaction = $_REQUEST["ajxaction"];
if($ajaxaction == "DETAILVIEW")
{
$crmid = $_REQUEST["recordid"];
$tablename = $_REQUEST["tableName"];
$fieldname = $_REQUEST["fldName"];
$fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);
if($crmid != "")
{
$modObj->retrieve_entity_info($crmid,"PriceBooks");
$modObj->column_fields[$fieldname] = $fieldvalue;
$modObj->id = $crmid;
$modObj->mode = "edit";
$modObj->save("PriceBooks");
if($modObj->id != "")
{
echo ":#:SUCCESS";
}else
{
echo ":#:FAILURE";
}
}else
{
echo ":#:FAILURE";
}
} elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE"){
require_once 'include/ListView/RelatedListViewContents.php';
}
?>
@@ -0,0 +1,125 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('Smarty_setup.php');
require_once('include/utils/utils.php');
global $app_strings,$mod_strings,$theme,$currentModule;
$focus = CRMEntity::getInstance($currentModule);
$smarty = new vtigerCRM_Smarty();
//added to fix the issue4600
$searchurl = getBasic_Advance_SearchURL();
$smarty->assign("SEARCH", $searchurl);
//4600 ends
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '')
{
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->retrieve_entity_info($_REQUEST['record'],"PriceBooks");
$focus->name = $focus->column_fields['bookname'];
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
{
$focus->id = "";
$focus->mode = '';
}
if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
setObjectValuesFromRequest($focus);
}
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$disp_view = getView($focus->mode);
if($disp_view == 'edit_view')
$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
else
{
$bas_block = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'BAS');
$blocks['basicTab'] = $bas_block;
$smarty->assign("BLOCKS",$blocks);
$smarty->assign("BLOCKS_COUNT",count($blocks));
}
$smarty->assign("OP_MODE",$disp_view);
$smarty->assign("MODULE",$currentModule);
$smarty->assign("SINGLE_MOD",'PriceBook');
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
if(isset($cust_fld))
{
$smarty->assign("CUSTOMFIELD", $cust_fld);
}
$smarty->assign("ID", $focus->id);
if(isset($focus->name))
$smarty->assign("NAME", $focus->name);
$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
if($focus->mode == 'edit')
{
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
$smarty->assign("MODE", $focus->mode);
}
if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id']));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$tabid = getTabid("PriceBooks");
$validationData = getDBValidationData($focus->tab_name,$tabid);
$data = split_validationdataArray($validationData);
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
// Added to set price book active when creating a new pricebook
if($focus->mode != 'edit' && $_REQUEST['isDuplicate'] != 'true')
$smarty->assign('PRICE_BOOK_MODE', 'create');
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate']));
global $adb;
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if($focus->mode != 'edit' && $mod_seq_field != null) {
$autostr = getTranslatedString('MSG_AUTO_GEN_ON_SAVE');
$mod_seq_string = $adb->pquery("SELECT prefix, cur_id from vtiger_modentity_num where semodule = ? and active=1",array($currentModule));
$mod_seq_prefix = $adb->query_result($mod_seq_string,0,'prefix');
$mod_seq_no = $adb->query_result($mod_seq_string,0,'cur_id');
if($adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix.$mod_seq_no))
echo '<br><font color="#FF0000"><b>'. getTranslatedString('LBL_DUPLICATE'). ' '. getTranslatedString($mod_seq_field['label'])
.' - '. getTranslatedString('LBL_CLICK') .' <a href="index.php?module=Settings&action=CustomModEntityNo&parenttab=Settings&selmodule='.$currentModule.'">'.getTranslatedString('LBL_HERE').'</a> '
. getTranslatedString('LBL_TO_CONFIGURE'). ' '. getTranslatedString($mod_seq_field['label']) .'</b></font>';
else
$smarty->assign("MOD_SEQ_ID",$autostr);
} else {
$smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
}
// END
if($focus->mode == 'edit')
$smarty->display('Inventory/InventoryEditView.tpl');
else
$smarty->display('Inventory/InventoryCreateView.tpl');
?>
@@ -0,0 +1,196 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('Smarty_setup.php');
require_once('modules/PriceBooks/PriceBooks.php');
require_once('include/ListView/ListView.php');
require_once('include/utils/utils.php');
require_once('modules/CustomView/CustomView.php');
require_once('include/database/Postgres8.php');
global $app_strings,$mod_strings,$list_max_entries_per_page,$currentModule,$theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("MODULE",$currentModule);
$smarty->assign("SINGLE_MOD",'PriceBook');
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$focus = new PriceBooks();
// Initialize sort by fields
$focus->initSortbyField('PriceBooks');
// END
$other_text=Array();
if(!$_SESSION['lvs'][$currentModule])
{
unset($_SESSION['lvs']);
$modObj = new ListViewSession();
$modObj->sorder = $sorder;
$modObj->sortby = $order_by;
$_SESSION['lvs'][$currentModule] = get_object_vars($modObj);
}
if($_REQUEST['errormsg'] != '')
{
$errormsg = vtlib_purify($_REQUEST['errormsg']);
$smarty->assign("ERROR","The User does not have permission to delete ".$errormsg." ".$currentModule);
}else
{
$smarty->assign("ERROR","");
}
if (!isset($where)) $where = "";
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
$sorder = $focus->getSortOrder();
$order_by = $focus->getOrderBy();
$_SESSION['PRICEBOOK_ORDER_BY'] = $order_by;
$_SESSION['PRICEBOOK_SORT_ORDER'] = $sorder;
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
//<<<<cutomview>>>>>>>
$oCustomView = new CustomView("PriceBooks");
$viewid = $oCustomView->getViewId($currentModule);
$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
//Added to handle approving or denying status-public by the admin in CustomView
$statusdetails = $oCustomView->isPermittedChangeStatus($viewnamedesc['status']);
$smarty->assign("CUSTOMVIEW_PERMISSION",$statusdetails);
//To check if a user is able to edit/delete a customview
$edit_permit = $oCustomView->isPermittedCustomView($viewid,'EditView',$currentModule);
$delete_permit = $oCustomView->isPermittedCustomView($viewid,'Delete',$currentModule);
$smarty->assign("CV_EDIT_PERMIT",$edit_permit);
$smarty->assign("CV_DELETE_PERMIT",$delete_permit);
//<<<<<customview>>>>>
if(isPermitted('PriceBooks','DeletePriceBook','') == 'yes')
$other_text['del'] = $app_strings[LBL_MASS_DELETE];
if(isPermitted('PriceBooks','EditView','') == 'yes')
$other_text['mass_edit'] = $app_strings[LBL_MASS_EDIT];
if($viewnamedesc['viewname'] == 'All')
{
$smarty->assign("ALL", 'All');
}
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
global $current_user;
$queryGenerator = new QueryGenerator($currentModule, $current_user);
if ($viewid != "0") {
$queryGenerator->initForCustomViewById($viewid);
} else {
$queryGenerator->initForDefaultCustomView();
}
//<<<<<<<<customview>>>>>>>>>
// Enabling Module Search
$url_string = '';
if($_REQUEST['query'] == 'true') {
$queryGenerator->addUserSearchConditions($_REQUEST);
$ustring = getSearchURL($_REQUEST);
$url_string .= "&query=true$ustring";
$smarty->assign('SEARCH_URL', $url_string);
}
$list_query = $queryGenerator->getQuery();
if(isset($order_by) && $order_by != '')
{
$tablename = getTableNameForField('PriceBooks',$order_by);
$tablename = (($tablename != '')?($tablename."."):'');
if( $adb->dbType == "pgsql")
$list_query .= ' GROUP BY '.$tablename.$order_by;
$list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
}
///Postgres 8 fixes
if( $adb->dbType == "pgsql")
$list_query = fixPostgresQuery( $list_query, $log, 0);
if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
$count_result = $adb->query( mkCountQuery( $list_query));
$noofrows = $adb->query_result($count_result,0,"count");
}else{
$noofrows = null;
}
$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true');
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
$navigation_array = VT_getSimpleNavigationValues($start,$list_max_entries_per_page,$noofrows);
$limit_start_rec = ($start-1) * $list_max_entries_per_page;
if( $adb->dbType == "pgsql")
$list_result = $adb->pquery($list_query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array());
else
$list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array());
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows);
$smarty->assign('recordListRange',$recordListRangeMsg);
//Retreive the List View Table Header
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$listview_header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder,
$order_by);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = $controller->getBasicSearchFieldInfoList();
$smarty->assign("SEARCHLISTHEADER",$listview_header_search);
$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result,
$navigation_array);
$smarty->assign("LISTENTITY", $listview_entries);
//Added to select Multiple records in multiple pages
$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries),";"));
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"PriceBooks","index",$viewid);
$alphabetical = AlphabeticalSearch($currentModule,'index','bookname','true','basic',"","","","",$viewid);
$fieldnames = $controller->getAdvancedSearchOptionString();
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
$smarty->assign("ALPHABETICAL", $alphabetical);
$smarty->assign("NAVIGATION", $navigationOutput);
$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
$smarty->assign("VIEWID", $viewid);
$smarty->assign("SELECT_SCRIPT", $view_script);
$smarty->assign("BUTTONS", $other_text);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
ListViewSession::setSessionQuery($currentModule,$list_query,$viewid);
// Gather the custom link information to display
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE'=>$currentModule, 'ACTION'=>vtlib_purify($_REQUEST['action']), 'CATEGORY'=> $category);
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('LISTVIEWBASIC','LISTVIEW'), $customlink_params));
// END
if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
$smarty->display("ListViewEntries.tpl");
else
$smarty->display("ListView.tpl");
?>
@@ -0,0 +1,11 @@
<?php
/*+*******************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
require_once 'include/ListView/ListViewPagging.php';
?>
@@ -0,0 +1,45 @@
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
global $mod_strings,$app_strings,$theme,$currentModule,$current_user;
require_once('Smarty_setup.php');
require_once('include/utils/utils.php');
$focus = CRMEntity::getInstance($currentModule);
$focus->mode = '';
$mode = 'mass_edit';
$disp_view = getView($focus->mode);
$smarty = new vtigerCRM_Smarty;
$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
$smarty->assign("IDS",$_REQUEST['idstring']);
$smarty->assign("MASS_EDIT","1");
$smarty->assign("MODULE",$currentModule);
$smarty->assign("APP",$app_strings);
$smarty->assign("CATEGORY",getParentTab());
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
// Field Validation Information
$tabid = getTabid($currentModule);
$validationData = getDBValidationData($focus->tab_name,$tabid);
$validationArray = split_validationdataArray($validationData);
$smarty->assign("VALIDATION_DATA_FIELDNAME",$validationArray['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$validationArray['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$validationArray['fieldlabel']);
$smarty->display('MassEditForm.tpl');
?>
@@ -0,0 +1,67 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
global $currentModule;
$focus = CRMEntity::getInstance($currentModule);
$idlist= vtlib_purify($_REQUEST['massedit_recordids']);
$viewid = vtlib_purify($_REQUEST['viewname']);
$return_module = vtlib_purify($_REQUEST['massedit_module']);
$return_action = 'index';
global $rstart;
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if(isset($_REQUEST['start']) && $_REQUEST['start']!=''){
$rstart = "&start=".vtlib_purify($_REQUEST['start']);
}
if(isset($idlist)) {
$recordids = explode(';', $idlist);
for($index = 0; $index < count($recordids); ++$index) {
$recordid = $recordids[$index];
if($recordid == '') continue;
if(isPermitted($currentModule,'EditView',$recordid) == 'yes') {
// Save each module record with update value.
$focus->retrieve_entity_info($recordid, $currentModule);
$focus->mode = 'edit';
$focus->id = $recordid;
foreach($focus->column_fields as $fieldname => $val)
{
if(isset($_REQUEST[$fieldname."_mass_edit_check"]))
{
if($fieldname == 'assigned_user_id'){
if($_REQUEST['assigntype'] == 'U') {
$value = $_REQUEST['assigned_user_id'];
} elseif($_REQUEST['assigntype'] == 'T') {
$value = $_REQUEST['assigned_group_id'];
}
} else {
if(is_array($_REQUEST[$fieldname]))
$value = $_REQUEST[$fieldname];
else
$value = trim($_REQUEST[$fieldname]);
}
$focus->column_fields[$fieldname] = $value;
}
else{
$focus->column_fields[$fieldname] = decode_html($focus->column_fields[$fieldname]);
}
}
$focus->save($currentModule);
}
}
}
$parenttab = getParentTab();
header("Location: index.php?module=$return_module&action=$return_action&parenttab=$parenttab$rstart");
?>
@@ -0,0 +1,13 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('Popup.php');
?>
@@ -0,0 +1,192 @@
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
prod_array = new Array();
function addtopricebook()
{
x = document.addToPB.selected_id.length;
prod_array = new Array(x);
idstring = "";
if ( x == undefined)
{
if (document.addToPB.selected_id.checked)
{
yy = document.addToPB.selected_id.value+"_listprice";
document.addToPB.idlist.value=document.addToPB.selected_id.value;
var elem = document.addToPB.elements;
var ele_len =elem.length;
var i=0,j=0;
for(i=0; i<ele_len; i++)
{
if(elem[i].name == yy)
{
if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0)
{
alert(alert_arr.LISTPRICE_CANNOT_BE_EMPTY);
return false;
}
else if(isNaN(elem[i].value))
{
alert(alert_arr.INVALID_LIST_PRICE);
return false;
}
}
}
}
else
{
alert(alert_arr.SELECT);
return false;
}
}
else
{
xx = 0;
for(i = 0; i < x ; i++)
{
if(document.addToPB.selected_id[i].checked)
{
idstring = document.addToPB.selected_id[i].value +";"+idstring;
prod_array[xx] = document.addToPB.selected_id[i].value;
xx++;
}
}
if (xx != 0)
{
document.addToPB.idlist.value=idstring;
var elem = document.addToPB.elements;
var ele_len =elem.length;
var i=0,j=0;
for(i=0; i<ele_len; i++)
{
for(j=0; j < xx; j++)
{
var xy= prod_array[j]+"_listprice";
if(elem[i].name == xy)
{
if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0)
{
alert(alert_arr.LISTPRICE_CANNOT_BE_EMPTY);
return false;
}
else if(isNaN(elem[i].value) || elem[i].value < 0)
{
alert(alert_arr.INVALID_LIST_PRICE);
return false;
}
}
}
}
}
else
{
alert(alert_arr.SELECT);
return false;
}
}
document.addToPB.action="index.php?module=Products&action=addPbProductRelToDB&return_module=Products&return_action=AddProductsToPriceBook&parenttab="+parenttab;
}
function updateListPrice(unitprice,fieldname,oSelect)
{
if(oSelect.checked == true)
{
document.getElementById(fieldname).style.visibility = 'visible';
document.getElementById(fieldname).value = unitprice;
}else
{
document.getElementById(fieldname).style.visibility = 'hidden';
}
}
function check4null(form)
{
var isError = false;
var errorMessage = "";
if (trim(form.productname.value) =='')
{
isError = true;
errorMessage += "\n Product Name";
form.productname.focus();
}
if (isError == true)
{
alert(alert_arr.MISSING_REQUIRED_FIELDS + errorMessage);
return false;
}
return true;
}
function set_return_specific(vendor_id, vendor_name)
{
//getOpenerObj used for DetailView
var fldName = getOpenerObj("vendor_name");
var fldId = getOpenerObj("vendor_id");
fldName.value = vendor_name;
fldId.value = vendor_id;
}
function set_return_inventory_pb(listprice, fldname)
{
window.opener.document.EditView.elements[fldname].value = listprice;
window.opener.document.EditView.elements[fldname].focus();
}
function deletePriceBookProductRel(id,pbid)
{
$("status").style.display="inline";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: 'module=Products&action=ProductsAjax&file=DeletePriceBookProductRel&ajax=true&return_action=CallRelatedList&return_module=PriceBooks&record='+id+'&pricebook_id='+pbid+'&return_id='+pbid,
onComplete: function(response) {
$("status").style.display="none";
$("RLContents").update(response.responseText);
}
}
);
}
function verify_data()
{
var returnValue = true;
var list_price = $('list_price');
if(list_price.value != '' && list_price.value != 0)
{
intval= intValidate('list_price','EditListPrice');
if(!intval)
{
returnValue = false;
}
}
else
{
if(list_price.value == '')
{
alert(alert_arr.LISTPRICE_CANNOT_BE_EMPTY);
returnValue = false;
}
}
return returnValue;
}
@@ -0,0 +1,318 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
include_once('config.php');
require_once('include/logging.php');
require_once('data/SugarBean.php');
require_once('include/utils/utils.php');
require_once('user_privileges/default_module_view.php');
class PriceBooks extends CRMEntity {
var $log;
var $db;
var $table_name = "vtiger_pricebook";
var $table_index= 'pricebookid';
var $tab_name = Array('vtiger_crmentity','vtiger_pricebook','vtiger_pricebookcf');
var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_pricebook'=>'pricebookid','vtiger_pricebookcf'=>'pricebookid');
/**
* Mandatory table for supporting custom fields.
*/
var $customFieldTable = Array('vtiger_pricebookcf', 'pricebookid');
var $column_fields = Array();
var $sortby_fields = Array('bookname');
// This is the list of fields that are in the lists.
var $list_fields = Array(
'Price Book Name'=>Array('pricebook'=>'bookname'),
'Active'=>Array('pricebook'=>'active')
);
var $list_fields_name = Array(
'Price Book Name'=>'bookname',
'Active'=>'active'
);
var $list_link_field= 'bookname';
var $search_fields = Array(
'Price Book Name'=>Array('pricebook'=>'bookname')
);
var $search_fields_name = Array(
'Price Book Name'=>'bookname',
);
//Added these variables which are used as default order by and sortorder in ListView
var $default_order_by = 'bookname';
var $default_sort_order = 'ASC';
var $mandatory_fields = Array('bookname','currency_id','pricebook_no','createdtime' ,'modifiedtime');
/** Constructor which will set the column_fields in this object
*/
function PriceBooks() {
$this->log =LoggerManager::getLogger('pricebook');
$this->log->debug("Entering PriceBooks() method ...");
$this->db = PearDatabase::getInstance();
$this->column_fields = getColumnFields('PriceBooks');
$this->log->debug("Exiting PriceBook method ...");
}
function save_module($module)
{
// Update the list prices in the price book with the unit price, if the Currency has been changed
$this->updateListPrices();
}
/* Function to Update the List prices for all the products of a current price book
with its Unit price, if the Currency for Price book has changed. */
function updateListPrices() {
global $log, $adb;
$log->debug("Entering function updateListPrices...");
$pricebook_currency = $this->column_fields['currency_id'];
$prod_res = $adb->pquery("select * from vtiger_pricebookproductrel where pricebookid=? AND usedcurrency != ?",
array($this->id, $pricebook_currency));
$numRows = $adb->num_rows($prod_res);
for($i=0;$i<$numRows;$i++) {
$product_id = $adb->query_result($prod_res,$i,'productid');
$list_price = $adb->query_result($prod_res,$i,'listprice');
$used_currency = $adb->query_result($prod_res,$i,'usedcurrency');
$product_currency_info = getCurrencySymbolandCRate($used_currency);
$product_conv_rate = $product_currency_info['rate'];
$pricebook_currency_info = getCurrencySymbolandCRate($pricebook_currency);
$pb_conv_rate = $pricebook_currency_info['rate'];
$conversion_rate = $pb_conv_rate / $product_conv_rate;
$computed_list_price = $list_price * $conversion_rate;
$query = "update vtiger_pricebookproductrel set listprice=?, usedcurrency=? where pricebookid=? and productid=?";
$params = array($computed_list_price, $pricebook_currency, $this->id, $product_id);
$adb->pquery($query, $params);
}
$log->debug("Exiting function updateListPrices...");
}
/** Function used to get the sort order for PriceBook listview
* @return string $sorder - first check the $_REQUEST['sorder'] if request value is empty then check in the $_SESSION['PRICEBOOK_SORT_ORDER'] if this session value is empty then default sort order will be returned.
*/
function getSortOrder()
{
global $log;
$log->debug("Entering getSortOrder() method ...");
if(isset($_REQUEST['sorder']))
$sorder = $this->db->sql_escape_string($_REQUEST['sorder']);
else
$sorder = (($_SESSION['PRICEBOOK_SORT_ORDER'] != '')?($_SESSION['PRICEBOOK_SORT_ORDER']):($this->default_sort_order));
$log->debug("Exiting getSortOrder() method ...");
return $sorder;
}
/** Function used to get the order by value for PriceBook listview
* @return string $order_by - first check the $_REQUEST['order_by'] if request value is empty then check in the $_SESSION['PRICEBOOK_ORDER_BY'] if this session value is empty then default order by will be returned.
*/
function getOrderBy()
{
global $log;
$log->debug("Entering getOrderBy() method ...");
$use_default_order_by = '';
if(PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
$use_default_order_by = $this->default_order_by;
}
if (isset($_REQUEST['order_by']))
$order_by = $this->db->sql_escape_string($_REQUEST['order_by']);
else
$order_by = (($_SESSION['PRICEBOOK_ORDER_BY'] != '')?($_SESSION['PRICEBOOK_ORDER_BY']):($use_default_order_by));
$log->debug("Exiting getOrderBy method ...");
return $order_by;
}
/** function used to get the products which are related to the pricebook
* @param int $id - pricebook id
* @return array - return an array which will be returned from the function getPriceBookRelatedProducts
**/
function get_pricebook_products($id, $cur_tab_id, $rel_tab_id, $actions=false) {
global $log, $singlepane_view,$currentModule,$current_user;
$log->debug("Entering get_pricebook_products(".$id.") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once("modules/$related_module/$related_module.php");
$other = new $related_module();
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if($singlepane_view == 'true')
$returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
else
$returnset = '&return_module='.$this_module.'&return_action=CallRelatedList&return_id='.$id;
$button = '';
if($actions) {
if(is_string($actions)) $actions = explode(',', strtoupper($actions));
if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') {
$button .= "<input title='".getTranslatedString('LBL_SELECT')." ". getTranslatedString($related_module). "' class='crmbutton small edit' type='submit' name='button' onclick=\"this.form.action.value='AddProductsToPriceBook';this.form.module.value='$related_module';this.form.return_module.value='$currentModule';this.form.return_action.value='PriceBookDetailView'\" value='". getTranslatedString('LBL_SELECT'). " " . getTranslatedString($related_module) ."'>&nbsp;";
}
}
$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_pricebookproductrel.listprice from vtiger_products inner join vtiger_pricebookproductrel on vtiger_products.productid = vtiger_pricebookproductrel.productid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid inner join vtiger_pricebook on vtiger_pricebook.pricebookid = vtiger_pricebookproductrel.pricebookid where vtiger_pricebook.pricebookid = '.$id.' and vtiger_crmentity.deleted = 0';
$this->retrieve_entity_info($id,$this_module);
$return_value = getPriceBookRelatedProducts($query,$this,$returnset);
if($return_value == null) $return_value = Array();
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_pricebook_products method ...");
return $return_value;
}
/** function used to get the services which are related to the pricebook
* @param int $id - pricebook id
* @return array - return an array which will be returned from the function getPriceBookRelatedServices
**/
function get_pricebook_services($id, $cur_tab_id, $rel_tab_id, $actions=false) {
global $log, $singlepane_view,$currentModule,$current_user;
$log->debug("Entering get_pricebook_services(".$id.") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once("modules/$related_module/$related_module.php");
$other = new $related_module();
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if($singlepane_view == 'true')
$returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
else
$returnset = '&return_module='.$this_module.'&return_action=CallRelatedList&return_id='.$id;
$button = '';
if($actions) {
if(is_string($actions)) $actions = explode(',', strtoupper($actions));
if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') {
$button .= "<input title='".getTranslatedString('LBL_SELECT')." ". getTranslatedString($related_module). "' class='crmbutton small edit' type='submit' name='button' onclick=\"this.form.action.value='AddServicesToPriceBook';this.form.module.value='$related_module';this.form.return_module.value='$currentModule';this.form.return_action.value='PriceBookDetailView'\" value='". getTranslatedString('LBL_SELECT'). " " . getTranslatedString($related_module) ."'>&nbsp;";
}
}
$query = 'select vtiger_service.serviceid, vtiger_service.servicename, vtiger_service.commissionrate,
vtiger_service.qty_per_unit, vtiger_service.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
vtiger_pricebookproductrel.listprice from vtiger_service
inner join vtiger_pricebookproductrel on vtiger_service.serviceid = vtiger_pricebookproductrel.productid
inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_service.serviceid
inner join vtiger_pricebook on vtiger_pricebook.pricebookid = vtiger_pricebookproductrel.pricebookid
where vtiger_pricebook.pricebookid = '.$id.' and vtiger_crmentity.deleted = 0';
$this->retrieve_entity_info($id,$this_module);
$return_value = $other->getPriceBookRelatedServices($query,$this,$returnset);
if($return_value == null) $return_value = Array();
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_pricebook_services method ...");
return $return_value;
}
/** function used to get whether the pricebook has related with a product or not
* @param int $id - product id
* @return true or false - if there are no pricebooks available or associated pricebooks for the product is equal to total number of pricebooks then return false, else return true
*/
function get_pricebook_noproduct($id)
{
global $log;
$log->debug("Entering get_pricebook_noproduct(".$id.") method ...");
$query = "select vtiger_crmentity.crmid, vtiger_pricebook.* from vtiger_pricebook inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_pricebook.pricebookid where vtiger_crmentity.deleted=0";
$result = $this->db->pquery($query, array());
$no_count = $this->db->num_rows($result);
if($no_count !=0)
{
$pb_query = 'select vtiger_crmentity.crmid, vtiger_pricebook.pricebookid,vtiger_pricebookproductrel.productid from vtiger_pricebook inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_pricebook.pricebookid inner join vtiger_pricebookproductrel on vtiger_pricebookproductrel.pricebookid=vtiger_pricebook.pricebookid where vtiger_crmentity.deleted=0 and vtiger_pricebookproductrel.productid=?';
$result_pb = $this->db->pquery($pb_query, array($id));
if($no_count == $this->db->num_rows($result_pb))
{
$log->debug("Exiting get_pricebook_noproduct method ...");
return false;
}
elseif($this->db->num_rows($result_pb) == 0)
{
$log->debug("Exiting get_pricebook_noproduct method ...");
return true;
}
elseif($this->db->num_rows($result_pb) < $no_count)
{
$log->debug("Exiting get_pricebook_noproduct method ...");
return true;
}
}
else
{
$log->debug("Exiting get_pricebook_noproduct method ...");
return false;
}
}
/*
* Function to get the primary query part of a report
* @param - $module Primary module name
* returns the query string formed on fetching the related data for report for primary module
*/
function generateReportsQuery($module){
$moduletable = $this->table_name;
$moduleindex = $this->table_index;
$query = "from $moduletable
inner join vtiger_crmentity on vtiger_crmentity.crmid=$moduletable.$moduleindex
left join vtiger_currency_info as vtiger_currency_info$module on vtiger_currency_info$module.id = $moduletable.currency_id
left join vtiger_groups as vtiger_groups$module on vtiger_groups$module.groupid = vtiger_crmentity.smownerid
left join vtiger_users as vtiger_users$module on vtiger_users$module.id = vtiger_crmentity.smownerid
left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid
left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid";
return $query;
}
/*
* Function to get the secondary query part of a report
* @param - $module primary module name
* @param - $secmodule secondary module name
* returns the query string formed on fetching the related data for report for secondary module
*/
function generateReportsSecQuery($module,$secmodule){
$query = $this->getRelationQuery($module,$secmodule,"vtiger_pricebook","pricebookid");
$query .=" left join vtiger_crmentity as vtiger_crmentityPriceBooks on vtiger_crmentityPriceBooks.crmid=vtiger_pricebook.pricebookid and vtiger_crmentityPriceBooks.deleted=0
left join vtiger_currency_info as vtiger_currency_infoPriceBooks on vtiger_currency_infoPriceBooks.id = vtiger_pricebook.currency_id
left join vtiger_users as vtiger_usersPriceBooks on vtiger_usersPriceBooks.id = vtiger_crmentityPriceBooks.smownerid
left join vtiger_groups as vtiger_groupsPriceBooks on vtiger_groupsPriceBooks.groupid = vtiger_crmentityPriceBooks.smownerid";
return $query;
}
/*
* Function to get the relation tables for related modules
* @param - $secmodule secondary module name
* returns the array with table names and fieldnames storing relations between module and this module
*/
function setRelationTables($secmodule){
$rel_tables = array (
"Products" => array("vtiger_pricebookproductrel"=>array("pricebookid","productid"),"vtiger_pricebook"=>"pricebookid"),
"Services" => array("vtiger_pricebookproductrel"=>array("pricebookid","productid"),"vtiger_pricebook"=>"pricebookid"),
);
return $rel_tables[$secmodule];
}
}
?>
@@ -0,0 +1,13 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/Ajax/CommonAjax.php');
?>
@@ -0,0 +1,12 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/quickcreate.php');
?>
@@ -0,0 +1,51 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header$
* Description: Saves an Account record and then redirects the browser to the
* defined return URL.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/PriceBooks/PriceBooks.php');
require_once('include/logging.php');
require_once('include/database/PearDatabase.php');
$focus = new PriceBooks();
//added to fix 4600
$search=vtlib_purify($_REQUEST['search_url']);
setObjectValuesFromRequest($focus);
if($_REQUEST['assigntype'] == 'U') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif($_REQUEST['assigntype'] == 'T') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
$focus->save("PriceBooks");
$return_id = $focus->id;
$parenttab = getParentTab();
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']);
else $return_module = "PriceBooks";
if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = vtlib_purify($_REQUEST['return_action']);
else $return_action = "DetailView";
if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = vtlib_purify($_REQUEST['return_id']);
header("Location: index.php?action=$return_action&module=$return_module&parenttab=$parenttab&record=$return_id&start=".vtlib_purify($_REQUEST['pagenumber']).$search);
?>
@@ -0,0 +1,13 @@
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
include('modules/Vtiger/Settings.php');
?>
@@ -0,0 +1,12 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/Ajax/TagCloud.php')
?>
@@ -0,0 +1,11 @@
<?php
/*+*******************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
require_once 'modules/Home/UnifiedSearch.php';
?>
@@ -0,0 +1,20 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
include ('modules/PriceBooks/ListView.php');
?>
@@ -0,0 +1,42 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
$mod_strings = array(
'LBL_PRICEBOOK_INFORMATION'=>'Price Book Information:',
'LBL_CUSTOM_INFORMATION'=>'Custom Information',
'LBL_DESCRIPTION_INFORMATION'=>'Description Name:',
//Mapping for price book
'Price Book Name'=>'Price Book Name',
'Product Name'=>'Product Name',
'Active'=>'Active',
'Description'=>'Description',
'Created Time'=>'Created Time',
'Modified Time'=>'Modified Time',
'LBL_LIST_PRODUCT_NAME'=>'Product Name',
'LBL_PRODUCT_CODE'=>'Part Number',
'LBL_PRODUCT_UNIT_PRICE'=>'Unit Price',
'LBL_PB_LIST_PRICE'=>'List Price',
'LBL_ACTION'=>'Action',
'PriceBook'=>'Price Book',
// Added after 5.0.4 GA
'Currency'=>'Currency',
// Module Sequence Numbering
'PriceBook No' => 'PriceBook No',
// END
);
?>
@@ -0,0 +1,51 @@
<?php
/**
* Copyright (C) 2006-2010 YUCHENG HU
*
* ---------------------------------------------
* HA WEBSYSTEMS
* http://www.hawebs.net
* https://www.hawebs.org/forums/computer/
*
* CONTACT
* huyuchengus@gmail.com / yuchenghu@hawebs.net
*
* ---------------------------------------------
* [A] GNU GENERAL PUBLIC LICENSE GNU/LGPL
* [B] Apache License, Version 2.0
*
* ---------------------------------------------
* NOTE
* 1. 所有的语言配置文件请采用 UTF-8 编码
*
* ---------------------------------------------
*/
$mod_strings = array(
'LBL_PRICEBOOK_INFORMATION' => '价目表信息:',
'LBL_CUSTOM_INFORMATION' => '自订信息:',
'LBL_DESCRIPTION_INFORMATION' => '描述名称:',
//Mapping for price book
'Price Book Name' => '价目表名称',
'Product Name' => '产品名称',
'Active' => '启用',
'Description' => '说明',
'Created Time' => '建立时间',
'Modified Time' => '修改时间',
'LBL_LIST_PRODUCT_NAME' => '产品名称',
'LBL_PRODUCT_CODE' => '产品代号',
'LBL_PRODUCT_UNIT_PRICE' => '单位价格',
'LBL_PB_LIST_PRICE' => '定价',
'LBL_ACTION' => '操作',
'PriceBook' => '价目表',
// Added after 5.0.4 GA
'Currency'=>'Currency',
// Module Sequence Numbering
'PriceBook No' => 'PriceBook No',
// END
);
?>