Exemplo n.º 1
0
 /**
  * Create order for current item and delete item from cart
  *
  * @return bool
  */
 public function order()
 {
     $obOrder = $this->_mapper->createObject('order', array('user_id' => $this->getCart()->user_id, 'present_id' => $this->present_id, 'price' => $this->getPresent()->price, 'quantity' => $this->quantity, 'state' => RM_Presents_Order_State::CREATE));
     if ($obOrder->save()) {
         M('Points')->newPresentOrder(array('user_id' => $this->getCart()->user_id, 'present_id' => $this->present_id, 'price' => $this->getPresent()->price, 'quantity' => $this->quantity));
     }
     $this->delete();
     return TRUE;
 }
Exemplo n.º 2
0
 /**
  * Enter description here...
  *
  * @return RM_Presents_Order_Item
  */
 public function getItemsList()
 {
     return $this->_mapper->getOrderItems($this);
 }
Exemplo n.º 3
0
 /**
  * Enter description here...
  *
  * @return RM_Db_Query
  */
 public function getOrdersControlReportQuery()
 {
     return M('Db')->createQuery($this->_mapper->table('order') . ' AS r')->join('r', 'LEFT JOIN ' . M('User')->table('user') . ' AS u ON r.user_id = u.user_id')->join('r', 'LEFT JOIN ' . $this->_mapper->table('present') . ' AS p ON r.present_id = p.id')->what('u.city_id,p.name,r.*')->where('u.is_tester = 0');
 }