예제 #1
0
 public function takeawayInsert(UploadDTO\TakeawayUploadDto $takeawayRequest, $restaurantId)
 {
     try {
         $tableObj = $this->connect();
         $newEntity = $tableObj->newEntity();
         $newEntity->TakeawayId = $takeawayRequest->takeawayId;
         $newEntity->TakeawayNo = $takeawayRequest->takeawayNo;
         $newEntity->Discount = $takeawayRequest->discount;
         $newEntity->DeliveryCharges = $takeawayRequest->deliveryCharges;
         $newEntity->CustId = $takeawayRequest->custId;
         $newEntity->RestaurantId = $restaurantId;
         $newEntity->UserId = $takeawayRequest->userId;
         $newEntity->SourceId = $takeawayRequest->sourceId;
         $newEntity->CreatedDate = date(VB_DATE_TIME_FORMAT);
         $newEntity->UpdatedDate = date(VB_DATE_TIME_FORMAT);
         if ($tableObj->save($newEntity)) {
             Log::debug('Takeaway entry stored for custId :- ' . $takeawayRequest->custId);
             return $takeawayRequest->takeawayNo;
         }
         Log::error('Takeaway entry stored for custId :- ' . $takeawayRequest->custId);
         return FALSE;
     } catch (Exception $ex) {
         return FALSE;
     }
 }
예제 #2
0
 public function index()
 {
     $this->autoRender = false;
     $userId = $this->request->query("userId");
     $restaurantId = $this->request->query("restaurantId");
     \Cake\Log\Log::debug("Download request come with userId  :- " . $userId . ' restaurantId :- ' . $restaurantId);
     if (empty($userId) or empty($restaurantId)) {
         $this->response->body(DTO\ErrorDto::prepareError(101));
         \Cake\Log\Log::error("userId or restaurantID is blank ");
         return;
     }
     $restaurantController = new RestaurantController();
     if (!$restaurantController->isValidate($restaurantId)) {
         $this->response->body(DTO\ErrorDto::prepareError(100));
         \Cake\Log\Log::error("request with incorrect restaurantId :- " . $restaurantId);
         return;
     }
     $userController = new UserController();
     if (!$userController->isUserValid($userId, $restaurantId)) {
         $this->response->body(DTO\ErrorDto::prepareError(102));
         \Cake\Log\Log::error("request with incorrect  userId :- " . $userId);
         return;
     }
     \Cake\Log\Log::debug('Download request is validate successfully ');
     $syncController = new SyncController();
     $syncController->download($userId, $restaurantId);
 }
 public function saveNetworkDeviceInfo(DTO\ClsNetworkDeviceInfoDto $infoDto)
 {
     if ($infoDto and !$this->isPresent($infoDto->userId)) {
         $entity = $this->connect()->newEntity();
         $entity->UserId = $infoDto->userId;
         $entity->Board = $infoDto->board;
         $entity->Brand = $infoDto->brand;
         $entity->Manufacturer = $infoDto->manufacturer;
         $entity->Model = $infoDto->model;
         $entity->Product = $infoDto->product;
         $entity->FmVersion = $infoDto->fmVersion;
         $entity->IpAddress = $infoDto->ip;
         $entity->City = $infoDto->city;
         $entity->Region = $infoDto->region;
         $entity->Country = $infoDto->country;
         if ($this->connect()->save($entity)) {
             \Cake\Log\Log::debug("User Network Device Info save in database for userid : " . $infoDto->userId);
             return SUCCESS;
         }
         \Cake\Log\Log::error("User Network Device Info not save in database for userid : " . $infoDto->userId);
         return FAIL;
     }
     \Cake\Log\Log::error(" userid : " . $infoDto->userId . " record exist in database");
     return FAIL;
 }
 public function customerVisitReport()
 {
     $this->autoRender = false;
     $restaurantId = $this->request->query('id');
     \Cake\Log\Log::debug('Ajax request visited with RestaurantId :-' . $restaurantId);
     $customerVisitReportData = $this->getTableObj()->getdata($restaurantId);
     if (is_null($customerVisitReportData)) {
         $this->response->body(0);
         return;
     }
     $intermediate = [];
     foreach ($this->objKey as $key => $value) {
         $intermediate[$value] = 0;
     }
     foreach ($customerVisitReportData as $reportData) {
         for ($i = 0; $i < count($this->timeSlot); $i++) {
             $index = $this->objKey[$i];
             $intermediate[$index] = $intermediate[$index] + $reportData->{$index};
         }
     }
     $data[] = null;
     $ind = 0;
     foreach ($intermediate as $key => $value) {
         $data[$ind++] = new DownloadDTO\RushHourReportDto($value, $this->timeSlot[$key], $this->timeSlot[$key]);
     }
     $chartData = json_encode($data);
     $this->response->body($chartData);
 }
예제 #5
0
 public function ajustabase()
 {
     $Usuario = TableRegistry::get("usuario");
     $Categoria = TableRegistry::get("categoria");
     $usuarios = $Usuario->find()->where(['usuario.historico' => 0, 'usuario.pendente' => 0, 'usuario.idUsuario is not' => 0]);
     $ldap = new LDAP(3);
     $res = array();
     $res_ldap = array();
     $cats = array();
     foreach ($usuarios as $usuario) {
         $obj = $ldap->getUsers("(uid=*{$usuario->login}*)");
         Log::debug($obj);
         $usuario->nomeUsuario = $obj[0]["cn"][0];
         $usuario->dre = isset($obj[0]["smtdre"][0]) ? $obj[0]["smtdre"][0] : '';
         $usuario->logradouro = isset($obj[0]["street"][0]) ? $obj[0]["street"][0] : '';
         $usuario->complemento = isset($obj[0]["smtcomplemento"][0]) ? $obj[0]["smtcomplemento"][0] : '';
         $usuario->cidade = isset($obj[0]["smtcidade"][0]) ? $obj[0]["smtcidade"][0] : '';
         $usuario->bairro = isset($obj[0]["smtbairro"][0]) ? $obj[0]["smtbairro"][0] : '';
         $usuario->pais = isset($obj[0]["smtpais"][0]) ? $obj[0]["smtpais"][0] : '';
         $usuario->estado = isset($obj[0]["smtuf"][0]) ? $obj[0]["smtuf"][0] : '';
         $usuario->codigoPostal = isset($obj[0]["homepostaladdress"][0]) ? $obj[0]["homepostaladdress"][0] : '';
         $usuario->rg = isset($obj[0]['smtrg'][0]) ? $obj[0]['smtrg'][0] : '';
         $usuario->cpf = isset($obj[0]['smtcpf'][0]) ? $this->formataCpf($obj[0]['smtcpf'][0]) : '';
         $usuario->email = isset($obj[0]['mail'][0]) ? $obj[0]['mail'][0] : '';
         $usuario->tel_fixo = isset($obj[0]['telephonenumber'][0]) ? $obj[0]['telephonenumber'][0] : '';
         $usuario->tel_cel = isset($obj[0]['mobile'][0]) ? $obj[0]['mobile'][0] : '';
         $nascimento = isset($obj[0]['smtnascimento'][0]) ? $obj[0]['smtnascimento'][0] : '19000101';
         $usuario->data_nascimento = substr($nascimento, 6, 2) . '/' . substr($nascimento, 4, 2) . '/' . substr($nascimento, 0, 4);
         $usuario->data_exp = isset($obj[0]['smtdataexpiracao'][0]) ? $obj[0]['smtdataexpiracao'][0] : '';
         $usuario->cadastro = isset($obj[0]['smtdatacadastro'][0]) ? $obj[0]['smtdatacadastro'][0] : '';
         //$usuario->ativo = (isset($obj[0]['smtbool'][0])) ? ($obj[0]['smtbool'][0] == 'FALSE') ? false :  true : '';
         $loginResp = str_replace('uid=', '', explode(',', $obj[0]['smtprofresp'][0])[0]);
         $id = $Usuario->find()->where(['login' => $loginResp, 'idTipoUsuario' => 2]);
         if ($id->count() > 0) {
             $usuario->profResponsavel = $id->first()->idUsuario;
         }
         if (isset($obj[0]['smtgroups'])) {
             foreach ($obj[0]['smtgroups'] as $grupo) {
                 $busca = $Usuario->Projeto->find('all', ['conditions' => ['grupo' => "{$grupo}"]]);
                 $number = $busca->count();
                 if ($number > 0) {
                     $proj = $Usuario->Projeto->find()->where(['grupo' => "{$grupo}"])->first();
                     $usuario->idProjeto = $proj->idprojeto;
                     break;
                 }
             }
         }
         if (isset($obj[0]['smtcategoria'])) {
             $cat = $Categoria->find('all')->where(['upper(nomeCategoria)' => strtoupper($obj[0]['smtcategoria'][0])])->first();
             $usuario->idCategoria = $cat->idCategoria;
         }
         array_push($res_ldap, $obj);
         array_push($res, $usuario);
         array_push($cats, $cat);
         $Usuario->save($usuario);
     }
     $aviso = new Email('gmail');
     $aviso->from(['*****@*****.**' => 'Controle de Usuarios'])->emailFormat('html')->to('*****@*****.**')->subject('JOB Realizado')->send('Job Ajuste Base executado com sucesso.');
     $this->set(compact('res', 'res_ldap', 'cats'));
 }
 public function userSignUp($userId)
 {
     if ($this->getTableObj()->insertUser($userId)) {
         \Cake\Log\Log::debug('temp Userid inserted');
         return SUCCESS;
     }
     return FAIL;
 }
예제 #7
0
 public function check($restaurantId)
 {
     $conditions = ['RestaurantId =' => $restaurantId, 'Active =' => ACTIVE];
     $result = $this->connect()->find()->where($conditions);
     if ($result->count()) {
         \Cake\Log\Log::debug('restaurant checking result = ' . $result->count());
         return true;
     }
     return false;
 }
 /**
  * Hands authorization over to the AnnAuthorize class.
  * @param array $user
  *         An array containing information about the user to authorize.
  * @param Request $request
  *         Describes the request to authorize.
  */
 public function authorize($user, Request $request)
 {
     $controller = $this->_registry->getController();
     $action = $request->param('action');
     $pass = $request->param('pass');
     Log::debug(sprintf('Trying to authorize user %s for request %s/%s and parameters %s.', $user['username'], $controller->name, $action, json_encode($pass)));
     $annAuthorization = AnnAuthorization::getInstance();
     $authorized = $annAuthorization->authorizeRequest($user['id'], $controller, $action, $pass, $request);
     Log::debug(sprintf('Authorization %s', $authorized ? 'was successful.' : 'failed.'));
     return $authorized;
 }
 /**
  * @param $method
  * @param array $data
  * @return \Cake\Network\Http\Response
  */
 protected function getData($method = '', $data = [])
 {
     $query = ['version' => 1.3, 'key' => $this->_API_KEY];
     foreach ($data as $key => $value) {
         $query[$key] = $value;
     }
     Log::debug($query);
     $response = $this->http->get($this->_SERVER . $method, $query);
     Log::debug($response->body);
     return $response->json;
 }
예제 #10
0
 public function isLogin()
 {
     $userName = $this->readCookie('un');
     $password = $this->readCookie('pw');
     $restaurantId = $this->readCookie('cri');
     \Cake\Log\Log::debug('request come to check login');
     if (isset($userName) and isset($password) and isset($restaurantId)) {
         return TRUE;
     }
     return FALSE;
 }
 public function getPaymentOptions()
 {
     $this->autoRender = FALSE;
     if ($this->request->is('post')) {
         $data = $this->getPaymetModes();
         Log::debug(json_encode($data));
         $this->response->body(json_encode($data));
     } else {
         $this->response->body(0);
     }
 }
예제 #12
0
 public function getOrderDetails($orderDetailsId)
 {
     $conditions = ['OrderDetailsId =' => $orderDetailsId];
     $orderDetails = $this->connect()->find()->where($conditions);
     if ($orderDetails->count()) {
         foreach ($orderDetails as $orderDetail) {
             $orderDetailDto = new DownloadDTO\OrderDetailsDownloadDto($orderDetail->OrderDetailsId, $orderDetail->OrderPrice, $orderDetail->OrderQuantity, $orderDetail->OrderId, $orderDetail->MenuId, $orderDetail->SubMenuId, $orderDetail->MenuTitle, $orderDetail->Note);
             Log::debug('OrderDetails goes in sync Table : Id -> ' . $orderDetailDto->orderDetailsId);
         }
         return $orderDetailDto;
     }
 }
 public function editWhenAlways($id)
 {
     $entity = $this->Ips->get($id);
     /** @var IpBehavior $behavior */
     $this->Ips->removeBehavior('Ip');
     Log::debug($this->Ips->behaviors()->loaded());
     $this->Ips->addBehavior('IpBehavior.Ip', ['fields' => ['ip' => 'always']]);
     if ($this->request->is(['post', 'put'])) {
         $entity = $this->Ips->patchEntity($entity, $this->request->data());
         $this->Ips->save($entity);
     }
 }
예제 #14
0
 public function takeawayView()
 {
     $data = explode('/', $this->request->url);
     Log::debug($data);
     $set = ['option' => $data[1]];
     if (in_array('placeorder', $data)) {
         $takeawaySourceController = new TakeawaySourceController();
         $set['source'] = $takeawaySourceController->getTakeawaySource();
         $set['addNew'] = true;
     }
     $this->set($set);
 }
예제 #15
0
 public function getSingleCategory($categoryId)
 {
     $condition = ['TableCategoryId' => $categoryId];
     $tableCategories = $this->connect()->find()->where($condition);
     if (!$tableCategories->count()) {
         Log::debug('Table Categories are not found');
         return false;
     }
     foreach ($tableCategories as $category) {
         $tableCategoryDto = new DownloadDTO\TableCategoryDownloadDto($category->TableCategoryId, $category->CategoryTitle, $category->Image);
     }
     return $tableCategoryDto;
 }
예제 #16
0
 public function getStdRooms($restaurantId)
 {
     \Cake\Log\Log::debug('current restaurantId is :-' . $restaurantId);
     $allRooms = $this->getTableObj()->getRooms($restaurantId);
     if ($allRooms) {
         $mRoom = new \stdClass();
         foreach ($allRooms as $room) {
             $key = $room->roomId;
             $mRoom->{$key} = $room->description;
         }
         return $mRoom;
     }
     return FALSE;
 }
예제 #17
0
 /**
  * Authentication hook to authenticate a user against an LDAP server.
  *
  * @param \Cake\Network\Request $request The request that contains login information.
  * @param \Cake\Network\Response $response Unused response object.
  * @return mixed False on login failure.  An array of User data on success.
  */
 public function authenticate(Request $request, Response $response)
 {
     // This will probably be cn or an email field to search for
     Log::debug("[Yalp.authenticate] Authentication started", 'yalp');
     $userField = $this->form_fields['username'];
     $passField = $this->form_fields['password'];
     $userModel = $this->config('userModel');
     list($plugin, $model) = pluginSplit($userModel);
     // Definitely not authenticated if we haven't got the request data...
     if (!isset($request->data[$userModel])) {
         Log::error("[Yalp.authenticate] No request data, cannot authenticate", 'yalp');
         return false;
     }
     // We need to know the username, or email, or some other unique ID
     $submittedDetails = $request->data[$userModel];
     if (!isset($submittedDetails[$userField])) {
         //Log::write('yalp', "[Yalp.authenticate] No username supplied, cannot authenticate");
         return false;
     }
     // Make sure it's a valid string...
     $username = $submittedDetails[$userField];
     if (!is_string($username)) {
         Log::error("[Yalp.authenticate] Invalid username, cannot authenticate", 'yalp');
         return false;
     }
     // Make sure they gave us a password too...
     $password = $submittedDetails[$passField];
     if (!is_string($password) || empty($password)) {
         Log::error("[Yalp.authenticate] Invalid password, cannot authenticate", 'yalp');
         return false;
     }
     // Check whether or not user exists on LDAP
     if (!$this->Yalp->validateUser($username, $password)) {
         Log::error("[Yalp.authenticate] User '{$username}' could not be found on LDAP", 'yalp');
         return false;
     } else {
         Log::debug("[Yalp.authenticate] User '{$username}' was found on LDAP", 'yalp');
     }
     // Check on DB
     $comparison = 'LOWER(' . $model . '.' . $userField . ')';
     $conditions = array($comparison => strtolower($username));
     $dbUser = TableRegistry::get($userModel)->find('all', array('conditions' => $conditions, 'recursive' => false))->first();
     // If we couldn't find them in the database, warn and fail
     if (empty($dbUser)) {
         Log::warning("[Yalp.authenticate] Could not find a database entry for {$username}", 'yalp');
         return false;
     }
     // ...and return the user object.
     return $dbUser->toArray();
 }
예제 #18
0
 public function deleteCustomer(UploadDTO\CustomerUploadDto $customerInfo, $userInfo)
 {
     $conditions = ['CustId =' => $customerInfo->custId, 'RestaurantId =' => $userInfo->restaurantId];
     try {
         $delete = $this->connect()->deleteAll($conditions);
         if ($delete) {
             Log::debug('Waiting Customer' . $customerInfo->custName . ' deleted from customer table');
             return true;
         }
         Log::error('Error Occured in customer table during customer deletion');
         return false;
     } catch (Exception $ex) {
         return false;
     }
 }
예제 #19
0
 public function Create($id)
 {
     $returnValue = false;
     $dbDir = new Folder(SQLITE_DB_DIR, true);
     \Cake\Log\Log::debug('folder created');
     $this->sqliteFile = $dbDir->path . 'TravelDb' . $id . '.sqlite';
     $db = new \SQLite3($this->sqliteFile);
     if ($db != NULL) {
         $fileContents = file_get_contents(__DIR__ . DS . 'CreateTableScripts.sql');
         $db->exec($fileContents);
         $db->close();
         $returnValue = true;
     }
     return $returnValue;
 }
예제 #20
0
 public function getRestaurants($adminId)
 {
     $result = null;
     $counter = 0;
     if ($adminId) {
         $conditions = ['AdminUserId' => $adminId];
         $restaurants = $this->connect()->find()->where($conditions);
         foreach ($restaurants as $restaurant) {
             $result[$counter] = $restaurant->RestaurantId;
             $counter++;
         }
         Log::debug('Admin information send');
     }
     return $result;
 }
예제 #21
0
 public function isStockClose($day, $month, $year, $restaurantId)
 {
     $condtions = ['Day =' => $day, 'Month' => $month, 'Year' => $year, 'RestaurantId =' => $restaurantId];
     $fields = ['Closing'];
     try {
         $result = $this->connect()->find('all', array('fields' => $fields, 'conditions' => $condtions))->orderAsc('StockLevelId')->first()->toArray();
         Log::debug($result);
         if (!is_null($result['Closing'])) {
             return True;
         }
         return FALSE;
     } catch (Exception $ex) {
         return false;
     }
 }
 public function getTransactionReport()
 {
     $this->autoRender = FALSE;
     $restaurantId = $this->request->query('id');
     if ($this->request->is('post')) {
         Log::debug('Thiis request is post');
     }
     $transactionDetailsController = new TransactionDetailsController();
     $reportData = $transactionDetailsController->generateReport($restaurantId);
     if (count($reportData)) {
         $response = json_encode($reportData);
     } else {
         $response = 0;
     }
     $this->response->body($response);
 }
예제 #23
0
 public function updateConfig($key, $value)
 {
     try {
         $query = $this->connect()->query();
         $update = $query->update();
         $update->set(['ConfigValue' => $value]);
         $update->where(['ConfigKey =' => $key]);
         if ($update->execute()) {
             \Cake\Log\Log::debug("config updated key : " . $key);
             return SUCCESS;
         }
         return FAIL;
     } catch (Exception $ex) {
         echo 'Database Error Occured' . $ex->getMessage();
     }
 }
예제 #24
0
 public function getItems($restaurantId)
 {
     $joins = ['a' => ['table' => 'item_brand', 'type' => 'INNER', 'conditions' => 'a.BrandId = recipe_item_details.BrandId '], 'b' => ['table' => 'recipe_item_master', 'type' => 'INNER', 'conditions' => 'b.ItemId = recipe_item_details.ItemId'], 'c' => ['table' => 'unit_master', 'type' => 'INNER', 'conditions' => 'c.UnitId = b.UnitId ']];
     $fields = ['BrandCode' => 'a.BrandId', 'BrandName' => 'a.BrandName', 'ItemName' => 'b.ItemName', 'Stock' => 'recipe_item_details.Quantity', 'UnitId' => 'b.UnitId', 'Unit' => 'c.UnitTitle', 'RStock' => 'recipe_item_details.RorderLevel'];
     $response = FALSE;
     $counter = 0;
     $conditions = array('recipe_item_master.RestaurantId =' => $restaurantId);
     $allRecipItems = $this->connect()->find('all', array('fields' => $fields, 'condition' => $conditions))->orderAsc('a.BrandId')->join($joins);
     if ($allRecipItems->count()) {
         foreach ($allRecipItems as $item) {
             $response[$counter++] = new DownloadDTO\RecipeItemDetailsDwldDto($item->BrandCode, $item->BrandName, $item->Stock, $item->RStock, $item->Unit, $item->ItemName);
         }
     } else {
         Log::debug('Records are not fount in recipe_item_details');
     }
     return $response;
 }
 public function insert(UploadDTO\BillTaxTransactionDto $billTaxTransactions)
 {
     $conn = ConnectionManager::get('default');
     $tableObj = $this->connect();
     $newBillTax = $tableObj->newEntity();
     $newBillTax->BillNo = $billTaxTransactions->billNo;
     $newBillTax->TaxId = $billTaxTransactions->taxId;
     $newBillTax->TaxAmount = $billTaxTransactions->taxAmt;
     $newBillTax->CreatedDate = date(VB_DATE_TIME_FORMAT);
     if ($tableObj->save($newBillTax)) {
         Log::debug('Bill Tax Transactions has been created for BillNo :-' . $billTaxTransactions->billNo);
         return $billTaxTransactions->billNo;
     }
     $conn->rollback();
     Log::error('error ocurred in Bill Tax Transactions creating for BillNo :-' . $billTaxTransactions->billNo);
     return 0;
 }
예제 #26
0
 private function makeSyncEntry($billNo, $userId, $restaurantId)
 {
     $newBillDetailsEntryList = $this->getTableObj()->getNewDetails($billNo);
     if (!is_null($newBillDetailsEntryList)) {
         $syncController = new SyncController();
         foreach ($newBillDetailsEntryList as $newBillDetails) {
             $syncResult = $syncController->billDetailsEntry($userId, json_encode($newBillDetails), INSERT_OPERATION, $restaurantId);
             if (!$syncResult) {
                 return $syncResult;
             }
         }
         Log::debug(' New bill Details entry successfully place in sync table');
         return $syncResult;
     }
     Log::error('Error occured in sync entry of new bill Details ');
     return;
 }
예제 #27
0
 public function getMenuTag()
 {
     $menuTags = $this->connect()->find();
     $count = $menuTags->count();
     if (!$count) {
         Log::debug('Menu Tags are not found');
         return false;
     }
     $allMenuTags[] = null;
     $i = 0;
     foreach ($menuTags as $tag) {
         $menuTagDto = new DownloadDTO\MenuTagDownloadDto($tag->TagId, $tag->TagTitle);
         $allMenuTags[$i] = $menuTagDto;
         $i++;
     }
     Log::debug('Menu Tags are successfully return');
     return $allMenuTags;
 }
예제 #28
0
 public function getSub($menuId, $restaurantId)
 {
     $joins = ['a' => ['table' => 'menu', 'type' => 'INNER', 'conditions' => 'a.MenuId = sub_menu.MenuId and a.RestaurantId =' . $restaurantId . ' and sub_menu.MenuId = ' . $menuId]];
     $fields = ['SubMenuId' => 'sub_menu.SubMenuId', 'MenuId' => 'sub_menu.MenuId', 'SubMenuTitle' => 'sub_menu.SubMenuTitle', 'Price' => 'sub_menu.Price'];
     $allSubMenu = $this->connect()->find('all', array('field' => $fields))->join($joins);
     $count = $allSubMenu->count();
     Log::debug('Number of sub menu are :- ' . $count);
     $SubMenu = null;
     if ($count) {
         $subMenuCounter = 0;
         foreach ($allSubMenu as $menu) {
             $SubMenu[$subMenuCounter++] = new DownloadDTO\SubMenuDownloadDto($menu->SubMenuId, $menu->MenuId, $menu->SubMenuTitle, $menu->Price);
         }
         return $SubMenu;
     } else {
         return false;
     }
 }
예제 #29
0
 public function update(UploadDTO\CustomerVisitUpldDto $customerVIsitData)
 {
     $conditions = ['RestaurantId =' => $customerVIsitData->restaurantId, 'Month =' => $customerVIsitData->month, 'Year =' => $customerVIsitData->year, 'Day =' => $customerVIsitData->day];
     $timeSlot = $customerVIsitData->timeSlot;
     try {
         $tableObj = $this->connect();
         $entity = $tableObj->get($conditions);
         $entity->{$timeSlot} = $entity->{$timeSlot} + 1;
         if ($tableObj->save($entity)) {
             Log::debug('customer visit updated successfully');
             return TRUE;
         }
         Log::error('customer visit error in update');
         return false;
     } catch (Exception $ex) {
         return false;
     }
 }
 public function prepareInsertStatements()
 {
     $allSource = $this->getTakeawaySource();
     if (!$allSource) {
         return false;
     }
     $preparedStatements = '';
     foreach ($allSource as $source) {
         $preparedStatements .= TAS_INS_QRY;
         $preparedStatements = str_replace('@SourceId', $source->sourceId, $preparedStatements);
         $preparedStatements = str_replace('@SourceName', $source->sourceName, $preparedStatements);
         $preparedStatements = str_replace('@SourceImg', $source->sourceImg, $preparedStatements);
         $preparedStatements = str_replace('@Discount', $source->discount, $preparedStatements);
         $preparedStatements = str_replace('@Active', $source->active, $preparedStatements);
     }
     \Cake\Log\Log::debug('Takeaway Insert script :-' . $preparedStatements);
     return $preparedStatements;
 }