示例#1
0
 static function unassignedProductGroups($_slmaster_id = '')
 {
     if (empty($_slmaster_id)) {
         $current_prod_groups = array();
     } else {
         $cc = new ConstraintChain();
         $cc->add(new Constraint('slmaster_id', '=', $_slmaster_id));
         $sldiscount = new SLDiscount();
         $sldiscount->identifierField = 'prod_group_id';
         $sldiscount->orderby = 'prod_group_id';
         $current_prod_groups = $sldiscount->getAll($cc);
     }
     $cc = new ConstraintChain();
     $prodgroup = new STProductgroup();
     if (count($current_prod_groups) > 0) {
         $cc->add(new Constraint($prodgroup->idField, 'not in', '(' . implode(',', $current_prod_groups) . ')'));
     }
     return $prodgroup->getAll($cc);
 }
示例#2
0
 public static function useDefault($search_data = null, &$errors = array(), $defaults = null)
 {
     $search = new SLDiscountSearch($defaults);
     // Customer
     $search->addSearchField('slmaster_id', 'Customer', 'select', 0, 'advanced');
     $customer = new SLCustomer();
     $options = array('0' => 'All');
     $customers = $customer->getAll(null, false, true);
     $options += $customers;
     $search->setOptions('slmaster_id', $options);
     // Product Group
     $search->addSearchField('prod_group_id', 'Product Group', 'select', '', 'advanced');
     $prodgroup = new STProductgroup();
     $prodgroup_list = $prodgroup->getAll();
     $options = array('' => 'All');
     $options += $prodgroup_list;
     $search->setOptions('prod_group_id', $options);
     // Execute Search
     $search->setSearchData($search_data, $errors);
     return $search;
 }