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. * Initial Release.

View File

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

View File

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