[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 class Faq_Record_Model extends Vtiger_Record_Model { 12 13 /** 14 * Function to get Instance of Faq Record Model using TroubleTicket RecordModel 15 * @param HelpDesk_Record_Model 16 * @return Faq_Record_Model 17 */ 18 public static function getInstanceFromHelpDesk($parentRecordModel) { 19 $recordModel = Vtiger_Record_Model::getCleanInstance('Faq'); 20 $fieldMappingList = Faq_Record_Model::getTicketToFAQMappingFields(); 21 22 foreach ($fieldMappingList as $fieldMapping) { 23 $ticketField = $fieldMapping['ticketField']; 24 $faqField = $fieldMapping['faqField']; 25 if (!empty ($ticketField)) { 26 $faqData[$faqField] = $parentRecordModel->get($ticketField); 27 } else { 28 $faqData[$faqField] = $fieldMapping['defaultValue']; 29 } 30 } 31 $recordModel->setData($faqData); 32 33 //Updating the answer of Faq 34 $answer = $recordModel->get('faq_answer'); 35 if ($answer) { 36 $answer = vtranslate('LBL_SOLUTION', 'Faq').":\r\n".$answer; 37 } 38 39 $commentsList = $parentRecordModel->getCommentsList(); 40 if ($commentsList) { 41 $answer .= "\r\n\r\n".vtranslate('LBL_COMMENTS', 'Faq').":"; 42 foreach ($commentsList as $comment) { 43 $answer .= "\r\n$comment"; 44 } 45 } 46 $recordModel->set('faq_answer', $answer); 47 return $recordModel; 48 } 49 50 /** 51 * Function get List of Fields which are mapping from Truoble Tickets to FAQ 52 * @return <array> 53 */ 54 public static function getTicketToFAQMappingFields() { 55 return array( 56 array('ticketField'=>'ticket_title', 'faqField'=>'question', 'defaultValue'=>''), 57 array('ticketField'=>'product_id', 'faqField'=>'product_id', 'defaultValue'=>''), 58 array('ticketField'=>'solution', 'faqField'=>'faq_answer', 'defaultValue'=>''), 59 array('ticketField'=>'', 'faqField'=>'faqcategories', 'defaultValue'=>'General'), 60 array('ticketField'=>'', 'faqField'=>'faqstatus', 'defaultValue'=>'Draft') 61 ); 62 } 63 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |