Example #1
0
    }
    if ($cnt == 0) {
        \Sop\Log::warning(__FILE__, __LINE__, 'User tried to update non-existent group.');
        $msg001 = "This group already has been deleted.";
        // このグループは既に削除されています
        \Sop\Api::exitWithError(array($msg001));
    }
}
// ---------------------------
// データ登録
// ---------------------------
$db->beginTransaction();
if ($div == 'add') {
    // --- TBL: grp
    $grp_id = -1;
    $rslt = addGrp($db, $grp_id, $grp_name);
    if (!$rslt) {
        \Sop\Log::error(__FILE__, __LINE__, 'Failed to insert group.');
        $msg002 = "The registration failed.: grp";
        // 登録に失敗しました: grp
        \Sop\Api::exitWithError(array($msg002));
    }
}
if ($div == 'upd') {
    // --- TBL: grp
    $rslt = updGrp($db, $grp_id, $grp_name);
    if (!$rslt) {
        \Sop\Log::error(__FILE__, __LINE__, 'Failed to update group.');
        $msg003 = "The update failed.: grp";
        // 更新に失敗しました: grp
        \Sop\Api::exitWithError(array($msg003));
        ###Send the call###
        $result = $client->send($call);
        ###Check the returned value to see if it was successful and set it to a variable/display the results###
        if (!$result->faultCode()) {
            $conID = $result->value();
            print "Contact added was " . $conID;
            print "<BR>";
        } else {
            print $result->faultCode() . "<BR>";
            print $result->faultString() . "<BR>";
        }
        ################################################################################
        ###Check to see what tags/Follow up sequences were selected					 ###
        ################################################################################
        if (isset($_POST['news1'])) {
            addGrp($conID, 91);
        }
        if (isset($_POST['news2'])) {
            addGrp($conID, 92);
        }
        if (isset($_POST['camp1'])) {
            addCamp($conID, 21);
        }
        if (isset($_POST['camp2'])) {
            addCamp($conID, 23);
        }
    }
    ###Finally, lets alert them if they didnt post the required fields###
} else {
    echo "<script>alert('Be sure to fill out all required fields.');</script>";
}