function getZendBlockConent() { // echo $_GET['idprojecttask']; $do_project_task = new ProjectTask(); $idtask = $do_project_task->getTaskId($_GET['idprojecttask']); // echo $idtask; $data = $do_project_task->getProjectTaskDetailsByTaskId($idtask); //echo $data->getData('idproject'); $idproject = $data->getData('idproject'); //$idproject = $data['idproject']; //echo '-'.$idproject; $do_zend = new Zendesk(); if ($do_zend->zendeskProjectUserRelation($_SESSION['do_User']->iduser, $idproject)) { /*Ticket Block*/ $ticket = $do_zend->getZendTicketId($_SESSION['do_User']->iduser, $_GET['idprojecttask']); $ticket_id = $ticket['ticket']; if (!empty($ticket_id)) { $idzendesk_task_ticket_releation = $ticket['idzendesk_task_ticket_releation']; $output .= '<div style="position: relative;">'; $output .= '<b>Ticket ID: ' . $ticket_id . '</b>'; $e_remove_invitation = new Event("Zendesk->eventRemoveZendTicket"); $e_remove_invitation->addParam('idzendesk_task_ticket_releation', $idzendesk_task_ticket_releation); $e_remove_invitation->addParam("goto", "Task/" . $_SESSION['do_project_task']->idproject_task); $img_del = '<img src="/images/delete.gif" width="14px" height="14px" alt="" />'; $output .= '<div style="float:right;align:right;">' . $e_remove_invitation->getLink($img_del) . '</div>'; $output .= '</div><br /><br />'; } /* Ticket Block ends */ //$ticket_id = $do_zend->getZendTicketId($_SESSION['do_User']->iduser,$_GET['idprojecttask']); $output .= '<a href="#" onclick="showZBox();return false;">' . _('Add/Update Zendesk Ticket ID') . '</a>'; $output .= '<div id="task_zbox" style="display:none;">'; $e_zticket = new Event("Zendesk->eventAddZendTicket"); //$e_zticket->setLevel(160); $e_zticket->addParam("idproject", $idproject); $e_zticket->addParam("idproject_task", $_GET['idprojecttask']); $e_zticket->addParam("iduser", $_SESSION['do_User']->iduser); $e_zticket->addParam("goto", "Task/" . $_SESSION['do_project_task']->idproject_task); $output .= $e_zticket->getFormHeader(); $output .= $e_zticket->getFormEvent(); $output .= '<input type="text" name="z_ticket_id" id = "z_ticket_id" value= ' . $ticket_id . '>'; $output .= '<input value="' . _('Add Zend Ticket') . '" type="submit">'; $output .= $e_zticket->getFormFooter(); $output .= '<br /><br /><a href="#" onclick="hideZbox(); return false;">' . _('Hide') . '</a>'; $output .= '</div>'; } return $output; }
public function testDeleteTicket() { $this->assertEquals(200, $this->call('post', 'v1/tickets/', factory(Ticket::class)->make()->toarray())->status()); //add ticket $ticket = Ticket::orderBy('id', 'desc')->first(); $ticketId = $ticket->id; $zendeskTicketId = $ticket->zendesk_ticket_id; $this->assertEquals(200, $this->call('delete', 'v1/tickets/' . $ticketId)->status()); //find and delete $updatedTicketStatus = 404; if (Zendesk::tickets($zendeskTicketId)->find()->ticket->status == "solved") { $updatedTicketStatus = 200; } $this->assertEquals(200, $updatedTicketStatus); Zendesk::ticket($zendeskTicketId)->delete(); //delete ticket after $this->assertEquals(404, $this->call('delete', 'v1/tickets/' . $ticketId)->status()); //find deleted one }
Copyright (c) 2011 D. Keith Casey Jr. "caseysoftware" Copyright (c) 2015 Artjoms Petrovs "ArtyCo" */ include 'Zendesk.lib.php'; ini_set('display_errors', 0); error_reporting(0); define("ZD_SITE", 'xxxxx.zendesk.com'); define("ZD_USER", '*****@*****.**'); define("ZD_PASS", 'xxxxxxxx'); define("ZD_FIELD", 'xxxxxxxx'); define("PLACEHOLDEREMAIL", ZD_USER); define("EMAIL_DOMAIN", 'youremaildomain.com'); if (isset($_REQUEST)) { $from = isset($_REQUEST['From']) ? urldecode($_REQUEST['From']) : 'bad phone number'; $body = isset($_REQUEST['Body']) ? $_REQUEST['Body'] : 'An error occured from this number: ' . $from; $zd = new Zendesk(ZD_SITE, ZD_USER, ZD_PASS); $from = urlencode($from); $from_search = str_replace('+', '', $from); $result = $zd->get(ZENDESK_SEARCH, array('query' => "query=type:ticket+status:new+status:open+" . "status:pending+order_by:updated_at+sort:desc+" . "fieldvalue:{$from_search}")); //echo $result; $result = json_decode($result); //var_dump( $result ); //$attr = $xml->attributes(); if ($result->count > 0) { //print_r($result->results); $first_ticket = $result->results[0]; $ticket_id = $first_ticket->id; // incoming sms has the same From as an open ticket, just append $result = $zd->update(ZENDESK_TICKETS, array('details' => array('is-public' => true, 'comment' => array("body" => $body, "public" => "true"), 'subject' => substr($body, 0, 80)), 'id' => $ticket_id)); } else { // incoming sms has a new From, so create a new ticket
var zend_url = $('#zend_url').val(); var zend_email = $('#zend_email').val(); var zend_api = $('#zend_api').val(); var idproject = $( "#idproject" ).val(); if((zend_url == '') || (zend_email == '') || (zend_api == '') || (idproject == '')){ alert('Please fill in all the details metioned.'); event.preventDefault(); } }); }); </script> <?php $iduser = $_SESSION['do_User']->iduser; $do_zend = new Zendesk(); $data = $do_zend->GetUserZendeskDetails($iduser); ?> <?php if (isset($_SESSION['msg'])) { ?> <div id="msg"><?php echo $_SESSION['msg']; ?> </div> <?php $_SESSION['msg'] = ''; unset($_SESSION['msg']); } ?> <?php
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::group(['prefix' => 'v1'], function () { Route::get('/tickets', 'TicketController@index'); Route::get('/tickets/{id}', 'TicketController@getIndividual'); Route::post('/tickets', 'TicketController@create'); Route::delete('/tickets/{id}', 'TicketController@delete'); Route::get('/statistic', 'TicketController@getStatistic'); }); Route::get('/', function () { var_dump(Zendesk::tickets(63699)->find()->ticket->status); });
<?php if ($_SESSION["do_project"]->status != 'closed') { /** Discussion Add form starts here */ if ($task_operation_access === true) { $_SESSION['ProjectDiscussEditSave']->setLogRun(true); $e_addProjectDiscuss = $_SESSION['ProjectDiscussEditSave']->newForm('ProjectDiscussEditSave->eventAdd'); $e_addProjectDiscuss->setLevel(123); $e_addProjectDiscuss->setGotFile(true); $e_addProjectDiscuss->addEventAction('mydb.gotoPage', 90); //$e_addProjectDiscuss->addEventAction('ProjectDiscussEditSave->eventFormatDiscussInsert', 119); $e_addProjectDiscuss->addEventAction('ProjectDiscussEditSave->eventHTMLCleanUp ', 119); $e_addProjectDiscuss->addEventAction('ProjectDiscussEditSave->eventSendDiscussMessageByEmail', 131); $e_addProjectDiscuss->addEventAction('WorkFeedProjectDiscuss->eventAddFeed', 140); $do_zend = new Zendesk(); $t_data = $do_zend->getZendTicketId($_SESSION['do_User']->iduser, $idproject_task); if ($t_data['ticket'] != '') { $e_addProjectDiscuss->addEventAction('Zendesk->eventAddZendeskNote', 160); $e_addProjectDiscuss->addParam('z_ticket', $t_data['ticket']); $e_addProjectDiscuss->addParam('z_iduser', $_SESSION['do_User']->iduser); $e_addProjectDiscuss->addParam('z_idproject', $_SESSION['do_project']->idproject); } $e_addProjectDiscuss->addParam('goto', $return_page); $e_addProjectDiscuss->addParam('errPage', 'Task/' . $idproject_task); $discussFields = new FieldsForm('ofuz_add_project_discuss'); echo $e_addProjectDiscuss->getFormHeader(); echo $e_addProjectDiscuss->getFormEvent(); // display the note text field: echo $discussFields->discuss; //hidden fields