QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
93 lines
3.4 KiB
C#
93 lines
3.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Administration.Settings;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.Sales.CustomerAssets.TimerBilling;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.Data.WebServices.Sales.Receipts;
|
|
using Centron.Interfaces;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using CentronSoftware.Centron.WebServices.Entities.Sales.CustomerAssets.TimerBilling;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket140509;
|
|
|
|
public class Ticket140509Tests : EndToEndTest
|
|
{
|
|
public Ticket140509Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
private const int HelpdeskNumber = 12504;
|
|
|
|
public override void Execute()
|
|
{
|
|
// In this ticket the problem was that the TimerBillingSettingsDTO.InsertTimerTime setting
|
|
// was not respected for special-articles (remote or drive articles)
|
|
// So the timers itself would not have their time, but the special-articles would have their time
|
|
// That was incorrect, the setting should be respected in both cases
|
|
|
|
this.PrepareDatabase();
|
|
|
|
var timerI3Ds = this.FindTimers(HelpdeskNumber);
|
|
|
|
var settings = new TimerBillingSettingsDTO
|
|
{
|
|
InsertHelpdeskDescription = false,
|
|
InsertHelpdeskShortDescription = false,
|
|
InsertTimerText = true,
|
|
InsertTimerTime = false, // The important setting
|
|
InsertTheFollowingAreTimersFromHelpdeskText = true,
|
|
Sorting = Interfaces.Sales.Receipts.TimerBilling.TimerSorting.ChronologicalUp,
|
|
|
|
ReceiptKind = CentronObjectKindNumeric.InvoiceClass,
|
|
AdditionalText = "Hier mein Text!"
|
|
};
|
|
|
|
var invoice = this.CreateReceipt(timerI3Ds, settings);
|
|
|
|
this.Verifier.Verify("Invoice", invoice);
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
this.Sql($"UPDATE dbo.hlpdsk_timer SET Geplant = 0 WHERE RequestI3D = (SELECT I3D FROM dbo.hlpdsk_requests WHERE Nummer = {HelpdeskNumber})");
|
|
|
|
this.WithSession(s =>
|
|
{
|
|
var bl = s.GetBL<AppSettingsBL>();
|
|
var settingsForUpdate = bl.GetSettingsForUpdate(AppSettingsConst.HelpdeskTimerStartTimeFormat, AppSettingsConst.HelpdeskTimerEndTimeFormat);
|
|
|
|
settingsForUpdate.UpdateString(AppSettingsConst.HelpdeskTimerStartTimeFormat, "HH:mm");
|
|
settingsForUpdate.UpdateString(AppSettingsConst.HelpdeskTimerEndTimeFormat, "HH:mm");
|
|
|
|
settingsForUpdate.SaveSettings();
|
|
});
|
|
}
|
|
|
|
private List<int> FindTimers(int helpdeskNumber)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new TimerBillingFilter
|
|
{
|
|
HelpdeskNumber = helpdeskNumber
|
|
};
|
|
|
|
var timers = session.GetBL<TimerBillingBL>().SearchTimers(filter);
|
|
return timers.Select(f => f.I3D).ToList();
|
|
}
|
|
}
|
|
|
|
private ReceiptBaseDTO CreateReceipt(List<int> timerI3Ds, TimerBillingSettingsDTO settings)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
var invoiceResult = session.GetBL<ReceiptWebServiceBL>().CreateNewReceiptForHelpdekTimers(timerI3Ds, settings, user);
|
|
return invoiceResult.Data;
|
|
}
|
|
}
|
|
} |