Commit 883774f5 authored by doc@bgerp.org's avatar doc@bgerp.org

p11815 Process queue in customer.

parent df5db0ad
F: Process queue saved filters drag & drop.
C: Do not use db.driver MySQL connection parameter.
C: Remove right-click Firefox context menu for storing something.
C: Process queue URL from processQueue to process/queue.
C: Rename crm*.js scripts to kernel*.js.
C: Refactoring JS.
F: Refresh customer's processes tab on reopen.
C: Removed not working filters by open / close date in customer processes.
A: Use process queue for displaying linked processes, https://bgerp.ru/doc/3.0/manual/kernel/process/index.html#link-processes
A: Open created linked process with wizard, https://bgerp.ru/doc/3.0/manual/kernel/process/index.html#create-process-with-link
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -223,12 +223,12 @@ public class ProcessLinkDAO extends CommonLinkDAO {
* @param typeIds опциональный фильтр по типам процессов.
* @param statusIds опциональный фильтр по статусам процессов.
* @param paramFilter опциональный фильтр по параметру, передаётся в {@link ParamValueDAO#getParamJoinFilters(String, String)}.
* @param closed опциональный фильтр по закрытости процесса.
* @param open опциональный фильтр по открытости процесса.
* @throws BGException
*/
public void searchLinkedProcessList(SearchResult<Pair<String, Process>> searchResult,
String objectType, int objectId, String objectTitle,
Set<Integer> typeIds, Set<Integer> statusIds, String paramFilter, Boolean closed)
Set<Integer> typeIds, Set<Integer> statusIds, String paramFilter, Boolean open)
throws Exception {
if (searchResult != null) {
Page page = searchResult.getPage();
......@@ -259,8 +259,8 @@ public class ProcessLinkDAO extends CommonLinkDAO {
pd.addQuery(" AND process.status_id IN (" + Utils.toString(statusIds) + ") ");
}
if (closed != null) {
if (closed) {
if (open != null) {
if (open) {
pd.addQuery(" AND process.close_dt IS NULL");
} else {
pd.addQuery(" AND process.close_dt IS NOT NULL");
......
......@@ -5,29 +5,23 @@ import java.util.Map;
import ru.bgcrm.model.process.queue.config.SavedFiltersConfig.SavedFilterSet;
public class FilterCounterEvent
extends ClientEvent
{
private Map<Integer, SavedFilterSet> filters;
private Map<Integer, HashMap<Integer, Integer>> count;
public class FilterCounterEvent extends ClientEvent {
private Map<Integer, SavedFilterSet> filters;
private Map<Integer, HashMap<Integer, Integer>> count;
public void setFilters( Map<Integer, SavedFilterSet> f )
{
filters = f;
}
public Map<Integer, SavedFilterSet> getFilters()
{
return filters;
}
public void setFilters(Map<Integer, SavedFilterSet> f) {
filters = f;
}
public void setCount( HashMap<Integer, HashMap<Integer, Integer>> c )
{
count = c;
}
public Map<Integer, HashMap<Integer, Integer>> getCount()
{
return count;
}
public Map<Integer, SavedFilterSet> getFilters() {
return filters;
}
public void setCount(HashMap<Integer, HashMap<Integer, Integer>> c) {
count = c;
}
public Map<Integer, HashMap<Integer, Integer>> getCount() {
return count;
}
}
package ru.bgcrm.event.process.queue;
import ru.bgcrm.event.Event;
import ru.bgcrm.util.ParameterMap;
@Deprecated
public class QueueColumnAddEvent implements Event {
private ParameterMap col;
private StringBuilder selectPart;
private StringBuilder joinPart;
public QueueColumnAddEvent(ParameterMap col, StringBuilder selectPart, StringBuilder joinPart) {
this.col = col;
this.selectPart = selectPart;
this.joinPart = joinPart;
}
public ParameterMap getCol() {
return col;
}
public StringBuilder getSelectPart() {
return selectPart;
}
public StringBuilder getJoinPart() {
return joinPart;
}
}
......@@ -10,8 +10,7 @@ import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.commons.lang3.StringUtils;
import ru.bgcrm.cache.ParameterCache;
import ru.bgcrm.cache.UserCache;
......@@ -28,6 +27,7 @@ import ru.bgcrm.model.process.queue.FilterLinkObject;
import ru.bgcrm.model.process.queue.FilterList;
import ru.bgcrm.model.process.queue.FilterOpenClose;
import ru.bgcrm.model.process.queue.FilterParam;
import ru.bgcrm.model.process.queue.FilterProcessType;
import ru.bgcrm.model.process.queue.Processor;
import ru.bgcrm.model.process.queue.SortMode;
import ru.bgcrm.model.process.queue.SortSet;
......@@ -37,22 +37,26 @@ import ru.bgcrm.struts.form.DynActionForm;
import ru.bgcrm.util.ParameterMap;
import ru.bgcrm.util.Preferences;
import ru.bgcrm.util.Utils;
import ru.bgerp.util.Log;
public class Queue {
private static final Logger log = Logger.getLogger(Queue.class);
private static final Log log = Log.getLog();
private int id;
private String title;
private String config;
private Set<Integer> processTypeIds = new HashSet<Integer>();
private ParameterMap configMap;
private List<ParameterMap> columnList;
private SortedMap<Integer, ParameterMap> columnMap;
private SortSet sortSet = new SortSet();
private final FilterList filterList = new FilterList();
private final Map<Integer, Processor> processorMap = new HashMap<Integer, Processor>();
private final SortSet sortSet = new SortSet();
private final List<Action> actionList = new ArrayList<Action>();
private Set<Integer> processTypeIds = new HashSet<Integer>();
private final List<IdTitle> createAllowedProcessList = new ArrayList<IdTitle>();
private LastModify lastModify = new LastModify();
public int getId() {
......@@ -97,6 +101,18 @@ public class Queue {
return result;
}
public Queue clone() {
Queue result = new Queue();
result.processTypeIds = processTypeIds;
result.configMap = configMap;
result.columnList = columnList;
result.columnMap = columnMap;
result.sortSet = sortSet;
return result;
}
// столбец указанный в конфигурации
public static class ColumnRef {
private final int columnId;
......@@ -423,10 +439,10 @@ public class Queue {
try {
String type = filter.get("type", "");
if ("status".equals(type) || "groups".equals(type) || "executors".equals(type) || "type".equals(type) || "close_date".equals(type)
|| "create_date".equals(type) || "status_date".equals(type) || "code".equals(type) || "description".equals(type)
|| "message:systemId".equals(type)) {
if (StringUtils.equalsAny(type, "status", "groups", "executors", "close_date", "create_date", "status_date", "code", "description", "message:systemId")) {
filterList.add(new Filter(id, filter));
} else if ("type".equals(type)) {
filterList.add(new FilterProcessType(id, filter));
} else if ("openClose".equals(type)) {
filterList.add(new FilterOpenClose(id, filter));
} else if ("grex".equals(type)) {
......
......@@ -5,45 +5,38 @@ import java.util.Set;
import ru.bgcrm.util.ParameterMap;
import ru.bgcrm.util.Utils;
public class Action
{
private final String title;
private final String shortcut;
private final String style;
private final Set<Integer> statusIds;
private final String commands;
public Action( ParameterMap config )
{
title = config.get( "title", "" );
shortcut = config.get( "shortcut", "*" );
style = config.get( "style", "" );
statusIds = Utils.toIntegerSet( config.get( "statusIds" ) );
commands = config.get( "commands", "" );
}
public String getTitle()
{
return title;
}
public String getShortcut()
{
return shortcut;
}
public String getStyle()
{
return style;
}
public Set<Integer> getStatusIds()
{
return statusIds;
}
public String getCommands()
{
return commands;
}
public class Action {
private final String title;
private final String shortcut;
private final String style;
private final Set<Integer> statusIds;
private final String commands;
public Action(ParameterMap config) {
title = config.get("title", "");
shortcut = config.get("shortcut", "*");
style = config.get("style", "");
statusIds = Utils.toIntegerSet(config.get("statusIds"));
commands = config.get("commands", "");
}
public String getTitle() {
return title;
}
public String getShortcut() {
return shortcut;
}
public String getStyle() {
return style;
}
public Set<Integer> getStatusIds() {
return statusIds;
}
public String getCommands() {
return commands;
}
}
......@@ -7,19 +7,21 @@ import ru.bgcrm.util.ParameterMap;
import ru.bgcrm.util.Utils;
// параметры фильтра в очереди
public class Filter
{
private final ParameterMap configMap;
private final int id;
// произвольное наименование фильтра
private final String title;
// фильтр по допустимым значениям
public class Filter {
public static final String VALUES = "values";
public static final String ON_EMPTY_VALUES = "onEmptyValues";
private final ParameterMap configMap;
private final int id;
// произвольное наименование фильтра
private final String title;
// фильтр по допустимым значениям
private final List<Integer> availableValues;
// значения по-умолчанию
private final Set<Integer> defaultValues;
// жёстко определённые значения
private final Set<String> values;
private final Set<String> values;
// значения, если ни одно значение фильтра не выбрано
private final Set<Integer> onEmptyValues;
// отображать фильтр, он может быть скрытым, в этом случае всё время передаются defaultValues
......@@ -29,68 +31,57 @@ public class Filter
//тип фильтра
private final String type;
//мап параметров
public Filter( int id, ParameterMap filter )
{
this.id = id;
this.type = filter.get( "type" );
this.title = filter.get( "title" );
this.configMap = filter;
this.onEmptyValues = Utils.toIntegerSet( filter.get( "onEmptyValues" ) );
this.defaultValues = Utils.emptyToNull( Utils.toIntegerSet( filter.get( "defaultValues" ) ) );
this.values = Utils.toSet( filter.get( "values" ) );
this.availableValues = Utils.emptyToNull( Utils.toIntegerList( filter.get( "availableValues" ) ) );
this.show = Utils.parseBoolean( filter.get( "show" ), true );
this.width = filter.get( "width" );
public Filter(int id, ParameterMap filter) {
this.id = id;
this.type = filter.get("type");
this.title = filter.get("title");
this.configMap = filter;
this.onEmptyValues = Utils.toIntegerSet(filter.get(ON_EMPTY_VALUES));
this.defaultValues = Utils.emptyToNull(Utils.toIntegerSet(filter.get("defaultValues")));
this.values = Utils.toSet(filter.get(VALUES));
this.availableValues = Utils.emptyToNull(Utils.toIntegerList(filter.get("availableValues")));
this.show = Utils.parseBoolean(filter.get("show"), true);
this.width = filter.get("width");
}
public ParameterMap getConfigMap()
{
return configMap;
}
public int getId()
{
return id;
}
public String getType()
{
return type;
public ParameterMap getConfigMap() {
return configMap;
}
public int getId() {
return id;
}
public String getTitle()
{
public String getType() {
return type;
}
public String getTitle() {
return title;
}
public Set<Integer> getDefaultValues()
{
return defaultValues;
public Set<Integer> getDefaultValues() {
return defaultValues;
}
public List<Integer> getAvailableValues()
{
return availableValues;
public List<Integer> getAvailableValues() {
return availableValues;
}
public Set<String> getValues()
{
return values;
public Set<String> getValues() {
return values;
}
public Set<Integer> getOnEmptyValues()
{
return onEmptyValues;
}
public Set<Integer> getOnEmptyValues() {
return onEmptyValues;
}
public boolean isShow()
{
return show;
public boolean isShow() {
return show;
}
public String getWidth()
{
return width;
}
public String getWidth() {
return width;
}
}
\ No newline at end of file
......@@ -3,11 +3,8 @@ package ru.bgcrm.model.process.queue;
import ru.bgcrm.model.param.Parameter;
import ru.bgcrm.util.ParameterMap;
public class FilterCustomerParam
extends FilterParam
{
public FilterCustomerParam( int id, ParameterMap filter, Parameter parameter )
{
super( id, filter, parameter );
}
public class FilterCustomerParam extends FilterParam {
public FilterCustomerParam(int id, ParameterMap filter, Parameter parameter) {
super(id, filter, parameter);
}
}
......@@ -2,34 +2,28 @@ package ru.bgcrm.model.process.queue;
import ru.bgcrm.util.ParameterMap;
public class FilterGrEx
extends Filter
{
private int roleId;
private Filter groupsFilter;
private Filter executorsFilter;
public FilterGrEx( int id, ParameterMap filter )
{
super( id, filter );
this.roleId = filter.getInt( "roleId", 0 );
this.groupsFilter = new Filter( id, filter.sub( "groups." ) );
this.executorsFilter = new Filter( id, filter.sub( "executors." ) );
}
public class FilterGrEx extends Filter {
private int roleId;
private Filter groupsFilter;
private Filter executorsFilter;
public int getRoleId()
{
return roleId;
}
public FilterGrEx(int id, ParameterMap filter) {
super(id, filter);
public Filter getGroupsFilter()
{
return groupsFilter;
}
this.roleId = filter.getInt("roleId", 0);
this.groupsFilter = new Filter(id, filter.sub("groups."));
this.executorsFilter = new Filter(id, filter.sub("executors."));
}
public Filter getExecutorsFilter()
{
return executorsFilter;
}
public int getRoleId() {
return roleId;
}
public Filter getGroupsFilter() {
return groupsFilter;
}
public Filter getExecutorsFilter() {
return executorsFilter;
}
}
......@@ -2,34 +2,28 @@ package ru.bgcrm.model.process.queue;
import ru.bgcrm.util.ParameterMap;
public class FilterLinkObject
extends Filter
{
private final String objectType;
private final String whatFilter;
public static final String WHAT_FILTER_ID = "id";
public static final String WHAT_FILTER_TITLE = "title";
public FilterLinkObject( int id, ParameterMap filter, String objectType, String whatFilter )
{
super( id, filter );
this.objectType = objectType;
this.whatFilter = whatFilter;
}
public class FilterLinkObject extends Filter {
private final String objectType;
private final String whatFilter;
public String getObjectType()
{
return objectType;
}
public static final String WHAT_FILTER_ID = "id";
public static final String WHAT_FILTER_TITLE = "title";
public String getWhatFilter()
{
return whatFilter;
}
public String getParamName()
{
return objectType + "-" + whatFilter;
}
public FilterLinkObject(int id, ParameterMap filter, String objectType, String whatFilter) {
super(id, filter);
this.objectType = objectType;
this.whatFilter = whatFilter;
}
public String getObjectType() {
return objectType;
}
public String getWhatFilter() {
return whatFilter;
}
public String getParamName() {
return objectType + "-" + whatFilter;
}
}
......@@ -2,29 +2,23 @@ package ru.bgcrm.model.process.queue;
import java.util.ArrayList;
public class FilterList
{
private ArrayList<Filter> filterList = new ArrayList<Filter>();
public class FilterList {
private ArrayList<Filter> filterList = new ArrayList<Filter>();
public void add( Filter filter )
{
filterList.add( filter );
}
public void add(Filter filter) {
filterList.add(filter);
}
public ArrayList<Filter> getFilterList()
{
return filterList;
}
public ArrayList<Filter> getFilterList() {
return filterList;
}
public Filter getByType( String type )
{
for( Filter filter : filterList )
{
if( filter.getType().equals( type ) )
{
return filter;
}
}
return null;
}
public Filter getByType(String type) {
for (Filter filter : filterList) {
if (filter.getType().equals(type)) {
return filter;
}
}
return null;
}
}
package ru.bgcrm.model.process.queue;
/*
public class FilterListParam
extends FilterParam
{
public List<IdTitle> get
}
*/
\ No newline at end of file
......@@ -2,19 +2,18 @@ package ru.bgcrm.model.process.queue;
import ru.bgcrm.util.ParameterMap;
public class FilterOpenClose
extends Filter
{
private String defaultValue;
public class FilterOpenClose extends Filter {
public static final String OPEN = "open";
public static final String CLOSE = "close";
public FilterOpenClose( int id, ParameterMap filter )
{
super( id, filter );
defaultValue = filter.get( "defaultValue" ) ;
}
private String defaultValue;
public String getDefaultValue()
{
return defaultValue;
}
public FilterOpenClose(int id, ParameterMap filter) {
super(id, filter);
defaultValue = filter.get("defaultValue");
}
public String getDefaultValue() {
return defaultValue;
}
}
......@@ -3,19 +3,15 @@ package ru.bgcrm.model.process.queue;
import ru.bgcrm.model.param.Parameter;
import ru.bgcrm.util.ParameterMap;
public class FilterParam
extends Filter
{
private Parameter parameter;
public FilterParam( int id, ParameterMap filter, Parameter parameter )
{
super( id, filter );
this.parameter = parameter;
}
public Parameter getParameter()
{
return parameter;
}
public class FilterParam extends Filter {
private Parameter parameter;
public FilterParam(int id, ParameterMap filter, Parameter parameter) {
super(id, filter);
this.parameter = parameter;
}
public Parameter getParameter() {
return parameter;
}
}
package ru.bgcrm.model.process.queue;
import ru.bgcrm.util.ParameterMap;