Exemplo n.º 1
0
 /**
  * Adjust scafolded search context
  *
  * @return SearchContext the updated search context
  */
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getFields();
     $fields->push(ListboxField::create("Status", _t('Order.db_Status', "Status"))->setSource(array_combine(self::config()->placed_status, self::config()->placed_status))->setMultiple(true));
     // add date range filtering
     $fields->insertBefore(DateField::create("DateFrom", _t('Order.DateFrom', "Date from"))->setConfig('showcalendar', true), 'Status');
     $fields->insertBefore(DateField::create("DateTo", _t('Order.DateTo', "Date to"))->setConfig('showcalendar', true), 'Status');
     // get the array, to maniplulate name, and fullname seperately
     $filters = $context->getFilters();
     $filters['DateFrom'] = GreaterThanFilter::create('Placed');
     $filters['DateTo'] = LessThanFilter::create('Placed');
     // filter customer need to use a bunch of different sources
     $filters['FirstName'] = new MultiFieldPartialMatchFilter('FirstName', false, array('SplitWords'), array('Surname', 'Member.FirstName', 'Member.Surname', 'BillingAddress.FirstName', 'BillingAddress.Surname', 'ShippingAddress.FirstName', 'ShippingAddress.Surname'));
     $context->setFilters($filters);
     $this->extend('updateDefaultSearchContext', $context);
     return $context;
 }
Exemplo n.º 2
0
 /**
  * Adjust scafolded search context
  * @return SearchContext the updated search context
  */
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getFields();
     $fields->push(ListboxField::create("Status", "Status")->setSource(array_combine(self::config()->placed_status, self::config()->placed_status))->setMultiple(true));
     //add date range filtering
     $fields->insertBefore(DateField::create("DateFrom", "Date from")->setConfig('showcalendar', true), 'Status');
     $fields->insertBefore(DateField::create("DateTo", "Date to")->setConfig('showcalendar', true), 'Status');
     //get the array, to maniplulate name, and fullname seperately
     $filters = $context->getFilters();
     $filters['DateFrom'] = GreaterThanFilter::create('Placed');
     $filters['DateTo'] = LessThanFilter::create('Placed');
     $context->setFilters($filters);
     return $context;
 }