[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
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 12 require_once ("modules/Faq/Faq.php"); 13 14 $focus = new FAQ(); 15 16 //Map the vtiger_fields like ticket column => vtiger_faq column where ticket column is the troubletikcets vtiger_field name & vtiger_faq - column_fields 17 $ticket_faq_mapping_fields = Array( 18 'title'=>'question', 19 'product_id'=>'product_id', 20 'description'=>'faq_answer', 21 //'ticketstatus'=>'faqstatus', 22 //'ticketcategories'=>'faqcategory' 23 ); 24 25 $sql = "select ticketid, title, product_id, description, solution,status, category from vtiger_troubletickets where ticketid=".$_REQUEST['record']; 26 $res = $adb->query($sql); 27 28 //set all the ticket values to FAQ 29 foreach($ticket_faq_mapping_fields as $ticket_column => $faq_column) 30 { 31 $focus->column_fields[$faq_column] = $adb->query_result($res,0,$ticket_column); 32 } 33 34 $focus->save("Faq"); 35 36 if($focus->id != '') 37 { 38 $description = $adb->query_result($res,0,'description'); 39 $solution = $adb->query_result($res,0,'solution'); 40 41 //Add the solution of the ticket with the FAQ answer 42 $answer = $description; 43 if($solution != '') 44 { 45 $answer .= '\r\n\r\nSOLUTION:\r\n'.$solution; 46 } 47 48 //Retrive the ticket comments from the vtiger_ticketcomments vtiger_table and added into the vtiger_faq answer 49 $sql = "select ticketid, comments, createdtime from vtiger_ticketcomments where ticketid=".$_REQUEST['record']; 50 $res = $adb->query($sql); 51 $noofrows = $adb->num_rows($res); 52 53 if($noofrows > 0) 54 $answer .= '\r\n\r\nCOMMENTS:'; 55 for($i=0; $i < $noofrows; $i++) 56 { 57 $comments = $adb->query_result($res,$i,'comments'); 58 if($comments != '') 59 { 60 $answer .= '\r\n'.$comments; 61 } 62 } 63 64 $sql1 = "update vtiger_faq set answer='".$answer."' where id=".$focus->id; 65 $adb->query($sql1); 66 } 67 68 header("Location:index.php?module=Faq&action=EditView&record=$focus->id&return_module=Faq&return_action=DetailView&return_id=$focus->id"); 69 70 ?>
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 |