I
I
igordata12020-04-01 08:35:36
1C-Bitrix
igordata1, 2020-04-01 08:35:36

Why is the application not cancelled?

<?php
 
require_once('rest_api.php');
 
$api_auth = [
    "name" => "", //названием магазина
    "user_num" => "1", // "1"
    "auth_secret_key" => "" //хук
];
 
$queryData = http_build_query(array(
    "filter" => [ "PHONE"=> $_POST['phone'] ],
    'select' => [ "ID", "TITLE", "status_id", "STATUS_SEMANTIC_ID" ]
));
 
$result = rest_api("list", $queryData, $api_auth);
if (array_key_exists('error', $result)) echo "Ошибка при получении лида: ".$result['error_description']."<br/>";
 
print_r($result);
echo "<br>||||||||||<br>";
print_r($result['result'][0]['ID']);
 
if ($result['result'][0]['ID']) {
    echo "<br>===========<br>";
    $queryData = http_build_query(array(
        "id" => $result['result'][0]['ID'],
        "fields" => [
            "status_id" => "JUNK"
        ],
        'params' => ["REGISTER_SONET_EVENT" => "Y"]
    ));
    $result = rest_api("update", $queryData, $api_auth);
    if (array_key_exists('error', $result)) echo "Ошибка при обновлении статуса: ".$result['error_description']."<br/>";
    echo "Статус успешно изменён";
 
    echo "<br><br>=======================<br>";
    print_r($result);
    echo "<br>========================<br><br>";
 
 
    $queryData = http_build_query(array(
        "filter" => [ "PHONE"=> $_POST['phone'] ],
        'select' => [ "ID", "TITLE", "status_id" ]
    ));
    $result = rest_api("list", $queryData, $api_auth);
    if (array_key_exists('error', $result)) echo "Ошибка при получении лида: ".$result['error_description']."<br/>";
 
    echo "<br>--------";
    print_r($result);
 
}
 
?>


<form action="remove.php" method="POST">
    <p>Телефон: <input type="phone" name="phone"></p>
    <p><input type="submit" value="Отменить заявку"></p>
</form>


Make it possible to cancel an appointment through the site. In this case, when you click on the button, the recording is canceled and the status in the cpm changes.

Array ( [result] => Array ( [0] => Array ( [ID] => 11 [TITLE] => Diagnostic ticket [STATUS_ID] => CONVERTED [STATUS_SEMANTIC_ID] => S ) ) [total] => 1 [time] => Array ( [start] => 1585719398.2468 [finish] => 1585719398.2787 [duration] => 0.031940221786499 [processing] => 0.0088760852813721 [date_start] => 2020-04-01T08:36:38 [+ date_finish] => 2020-04-01T08:36:38+03:00 ) )
||||||||||
11
===========
Status changed successfully

=======================
Array ( [result] => 1 [time] => Array ( [start] => 1585719398.4532 [finish] => 1585719398.657 [duration] => 0.20377206802368 [processing] => 0.18767380714417 [date_start] => 2020-084-01T0: 36:38+03:00 [date_finish] => 2020-04-01T08:36:38+03:00 ) )
======================= =

--------Array ( [result] => Array ( [0] => Array ( [ID] => 11 [TITLE] => Diagnostic ticket [STATUS_ID] => JUNK ) ) [total] => 1 [time] => Array ( [start] => 1585719398.8502 [finish] => 1585719398.8794 [duration] => 0.029161930084229 [processing] => 0.009382963180542 [date_start] => 2020-04-01T08+06 :00 [date_finish] => 2020-04-01T08:36:38+03:00 ) )

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question