| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * This file is part of EC-CUBE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * http://www.lockon.co.jp/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * This program is free software; you can redistribute it and/or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * modify it under the terms of the GNU General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * as published by the Free Software Foundation; either version 2 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * of the License, or (at your option) any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * GNU General Public License for more details. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * You should have received a copy of the GNU General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * along with this program; if not, write to the Free Software | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | namespace Eccube\Controller\Admin\Order; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use Doctrine\Common\Collections\ArrayCollection; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use Eccube\Application; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use Eccube\Common\Constant; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use Eccube\Controller\AbstractController; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use Eccube\Entity\ShipmentItem; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | use Eccube\Event\EccubeEvents; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | use Eccube\Event\EventArgs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | use Symfony\Component\Form\FormError; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | use Symfony\Component\HttpFoundation\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 5 |  | class EditController extends AbstractController | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 | 5 |  |     public function index(Application $app, Request $request, $id = null) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 5 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $TargetOrder = null; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $OriginOrder = null; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         if (is_null($id)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             // 空のエンティティを作成. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             $TargetOrder = $this->newOrder(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |             $TargetOrder = $app['eccube.repository.order']->find($id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |             if (is_null($TargetOrder)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 2 |  |                 throw new NotFoundHttpException(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 | 5 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         // 編集前の受注情報を保持 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $OriginOrder = clone $TargetOrder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 5 |  |         $OriginalOrderDetails = new ArrayCollection(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 2 |  |         foreach ($TargetOrder->getOrderDetails() as $OrderDetail) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |             $OriginalOrderDetails->add($OrderDetail); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $builder = $app['form.factory'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |             ->createBuilder('order', $TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |                 'builder' => $builder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |                 'OriginOrder' => $OriginOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |                 'TargetOrder' => $TargetOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |                 'OriginOrderDetails' => $OriginalOrderDetails, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 | 3 |  |             $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 3 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_INDEX_INITIALIZE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $form = $builder->getForm(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         if ('POST' === $request->getMethod()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |             $form->handleRequest($request); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             // 入力情報にもとづいて再計算. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             $this->calculate($app, $TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |             // 登録ボタン押下 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |             switch ($request->get('mode')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |                 case 'register': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |                     if ($TargetOrder->getTotal() > $app['config']['max_total_fee']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |                         $form['charge']->addError(new FormError('合計金額の上限を超えております。')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |                     } elseif ($form->isValid()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 | 3 |  |                         $BaseInfo = $app['eccube.repository.base_info']->get(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |                         // お支払い方法の更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |                         $TargetOrder->setPaymentMethod($TargetOrder->getPayment()->getMethod()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |                         // 配送業者・お届け時間の更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |                         $Shippings = $TargetOrder->getShippings(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |                         foreach ($Shippings as $Shipping) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |                             $Shipping->setShippingDeliveryName($Shipping->getDelivery()->getName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |                             if (!is_null($Shipping->getDeliveryTime())) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |                                 $Shipping->setShippingDeliveryTime($Shipping->getDeliveryTime()->getDeliveryTime()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |                             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 | 1 |  |                                 $Shipping->setShippingDeliveryTime(null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |                         // 受注日/発送日/入金日の更新. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |                         $this->updateDate($app, $TargetOrder, $OriginOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |                         // 受注明細で削除されているものをremove | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |                         foreach ($OriginalOrderDetails as $OrderDetail) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |                             if (false === $TargetOrder->getOrderDetails()->contains($OrderDetail)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |                                 $app['orm.em']->remove($OrderDetail); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |                         if ($BaseInfo->getOptionMultipleShipping() == Constant::ENABLED) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |                             foreach ($TargetOrder->getOrderDetails() as $OrderDetail) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |                                 /** @var $OrderDetail \Eccube\Entity\OrderDetail */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |                                 $OrderDetail->setOrder($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |                             /** @var \Eccube\Entity\Shipping $Shipping */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 126 |  | View Code Duplication |                             foreach ($Shippings as $Shipping) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |                                 $shipmentItems = $Shipping->getShipmentItems(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 | 3 |  |                                 /** @var \Eccube\Entity\ShipmentItem $ShipmentItem */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |                                 foreach ($shipmentItems as $ShipmentItem) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |                                     $ShipmentItem->setOrder($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |                                     $ShipmentItem->setShipping($Shipping); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |                                     $app['orm.em']->persist($ShipmentItem); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |                                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |                                 $Shipping->setOrder($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |                                 $app['orm.em']->persist($Shipping); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |                             $NewShipmentItems = new ArrayCollection(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |                             foreach ($TargetOrder->getOrderDetails() as $OrderDetail) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |                                 /** @var $OrderDetail \Eccube\Entity\OrderDetail */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |                                 $OrderDetail->setOrder($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |                                 $NewShipmentItem = new ShipmentItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |                                 $NewShipmentItem | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |                                     ->setProduct($OrderDetail->getProduct()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |                                     ->setProductClass($OrderDetail->getProductClass()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |                                     ->setProductName($OrderDetail->getProduct()->getName()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |                                     ->setProductCode($OrderDetail->getProductClass()->getCode()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |                                     ->setClassCategoryName1($OrderDetail->getClassCategoryName1()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |                                     ->setClassCategoryName2($OrderDetail->getClassCategoryName2()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |                                     ->setClassName1($OrderDetail->getClassName1()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 | 1 |  |                                     ->setClassName2($OrderDetail->getClassName2()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |                                     ->setPrice($OrderDetail->getPrice()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |                                     ->setQuantity($OrderDetail->getQuantity()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |                                     ->setOrder($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |                                 $NewShipmentItems[] = $NewShipmentItem; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |                             // 配送商品の更新. delete/insert. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |                             $Shippings = $TargetOrder->getShippings(); | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 163 |  | View Code Duplication |                             foreach ($Shippings as $Shipping) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |                                 $ShipmentItems = $Shipping->getShipmentItems(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |                                 foreach ($ShipmentItems as $ShipmentItem) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |                                     $app['orm.em']->remove($ShipmentItem); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 | 3 |  |                                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |                                 $ShipmentItems->clear(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |                                 foreach ($NewShipmentItems as $NewShipmentItem) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |                                     $NewShipmentItem->setShipping($Shipping); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |                                     $ShipmentItems->add($NewShipmentItem); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |                                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |                         $app['orm.em']->persist($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |                         $app['orm.em']->flush(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |                         $Customer = $TargetOrder->getCustomer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |                         if ($Customer) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                             // 会員の場合、購入回数、購入金額などを更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |                             $app['eccube.repository.customer']->updateBuyData($app, $Customer, $TargetOrder->getOrderStatus()->getId()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |                         $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |                             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |                                 'form' => $form, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |                                 'OriginOrder' => $OriginOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |                                 'TargetOrder' => $TargetOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |                                 'OriginOrderDetails' => $OriginalOrderDetails, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |                                 'Customer' => $Customer, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |                             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |                             $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |                         $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_INDEX_COMPLETE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |                         $app->addSuccess('admin.order.save.complete', 'admin'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |                         return $app->redirect($app->url('admin_order_edit', array('id' => $TargetOrder->getId()))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |                 case 'add_delivery': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |                     // お届け先情報の新規追加 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |                     $form = $builder->getForm(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |                     $Shipping = new \Eccube\Entity\Shipping(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 | 2 |  |                     $Shipping->setDelFlg(Constant::DISABLED); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |                     $TargetOrder->addShipping($Shipping); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |                     $Shipping->setOrder($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |                     $form->setData($TargetOrder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 | 2 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 | 2 |  |                 default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 2 |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 | 2 |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |         // 会員検索フォーム | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |         $builder = $app['form.factory'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 | 5 |  |             ->createBuilder('admin_search_customer'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |                 'builder' => $builder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |                 'OriginOrder' => $OriginOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |                 'TargetOrder' => $TargetOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |                 'OriginOrderDetails' => $OriginalOrderDetails, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 | 1 |  |             $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |         $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_INITIALIZE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |         $searchCustomerModalForm = $builder->getForm(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 | 1 |  |         // 商品検索フォーム | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 | 1 |  |         $builder = $app['form.factory'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |             ->createBuilder('admin_search_product'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |         $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 | 1 |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |                 'builder' => $builder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |                 'OriginOrder' => $OriginOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 | 1 |  |                 'TargetOrder' => $TargetOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |                 'OriginOrderDetails' => $OriginalOrderDetails, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |             $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 | 1 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_PRODUCT_INITIALIZE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 | 1 |  |         $searchProductModalForm = $builder->getForm(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |         // 配送業者のお届け時間 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 | 1 |  |         $times = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |         $deliveries = $app['eccube.repository.delivery']->findAll(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |         foreach ($deliveries as $Delivery) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |             $deliveryTiems = $Delivery->getDeliveryTimes(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |             foreach ($deliveryTiems as $DeliveryTime) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |                 $times[$Delivery->getId()][$DeliveryTime->getId()] = $DeliveryTime->getDeliveryTime(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 | 1 |  |         return $app->render('Order/edit.twig', array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |             'form' => $form->createView(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |             'searchCustomerModalForm' => $searchCustomerModalForm->createView(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |             'searchProductModalForm' => $searchProductModalForm->createView(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |             'Order' => $TargetOrder, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |             'id' => $id, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |             'shippingDeliveryTimes' => $app['serializer']->serialize($times, 'json'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |         )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |      * 顧客情報を検索する. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |      * @param Application $app | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |      * @param Request $request | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |      * @return \Symfony\Component\HttpFoundation\JsonResponse | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |     public function searchCustomer(Application $app, Request $request) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |         if ($request->isXmlHttpRequest()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |             $app['monolog']->addDebug('search customer start.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |             $searchData = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |                 'multi' => $request->get('search_word'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |             $qb = $app['eccube.repository.customer']->getQueryBuilderBySearchData($searchData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 | 1 |  |             $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 | 1 |  |                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 | 1 |  |                     'qb' => $qb, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 | 1 |  |                     'data' => $searchData, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 | 1 |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 | 1 |  |                 $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 | 1 |  |             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_SEARCH, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 | 1 |  |             $Customers = $qb->getQuery()->getResult(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 | 1 |  |             if (empty($Customers)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 | 1 |  |                 $app['monolog']->addDebug('search customer not found.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 | 1 |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 | 1 |  |             $data = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |             $formatTel = '%s-%s-%s'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |             $formatName = '%s%s(%s%s)'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |             foreach ($Customers as $Customer) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 | 1 |  |                 $data[] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |                     'id' => $Customer->getId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 | 1 |  |                     'name' => sprintf($formatName, $Customer->getName01(), $Customer->getName02(), $Customer->getKana01(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |                         $Customer->getKana02()), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |                     'tel' => sprintf($formatTel, $Customer->getTel01(), $Customer->getTel02(), $Customer->getTel03()), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 | 1 |  |             $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 | 1 |  |                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |                     'data' => $data, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |                     'Customers' => $Customers, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |                 $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_COMPLETE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |             $data = $event->getArgument('data'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |             return $app->json($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 | 1 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 | 1 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |      * 顧客情報を検索する. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |      * @param Application $app | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 | 1 |  |      * @param Request $request | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |      * @return \Symfony\Component\HttpFoundation\JsonResponse | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |     public function searchCustomerById(Application $app, Request $request) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         if ($request->isXmlHttpRequest()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |             $app['monolog']->addDebug('search customer by id start.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 | 1 |  |             /** @var $Customer \Eccube\Entity\Customer */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |             $Customer = $app['eccube.repository.customer'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 | 1 |  |                 ->find($request->get('id')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |             $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |                     'Customer' => $Customer, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 | 1 |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |                 $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 | 2 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_BY_ID_INITIALIZE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |             if (is_null($Customer)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |                 $app['monolog']->addDebug('search customer by id not found.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |                 return $app->json(array(), 404); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 | 2 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |             $app['monolog']->addDebug('search customer by id found.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |             $data = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |                 'id' => $Customer->getId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |                 'name01' => $Customer->getName01(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |                 'name02' => $Customer->getName02(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |                 'kana01' => $Customer->getKana01(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |                 'kana02' => $Customer->getKana02(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 | 3 |  |                 'zip01' => $Customer->getZip01(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |                 'zip02' => $Customer->getZip02(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 | 3 |  |                 'pref' => is_null($Customer->getPref()) ? null : $Customer->getPref()->getId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 | 3 |  |                 'addr01' => $Customer->getAddr01(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |                 'addr02' => $Customer->getAddr02(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |                 'email' => $Customer->getEmail(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |                 'tel01' => $Customer->getTel01(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |                 'tel02' => $Customer->getTel02(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |                 'tel03' => $Customer->getTel03(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |                 'fax01' => $Customer->getFax01(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |                 'fax02' => $Customer->getFax02(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 | 1 |  |                 'fax03' => $Customer->getFax03(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |                 'company_name' => $Customer->getCompanyName(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |             $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |                     'data' => $data, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |                     'Customer' => $Customer, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |                 $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_BY_ID_COMPLETE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |             $data = $event->getArgument('data'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |             return $app->json($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |     public function searchProduct(Application $app, Request $request) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |         if ($request->isXmlHttpRequest()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |             $app['monolog']->addDebug('search product start.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |             $searchData = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 | 3 |  |                 'name' => $request->get('id'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |             if ($categoryId = $request->get('category_id')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |                 $Category = $app['eccube.repository.category']->find($categoryId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |                 $searchData['category_id'] = $Category; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |             /** @var $Products \Eccube\Entity\Product[] */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |             $qb = $app['eccube.repository.product'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |                 ->getQueryBuilderBySearchData($searchData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |             $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |                     'qb' => $qb, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |                     'searchData' => $searchData, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |                 $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_PRODUCT_SEARCH, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |             /** @var $Products \Eccube\Entity\Product[] */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |             $Products = $qb->getQuery()->getResult(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |             if (empty($Products)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |                 $app['monolog']->addDebug('search product not found.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |             $forms = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |             foreach ($Products as $Product) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |                 /* @var $builder \Symfony\Component\Form\FormBuilderInterface */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |                 $builder = $app['form.factory']->createNamedBuilder('', 'add_cart', null, array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |                     'product' => $Product, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |                 )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |                 $addCartForm = $builder->getForm(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |                 $forms[$Product->getId()] = $addCartForm->createView(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |             $event = new EventArgs( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |                     'forms' => $forms, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |                     'Products' => $Products, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |                 $request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_PRODUCT_COMPLETE, $event); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |             return $app->render('Order/search_product.twig', array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |                 'forms' => $forms, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |                 'Products' => $Products, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |             )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 467 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 468 |  |  |     protected function newOrder() | 
            
                                                                        
                            
            
                                    
            
            
                | 469 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 470 | 3 |  |         $Order = new \Eccube\Entity\Order(); | 
            
                                                                        
                            
            
                                    
            
            
                | 471 |  |  |         $Shipping = new \Eccube\Entity\Shipping(); | 
            
                                                                        
                            
            
                                    
            
            
                | 472 |  |  |         $Shipping->setDelFlg(0); | 
            
                                                                        
                            
            
                                    
            
            
                | 473 |  |  |         $Order->addShipping($Shipping); | 
            
                                                                        
                            
            
                                    
            
            
                | 474 |  |  |         $Shipping->setOrder($Order); | 
            
                                                                        
                            
            
                                    
            
            
                | 475 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 476 |  |  |         return $Order; | 
            
                                                                        
                            
            
                                    
            
            
                | 477 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |      * フォームからの入直内容に基づいて、受注情報の再計算を行う | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |      * @param $app | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |      * @param $Order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |     protected function calculate($app, \Eccube\Entity\Order $Order) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |         $taxtotal = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |         $subtotal = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |         // 受注明細データの税・小計を再計算 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |         /** @var $OrderDetails \Eccube\Entity\OrderDetail[] */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |         $OrderDetails = $Order->getOrderDetails(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |         foreach ($OrderDetails as $OrderDetail) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |             // 新規登録の場合は, 入力されたproduct_id/produc_class_idから明細にセットする. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |             if (!$OrderDetail->getId()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |                 $TaxRule = $app['eccube.repository.tax_rule']->getByRule($OrderDetail->getProduct(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |                     $OrderDetail->getProductClass()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |                 $OrderDetail->setTaxRule($TaxRule->getCalcRule()->getId()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |                 $OrderDetail->setProductName($OrderDetail->getProduct()->getName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |                 $OrderDetail->setProductCode($OrderDetail->getProductClass()->getCode()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |                 $OrderDetail->setClassName1($OrderDetail->getProductClass()->hasClassCategory1() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |                     ? $OrderDetail->getProductClass()->getClassCategory1()->getClassName()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |                 $OrderDetail->setClassName2($OrderDetail->getProductClass()->hasClassCategory2() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |                     ? $OrderDetail->getProductClass()->getClassCategory2()->getClassName()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |                 $OrderDetail->setClassCategoryName1($OrderDetail->getProductClass()->hasClassCategory1() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |                     ? $OrderDetail->getProductClass()->getClassCategory1()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 | 2 |  |                 $OrderDetail->setClassCategoryName2($OrderDetail->getProductClass()->hasClassCategory2() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 | 3 |  |                     ? $OrderDetail->getProductClass()->getClassCategory2()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |             // 税 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |             $tax = $app['eccube.service.tax_rule'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |                 ->calcTax($OrderDetail->getPrice(), $OrderDetail->getTaxRate(), $OrderDetail->getTaxRule()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |             $OrderDetail->setPriceIncTax($OrderDetail->getPrice() + $tax); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |             $taxtotal += $tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |             // 小計 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |             $subtotal += $OrderDetail->getTotalPrice(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |         $shippings = $Order->getShippings(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |         /** @var \Eccube\Entity\Shipping $Shipping */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |         foreach ($shippings as $Shipping) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |             $shipmentItems = $Shipping->getShipmentItems(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |             $Shipping->setDelFlg(Constant::DISABLED); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |             /** @var \Eccube\Entity\ShipmentItem $ShipmentItem */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |             foreach ($shipmentItems as $ShipmentItem) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |                 $ShipmentItem->setProductName($ShipmentItem->getProduct()->getName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |                 $ShipmentItem->setProductCode($ShipmentItem->getProductClass()->getCode()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |                 $ShipmentItem->setClassName1($ShipmentItem->getProductClass()->hasClassCategory1() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |                     ? $ShipmentItem->getProductClass()->getClassCategory1()->getClassName()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |                 $ShipmentItem->setClassName2($ShipmentItem->getProductClass()->hasClassCategory2() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |                     ? $ShipmentItem->getProductClass()->getClassCategory2()->getClassName()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |                 $ShipmentItem->setClassCategoryName1($ShipmentItem->getProductClass()->hasClassCategory1() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |                     ? $ShipmentItem->getProductClass()->getClassCategory1()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |                 $ShipmentItem->setClassCategoryName2($ShipmentItem->getProductClass()->hasClassCategory2() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |                     ? $ShipmentItem->getProductClass()->getClassCategory2()->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |                     : null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |         // 受注データの税・小計・合計を再計算 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |         $Order->setTax($taxtotal); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |         $Order->setSubtotal($subtotal); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |         $Order->setTotal($subtotal + $Order->getCharge() + $Order->getDeliveryFeeTotal() - $Order->getDiscount()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |         // お支払い合計は、totalと同一金額(2系ではtotal - point) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |         $Order->setPaymentTotal($Order->getTotal()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |      * 受注ステータスに応じて, 受注日/入金日/発送日を更新する, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |      * 発送済ステータスが設定された場合は, お届け先情報の発送日も更新を行う. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |      * 編集の場合 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |      * - 受注ステータスが他のステータスから発送済へ変更された場合に発送日を更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |      * - 受注ステータスが他のステータスから入金済へ変更された場合に入金日を更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |      * 新規登録の場合 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |      * - 受注日を更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |      * - 受注ステータスが発送済に設定された場合に発送日を更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |      * - 受注ステータスが入金済に設定された場合に入金日を更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |      * @param $app | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |      * @param $TargetOrder | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |      * @param $OriginOrder | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |     protected function updateDate($app, $TargetOrder, $OriginOrder) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |         $dateTime = new \DateTime(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |         // 編集 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |         if ($TargetOrder->getId()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |             // 発送済 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |             if ($TargetOrder->getOrderStatus()->getId() == $app['config']['order_deliv']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |                 // 編集前と異なる場合のみ更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |                 if ($TargetOrder->getOrderStatus()->getId() != $OriginOrder->getOrderStatus()->getId()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |                     $TargetOrder->setCommitDate($dateTime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |                     // お届け先情報の発送日も更新する. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |                     $Shippings = $TargetOrder->getShippings(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |                     foreach ($Shippings as $Shipping) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |                         $Shipping->setShippingCommitDate($dateTime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |                 // 入金済 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |             } elseif ($TargetOrder->getOrderStatus()->getId() == $app['config']['order_pre_end']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |                 // 編集前と異なる場合のみ更新 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |                 if ($TargetOrder->getOrderStatus()->getId() != $OriginOrder->getOrderStatus()->getId()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |                     $TargetOrder->setPaymentDate($dateTime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |             // 新規 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |             // 発送済 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |             if ($TargetOrder->getOrderStatus()->getId() == $app['config']['order_deliv']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |                 $TargetOrder->setCommitDate($dateTime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |                 // お届け先情報の発送日も更新する. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |                 $Shippings = $TargetOrder->getShippings(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |                 foreach ($Shippings as $Shipping) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |                     $Shipping->setShippingCommitDate($dateTime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |                 // 入金済 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |             } elseif ($TargetOrder->getOrderStatus()->getId() == $app['config']['order_pre_end']) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |                 $TargetOrder->setPaymentDate($dateTime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |             // 受注日時 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |             $TargetOrder->setOrderDate($dateTime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 618 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 619 |  |  |  |