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

yuchenghu@hawebs.net


git-svn-id: https://svn.code.sf.net/p/hawebs/svn@636 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-11-17 01:54:58 +00:00
parent 7eeb27907a
commit 4d64b3da26
30 changed files with 2521 additions and 0 deletions
@@ -0,0 +1,81 @@
<?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['subject'];
$log->debug("id is ".$focus->id);
$log->debug("name is ".$focus->name);
}
global $mod_strings,$currentModule;
global $app_strings;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
$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'])) {
$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("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("MODULE",$currentmodule);
$smarty->assign("SINGLE_MOD",$mod_strings['PurchaseOrder']);
$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);
$smarty->display("RelatedLists.tpl");
}
?>
@@ -0,0 +1,18 @@
<?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 'modules/PurchaseOrder/PurchaseOrderPDFController.php';
$controller = new Vtiger_PurchaseOrderPDFController($currentModule);
$controller->loadRecord(vtlib_purify($_REQUEST['record']));
$controller->Output('PurchaseOrder.pdf', 'D');//added file name to make it work in IE, also forces the download giving the user the option to save
exit();
?>
@@ -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,38 @@
<?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.
********************************************************************************/
global $currentModule;
$focus = CRMEntity::getInstance($currentModule);
global $mod_strings;
require_once('include/logging.php');
$log = LoggerManager::getLogger('order_delete');
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if(!isset($_REQUEST['record']))
die($mod_strings['ERR_DELETE_RECORD']);
DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$_REQUEST['record'],$_REQUEST['return_id']);
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action'])."&record=".vtlib_purify($_REQUEST['return_id'])."&relmodule=".vtlib_purify($_REQUEST['module'])."&parenttab=".getParentTab().$url);
?>
@@ -0,0 +1,142 @@
<?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: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('Smarty_setup.php');
require_once('data/Tracker.php');
require_once('include/CustomFieldUtil.php');
require_once('include/utils/utils.php');
require_once('user_privileges/default_module_view.php');
global $mod_strings,$app_strings,$theme,$currentModule,$singlepane_view;
$focus = CRMEntity::getInstance($currentModule);
if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
$focus->retrieve_entity_info($_REQUEST['record'],"PurchaseOrder");
$focus->id = $_REQUEST['record'];
$focus->name=$focus->column_fields['subject'];
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$log->info("Order detail view");
$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("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
else $smarty->assign("NAME", "");
$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields));
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
$smarty->assign("CUSTOMFIELD", $cust_fld);
$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("SINGLE_MOD", 'PurchaseOrder');
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
if(isPermitted("PurchaseOrder","EditView",$_REQUEST['record']) == 'yes')
$smarty->assign("EDIT_DUPLICATE","permitted");
$smarty->assign("CREATEPDF","permitted");
if(isPermitted("PurchaseOrder","Delete",$_REQUEST['record']) == 'yes')
$smarty->assign("DELETE","permitted");
//Get the associated Products and then display above Terms and Conditions
$smarty->assign("ASSOCIATED_PRODUCTS",getDetailAssociatedProducts('PurchaseOrder',$focus));
$tabid = getTabid("PurchaseOrder");
$validationData = getDBValidationData($focus->tab_name,$tabid);
$data = split_validationdataArray($validationData);
$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record']));
$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule));
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("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,55 @@
<?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('include/database/PearDatabase.php');
global $adb;
$local_log =& LoggerManager::getLogger('PurchaseOrderAjax');
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,"PurchaseOrder");
//Added code for auto product stock updation on receiving goods
$prev_postatus = $modObj->column_fields['postatus'];
if($fieldname == 'postatus' && $prev_postatus != $fieldvalue && $fieldvalue == 'Received Shipment')
{
$modObj->update_prod_stock = 'true';
}
$modObj->column_fields[$fieldname] = $fieldvalue;
$modObj->id = $crmid;
$modObj->mode = "edit";
$modObj->save("PurchaseOrder");
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,254 @@
<?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: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('Smarty_setup.php');
require_once('data/Tracker.php');
require_once('include/CustomFieldUtil.php');
require_once('include/utils/utils.php');
global $app_strings,$mod_strings,$log,$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
global $current_user;
$currencyid=fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '')
{
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->retrieve_entity_info($_REQUEST['record'],"PurchaseOrder");
$focus->name=$focus->column_fields['subject'];
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$smarty->assign("DUPLICATE_FROM", $focus->id);
$PO_associated_prod = getAssociatedProducts("PurchaseOrder",$focus);
$focus->id = "";
$focus->mode = '';
}
if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
setObjectValuesFromRequest($focus);
}
if(isset($_REQUEST['product_id']) && $_REQUEST['product_id'] !='')
{
$focus->column_fields['product_id'] = $_REQUEST['product_id'];
$log->debug("Purchase Order EditView: Product Id from the request is ".$_REQUEST['product_id']);
$associated_prod = getAssociatedProducts("Products",$focus,$focus->column_fields['product_id']);
for ($i=1; $i<=count($associated_prod);$i++) {
$associated_prod_id = $associated_prod[$i]['hdnProductId'.$i];
$associated_prod_prices = getPricesForProducts($currencyid,array($associated_prod_id),'Products');
$associated_prod[$i]['listPrice'.$i] = $associated_prod_prices[$associated_prod_id];
}
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("AVAILABLE_PRODUCTS", 'true');
}
if(!empty($_REQUEST['parent_id']) && !empty($_REQUEST['return_module']))
{
if ($_REQUEST['return_module'] == 'Services') {
$focus->column_fields['product_id'] = $_REQUEST['parent_id'];
$log->debug("Service Id from the request is ".$_REQUEST['parent_id']);
$associated_prod = getAssociatedProducts("Services",$focus,$focus->column_fields['product_id']);
for ($i=1; $i<=count($associated_prod);$i++) {
$associated_prod_id = $associated_prod[$i]['hdnProductId'.$i];
$associated_prod_prices = getPricesForProducts($currencyid,array($associated_prod_id),'Services');
$associated_prod[$i]['listPrice'.$i] = $associated_prod_prices[$associated_prod_id];
}
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("AVAILABLE_PRODUCTS", 'true');
}
}
// Get vtiger_vendor address if vtiger_vendorid is given
if(isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id']!='' && $_REQUEST['record']==''){
require_once('modules/Vendors/Vendors.php');
$vend_focus = new Vendors();
$vend_focus->retrieve_entity_info($_REQUEST['vendor_id'],"Vendors");
$focus->column_fields['bill_city']=$vend_focus->column_fields['city'];
$focus->column_fields['ship_city']=$vend_focus->column_fields['city'];
$focus->column_fields['bill_street']=$vend_focus->column_fields['street'];
$focus->column_fields['ship_street']=$vend_focus->column_fields['street'];
$focus->column_fields['bill_state']=$vend_focus->column_fields['state'];
$focus->column_fields['ship_state']=$vend_focus->column_fields['state'];
$focus->column_fields['bill_code']=$vend_focus->column_fields['postalcode'];
$focus->column_fields['ship_code']=$vend_focus->column_fields['postalcode'];
$focus->column_fields['bill_country']=$vend_focus->column_fields['country'];
$focus->column_fields['ship_country']=$vend_focus->column_fields['country'];
$focus->column_fields['bill_pobox']=$vend_focus->column_fields['pobox'];
$focus->column_fields['ship_pobox']=$vend_focus->column_fields['pobox'];
}
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$disp_view = getView($focus->mode);
$mode = $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');
$adv_block = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'ADV');
$blocks['basicTab'] = $bas_block;
if(is_array($adv_block ))
$blocks['moreTab'] = $adv_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",'PurchaseOrder');
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$log->info("Order view");
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
else $smarty->assign("NAME", "");
if($focus->mode == 'edit')
{
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
$associated_prod = getAssociatedProducts("PurchaseOrder",$focus);
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("MODE", $focus->mode);
}
elseif(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
{
$smarty->assign("ASSOCIATEDPRODUCTS", $PO_associated_prod);
$smarty->assign("AVAILABLE_PRODUCTS", 'true');
$smarty->assign("MODE", $focus->mode);
}
elseif((isset($_REQUEST['product_id']) && $_REQUEST['product_id'] != '')) {
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$InvTotal = getInventoryTotal($_REQUEST['return_module'],$_REQUEST['return_id']);
$smarty->assign("MODE", $focus->mode);
//this is to display the Product Details in first row when we create new PO from Product relatedlist
if($_REQUEST['return_module'] == 'Products')
{
$smarty->assign("PRODUCT_ID",vtlib_purify($_REQUEST['product_id']));
$smarty->assign("PRODUCT_NAME",getProductName($_REQUEST['product_id']));
$smarty->assign("UNIT_PRICE",vtlib_purify($_REQUEST['product_id']));
$smarty->assign("QTY_IN_STOCK",getPrdQtyInStck($_REQUEST['product_id']));
$smarty->assign("VAT_TAX",getProductTaxPercentage("VAT",$_REQUEST['product_id']));
$smarty->assign("SALES_TAX",getProductTaxPercentage("Sales",$_REQUEST['product_id']));
$smarty->assign("SERVICE_TAX",getProductTaxPercentage("Service",$_REQUEST['product_id']));
}
}
if(isset($cust_fld))
{
$smarty->assign("CUSTOMFIELD", $cust_fld);
}
if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
else $smarty->assign("RETURN_MODULE","PurchaseOrder");
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']));
if (isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", vtlib_purify($_REQUEST['return_viewname']));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE","PurchaseOrder");
$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$smarty->assign("ID", $focus->id);
$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
//if create PO, get all available product taxes and shipping & Handling taxes
if($focus->mode != 'edit')
{
$tax_details = getAllTaxes('available');
$sh_tax_details = getAllTaxes('available','sh');
}
else
{
$tax_details = getAllTaxes('available','',$focus->mode,$focus->id);
$sh_tax_details = getAllTaxes('available','sh','edit',$focus->id);
}
$smarty->assign("GROUP_TAXES",$tax_details);
$smarty->assign("SH_TAXES",$sh_tax_details);
$tabid = getTabid("PurchaseOrder");
$validationData = getDBValidationData($focus->tab_name,$tabid);
$data = split_validationdataArray($validationData);
$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
$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
$smarty->assign("CURRENCIES_LIST", getAllCurrencies());
if($focus->mode == 'edit' || $_REQUEST['isDuplicate'] == 'true') {
$inventory_cur_info = getInventoryCurrencyInfo('PurchaseOrder', $focus->id);
$smarty->assign("INV_CURRENCY_ID", $inventory_cur_info['currency_id']);
} else {
$smarty->assign("INV_CURRENCY_ID", $currencyid);
}
if($focus->mode == 'edit')
$smarty->display('Inventory/InventoryEditView.tpl');
else
$smarty->display('Inventory/InventoryCreateView.tpl');
?>
@@ -0,0 +1,169 @@
<?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): ______________________________________.
********************************************************************************/
/** function used to get the top 5 purchase orders from Listview query
* @return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
*/
function getTopPurchaseOrder($maxval,$calCnt)
{
require_once("data/Tracker.php");
require_once('modules/PurchaseOrder/PurchaseOrder.php');
require_once('include/logging.php');
require_once('include/ListView/ListView.php');
require_once('include/utils/utils.php');
require_once('modules/CustomView/CustomView.php');
global $current_language,$current_user,$list_max_entries_per_page,$theme,$adb;
$current_module_strings = return_module_language($current_language, 'PurchaseOrder');
$log = LoggerManager::getLogger('po_list');
$url_string = '';
$sorder = '';
$oCustomView = new CustomView("PurchaseOrder");
$customviewcombo_html = $oCustomView->getCustomViewCombo();
if(isset($_REQUEST['viewname']) == false || $_REQUEST['viewname']=='')
{
if($oCustomView->setdefaultviewid != "")
{
$viewid = $oCustomView->setdefaultviewid;
}else
{
$viewid = "0";
}
}
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$date_var = date('Y-m-d');
$currentModule = 'PurchaseOrder';
$viewId = getCvIdOfAll($currentModule);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$queryGenerator->initForCustomViewById($viewId);
$meta = $queryGenerator->getMeta($currentModule);
$accessibleFieldNameList = array_keys($meta->getModuleFields());
$customViewFields = $queryGenerator->getCustomViewFields();
$fields = $queryGenerator->getFields();
$newFields = array_diff($fields, $customViewFields);
$widgetFieldsList = array('subject','vendor_id','contact_id','total');
$widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
$widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
if(count($widgetSelectedFields) < 2) {
$widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
}
$newFields = array_merge($newFields, $widgetSelectedFields);
$queryGenerator->setFields($newFields);
$_REQUEST = getTopPurchaseOrderSearch($_REQUEST, array(
'assigned_user_id'=>$current_user->column_fields['user_name'],
'duedate'=>$date_var));
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true'.getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT " . $adb->sql_escape_string($maxval);
if($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
//Retreiving the start value from request
if(isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
$start = vtlib_purify($_REQUEST['start']);
} else {
$start = 1;
}
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
if ($navigation_array['start'] == 1)
{
if($noofrows != 0)
$start_rec = $navigation_array['start'];
else
$start_rec = 0;
if($noofrows > $list_max_entries_per_page)
{
$end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
}
else
{
$end_rec = $noofrows;
}
}
else
{
if($navigation_array['next'] > $list_max_entries_per_page)
{
$start_rec = $navigation_array['next'] - $list_max_entries_per_page;
$end_rec = $navigation_array['next'] - 1;
}
else
{
$start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
$end_rec = $noofrows;
}
}
$focus = new PurchaseOrder();
//Retreive the List View Table Header
$title=array('myTopPurchaseOrders.gif',$current_module_strings['LBL_MY_TOP_PO'],'home_mytoppo');
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$controller->setHeaderSorting(false);
$header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder,
$order_by, true);
$entries = $controller->getListViewEntries($focus,$currentModule,$list_result,
$navigation_array, true);
$values=Array('ModuleName'=>'PurchaseOrder','Title'=>$title,'Header'=>$header,'Entries'=>$entries,'search_qry'=>$search_qry);
if ( ($display_empty_home_blocks && $noofrows == 0 ) || ($noofrows>0) )
return $values;
}
function getTopPurchaseOrderSearch($output, $input) {
$output['smodule'] = 'PO';
$output['query'] = 'true';
$output['Fields0'] = 'assigned_user_id';
$output['Condition0'] = 'e';
$output['Srch_value0'] = $input['assigned_user_id'];
$output['Fields1'] = 'duedate';
$output['Condition1'] = 'h';
$output['Srch_value1'] = $input['duedate'];
$output['searchtype'] = 'advance';
$output['search_cnt'] = '2';
$output['matchtype'] = 'all';
return $output;
}
?>
@@ -0,0 +1,227 @@
<?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): ______________________________________.
********************************************************************************/
require_once('Smarty_setup.php');
require_once("data/Tracker.php");
require_once('modules/PurchaseOrder/PurchaseOrder.php');
require_once('include/logging.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,$list_max_entries_per_page,$currentModule,$theme;
$log = LoggerManager::getLogger('order_list');
if (!isset($where)) $where = "";
$url_string = '&smodule=PO';
$focus = new PurchaseOrder();
// Initialize sort by fields
$focus->initSortbyField('PurchaseOrder');
// END
$smarty = new vtigerCRM_Smarty;
$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 Change/Delete ".$errormsg." ".$currentModule);
}else
{
$smarty->assign("ERROR","");
}
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
$sorder = $focus->getSortOrder();
$order_by = $focus->getOrderBy();
$_SESSION['PURCHASEORDER_ORDER_BY'] = $order_by;
$_SESSION['PURCHASEORDER_SORT_ORDER'] = $sorder;
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
//<<<<cutomview>>>>>>>
$oCustomView = new CustomView("PurchaseOrder");
$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>>>>>
$smarty->assign("CHANGE_OWNER",getUserslist());
$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
if(isPermitted('PurchaseOrder','Delete','') == 'yes')
{
$other_text['del'] = $app_strings[LBL_MASS_DELETE];
}
if(isPermitted('PurchaseOrder','EditView','') == 'yes')
{
$other_text['mass_edit'] = $app_strings[LBL_MASS_EDIT];
$other_text['c_owner'] = $app_strings[LBL_CHANGE_OWNER];
}
if($viewnamedesc['viewname'] == 'All')
{
$smarty->assign("ALL", 'All');
}
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$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",'PurchaseOrder');
$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
$smarty->assign("VIEWID", $viewid);
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$smarty->assign("BUTTONS", $other_text);
$smarty->assign("CUSTOMVIEW", $custom_view_strings);
//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);
}
$query = $queryGenerator->getQuery();
if(isset($order_by) && $order_by != '')
{
if($order_by == 'smownerid')
{
if( $adb->dbType == "pgsql")
$query .= ' GROUP BY user_name';
$query .= ' ORDER BY user_name '.$sorder;
}
else
{
$tablename = getTableNameForField('PurchaseOrder',$order_by);
$tablename = (($tablename != '')?($tablename."."):'');
if( $adb->dbType == "pgsql")
$query .= ' GROUP BY '.$tablename.$order_by;
$query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
}
}
//Postgres 8 fixes
if( $adb->dbType == "pgsql")
$query = fixPostgresQuery( $query, $log, 0);
if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
$count_result = $adb->query( mkCountQuery( $query));
$noofrows = $adb->query_result($count_result,0,"count");
}else{
$noofrows = null;
}
$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true');
$start = ListViewSession::getRequestCurrentPage($currentModule, $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($query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array());
else
$list_result = $adb->pquery($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
if($viewid !='')
$url_string .="&viewname=".$viewid;
$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);
$smarty->assign("SELECT_SCRIPT", $view_script);
//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,"PurchaseOrder","index",$viewid);
$alphabetical = AlphabeticalSearch($currentModule,'index','subject','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);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
ListViewSession::setSessionQuery($currentModule,$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,33 @@
/*********************************************************************************
** 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.
*
********************************************************************************/
document.write("<script type='text/javascript' src='include/js/Inventory.js'></"+"script>");
function set_return(product_id, product_name) {
window.opener.document.EditView.parent_name.value = product_name;
window.opener.document.EditView.parent_id.value = product_id;
}
function set_return_specific(product_id, product_name) {
//getOpenerObj used for DetailView
var fldName = getOpenerObj("purchaseorder_name");
var fldId = getOpenerObj("purchaseorder_id");
fldName.value = product_name;
fldId.value = product_id;
}
function set_return_formname_specific(formname, product_id, product_name) {
window.opener.document.EditView1.purchaseorder_name.value = product_name;
window.opener.document.EditView1.purchaseorder_id.value = product_id;
}
function set_return_todo(product_id, product_name) {
window.opener.document.createTodo.task_parent_name.value = product_name;
window.opener.document.createTodo.task_parent_id.value = product_id;
}
@@ -0,0 +1,368 @@
<?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: Defines the Account SugarBean Account entity with the necessary
* methods and variables.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
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');
// Account is used to store vtiger_account information.
class PurchaseOrder extends CRMEntity {
var $log;
var $db;
var $table_name = "vtiger_purchaseorder";
var $table_index= 'purchaseorderid';
var $tab_name = Array('vtiger_crmentity','vtiger_purchaseorder','vtiger_pobillads','vtiger_poshipads','vtiger_purchaseordercf');
var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_purchaseorder'=>'purchaseorderid','vtiger_pobillads'=>'pobilladdressid','vtiger_poshipads'=>'poshipaddressid','vtiger_purchaseordercf'=>'purchaseorderid');
/**
* Mandatory table for supporting custom fields.
*/
var $customFieldTable = Array('vtiger_purchaseordercf', 'purchaseorderid');
var $entity_table = "vtiger_crmentity";
var $billadr_table = "vtiger_pobillads";
var $column_fields = Array();
var $sortby_fields = Array('subject','tracking_no','smownerid','lastname');
// This is used to retrieve related vtiger_fields from form posts.
var $additional_column_fields = Array('assigned_user_name', 'smownerid', 'opportunity_id', 'case_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id', 'parent_name', 'member_id' );
// This is the list of vtiger_fields that are in the lists.
var $list_fields = Array(
// Module Sequence Numbering
//'Order No'=>Array('crmentity'=>'crmid'),
'Order No'=>Array('purchaseorder'=>'purchaseorder_no'),
// END
'Subject'=>Array('purchaseorder'=>'subject'),
'Vendor Name'=>Array('purchaseorder'=>'vendorid'),
'Tracking Number'=>Array('purchaseorder'=> 'tracking_no'),
'Total'=>Array('purchaseorder'=>'total'),
'Assigned To'=>Array('crmentity'=>'smownerid')
);
var $list_fields_name = Array(
'Order No'=>'purchaseorder_no',
'Subject'=>'subject',
'Vendor Name'=>'vendor_id',
'Tracking Number'=>'tracking_no',
'Total'=>'hdnGrandTotal',
'Assigned To'=>'assigned_user_id'
);
var $list_link_field= 'subject';
var $search_fields = Array(
'Order No'=>Array('purchaseorder'=>'purchaseorder_no'),
'Subject'=>Array('purchaseorder'=>'subject'),
);
var $search_fields_name = Array(
'Order No'=>'purchaseorder_no',
'Subject'=>'subject',
);
// Used when enabling/disabling the mandatory fields for the module.
// Refers to vtiger_field.fieldname values.
var $mandatory_fields = Array('subject', 'vendor_id','createdtime' ,'modifiedtime');
// This is the list of vtiger_fields that are required.
var $required_fields = array("accountname"=>1);
//Added these variables which are used as default order by and sortorder in ListView
var $default_order_by = 'subject';
var $default_sort_order = 'ASC';
//var $groupTable = Array('vtiger_pogrouprelation','purchaseorderid');
/** Constructor Function for Order class
* This function creates an instance of LoggerManager class using getLogger method
* creates an instance for PearDatabase class and get values for column_fields array of Order class.
*/
function PurchaseOrder() {
$this->log =LoggerManager::getLogger('PurchaseOrder');
$this->db = PearDatabase::getInstance();
$this->column_fields = getColumnFields('PurchaseOrder');
}
function save_module($module)
{
global $adb;
//in ajax save we should not call this function, because this will delete all the existing product values
if($_REQUEST['action'] != 'PurchaseOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave')
{
//Based on the total Number of rows we will save the product relationship with this entity
saveInventoryProductDetails($this, 'PurchaseOrder', $this->update_prod_stock);
}
//In Ajax edit, if the status changed to Received Shipment then we have to update the product stock
if($_REQUEST['action'] == 'PurchaseOrderAjax' && $this->update_prod_stock == 'true')
{
$inventory_res = $this->db->pquery("select productid, quantity from vtiger_inventoryproductrel where id=?",array($this->id));
$noofproducts = $this->db->num_rows($inventory_res);
//We have to update the stock for all the products in this PO
for($prod_count=0;$prod_count<$noofproducts;$prod_count++)
{
$productid = $this->db->query_result($inventory_res,$prod_count,'productid');
$quantity = $this->db->query_result($inventory_res,$prod_count,'quantity');
$this->db->println("Stock is going to be updated for the productid - $productid with quantity - $quantity");
addToProductStock($productid,$quantity);
}
}
// Update the currency id and the conversion rate for the purchase order
$update_query = "update vtiger_purchaseorder set currency_id=?, conversion_rate=? where purchaseorderid=?";
$update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
$adb->pquery($update_query, $update_params);
}
/** Function used to get the sort order for Purchase Order listview
* @return string $sorder - first check the $_REQUEST['sorder'] if request value is empty then check in the $_SESSION['PURCHASEORDER_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['PURCHASEORDER_SORT_ORDER'] != '')?($_SESSION['PURCHASEORDER_SORT_ORDER']):($this->default_sort_order));
$log->debug("Exiting getSortOrder() method ...");
return $sorder;
}
/** Function used to get the order by value for Purchase Order listview
* @return string $order_by - first check the $_REQUEST['order_by'] if request value is empty then check in the $_SESSION['PURCHASEORDER_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['PURCHASEORDER_ORDER_BY'] != '')?($_SESSION['PURCHASEORDER_ORDER_BY']):($use_default_order_by));
$log->debug("Exiting getOrderBy method ...");
return $order_by;
}
/** Function to get activities associated with the Purchase Order
* This function accepts the id as arguments and execute the MySQL query using the id
* and sends the query and the id as arguments to renderRelatedActivities() method
*/
function get_activities($id, $cur_tab_id, $rel_tab_id, $actions=false) {
global $log, $singlepane_view,$currentModule,$current_user;
$log->debug("Entering get_activities(".$id.") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once("modules/$related_module/Activity.php");
$other = new Activity();
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 = '';
$button .= '<input type="hidden" name="activity_mode">';
if($actions) {
if(is_string($actions)) $actions = explode(',', strtoupper($actions));
if(in_array('ADD', $actions) && isPermitted($related_module,1, '') == 'yes') {
$button .= "<input title='".getTranslatedString('LBL_NEW'). " ". getTranslatedString('LBL_TODO', $related_module) ."' class='crmbutton small create'" .
" onclick='this.form.action.value=\"EditView\";this.form.module.value=\"$related_module\";this.form.return_module.value=\"$this_module\";this.form.activity_mode.value=\"Task\";' type='submit' name='button'" .
" value='". getTranslatedString('LBL_ADD_NEW'). " " . getTranslatedString('LBL_TODO', $related_module) ."'>&nbsp;";
}
}
$query = "SELECT case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name,vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid,vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' and vtiger_crmentity.deleted=0 and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL and vtiger_activity.status != 'Deferred') ";
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
if($return_value == null) $return_value = Array();
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_activities method ...");
return $return_value;
}
/** Function to get the activities history associated with the Purchase Order
* This function accepts the id as arguments and execute the MySQL query using the id
* and sends the query and the id as arguments to renderRelatedHistory() method
*/
function get_history($id)
{
global $log;
$log->debug("Entering get_history(".$id.") method ...");
$query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid,vtiger_activity.* ,vtiger_seactivityrel.*, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_crmentity.createdtime, vtiger_crmentity.description,case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name
from vtiger_activity
inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid
inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid
left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid
left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid
left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid
left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid
where vtiger_activity.activitytype='Task'
and (vtiger_activity.status = 'Completed' or vtiger_activity.status = 'Deferred')
and vtiger_seactivityrel.crmid=".$id."
and vtiger_crmentity.deleted = 0";
//Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php
$log->debug("Exiting get_history method ...");
return getHistory('PurchaseOrder',$query,$id);
}
/** Function used to get the Status history of the Purchase Order
* @param $id - purchaseorder id
* @return $return_data - array with header and the entries in format Array('header'=>$header,'entries'=>$entries_list) where as $header and $entries_list are arrays which contains header values and all column values of all entries
*/
function get_postatushistory($id)
{
global $log;
$log->debug("Entering get_postatushistory(".$id.") method ...");
global $adb;
global $mod_strings;
global $app_strings;
$query = 'select vtiger_postatushistory.*, vtiger_purchaseorder.purchaseorder_no from vtiger_postatushistory inner join vtiger_purchaseorder on vtiger_purchaseorder.purchaseorderid = vtiger_postatushistory.purchaseorderid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_purchaseorder.purchaseorderid where vtiger_crmentity.deleted = 0 and vtiger_purchaseorder.purchaseorderid = ?';
$result=$adb->pquery($query, array($id));
$noofrows = $adb->num_rows($result);
$header[] = $app_strings['Order No'];
$header[] = $app_strings['Vendor Name'];
$header[] = $app_strings['LBL_AMOUNT'];
$header[] = $app_strings['LBL_PO_STATUS'];
$header[] = $app_strings['LBL_LAST_MODIFIED'];
//Getting the field permission for the current user. 1 - Not Accessible, 0 - Accessible
//Vendor, Total are mandatory fields. So no need to do security check to these fields.
global $current_user;
//If field is accessible then getFieldVisibilityPermission function will return 0 else return 1
$postatus_access = (getFieldVisibilityPermission('PurchaseOrder', $current_user->id, 'postatus') != '0')? 1 : 0;
$picklistarray = getAccessPickListValues('PurchaseOrder');
$postatus_array = ($postatus_access != 1)? $picklistarray['postatus']: array();
//- ==> picklist field is not permitted in profile
//Not Accessible - picklist is permitted in profile but picklist value is not permitted
$error_msg = ($postatus_access != 1)? 'Not Accessible': '-';
while($row = $adb->fetch_array($result))
{
$entries = Array();
//Module Sequence Numbering
//$entries[] = $row['purchaseorderid'];
$entries[] = $row['purchaseorder_no'];
// END
$entries[] = $row['vendorname'];
$entries[] = $row['total'];
$entries[] = (in_array($row['postatus'], $postatus_array))? $row['postatus']: $error_msg;
$entries[] = getDisplayDate($row['lastmodified']);
$entries_list[] = $entries;
}
$return_data = Array('header'=>$header,'entries'=>$entries_list);
$log->debug("Exiting get_postatushistory method ...");
return $return_data;
}
/*
* 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){
$qry = " left join on vtiger_purchaseorder. = ";
$query = $this->getRelationQuery($module,$secmodule,"vtiger_purchaseorder","purchaseorderid");
$query .= " left join vtiger_crmentity as vtiger_crmentityPurchaseOrder on vtiger_crmentityPurchaseOrder.crmid=vtiger_purchaseorder.purchaseorderid and vtiger_crmentityPurchaseOrder.deleted=0
left join vtiger_purchaseordercf on vtiger_purchaseorder.purchaseorderid = vtiger_purchaseordercf.purchaseorderid
left join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid
left join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid
left join vtiger_inventoryproductrel as vtiger_inventoryproductrelPurchaseOrder on vtiger_purchaseorder.purchaseorderid = vtiger_inventoryproductrelPurchaseOrder.id
left join vtiger_products as vtiger_productsPurchaseOrder on vtiger_productsPurchaseOrder.productid = vtiger_inventoryproductrelPurchaseOrder.productid
left join vtiger_service as vtiger_servicePurchaseOrder on vtiger_servicePurchaseOrder.serviceid = vtiger_inventoryproductrelPurchaseOrder.productid
left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentityPurchaseOrder.smownerid
left join vtiger_groups as vtiger_groupsPurchaseOrder on vtiger_groupsPurchaseOrder.groupid = vtiger_crmentityPurchaseOrder.smownerid
left join vtiger_vendor as vtiger_vendorRelPurchaseOrder on vtiger_vendorRelPurchaseOrder.vendorid = vtiger_purchaseorder.vendorid
left join vtiger_contactdetails as vtiger_contactdetailsPurchaseOrder on vtiger_contactdetailsPurchaseOrder.contactid = vtiger_purchaseorder.contactid ";
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 (
"Calendar" =>array("vtiger_seactivityrel"=>array("crmid","activityid"),"vtiger_purchaseorder"=>"purchaseorderid"),
"Documents" => array("vtiger_senotesrel"=>array("crmid","notesid"),"vtiger_purchaseorder"=>"purchaseorderid"),
"Contacts" => array("vtiger_purchaseorder"=>array("purchaseorderid","contactid")),
);
return $rel_tables[$secmodule];
}
// Function to unlink an entity with given Id from another entity
function unlinkRelationship($id, $return_module, $return_id) {
global $log;
if(empty($return_module) || empty($return_id)) return;
if($return_module == 'Vendors') {
$sql_req ='UPDATE vtiger_crmentity SET deleted = 1 WHERE crmid= ?';
$this->db->pquery($sql_req, array($id));
} elseif($return_module == 'Contacts') {
$sql_req ='UPDATE vtiger_purchaseorder SET contactid=0 WHERE purchaseorderid = ?';
$this->db->pquery($sql_req, array($id));
} else {
$sql = 'DELETE FROM vtiger_crmentityrel WHERE (crmid=? AND relmodule=? AND relcrmid=?) OR (relcrmid=? AND module=? AND crmid=?)';
$params = array($id, $return_module, $return_id, $id, $return_module, $return_id);
$this->db->pquery($sql, $params);
}
}
}
?>
@@ -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/CommonAjax.php');
?>
@@ -0,0 +1,68 @@
<?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 'include/InventoryPDFController.php';
class Vtiger_PurchaseOrderPDFController extends Vtiger_InventoryPDFController{
function buildHeaderModelTitle() {
return sprintf("%s: %s", rtrim($this->moduleName, 's'), $this->focusColumnValue('purchaseorder_no'));
}
function buildHeaderModelColumnCenter() {
$contactName = $this->resolveReferenceLabel($this->focusColumnValue('contact_id'), 'Contacts');
$vendorName = $this->resolveReferenceLabel($this->focusColumnValue('vendor_id'), 'Vendors');
$trackingNumber = $this->focusColumnValue('tracking_no');
$requisitionNumber = $this->focusColumnValue('requisition_no');
$contactNameLabel = getTranslatedString('Contact Name', $this->moduleName);
$vendorNameLabel = getTranslatedString('Vendor Name', $this->moduleName);
$trackingNumberLabel = getTranslatedString('Tracking Number', $this->moduleName);
$requisitionNumberLabel = getTranslatedString('Requisition Number', $this->moduleName);
$modelColumn1 = array(
$contactNameLabel => $contactName,
$vendorNameLabel => $vendorName,
$trackingNumberLabel=> $trackingNumber,
$requisitionNumberLabel=>$requisitionNumber
);
return $modelColumn1;
}
function buildHeaderModelColumnRight() {
$issueDateLabel = getTranslatedString('Issued Date', $this->moduleName);
$validDateLabel = getTranslatedString('Due Date', $this->moduleName);
$billingAddressLabel = getTranslatedString('Billing Address', $this->moduleName);
$shippingAddressLabel = getTranslatedString('Shipping Address', $this->moduleName);
$modelColumn2 = array(
'dates' => array(
$issueDateLabel => $this->formatDate(date("Y-m-d")),
$validDateLabel => $this->formatDate($this->focusColumnValue('duedate')),
),
$billingAddressLabel => $this->buildHeaderBillingAddress(),
$shippingAddressLabel => $this->buildHeaderShippingAddress()
);
return $modelColumn2;
}
function getWatermarkContent() {
return $this->focusColumnValue('postatus');
}
function buildFooterModel() {
$footerModel = new Vtiger_PDF_Model();
$termsconditionLabel = getTranslatedString('Description', $this->moduleName);
$footerModel->set('title', $termsconditionLabel);
$footerModel->set('content', from_html($this->focusColumnValue("description")));
return $footerModel;
}
}
?>
@@ -0,0 +1,81 @@
<?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/PurchaseOrder/PurchaseOrder.php');
require_once('include/logging.php');
require_once('include/database/PearDatabase.php');
$local_log =& LoggerManager::getLogger('index');
$focus = new PurchaseOrder();
//added to fix 4600
$search=vtlib_purify($_REQUEST['search_url']);
global $current_user;
setObjectValuesFromRequest($focus);
//Added code for auto product stock updation on receiving goods
$focus->update_prod_stock='';
if($focus->column_fields['postatus'] == 'Received Shipment')
{
if($focus->mode != 'edit')
$focus->update_prod_stock='true';
else
{
$prev_postatus=getPoStatus($focus->id);
if($focus->column_fields['postatus'] != $prev_postatus)
{
$focus->update_prod_stock='true';
}
}
}
$focus->column_fields['currency_id'] = $_REQUEST['inventory_currency'];
$cur_sym_rate = getCurrencySymbolandCRate($_REQUEST['inventory_currency']);
$focus->column_fields['conversion_rate'] = $cur_sym_rate['rate'];
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("PurchaseOrder");
$return_id = $focus->id;
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']);
else $return_module = "PurchaseOrder";
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']);
$parenttab = getParentTab();
$local_log->debug("Saved record with id of ".$return_id);
//code added for returning back to the current view after edit from list view
if($_REQUEST['return_viewname'] == '') $return_viewname='0';
if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']);
header("Location: index.php?action=$return_action&module=$return_module&record=$return_id&parenttab=$parenttab&viewname=$return_viewname&start=".vtlib_purify($_REQUEST['pagenumber']).$search);
?>
@@ -0,0 +1,25 @@
<?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 'modules/PurchaseOrder/PurchaseOrderPDFController.php';
$controller = new Vtiger_PurchaseOrderPDFController($currentModule);
$controller->loadRecord(vtlib_purify($_REQUEST['record']));
$filenameid = $_REQUEST['record'];
if(empty($filenameid)) $filenameid = time();
$filepath="storage/PurchaseOrder_$filenameid.pdf";
//added file name to make it work in IE, also forces the download giving the user the option to save
$controller->Output($filepath,'F');
// Added to fix annoying bug that includes HTML in your PDF
echo "<script>window.history.back();</script>";
exit();
?>
@@ -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,53 @@
<?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: TODO To be written.
* 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/PurchaseOrder/ListView.php');
?>
@@ -0,0 +1,203 @@
<?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: Defines the English language pack
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = Array(
'LBL_MODULE_NAME'=>'PurchaseOrder',
'LBL_RELATED_PRODUCTS'=>'Product Details',
'LBL_MODULE_TITLE'=>'Purchase Order: Home',
'LBL_SEARCH_FORM_TITLE'=>'Purchase Order Search',
'LBL_LIST_FORM_TITLE'=>'Purchase Order List',
'LBL_NEW_FORM_TITLE'=>'New Purchase Order',
'LBL_MEMBER_ORG_FORM_TITLE'=>'Member Organizations',
'LBL_LIST_ACCOUNT_NAME'=>'Account Name',
'LBL_LIST_CITY'=>'City',
'LBL_LIST_WEBSITE'=>'Website',
'LBL_LIST_STATE'=>'State',
'LBL_LIST_PHONE'=>'Phone',
'LBL_LIST_EMAIL_ADDRESS'=>'Email Address',
'LBL_LIST_CONTACT_NAME'=>'Contact Name',
//DON'T CONVERT THESE THEY ARE MAPPINGS
'db_name' => 'LBL_LIST_ACCOUNT_NAME',
'db_website' => 'LBL_LIST_WEBSITE',
'db_billing_address_city' => 'LBL_LIST_CITY',
//END DON'T CONVERT
'LBL_ACCOUNT'=>'Account:',
'LBL_ACCOUNT_NAME'=>'Account Name:',
'LBL_PHONE'=>'Phone:',
'LBL_WEBSITE'=>'Website:',
'LBL_FAX'=>'Fax:',
'LBL_TICKER_SYMBOL'=>'Ticker Symbol:',
'LBL_OTHER_PHONE'=>'Other Phone:',
'LBL_ANY_PHONE'=>'Any Phone:',
'LBL_MEMBER_OF'=>'Member of:',
'LBL_EMAIL'=>'Email:',
'LBL_EMPLOYEES'=>'Employees:',
'LBL_OTHER_EMAIL_ADDRESS'=>'Other Email:',
'LBL_ANY_EMAIL'=>'Any Email:',
'LBL_OWNERSHIP'=>'Ownership:',
'LBL_RATING'=>'Rating:',
'LBL_INDUSTRY'=>'Industry:',
'LBL_SIC_CODE'=>'SIC Code:',
'LBL_TYPE'=>'Type:',
'LBL_ANNUAL_REVENUE'=>'Annual Revenue:',
'LBL_ADDRESS_INFORMATION'=>'Address Information',
'LBL_Quote_INFORMATION'=>'Account Information',
'LBL_CUSTOM_INFORMATION'=>'Custom Information',
'LBL_BILLING_ADDRESS'=>'Billing Address:',
'LBL_SHIPPING_ADDRESS'=>'Shipping Address:',
'LBL_ANY_ADDRESS'=>'Any Address:',
'LBL_CITY'=>'City:',
'LBL_STATE'=>'State:',
'LBL_POSTAL_CODE'=>'Postal Code:',
'LBL_COUNTRY'=>'Country:',
'LBL_DESCRIPTION_INFORMATION'=>'Description Information',
'LBL_TERMS_INFORMATION'=>'Terms & Conditions',
'LBL_DESCRIPTION'=>'Description:',
'NTC_COPY_BILLING_ADDRESS'=>'Copy billing address to shipping address',
'NTC_COPY_SHIPPING_ADDRESS'=>'Copy shipping address to billing address',
'NTC_REMOVE_MEMBER_ORG_CONFIRMATION'=>'Are you sure you want to remove this record as a member organization?',
'LBL_DUPLICATE'=>'Potential Duplicate Accounts',
'MSG_DUPLICATE' => 'Creating this vtiger_account may vtiger_potentialy create a duplicate vtiger_account. You may either select an vtiger_account from the list below or you may click on Create New Account to continue creating a new vtiger_account with the previously entered data.',
'LBL_INVITEE'=>'Contacts',
'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.",
'LBL_SELECT_ACCOUNT'=>'Select Account',
'LBL_GENERAL_INFORMATION'=>'General Information',
//for v4 release added
'LBL_NEW_POTENTIAL'=>'New Potential',
'LBL_POTENTIAL_TITLE'=>'Potentials',
'LBL_NEW_TASK'=>'New Task',
'LBL_TASK_TITLE'=>'Tasks',
'LBL_NEW_CALL'=>'New Call',
'LBL_CALL_TITLE'=>'Calls',
'LBL_NEW_MEETING'=>'New Meeting',
'LBL_MEETING_TITLE'=>'Meetings',
'LBL_NEW_EMAIL'=>'New Email',
'LBL_EMAIL_TITLE'=>'Emails',
'LBL_NEW_CONTACT'=>'New Contact',
'LBL_CONTACT_TITLE'=>'Contacts',
//Added vtiger_fields after RC1 - Release
'LBL_ALL'=>'All',
'LBL_PROSPECT'=>'Prospect',
'LBL_INVESTOR'=>'Investor',
'LBL_RESELLER'=>'Reseller',
'LBL_PARTNER'=>'Partner',
// Added for 4GA
'LBL_TOOL_FORM_TITLE'=>'Account Tools',
//Added for 4GA
'Subject'=>'Subject',
'Quote Name'=>'Quote Name',
'Vendor Name'=>'Vendor Name',
'Requisition No'=>'Requisition No',
'Tracking Number'=>'Tracking Number',
'Contact Name'=>'Contact Name',
'Due Date'=>'Due Date',
'Carrier'=>'Carrier',
'Type'=>'Type',
'Sales Tax'=>'Sales Tax',
'Sales Commission'=>'Sales Commission',
'Excise Duty'=>'Excise Duty',
'Total'=>'Total',
'Product Name'=>'Product Name',
'Assigned To'=>'Assigned To',
'Billing Address'=>'Billing Address',
'Shipping Address'=>'Shipping Address',
'Billing City'=>'Billing City',
'Billing State'=>'Billing State',
'Billing Code'=>'Billing Postal Code',
'Billing Country'=>'Billing Country',
'Billing Po Box'=>'Billing PO Box',
'Shipping Po Box'=>'Shipping PO Box',
'Shipping City'=>'Shipping City',
'Shipping State'=>'Shipping State',
'Shipping Code'=>'Shipping Postal Code',
'Shipping Country'=>'Shipping Country',
'City'=>'City',
'State'=>'State',
'Code'=>'Code',
'Country'=>'Country',
'Created Time'=>'Created Time',
'Modified Time'=>'Modified Time',
'Description'=>'Description',
'Potential Name'=>'Potential Name',
'Customer No'=>'Customer No',
'Purchase Order'=>'Purchase Order',
'Vendor Terms'=>'Vendor Terms',
'Pending'=>'Pending',
'Account Name'=>'Account Name',
'Terms & Conditions'=>'Terms & Conditions',
//Quote Info
'LBL_PO_INFORMATION'=>'Purchase Order Information',
'LBL_PO'=>'Purchase Order:',
//Added for 4.2 GA
'LBL_SO_FORM_TITLE'=>'Sales',
'LBL_PO_FORM_TITLE'=>'Purchase',
'LBL_SUBJECT_TITLE'=>'Subject',
'LBL_VENDOR_NAME_TITLE'=>'Vendor Name',
'LBL_TRACKING_NO_TITLE'=>'Tracking No:',
'LBL_PO_SEARCH_TITLE'=>'Purchase Order Search',
'LBL_SO_SEARCH_TITLE'=>'Sales Order Search',
'LBL_QUOTE_NAME_TITLE'=>'Quote Name',
'Order No'=>'Order No',
'Status'=>'Status',
'PurchaseOrder'=>'Purchase Order',
'LBL_MY_TOP_PO'=>'My Top Open Purchase Orders',
//Added for existing Picklist Entries
'FedEx'=>'FedEx',
'UPS'=>'UPS',
'USPS'=>'USPS',
'DHL'=>'DHL',
'BlueDart'=>'BlueDart',
'Created'=>'Created',
'Approved'=>'Approved',
'Delivered'=>'Delivered',
'Cancelled'=>'Cancelled',
'Received Shipment'=>'Received Shipment',
//Added for Reports (5.0.4)
'Tax Type'=>'Tax Type',
'Discount Percent'=>'Discount Percent',
'Discount Amount'=>'Discount Amount',
'Terms & Conditions'=>'Terms & Conditions',
'Adjustment'=>'Adjustment',
'Sub Total'=>'Sub Total',
'S&H Amount'=>'S&H Amount',
//Added after 5.0.4 GA
'PurchaseOrder No'=>'PurchaseOrder No',
);
?>
@@ -0,0 +1,201 @@
<?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_MODULE_NAME' => '采购订单',
'LBL_RELATED_PRODUCTS' => '产品细节',
'LBL_MODULE_TITLE' => '采购订单:首页',
'LBL_SEARCH_FORM_TITLE' => '搜寻采购订单',
'LBL_LIST_FORM_TITLE' => '采购订单列表',
'LBL_NEW_FORM_TITLE' => '新增采购订单',
'LBL_MEMBER_ORG_FORM_TITLE' => '成员组织',
'LBL_LIST_ACCOUNT_NAME' => '客户名称',
'LBL_LIST_CITY' => '乡镇市区',
'LBL_LIST_WEBSITE' => '网站',
'LBL_LIST_STATE' => '县市',
'LBL_LIST_PHONE' => '电话',
'LBL_LIST_EMAIL_ADDRESS' => '电子邮件',
'LBL_LIST_CONTACT_NAME' => '联络人名称',
//DON'T CONVERT THESE THEY ARE MAPPINGS
'db_name' => 'LBL_LIST_ACCOUNT_NAME',
'db_website' => 'LBL_LIST_WEBSITE',
'db_billing_address_city' => 'LBL_LIST_CITY',
//END DON'T CONVERT
'LBL_ACCOUNT' => '客户:',
'LBL_ACCOUNT_NAME' => '客户名称:',
'LBL_PHONE' => '电话:',
'LBL_WEBSITE' => '网站:',
'LBL_FAX' => '传真:',
'LBL_TICKER_SYMBOL' => '传票符号:',
'LBL_OTHER_PHONE' => '其它电话:',
'LBL_ANY_PHONE' => '其它电话:',
'LBL_MEMBER_OF' => '群组:',
'LBL_EMAIL' => '电子信箱:',
'LBL_EMPLOYEES' => '员工人数:',
'LBL_OTHER_EMAIL_ADDRESS' => '其它电子信箱:',
'LBL_ANY_EMAIL' => '其它电子信箱:',
'LBL_OWNERSHIP' => '负责人:',
'LBL_RATING' => '评分:',
'LBL_INDUSTRY' => '产业别:',
'LBL_SIC_CODE' => '统一编号:',
'LBL_TYPE' => '类型:',
'LBL_ANNUAL_REVENUE' => '年收入:',
'LBL_ADDRESS_INFORMATION' => '住址信息',
'LBL_Quote_INFORMATION' => '客户信息',
'LBL_CUSTOM_INFORMATION' => '自订信息',
'LBL_BILLING_ADDRESS' => '发票住址:',
'LBL_SHIPPING_ADDRESS' => '送货住址:',
'LBL_ANY_ADDRESS' => '其它住址:',
'LBL_CITY' => '乡镇市区:',
'LBL_STATE' => '县市:',
'LBL_POSTAL_CODE' => '邮政编码:',
'LBL_COUNTRY' => '国家:',
'LBL_DESCRIPTION_INFORMATION' => '说明信息',
'LBL_TERMS_INFORMATION' => '期限与条件',
'LBL_DESCRIPTION' => '说明:',
'NTC_COPY_BILLING_ADDRESS' => '复制发票地址到送货地址',
'NTC_COPY_SHIPPING_ADDRESS' => '复制送货地址到送货发票地址',
'NTC_REMOVE_MEMBER_ORG_CONFIRMATION' => '您确定要删除这笔数据?',
'LBL_DUPLICATE' => '客户数据重复',
'MSG_DUPLICATE' => '建立这个客户数据可能与现有数据重复,您可以选择将数据归属于下面其中一个项目中,或是点选建立新客户来透过刚刚输入的数据建立新项目。',
'LBL_INVITEE' => '联络人',
'ERR_DELETE_RECORD' => '必须指定数据编号才能删除客户。',
'LBL_SELECT_ACCOUNT' => '选择客户',
'LBL_GENERAL_INFORMATION' => '一般信息',
//for v4 release added
'LBL_NEW_POTENTIAL' => '新潜在机会',
'LBL_POTENTIAL_TITLE' => '潜在机会',
'LBL_NEW_TASK' => '新任务',
'LBL_TASK_TITLE' => '任务',
'LBL_NEW_CALL' => ' 安排电话联系',
'LBL_CALL_TITLE' => '电话联系',
'LBL_NEW_MEETING' => '新增会议',
'LBL_MEETING_TITLE' => '会议',
'LBL_NEW_EMAIL' => '寄发电子邮件',
'LBL_EMAIL_TITLE' => '电子邮件',
'LBL_NEW_CONTACT' => '新增联络人',
'LBL_CONTACT_TITLE' => '联络人',
//Added vtiger_fields after RC1 - Release
'LBL_ALL' => '全部',
'LBL_PROSPECT' => '预期',
'LBL_INVESTOR' => '投资者',
'LBL_RESELLER' => '经销商',
'LBL_PARTNER' => '合作伙伴',
// Added for 4GA
'LBL_TOOL_FORM_TITLE' => '客户管理工具',
//Added for 4GA
'Subject' => '主旨',
'Quote Name' => '报价单名称',
'Vendor Name' => '厂商名称',
'Requisition No' => '申请书编号',
'Tracking Number' => '追踪编号',
'Contact Name' => '联络人名称',
'Due Date' => '到期日',
'Carrier' => '货运商',
'Type' => '类型',
'Sales Tax' => '销售税额',
'Sales Commission' => '销售佣金',
'Excise Duty' => '货物税',
'Total' => '总计',
'Product Name' => '产品名称',
'Assigned To' => '负责人',
'Billing Address' => '付款住址',
'Shipping Address' => '送货住址',
'Billing City' => '[付款住址]乡镇市区',
'Billing State' => '[付款住址]县市',
'Billing Code' => '[付款住址]邮政编码',
'Billing Country' => '[付款住址]国家',
'Billing Po Box' => '[付款住址]采购订单信箱',
'Shipping Po Box' => '[送货住址]采购订单信箱',
'Shipping City' => '[送货住址]乡镇市区',
'Shipping State' => '[送货住址]县市',
'Shipping Code' => '[送货住址]邮政编码',
'Shipping Country' => '[送货住址]国家',
'City' => '乡镇市区',
'State' => '县市',
'Code' => '邮政编码',
'Country' => '国家',
'Created Time' => '建立时间',
'Modified Time' => '修改时间',
'Description' => '说明',
'Potential Name' => '潜在机会名称',
'Customer No' => '客户编号',
'Purchase Order' => '采购订单',
'Vendor Terms' => '厂商条件',
'Pending' => '等待',
'Account Name' => '客户名称',
'Terms & Conditions' => '期限与条件',
//Quote Info
'LBL_PO_INFORMATION' => '采购订单信息',
'LBL_PO' => '采购订单:',
//Added for 4.2 GA
'LBL_SO_FORM_TITLE' => '业务',
'LBL_PO_FORM_TITLE' => '采购',
'LBL_SUBJECT_TITLE' => '主旨',
'LBL_VENDOR_NAME_TITLE' => '厂商名称',
'LBL_TRACKING_NO_TITLE' => '追踪编号',
'LBL_PO_SEARCH_TITLE' => '搜寻采购订单',
'LBL_SO_SEARCH_TITLE' => '搜寻销售订单',
'LBL_QUOTE_NAME_TITLE' => '报价单名称',
'Order Id' => '订单编号',
'Status' => '状态',
'PurchaseOrder' => '采购订单',
'LBL_MY_TOP_PO' => '进行中的最佳采购订单',
//Added for existing Picklist Entries
'FedEx'=>'FedEx',
'UPS'=>'UPS',
'USPS'=>'USPS',
'DHL'=>'DHL',
'BlueDart'=>'BlueDart',
'Created' => '建立日期',
'Approved' => '审核日期',
'Delivered' => '递送日期',
'Cancelled' => '取消日期',
'Received Shipment' => '收件日期',
//Added for Reports (5.0.4)
'Tax Type'=>'Tax Type',
'Discount Percent'=>'Discount Percent',
'Discount Amount'=>'Discount Amount',
'Terms & Conditions'=>'Terms & Conditions',
'Adjustment'=>'Adjustment',
'Sub Total'=>'Sub Total',
'S&H Amount'=>'S&H Amount',
//Added after 5.0.4 GA
'PurchaseOrder No'=>'PurchaseOrder No',
);
?>
@@ -0,0 +1,35 @@
<?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.
*
********************************************************************************/
define('USD',"$");
define('EURO', chr(128) );
$desc=explode("\n",$description);
$cond=explode("\n",$conditions);
$num=230;
/* **************** Begin Description ****************** */
$descBlock=array("10",$top,"53", $num);
$pdf->addDescBlock($description, $app_strings["Description"], $descBlock);
/* ************** End Description *********************** */
/* **************** Begin Terms ****************** */
$termBlock=array("107",$top,"53", $num);
$pdf->addDescBlock($conditions, $app_strings["Terms & Conditions"], $termBlock);
/* ************** End Terms *********************** */
?>
@@ -0,0 +1,103 @@
<?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.
*
********************************************************************************/
define('USD',"$");
define('EURO', chr(128) );
// ************** Begin company information *****************
$imageBlock=array("10","3","0","0");
$pdf->addImage( $logo_name, $imageBlock);
// x,y,width
if($org_phone != '')
$phone ="\n".$app_strings["Phone"].":".$org_phone;
$companyBlockPositions=array( "10","23","62" );
$companyText=$org_address."\n".$org_city.", ".$org_state." ".$org_code." ".$org_country." ".$phone."\n".$org_website;
$pdf->addTextBlock( $org_name, $companyText ,$companyBlockPositions );
// ************** End company information *******************
// ************* Begin Top-Right Header ***************
// title
$titleBlock=array("147","7");
$pdf->title( $app_strings["PurchaseOrder"],"", $titleBlock );
$soBubble=array("168","17","12");
$pdf->addBubbleBlock($reqno, $app_strings["Req. No."], $soBubble);
$poBubble=array("114","17","12");
$pdf->addBubbleBlock($trno, $app_strings["Tracking No."], $poBubble);
// page number
$pageBubble=array("147","17",0);
$pdf->addBubbleBlock($page_num, $app_strings["Page"], $pageBubble);
// ************** End Top-Right Header *****************
// ************** Begin Addresses **************
// shipping Address
$shipLocation = array("147","40","61");
if(trim($ship_street)!='')
$shipText = $ship_street."\n";
if(trim($ship_city) !='')
$shipText .= $ship_city.", ";
if(trim($ship_state)!='' || trim($ship_code)!= '')
$shipText .= $ship_state." ".$ship_code."\n";
$shipText .=$ship_country;
$pdf->addTextBlock( $app_strings["Shipping Address"].":", $shipText, $shipLocation );
// billing Address
$billPositions = array("10","51","61");
if(trim($bill_street)!='')
$billText = $bill_street."\n";
if(trim($bill_city) !='')
$billText .= $bill_city.", ";
if(trim($bill_state)!='' || trim($bill_code)!= '')
$billText .= $bill_state." ".$bill_code."\n";
$billText .=$bill_country;
$pdf->addTextBlock($app_strings["Billing Address"].":",$billText, $billPositions);
// ********** End Addresses ******************
/* ******** Begin Invoice Data ************************ */
// issue date block
$issueBlock=array("80","37");
$pdf->addRecBlock(getDisplayDate(date("Y-m-d")), $app_strings["Issue Date"],$issueBlock);
// due date block
$dueBlock=array("81","52");
$pdf->addRecBlock($valid_till, $app_strings["Due Date"],$dueBlock);
// terms block
$termBlock=array("10","67");
$pdf->addRecBlock($vendor_name, $app_strings["Vendor Name"], $termBlock);
// Contact Name block
$conBlock=array("79","67");
$pdf->addRecBlock($contact_name, $app_strings["Contact Name"],$conBlock);
// vtiger_invoice number block
$invBlock=array("145","65");
$pdf->addRecBlock($po_no, $app_strings["PO Number"],$invBlock);
/* ************ End Invoice Data ************************ */
?>
@@ -0,0 +1,62 @@
<?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.
*
********************************************************************************/
// Fun with watermarks :)
$waterMarkPositions=array("60","110");
$waterMarkRotate=array("0","0","0");
$pdf->watermark( $app_strings["Thank You"], $waterMarkPositions, $waterMarkRotate );
$waterMarkPositions=array("30","130");
$pdf->watermark( $app_strings["For Your Business"], $waterMarkPositions, $waterMarkRotate );
// blowing bubbles
$Bubble=array("10","80","170","4");
$pdf->addBubble("", "", $Bubble);
$Bubble=array("168","131","12");
//$pdf->addBubbleBlock("Neat Look", "For A", $Bubble);
$Bubble=array("10","131","12");
//$pdf->addBubbleBlock("The Corners", "Line Up", $Bubble);
/* ************* Begin Totals ************************** */
$totalBlock=array("59","135");
$names=array($app_strings["Subtotal"],$app_strings["Tax"],$app_strings["Adjustment"],$app_strings["Total"]);
$totals=array($price_subtotal,$price_salestax,$price_adjustment,$price_total);
$pdf->addTotalsRec($names,$totals,$totalBlock);
/* ************* End Totals *************************** */
// lets add an image :)
$imageBlock=array("15","95","8","8");
$pdf->addImage( "sale.jpeg", $imageBlock);
$imageBlock=array("185","95","8","8");
$pdf->addImage( "sale.jpeg", $imageBlock);
// descriptions that change sizes!
$descc=count(explode("\n",$description));
$condc=count(explode("\n",$conditions));
if( (strlen($description) > 256) || (strlen($conditions) > 256) || $condc >6 || $descc > 6 )
$num=255;
else
$num=150;
/* **************** Begin Description ****************** */
$descBlock=array("10","160","53", $num);
$pdf->addDescBlock($description, $app_strings["Description"], $descBlock);
$termBlock=array("107","160","53", $num);
$pdf->addDescBlock($conditions, $app_strings["Terms & Conditions"], $termBlock);
/* ************** End Terms *********************** */
?>
@@ -0,0 +1,60 @@
<?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.
*
********************************************************************************/
// draw a broken line
$width=3;
$area=216;
$pad=2;
for ($i=10;$i<200;$i++) {
$linePos=array($i,$area,$width);
$pdf->drawLine($linePos);
$i = (($i+$width)+$pad)-1;
}
// company addy
if($org_phone != '')
$phone="\n".$app_strings["Phone"].": ".$org_phone;
if($org_fax != '')
$fax ="\n".$app_strings["Fax"].": ".$org_fax;
$companyBlockPositions=array( "10","220","60" );
$companyText=$org_address."\n".$org_city.", ".$org_state." ".$org_code." ".$org_country." ".$phone." ".$fax."\n".$org_website ;
$pdf->addTextBlock( $org_name, $companyText ,$companyBlockPositions );
// billing Address
$billPositions = array("85","235","60");
if(trim($bill_street)!='')
$billText = $bill_street."\n";
if(trim($bill_city) !='')
$billText .= $bill_city.", ";
if(trim($bill_state)!='' || trim($bill_code)!= '')
$billText .= $bill_state." ".$bill_code."\n";
$billText .=$bill_country;
$pdf->addTextBlock($app_strings["Billing Address"].":",$billText, $billPositions);
// totals
$totalBlock=array("145","235","10", "110");
$totalText=$app_strings["Subtotal"].": ".$price_subtotal."\n".
$app_strings["Tax"].": ".$price_salestax."\n".
$app_strings["Adjustment"].": ".$price_adjustment."\n".
$app_strings["Total"].": ".$price_total;
$pdf->addDescBlock($totalText, $app_strings["Total Due"], $totalBlock);
$blurbBlock=array("10","265","150", "60");
$blockText=$app_strings["Detach_Info"];
$pdf->addDescBlock($blockText, $app_strings["Instructions"], $blurbBlock);
?>
@@ -0,0 +1,47 @@
<?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/database/PearDatabase.php');
require_once('user_privileges/default_module_view.php');
global $adb, $singlepane_view, $currentModule;
$idlist = vtlib_purify($_REQUEST['idlist']);
$dest_mod = vtlib_purify($_REQUEST['destination_module']);
$parenttab = getParentTab();
$forCRMRecord = vtlib_purify($_REQUEST['parentid']);
if($singlepane_view == 'true')
$action = "DetailView";
else
$action = "CallRelatedList";
$storearray = array();
if(!empty($_REQUEST['idlist'])) {
// Split the string of ids
$storearray = explode (";",trim($idlist,";"));
} else if(!empty($_REQUEST['entityid'])){
$storearray = array($_REQUEST['entityid']);
}
$focus = CRMEntity::getInstance($currentModule);
foreach($storearray as $id)
{
if($id != '')
{
if($dest_mod == 'Documents')
$adb->pquery("insert into vtiger_senotesrel values (?,?)", array($forCRMRecord,$id));
else {
$focus->save_related_module($currentModule, $forCRMRecord, $dest_mod, $id);
}
}
}
header("Location: index.php?action=$action&module=$currentModule&record=".$forCRMRecord."&parenttab=".$parenttab);
?>