예제 #1
0
        $person = new Person($row2['username']);
        $history->setEnteredByPerson($person);
        $history->setActionPerson($person);
        $ticket->updateHistory($history);
    }
    //
    // responses go in issueHistory
    //
    $sql = "select r.date as date,r.notes as notes,\n        u.username as username, c.name as contactMethod\n\t\tfrom responses r\n        left join referrals rf on r.referral_id = rf.id\n        left join users u on r.user_id = u.id\n        left join contactMethods c on r.contactMethod_id = c.id\n\t\twhere rf.request_id=" . $row['id'];
    $result2 = $pdo->query($sql);
    while ($result2 && ($row2 = $result2->fetch(PDO::FETCH_ASSOC))) {
        $history = new History();
        $history->setAction('response');
        $history->setEnteredDate($row2['date']);
        $history->setActionDate($row2['date']);
        $history->setNotes($row2['notes']);
        $person = new Person($row2['username']);
        $history->setEnteredByPerson($person);
        $history->setActionPerson($person);
        $ticket->updateHistory($history);
    }
    try {
        $ticket->save();
        echo $ticket->getId() . " {$cnt}\n";
        $cnt++;
    } catch (Exception $e) {
        echo $e->getMessage() . "\n";
        print_r($e);
        exit;
    }
}
예제 #2
0
 try {
     $ticket->updateHistory($history);
 } catch (Exception $e) {
     // Any problems when creating the inspection, and we'll just not bother
     // to create it.  We're missing important information
     echo "Couldn't save inspection\n";
     echo $e->getMessage() . "\n";
     print_r($history);
     exit;
 }
 if ($row['followup_date']) {
     $history = new History();
     $history->setAction('followup');
     $history->setActionDate($row['followup_date']);
     $history->setEnteredDate($row['followup_date']);
     $history->setNotes("{$row['action_taken']}\n{$row['next_action']}");
     if ($lastPerson) {
         try {
             $history->setEnteredByPerson($lastPerson);
             $history->setActionPerson($lastPerson);
         } catch (Exception $e) {
             echo "Could not set a person for the followup\n";
             print_r($ticket);
             print_r($lastPerson);
             exit;
         }
     }
     try {
         $ticket->updateHistory($history);
     } catch (Exception $e) {
         // Anything that doesn't save, we're just going to ignore