Function tfgBackfillSnapshots

Data-preparation step for TFG/UFG reporting. Creates the missing R2_LOG_ZMIAN snapshots for reservations that are in reporting scope (contracts concluded from 1 July 2026, not older than 28 months) for a given branch, but that do not yet have any snapshot entry. For each such reservation it calls reservationLog (which is idempotent thanks to its own dedup, so the function can be re-run safely).

โ„น๏ธ
Run this BEFORE tfgGetReportFiles

The report (tfgGetReportFiles) only READS existing snapshots. This function was split out from the report so that the potentially heavy snapshot rebuild (many reservationLog calls, e.g. on a cold/empty base) does not run inside the report request. Run it once first; on a large empty base it may take a while.

Arguments

  • params :
        array (
              [ 'idCompany' ] = ''   // REQUIRED, branch id (= R2.ID_FIRMY)
            )
        

Returns

  • status - OK | FAIL
  • idCompany - the branch id used
  • backfilledSnapshots - number of snapshots created
  • warnings - soft warnings (e.g. a single reservation that failed to log)
  • errors - array of error records (code, message)

Example


  require_once ( 'classUddsOx.php' ) ;

  $udds = new classUddsOx ;
  $udds->customerCode = [your_customerCode] ;
  $udds->login = [your_login] ;
  $udds->password = [your_password] ;
  $udds->serverUrl = 'http://api.dlaoperatora.pl/udds/' ;

  $yourParams = array();
  $yourParams [ 'idCompany' ] = '21624' ;
  $ret = $udds->tfgBackfillSnapshots ( $yourParams ) ;


Returns $ret =
array ( 'status' => 'OK', 'idCompany' => '21624', 'backfilledSnapshots' => 56, 'errors' => array (), )