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
96 lines
3.8 KiB
C#
96 lines
3.8 KiB
C#
using System.Linq;
|
|
using Centron.BusinessLogic.Administration.Company;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.Data.WebServices.Sales.Receipts.Invoices;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Administration.Environment;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket138418;
|
|
|
|
public class Ticket138418Tests : EndToEndTest
|
|
{
|
|
public Ticket138418Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
this.Verifier.Settings.IgnoreColumn("Date");
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
// In this ticket the problem was, that in the ContractItemsContingent table, it would save the old incorrect invoice-number
|
|
// Not the correct one from the 0,00 € invoice-number-group that was actually used for the invoice
|
|
|
|
this.PrepareDatabase();
|
|
|
|
var invoice = this.CreateInvoice();
|
|
Assert.Equal(40287, invoice.Number); //New invoice should have a number from the default number-group
|
|
|
|
var savedInvoice = this.SaveInvoice(invoice);
|
|
Assert.Equal(22001, savedInvoice.Number); //When it's saved we should use a number from the 0,00 € invoice-number-group
|
|
|
|
this.Verifier.VerifyTable("Items", "ContractItemsContingent", $"AssetI3D = {savedInvoice.I3D} AND AssetKind = 4");
|
|
}
|
|
|
|
private ReceiptInvoiceDTO SaveInvoice(ReceiptInvoiceDTO invoice)
|
|
{
|
|
var savedInvoice = (ReceiptInvoiceDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().SaveReceipt(
|
|
invoice,
|
|
this.GetLoggedInUser().User,
|
|
new SaveReceiptData(),
|
|
autoLockIfNewReceipt: false,
|
|
CreatedThroughApplication.WebServices,
|
|
receiptTemplateFolderI3D: null)).ThrowIfError().Receipt;
|
|
|
|
return savedInvoice;
|
|
}
|
|
|
|
private ReceiptInvoiceDTO CreateInvoice()
|
|
{
|
|
// Create new invoice
|
|
var invoice = (ReceiptInvoiceDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(
|
|
CentronObjectKindNumeric.InvoiceClass,
|
|
this.GetLoggedInUser(),
|
|
customerI3D: 10000,
|
|
new CreateReceiptData
|
|
{
|
|
IgnoreCallbacks = true,
|
|
},
|
|
addressI3D: null,
|
|
contactPersonI3D: null,
|
|
insertSalutationAndAgreement: false,
|
|
ignoreDefaultContract: false,
|
|
insertCustomerDiscount: false)).ThrowIfError().Receipt;
|
|
|
|
// Assign contingent-contract to the invoice
|
|
invoice.ContractI3D = 35;
|
|
|
|
// Create items
|
|
var items = this.WithSession(s => s.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
|
|
invoice,
|
|
isExternalArticle: false,
|
|
articleI3D: 5,
|
|
externalArticleKind: null,
|
|
externalArticleId: null,
|
|
warehouseI3D: -1,
|
|
this.GetLoggedInUser())).ThrowIfError();
|
|
invoice.Items.AddRange(items.ReceiptItems.Cast<ReceiptInvoiceItemDTO>());
|
|
|
|
return invoice;
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
// Setup 0,00 € invoice-number-group
|
|
this.WithSession(s => s.GetBL<NumberGroupBL>().RefreshAllNumberGroups());
|
|
this.Sql("UPDATE dbo.Nummernkreis SET BereichVon = 22000, BereichBis = 22999, Aktuell = 22000, Intervall = 1 WHERE I3D = 56"); // Configure the 0,00 € invoice-number-group
|
|
|
|
// Reset contingent-settings to work for all contingent-contracts and service-articles
|
|
this.Sql($"DELETE FROM dbo.GroupToContingent");
|
|
this.Sql($"INSERT INTO dbo.GroupToContingent (ContractI3D, Kind, ElementI3D) VALUES (0, 1, 3)");
|
|
}
|
|
} |