From bcf2544735077ada89900d2f1057c0660e8a69cb Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Sun, 29 Jan 2023 14:50:15 +0100 Subject: [PATCH] Bugfixes presta, support for project specific number ranges --- www/lib/class.erpapi.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 554317a3..4dcc75d8 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -29440,7 +29440,7 @@ function Firmendaten($field,$projekt="") $process_lock = $this->app->erp->ProzessLock("erpapi_getnextnummer"); $eigenernummernkreis = $this->app->DB->Select("SELECT eigenernummernkreis FROM projekt WHERE id='$projekt' LIMIT 1"); - $newbelegnr = ''; + $belegnr = ''; if($eigenernummernkreis=='1') { $allowedtypes = ['angebot', 'auftrag', 'rechnung', 'lieferschein', 'arbeitsnachweis', 'reisekosten', @@ -29449,13 +29449,13 @@ function Firmendaten($field,$projekt="") 'retoure', 'verbindlichkeit', 'goodspostingdocument', 'receiptdocument']; $dbfield = "next_$type"; - $dbvalue = $this->app->DB->Select("SELECT $dbfield FROM projekt WHERE id='$projekt' LIMIT 1"); - if (!empty($dbvalue)) { + $belegnr = $this->app->DB->Select("SELECT $dbfield FROM projekt WHERE id='$projekt' LIMIT 1"); + if (!empty($belegnr)) { $newbelegnr = $this->CalcNextNummer($dbvalue); $this->app->DB->Update("UPDATE projekt SET $dbfield='$newbelegnr' WHERE id='$projekt' LIMIT 1"); } } - if (empty($newbelegnr)) { + if (empty($belegnr)) { // naechste switch($type) {