Skip to content

Commit

Permalink
Merge pull request #2508 from kiy0taka/fix/product-master-search
Browse files Browse the repository at this point in the history
商品マスターで廃止は初期検索ではえらばれていないようにする
  • Loading branch information
Chihiro Adachi committed Sep 15, 2017
2 parents 0af1d85 + f36f54a commit 130648e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
8 changes: 8 additions & 0 deletions src/Eccube/Entity/Master/Disp.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,20 @@ class Disp extends \Eccube\Entity\Master\AbstractMasterEntity
{

/**
* 公開
* @var integer
*/
const DISPLAY_SHOW = 1;

/**
* 非公開
* @var integer
*/
const DISPLAY_HIDE = 2;

/**
* 廃止
* @var integer
*/
const DISPLAY_ABOLISHED = 3;
}
26 changes: 13 additions & 13 deletions src/Eccube/Form/Type/Admin/SearchProductType.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,35 @@

use Eccube\Annotation\FormType;
use Eccube\Annotation\Inject;
use Eccube\Application;
use Eccube\Form\Type\Master\CategoryType as MasterCategoryType;;
use Eccube\Entity\Master\Disp;
use Eccube\Form\Type\Master\CategoryType as MasterCategoryType;
use Eccube\Form\Type\Master\DispType;
use Eccube\Repository\Master\DispRepository;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;

;

/**
* @FormType
*/
class SearchProductType extends AbstractType
{

/**
* @var \Eccube\Application $app
* @Inject(Application::class)
* @Inject(DispRepository::class)
* @var DispRepository
*/
protected $app;

public function __construct()
{
}
protected $DispRepository;

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$app = $this->app;

$builder
->add('id', TextType::class, array(
'label' => '商品ID',
Expand All @@ -83,6 +79,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => '種別',
'multiple'=> true,
'required' => false,
'data' => $this->DispRepository->findBy(['id' => [
Disp::DISPLAY_SHOW,
Disp::DISPLAY_HIDE
]])
))
->add('create_date_start', DateType::class, array(
'label' => '登録日(FROM)',
Expand Down
4 changes: 2 additions & 2 deletions src/Eccube/Repository/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ public function getQueryBuilderBySearchDataForAdmin($searchData)
}

// status
if (!empty($searchData['status']) && $searchData['status']->toArray()) {
if (!empty($searchData['status']) && $searchData['status']) {
$qb
->andWhere($qb->expr()->in('p.Status', ':Status'))
->setParameter('Status', $searchData['status']->toArray());
->setParameter('Status', $searchData['status']);
}

// link_status
Expand Down

0 comments on commit 130648e

Please sign in to comment.