*    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *
*
* program cte dbf stravniku a v tabulce clients je znehodnoti
*
*     REPLACE ALL usr_2name WITH chip_id, usr_1name WITH card_id
*     REPLACE FOR status = "N" expiration WITH "2020-02-02"
*
*
*    *    *    *    *    *    *    *    *    *    *    *      #> ver. 2022-02-14 <#       *    *    *    *    *    *    *    *    *    *    *    *    *


HTTP_READ_ONLY_MODE = .F.

DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@friends-backend.production-d.asrv.cz/"

ACTIVATE SCREEN 
_screen.Cls

USE i:\clients_to_delete
DO posli_cloveky


*    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *
PROCEDURE posli_cloveky
SCAN 
    SCATTER MEMVAR 
    ?? "."

    client_req = '{"status":"N", "client_id":"[OSC]", "card_id":"[CARD]", "chip_id":"[CHIP]",  "comment":"smazano 22-02-14" }'

    client_req = STRTRAN(m.client_req, '[OSC]'  , 'ZZ' + ALLTRIM(client_id))
    client_req = STRTRAN(m.client_req, '[CARD]' , 'ZZ' + ALLTRIM(  card_id))
    client_req = STRTRAN(m.client_req, '[CHIP]' , 'ZZ' + ALLTRIM(  chip_id))

*    client_req = STRTRAN(m.client_req, '[OSC]'  , "ZZ" + ALLTRIM(client_id))
*    client_req = STRTRAN(m.client_req, '[CHIP]' , "ZZ" + ALLTRIM(chip_id  ))
*    client_req = STRTRAN(m.client_req, '[CARD]' , "ZZ" + ALLTRIM(chip_id  ))


    json = http_request("kredit/crud/clients/" + ALLTRIM(STR(id)), "PATCH", m.client_req)

ENDSCAN 
