mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Fixed the bug where grocy would return "Not a grocycode" all the time (#1557)
This commit is contained in:
parent
53e405c4f8
commit
a79247a30c
@ -77,7 +77,7 @@ class Grocycode
|
|||||||
$gc = new self($code);
|
$gc = new self($code);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ class Grocycode
|
|||||||
*/
|
*/
|
||||||
private function setFromCode($code)
|
private function setFromCode($code)
|
||||||
{
|
{
|
||||||
$parts = array_reverse(explode(':', $barcode));
|
$parts = array_reverse(explode(':', $code));
|
||||||
if (array_pop($parts) != self::MAGIC)
|
if (array_pop($parts) != self::MAGIC)
|
||||||
{
|
{
|
||||||
throw new \Exception('Not a grocycode');
|
throw new \Exception('Not a grocycode');
|
||||||
@ -122,7 +122,7 @@ class Grocycode
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->id = array_pop($parts);
|
$this->id = array_pop($parts);
|
||||||
$this->extra_data = array_reverse($parse);
|
$this->extra_data = array_reverse($parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user