This commit is contained in:
2021-06-22 23:33:41 +00:00
parent 3c5298aa05
commit 9c60886cfa
8 changed files with 27 additions and 16 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -4764,21 +4764,24 @@ namespace AyaNova.Biz
}
//Scheduling conflict?
//TODO: Add global settings allow schedule conflicts setting check here (after implementing it)
if (proposedObj.UserId!=null && proposedObj.StartDate != null
if (!AyaNova.Util.ServerGlobalBizSettings.Cache.AllowScheduleConflicts
&& proposedObj.UserId != null
&& proposedObj.StartDate != null
&& proposedObj.StopDate != null
&& (isNew
|| (proposedObj.StartDate != currentObj.StartDate)
|| (proposedObj.StopDate != currentObj.StopDate)
|| (proposedObj.UserId != currentObj.UserId)
|| (proposedObj.UserId != currentObj.UserId)
))
{
// ICollection<DateTime> Overlaps = await db.TaskTime.Where(a => a.UserId == UserId && a.StartDate <= time.EndDate && time.StartDate <= a.EndDate.Value).OrderBy(a => a).Select(a => a.StartDate).ToListAsync();
// if (Overlaps.Any())
// {
if(await ct.WorkOrderItemScheduledUser.AnyAsync(x=>x.Id!=proposedObj.Id && x.UserId==proposedObj.UserId && x.StartDate<= proposedObj.StopDate && proposedObj.StartDate <= x.StopDate )){
AddError(ApiErrorCode.VALIDATION_FAILED, "StartDate", await Translate("GlobalAllowScheduleConflicts"));
}
if (await ct.WorkOrderItemScheduledUser.AnyAsync(x => x.Id != proposedObj.Id
&& x.UserId == proposedObj.UserId
&& x.StartDate <= proposedObj.StopDate
&& proposedObj.StartDate <= x.StopDate))
{
AddError(ApiErrorCode.VALIDATION_FAILED, "StartDate", await Translate("ScheduleConflict"));
AddError(ApiErrorCode.VALIDATION_FAILED, "StopDate", await Translate("ScheduleConflict"));
}
}

View File

@@ -40,6 +40,9 @@ namespace AyaNova.Models
[Required]
public TimeSpan WorkOrderCompleteByAge { get; set; } = TimeSpan.Zero;//was workorderclosebyage
public bool AllowScheduleConflicts { get; set; }
//CUSTOMER ACCESS FEATURES AND SETTINGS
public long? CustomerDefaultWorkOrderReportId { get; set; }

View File

@@ -2268,5 +2268,6 @@
"CustomerAccessWorkOrderReport":"Kundenversion Arbeitsauftragsbericht",
"NoFeaturesAvailable":"Für Ihr Konto sind keine Funktionen aktiviert",
"CustomerSignature":"Unterschrift des Kunden",
"TechSignature":"Unterschrift des Technikers"
"TechSignature":"Unterschrift des Technikers",
"ScheduleConflict":"Terminkonflikt"
}

View File

@@ -2268,7 +2268,8 @@
"CustomerAccessWorkOrderReport":"Customer work order report",
"NoFeaturesAvailable":"No features are enabled for your account",
"CustomerSignature":"Customer signature",
"TechSignature":"Technician signature"
"TechSignature":"Technician signature",
"ScheduleConflict":"Schedule conflict"
}

View File

@@ -2268,5 +2268,6 @@
"CustomerAccessWorkOrderReport":"Informe de orden de trabajo del cliente",
"NoFeaturesAvailable":"No hay funciones habilitadas para su cuenta",
"CustomerSignature":"Firma del cliente",
"TechSignature":"Firma del técnico"
"TechSignature":"Firma del técnico",
"ScheduleConflict":"Conflicto de horario"
}

View File

@@ -2268,5 +2268,6 @@
"CustomerAccessWorkOrderReport":"Rapport de bon de travail client",
"NoFeaturesAvailable":"Aucune fonctionnalité n'est activée pour votre compte",
"CustomerSignature":"Signature du client",
"TechSignature":"Signature du technicien"
"TechSignature":"Signature du technicien",
"ScheduleConflict":"Conflit d'horaire"
}

View File

@@ -252,6 +252,7 @@ namespace AyaNova.Util
await ExecQueryAsync("CREATE TABLE aglobalbizsettings (id INTEGER NOT NULL PRIMARY KEY, "
+ "searchcasesensitiveonly BOOL DEFAULT FALSE, "
+ "useinventory BOOL DEFAULT TRUE, "
+ "allowscheduleconflicts BOOL DEFAULT FALSE, "
+ "workordercompletebyage INTERVAL NOT NULL DEFAULT '00:00:00', "
+ "workordertraveldefaultminutes INTEGER NOT NULL DEFAULT 0, "
+ "worklaborscheduledefaultminutes INTEGER NOT NULL DEFAULT 0, "
@@ -527,7 +528,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//Global tax code defaults
await ExecQueryAsync("ALTER TABLE aglobalbizsettings ADD column taxpartpurchaseid BIGINT REFERENCES ataxcode, "
+ "ADD column taxpartsaleid BIGINT REFERENCES ataxcode, ADD column taxratesaleid BIGINT REFERENCES ataxcode");
//MEMO
await ExecQueryAsync("CREATE TABLE amemo (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, "
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, "
@@ -971,7 +972,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
+ "notes TEXT, roles INTEGER NOT NULL, atype INTEGER NOT NULL, template TEXT, style TEXT, jsprerender TEXT, jshelpers TEXT, rendertype INTEGER NOT NULL, "
+ "headertemplate TEXT, footertemplate TEXT, displayheaderfooter BOOL, paperformat INTEGER NOT NULL, landscape BOOL, marginoptionsbottom TEXT, "
+ "marginoptionsleft TEXT, marginoptionsright TEXT, marginoptionstop TEXT, pageranges TEXT, prefercsspagesize BOOL, printbackground BOOL, scale DECIMAL(8,5) )");
//Global customer default workorder report default
await ExecQueryAsync("ALTER TABLE aglobalbizsettings ADD column customerdefaultworkorderreportid BIGINT REFERENCES areport(id) ");