function store(&$data)
 {
     if (!vmAccess::manager('manufacturercategories')) {
         vmWarn('Insufficient permissions to store manufacturer category');
         return false;
     }
     return parent::store($data);
 }
예제 #2
0
 /**
  * Retireve a list of paymentsetting from the database.
  *
  * This is written to get a list for selecting paymentsetting. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of paymentsetting objects
  */
 function store(&$data)
 {
     if (!vmAccess::manager('paymentsetting')) {
         vmWarn('Insufficient permissions to store paymentsetting');
         return false;
     }
     return parent::store($data);
 }
예제 #3
0
 /**
  * Retireve a list of general from the database.
  *
  * This is written to get a list for selecting general. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of general objects
  */
 function store(&$data)
 {
     $tsmart_general_id = $data['tsmart_general_id'];
     if ($tsmart_general_id) {
         $general = $this->getItem($tsmart_general_id);
         $result = array_merge($general->params->toArray(), $data['params']);
         $data['params'] = json_encode($result);
     }
     if (!vmAccess::manager('general')) {
         vmWarn('Insufficient permissions to store general');
         return false;
     }
     return parent::store($data);
 }
예제 #4
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     if (!vmAccess::manager('supplier')) {
         vmWarn('Insufficient permissions to store supplier');
         return false;
     }
     $tsmart_supplier_id = parent::store($data);
     if ($tsmart_supplier_id) {
         $db = JFactory::getDbo();
     }
     return $tsmart_supplier_id;
     //end insert group size
 }
예제 #5
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     $db = JFactory::getDbo();
     if (!vmAccess::manager('payment')) {
         vmWarn('Insufficient permissions to store payment');
         return false;
     }
     $tsmart_payment_id = parent::store($data);
     if ($tsmart_payment_id) {
         //insert to tour in payment
         $query = $db->getQuery(true);
         $query->delete('#__tsmart_tour_id_payment_id')->where('tsmart_payment_id=' . (int) $tsmart_payment_id);
         $db->setQuery($query)->execute();
         $err = $db->getErrorMsg();
         if (!empty($err)) {
             vmError('can not delete tour in payment', $err);
         }
         $list_tour_id = $data['list_tour_id'];
         foreach ($list_tour_id as $tsmart_product_id) {
             $query->clear()->insert('#__tsmart_tour_id_payment_id')->set('tsmart_product_id=' . (int) $tsmart_product_id)->set('tsmart_payment_id=' . (int) $tsmart_payment_id);
             $db->setQuery($query)->execute();
             $err = $db->getErrorMsg();
             if (!empty($err)) {
                 vmError('can not insert tour in this payment', $err);
             }
         }
         //end insert to tour in payment
         //insert to payment method in payment
         $query = $db->getQuery(true);
         $query->delete('#__tsmart_payment_id_payment_method_id')->where('tsmart_payment_id=' . (int) $tsmart_payment_id);
         $db->setQuery($query)->execute();
         $err = $db->getErrorMsg();
         if (!empty($err)) {
             vmError('can not delete payment method in payment', $err);
         }
         $list_payment_method_id = $data['list_payment_method_id'];
         foreach ($list_payment_method_id as $tsmart_payment_method_id) {
             $query->clear()->insert('#__tsmart_payment_id_payment_method_id')->set('tsmart_payment_method_id=' . (int) $tsmart_payment_method_id)->set('tsmart_payment_id=' . (int) $tsmart_payment_id);
             $db->setQuery($query)->execute();
             $err = $db->getErrorMsg();
             if (!empty($err)) {
                 vmError('can not insert payment method in this payment', $err);
             }
         }
         //end insert to payment method in payment
     }
     return $tsmart_payment_id;
 }
예제 #6
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     if (!vmAccess::manager('language')) {
         vmWarn('Insufficient permissions to store language');
         return false;
     }
     return parent::store($data);
 }
예제 #7
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     if (!vmAccess::manager('hotel')) {
         vmWarn('Insufficient permissions to store hotel');
         return false;
     }
     $db = JFactory::getDbo();
     $tsmart_hotel_addon_id = parent::store($data);
     if ($tsmart_hotel_addon_id) {
         //inser to excusionaddon
         $query = $db->getQuery(true);
         $query->delete('#__tsmart_tour_id_hotel_addon_id')->where('tsmart_hotel_addon_id=' . (int) $tsmart_hotel_addon_id);
         $db->setQuery($query)->execute();
         $err = $db->getErrorMsg();
         if (!empty($err)) {
             vmError('can not delete tour in hotel_addon', $err);
         }
         $list_tour_id = $data['list_tour_id'];
         foreach ($list_tour_id as $tsmart_product_id) {
             $query->clear()->insert('#__tsmart_tour_id_hotel_addon_id')->set('tsmart_product_id=' . (int) $tsmart_product_id)->set('tsmart_hotel_addon_id=' . (int) $tsmart_hotel_addon_id);
             $db->setQuery($query)->execute();
             $err = $db->getErrorMsg();
             if (!empty($err)) {
                 vmError('can not insert tour in this hotel_addon', $err);
             }
         }
         $hotel_addon_type = $data['hotel_addon_type'];
         $hotel_addon_date_price_table = $this->getTable('hotel_addon_date_price');
         //end insert group size
         $data_price = $data['data_price'];
         $data_price = base64_decode($data_price);
         require_once JPATH_ROOT . '/libraries/upgradephp-19/upgrade.php';
         $data_price = up_json_decode($data_price, false, 512, JSON_PARSE_JAVASCRIPT);
         $item_mark_up_type = $data_price->item_mark_up_type;
         foreach ($list_tour_id as $tour_id) {
             $vail_from = JFactory::getDate($data['vail_from']);
             $vail_to = JFactory::getDate($data['vail_to']);
             $single_room = $data_price->items->single_room;
             $double_twin_room = $data_price->items->double_twin_room;
             $triple_room = $data_price->items->triple_room;
             while ($vail_from->getTimestamp() <= $vail_to->getTimestamp()) {
                 $date = $vail_from->format('Y-m-d');
                 $hotel_addon_date_price_table->id = 0;
                 $hotel_addon_date_price_table->jload(array('date' => $date, 'tsmart_product_id' => $tour_id, 'hotel_addon_type' => $hotel_addon_type));
                 $hotel_addon_date_price_table->date = $date;
                 $hotel_addon_date_price_table->tsmart_hotel_addon_id = $tsmart_hotel_addon_id;
                 $hotel_addon_date_price_table->tsmart_product_id = $tour_id;
                 $hotel_addon_date_price_table->hotel_addon_type = $hotel_addon_type;
                 $hotel_addon_date_price_table->single_room_net_price = $single_room->net_price;
                 $hotel_addon_date_price_table->doulble_twin_room_net_price = $double_twin_room->net_price;
                 $hotel_addon_date_price_table->triple_room_net_price = $triple_room->net_price;
                 //tax
                 $hotel_addon_date_price_table->single_room_tax = $single_room->tax;
                 $hotel_addon_date_price_table->doulble_twin_room_tax = $double_twin_room->tax;
                 $hotel_addon_date_price_table->triple_room_tax = $triple_room->tax;
                 if ($item_mark_up_type == 'percent') {
                     $hotel_addon_date_price_table->single_room_mark_up_percent = $single_room->mark_up_percent;
                     $hotel_addon_date_price_table->doulble_twin_room_mark_up_percent = $double_twin_room->mark_up_percent;
                     $hotel_addon_date_price_table->triple_room_mark_up_percent = $triple_room->mark_up_percent;
                 } else {
                     $hotel_addon_date_price_table->single_room_mark_up_amout = $single_room->mark_up_amount;
                     $hotel_addon_date_price_table->doulble_twin_room_mark_up_amount = $double_twin_room->mark_up_amount;
                     $hotel_addon_date_price_table->triple_room_mark_up_amout = $triple_room->mark_up_amount;
                 }
                 $ok = $hotel_addon_date_price_table->store();
                 if (!$ok) {
                     throw new Exception($hotel_addon_date_price_table->getError());
                 }
                 $vail_from->modify('+1 day');
             }
         }
     }
     return $tsmart_hotel_addon_id;
 }
예제 #8
0
 function store(&$data)
 {
     if (!vmAccess::manager('shoppergroup.edit')) {
         vmWarn('Insufficient permissions to store shoppergroup');
         return false;
     }
     return parent::store($data);
 }
예제 #9
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     if (!vmAccess::manager('hotel')) {
         vmWarn('Insufficient permissions to store hotel');
         return false;
     }
     $db = JFactory::getDbo();
     $tsmart_coupon_id = parent::store($data);
     return $tsmart_coupon_id;
 }
예제 #10
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     $db = JFactory::getDbo();
     if (!vmAccess::manager('transferaddon')) {
         vmWarn('Insufficient permissions to store transferaddon');
         return false;
     }
     $tsmart_transfer_addon_id = parent::store($data);
     if ($tsmart_transfer_addon_id) {
         //inser to excusionaddon
         $query = $db->getQuery(true);
         $query->delete('#__tsmart_tour_id_transfer_addon_id')->where('tsmart_transfer_addon_id=' . (int) $tsmart_transfer_addon_id);
         $db->setQuery($query)->execute();
         $err = $db->getErrorMsg();
         if (!empty($err)) {
             vmError('can not delete tour in transfer_addon', $err);
         }
         $list_tour_id = $data['list_tour_id'];
         foreach ($list_tour_id as $tsmart_product_id) {
             $query->clear()->insert('#__tsmart_tour_id_transfer_addon_id')->set('tsmart_product_id=' . (int) $tsmart_product_id)->set('tsmart_transfer_addon_id=' . (int) $tsmart_transfer_addon_id);
             $db->setQuery($query)->execute();
             $err = $db->getErrorMsg();
             if (!empty($err)) {
                 vmError('can not insert tour in this transfer_addon', $err);
             }
         }
         //end insert group size
     }
     return $tsmart_transfer_addon_id;
 }
예제 #11
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     $tsmart_promotion_price_id = parent::store($data);
     if ($tsmart_promotion_price_id) {
         $tsmart_product_id = $data['tsmart_product_id'];
         $model_product = $this->getModel('product');
         $product = $model_product->getItem($tsmart_product_id);
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
         if ($tsmart_promotion_price_id && $product->price_type != tsmGroupSize::FLAT_PRICE) {
             $tour_promotion_price_by_tour_promotion_price_id = $data['tour_promotion_price_by_tour_promotion_price_id'];
             $this->save_promotion_price_group_size_by_promotion_price_id($tour_promotion_price_by_tour_promotion_price_id, $tsmart_promotion_price_id);
             $amount = $data['amount']->markup_promotion_price;
             $percent = $data['percent']->markup_promotion_price;
             $this->save_markup_promotion_price($amount, $percent, $tsmart_promotion_price_id);
             $amount = $data['amount']->net_markup_promotion_price;
             $percent = $data['percent']->net_markup_promotion_price;
             $this->save_net_markup_promotion_price($amount, $percent, $tsmart_promotion_price_id);
         } else {
             $tour_promotion_price_by_tour_promotion_price_id = $data['tour_promotion_price_by_tour_promotion_price_id'];
             $this->save_promotion_price_group_size_by_promotion_price_id_tour_private($tour_promotion_price_by_tour_promotion_price_id, $tsmart_promotion_price_id);
             $amount = $data['amount']->mark_up;
             $percent = $data['percent']->promotion;
             $this->save_markup_promotion_price($amount, $percent, $tsmart_promotion_price_id);
             $amount = $data['amount']->mark_up;
             $percent = $data['percent']->promotion;
             $this->save_net_markup_promotion_price($amount, $percent, $tsmart_promotion_price_id);
         }
     }
     return $tsmart_promotion_price_id;
 }
예제 #12
0
 public function store(&$data)
 {
     $return = parent::store($data);
     // TODO: Change the autogenerated stub
     return $return;
 }
예제 #13
0
 /**
  * Retireve a list of currencies from the database.
  *
  * This is written to get a list for selecting currencies. Therefore it asks for enabled
  * @author Max Milbers
  * @return object List of currency objects
  */
 function store(&$data)
 {
     if (!vmAccess::manager('accommodation')) {
         vmWarn('Insufficient permissions to store accommodation');
         return false;
     }
     $tsmart_accommodation_id = parent::store($data);
     if ($tsmart_accommodation_id) {
         $list_hotel_service_class = $data['list_hotel_service_class'];
         foreach ($list_hotel_service_class as $tsmart_service_class_id => $list_hotel) {
             $query = $this->_db->getQuery(true);
             $query->delete('#__tsmart_hotel_id_service_class_id_accommodation_id')->where('tsmart_service_class_id=' . (int) $tsmart_service_class_id)->where('tsmart_accommodation_id=' . (int) $tsmart_accommodation_id);
             $this->_db->setQuery($query);
             $ok = $this->_db->execute();
             if (!$ok) {
                 throw new Exception($this->_db->getErrorMsg());
             }
             foreach ($list_hotel as $key => $tsmart_hotel_id) {
                 if (!is_numeric($key)) {
                     $key = explode(':', $key);
                     $key = $key[1];
                 } else {
                     $key = 0;
                 }
                 $tsmart_service_class_id = $tsmart_service_class_id ? $tsmart_service_class_id : 0;
                 $tsmart_hotel_id = $tsmart_hotel_id ? $tsmart_hotel_id : 0;
                 $table_hotel_id_service_class_id_accommodation_id = $this->getTable('hotel_id_service_class_id_accommodation_id');
                 $table_hotel_id_service_class_id_accommodation_id->tsmart_service_class_id = $tsmart_service_class_id;
                 $table_hotel_id_service_class_id_accommodation_id->tsmart_hotel_id = $tsmart_hotel_id;
                 $table_hotel_id_service_class_id_accommodation_id->tsmart_accommodation_id = $tsmart_accommodation_id;
                 if ($tsmart_hotel_id && $tsmart_service_class_id && $tsmart_accommodation_id) {
                     $table_hotel_id_service_class_id_accommodation_id->store(true);
                 }
                 $errors = $table_hotel_id_service_class_id_accommodation_id->getErrors();
                 if (count($errors)) {
                     throw new Exception($table_hotel_id_service_class_id_accommodation_id->getError());
                 }
             }
         }
     }
 }