Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Selection checkboxes shown when command doesn't require it #2638

Merged
merged 2 commits into from Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 24 additions & 13 deletions backend/Origam.OrigamEngine/ModelXmlBuilders/FormXmlBuilder.cs
Expand Up @@ -307,25 +307,38 @@ public static XmlDocument GetXml(WorkQueueClass wqc, DataSet dataset, string nam
Hashtable dataSources = new Hashtable();
OrigamSettings settings = ConfigurationManager.GetActiveConfiguration();
DataTable table = dataset.Tables["WorkQueueEntry"];
var parameterService = ServiceManager.Services.GetService<IParameterService>();

QueryParameterCollection pms = new QueryParameterCollection();
QueryParameterCollection pms = new QueryParameterCollection();
pms.Add(new QueryParameter("WorkQueueCommand_parWorkQueueId", queueId));
DataSet commands = core.DataService.Instance.LoadData(new Guid("1d33b667-ca76-4aaa-a47d-0e404ed6f8a6"), new Guid("421aec03-1eec-43f9-b0bb-17cfc24510a0"), Guid.Empty, Guid.Empty, null, pms);

ArrayList commandRows = new ArrayList();
var commandRows = new List<DataRow>();
IOrigamAuthorizationProvider auth = SecurityManager.GetAuthorizationProvider();
foreach (DataRow cmdRow in commands.Tables["WorkQueueCommand"].Rows)
{
if (cmdRow.IsNull("Roles") || !auth.Authorize(SecurityManager.CurrentPrincipal, (string)cmdRow["Roles"]))
foreach (DataRow cmdRow in commands.Tables["WorkQueueCommand"].Rows)
{
if (cmdRow.IsNull("Roles") || !auth.Authorize(SecurityManager.CurrentPrincipal, (string)cmdRow["Roles"]))
{
continue;
}
commandRows.Add(cmdRow);
}

bool showCheckboxes = commandRows.Any(cmdRow =>
{
if ((Guid)cmdRow["refWorkQueueCommandTypeId"] == (Guid)parameterService.GetParameterValue("WorkQueueCommandType_WorkQueueClassCommand"))
{
continue;
WorkQueueWorkflowCommand cmd = wqc.GetCommand((string)cmdRow["Command"]);
return cmd.Mode == PanelActionMode.MultipleCheckboxes;
}
commandRows.Add(cmdRow);
}
bool showCheckboxes = commandRows.Count > 0;
else
{
return true;
}
});

// Window
XmlDocument doc = GetWindowBaseXml(
// Window
XmlDocument doc = GetWindowBaseXml(
name, Guid.Empty, settings.WorkQueueListRefreshPeriod, false, false, false);
XmlElement windowElement = WindowElement(doc);
XmlElement uiRootElement = UIRootElement(windowElement);
Expand Down Expand Up @@ -460,8 +473,6 @@ public static XmlDocument GetXml(WorkQueueClass wqc, DataSet dataset, string nam
CreateComponentBinding(doc, bindingsElement, queueId.ToString(), "Id", "WorkQueueEntry", "65DF44F9-C050-4554-AD9A-896445314279", "Id", "WorkQueueEntry", false);
}

IParameterService parameterService = ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService;

foreach(DataRow cmdRow in commandRows)
{
Hashtable cmdParams = new Hashtable();
Expand Down