mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
bugfix GetNextArtikelNummer skip existing numbers
This commit is contained in:
parent
1ff2878d06
commit
e51e1db15c
@ -27558,6 +27558,16 @@ function Firmendaten($field,$projekt="")
|
||||
return $buchstaben_anteil_string.$neue_nummer;
|
||||
}
|
||||
|
||||
function CalcNextArtikelNummer($nummer) {
|
||||
$check = null;
|
||||
do {
|
||||
$nummer = $this->CalcNextNummer($nummer);
|
||||
$sql = "SELECT id FROM artikel WHERE nummer = '".$nummer."'";
|
||||
$check = $this->app->DB->Select($sql);
|
||||
} while (!empty($check));
|
||||
return ($nummer);
|
||||
}
|
||||
|
||||
function GetNextNummer($type,$projekt="",$data="")
|
||||
{
|
||||
$doctype = $type;
|
||||
@ -28032,7 +28042,7 @@ function Firmendaten($field,$projekt="")
|
||||
$nurzahlen = preg_replace("/[^0-9]/","",$next_nummer_alt);
|
||||
$laenge = strlen($nurzahlen);
|
||||
|
||||
$next_nummer = $this->CalcNextNummer($next_nummer_alt);
|
||||
$next_nummer = $this->CalcNextArtikelNummer($next_nummer_alt);
|
||||
//$nurbuchstaben.str_pad($nurzahlen+1, $laenge ,'0', STR_PAD_LEFT);
|
||||
$neue_nummer = $next_nummer;
|
||||
|
||||
@ -28045,12 +28055,12 @@ function Firmendaten($field,$projekt="")
|
||||
if($eigenernummernkreis=="1")
|
||||
{
|
||||
$neue_nummer = $this->app->DB->Select("SELECT next_artikelnummer FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextNummer($neue_nummer);
|
||||
$next_nummer = $this->CalcNextNummer($neue_nummer);
|
||||
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||
$next_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||
$this->app->DB->Update("UPDATE projekt SET next_artikelnummer='".$next_nummer."' WHERE id='$projekt' LIMIT 1");
|
||||
} else {
|
||||
//zentraler nummernkreis mit prefix
|
||||
$next_nummer = $this->CalcNextNummer($this->Firmendaten("next_artikelnummer"));
|
||||
$next_nummer = $this->CalcNextArtikelNummer($this->Firmendaten("next_artikelnummer"));
|
||||
$this->FirmendatenSet("next_artikelnummer",$next_nummer);
|
||||
if($next_nummer_alt!="") $neue_nummer=$next_nummer_alt.$next_nummer;
|
||||
else $neue_nummer = $next_nummer;
|
||||
@ -28065,15 +28075,15 @@ function Firmendaten($field,$projekt="")
|
||||
if($eigenernummernkreis)
|
||||
{
|
||||
$neue_nummer = $this->app->DB->Select("SELECT next_artikelnummer FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextNummer($neue_nummer);
|
||||
$next_nummer = $this->CalcNextNummer($neue_nummer);
|
||||
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||
$next_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||
$this->app->DB->Update("UPDATE projekt SET next_artikelnummer='".$next_nummer."' WHERE id='$projekt' LIMIT 1");
|
||||
}else{
|
||||
$firmennummer = $this->app->erp->Firmendaten('next_artikelnummer');
|
||||
if($firmennummer)
|
||||
{
|
||||
$next_nummer = $firmennummer;
|
||||
$neue_nummer = $this->CalcNextNummer($next_nummer);
|
||||
$neue_nummer = $this->CalcNextArtikelNummer($next_nummer);
|
||||
$this->FirmendatenSet('next_artikelnummer', $neue_nummer);
|
||||
$neue_nummer = $this->app->erp->Firmendaten('next_artikelnummer');
|
||||
} else {
|
||||
@ -28095,10 +28105,11 @@ function Firmendaten($field,$projekt="")
|
||||
$neue_nummer = $this->app->DB->Select("SELECT MAX(CAST(nummer AS UNSIGNED)) FROM artikel WHERE nummer LIKE '1%'");
|
||||
if(($neue_nummer=="" || $neue_nummer=="0")) $neue_nummer = "100000";
|
||||
}
|
||||
$neue_nummer = $this->CalcNextNummer($neue_nummer);//$neue_nummer + 1;
|
||||
$neue_nummer = $this->CalcNextArtikelNummer($neue_nummer);//$neue_nummer + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->app->erp->ProzessUnlock($process_lock);
|
||||
$neue_nummer = str_replace('{JAHR}',date('Y'),$neue_nummer);
|
||||
$neue_nummer = str_replace('{MONAT}',date('m'),$neue_nummer);
|
||||
|
Loading…
Reference in New Issue
Block a user