Ejemplo n.º 1
0
 /**
  *
  * @param int $apartmentId
  * @return string
  * @var $apartmentGeneralService \DDD\Service\Apartment\General
  */
 public function __invoke($apartmentId)
 {
     $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general');
     $status = $apartmentGeneralService->getStatus($apartmentId);
     $apartmentStatuses = Objects::getProductStatuses();
     $label = '';
     switch ($status) {
         case Objects::PRODUCT_STATUS_LIVEANDSELLIG:
         case Objects::PRODUCT_STATUS_SELLING:
         case Objects::PRODUCT_STATUS_SELLINGNOTSEARCHABLE:
             $label = '-success';
             break;
         case Objects::PRODUCT_STATUS_DISABLED:
             $label = '-danger';
             break;
         case Objects::PRODUCT_STATUS_SANDBOX:
             $label = '-warning';
             break;
         default:
             $label = '-default';
             break;
     }
     $apartmentStatusText = isset($apartmentStatuses[$status]) ? $apartmentStatuses[$status] : '';
     $badgeTemplate = '<span class="label label%1$s">%2$s</span>';
     $html = sprintf($badgeTemplate, $label, $apartmentStatusText);
     return $html;
 }
Ejemplo n.º 2
0
 public function indexAction()
 {
     /**
      * @var \DDD\Service\Cubilis\Connection $cubilisConnectionService
      * @var General $apartmentGeneralService
      */
     $cubilisConnectionService = $this->getServiceLocator()->get('service_cubilis_connection');
     $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general');
     $cubilisDetails = $apartmentGeneralService->getCubilisDetailsAsArray($this->apartmentId);
     $form = new CubilisConnection($this->url()->fromRoute('apartment/channel-connection/save', ['apartment_id' => $this->apartmentId]));
     $form->prepare();
     $form->populateValues($cubilisDetails);
     $formTemplate = 'form-templates/cubilis-connection';
     $viewModelForm = new ViewModel();
     $viewModelForm->setVariables(['form' => $form]);
     $viewModelForm->setTemplate($formTemplate);
     $rates = $apartmentGeneralService->getRoomRates($this->apartmentId);
     $rateConnections = $cubilisConnectionService->getCubilisTypes($this->apartmentId, $rates);
     $urlLinkRates = $this->url()->fromRoute('apartment/channel-connection/link', ['apartment_id' => $this->apartmentId]);
     $apartmentOTAService = $this->getServiceLocator()->get('service_apartment_ota_distribution');
     $apartmentOTAList = $apartmentOTAService->getOTAList($this->apartmentId);
     $partnerList = $apartmentOTAService->getPartnerList();
     $hasApartmentConnectionRole = false;
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     if ($auth->hasRole(Roles::ROLE_APARTMENT_CONNECTION)) {
         $hasApartmentConnectionRole = true;
     }
     $viewModel = new ViewModel();
     $viewModel->setVariables(['apartmentId' => $this->apartmentId, 'apartmentStatus' => $this->apartmentStatus, 'rateConnections' => $rateConnections, 'rates' => $rates, 'urlLinkRates' => $urlLinkRates, 'cubilisDetails' => $cubilisDetails, 'apartmentOTAList' => $apartmentOTAList, 'partnerList' => $partnerList, 'OTAStatus' => Objects::getOTADistributionStatusList(), 'isCubilisConnecter' => $hasApartmentConnectionRole]);
     // child view to render form
     $viewModel->addChild($viewModelForm, 'formOutput');
     $viewModel->setTemplate('apartment/channel-connection/index');
     return $viewModel;
 }
Ejemplo n.º 3
0
 public function indexAction()
 {
     /**
      * @var \DDD\Service\Apartel\Connection $connectionService
      * @var \DDD\Service\Cubilis\Connection $cubilisConnectionService
      * @var \DDD\Service\Apartel\Type $typeService
      * @var OTADistribution $apartelOTAService
      */
     $connectionService = $this->getServiceLocator()->get('service_apartel_connection');
     $cubilisConnectionService = $this->getServiceLocator()->get('service_cubilis_connection');
     $typeService = $this->getServiceLocator()->get('service_apartel_type');
     // set Connection From
     $cubilisDetails = $connectionService->getCubilisConnectionDetails($this->apartelId);
     $form = new ApartelForm();
     $form->prepare();
     $form->populateValues($cubilisDetails);
     // syn Ginosi Type/Rate width Cubilis
     $ginosiTypeRateList = $typeService->getApartelTypesWithRates($this->apartelId);
     $cubilisTypeRateList = $cubilisConnectionService->getCubilisTypes($this->apartelId, $ginosiTypeRateList, true);
     // OTA connection
     $apartelOTAService = $this->getServiceLocator()->get('service_apartel_ota_distribution');
     $apartelOTAList = $apartelOTAService->getOTAList($this->apartelId);
     $partnerList = $apartelOTAService->getPartnerList();
     return ['form' => $form, 'cubilisDetails' => $cubilisDetails, 'ginosiTypeRateList' => $ginosiTypeRateList, 'cubilisTypeRateList' => $cubilisTypeRateList, 'apartelOTAList' => $apartelOTAList, 'partnerList' => $partnerList, 'OTAStatus' => Objects::getOTADistributionStatusList()];
 }
Ejemplo n.º 4
0
 public function getTransactionSummary($data)
 {
     /**
      * @var Currency $currencyService
      */
     $transactionDao = new ChargeTransaction($this->getServiceLocator());
     $currencyService = $this->getServiceLocator()->get('service_currency_currency');
     $statement = $this->prepareTransactionStatement($data);
     $transactions = $transactionDao->getTransactionSummary($statement, (bool) $data['group']);
     $transactionList = [];
     $baseCurrency = 'EUR';
     if ($transactions) {
         // Group by addon type
         foreach ($transactions as $transaction) {
             if (!isset($transactionList[$transaction['type']])) {
                 $transactionList[$transaction['type']] = ['amount' => 0, 'count' => 0, 'currency' => $baseCurrency, 'type' => Objects::getTransactionTypeById($transaction['type'])];
             }
             if ($transaction['currency'] != $baseCurrency) {
                 if (isset($transactionList[$transaction['type']])) {
                     $convertedAmount = (int) $transaction['amount'] ? $currencyService->convertCurrency($transaction['amount'], $transaction['currency'], $baseCurrency) : 0;
                     $transactionList[$transaction['type']]['amount'] = intval($transactionList[$transaction['type']]['amount'] + $convertedAmount);
                     $transactionList[$transaction['type']]['count'] = $transactionList[$transaction['type']]['count'] + $transaction['count'];
                 }
             } else {
                 $transactionList[$transaction['type']]['amount'] = intval($transactionList[$transaction['type']]['amount'] + $transaction['amount']);
                 $transactionList[$transaction['type']]['count'] = $transactionList[$transaction['type']]['count'] + $transaction['count'];
             }
         }
     }
     return $transactionList;
 }
Ejemplo n.º 5
0
 /**
  * Construct Where object from query parameters
  *
  * @param array $filterParams
  * @param bool $testApartments
  * @return Where
  */
 public function constructWhereFromFilterParams($filterParams, $testApartments = true)
 {
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     $hasDevTestRole = $auth->hasRole(Roles::ROLE_DEVELOPMENT_TESTING);
     $where = new Where();
     $table = DbTables::TBL_APARTMENTS;
     $productStatusGroups = Objects::getProductStatusGroups();
     if (!$testApartments || !$hasDevTestRole) {
         $where->expression($table . '.id NOT IN(' . Constants::TEST_APARTMENT_1 . ', ' . Constants::TEST_APARTMENT_2 . ')', []);
     }
     if (isset($filterParams["status"]) && $filterParams["status"] != '0') {
         $statusGroup = $productStatusGroups[$filterParams["status"]];
         $where->in($table . ".status", $statusGroup);
     }
     if (isset($filterParams["building_id"]) && $filterParams["building_id"] != '0') {
         $where->expression($table . '.id IN (SELECT `apartment_id` FROM ' . DbTables::TBL_APARTMENT_GROUP_ITEMS . ' JOIN ' . DbTables::TBL_APARTMENT_GROUPS . ' ON `apartment_group_id` = ' . DbTables::TBL_APARTMENT_GROUPS . '.id WHERE ' . DbTables::TBL_APARTMENT_GROUPS . '.id = ' . $filterParams['building_id'] . ' ) ', []);
     }
     if (isset($filterParams["address"]) && $filterParams["address"] != '') {
         $addressQuery = $filterParams["address"];
         $nestedWhere = new Where();
         $nestedWhere->like($table . '.name', '%' . $addressQuery . '%')->or->like('det1.name', '%' . $addressQuery . '%')->or->like('det2.name', '%' . $addressQuery . '%')->or->like($table . '.address', '%' . $addressQuery . '%')->or->like($table . '.unit_number', '%' . $addressQuery . '%')->or->like($table . '.postal_code', '%' . $addressQuery . '%');
         $where->addPredicate($nestedWhere);
     }
     if (isset($filterParams['createdDate']) && $filterParams['createdDate'] !== '') {
         $createdDate = explode(' - ', $filterParams['createdDate']);
         $where->between($table . '.create_date', $createdDate['0'], $createdDate['1']);
     }
     return $where;
 }
Ejemplo n.º 6
0
 /**
  * @return array
  */
 public function getOptionsForSearch()
 {
     $guest = Objects::getGuestList(['guest' => $this->getTextLineSite(1455), 'guests' => $this->getTextLineSite(1456)]);
     $params['cities'] = $this->getCityListForSearch();
     $params['guest'] = $guest;
     $params['current_date'] = date('d-m-Y');
     return $params;
 }
Ejemplo n.º 7
0
 /**
  * @param ServiceLocatorInterface $sm
  */
 public function __construct($categoryId)
 {
     parent::__construct('apartment-review-category-form');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('method', 'post');
     $this->add(array('name' => 'name', 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'name')));
     $this->add(array('name' => 'type', 'type' => 'Zend\\Form\\Element\\Select', 'options' => array('value_options' => Objects::getApartmentReviewCategoryStatus()), 'attributes' => array('class' => 'form-control', 'id' => 'type')));
     $this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'class' => 'btn btn-primary state save-bank-account col-sm-2 col-xs-12 margin-left-10 pull-right', 'value' => $categoryId > 0 ? 'Save Changes' : 'Add New Code')));
 }
Ejemplo n.º 8
0
 private function getCategory($permission)
 {
     $categoryList = [];
     foreach ($permission as $perm) {
         if (isset(Objects::getTranslationCategory()[$perm])) {
             $categoryList[$perm] = Objects::getTranslationCategory()[$perm];
         }
     }
     return $categoryList;
 }
Ejemplo n.º 9
0
 public function __construct($apartmentId, $name = 'apartment_general', $preparedData = [])
 {
     parent::__construct($name);
     if (count($preparedData)) {
         $this->setBuildingOptions($preparedData['buildingOptions']);
     }
     $this->setName($name);
     $this->setAttribute('method', 'POST');
     $this->setAttribute('action', 'general/save');
     $this->setAttribute('class', 'form-horizontal');
     // add filter for form
     $generalFilter = new GeneralFilter();
     $this->setInputFilter($generalFilter->getInputFilter());
     // ID
     $this->add(['name' => 'id', 'attributes' => ['type' => 'hidden', 'value' => 0, 'id' => 'aId']]);
     // Name
     $this->add(['name' => 'apartment_name', 'options' => ['label' => 'Promotional Name', 'required' => true], 'attributes' => ['type' => 'text', 'id' => 'apartment_name', 'class' => 'form-control', 'data-toggle' => 'tooltip', 'data-placement' => 'right', 'title' => 'Apartment name can only contain letters and a space, and the length should not exceed 40 characters']]);
     // Building
     $this->add(['name' => 'building_id', 'options' => ['label' => 'Building', 'value_options' => $this->buildingOptions, 'disable_inarray_validator' => true, 'required' => true], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => ['id' => 'building_id', 'class' => 'form-control']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'building_section', 'options' => ['label' => 'Building Section', 'value_options' => [], 'disable_inarray_validator' => true, 'required' => true], 'attributes' => ['id' => 'building_section', 'class' => 'form-control']]);
     // Status
     if ($apartmentId > 0) {
         $statuses = Objects::getProductStatuses();
     } else {
         $statuses = [Objects::PRODUCT_STATUS_SANDBOX => 'Sandbox'];
     }
     $this->add(['name' => 'status', 'options' => ['label' => 'Status', 'value_options' => $statuses, 'required' => true], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'status', 'class' => 'form-control')]);
     /************************************* METRICS *************************************/
     // Room count
     $this->add(['name' => 'room_count', 'options' => ['label' => 'Room Count'], 'attributes' => ['type' => 'number', 'id' => 'room_count', 'class' => 'form-control']]);
     // Square meters
     $this->add(['name' => 'square_meters', 'options' => array('label' => 'Square Meters'), 'attributes' => ['type' => 'text', 'id' => 'square_meters', 'class' => 'form-control']]);
     // Max. capacity
     $this->add(['name' => 'max_capacity', 'options' => ['label' => 'Max. Capacity', 'required' => true], 'attributes' => ['type' => 'number', 'id' => 'max_capacity', 'class' => 'form-control']]);
     // Bedrooms
     $this->add(['name' => 'bedrooms', 'options' => ['label' => 'Bedrooms'], 'attributes' => ['type' => 'number', 'id' => 'bedrooms', 'class' => 'form-control']]);
     // Bathrooms
     $this->add(['name' => 'bathrooms', 'options' => array('label' => 'Bathrooms'), 'attributes' => ['type' => 'number', 'id' => 'bathrooms', 'class' => 'form-control']]);
     /************************************* POLICY *************************************/
     // Check in time
     $this->add(['name' => 'chekin_time', 'options' => ['label' => 'Check-in'], 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => ['id' => 'chekin_time', 'class' => 'form-control datetimepicker']]);
     // Check out time
     $this->add(['name' => 'chekout_time', 'options' => ['label' => 'Check-out'], 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => ['id' => 'chekout_time', 'class' => 'form-control datetimepicker']]);
     /************************************* DESCRIPTIONS *************************************/
     // General description Textline ID
     $this->add(['name' => 'general_description_textline', 'attributes' => ['type' => 'hidden', 'value' => 0, 'class' => 'form-control']]);
     // General description
     $this->add(['name' => 'general_description', 'options' => ['label' => 'General Description', 'required' => true], 'attributes' => ['type' => 'textarea', 'id' => 'general_description', 'class' => 'form-control tinymce']]);
     $btnName = 'Save Changes';
     if (!$apartmentId) {
         $btnName = 'Add Apartment';
     }
     // Save button
     $this->add(['name' => 'save_button', 'type' => 'Zend\\Form\\Element\\Button', 'options' => ['label' => $btnName], 'attributes' => ['data-loading-text' => 'Saving...', 'id' => 'save_button', 'value' => $btnName, 'class' => 'btn btn-primary col-sm-2 col-xs-12 pull-right']]);
 }
Ejemplo n.º 10
0
 /**
  * @param \DDD\Domain\Apartment\ReviewCategory[]|\ArrayObject
  * @return array
  */
 private function prepareData($reviewCategoryList)
 {
     $data = [];
     if ($reviewCategoryList->count()) {
         foreach ($reviewCategoryList as $reviewCategory) {
             $router = $this->getServiceLocator()->get('router');
             $editUrl = $router->assemble(['controller' => 'apartment-review-category', 'action' => 'edit', 'id' => $reviewCategory['id']], ['name' => 'backoffice/default']);
             array_push($data, [$reviewCategory['name'], Objects::getApartmentReviewCategoryStatus()[$reviewCategory['type']], '<a class="btn btn-xs btn-primary" href="' . $editUrl . '" data-html-content="Edit"></a>']);
         }
     }
     return $data;
 }
Ejemplo n.º 11
0
 public function getTranslationBasicInfo($filterParams = array(), $sortCol = 0, $sortDir = 'ASC')
 {
     $status = Objects::getTranslationStatus();
     $filteredArray = [];
     $lang = 'en';
     $result = ['count' => [], 'result' => []];
     if ($filterParams['category'] == 1) {
         $dao = new \DDD\Dao\Translation\Universal($this->getServiceLocator(), 'DDD\\Domain\\Translation\\UniversalView');
         $response = $dao->getTranslationListForSearch($filterParams);
         foreach ($response['result'] as $reservation) {
             $row = array($reservation->getId(), $reservation->getPageName(), substr($reservation->getContent(), 0, 100) . (strlen($reservation->getContent()) > 100 ? '...' : ''), 'u-' . $reservation->getId() . '-' . $lang);
             $filteredArray[] = $row;
         }
         $result['count'] = $response['count'];
         $result['result'] = $filteredArray;
     } elseif ($filterParams['category'] == 2) {
         $dao = new \DDD\Dao\Geolocation\Details($this->getServiceLocator(), 'DDD\\Domain\\Translation\\LocationView');
         $response = $dao->getTranslationListForSearch($filterParams);
         foreach ($response['result'] as $reservation) {
             $types = '';
             if ($reservation->getCountry()) {
                 $types = 'Country';
             } elseif ($reservation->getProvinces()) {
                 $types = 'Province';
             } elseif ($reservation->getCity()) {
                 $types = 'City';
             } elseif ($reservation->getPoi()) {
                 $types = 'POI';
             }
             $row = array($reservation->getId(), $reservation->getName() . ' - ' . $types, substr($reservation->getName(), 0, 100) . (strlen($reservation->getName()) > 100 ? '...' : ''), 'l-' . $reservation->getId() . '-' . $lang . '-name-' . strtolower($types));
             $filteredArray[] = $row;
             $row = array($reservation->getId(), 'Information', substr($reservation->getTx_2(), 0, 100) . (strlen($reservation->getTx_2()) > 100 ? '...' : ''), 'l-' . $reservation->getId() . '-' . $lang . '-info-' . strtolower($types));
             $filteredArray[] = $row;
         }
         $result['count'] = $response['count']->getCount();
         $result['result'] = $filteredArray;
     } elseif ($filterParams['category'] == 3) {
         $dao = new \DDD\Dao\Translation\Product($this->getServiceLocator(), 'DDD\\Domain\\Translation\\ProductView');
         $response = $dao->getTranslationListForSearch($filterParams);
         /** @var \DDD\Domain\Translation\ProductView $item */
         foreach ($response['result'] as $item) {
             if ($typeProd = $this->getDescriptionType($item->getType())) {
                 $row = [$item->getId(), $item->getEntityName() . ' - ' . $typeProd, substr($item->getContent(), 0, 100) . (strlen($item->getContent()) > 100 ? '...' : ''), 'p-' . $item->getId() . '-' . $lang];
                 $filteredArray[] = $row;
             }
         }
         $result['count'] = $response['total'];
         $result['result'] = $filteredArray;
     }
     return $result;
 }
Ejemplo n.º 12
0
 public function __construct($name = 'vacationdays-form')
 {
     parent::__construct($name);
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('id', 'vacationdays-form');
     $this->add(array('name' => 'interval', 'attributes' => array('type' => 'text', 'class' => 'form-control pull-right', 'id' => 'interval')));
     $this->add(array('name' => 'from', 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'from')));
     $this->add(array('name' => 'to', 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'to')));
     $this->add(array('name' => 'total_number', 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'total_number', 'max' => 365, 'min' => 0, 'maxlength' => 5)));
     $this->add(array('name' => 'vacation_type', 'options' => array('value_options' => Objects::getVacationType()), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'vacation_type', 'class' => 'form-control')));
     $this->add(array('name' => 'comment', 'attributes' => array('type' => 'textarea', 'class' => 'form-control', 'rows' => '4', 'id' => 'comment', 'maxlength' => 255)));
     $this->add(array('name' => 'save_button', 'options' => array('label' => 'Submit Request'), 'attributes' => array('type' => 'button', 'class' => 'btn btn-primary state', 'data-loading-text' => 'Saving...', 'id' => 'save_button', 'value' => 'Save')));
 }
Ejemplo n.º 13
0
 public static function convertMonth($month)
 {
     $months = Objects::getMonths();
     if (in_array($month, $months)) {
         array_unshift($months, '');
         $monthsReversed = array_flip($months);
         return str_pad($monthsReversed[$month], 2, '0', STR_PAD_LEFT);
     } elseif (in_array($month, range(1, 12))) {
         array_unshift($months, '');
         return $months[(int) $month];
     } else {
         throw new \Exception('Wrong month name.');
     }
 }
Ejemplo n.º 14
0
 public function __construct($name = 'blank', $resources = [])
 {
     // set the form's name
     parent::__construct($name);
     $this->resources = $resources;
     // set the method
     $this->setAttribute('method', 'post');
     // TID
     $this->add(['name' => 'tid', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false], 'attributes' => ['placeholder' => 'TID', 'class' => 'form-control', 'id' => 'tid']]);
     // Category
     $this->add(['name' => 'category', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => $this->getExpenseCategories()], 'attributes' => ['class' => 'form-control', 'id' => 'category']]);
     // Entered by
     $this->add(['name' => 'entered_by', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false, 'required' => true], 'attributes' => ['placeholder' => 'Entered By', 'class' => 'form-control', 'id' => 'entered_by']]);
     // Managed by
     $this->add(['name' => 'managed_by', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false], 'attributes' => ['placeholder' => 'Managed By', 'class' => 'form-control', 'id' => 'managed_by']]);
     $this->add(['name' => 'entered_by_id', 'type' => 'Zend\\Form\\Element\\Hidden', 'attributes' => ['id' => 'entered_by_id', 'class' => 'form-control'], 'options' => ['label' => false]]);
     $this->add(['name' => 'entered_for_id', 'type' => 'Zend\\Form\\Element\\Hidden', 'attributes' => ['id' => 'entered_for_id', 'class' => 'form-control'], 'options' => ['label' => false]]);
     $this->add(['name' => 'managed_by_id', 'type' => 'Zend\\Form\\Element\\Hidden', 'attributes' => ['id' => 'managed_by_id', 'class' => 'form-control'], 'options' => ['label' => false]]);
     // Supplier
     $this->add(['name' => 'supplier', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => $this->getSuppliers()], 'attributes' => ['class' => 'form-control', 'id' => 'supplier']]);
     // Supplier Reference
     $this->add(['name' => 'supplier_reference', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false], 'attributes' => ['placeholder' => 'Supplier Reference', 'class' => 'form-control', 'id' => 'supplier_reference']]);
     // Purpose
     $this->add(['name' => 'purpose', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false], 'attributes' => ['placeholder' => 'Purpose', 'class' => 'form-control', 'id' => 'purpose']]);
     // Currency
     $this->add(['name' => 'currency', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => $this->getCurrencies()], 'attributes' => ['class' => 'form-control', 'id' => 'currency']]);
     // Bank Account
     $this->add(['name' => 'bank_account', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => $this->getBankAccounts()], 'attributes' => ['class' => 'form-control', 'id' => 'bank_account']]);
     // Amount
     $this->add(['name' => 'amount', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false], 'attributes' => ['placeholder' => 'Amount', 'class' => 'form-control', 'id' => 'amount']]);
     // Transaction Date
     $this->add(['name' => 'transaction_date', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false], 'attributes' => ['placeholder' => 'Transaction Date', 'id' => 'transaction_date', 'class' => 'form-control pull-right']]);
     // Date Entered
     $this->add(['name' => 'date_entered', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => false], 'attributes' => ['placeholder' => 'Date Entered', 'id' => 'date_entered', 'class' => 'form-control pull-right']]);
     // Global Cost
     $this->add(['name' => 'global_cost', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => [2 => 'Global & Specific', 1 => 'Global Costs', 0 => 'Specific Costs']], 'attributes' => ['class' => 'form-control', 'id' => 'global_cost']]);
     // Direct Debit
     $this->add(['name' => 'direct_debit', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => array_merge([2 => 'Debit & Manual'], Objects::getPaymentTypes())], 'attributes' => ['class' => 'form-control', 'id' => 'direct_debit']]);
     // Verified
     $this->add(['name' => 'verified', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => [2 => 'Verified & Unverified', 1 => 'Verified', 0 => 'Unverified']], 'attributes' => ['class' => 'form-control', 'id' => 'verified']]);
     // Verified
     $this->add(['name' => 'debt', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => [0 => 'Deposit & Non', 1 => 'Deposit', 2 => 'Non Deposit']], 'attributes' => ['class' => 'form-control', 'id' => 'debt']]);
     // Paid
     $this->add(['name' => 'paid', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => [2 => 'Paid & Unpaid', 1 => 'Paid', 0 => 'Unpaid']], 'attributes' => ['class' => 'form-control', 'id' => 'paid']]);
     // Approved
     $this->add(['name' => 'approved', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => [2 => 'Approved & New', 1 => 'Approved', 0 => 'New']], 'attributes' => ['class' => 'form-control', 'id' => 'approved']]);
     // Cost Center
     $this->add(['name' => 'cost_center_id', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => $this->getAccommodations()], 'attributes' => ['data-placeholder' => 'Cost Center', 'class' => 'form-control', 'id' => 'cost_center_id']]);
 }
Ejemplo n.º 15
0
 public function statisticsAction()
 {
     $months = Objects::getMonthLongNames();
     $y = $this->params()->fromRoute('year', null);
     $m = $this->params()->fromRoute('month', null);
     $StatisticsForm = new StatisticsForm($months);
     $formTemplate = 'form-templates/search-statistics';
     $viewModelForm = new ViewModel();
     $requestDate = null;
     if (!is_null($y) && !is_null($y)) {
         $requestDate = $y . '_' . $m;
     }
     $viewModelForm->setVariables(['form' => $StatisticsForm, 'requestDate' => $requestDate]);
     $viewModelForm->setTemplate($formTemplate);
     $router = $this->getEvent()->getRouter();
     $ajaxSourceUrl = $router->assemble(['controller' => 'apartment', 'action' => 'get-occupancy-statistics-json'], ['name' => 'occupancy_statistics']);
     $viewModel = new ViewModel(['ajaxSourceUrl' => $ajaxSourceUrl]);
     $viewModel->addChild($viewModelForm, 'formOutput');
     $viewModel->setTemplate('apartment/occupancy-statistics/index');
     return $viewModel;
 }
Ejemplo n.º 16
0
 public function indexAction()
 {
     /**
      * @var \DDD\Dao\Geolocation\Cities $cityDao
      * @var \DDD\Dao\Office\OfficeManager $officeDao
      * @var \Library\Authentication\BackofficeAuthenticationService $auth
      * @var \DDD\Dao\Team\TeamStaff $teamStaffDao
      */
     $cityDao = $this->getServiceLocator()->get('dao_geolocation_cities');
     $officeDao = $this->getServiceLocator()->get('dao_office_office_manager');
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     $teamStaffDao = $this->getServiceLocator()->get('dao_team_team_staff');
     $cities = $cityDao->getBoUserCities();
     /**
      * @var Base $teamBaseUsageService
      */
     $teamBaseUsageService = $this->getServiceLocator()->get('service_team_usages_base');
     $teams = $teamBaseUsageService->getTeamsBySeveralUsages([Base::TEAM_USAGE_DEPARTMENT, Base::TEAM_USAGE_FRONTIER]);
     $myTeams = [];
     $teamsSelect = [];
     $myTeamRoles = [Team::STAFF_MEMBER, Team::STAFF_OFFICER, Team::STAFF_MANAGER, Team::STAFF_DIRECTOR];
     foreach ($teams as $team) {
         if ($teamStaffDao->isTeamStaff($auth->getIdentity()->id, $team->getId(), $myTeamRoles)) {
             $myTeams[$team->getId()] = $team->getName();
         } else {
             $teamsSelect[$team->getId()] = $team->getName();
         }
     }
     if (empty($myTeams)) {
         $allTeams = $teamsSelect;
     } else {
         $allTeams = $myTeams + ['disabled' => '-------'] + $teamsSelect;
     }
     $offices = $officeDao->getOfficeList(null, false);
     return new ViewModel(['cities' => $cities, 'teams' => $allTeams, 'offices' => iterator_to_array($offices), 'schedule_types' => Objects::getShift()]);
 }
Ejemplo n.º 17
0
 public function downloadTransactionAction()
 {
     /**
      * @var ChartService $chartService
      * @var BookingManagement $bookingManagementService
      */
     $request = $this->getRequest();
     $chartService = $this->getServiceLocator()->get('service_finance_account_receivable_chart');
     $transactions = $chartService->getTransactionDownloadable($request->getQuery());
     header('Content-Type: text/csv; charset=utf-8');
     header('Content-Disposition: attachment; filename=Transactions.csv');
     $output = fopen('php://output', 'w');
     fputcsv($output, ['Res. Number', 'Type', 'Acc Amount', 'Acc Currency', 'Transaction Date', 'PSP']);
     foreach ($transactions as $transaction) {
         fputcsv($output, [$transaction['res_number'], Objects::getTransactionTypeById($transaction['type']), $transaction['acc_amount'], $transaction['currency'], $transaction['date'], $transaction['psp_name']]);
     }
     exit;
 }
Ejemplo n.º 18
0
Archivo: User.php Proyecto: arbi/MyCode
 public function __construct($name = null, $data, $options)
 {
     parent::__construct($name);
     $name = $this->getName();
     if (null === $name) {
         $this->setName('user');
     }
     $email_attr = array('type' => 'Zend\\Form\\Element\\Email', 'class' => 'form-control', 'id' => 'email', 'maxlength' => 40);
     $this->add(array('name' => 'email', 'options' => array('label' => ''), 'attributes' => $email_attr));
     $this->add(array('name' => 'alt_email', 'options' => array('label' => ''), 'attributes' => array('type' => 'Zend\\Form\\Element\\Email', 'class' => 'form-control', 'id' => 'alt_email', 'maxlength' => 40)));
     $this->add(array('name' => 'password', 'options' => array('label' => ''), 'attributes' => array('class' => 'form-control', 'type' => 'password', 'id' => 'password', 'maxlength' => 20)));
     $this->add(array('name' => 'firstname', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'firstname', 'maxlength' => 35)));
     $this->add(array('name' => 'lastname', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'lastname', 'maxlength' => 35)));
     $this->add(array('name' => 'birthday', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control datepicker', 'id' => 'birthday')));
     $this->add(array('name' => 'living_city', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'living_city', 'maxlength' => 200)));
     $this->add(['name' => 'external', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => ['id' => 'external'], 'options' => []]);
     $managers = [0 => '-- Choose Manager --'];
     foreach ($options->get('managers') as $row) {
         $managers[$row->getId()] = $row->getFirstName() . ' ' . $row->getLastName();
     }
     $this->add(array('name' => 'manager', 'options' => array('label' => '', 'value_options' => $managers), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'manager', 'class' => 'form-control')));
     $countries = array('0' => '-- Choose Countries --');
     foreach ($options->get('countries') as $row) {
         $countries[$row->getId()] = $row->getName();
     }
     $cities = $options->get('cities');
     $this->add(array('name' => 'country', 'options' => array('label' => '', 'value_options' => $countries), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'country', 'class' => 'form-control')));
     $this->add(array('name' => 'city', 'options' => array('label' => '', 'value_options' => $cities), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'city', 'class' => 'form-control')));
     $this->add(array('name' => 'timezone', 'options' => array('label' => '', 'value_options' => Objects::getTimezoneOptions()), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'timezone', 'class' => 'form-control')));
     $this->add(array('name' => 'last_login', 'options' => array('label' => ''), 'type' => 'Text', 'attributes' => array('id' => 'last_login', 'class' => 'form-control', 'disabled' => true)));
     $this->add(array('name' => 'internal_number', 'options' => array('label' => '', 'required' => false), 'type' => 'Number', 'attributes' => array('id' => 'internal_number', 'class' => 'form-control', 'min' => 0, 'value' => 0)));
     $this->add(array('name' => 'startdate', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control datepicker', 'id' => 'startdate')));
     $this->add(array('name' => 'end_date', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control datepicker', 'id' => 'startdate')));
     $this->add(array('name' => 'vacationdays', 'options' => array('label' => ''), 'attributes' => array('type' => 'Float', 'class' => 'form-control', 'id' => 'vacationdays', 'max' => 365, 'min' => -365, 'maxlength' => 16)));
     $this->add(array('name' => 'vacation_days_per_year', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'vacation_days_per_year', 'max' => 365, 'min' => 0, 'maxlength' => 6)));
     $this->add(array('name' => 'personalphone', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'personalphone', 'maxlength' => 15)));
     $this->add(array('name' => 'businessphone', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'businessphone', 'maxlength' => 15)));
     $this->add(array('name' => 'emergencyphone', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'emergencyphone', 'maxlength' => 15)));
     $this->add(array('name' => 'housephone', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'housephone', 'maxlength' => 15)));
     $this->add(array('name' => 'asana_id', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'asana_id', 'maxlength' => 25)));
     $this->add(array('name' => 'address_permanent', 'options' => array('label' => ''), 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('class' => 'form-control', 'rows' => 3, 'id' => 'address_permanent', 'maxlength' => 250)));
     $this->add(array('name' => 'address_residence', 'options' => array('label' => ''), 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('class' => 'form-control', 'rows' => 3, 'id' => 'address_residence', 'maxlength' => 250)));
     $dashboards = array();
     foreach ($options->get('dashboards') as $dashboard) {
         $dashboards[$dashboard->getId()] = $dashboard->getName();
     }
     $this->add(array('name' => 'dashboards', 'options' => array('label' => '', 'value_options' => $dashboards), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'dashboards', 'class' => 'selectize form-control', 'multiple' => 'multiple')));
     $this->add(array('name' => 'system', 'type' => 'Zend\\Form\\Element\\Checkbox', 'options' => array('label' => 'System User', 'use_hidden_element' => true, 'checked_value' => 1, 'unchecked_value' => 0), 'attributes' => ['class' => 'margin-top-10', 'id' => 'system']));
     $user_concierge_array = [];
     if (!is_null($data)) {
         $obj_user_concierge = $data->get('user_conciergegroups');
         foreach ($obj_user_concierge as $row) {
             $user_concierge_array[] = $row->getApartmentGroupId();
         }
     }
     $conciergegroups = [];
     foreach ($options->get('concierges') as $row) {
         $conciergegroups[$row->getId()] = $row->getName();
     }
     $this->add(array('name' => 'conciergegroups', 'options' => array('label' => '', 'value_options' => $conciergegroups), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'conciergegroups', 'class' => 'selectize form-control', 'multiple' => 'multiple')));
     $submitLable = 'Save Changes';
     if (is_null($data)) {
         $submitLable = 'Create User';
     }
     $this->add(array('name' => 'user_button', 'options' => array('label' => $submitLable), 'attributes' => array('type' => 'button', 'class' => 'btn btn-primary personal-tab-btn administration-tab-btn permission-tab-btn pull-right margin-left-10 col-sm-2 col-xs-12', 'data-loading-text' => 'Saving...', 'id' => 'user_button', 'value' => $submitLable)));
     $officeRawList = $options->get('office');
     $offices = ['-1' => '-- Choose Office --'];
     if (count($officeRawList)) {
         foreach ($officeRawList as $key => $office) {
             $offices[$key] = $office;
         }
     }
     if (is_object($data)) {
         $userOffice = $data->get('userOffice');
         if (!is_null($userOffice)) {
             $offices += $userOffice;
         }
     }
     $this->add(array('name' => 'reporting_office_id', 'options' => array('label' => '', 'value_options' => $offices), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'reporting_office_id', 'class' => 'form-control')));
     $departments = $options->get('departments');
     $this->add(array('name' => 'department', 'options' => array('label' => '', 'value_options' => $departments), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'department', 'class' => 'form-control')));
     $this->add(array('name' => 'position', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'position', 'maxlength' => 50)));
     $this->add(array('name' => 'city_hidden_id', 'attributes' => array('type' => 'hidden', 'id' => 'city_hidden_id')));
     $this->add(array('name' => 'period_of_evaluation', 'options' => array('label' => '', 'value_options' => Evaluations::getEvaluationPeriodOptions()), 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'period_of_evaluation', 'class' => 'form-control')));
     $this->add(array('name' => 'user_hidden_id', 'attributes' => array('type' => 'hidden', 'id' => 'user_hidden_id')));
     $this->add(array('name' => 'disabled', 'attributes' => array('type' => 'hidden', 'id' => 'disabled')));
     $this->add(array('name' => 'employment', 'type' => 'Zend\\Form\\Element\\Select', 'options' => array('label' => 'Employment (%)', 'value_options' => $this->getSelectPercentValues(), 'required' => true), 'attributes' => array('class' => 'form-control', 'id' => 'employment')));
     $this->add(array('name' => 'sick_days', 'options' => array('label' => ''), 'attributes' => array('type' => 'int', 'class' => 'form-control', 'id' => 'sick_days', 'max' => 3, 'min' => -1, 'maxlength' => 2, 'class' => 'form-control')));
     if (is_object($data)) {
         $objectData = new \ArrayObject();
         $obj = $data->get('user_main');
         $objectData['firstname'] = $obj->getFirstName();
         $objectData['lastname'] = $obj->getLastName();
         $objectData['birthday'] = \Library\Utility\DateLocal::convertDateFromYMD($obj->getBirthDay());
         $objectData['email'] = $obj->geteMail();
         $objectData['internal_number'] = $obj->getInternalNumber();
         $objectData['alt_email'] = $obj->getAlt_email();
         $objectData['manager'] = $obj->getManager_id();
         $objectData['country'] = $obj->getCountry_id();
         $objectData['city'] = $obj->getCity_id();
         $objectData['living_city'] = $obj->getLivingCity();
         $objectData['city_hidden_id'] = $obj->getCity_id();
         $objectData['user_hidden_id'] = $obj->getId();
         $objectData['startdate'] = (int) $obj->getStart_date() ? date('d M Y', strtotime($obj->getStart_date())) : '';
         $objectData['end_date'] = (int) $obj->getEndDate() ? date('d M Y', strtotime($obj->getEndDate())) : '';
         $objectData['vacationdays'] = $obj->getVacation_days() ? $obj->getVacation_days() : '';
         $objectData['vacation_days_per_year'] = $obj->getVacation_days_per_year() ? $obj->getVacation_days_per_year() : '';
         $objectData['personalphone'] = $obj->getPersonal_phone() ? $obj->getPersonal_phone() : '';
         $objectData['businessphone'] = $obj->getBusiness_phone() ? $obj->getBusiness_phone() : '';
         $objectData['emergencyphone'] = $obj->getEmergency_phone() ? $obj->getEmergency_phone() : '';
         $objectData['housephone'] = $obj->getHouse_phone() ? $obj->getHouse_phone() : '';
         $objectData['address_permanent'] = $obj->getAddressPermanent();
         $objectData['address_residence'] = $obj->getAddressResidence();
         $objectData['timezone'] = $obj->getTimezone();
         $objectData['shift'] = $obj->getShift();
         $objectData['department'] = $data->get('userDepId');
         $objectData['position'] = $obj->getPosition();
         $objectData['period_of_evaluation'] = $obj->getPeriodOfEvaluation();
         $objectData['system'] = $obj->getSystem();
         $objectData['disabled'] = $obj->getDisabled();
         $objectData['reporting_office_id'] = $obj->getReportingOfficeId();
         $objectData['asana_id'] = $obj->getAsanaId();
         $objectData['employment'] = $obj->getEmployment();
         $objectData['sick_days'] = $obj->getSickDays();
         $objectData['external'] = $obj->isExternal();
         $objectData['last_login'] = $obj->getLastLogin() == '0000-00-00 00:00:00' ? 'Unknown' : date(Constants::GLOBAL_DATE_FORMAT . ' \\a\\t H:i', strtotime($obj->getLastLogin())) . " (Amsterdam time)";
         $dashboardsArray = array();
         $obj_user_dashboards = $data->get('user_dashboards');
         foreach ($obj_user_dashboards as $row) {
             $dashboardsArray[] = $row->getDashboardID();
         }
         $objectData['dashboards'] = $dashboardsArray;
         $objectData['conciergegroups'] = $user_concierge_array;
         $this->bind($objectData);
     }
 }
Ejemplo n.º 19
0
 /**
  * @param \DDD\Domain\Booking\BookingTicket $booking
  * @param array $data
  * @param array $permission
  */
 private function setGinosiComment($booking, $data, $permission)
 {
     /**
      * @var Logger $logger
      */
     $logger = $this->getServiceLocator()->get('ActionLogger');
     if ($permission['credit']) {
         if ($booking->getFunds_confirmed() != $data['finance_valid_card']) {
             $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_BOOKING_CC_STATUS, (int) $data['finance_valid_card'] + 1);
         }
     }
     if ($booking->isKiViewed() != (int) $data['finance_key_instructions']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_KI_VIEWED, (int) $data['finance_key_instructions']);
     }
     if ($booking->getApartelId() != (int) $data['apartel_id']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_APARTEL_ID, (int) $data['apartel_id']);
     }
     if ($booking->getPartnerSettled() != (int) $data['finance_paid_affiliate']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_PARTNER_SETTLED, (int) $data['finance_paid_affiliate']);
     }
     if ($booking->getNo_collection() != (int) $data['finance_no_collection']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_NO_COLLECTION, (int) $data['finance_no_collection']);
     }
     if ($booking->getCccaVerified() != (int) $data['ccca_verified']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_CCCA_VERIFIED, (int) $data['ccca_verified']);
     }
     if ($permission['fin']) {
         if ($booking->getPayment_settled() != (int) $data['finance_reservation_settled']) {
             $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_RESERVATION_SETTLED, (int) $data['finance_reservation_settled']);
         }
     }
     if (isset($data['booking_statuses']) && $booking->getStatus() != $data['booking_statuses']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_BOOKING_STATUSES, Objects::getBookingStatusMapping()[$data['booking_statuses']]);
     }
     if (isset($data['finance_booked_state']) && $booking->getArrivalStatus() != $data['finance_booked_state'] && ($booking->getArrivalStatus() != self::INSPECTED_STATE || $booking->getArrivalStatus() == self::INSPECTED_STATE && $data['finance_booked_state'] != self::CHECKOUT_STATE) && $data['finance_booked_state_changed'] == self::BOOKED_STATE_CHANGED) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_CHECK_IN, $data['finance_booked_state']);
     }
     $msg = $data['booking_ginosi_comment'];
     if ($data['booking_ginosi_comment_team']) {
         $teamDao = $this->getServiceLocator()->get('dao_team_team');
         $teamName = $teamDao->getTeamNameById($data['booking_ginosi_comment_team']);
         $msg .= '</br><b>' . $teamName . ' Notified</b>';
     }
     if ($data['booking_ginosi_comment'] != '') {
         $logId = $logger->save(Logger::MODULE_BOOKING, $booking->getId(), empty($data['booking_ginosi_comment_frontier']) ? Logger::ACTION_COMMENT : Logger::ACTION_HOUSEKEEPING_COMMENT, $msg);
         if ($data['booking_ginosi_comment_team']) {
             $logsTeamDao = $this->getServiceLocator()->get('dao_action_logs_logs_team');
             $logsTeamDao->save(['action_log_id' => $logId, 'team_id' => $data['booking_ginosi_comment_team']]);
         }
     }
 }
    public function getVacationRequestsAction()
    {
        /**
         * @var TimeOffRequestsService $timeOffRequestsWidgetService
         * @var BackofficeAuthenticationService $authenticationService
         */
        $timeOffRequestsWidgetService = $this->getServiceLocator()->get('service_universal_dashboard_widget_time_off_requests');
        $authenticationService = $this->getServiceLocator()->get('library_backoffice_auth');
        $vacationDao = $this->getServiceLocator()->get('dao_user_vacation_days');
        $loggedInUserID = $authenticationService->getIdentity()->id;
        $dataSet = $timeOffRequestsWidgetService->getTimeOffRequests($loggedInUserID);
        $preparedData = [];
        if ($dataSet && count($dataSet)) {
            foreach ($dataSet as $row) {
                $remainColumn = $row->getVacation_days();
                $purposeColumn = '<span class="glyphicon glyphicon-comment" data-toggle="popover" data-placement="top" data-trigger="hover" data-content="' . $row->getComment() . '"></span>';
                $actionsColumn = '
					<a href="javascript:void(0)" class="btn btn-xs btn-success" onclick="vacationRequest(' . $row->getId() . ',1)" id="vac_accept_' . $row->getId() . '">Approve</a>
					<a href="javascript:void(0)" class="btn btn-xs btn-danger" onclick="vacationRequest(' . $row->getId() . ',3)" id="vac_reject_' . $row->getId() . '">Reject</a>
				';
                if ($row->getType() == VacationService::VACATION_TYPE_SICK) {
                    $takenSickDays = 0;
                    $sickDays = $vacationDao->getSickDays($row->getUser_id());
                    if ($sickDays) {
                        foreach ($sickDays as $sickDay) {
                            $takenSickDays += abs($sickDay['total_number']);
                        }
                    }
                    if ($row->getSickDays() != -1) {
                        $remainColumn = $row->getSickDays() - $takenSickDays;
                    } else {
                        $remainColumn = '';
                    }
                }
                array_push($preparedData, ['<a href="/profile/index/' . $row->getUser_id() . '" target="_blank">' . $row->getFirstName() . ' ' . $row->getLastName() . '</a>', isset(Objects::getVacationType()[$row->getType()]) ? Objects::getVacationType()[$row->getType()] : 'None', date(Constants::GLOBAL_DATE_FORMAT, strtotime($row->getFrom())) . ' - ' . date(Constants::GLOBAL_DATE_FORMAT, strtotime($row->getTo())), $row->getTotal_number(), round($remainColumn, 2), $purposeColumn, $actionsColumn]);
            }
            return new JsonModel(["aaData" => $preparedData]);
        } else {
            return new JsonModel(["aaData" => []]);
        }
    }
Ejemplo n.º 21
0
 public function getApartment($cityApartel)
 {
     $cityApartel = explode('--', $cityApartel);
     if (!isset($cityApartel[1]) || !ClassicValidator::checkApartmentTitle($cityApartel[0]) || !ClassicValidator::checkApartmentTitle($cityApartel[1])) {
         return false;
     }
     $apartel = $otherParams['apartel'] = $cityApartel[0];
     $city = $cityApartel[1];
     $generalDao = $this->getApartmentGeneralDao();
     $descrDao = $this->getDescriptionDao();
     $roomDao = $this->getRoomDao();
     $officeDao = new \DDD\Dao\Office\OfficeManager($this->getServiceLocator());
     $furnitureDao = $this->getFurnitureDao();
     $apartmentAmenitiesDao = $this->getAmenitiesDao();
     $buildingFacilitiesDao = $this->getFacilitiesDao();
     $general = $generalDao->getApartmentGeneralBySlug($apartel, Helper::urlForSearch($city, TRUE));
     if (!$general) {
         return false;
     }
     //change currency
     $userCurrency = $this->getCurrencySite();
     if ($userCurrency != $general['code']) {
         $currencyResult = $this->currencyConvert($general['price_avg'], $userCurrency, $general['code']);
         $general['price_avg'] = $currencyResult[0];
         $general['symbol'] = $currencyResult[1];
     }
     //images
     $imgDomain = DomainConstants::IMG_DOMAIN_NAME;
     $imgPath = Website::IMAGES_PATH;
     $images = [];
     $checkHasImage = false;
     foreach ($general as $key => $img) {
         if (strpos($key, 'img') !== false && $img) {
             $original = Helper::getImgByWith($img);
             $smallImg = Helper::getImgByWith($img, WebSite::IMG_WIDTH_AMARTMENT_SMALL);
             $bigImg = Helper::getImgByWith($img, WebSite::IMG_WIDTH_AMARTMENT_BIG);
             if ($original && $bigImg && $smallImg) {
                 $checkHasImage = true;
                 $images[] = ['domain' => $imgDomain, 'big' => $bigImg, 'small' => $smallImg, 'orig' => $original];
             }
         }
     }
     if (!$checkHasImage) {
         $noImg = Constants::VERSION . 'img/no_image.png';
         $images[] = ['domain' => $noImg, 'big' => $noImg, 'small' => $noImg, 'orig' => $noImg];
     }
     $otherParams['images'] = $images;
     //video
     if (isset($general['video']) && $general['video']) {
         $video = Helper::getVideoUrl($general['video']);
         if ($video) {
             $otherParams['video'] = ['video_screen' => $video, 'src' => $general['video']];
         }
     }
     //facilities
     $tempFacilitiesData = $buildingFacilitiesDao->getApartmentBuildingFacilities($general['aprtment_id']);
     $facilities = [];
     foreach ($tempFacilitiesData as $tempFacility) {
         $facilities[$tempFacility->getFacilityName()] = $tempFacility->getFacilityTextlineId();
     }
     unset($tempFacilitiesData);
     //amenities
     $tempAmenitiesData = $apartmentAmenitiesDao->getApartmentAmenities($general['aprtment_id']);
     $amenities = [];
     foreach ($tempAmenitiesData as $tempAmenity) {
         $amenities[$tempAmenity->getAmenityName()] = $tempAmenity->getAmenityTextlineId();
     }
     unset($tempAmenitiesData);
     if (isset($facilities['Parking']) && $facilities['Parking']) {
         $otherParams['parking'] = true;
     }
     if (isset($amenitiesData['Free Wifi']) && $amenitiesData['Free Wifi']) {
         $otherParams['internet'] = true;
     }
     //furniture
     $furnitureData = $furnitureDao->getFurnitureLits($general['aprtment_id']);
     $otherParams['furnitures'] = $furnitureData;
     /* @var $websiteSearchService \DDD\Service\Website\Search */
     $websiteSearchService = $this->getServiceLocator()->get('service_website_search');
     $diffHours = $websiteSearchService->getDiffHoursForDate();
     $otherParams['current'] = Helper::getCurrenctDateByTimezone($general['timezone'], 'd-m-Y', $diffHours);
     $general['city_name'] = $general['city_name'];
     $general['city_slug'] = $general['city_slug'];
     $otherParams['guestList'] = Objects::getGuestList(['guest' => $this->getTextLineSite(1455), 'guests' => $this->getTextLineSite(1456)], true);
     $params = ['general' => $general, 'amenities' => $amenities, 'facilities' => $facilities, 'otherParams' => $otherParams];
     return $params;
 }
Ejemplo n.º 22
0
 /**
  *
  * @return array
  */
 private function getTimeZoneList()
 {
     return ['' => '-- Choose Timezone --'] + Objects::getTimezoneOptions();
 }
Ejemplo n.º 23
0
 public function ajaxApplyCancelationAction()
 {
     /**
      * @var \DDD\Service\UniversalDashboard\Widget\PendingCancelation $pendingCancelationWidgetService
      */
     $pendingCancelationWidgetService = $this->getServiceLocator()->get('service_universal_dashboard_widget_pending_cancellation');
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     $request = $this->getRequest();
     $result = ['status' => 'error', 'msg' => TextConstants::SERVER_ERROR];
     if (!$auth->checkUniversalDashboardPermission(UserService::DASHBOARD_PENDING_CANCELLATION)) {
         return $this->redirect()->toRoute('home');
     }
     $logger = $this->getServiceLocator()->get('ActionLogger');
     try {
         if ($request->isPost() && $request->isXmlHttpRequest()) {
             $params = $this->params()->fromPost();
             $resNumber = $params['res_number'];
             $bookingStatus = $params['booking_status'];
             $bookingId = $params['booking_id'];
             $resolveResult = $pendingCancelationWidgetService->applyCancelation($resNumber, $bookingStatus);
             if ($resolveResult) {
                 $bookingStatusesDao = new Statuses($this->getServiceLocator(), '\\ArrayObject');
                 $bookingStatuses = $bookingStatusesDao->getAllList();
                 $result['status'] = 'success';
                 $statusName = '';
                 foreach ($bookingStatuses as $status) {
                     if ($bookingStatus == $status['id']) {
                         $statusName = $status['name'];
                     }
                 }
                 $result['msg'] = 'Reservation with R# ' . $resNumber . ' marked as ' . $statusName;
                 $logger->save(Logger::MODULE_BOOKING, $bookingId, Logger::ACTION_BOOKING_STATUSES, Objects::getBookingStatusMapping()[$bookingStatus]);
             } else {
                 $result['msg'] = 'Problem during requested operation for R# ' . $resNumber;
             }
         }
     } catch (\Exception $e) {
         $result['msg'] = $e->getMessage();
     }
     return new JsonModel($result);
 }
Ejemplo n.º 24
0
 public function __construct($name = null, $datas, $options, $type)
 {
     /**
      * @var \DDD\Domain\Geolocation\Details $data
      */
     parent::__construct($name);
     $name = $this->getName();
     if (null === $name) {
         $this->setName('location');
     }
     $this->add(['name' => 'name', 'options' => ['label' => ''], 'attributes' => ['type' => 'text', 'class' => 'form-control', 'id' => 'name', 'maxlength' => 150]]);
     $this->add(['name' => 'slug', 'options' => ['label' => ''], 'attributes' => ['type' => 'text', 'class' => 'form-control', 'id' => 'name', 'maxlength' => 255]]);
     if (isset($datas) || $type == LocationService::LOCATION_TYPE_CITY) {
         $timeZoneOptions = Objects::getTimezoneOptions();
         $this->add(['name' => 'timezone', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => $timeZoneOptions], 'attributes' => ['class' => 'form-control', 'id' => 'timezone']]);
     }
     $this->add(['name' => 'autocomplete_txt', 'options' => ['label' => ''], 'attributes' => ['type' => 'text', 'class' => 'form-control', 'id' => 'autocomplete_txt', 'maxlength' => 150]]);
     $this->add(['name' => 'latitude', 'options' => ['label' => 'LONGITUDE'], 'attributes' => ['type' => 'hidden', 'class' => 'form-control', 'id' => 'latitude']]);
     $this->add(['name' => 'longitude', 'options' => ['label' => 'LONGITUDE'], 'attributes' => ['type' => 'hidden', 'class' => 'form-control', 'id' => 'longitude']]);
     $this->add(['name' => 'information', 'options' => ['label' => ''], 'attributes' => ['type' => 'textarea', 'class' => 'tinymce', 'rows' => '15', 'id' => 'information']]);
     $this->add(['name' => 'cover_image', 'options' => ['label' => ''], 'attributes' => ['type' => 'file', 'id' => 'img1', 'class' => 'hidden-file-input invisible']]);
     $this->add(['name' => 'thumbnail', 'options' => ['label' => ''], 'attributes' => ['type' => 'file', 'id' => 'img2', 'class' => 'hidden-file-input invisible']]);
     /**
      * Selling
      */
     $is_salling = ['id' => 'is_selling', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     if (is_array($datas)) {
         $data = $datas['details'];
     } else {
         $data = '';
     }
     if (is_object($data) && $data->getIs_selling() > 0) {
         $is_salling['checked'] = 'checked';
     }
     $this->add(['name' => 'is_selling', 'options' => ['label' => ''], 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $is_salling]);
     /**********Country**********/
     $this->add(['name' => 'iso', 'options' => ['label' => ''], 'attributes' => ['type' => 'text', 'class' => 'form-control', 'id' => 'iso', 'maxlength' => 10]]);
     $this->add(['name' => 'currency', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => $options['currency_list']], 'attributes' => ['class' => 'form-control', 'id' => 'currency']]);
     $this->add(['name' => 'required_postal_code', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => \DDD\Service\Location::getRequiredPostalCodes()], 'attributes' => ['class' => 'form-control', 'id' => 'required_postal_code']]);
     $this->add(['name' => 'contact_phone', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => 'Contact Phone'], 'attributes' => ['class' => 'form-control', 'id' => 'contact_phone']]);
     /************City**************/
     $is_searchable = ['id' => 'is_searchable', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     if (is_object($data) && $data->getIs_searchable() > 0) {
         $is_searchable['checked'] = 'checked';
     }
     $this->add(['name' => 'is_searchable', 'options' => ['label' => 'Searchable'], 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $is_searchable]);
     $taxIncludedOptions = [LocationService::TAX_INCLUDED => 'Included', LocationService::TAX_EXCLUDED => 'Excluded'];
     $totIncluded = ['id' => 'tot_included', 'class' => 'form-control'];
     $vatIncluded = ['id' => 'vat_included', 'class' => 'form-control'];
     $cityTaxIncluded = ['id' => 'city_tax_included', 'class' => 'form-control'];
     $salesTaxIncluded = ['id' => 'city_tax_included', 'class' => 'form-control'];
     $this->add(['name' => 'tot', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'tot', 'placeholder' => 'Pure']]);
     $this->add(['name' => 'tot_additional', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'tot', 'placeholder' => 'Additional']]);
     $this->add(['name' => 'tot_type', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => Taxes::getTaxesType()], 'attributes' => ['class' => 'form-control tax-type', 'id' => 'tot_type']]);
     $this->add(['name' => 'tot_included', 'options' => ['label' => 'TOT Included', 'value_options' => $taxIncludedOptions], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => $totIncluded]);
     $this->add(['name' => 'tot_max_duration', 'attributes' => ['type' => 'text', 'placeholder' => 'Max. Duration', 'class' => 'form-control tax-duration', 'id' => 'tot-max-duration']]);
     $this->add(['name' => 'vat', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'vat', 'placeholder' => 'Pure']]);
     $this->add(['name' => 'vat_additional', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'vat', 'placeholder' => 'Additional']]);
     $this->add(['name' => 'vat_type', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => Taxes::getTaxesType()], 'attributes' => ['class' => 'form-control tax-type', 'id' => 'vat_type']]);
     $this->add(['name' => 'vat_included', 'options' => ['label' => 'VAT Included', 'value_options' => $taxIncludedOptions], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => $vatIncluded]);
     $this->add(['name' => 'vat_max_duration', 'attributes' => ['type' => 'text', 'placeholder' => 'Max. Duration', 'class' => 'form-control tax-duration', 'id' => 'vat-max-duration']]);
     $this->add(['name' => 'sales_tax', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'sales_tax', 'placeholder' => 'Pure']]);
     $this->add(['name' => 'sales_tax_additional', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'sales_tax', 'placeholder' => 'Additional']]);
     $this->add(['name' => 'sales_tax_type', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => Taxes::getTaxesType()], 'attributes' => ['class' => 'form-control tax-type', 'id' => 'sales_tax_type']]);
     $this->add(['name' => 'sales_tax_included', 'options' => ['label' => 'Sales Tax Included', 'value_options' => $taxIncludedOptions], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => $salesTaxIncluded]);
     $this->add(['name' => 'sales_tax_max_duration', 'attributes' => ['type' => 'text', 'placeholder' => 'Max. Duration', 'class' => 'form-control tax-duration', 'id' => 'sales-tax-max-duration']]);
     $this->add(['name' => 'city_tax', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'city_tax', 'placeholder' => 'Pure']]);
     $this->add(['name' => 'city_tax_additional', 'attributes' => ['type' => 'text', 'class' => 'form-control tax-value', 'id' => 'city_tax', 'placeholder' => 'Additional']]);
     $this->add(['name' => 'city_tax_type', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => false, 'value_options' => Taxes::getTaxesType(true)], 'attributes' => ['class' => 'form-control tax-type', 'id' => 'city_tax_type']]);
     $this->add(['name' => 'city_tax_included', 'options' => ['label' => 'City Tax Included', 'value_options' => $taxIncludedOptions], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => $cityTaxIncluded]);
     $this->add(['name' => 'city_tax_max_duration', 'attributes' => ['type' => 'text', 'placeholder' => 'Max. Duration', 'class' => 'form-control tax-duration', 'id' => 'city-tax-max-duration']]);
     /**********POI**********/
     $poi_type = [];
     if (isset($options['poi_types'])) {
         foreach ($options['poi_types'] as $row) {
             $poi_type[$row->getId()] = $row->getName();
         }
     }
     $this->add(['name' => 'poi_type', 'options' => ['label' => 'POI Type', 'value_options' => $poi_type], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => ['id' => 'poi_type', 'class' => 'form-control']]);
     $this->add(['name' => 'ws_show_right_column', 'type' => 'Zend\\Form\\Element\\Checkbox', 'options' => ['label' => 'Show Right Column', 'for' => "ws_show_right_column"], 'attributes' => ['id' => 'ws_show_right_column']]);
     $buttons_save = 'Create New Location';
     if (is_object($data)) {
         $buttons_save = 'Save Changes';
     }
     $this->add(['name' => 'save_button', 'options' => ['label' => $buttons_save], 'attributes' => ['type' => 'button', 'class' => 'btn btn-primary pull-right col-sm-2 col-xs-12 margin-left-10', 'data-loading-text' => 'Saving...', 'id' => 'save_button', 'value' => 'Save']]);
     $this->add(['name' => 'edit_id', 'attributes' => ['type' => 'hidden', 'id' => 'edit_id']]);
     $this->add(['name' => 'type_location', 'attributes' => ['type' => 'hidden', 'id' => 'type_location']]);
     $this->add(['name' => 'cover_image_post', 'attributes' => ['type' => 'hidden', 'id' => 'img1_post']]);
     $this->add(['name' => 'thumbnail_post', 'attributes' => ['type' => 'hidden', 'id' => 'img2_post']]);
     $this->add(['name' => 'autocomplete_id', 'attributes' => ['type' => 'hidden', 'id' => 'autocomplete_id']]);
     $this->add(['name' => 'edit_name', 'attributes' => ['type' => 'hidden', 'id' => 'edit_name']]);
     $this->add(['name' => 'edit_location_id', 'attributes' => ['type' => 'hidden', 'id' => 'edit_location_id']]);
     $this->add(['name' => 'poi_type_chaneg', 'attributes' => ['type' => 'hidden', 'id' => 'poi_type_chaneg']]);
     $this->add(['name' => 'province_short_name', 'attributes' => ['type' => 'text', 'class' => 'form-control', 'maxlength' => 150, 'id' => 'province_short_name']]);
     if (is_object($data)) {
         $this->add(['name' => 'delete_button', 'options' => ['label' => 'Delete'], 'attributes' => ['type' => 'button', 'class' => 'btn btn-danger pull-right col-sm-2 col-xs-12 margin-left-10', 'data-loading-text' => 'Deleteing...', 'id' => 'delete_button', 'value' => 'Delete']]);
     }
     if (is_object($data)) {
         $objectData = new \ArrayObject();
         $objectData['name'] = $data->getName();
         $objectData['edit_name'] = $data->getName();
         $objectData['latitude'] = $data->getLatitude();
         $objectData['longitude'] = $data->getLongitude();
         $objectData['information'] = $data->getInformation_text();
         $objectData['edit_id'] = $data->getId();
         $objectData['type_location'] = $type;
         $objectData['cover_image_post'] = '';
         $objectData['thumbnail_post'] = '';
         if ($data->getCover_image()) {
             $objectData['cover_image_post'] = '/locations/' . $data->getId() . '/' . $data->getCover_image();
         }
         if ($data->getThumbnail()) {
             $objectData['thumbnail_post'] = '/locations/' . $data->getId() . '/' . $data->getThumbnail();
         }
         if ($type == LocationService::LOCATION_TYPE_COUNTRY) {
             $objectData['iso'] = $data->getIso();
             $objectData['currency'] = isset($datas['currency']) ? $datas['currency'] : 0;
             $objectData['required_postal_code'] = isset($datas['required_postal_code']) ? $datas['required_postal_code'] : 0;
             $objectData['contact_phone'] = isset($datas['contactPhone']) ? $datas['contactPhone'] : 0;
         }
         if ($type == LocationService::LOCATION_TYPE_PROVINCE) {
             $objectData['province_short_name'] = $datas['province_short_name'];
         }
         if ($type == LocationService::LOCATION_TYPE_CITY) {
             if ($data->getTotType()) {
                 $objectData['tot_type'] = $data->getTotType();
                 $objectData['tot'] = $data->getTot() ? $data->getTot() : '';
                 $objectData['tot_additional'] = $data->getTotAdditional() ? $data->getTotAdditional() : '';
                 $objectData['tot_included'] = $data->getTotIncluded();
                 $objectData['tot_max_duration'] = $data->getTotMaxDuration() ? $data->getTotMaxDuration() : '';
             }
             if ($data->getVatType()) {
                 $objectData['vat_type'] = $data->getVatType();
                 $objectData['vat'] = $data->getVat() ? $data->getVat() : '';
                 $objectData['vat_additional'] = $data->getVatAdditional() ? $data->getVatAdditional() : '';
                 $objectData['vat_included'] = $data->getVatIncluded();
                 $objectData['vat_max_duration'] = $data->getVatMaxDuration() ? $data->getVatMaxDuration() : '';
             }
             if ($data->getSalesTaxType()) {
                 $objectData['sales_tax_type'] = $data->getSalesTaxType();
                 $objectData['sales_tax'] = $data->getSales_tax() ? $data->getSales_tax() : '';
                 $objectData['sales_tax_additional'] = $data->getSalesTaxAdditional();
                 $objectData['sales_tax_included'] = $data->getSalesTaxIncluded();
                 $objectData['sales_tax_max_duration'] = $data->getSalesTaxMaxDuration() ? $data->getSalesTaxMaxDuration() : '';
             }
             if ($data->getCityTaxType()) {
                 $objectData['city_tax_type'] = $data->getCityTaxType();
                 $objectData['city_tax'] = $data->getCity_tax() ? $data->getCity_tax() : '';
                 $objectData['city_tax_additional'] = $data->getCityTaxAdditional() ? $data->getCityTaxAdditional() : '';
                 $objectData['city_tax_included'] = $data->getCityTaxIncluded();
                 $objectData['city_tax_max_duration'] = $data->getCityTaxMaxDuration() ? $data->getCityTaxMaxDuration() : '';
             }
             $objectData['timezone'] = isset($datas['timezone']) ? $datas['timezone'] : '';
         }
         if ($type == LocationService::LOCATION_TYPE_POI) {
             $poitype = $datas['poitype'];
             $objectData['poi_type'] = $poitype->getType_id();
             $objectData['poi_type_chaneg'] = $poitype->getType_id();
             $objectData['ws_show_right_column'] = $poitype->getWsShowRightColumn();
         }
         $this->bind($objectData);
     }
 }
Ejemplo n.º 25
0
 /**
  *
  * @param string $guestArrivalTime
  * @return array
  */
 private function getArrivalTimeValues($guestArrivalTime)
 {
     $arrivalTime = date('H:i', strtotime($guestArrivalTime));
     if (in_array($arrivalTime, Objects::getTime())) {
         $result = array_merge([''], Objects::getTime());
     } else {
         $result = array_merge(['', $arrivalTime => $arrivalTime], Objects::getTime());
     }
     return $result;
 }
Ejemplo n.º 26
0
Archivo: Card.php Proyecto: arbi/MyCode
 /**
  * @param $rawData
  * @return int
  */
 public function processCreditCardData($rawData)
 {
     $partnerId = Partners::PARTNER_WEBSITE;
     /**
      * @var \CreditCard\Service\Encrypt $encryptService
      */
     $encryptService = $this->getServiceLocator()->get('service_encrypt');
     // Detect partner business model
     if (isset($rawData['partner_id']) && $rawData['partner_id']) {
         /**
          * @var \DDD\Dao\Partners\Partners $partnerDao
          */
         $partnerDao = $this->getServiceLocator()->get('dao_partners_partners');
         $partnerData = $partnerDao->getPartnerModel($rawData['partner_id']);
         if ($partnerData && $partnerData->getBusinessModel() == Partners::BUSINESS_MODEL_GINOSI_COLLECT_PARTNER) {
             $partnerId = $rawData['partner_id'];
         }
     }
     // Save CC Details
     $creditCard = new CompleteData();
     $pan = isset($rawData['number']) ? $rawData['number'] : '';
     $creditCard->setPan($encryptService->encrypt($pan, ''));
     $holder = isset($rawData['holder']) ? $rawData['holder'] : '';
     $creditCard->setHolder($encryptService->encrypt($holder, ''));
     $cvc = isset($rawData['cvc']) ? $rawData['cvc'] : '';
     $creditCard->setSecurityCode($encryptService->encrypt($cvc, ''));
     if (isset($rawData['year']) && strlen($rawData['year']) == 4) {
         $rawData['year'] = substr($rawData['year'], 2, 2);
     }
     $year = isset($rawData['year']) ? $rawData['year'] : '';
     $creditCard->setExpirationYear($encryptService->encrypt($year, ''));
     $month = isset($rawData['month']) ? $rawData['month'] : '';
     $creditCard->setExpirationMonth($encryptService->encrypt($month, ''));
     // Card Type
     $creditCardValidator = new CreditCardValidator();
     $cardType = $creditCardValidator->getCardTypeByNumber(substr($pan, 0, 6));
     $creditCard->setBrand(0);
     if ($cardType) {
         $creditCardType = Objects::getCreditCardId($cardType);
         $creditCard->setBrand($creditCardType);
     }
     $creditCard->setSource($rawData['source']);
     $creditCard->setStatus(self::CC_STATUS_UNKNOWN);
     $creditCard->setPartnerId($partnerId);
     $creditCard->setCustomerId($rawData['customer_id']);
     $creditCard->setDateProvided(date('Y-m-d h:i:s'));
     // Save cc details locally
     //        $this->gr2info('Successfully created CC data from ' . ucfirst($params['source_provider']), ['module' => 'Finance']);
     //        $ccId = $creditCard->getId();
     /**
      * @var Queue $creditCardCreationQueueService
      */
     $creditCardCreationQueueService = $this->getServiceLocator()->get('service_card_creation_queue');
     $cardId = $creditCardCreationQueueService->insert($creditCard);
     return $cardId;
     //        $this->gr2info('Successfully send to Processing Queue from ' . ucfirst($params['source_provider']), ['module' => 'Finance']);
     //
     //        $this->gr2info('Customer or CC create/update end from ' . ucfirst($params['source_provider']), ['module' => 'Finance']);
     //
     //        $logger->save(Logger::MODULE_BOOKING, $reservationId, Logger::ACTION_NEW_CC_DETAILS, $cardId);
     //        $this->gr2logException($e, 'Cannot update CC data from Frontier');
     //        $this->gr2debug($e->getMessage(), [
     //            'reservation_id'              => $reservationId,
     //            'customer_id'                 => $reservationData['customer_id'],
     //            'credit_card_source_provider' => 'frontier'
     //        ]);
 }
Ejemplo n.º 27
0
Archivo: Team.php Proyecto: arbi/MyCode
 public function __construct($name, $data, $options, $global, $isDirector, $alreadyAttachedApartments = [])
 {
     parent::__construct($name);
     $this->setName($name);
     $name_attr = ['type' => 'text', 'class' => 'form-control', 'id' => 'name', 'maxlength' => 50];
     $desc_attr = ['type' => 'text', 'class' => 'form-control', 'id' => 'description', 'maxlength' => 255];
     $members_attr = ['id' => 'members', 'class' => 'form-control', 'multiple' => true];
     $officersAttr = ['id' => 'officers', 'class' => 'form-control', 'multiple' => true];
     $managers_attr = ['class' => 'form-control selectize', 'id' => 'managers', 'multiple' => true];
     $isDirectorAttr = ['class' => 'form-control', 'id' => 'director'];
     $company_department = ['id' => 'usage_department', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     $comment_notifiable = ['id' => 'usage_notifiable', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     $isFrontier = ['id' => 'usage_frontier', 'use_hidden_element' => true, 'checked_value' => 1, 'unchecked_value' => 0];
     $isSecurity = ['id' => 'usage_security', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     $usageHiring = ['id' => 'usage_hiring', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     $usageStorage = ['id' => 'usage_storage', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     $isTaskable = ['id' => 'usage_taskable', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0];
     $frontierApartmentsAttr = ['id' => 'frontier-apartments', 'class' => 'form-control', 'multiple' => true];
     $frontierBuildingsAttr = ['id' => 'frontier-buildings', 'class' => 'form-control selectize', 'multiple' => true];
     if (!$global) {
         $name_attr['disabled'] = true;
         $desc_attr['disabled'] = true;
         $isDirectorAttr['disabled'] = true;
     }
     if (!$global && !$isDirector) {
         $managers_attr['disabled'] = true;
         $company_department['disabled'] = true;
         $isFrontier['disabled'] = true;
         $isSecurity['disabled'] = true;
         $isTaskable['disabled'] = true;
         $comment_notifiable['disabled'] = true;
         $frontierApartmentsAttr['disabled'] = true;
         $frontierBuildingsAttr['disabled'] = true;
     }
     $this->add(['name' => 'name', 'attributes' => $name_attr]);
     $this->add(['name' => 'description', 'attributes' => $desc_attr]);
     $memberList = [0 => '-- Choose --'];
     $memberRawList = $options->get('ginosiksList');
     if ($memberRawList->count()) {
         foreach ($memberRawList as $member) {
             $memberList[$member['id']] = $member['firstname'] . ' ' . $member['lastname'];
         }
     }
     $this->add(array('name' => 'director', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['value_options' => $memberList], 'attributes' => $isDirectorAttr));
     unset($memberList[0]);
     $this->add(array('name' => 'members', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['value_options' => $memberList], 'attributes' => $members_attr));
     $this->add(array('name' => 'officers', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['value_options' => $memberList], 'attributes' => $officersAttr));
     $this->add(array('name' => 'managers', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['value_options' => $memberList], 'attributes' => $managers_attr));
     if (is_object($data)) {
         if ($data->get('general')->getIsDepartment()) {
             $company_department['checked'] = 'checked';
         }
         if ($data->get('general')->getUsageSecurity()) {
             $isSecurity['checked'] = 'checked';
         }
         if ($data->get('general')->getUsageHiring()) {
             $usageHiring['checked'] = 'checked';
         }
         if ($data->get('general')->getUsageStorage()) {
             $usageStorage['checked'] = 'checked';
         }
         if ($data->get('general')->isCommentNotifiable()) {
             $comment_notifiable['checked'] = 'checked';
         }
         if ($data->get('general')->isFrontier()) {
             $isFrontier['checked'] = 'checked';
         }
         if ($data->get('general')->isTaskable()) {
             $isTaskable['checked'] = 'checked';
         }
     }
     $this->add(['name' => 'usage_department', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $company_department]);
     $this->add(['name' => 'usage_security', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $isSecurity]);
     $this->add(['name' => 'usage_hiring', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $usageHiring]);
     $this->add(['name' => 'usage_storage', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $usageStorage]);
     $this->add(['name' => 'usage_taskable', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $isTaskable]);
     $this->add(['name' => 'usage_notifiable', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $comment_notifiable]);
     $this->add(['name' => 'usage_frontier', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => $isFrontier]);
     foreach ($options->get('accommodationList') as $row) {
         $name = $row->getName();
         if (array_key_exists($row->getId(), $alreadyAttachedApartments)) {
             continue;
         }
         $accommodations[$row->getId()] = $name;
     }
     $this->add(array('name' => 'frontier_apartments', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['value_options' => $accommodations], 'attributes' => $frontierApartmentsAttr));
     $this->add(array('name' => 'frontier_buildings', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['value_options' => $options->get('apartmentGroups')], 'attributes' => $frontierBuildingsAttr));
     $this->add(['name' => 'extra_inspection', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => ['id' => 'extra_inspection', 'use_hidden_element' => false, 'checked_value' => 1, 'unchecked_value' => 0]]);
     $this->add(['name' => 'timezone', 'options' => ['label' => '', 'value_options' => ['' => '-- Choose Timezone --'] + Objects::getTimezoneOptions()], 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => ['id' => 'timezone', 'class' => 'form-control']]);
     $buttons_save = 'Create Team';
     if (is_object($data)) {
         $buttons_save = 'Save';
     }
     $this->add(['name' => 'save_button', 'options' => ['label' => $buttons_save], 'attributes' => ['type' => 'button', 'class' => 'btn btn-primary state col-sm-2 ' . 'col-xs-12 margin-left-10 pull-right', 'data-loading-text' => 'Saving...', 'id' => 'save_button', 'value' => 'Save']]);
     if ($global) {
         $this->add(['name' => 'group_delete_button', 'options' => ['label' => 'Delete Group'], 'attributes' => ['type' => 'button', 'class' => 'btn btn-danger btn-large ' . 'pull-right helper-margin-left-04em state', 'data-loading-text' => 'Deleteing...', 'id' => 'group_delete_button', 'value' => 'Delete Group']]);
     }
     if (is_object($data)) {
         $objectData = new \ArrayObject();
         $teamManagers = $data->get('teamManagers');
         $teamOfficers = $data->get('teamOfficers');
         $teamMembers = $data->get('teamMembers');
         $allUsers = $data->get('allUsers');
         $members = [];
         $memberListNew = $memberList;
         if (!empty($teamMembers)) {
             foreach ($teamMembers as $row) {
                 $members[] = $row->getUserId();
                 if (!isset($memberListNew[$row->getUserId()])) {
                     $memberListNew[$row->getUserId()] = $allUsers[$row->getUserId()];
                 }
             }
         }
         if ($memberListNew != $memberList) {
             $this->get('members')->setOptions(['value_options' => $memberListNew]);
         }
         $managers = [];
         $managerListNew = $memberList;
         if (!empty($teamManagers)) {
             foreach ($teamManagers as $row) {
                 $managers[] = $row->getUserId();
                 if (!isset($managerListNew[$row->getUserId()])) {
                     $managerListNew[$row->getUserId()] = $allUsers[$row->getUserId()];
                 }
             }
         }
         if ($managerListNew != $memberList) {
             $this->get('managers')->setOptions(['value_options' => $managerListNew]);
         }
         $officers = [];
         $officerListNew = $memberList;
         if (!empty($teamOfficers)) {
             foreach ($teamOfficers as $row) {
                 $officers[] = $row->getUserId();
                 if (!isset($officerListNew[$row->getUserId()])) {
                     $officerListNew[$row->getUserId()] = $allUsers[$row->getUserId()];
                 }
             }
         }
         if ($officerListNew != $memberList) {
             $this->get('officers')->setOptions(['value_options' => $officerListNew]);
         }
         $apartments = [];
         if ($data->get('frontierApartments')) {
             foreach ($data->get('frontierApartments') as $row) {
                 $apartments[] = $row->getApartmentId();
             }
         }
         $buildings = [];
         if ($data->get('frontierBuildings')) {
             foreach ($data->get('frontierBuildings') as $row) {
                 $buildings[] = $row->getBuildingId();
             }
         }
         $objectData['members'] = $members;
         $objectData['officers'] = $officers;
         $objectData['frontier_buildings'] = $buildings;
         $objectData['frontier_apartments'] = $apartments;
         $objectData['managers'] = $managers;
         if ($data->get('director')) {
             $objectData['director'] = $data->get('director')->getUserId();
         }
         $objectData['name'] = $data->get('general')->getName();
         $objectData['description'] = $data->get('general')->getDescription();
         $objectData['extra_inspection'] = $data->get('general')->getExtraInspection();
         $objectData['timezone'] = $data->get('general')->getTimezone();
         $this->bind($objectData);
     }
 }
Ejemplo n.º 28
0
 /**
  * @param int $reservationId
  * @return array
  * @throws \Exception
  */
 public function getFraudForReservation($reservationId)
 {
     if (!$reservationId) {
         throw new \Exception('Invalid Data for Fraud detection');
     }
     $fraudValue = $blackListValue = 0;
     $fraudText = '';
     $linkTicket = '<a href="/booking/edit/%s" target="_blank">%s</a>' . "\n";
     /**
      * @var $fraudDetectionDao FraudDetection
      */
     // No Real Time Detection. Fraud Detection for Credit Card and HolderName <-> FullName
     $fraudDetectionDao = $this->getServiceLocator()->get('dao_booking_fraud_detection');
     $fraudCCData = $fraudDetectionDao->getFraudByReservationId($reservationId);
     if ($fraudCCData->count()) {
         foreach ($fraudCCData as $row) {
             switch ($row['type']) {
                 case self::FRAUD_TYPE_FULLNAME_HOLDERNAME:
                     $fraudText .= TextConstants::FRAUD_NAME_HOLDER . '<br>';
                     $fraudValue += Objects::getFraudValue()['name_holder'];
                     break;
             }
         }
     }
     // credit cards with status "Fraud"
     // if there is one cc with status "Fraud" fraud score will be incremented by 100
     $reservationsDao = new BookingDao($this->getServiceLocator(), '\\ArrayObject');
     $customerId = $reservationsDao->getCustomerIdByReservationId($reservationId);
     /**
      * @var Token $tokenDao
      */
     $tokenDao = $this->getServiceLocator()->get('dao_cc_token');
     $customerFraudCreditCards = $tokenDao->fetchAll(['customer_id' => $customerId, 'status' => CardService::CC_STATUS_FRAUD], ['id']);
     if ($customerFraudCreditCards->count()) {
         $fraudText .= TextConstants::FRAUD_CREDIT_CARD . '<br>';
         $fraudValue += Objects::getFraudValue()['credit_card'];
     }
     // Real Time Fraud Detection from blacklist
     $data = $this->getFraudCombinationAndData($reservationId);
     /**
      * @var $blackListDao BlackList
      */
     $blackListDao = $this->getServiceLocator()->get('dao_booking_black_list');
     $blackListResult = $blackListDao->getBlackList(['fullName' => $data['fullName'], 'fullNamePhone' => $data['fullNamePhone'], 'fullNameAddress' => $data['fullNameAddress'], 'email' => $data['guest_email'], 'phone' => $data['phone']]);
     if ($blackListResult->count()) {
         $blackListArr = [];
         foreach ($blackListResult as $row) {
             $blackListArr[$row['type']] = $row;
         }
         // Filtering duplicates.
         if (!empty($blackListArr[self::FRAUD_TYPE_FULLNAME_PHONE])) {
             unset($blackListArr[self::FRAUD_TYPE_PHONE]);
             unset($blackListArr[self::FRAUD_TYPE_FULLNAME]);
         }
         foreach ($blackListArr as $row) {
             switch ($row['type']) {
                 case self::FRAUD_TYPE_EMAIL:
                     $fraudText .= $reservationId != $row['reservation_id'] ? sprintf($linkTicket, $row['res_number'], TextConstants::FRAUD_BLACKLIST_EMAIL) : TextConstants::FRAUD_BLACKLIST_EMAIL . "\n";
                     $fraudText .= '<br>';
                     $blackListValue = Objects::getFraudValue()['black_list'];
                     break;
                 case self::FRAUD_TYPE_FULLNAME_PHONE:
                     $fraudText .= $reservationId != $row['reservation_id'] ? sprintf($linkTicket, $row['res_number'], TextConstants::FRAUD_BLACKLIST_NSP) : TextConstants::FRAUD_BLACKLIST_NSP . "\n";
                     $fraudText .= '<br>';
                     $blackListValue = Objects::getFraudValue()['black_list'];
                     break;
                 case self::FRAUD_TYPE_FULLNAME_ADDRESS:
                     $fraudText .= $reservationId != $row['reservation_id'] ? sprintf($linkTicket, $row['res_number'], TextConstants::FRAUD_BLACKLIST_NSA) : TextConstants::FRAUD_BLACKLIST_NSA . "\n";
                     $fraudText .= '<br>';
                     $blackListValue = Objects::getFraudValue()['black_list'];
                     break;
                 case self::FRAUD_TYPE_FULLNAME:
                     $fraudText .= $reservationId != $row['reservation_id'] ? sprintf($linkTicket, $row['res_number'], TextConstants::FRAUD_BLACKLIST_NS) : TextConstants::FRAUD_BLACKLIST_NS . "\n";
                     $fraudText .= '<br>';
                     $blackListValue = Objects::getFraudValue()['full_name'];
                     break;
                 case self::FRAUD_TYPE_PHONE:
                     $fraudText .= $reservationId != $row['reservation_id'] ? sprintf($linkTicket, $row['res_number'], TextConstants::FRAUD_BLACKLIST_PHONE) : TextConstants::FRAUD_BLACKLIST_PHONE . "\n";
                     $fraudText .= '<br>';
                     $blackListValue = Objects::getFraudValue()['phone'];
                     break;
             }
         }
     }
     // Fraud Detection Country IP
     $ipAddress = long2ip($data['reservation']['ip_address']);
     if (filter_var($ipAddress, FILTER_VALIDATE_IP) && $ipAddress != '127.0.0.1') {
         $geoLocationDao = $this->getServiceLocator()->get('dao_geolite_country_geolite_country');
         $countryID = $geoLocationDao->getCountryIDByIp(ip2long($ipAddress));
         if ($data['reservation']['guest_country_id'] != $countryID) {
             $fraudValue += Objects::getFraudValue()['country_ip'];
             $fraudText .= TextConstants::FRAUD_COUNTRY_IP . '<br>';
         }
     }
     $fraudValue += $blackListValue;
     if ($fraudValue < self::FRAUD_VALUE_GREEN) {
         $class = 'label-default';
     } elseif ($fraudValue >= self::FRAUD_VALUE_GREEN && $fraudValue < self::FRAUD_VALUE_ORANGE) {
         $class = 'label-warning';
     } else {
         $class = 'label-danger';
     }
     if ($fraudValue == 0) {
         $fraudText = TextConstants::FRAUD_NONE . '<br>';
         $fraudValue = TextConstants::FRAUD_NONE;
     }
     return ['value' => $fraudValue, 'text' => $fraudText, 'class' => $class];
 }
Ejemplo n.º 29
0
 /**
  *
  * @return array
  */
 public function getOptions($data)
 {
     /* @var $websiteSearchService \DDD\Service\Website\Search */
     $websiteSearchService = $this->getServiceLocator()->get('service_website_search');
     $diffHours = $websiteSearchService->getDiffHoursForDate();
     $options['current_date'] = Helper::getCurrenctDateByTimezone($data['city_data']['timezone'], 'd-m-Y', $diffHours);
     $router = $this->getServiceLocator()->get('router');
     $url = $router->assemble([], ['name' => 'search']);
     $options['url'] = $url;
     $guest = Objects::getGuestList(['guest' => $this->getTextLineSite(1455), 'guests' => $this->getTextLineSite(1456)]);
     $options['guest'] = $guest;
     return $options;
 }
Ejemplo n.º 30
0
 /**
  * @param int $transactionId
  * @param int $transactionStatus
  * @param int $transactionType
  * @return array
  */
 public function changeTransactionState($transactionId, $transactionStatus, $transactionType)
 {
     /**
      * @var \DDD\Dao\Booking\ChargeTransaction $bankTransactionDao
      * @var \Library\Authentication\BackofficeAuthenticationService $authenticationService
      * @var \DDD\Service\Booking\BookingTicket $bookingTicketService
      * @var ChargeTransaction $transactionData
      * @var Transactions $moneyTransactionDao
      */
     $authService = $this->getServiceLocator()->get('library_backoffice_auth');
     $bookingTicketService = $this->getServiceLocator()->get('service_booking_booking_ticket');
     $bankTransactionDao = $this->getServiceLocator()->get('dao_booking_change_transaction');
     $moneyTransactionDao = $this->getServiceLocator()->get('dao_finance_transaction_transactions');
     $bookingDao = $this->getServiceLocator()->get('dao_booking_booking');
     $timestamp = date('Y-m-d H:i:s');
     try {
         $bankTransactionDao->beginTransaction();
         if (!($transactionId > 0 && $transactionStatus > 0)) {
             throw new \RuntimeException(TextConstants::ERROR_BAD_REQUEST);
         }
         $auth = $authService->getIdentity();
         $logger = $auth->firstname . ' ' . $auth->lastname;
         $transactionData = $bankTransactionDao->fetchOne(['id' => $transactionId], ['reservation_id', 'money_transaction_id', 'status', 'comment', 'type']);
         if (!$transactionData) {
             throw new \RuntimeException(TextConstants::ERROR_BAD_REQUEST);
         }
         $comment = sprintf(TextConstants::COMMENT_TRANSACTION_ONLY_STATUS, self::$transactionStatus[$transactionData->getStatus()], self::$transactionStatus[$transactionStatus], $timestamp, $logger);
         $changeData = ['status' => $transactionStatus, 'reviewed' => 0];
         $returnStatus = 'success';
         $returnMsg = TextConstants::SUCCESS_UPDATE;
         if ($transactionType > 0 && in_array($transactionType, [self::BANK_TRANSACTION_TYPE_CHARGEBACK_FRAUD, self::BANK_TRANSACTION_TYPE_CHARGEBACK_OTHER, self::BANK_TRANSACTION_TYPE_CHARGEBACK_DISPUTE])) {
             $changeData['type'] = $transactionType;
             // in case when transaction is chargeback and it's reason of fraud, we must update data in black list table
             if ($transactionType == self::BANK_TRANSACTION_TYPE_CHARGEBACK_FRAUD && $transactionStatus == self::BANK_TRANSACTION_STATUS_APPROVED) {
                 $serviceFraud = $this->getServiceLocator()->get('service_fraud');
                 $fraud = $serviceFraud->saveFraudManual($transactionData->getReservationId());
                 if (isset($fraud['status']) && $fraud['status'] != 'success' && isset($fraud['msg'])) {
                     $returnStatus = 'warning';
                     $returnMsg .= "<br>{$fraud['msg']}";
                 }
             }
             $comment = sprintf(TextConstants::COMMENT_TRANSACTION_STATUS_TYPE, Objects::getChargeType()[$transactionData->getType()], self::$transactionStatus[$transactionData->getStatus()], Objects::getChargeType()[$transactionType], self::$transactionStatus[$transactionStatus], $timestamp, $logger);
         }
         if ($transactionData->getComment()) {
             $comment = "{$transactionData->getComment()}<br>{$comment}";
         }
         // Money Transaction status change
         if ($transactionStatus == self::BANK_TRANSACTION_STATUS_VOIDED) {
             $siblingCount = $moneyTransactionDao->getSiblingTransactionsCount($transactionData->getMoneyTransactionId());
             // If One to One connected reservation transaction
             if ($siblingCount == 1) {
                 // Disconnect from money transaction
                 $changeData['money_transaction_id'] = null;
                 $returnMsg = 'Reservation Transaction voided and all related Money Transactions have also been removed.';
                 // Remove money transaction
                 $moneyTransactionDao->delete(['id' => $transactionData->getMoneyTransactionId()]);
             } else {
                 $returnMsg = 'Reservation Transaction has been voided, however the Money Transaction has NOT been removed.';
             }
         }
         $changeData['comment'] = $comment;
         $bankTransactionDao->save($changeData, ['id' => $transactionId]);
         // after transaction save, we must recalculate balance and update it in reservations table
         $balances = $bookingTicketService->getSumAndBalanc($transactionData->getReservationId());
         $updateReservationData = ['guest_balance' => number_format($balances['ginosiBalanceInApartmentCurrency'], 2, '.', ''), 'partner_balance' => number_format($balances['partnerBalanceInApartmentCurrency'], 2, '.', '')];
         $bookingDao->save($updateReservationData, ['id' => $transactionData->getReservationId()]);
         $bankTransactionDao->commitTransaction();
         $result = ['status' => $returnStatus, 'msg' => $returnMsg];
     } catch (\RuntimeException $ex) {
         $bankTransactionDao->rollbackTransaction();
         $result = ['status' => 'error', 'msg' => $ex->getMessage()];
     } catch (\Exception $ex) {
         $bankTransactionDao->rollbackTransaction();
         $result = ['status' => 'error', 'msg' => TextConstants::SERVER_ERROR];
     }
     return $result;
 }