Пример #1
0
 function getAgreement($agreementID)
 {
     if (!$agreementID) {
         throw new Exception("No Agreement ID Specified!", 1);
     }
     $cw = new cwAPI();
     $cw->setAction('GetAgreement');
     $options = array('id' => $agreementID);
     $cw->setParameters($options);
     return $cw->makeCall();
 }
Пример #2
0
    <div id="tabCwTix">
      <!-- API CW Tickets -->
      <h3>Open ConnectWise Tickets (Max 25 most recent)</h3>
      <table id='cwTix' class="stripe compact" cellspacing="0" width="100%">
      <thead>
        <tr>
          <th style='text-align:left;'>Ticket #</th>
          <th style='text-align:left;'>Summary</th>
          <th style='text-align:left;'>Status</th>
          <th style='text-align:left;'>Priority</th>
        </tr>
      </thead>
      <tbody>
        <?php 
$connectwise = new cwAPI();
$connectwise->setAction('FindServiceTickets');
$options = array('conditions' => 'CompanyId = ' . $recid, 'limit' => 25, 'isOpen' => true, 'orderBy' => 'EnteredDateUTC desc');
// Last 10 open tickets by age descending
$connectwise->setParameters($options);
$tix = $connectwise->makeCall();
foreach ($tix as $k => $v) {
    if (count($v->TicketFindResult) <= 24) {
        $cnt = count($v->TicketFindResult) - 1;
    } else {
        $cnt = 24;
    }
    for ($x = 0; $x <= $cnt; $x++) {
        $entDate = split("T", $v->TicketFindResult[$x]->EnteredDateUTC);
        $lastDate = split("T", $v->TicketFindResult[$x]->LastUpdatedUTC);
        if ($v->TicketFindResult[$x]->IsInSla === true) {