@UniqueEntity("email")
Inheritance: extends Eccube\Entity\AbstractEntity, implements Symfony\Component\Security\Core\User\UserInterface
コード例 #1
0
 public function newCustomer()
 {
     $Customer = new \Eccube\Entity\Customer();
     $Status = $this->getEntityManager()->getRepository('Eccube\\Entity\\Master\\CustomerStatus')->find(1);
     $Customer->setStatus($Status)->setDelFlg(0);
     return $Customer;
 }
コード例 #2
0
 /**
  * 受注編集用フォーム作成.
  *
  * @param Customer $Customer
  * @param Product $Product
  * @return array
  */
 public function createFormData(Customer $Customer, Product $Product = null)
 {
     $faker = $this->getFaker();
     $tel = explode('-', $faker->phoneNumber);
     $email = $faker->safeEmail;
     $delivery_date = $faker->dateTimeBetween('now', '+ 5 days');
     $OrderDetails = array();
     if (is_object($Product)) {
         $ProductClasses = $Product->getProductClasses();
         $OrderDetails[] = array('Product' => $Product->getId(), 'ProductClass' => $ProductClasses[0]->getId(), 'price' => $ProductClasses[0]->getPrice02(), 'quantity' => $faker->randomNumber(2), 'tax_rate' => 8);
     }
     $Shippings = array(array('name' => array('name01' => $faker->lastName, 'name02' => $faker->firstName), 'kana' => array('kana01' => $faker->lastKanaName, 'kana02' => $faker->firstKanaName), 'company_name' => $faker->company, 'zip' => array('zip01' => $faker->postcode1(), 'zip02' => $faker->postcode2()), 'address' => array('pref' => $faker->numberBetween(1, 47), 'addr01' => $faker->city, 'addr02' => $faker->streetAddress), 'tel' => array('tel01' => $tel[0], 'tel02' => $tel[1], 'tel03' => $tel[2]), 'fax' => array('fax01' => $tel[0], 'fax02' => $tel[1], 'fax03' => $tel[2]), 'Delivery' => 1, 'DeliveryTime' => 1, 'shipping_delivery_date' => array('year' => $delivery_date->format('Y'), 'month' => $delivery_date->format('n'), 'day' => $delivery_date->format('j'))));
     $order = array('_token' => 'dummy', 'Customer' => $Customer->getId(), 'OrderStatus' => 1, 'name' => array('name01' => $faker->lastName, 'name02' => $faker->firstName), 'kana' => array('kana01' => $faker->lastKanaName, 'kana02' => $faker->firstKanaName), 'company_name' => $faker->company, 'zip' => array('zip01' => $faker->postcode1(), 'zip02' => $faker->postcode2()), 'address' => array('pref' => '5', 'addr01' => $faker->city, 'addr02' => $faker->streetAddress), 'tel' => array('tel01' => $tel[0], 'tel02' => $tel[1], 'tel03' => $tel[2]), 'fax' => array('fax01' => $tel[0], 'fax02' => $tel[1], 'fax03' => $tel[2]), 'email' => $email, 'message' => $faker->text, 'Payment' => 1, 'discount' => 0, 'delivery_fee_total' => 0, 'charge' => 0, 'note' => $faker->text, 'OrderDetails' => $OrderDetails, 'Shippings' => $Shippings);
     return $order;
 }
コード例 #3
0
 public function getCustomerName()
 {
     if ($this->Customer) {
         return $this->Customer->getName01() . " " . $this->Customer->getName02();
     } else {
         return "未ログイン";
     }
 }
コード例 #4
0
 protected function createSendCustomer(\Plugin\MailMagazine\Entity\MailMagazineSendHistory $SendHistory, \Eccube\Entity\Customer $MailCustomer)
 {
     // -----------------------------
     // plg_send_customer
     // -----------------------------
     $sendId = $SendHistory->getId();
     // Entity
     $SendCustomer = new MailMagazineSendCustomer();
     // data
     $SendCustomer->setSendId($sendId);
     $SendCustomer->setCustomerId($MailCustomer->getId());
     $SendCustomer->setEmail($MailCustomer->getEmail());
     $SendCustomer->setName($MailCustomer->getName01() . " " . $MailCustomer->getName02());
     $this->app['eccube.plugin.mail_magazine.repository.mail_magazine_send_customer']->updateSendCustomer($SendCustomer);
     return $SendCustomer;
 }
コード例 #5
0
ファイル: ShoppingService.php プロジェクト: rankai/ec-cube
 /**
  * 会員情報の更新
  *
  * @param Order $Order 受注情報
  * @param Customer $user ログインユーザ
  */
 public function setCustomerUpdate(Order $Order, Customer $user)
 {
     $orderDetails = $Order->getOrderDetails();
     // 顧客情報を更新
     $now = new \DateTime();
     $firstBuyDate = $user->getFirstBuyDate();
     if (empty($firstBuyDate)) {
         $user->setFirstBuyDate($now);
     }
     $user->setLastBuyDate($now);
     $user->setBuyTimes($user->getBuyTimes() + 1);
     $user->setBuyTotal($user->getBuyTotal() + $Order->getTotal());
 }
コード例 #6
0
 /**
  * 非会員処理
  */
 public function nonmember(Application $app, Request $request)
 {
     $cartService = $app['eccube.service.cart'];
     // カートチェック
     if (!$cartService->isLocked()) {
         // カートが存在しない、カートがロックされていない時はエラー
         return $app->redirect($app->url('cart'));
     }
     // ログイン済みの場合は, 購入画面へリダイレクト.
     if ($app->isGranted('ROLE_USER')) {
         return $app->redirect($app->url('shopping'));
     }
     // カートチェック
     if (count($cartService->getCart()->getCartItems()) <= 0) {
         // カートが存在しない時はエラー
         return $app->redirect($app->url('cart'));
     }
     $form = $app['form.factory']->createBuilder('nonmember')->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $data = $form->getData();
         $Customer = new Customer();
         $Customer->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setEmail($data['email'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02']);
         // 非会員複数配送用
         $CustomerAddress = new CustomerAddress();
         $CustomerAddress->setCustomer($Customer)->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02'])->setDelFlg(Constant::DISABLED);
         $Customer->addCustomerAddress($CustomerAddress);
         // 受注情報を取得
         $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
         // 初回アクセス(受注データがない)の場合は, 受注情報を作成
         if (is_null($Order)) {
             // 受注情報を作成
             try {
                 // 受注情報を作成
                 $app['eccube.service.shopping']->createOrder($Customer);
             } catch (CartException $e) {
                 $app->addRequestError($e->getMessage());
                 return $app->redirect($app->url('cart'));
             }
         }
         // 非会員用セッションを作成
         $nonMember = array();
         $nonMember['customer'] = $Customer;
         $nonMember['pref'] = $Customer->getPref()->getId();
         $app['session']->set($this->sessionKey, $nonMember);
         $customerAddresses = array();
         $customerAddresses[] = $CustomerAddress;
         $app['session']->set($this->sessionCustomerAddressKey, serialize($customerAddresses));
         return $app->redirect($app->url('shopping'));
     }
     return $app->render('Shopping/nonmember.twig', array('form' => $form->createView()));
 }
コード例 #7
0
ファイル: Generator.php プロジェクト: shhirose/ec-cube
 /**
  * 非会員の Customer オブジェクトを生成して返す.
  *
  * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される.
  * @return \Eccube\Entity\Customer
  */
 public function createNonMember($email = null)
 {
     $sessionKey = 'eccube.front.shopping.nonmember';
     $sessionCustomerAddressKey = 'eccube.front.shopping.nonmember.customeraddress';
     $faker = $this->getFaker();
     $Customer = new Customer();
     if (is_null($email)) {
         $email = $faker->email;
     }
     $Pref = $this->app['eccube.repository.master.pref']->find(1);
     $Customer->setName01($faker->lastName)->setName02($faker->firstName)->setEmail($email)->setPref($Pref)->setDelFlg(Constant::DISABLED);
     $CustomerAddress = new CustomerAddress();
     $CustomerAddress->setCustomer($Customer)->setDelFlg(Constant::DISABLED);
     $CustomerAddress->copyProperties($Customer);
     $Customer->addCustomerAddress($CustomerAddress);
     $nonMember = array();
     $nonMember['customer'] = $Customer;
     $nonMember['pref'] = $Customer->getPref()->getId();
     $this->app['session']->set($sessionKey, $nonMember);
     $customerAddresses = array();
     $customerAddresses[] = $CustomerAddress;
     $this->app['session']->set($sessionCustomerAddressKey, serialize($customerAddresses));
     return $Customer;
 }
コード例 #8
0
 /**
  * Customer オブジェクトを生成して返す.
  *
  * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される.
  * @return \Eccube\Entity\Customer
  */
 public function createCustomer($email = null)
 {
     $faker = $this->getFaker();
     $Customer = new Customer();
     if (is_null($email)) {
         $email = $faker->email;
     }
     $Status = $this->app['orm.em']->getRepository('Eccube\\Entity\\Master\\CustomerStatus')->find(CustomerStatus::ACTIVE);
     $Customer->setName01($faker->lastName)->setName02($faker->firstName)->setEmail($email)->setPassword('password')->setSecretKey($this->app['eccube.repository.customer']->getUniqueSecretKey($this->app))->setStatus($Status)->setDelFlg(0);
     $Customer->setPassword($this->app['eccube.repository.customer']->encryptPassword($this->app, $Customer));
     $this->app['orm.em']->persist($Customer);
     $this->app['orm.em']->flush();
     return $Customer;
 }
コード例 #9
0
ファイル: Generator.php プロジェクト: ec-cube/ec-cube
 /**
  * 非会員の Customer オブジェクトを生成して返す.
  *
  * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される.
  * @return \Eccube\Entity\Customer
  */
 public function createNonMember($email = null)
 {
     $sessionKey = 'eccube.front.shopping.nonmember';
     $sessionCustomerAddressKey = 'eccube.front.shopping.nonmember.customeraddress';
     $faker = $this->getFaker();
     $Customer = new Customer();
     if (is_null($email)) {
         $email = $faker->safeEmail;
     }
     $Pref = $this->app['eccube.repository.master.pref']->find($faker->numberBetween(1, 47));
     $tel = explode('-', $faker->phoneNumber);
     $fax = explode('-', $faker->phoneNumber);
     $Customer->setName01($faker->lastName)->setName02($faker->firstName)->setKana01($faker->lastKanaName)->setKana02($faker->firstKanaName)->setCompanyName($faker->company)->setEmail($email)->setZip01($faker->postcode1())->setZip02($faker->postcode2())->setPref($Pref)->setAddr01($faker->city)->setAddr02($faker->streetAddress)->setTel01($tel[0])->setTel02($tel[1])->setTel03($tel[2])->setFax01($fax[0])->setFax02($fax[1])->setFax03($fax[2])->setDelFlg(Constant::DISABLED);
     $CustomerAddress = new CustomerAddress();
     $CustomerAddress->setCustomer($Customer)->setDelFlg(Constant::DISABLED);
     $CustomerAddress->copyProperties($Customer);
     $Customer->addCustomerAddress($CustomerAddress);
     $nonMember = array();
     $nonMember['customer'] = $Customer;
     $nonMember['pref'] = $Customer->getPref()->getId();
     $this->app['session']->set($sessionKey, $nonMember);
     $customerAddresses = array();
     $customerAddresses[] = $CustomerAddress;
     $this->app['session']->set($sessionCustomerAddressKey, serialize($customerAddresses));
     return $Customer;
 }
コード例 #10
0
ファイル: MailService.php プロジェクト: shhirose/ec-cube
 /**
  * Send password reset notification mail.
  *
  * @param $Customer 会員情報
  */
 public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer, $password)
 {
     $body = $this->app->renderView('Mail/reset_complete_mail.twig', array('Customer' => $Customer, 'password' => $password));
     $message = \Swift_Message::newInstance()->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ')->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))->setTo(array($Customer->getEmail()))->setBcc($this->BaseInfo->getEmail01())->setReplyTo($this->BaseInfo->getEmail03())->setReturnPath($this->BaseInfo->getEmail04())->setBody($body);
     $event = new EventArgs(array('message' => $message, 'Customer' => $Customer, 'BaseInfo' => $this->BaseInfo, 'password' => $password), null);
     $this->app['eccube.event.dispatcher']->dispatch(EccubeEvents::MAIL_PASSWORD_RESET_COMPLETE, $event);
     $this->app->mail($message);
 }
コード例 #11
0
ファイル: MailService.php プロジェクト: noadless/ec-cube
 /**
  * Send password reset notification mail.
  *
  * @param $Customer 会員情報
  */
 public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer, $password)
 {
     $body = $this->app->renderView('Mail/reset_complete_mail.twig', array('Customer' => $Customer, 'password' => $password));
     $message = \Swift_Message::newInstance()->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ')->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))->setTo(array($Customer->getEmail()))->setBcc($this->BaseInfo->getEmail01())->setReplyTo($this->BaseInfo->getEmail03())->setReturnPath($this->BaseInfo->getEmail04())->setBody($body);
     $this->app->mail($message);
 }
コード例 #12
0
 /**
  * 非会員処理
  */
 public function nonmember(Application $app, Request $request)
 {
     $cartService = $app['eccube.service.cart'];
     // カートチェック
     if (!$cartService->isLocked()) {
         // カートが存在しない、カートがロックされていない時はエラー
         log_info('カートが存在しません');
         return $app->redirect($app->url('cart'));
     }
     // ログイン済みの場合は, 購入画面へリダイレクト.
     if ($app->isGranted('ROLE_USER')) {
         return $app->redirect($app->url('shopping'));
     }
     // カートチェック
     if (count($cartService->getCart()->getCartItems()) <= 0) {
         // カートが存在しない時はエラー
         log_info('カートに商品が入っていないためショッピングカート画面にリダイレクト');
         return $app->redirect($app->url('cart'));
     }
     $builder = $app['form.factory']->createBuilder('nonmember');
     $event = new EventArgs(array('builder' => $builder), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_NONMEMBER_INITIALIZE, $event);
     $form = $builder->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         log_info('非会員お客様情報登録開始');
         $data = $form->getData();
         $Customer = new Customer();
         $Customer->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setEmail($data['email'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02']);
         // 非会員複数配送用
         $CustomerAddress = new CustomerAddress();
         $CustomerAddress->setCustomer($Customer)->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02'])->setDelFlg(Constant::DISABLED);
         $Customer->addCustomerAddress($CustomerAddress);
         // 受注情報を取得
         $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
         // 初回アクセス(受注データがない)の場合は, 受注情報を作成
         if (is_null($Order)) {
             // 受注情報を作成
             try {
                 // 受注情報を作成
                 $Order = $app['eccube.service.shopping']->createOrder($Customer);
             } catch (CartException $e) {
                 $app->addRequestError($e->getMessage());
                 return $app->redirect($app->url('cart'));
             }
         }
         // 非会員用セッションを作成
         $nonMember = array();
         $nonMember['customer'] = $Customer;
         $nonMember['pref'] = $Customer->getPref()->getId();
         $app['session']->set($this->sessionKey, $nonMember);
         $customerAddresses = array();
         $customerAddresses[] = $CustomerAddress;
         $app['session']->set($this->sessionCustomerAddressKey, serialize($customerAddresses));
         $event = new EventArgs(array('form' => $form, 'Order' => $Order), $request);
         $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_NONMEMBER_COMPLETE, $event);
         if ($event->getResponse() !== null) {
             return $event->getResponse();
         }
         log_info('非会員お客様情報登録完了', array($Order->getId()));
         return $app->redirect($app->url('shopping'));
     }
     return $app->render('Shopping/nonmember.twig', array('form' => $form->createView()));
 }
コード例 #13
0
 /**
  *  ユーザはクーポン1回のみ利用できる
  *
  * @param $couponCd
  * @param $orderId
  * @param Customer $Customer
  * @return bool
  */
 public function checkCouponUsedOrNotBefore($couponCd, $orderId, Customer $Customer)
 {
     $repository = $this->app['eccube.plugin.coupon.repository.coupon_order'];
     if ($this->app->isGranted('ROLE_USER')) {
         $CouponOrders = $repository->findUseCouponBefore($couponCd, $orderId, $Customer->getId());
     } else {
         $CouponOrders = $repository->findUseCouponBefore($couponCd, $orderId, $Customer->getEmail());
     }
     if ($CouponOrders) {
         // 存在すれば既に受注として利用されていないかチェック
         foreach ($CouponOrders as $CouponOrder) {
             $Order = $this->app['eccube.repository.order']->find($CouponOrder->getOrderId());
             if ($Order) {
                 if ($Order->getOrderStatus()->getId() != $this->app['config']['order_processing']) {
                     // 同一のクーポンコードで既に受注データが存在している
                     return true;
                 }
             }
         }
     }
     return false;
 }