feature: #158 adds job preference option to include all attachments on lodgment

This commit is contained in:
Gary Sharp
2024-12-11 17:01:42 +11:00
parent 25e3a8e1f1
commit 90c709c4c1
17 changed files with 352 additions and 7 deletions
@@ -41,6 +41,12 @@ namespace Disco.Data.Configuration.Modules
} }
} }
public bool LodgmentIncludeAllAttachmentsByDefault
{
get { return Get(false); }
set { Set(value); }
}
/// <summary> /// <summary>
/// Theme used in noticeboards by default. /// Theme used in noticeboards by default.
/// <see cref="Disco.Services.Extensions.UIHelpers.NoticeboardThemes"/> /// <see cref="Disco.Services.Extensions.UIHelpers.NoticeboardThemes"/>
@@ -35,6 +35,18 @@ namespace Disco.Web.Areas.API.Controllers
return Json("OK", JsonRequestBehavior.AllowGet); return Json("OK", JsonRequestBehavior.AllowGet);
} }
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
public virtual ActionResult UpdateLodgmentIncludeAllAttachmentsByDefault(bool includeAllAttachmentsByDefault, bool redirect = false)
{
Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault = includeAllAttachmentsByDefault;
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.JobPreferences.Index());
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)] [DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
public virtual ActionResult UpdateDefaultNoticeboardTheme(string DefaultNoticeboardTheme, bool redirect = false) public virtual ActionResult UpdateDefaultNoticeboardTheme(string DefaultNoticeboardTheme, bool redirect = false)
{ {
@@ -15,6 +15,7 @@ namespace Disco.Web.Areas.Config.Controllers
{ {
LongRunningJobDaysThreshold = Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold, LongRunningJobDaysThreshold = Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold,
StaleJobMinutesThreshold = Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold, StaleJobMinutesThreshold = Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold,
LodgmentIncludeAllAttachmentsByDefault = Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault,
DefaultNoticeboardTheme = Database.DiscoConfiguration.JobPreferences.DefaultNoticeboardTheme, DefaultNoticeboardTheme = Database.DiscoConfiguration.JobPreferences.DefaultNoticeboardTheme,
LocationMode = Database.DiscoConfiguration.JobPreferences.LocationMode, LocationMode = Database.DiscoConfiguration.JobPreferences.LocationMode,
LocationList = Database.DiscoConfiguration.JobPreferences.LocationList, LocationList = Database.DiscoConfiguration.JobPreferences.LocationList,
@@ -13,6 +13,7 @@ namespace Disco.Web.Areas.Config.Models.JobPreferences
{ {
public int LongRunningJobDaysThreshold { get; set; } public int LongRunningJobDaysThreshold { get; set; }
public int StaleJobMinutesThreshold { get; set; } public int StaleJobMinutesThreshold { get; set; }
public bool LodgmentIncludeAllAttachmentsByDefault { get; set; }
public string DefaultNoticeboardTheme { get; set; } public string DefaultNoticeboardTheme { get; set; }
public LocationModes LocationMode { get; set; } public LocationModes LocationMode { get; set; }
public List<string> LocationList { get; set; } public List<string> LocationList { get; set; }
@@ -12,6 +12,7 @@
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons"); Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
} }
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Lodgment);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Reports); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Reports);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Expressions); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Expressions);
@@ -58,6 +58,7 @@ namespace Disco.Web.Areas.Config.Views.JobPreferences
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons"); Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
} }
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Lodgment);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Reports); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Reports);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Expressions); Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Expressions);
@@ -0,0 +1,45 @@
@model Disco.Web.Areas.Config.Models.JobPreferences.IndexModel
@{
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
}
<div id="Config_Lodgment" class="form" style="width: 530px;">
<h2>Job Lodgment</h2>
<table>
<tr>
<th style="width: 200px">
&nbsp;
</th>
<td>
@if (canConfig)
{
@Html.CheckBoxFor(model => model.LodgmentIncludeAllAttachmentsByDefault)
<label for="LodgmentIncludeAllAttachmentsByDefault">Include All Attachments by Default</label>
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>If enabled, all attachments will be selected by default when lodging a job.
</p>
</div>
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LodgmentIncludeAllAttachmentsByDefault'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLodgmentIncludeAllAttachmentsByDefault()))',
'includeAllAttachmentsByDefault');
});
</script>
}
else
{
<span>
@(Model.LodgmentIncludeAllAttachmentsByDefault ? "Yes" : "No")
</span>
}
</td>
</tr>
</table>
</div>
@@ -0,0 +1,206 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.JobPreferences.Parts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/JobPreferences/Parts/Lodgment.cshtml")]
public partial class Lodgment : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.JobPreferences.IndexModel>
{
public Lodgment()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_Lodgment\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>Job Lodgment</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">\r\n &nbsp;\r\n </th>\r\n <td>\r\n");
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(Html.CheckBoxFor(model => model.LodgmentIncludeAllAttachmentsByDefault));
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
WriteLiteral(" <label");
WriteLiteral(" for=\"LodgmentIncludeAllAttachmentsByDefault\"");
WriteLiteral(">Include All Attachments by Default</label>\r\n");
#line 19 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
#line 19 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 19 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
#line 20 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 20 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"info-box\"");
WriteLiteral(">\r\n <p");
WriteLiteral(" class=\"fa-p\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>If enabled, all attachments will be selected by default when lodging a job.\r" +
"\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LodgmentIncludeAll" +
"AttachmentsByDefault\'),\r\n null,\r\n " +
" \'");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLodgmentIncludeAllAttachmentsByDefault()));
#line default
#line hidden
WriteLiteral("\',\r\n \'includeAllAttachmentsByDefault\');\r\n " +
" });\r\n </script>\r\n");
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(Model.LodgmentIncludeAllAttachmentsByDefault ? "Yes" : "No");
#line default
#line hidden
WriteLiteral("\r\n </span>\r\n");
#line 41 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
+3
View File
@@ -1284,6 +1284,9 @@ h1.Config_DocumentTemplates {
#Config_AuthRoles_Subjects_Update_Dialog #Config_AuthRoles_Subjects_Update_Dialog_List li .remove:hover { #Config_AuthRoles_Subjects_Update_Dialog #Config_AuthRoles_Subjects_Update_Dialog_List li .remove:hover {
opacity: 1; opacity: 1;
} }
#Config_Lodgment {
margin-top: 10px;
}
#Config_ReportPrefs { #Config_ReportPrefs {
margin-top: 10px; margin-top: 10px;
} }
+4
View File
@@ -1541,6 +1541,10 @@ h1.Config_DocumentTemplates {
} }
} }
#Config_Lodgment {
margin-top: 10px;
}
#Config_ReportPrefs { #Config_ReportPrefs {
margin-top: 10px; margin-top: 10px;
File diff suppressed because one or more lines are too long
+9
View File
@@ -302,6 +302,11 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>General.cshtml</DependentUpon> <DependentUpon>General.cshtml</DependentUpon>
</Compile> </Compile>
<Compile Include="Areas\Config\Views\JobPreferences\Parts\Lodgment.generated.cs">
<DependentUpon>Lodgment.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Areas\Config\Views\JobPreferences\Parts\Locations.generated.cs"> <Compile Include="Areas\Config\Views\JobPreferences\Parts\Locations.generated.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
@@ -1324,6 +1329,10 @@
<Generator>RazorGenerator</Generator> <Generator>RazorGenerator</Generator>
<LastGenOutput>General.generated.cs</LastGenOutput> <LastGenOutput>General.generated.cs</LastGenOutput>
</None> </None>
<Content Include="Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Lodgment.generated.cs</LastGenOutput>
</Content>
<None Include="Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"> <None Include="Areas\Config\Views\JobPreferences\Parts\Locations.cshtml">
<Generator>RazorGenerator</Generator> <Generator>RazorGenerator</Generator>
<LastGenOutput>Locations.generated.cs</LastGenOutput> <LastGenOutput>Locations.generated.cs</LastGenOutput>
@@ -73,6 +73,12 @@ namespace Disco.Web.Areas.API.Controllers
} }
[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateLodgmentIncludeAllAttachmentsByDefault()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLodgmentIncludeAllAttachmentsByDefault);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateDefaultNoticeboardTheme() public virtual System.Web.Mvc.ActionResult UpdateDefaultNoticeboardTheme()
{ {
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDefaultNoticeboardTheme); return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDefaultNoticeboardTheme);
@@ -131,6 +137,7 @@ namespace Disco.Web.Areas.API.Controllers
{ {
public readonly string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold"; public readonly string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold";
public readonly string UpdateStaleJobMinutesThreshold = "UpdateStaleJobMinutesThreshold"; public readonly string UpdateStaleJobMinutesThreshold = "UpdateStaleJobMinutesThreshold";
public readonly string UpdateLodgmentIncludeAllAttachmentsByDefault = "UpdateLodgmentIncludeAllAttachmentsByDefault";
public readonly string UpdateDefaultNoticeboardTheme = "UpdateDefaultNoticeboardTheme"; public readonly string UpdateDefaultNoticeboardTheme = "UpdateDefaultNoticeboardTheme";
public readonly string UpdateLocationMode = "UpdateLocationMode"; public readonly string UpdateLocationMode = "UpdateLocationMode";
public readonly string UpdateLocationList = "UpdateLocationList"; public readonly string UpdateLocationList = "UpdateLocationList";
@@ -145,6 +152,7 @@ namespace Disco.Web.Areas.API.Controllers
{ {
public const string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold"; public const string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold";
public const string UpdateStaleJobMinutesThreshold = "UpdateStaleJobMinutesThreshold"; public const string UpdateStaleJobMinutesThreshold = "UpdateStaleJobMinutesThreshold";
public const string UpdateLodgmentIncludeAllAttachmentsByDefault = "UpdateLodgmentIncludeAllAttachmentsByDefault";
public const string UpdateDefaultNoticeboardTheme = "UpdateDefaultNoticeboardTheme"; public const string UpdateDefaultNoticeboardTheme = "UpdateDefaultNoticeboardTheme";
public const string UpdateLocationMode = "UpdateLocationMode"; public const string UpdateLocationMode = "UpdateLocationMode";
public const string UpdateLocationList = "UpdateLocationList"; public const string UpdateLocationList = "UpdateLocationList";
@@ -173,6 +181,15 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string StaleJobMinutesThreshold = "StaleJobMinutesThreshold"; public readonly string StaleJobMinutesThreshold = "StaleJobMinutesThreshold";
public readonly string redirect = "redirect"; public readonly string redirect = "redirect";
} }
static readonly ActionParamsClass_UpdateLodgmentIncludeAllAttachmentsByDefault s_params_UpdateLodgmentIncludeAllAttachmentsByDefault = new ActionParamsClass_UpdateLodgmentIncludeAllAttachmentsByDefault();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateLodgmentIncludeAllAttachmentsByDefault UpdateLodgmentIncludeAllAttachmentsByDefaultParams { get { return s_params_UpdateLodgmentIncludeAllAttachmentsByDefault; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateLodgmentIncludeAllAttachmentsByDefault
{
public readonly string includeAllAttachmentsByDefault = "includeAllAttachmentsByDefault";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateDefaultNoticeboardTheme s_params_UpdateDefaultNoticeboardTheme = new ActionParamsClass_UpdateDefaultNoticeboardTheme(); static readonly ActionParamsClass_UpdateDefaultNoticeboardTheme s_params_UpdateDefaultNoticeboardTheme = new ActionParamsClass_UpdateDefaultNoticeboardTheme();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateDefaultNoticeboardTheme UpdateDefaultNoticeboardThemeParams { get { return s_params_UpdateDefaultNoticeboardTheme; } } public ActionParamsClass_UpdateDefaultNoticeboardTheme UpdateDefaultNoticeboardThemeParams { get { return s_params_UpdateDefaultNoticeboardTheme; } }
@@ -283,6 +300,19 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo; return callInfo;
} }
[NonAction]
partial void UpdateLodgmentIncludeAllAttachmentsByDefaultOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, bool includeAllAttachmentsByDefault, bool redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateLodgmentIncludeAllAttachmentsByDefault(bool includeAllAttachmentsByDefault, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLodgmentIncludeAllAttachmentsByDefault);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "includeAllAttachmentsByDefault", includeAllAttachmentsByDefault);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateLodgmentIncludeAllAttachmentsByDefaultOverride(callInfo, includeAllAttachmentsByDefault, redirect);
return callInfo;
}
[NonAction] [NonAction]
partial void UpdateDefaultNoticeboardThemeOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string DefaultNoticeboardTheme, bool redirect); partial void UpdateDefaultNoticeboardThemeOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string DefaultNoticeboardTheme, bool redirect);
@@ -110,11 +110,13 @@ namespace Disco.Web.Areas.Config.Controllers
public readonly string Expressions = "Expressions"; public readonly string Expressions = "Expressions";
public readonly string General = "General"; public readonly string General = "General";
public readonly string Locations = "Locations"; public readonly string Locations = "Locations";
public readonly string Lodgment = "Lodgment";
public readonly string Reports = "Reports"; public readonly string Reports = "Reports";
} }
public readonly string Expressions = "~/Areas/Config/Views/JobPreferences/Parts/Expressions.cshtml"; public readonly string Expressions = "~/Areas/Config/Views/JobPreferences/Parts/Expressions.cshtml";
public readonly string General = "~/Areas/Config/Views/JobPreferences/Parts/General.cshtml"; public readonly string General = "~/Areas/Config/Views/JobPreferences/Parts/General.cshtml";
public readonly string Locations = "~/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml"; public readonly string Locations = "~/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml";
public readonly string Lodgment = "~/Areas/Config/Views/JobPreferences/Parts/Lodgment.cshtml";
public readonly string Reports = "~/Areas/Config/Views/JobPreferences/Parts/Reports.cshtml"; public readonly string Reports = "~/Areas/Config/Views/JobPreferences/Parts/Reports.cshtml";
} }
} }
@@ -112,10 +112,18 @@ namespace Disco.Web.Models.Job
OrganisationAddress = OrganisationAddresses.FirstOrDefault(oa => oa.Id == OrganisationAddressId.Value); OrganisationAddress = OrganisationAddresses.FirstOrDefault(oa => oa.Id == OrganisationAddressId.Value);
if (AttachmentIds == null) if (AttachmentIds == null)
{
if (Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault)
{
Attachments = Job.JobAttachments.ToList();
AttachmentIds = Attachments.Select(a => a.Id).ToList();
}
else
{ {
AttachmentIds = new List<int>(); AttachmentIds = new List<int>();
Attachments = new List<Disco.Models.Repository.JobAttachment>(); Attachments = new List<Disco.Models.Repository.JobAttachment>();
} }
}
else else
{ {
Attachments = Job.JobAttachments.Where(ja => AttachmentIds.Contains(ja.Id)).ToList(); Attachments = Job.JobAttachments.Where(ja => AttachmentIds.Contains(ja.Id)).ToList();
+8
View File
@@ -128,10 +128,18 @@ namespace Disco.Web.Models.Job
RepairDescription = RepairDescription.Trim(); RepairDescription = RepairDescription.Trim();
if (PublishAttachmentIds == null) if (PublishAttachmentIds == null)
{
if (Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault)
{
PublishAttachments = Job.JobAttachments.ToList();
PublishAttachmentIds = PublishAttachments.Select(a => a.Id).ToList();
}
else
{ {
PublishAttachmentIds = new List<int>(); PublishAttachmentIds = new List<int>();
PublishAttachments = new List<Disco.Models.Repository.JobAttachment>(); PublishAttachments = new List<Disco.Models.Repository.JobAttachment>();
} }
}
else else
{ {
PublishAttachments = Job.JobAttachments.Where(ja => PublishAttachmentIds.Contains(ja.Id)).ToList(); PublishAttachments = Job.JobAttachments.Where(ja => PublishAttachmentIds.Contains(ja.Id)).ToList();
+8
View File
@@ -128,10 +128,18 @@ namespace Disco.Web.Models.Job
FaultDescription = FaultDescription.Trim(); FaultDescription = FaultDescription.Trim();
if (PublishAttachmentIds == null) if (PublishAttachmentIds == null)
{
if (Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault)
{
PublishAttachments = Job.JobAttachments.ToList();
PublishAttachmentIds = PublishAttachments.Select(a => a.Id).ToList();
}
else
{ {
PublishAttachmentIds = new List<int>(); PublishAttachmentIds = new List<int>();
PublishAttachments = new List<Disco.Models.Repository.JobAttachment>(); PublishAttachments = new List<Disco.Models.Repository.JobAttachment>();
} }
}
else else
{ {
PublishAttachments = Job.JobAttachments.Where(ja => PublishAttachmentIds.Contains(ja.Id)).ToList(); PublishAttachments = Job.JobAttachments.Where(ja => PublishAttachmentIds.Contains(ja.Id)).ToList();