Example #1
0
 public function fetchPaidCompleted(User $user)
 {
     $qb = $this->getEntityManager()->createQueryBuilder();
     $qb->select('auction')->from('WoojinStoreBundle:Auction', 'auction')->where($qb->expr()->andX($qb->expr()->eq('auction.createStore', ':createStoreId'), $qb->expr()->eq('auction.profitStatus', ':profitStatus')));
     $qb->setParameter('createStoreId', $user->getStore()->getId())->setParameter('profitStatus', Auction::PROFIT_STATUS_PAY_COMPLETE);
     return $qb->getQuery()->getResult();
 }
Example #2
0
 public function getImgRelDir(User $user)
 {
     $dirParts = array();
     $dirParts[] = 'img';
     $dirParts[] = 'product';
     $dirParts[] = $user->getStore()->getSn();
     $dirParts[] = $this->brand ? $this->brand->getName() : 'NoBrand';
     $dirParts[] = $this->pattern ? $this->pattern->getName() : 'NoPattern';
     $dirParts[] = $this->sn;
     return '/' . implode('/', $dirParts);
 }
Example #3
0
 protected function genCriteria(Request $request, User $user)
 {
     $criteria = $request->request->all();
     if ($user->getRole()->hasAuth('BSO_VIEW_ALL_PROFIT') && array_key_exists('stores', $criteria)) {
         $criteria['stores'] = $criteria['stores'];
     }
     if (!$user->getRole()->hasAuth('BSO_VIEW_ALL_PROFIT')) {
         $criteria['stores'] = $user->getStore()->getId();
     }
     return $criteria;
 }
Example #4
0
 /**
  * 是否允許分派紅利
  *
  * 1. 競拍實體狀態是否為售出
  * 2. 競拍毛利狀態是否為已付清
  * 3. 操作者所屬店家是否和競拍刷入店家相同
  * 
  * @param  Woojin\UserBundle\Entity\User    $user [操作者]
  * @return boolean
  */
 public function isAllowedAssignProfit(User $user)
 {
     return Auction::STATUS_SOLD === $this->getStatus() && Auction::PROFIT_STATUS_PAY_COMPLETE === $this->getProfitStatus() && $user->getStore()->getId() === $this->getCreateStore()->getId();
 }
Example #5
0
 /**
  * Is the custom belong to the given user?
  *
  * @param  \Woojin\UserBundle\Entity\User   $user
  * @return boolean
  */
 public function isBelongUserStore(User $user)
 {
     return $this->getStore()->getId() === $user->getStore()->getId();
 }
 /**
  * GenCriteria by request  and the auth user
  *
  * @param  \Symfony\Component\HttpFoundation\Request    $request
  * @param  \Woojin\UserBundle\Entity\User    $user
  * @return array
  */
 protected function genCreateCriteria(Request $request, User $user)
 {
     $criteria = array('mobil' => $request->get('mobil'), 'store' => $user->getStore());
     return array_filter($criteria, array($this, '_isNotNull'));
 }
 public function getConsignFromOurStore(User $user)
 {
     $qb = $this->getEntityManager()->createQueryBuilder();
     $qb->select(array('g', 'o', 'p'))->from('WoojinGoodsBundle:GoodsPassport', 'g')->leftJoin('g.orders', 'o')->leftJoin('g.parent', 'p')->leftJoin('p.orders', 'po')->where($qb->expr()->andX($qb->expr()->eq('p.status', Avenue::GS_OTHERSTORE), $qb->expr()->eq('po.kind', Avenue::OK_FEEDBACK), $qb->expr()->eq('po.status', Avenue::OS_HANDLING), $qb->expr()->eq('SUBSTRING(p.sn, 1, 1)', $qb->expr()->literal($user->getStore()->getSn()))));
     return $qb->getQuery()->getResult();
 }
Example #8
0
 /**
  * For the purpose of typeahead
  *
  * @param  Woojin\UserBundle\Entity\User   $user
  * @param  string $mobil
  * @return array
  */
 public function getTypeahead(User $user, $mobil)
 {
     $em = $this->getEntityManager();
     $qb = $em->createQueryBuilder();
     $qb->select('c')->from('WoojinOrderBundle:Custom', 'c')->where($qb->expr()->andX($qb->expr()->like('c.mobil', '?1'), $qb->expr()->eq('c.store', $user->getStore()->getId())));
     $qb->setParameter('1', "{$mobil}%");
     return $qb->getQuery()->getResult();
 }
Example #9
0
 /**
  * Is auction belong to the given user's store
  *
  * @param  \Woojin\UserBundle\Entity\User  User    $user
  * @return boolean
  */
 public function isAuctionBelongGivenUsersStore(User $user)
 {
     if (NULL === $this->getBsoStore()) {
         return false;
     }
     return $this->getBsoStore()->getId() === $user->getStore()->getId();
 }