Eingangsrechnungen: disabled-Felder an update.php mitschicken
Bei gebuchten Rechnungen liefert editForm.php alle Felder disabled. serializeForm hat sie uebersprungen, update.php antwortete dann mit HTTP 422 (typ, mengenUndPreisAnpassung, firma_id, Adressfelder "must be present"). Die Felder werden jetzt mit ihren Werten uebernommen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f54a0fe155
commit
e6ce1d254b
5 files changed
+37
-4
No files matched your search
@@ -40,6 +40,9 @@ const editForm = `
|
||||
<script>admin.Eingangsrechnungen.editRechnung(388444);</script>
|
||||
`;
|
||||
|
||||
// Gebuchte Rechnung: editForm.php liefert alle Felder mit disabled.
|
||||
const editFormGebucht = editForm.replace(/<(input|select|textarea)(?=[\s>])/g, '<$1 disabled');
|
||||
|
||||
function createServer({ updateResponse = [], updateStatus = 200 } = {}) {
|
||||
const requests = [];
|
||||
|
||||
@@ -72,6 +75,12 @@ function createServer({ updateResponse = [], updateStatus = 200 } = {}) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === 'GET' && req.url === '/module/eingangsrechnungen/api/editForm.php?invoiceID=387644') {
|
||||
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
||||
res.end(editFormGebucht);
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === 'POST' && req.url === '/module/eingangsrechnungen/api/update.php') {
|
||||
res.writeHead(updateStatus, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify(updateResponse));
|
||||
@@ -180,3 +189,23 @@ test('setRechnungsdaten zeigt bei 422 ohne msg den Body', async t => {
|
||||
/HTTP 422\): \{"errors":\{"rgempf":"fehlt"\}\}/
|
||||
);
|
||||
});
|
||||
|
||||
test('setLieferscheinNummer schickt bei gebuchter Rechnung auch die disabled-Felder', async t => {
|
||||
const { connector, requests } = await startConnector(t);
|
||||
|
||||
await connector.setLieferscheinNummer(387644, '2026-001225');
|
||||
|
||||
const update = requests.find(request => request.url === '/module/eingangsrechnungen/api/update.php');
|
||||
assert.ok(update, 'update.php wurde nicht aufgerufen');
|
||||
const { formData } = JSON.parse(update.body);
|
||||
assert.equal(formData.lieferscheinnummer, '2026-001225');
|
||||
assert.equal(formData.typ, '0');
|
||||
assert.equal(formData.mengenUndPreisAnpassung, '0');
|
||||
assert.equal(formData.firma_id, '3');
|
||||
assert.equal(formData.additionalAddressLineOne, '');
|
||||
assert.equal(formData.additionalAddressLineTwo, '');
|
||||
assert.equal(formData.addressStreet, 'Postfach 810551');
|
||||
assert.equal(formData.addressPostalcode, '30505');
|
||||
assert.equal(formData.addressCity, 'Hannover');
|
||||
assert.equal(formData.addressCountryISO3166, 'DE');
|
||||
});
|
||||
Reference in new issue
Block a user