0
1
Fork 0

edi/load: fixes

This commit is contained in:
Juan Ferrer 2022-07-07 23:46:18 +02:00
parent 13e61acb2a
commit 2887497730
3 changed files with 14 additions and 14 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.408.5) stable; urgency=low
hedera-web (1.408.6) stable; urgency=low
* Initial Release.

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.408.5",
"version": "1.408.6",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {

View File

@ -206,25 +206,25 @@ class Load extends Edi\Method {
}
if ($update) {
$updateExistent = $db->getValue(
$ektFk = $db->getValue(
"SELECT id
FROM ekt
WHERE deliveryNumber = #deliveryNumber
AND entryYear = YEAR(#fec)",
$ediValues
);
$canUpdate = $ektFk && $db->getValue(
"SELECT COUNT(*) = 0
FROM ekt t
JOIN `exchange` b ON b.ektFk = t.id
JOIN exchangeConfig c
WHERE t.deliveryNumber = #deliveryNumber
AND t.entryYear = YEAR(#fec)
WHERE t.id = #
AND b.typeFk != c.presaleFk",
$ediValues
$ektFk
);
if ($updateExistent) {
$ektFk = $db->getValue(
"SELECT id
FROM ekt
WHERE deliveryNumber = #deliveryNumber
AND entryYear = YEAR(#fec)",
$ediValues
);
if ($canUpdate) {
$db->update('ekt',
$insertValues,
['id' => $ektFk]