[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Potentials/Potentials.php,v 1.65 2005/04/28 08:08:27 rank Exp $ 17 * Description: TODO: To be written. 18 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 19 * All Rights Reserved. 20 * Contributor(s): ______________________________________.. 21 ********************************************************************************/ 22 23 include_once ('config.php'); 24 require_once ('include/logging.php'); 25 require_once ('include/database/PearDatabase.php'); 26 require_once ('data/SugarBean.php'); 27 require_once ('data/CRMEntity.php'); 28 require_once ('modules/Contacts/Contacts.php'); 29 require_once ('modules/Calendar/Activity.php'); 30 require_once ('modules/Notes/Notes.php'); 31 require_once ('modules/Emails/Emails.php'); 32 require_once ('include/utils/utils.php'); 33 require_once ('user_privileges/default_module_view.php'); 34 35 // vtiger_potential is used to store customer information. 36 class Potentials extends CRMEntity { 37 var $log; 38 var $db; 39 40 41 var $tab_name = Array('vtiger_crmentity','vtiger_potential','vtiger_potentialscf'); 42 var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_potential'=>'potentialid','vtiger_potentialscf'=>'potentialid'); 43 44 var $column_fields = Array(); 45 46 var $sortby_fields = Array('potentialname','amount','closingdate','smownerid'); 47 48 49 // This is the list of vtiger_fields that are in the lists. 50 var $list_fields = Array( 51 'Potential'=>Array('potential'=>'potentialname'), 52 'Account Name'=>Array('account'=>'accountname'), 53 'Sales Stage'=>Array('potential'=>'sales_stage'), 54 'Amount'=>Array('potential'=>'amount'), 55 'Expected Close'=>Array('potential'=>'closingdate'), 56 'Assigned To'=>Array('crmentity','smownerid') 57 ); 58 59 var $list_fields_name = Array( 60 'Potential'=>'potentialname', 61 'Account Name'=>'accountid', 62 'Sales Stage'=>'sales_stage', 63 'Amount'=>'amount', 64 'Expected Close'=>'closingdate', 65 'Assigned To'=>'assigned_user_id'); 66 67 var $list_link_field= 'potentialname'; 68 69 var $search_fields = Array( 70 'Potential'=>Array('potential'=>'potentialname'), 71 'Account Name'=>Array('potential'=>'accountid'), 72 'Expected Close'=>Array('potential'=>'closedate') 73 ); 74 75 var $search_fields_name = Array( 76 'Potential'=>'potentialname', 77 'Account Name'=>'account_id', 78 'Expected Close'=>'closingdate' 79 ); 80 81 var $required_fields = array( 82 "potentialname"=>1, 83 "account_id"=>1, 84 "closingdate"=>1, 85 "sales_stage"=>1, 86 "amount"=>1 87 ); 88 89 //Added these variables which are used as default order by and sortorder in ListView 90 var $default_order_by = 'potentialname'; 91 var $default_sort_order = 'ASC'; 92 93 function Potentials() { 94 $this->log = LoggerManager::getLogger('potential'); 95 $this->db = new PearDatabase(); 96 $this->column_fields = getColumnFields('Potentials'); 97 } 98 99 function save_module($module) 100 { 101 } 102 103 /** 104 * Function to get sort order 105 * return string $sorder - sortorder string either 'ASC' or 'DESC' 106 */ 107 function getSortOrder() 108 { 109 global $log; 110 $log->debug("Entering getSortOrder() method ..."); 111 if(isset($_REQUEST['sorder'])) 112 $sorder = $_REQUEST['sorder']; 113 else 114 $sorder = (($_SESSION['POTENTIALS_SORT_ORDER'] != '')?($_SESSION['POTENTIALS_SORT_ORDER']):($this->default_sort_order)); 115 $log->debug("Exiting getSortOrder() method ..."); 116 return $sorder; 117 } 118 119 /** 120 * Function to get order by 121 * return string $order_by - fieldname(eg: 'Potentialname') 122 */ 123 function getOrderBy() 124 { 125 global $log; 126 $log->debug("Entering getOrderBy() method ..."); 127 if (isset($_REQUEST['order_by'])) 128 $order_by = $_REQUEST['order_by']; 129 else 130 $order_by = (($_SESSION['POTENTIALS_ORDER_BY'] != '')?($_SESSION['POTENTIALS_ORDER_BY']):($this->default_order_by)); 131 $log->debug("Exiting getOrderBy method ..."); 132 return $order_by; 133 } 134 135 /** Function to create list query 136 * @param reference variable - order by is passed when the query is executed 137 * @param reference variable - where condition is passed when the query is executed 138 * Returns Query. 139 */ 140 function create_list_query($order_by, $where) 141 { 142 global $log; 143 $log->debug("Entering create_list_query(".$order_by.",". $where.") method ..."); 144 // Determine if the vtiger_account name is present in the where clause. 145 $account_required = ereg("accounts\.name", $where); 146 147 if($account_required) 148 { 149 $query = "SELECT vtiger_potential.potentialid, vtiger_potential.potentialname, vtiger_potential.dateclosed FROM vtiger_potential, vtiger_account "; 150 $where_auto = "account.accountid = vtiger_potential.accountid AND vtiger_crmentity.deleted=0 "; 151 } 152 else 153 { 154 $query = 'SELECT potentialid, potentialname, smcreatorid, closingdate FROM vtiger_potential inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_potential.potentialid '; 155 $where_auto = 'AND vtiger_crmentity.deleted=0'; 156 } 157 158 if($where != "") 159 $query .= "where $where ".$where_auto; 160 else 161 $query .= "where ".$where_auto; 162 163 if($order_by != "") 164 $query .= " ORDER BY vtiger_potential.$order_by"; 165 else 166 $query .= " ORDER BY vtiger_potential.potentialname"; 167 168 169 170 $log->debug("Exiting create_list_query method ..."); 171 return $query; 172 } 173 174 /** Function to export the Opportunities records in CSV Format 175 * @param reference variable - order by is passed when the query is executed 176 * @param reference variable - where condition is passed when the query is executed 177 * Returns Export Potentials Query. 178 */ 179 function create_export_query($order_by, $where) 180 { 181 global $log; 182 global $current_user; 183 $log->debug("Entering create_export_query(".$order_by.",". $where.") method ..."); 184 185 include ("include/utils/ExportUtils.php"); 186 187 //To get the Permitted fields query and the permitted fields list 188 $sql = getPermittedFieldsQuery("Potentials", "detail_view"); 189 $fields_list = getFieldsListFromQuery($sql); 190 191 $query = "SELECT $fields_list FROM vtiger_potential 192 inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_potential.potentialid 193 LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid=vtiger_users.id 194 LEFT JOIN vtiger_account on vtiger_potential.accountid=vtiger_account.accountid 195 LEFT JOIN vtiger_potentialscf on vtiger_potentialscf.potentialid=vtiger_potential.potentialid 196 LEFT JOIN vtiger_potentialgrouprelation 197 ON vtiger_potentialscf.potentialid = vtiger_potentialgrouprelation.potentialid 198 LEFT JOIN vtiger_groups 199 ON vtiger_groups.groupname = vtiger_potentialgrouprelation.groupname 200 LEFT JOIN vtiger_campaign 201 ON vtiger_campaign.campaignid = vtiger_potential.campaignid 202 203 where vtiger_crmentity.deleted=0 "; 204 205 require('user_privileges/user_privileges_'.$current_user->id.'.php'); 206 require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); 207 //we should add security check when the user has Private Access 208 if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[2] == 3) 209 { 210 //Added security check to get the permitted records only 211 $query = $query." ".getListViewSecurityParameter("Potentials"); 212 } 213 214 $log->debug("Exiting create_export_query method ..."); 215 return $query; 216 217 } 218 219 220 221 /** Returns a list of the associated contacts 222 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. 223 * All Rights Reserved.. 224 * Contributor(s): ______________________________________.. 225 */ 226 function get_contacts($id) 227 { 228 global $log, $singlepane_view; 229 $log->debug("Entering get_contacts(".$id.") method ..."); 230 global $app_strings; 231 232 $focus = new Contacts(); 233 234 $button = ''; 235 236 if(isPermitted("Contacts",3,"") == 'yes') 237 { 238 239 $button .= '<input title="Change" accessKey="" tabindex="2" type="button" class="button" value="'.$app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL'].'" name="Button" LANGUAGE=javascript onclick=\'return window.open("index.php?module=Contacts&action=Popup&return_module=Potentials&popuptype=detailview&form=EditView&form_submit=false&recordid='.$_REQUEST["record"].'","test","width=600,height=400,resizable=1,scrollbars=1");\'> '; 240 } 241 if($singlepane_view == 'true') 242 $returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id; 243 else 244 $returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id; 245 246 $query = 'select vtiger_contactdetails.accountid, vtiger_users.user_name,vtiger_groups.groupname,vtiger_potential.potentialid, vtiger_potential.potentialname, vtiger_contactdetails.contactid, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.title, vtiger_contactdetails.department, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_potential inner join vtiger_contpotentialrel on vtiger_contpotentialrel.potentialid = vtiger_potential.potentialid inner join vtiger_contactdetails on vtiger_contpotentialrel.contactid = vtiger_contactdetails.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid left join vtiger_contactgrouprelation on vtiger_contactdetails.contactid=vtiger_contactgrouprelation.contactid left join vtiger_groups on vtiger_groups.groupname=vtiger_contactgrouprelation.groupname left join vtiger_users on vtiger_crmentity.smownerid=vtiger_users.id where vtiger_potential.potentialid = '.$id.' and vtiger_crmentity.deleted=0'; 247 248 $log->debug("Exiting get_contacts method ..."); 249 return GetRelatedList('Potentials','Contacts',$focus,$query,$button,$returnset); 250 } 251 252 /** Returns a list of the associated calls 253 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. 254 * All Rights Reserved.. 255 * Contributor(s): ______________________________________.. 256 */ 257 function get_activities($id) 258 { 259 global $log, $singlepane_view; 260 $log->debug("Entering get_activities(".$id.") method ..."); 261 global $mod_strings; 262 263 $focus = new Activity(); 264 265 $button = ''; 266 267 if(isPermitted("Calendar",1,"") == 'yes') 268 { 269 270 $button .= '<input title="New Task" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.activity_mode.value=\'Task\';this.form.return_module.value=\'Potentials\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_TASK'].'"> '; 271 $button .= '<input title="New Event" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.return_module.value=\'Potentials\';this.form.activity_mode.value=\'Events\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_EVENT'].'"> '; 272 } 273 if($singlepane_view == 'true') 274 $returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id; 275 else 276 $returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id; 277 278 $query = "SELECT vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name, vtiger_recurringevents.recurringtype 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 inner join vtiger_potential on vtiger_potential.potentialid=vtiger_seactivityrel.crmid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid where vtiger_seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and vtiger_crmentity.deleted=0 and ((vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Deferred') or (vtiger_activity.eventstatus != '' && vtiger_activity.eventstatus != 'Held'))"; 279 $log->debug("Exiting get_activities method ..."); 280 return GetRelatedList('Potentials','Calendar',$focus,$query,$button,$returnset); 281 282 } 283 284 /** 285 * Function to get Contact related Products 286 * @param integer $id - contactid 287 * returns related Products record in array format 288 */ 289 function get_products($id) 290 { 291 global $log, $singlepane_view; 292 $log->debug("Entering get_products(".$id.") method ..."); 293 require_once ('modules/Products/Products.php'); 294 global $app_strings; 295 296 $focus = new Products(); 297 298 $button = ''; 299 300 if(isPermitted("Products",1,"") == 'yes') 301 { 302 303 304 $button .= '<input title="New Product" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Potentials\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_PRODUCT'].'"> '; 305 } 306 if(isPermitted("Products",3,"") == 'yes') 307 { 308 $button .= '<input title="Change" accessKey="" tabindex="2" type="button" class="button" value="'.$app_strings['LBL_SELECT_PRODUCT_BUTTON_LABEL'].'" name="Button" LANGUAGE=javascript onclick=\'return window.open("index.php?module=Products&action=Popup&return_module=Potentials&popuptype=detailview&form=EditView&form_submit=false&recordid='.$_REQUEST["record"].'","test","width=600,height=400,resizable=1,scrollbars=1");\'> '; 309 } 310 if($singlepane_view == 'true') 311 $returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id; 312 else 313 $returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id; 314 315 $query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid from vtiger_products inner join vtiger_seproductsrel on vtiger_products.productid = vtiger_seproductsrel.productid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid inner join vtiger_potential on vtiger_potential.potentialid = vtiger_seproductsrel.crmid where vtiger_potential.potentialid = '.$id.' and vtiger_crmentity.deleted = 0'; 316 $log->debug("Exiting get_products method ..."); 317 return GetRelatedList('Potentials','Products',$focus,$query,$button,$returnset); 318 } 319 320 /** Function used to get the Sales Stage history of the Potential 321 * @param $id - potentialid 322 * return $return_data - array with header and the entries in format Array('header'=>$header,'entries'=>$entries_list) where as $header and $entries_list are array which contains all the column values of an row 323 */ 324 function get_stage_history($id) 325 { 326 global $log; 327 $log->debug("Entering get_stage_history(".$id.") method ..."); 328 329 global $adb; 330 global $mod_strings; 331 global $app_strings; 332 333 $query = 'select vtiger_potstagehistory.*, vtiger_potential.potentialname from vtiger_potstagehistory inner join vtiger_potential on vtiger_potential.potentialid = vtiger_potstagehistory.potentialid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_potential.potentialid where vtiger_crmentity.deleted = 0 and vtiger_potential.potentialid = '.$id; 334 $result=$adb->query($query); 335 $noofrows = $adb->num_rows($result); 336 337 $header[] = $app_strings['LBL_AMOUNT']; 338 $header[] = $app_strings['LBL_SALES_STAGE']; 339 $header[] = $app_strings['LBL_PROBABILITY']; 340 $header[] = $app_strings['LBL_CLOSE_DATE']; 341 $header[] = $app_strings['LBL_LAST_MODIFIED']; 342 343 while($row = $adb->fetch_array($result)) 344 { 345 $entries = Array(); 346 347 $entries[] = $row['amount']; 348 $entries[] = $row['stage']; 349 $entries[] = $row['probability']; 350 $entries[] = getDisplayDate($row['closedate']); 351 $entries[] = getDisplayDate($row['lastmodified']); 352 353 $entries_list[] = $entries; 354 } 355 356 $return_data = Array('header'=>$header,'entries'=>$entries_list); 357 358 $log->debug("Exiting get_stage_history method ..."); 359 360 return $return_data; 361 } 362 363 /** 364 * Function to get Potential related Task & Event which have activity type Held, Completed or Deferred. 365 * @param integer $id 366 * returns related Task or Event record in array format 367 */ 368 function get_history($id) 369 { 370 global $log; 371 $log->debug("Entering get_history(".$id.") method ..."); 372 $query = "SELECT vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.status, 373 vtiger_activity.eventstatus, vtiger_activity.activitytype, vtiger_crmentity.modifiedtime, 374 vtiger_crmentity.createdtime, vtiger_crmentity.description, vtiger_users.user_name 375 from vtiger_activity 376 inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid 377 inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid 378 left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid 379 left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname 380 inner join vtiger_users on vtiger_crmentity.smcreatorid= vtiger_users.id 381 where (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task') 382 and (vtiger_activity.status = 'Completed' or vtiger_activity.status = 'Deferred' or (vtiger_activity.eventstatus = 'Held' and vtiger_activity.eventstatus != '')) 383 and vtiger_seactivityrel.crmid=".$id; 384 //Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php 385 386 $log->debug("Exiting get_history method ..."); 387 return getHistory('Potentials',$query,$id); 388 } 389 390 /** 391 * Function to get Potential related Attachments 392 * @param integer $id 393 * returns related Attachment record in array format 394 */ 395 function get_attachments($id) 396 { 397 global $log; 398 $log->debug("Entering get_attachments(".$id.") method ..."); 399 // Armando Lüscher 18.10.2005 -> §visibleDescription 400 // Desc: Inserted crm2.createdtime, vtiger_notes.notecontent description, vtiger_users.user_name 401 // Inserted inner join vtiger_users on crm2.smcreatorid= vtiger_users.id 402 $query = "select vtiger_notes.title,'Notes ' ActivityType, vtiger_notes.filename, 403 vtiger_attachments.type FileType, crm2.modifiedtime lastmodified, 404 vtiger_seattachmentsrel.attachmentsid, vtiger_notes.notesid crmid, 405 crm2.createdtime, vtiger_notes.notecontent description, vtiger_users.user_name 406 from vtiger_notes 407 inner join vtiger_senotesrel on vtiger_senotesrel.notesid= vtiger_notes.notesid 408 inner join vtiger_crmentity on vtiger_crmentity.crmid= vtiger_senotesrel.crmid 409 inner join vtiger_crmentity crm2 on crm2.crmid=vtiger_notes.notesid and crm2.deleted=0 410 left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid =vtiger_notes.notesid 411 left join vtiger_attachments on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid 412 inner join vtiger_users on crm2.smcreatorid= vtiger_users.id 413 where vtiger_crmentity.crmid=".$id; 414 $query .= ' union all '; 415 // Armando Lüscher 18.10.2005 -> §visibleDescription 416 // Desc: Inserted crm2.createdtime, vtiger_attachments.description, vtiger_users.user_name 417 // Inserted inner join vtiger_users on crm2.smcreatorid= vtiger_users.id 418 // Inserted order by createdtime desc 419 $query .= "select vtiger_attachments.description title ,'Attachments' ActivityType, 420 vtiger_attachments.name filename, vtiger_attachments.type FileType,crm2.modifiedtime lastmodified, 421 vtiger_attachments.attachmentsid, vtiger_seattachmentsrel.attachmentsid crmid, 422 crm2.createdtime, vtiger_attachments.description, vtiger_users.user_name 423 from vtiger_attachments 424 inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid= vtiger_attachments.attachmentsid 425 inner join vtiger_crmentity on vtiger_crmentity.crmid= vtiger_seattachmentsrel.crmid 426 inner join vtiger_crmentity crm2 on crm2.crmid=vtiger_attachments.attachmentsid 427 inner join vtiger_users on crm2.smcreatorid= vtiger_users.id 428 where vtiger_crmentity.crmid=".$id." 429 order by createdtime desc"; 430 431 $log->debug("Exiting get_attachments method ..."); 432 return getAttachmentsAndNotes('Potentials',$query,$id); 433 } 434 435 /** 436 * Function to get Potential related Quotes 437 * @param integer $id - potentialid 438 * returns related Quotes record in array format 439 */ 440 function get_quotes($id) 441 { 442 global $log, $singlepane_view; 443 $log->debug("Entering get_quotes(".$id.") method ..."); 444 global $app_strings; 445 require_once ('modules/Quotes/Quotes.php'); 446 447 if($this->column_fields['account_id']!='') 448 $focus = new Quotes(); 449 450 $button = ''; 451 if(isPermitted("Quotes",1,"") == 'yes') 452 { 453 $button .= '<input title="'.$app_strings['LBL_NEW_QUOTE_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_QUOTE_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Quotes\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_QUOTE_BUTTON'].'"> </td>'; 454 } 455 if($singlepane_view == 'true') 456 $returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id; 457 else 458 $returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id; 459 460 461 $query = "select vtiger_crmentity.*, vtiger_quotes.*, vtiger_potential.potentialname, vtiger_users.user_name from vtiger_quotes inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_quotes.quoteid left outer join vtiger_potential on vtiger_potential.potentialid=vtiger_quotes.potentialid left join vtiger_quotegrouprelation on vtiger_quotes.quoteid=vtiger_quotegrouprelation.quoteid left join vtiger_groups on vtiger_groups.groupname=vtiger_quotegrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 and vtiger_potential.potentialid=".$id; 462 $log->debug("Exiting get_quotes method ..."); 463 return GetRelatedList('Potentials','Quotes',$focus,$query,$button,$returnset); 464 } 465 466 /** 467 * Function to get Potential related SalesOrder 468 * @param integer $id - potentialid 469 * returns related SalesOrder record in array format 470 */ 471 function get_salesorder($id) 472 { 473 global $log, $singlepane_view; 474 $log->debug("Entering get_salesorder(".$id.") method ..."); 475 require_once ('modules/SalesOrder/SalesOrder.php'); 476 global $mod_strings; 477 global $app_strings; 478 479 $focus = new SalesOrder(); 480 481 $button = ''; 482 if(isPermitted("SalesOrder",1,"") == 'yes') 483 { 484 $button .= '<input title="'.$app_strings['LBL_NEW_SORDER_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_SORDER_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'SalesOrder\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_SORDER_BUTTON'].'"> </td>'; 485 } 486 487 if($singlepane_view == 'true') 488 $returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id; 489 else 490 $returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id; 491 492 493 $query = "select vtiger_crmentity.*, vtiger_salesorder.*, vtiger_quotes.subject as quotename, vtiger_account.accountname, vtiger_potential.potentialname from vtiger_salesorder inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_salesorder.salesorderid left outer join vtiger_quotes on vtiger_quotes.quoteid=vtiger_salesorder.quoteid left outer join vtiger_account on vtiger_account.accountid=vtiger_salesorder.accountid left outer join vtiger_potential on vtiger_potential.potentialid=vtiger_salesorder.potentialid left join vtiger_sogrouprelation on vtiger_salesorder.salesorderid=vtiger_sogrouprelation.salesorderid left join vtiger_groups on vtiger_groups.groupname=vtiger_sogrouprelation.groupname where vtiger_crmentity.deleted=0 and vtiger_potential.potentialid = ".$id; 494 $log->debug("Exiting get_salesorder method ..."); 495 return GetRelatedList('Potentials','SalesOrder',$focus,$query,$button,$returnset); 496 497 } 498 499 500 501 502 } 503 504 505 506 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |