setupCustomFields('EcmProductGroups'); foreach($this->field_defs as $field){ $this->field_name_map[$field['name']] = $field; } } function get_summary_text(){ return $this->name; } function create_list_query($order_by, $where, $show_deleted = 0){ $custom_join = $this->custom_fields->getJOIN(); $query ="SELECT "; $query.="ecmproductgroups.*,users.user_name as assigned_user_name"; if($custom_join)$query.=$custom_join['select']; $query.=" FROM ecmproductgroups "; $query.="LEFT JOIN users ON ecmproductgroups.assigned_user_id=users.id"; $query.=" "; if($custom_join)$query.=$custom_join['join']; $where_auto='1=1'; if($show_deleted==0)$where_auto=" $this->table_name.deleted=0 "; elseif($show_deleted==1)$where_auto=" $this->table_name.deleted=1 "; if($where!="")$query.="where $where AND ".$where_auto; else $query.="where ".$where_auto; if(substr_count($order_by,'.')>0)$query .= " ORDER BY $order_by"; elseif($order_by != "")$query .= " ORDER BY $order_by"; else $query .= " ORDER BY ecmproductgroups.name"; return $query; } function create_export_query($order_by,$where){ $custom_join = $this->custom_fields->getJOIN(); $query ="SELECT "; $query.="ecmproductgroups.*,users.user_name as assigned_user_name"; if($custom_join)$query.=$custom_join['select']; $query.=" FROM ecmproductgroups "; $query.="LEFT JOIN users ON ecmproductgroups.assigned_user_id=users.id"; $query.=" "; if($custom_join)$query.=$custom_join['join']; $where_auto='1=1'; if($show_deleted==0)$where_auto=" $this->table_name.deleted=0 "; elseif($show_deleted==1)$where_auto=" $this->table_name.deleted=1 "; if($where!="")$query.="where $where AND ".$where_auto; else $query.="where ".$where_auto; if(substr_count($order_by,'.')>0)$query .= " ORDER BY $order_by"; elseif($order_by != "")$query .= " ORDER BY $order_by"; else $query .= " ORDER BY ecmproductgroups.name"; return $query; } function fill_in_additional_list_fields(){ } function fill_in_additional_detail_fields(){ parent::fill_in_additional_detail_fields(); } function build_generic_where_clause($the_query_string){ $where_clauses=array(); $the_query_string=PearDatabase::quote(from_html($the_query_string)); array_push($where_clauses,"ecmproductgroups.name like '$the_query_string%'"); $the_where=""; foreach($where_clauses as $clause){ if($the_where!="")$the_where.=" or "; $the_where.=$clause; } return $the_where; } function get_list_view_data(){ global $current_language; $the_array=parent::get_list_view_data(); $app_list_strings=return_app_list_strings_language($current_language); $mod_strings=return_module_language($current_language,'EcmProductGroups'); $the_array['NAME']=(($this->name == "") ? "blank" : $this->name); $the_array['ENCODED_NAME']=$this->name; return $the_array; } function set_notification_body($xtpl,$ecmproductgroup) { global $mod_strings,$app_list_strings; $xtpl->assign("ECMPRODUCTCATEGORY_SUBJECT",$ecmproductgroup->name); return $xtpl; } function bean_implements($interface){ switch($interface){ case 'ACL':return true; } return false; } function save($check_notify=FALSE){ //manage features //categories $pll = array(); $json = getJSONobj(); $exp=explode("||||",$_POST['position_list']); foreach($exp as $ep){ if($ep){ $pll[] = $json->decode(htmlspecialchars_decode($ep)); } } $this->features = $json->encode($pll); $back= parent::save($check_notify); if($_REQUEST['products_id']!=""){ $ids=explode(",",$_REQUEST['products_id']); $query="update ecmproducts set group_id='".$this->id."',group_name='".$this->name."' where id in ('".implode("','",$ids)."')"; $this->db->query($query); header("Location: index.php?action=index&module=EcmProducts"); die(); } return $back; } } ?>