コード例 #1
0
ファイル: smsReceive.php プロジェクト: omusico/sugar_work
        if ($result['module'] == 'Cases') {
            $case_status = $GLOBALS["app_list_strings"]["case_status_dom"];
            foreach ($case_status as $k => $v) {
                if (strtolower($k) == strtolower($result['message'])) {
                    # update case status
                    $object->status = $k;
                    $object->save();
                    break;
                }
            }
        }
    } else {
        $parent_type = "";
        $parent_id = "";
        $assigned_user_id = "";
    }
    $sugartalk_SMS->name = $id . date(" (Y-m-d)", strtotime($stamp));
    $sugartalk_SMS->date_entered = $stamp;
    $sugartalk_SMS->description = $result['message'];
    //strips off the "sugartalk" keyword
    $sugartalk_SMS->type = "inbound";
    $sugartalk_SMS->phone_number = $msisdn;
    $sugartalk_SMS->provider = "sugartalk";
    $sugartalk_SMS->api_message = "Response received.";
    $sugartalk_SMS->delivery_status = "RECEIVED";
    $sugartalk_SMS->assigned_user_id = $assigned_user_id;
    $sugartalk_SMS->parent_type = $parent_type;
    $sugartalk_SMS->parent_id = $parent_id;
    $sugartalk_SMS->save();
    # # # # # # # # # END LOG TO DB # # # # # # # # #
}
コード例 #2
0
ファイル: sms.php プロジェクト: omusico/sugar_work
 function send_batch_message($to_array, $text)
 {
     global $current_user;
     $summary = $this->send_to_multi($to_array, $text);
     if (empty($summary)) {
         return 'ERROR';
     }
     # Сохраняем все (отправленные и не отправленные) смс
     if (sizeof($summary)) {
         foreach ($summary as $pid => $val) {
             $sugartalk_SMS = new sugartalk_SMS();
             $sugartalk_SMS->provider = 'sugartalk';
             $sugartalk_SMS->parent_type = $this->parent_type;
             $sugartalk_SMS->description = $text;
             $sugartalk_SMS->api_message = $val[0];
             $sugartalk_SMS->parent_id = $pid;
             $sugartalk_SMS->name = strlen($val[1]) ? $val[1] : "-no name-";
             $sugartalk_SMS->name .= " (" . date("Y-m-d") . ")";
             $sugartalk_SMS->phone_number = strlen($val[1]) ? $val[1] . " " : "-none-";
             $sugartalk_SMS->assigned_user_id = $current_user->id;
             $sugartalk_SMS->delivery_status = $val[0];
             $sugartalk_SMS->save();
         }
     }
     return $summary;
 }