<?php
/**
 !! This file should be run if the Office Address was ever to change!
 This program will configure the distance of the client, as well as the travel time from this location, for each client.
 This information is stored to ensure that the planner takes less time to process with less calls the the DistanceMatrix API.
**/
include(__DIR__.'/../includes/sysinit.php');
include_once(SABLE_WORKING_PATH.'client/client.php');

$clients = $sableDB->getRows('select client.*, address.address
							from client 
							inner join address on address.address_id = client.address_id');
$count = 0;
$_client = new Client; //new class instance
foreach($clients as $client)
{
	$_client->hddnClientId				= $client['client_id'];
	$_client->edtClientName				= $client['client_name'];
	$_client->edtClientSurname			= $client['client_surname'];
	$_client->txtAddressId				= $client['address'];
	$_client->edtClientCell				= $client['client_cell'];
	$_client->edtClientPhone			= $client['client_phone'];
	$_client->edtClientEmail			= $client['client_phone'];
	$_client->addClient(true);
	$count++;
}
unset($_client);
echo($count.' client records updated.');