Add limit to number of locations to be stored. #632
This commit is contained in:
parent
c54ee5d7d8
commit
84844046f1
2 changed files with 14 additions and 1 deletions
|
|
@ -3650,8 +3650,13 @@ class APIController extends Controller implements LoggedController
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: limit locations to 6. If more than 6, pop the first one out
|
// limit locations to 6. If more than 6, pop the first one out
|
||||||
// add location to existing customer meta
|
// add location to existing customer meta
|
||||||
|
$meta_count = count($c_meta->getAllMetaInfo());
|
||||||
|
|
||||||
|
if ($meta_count >= 6)
|
||||||
|
$c_meta->popMetaInfo();
|
||||||
|
|
||||||
$c_meta->addMetaInfo($name, $loc_info);
|
$c_meta->addMetaInfo($name, $loc_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,4 +76,12 @@ class CustomerMetadata
|
||||||
{
|
{
|
||||||
return $this->meta_info;
|
return $this->meta_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function popMetaInfo()
|
||||||
|
{
|
||||||
|
if (count($this->meta_info) > 0)
|
||||||
|
{
|
||||||
|
array_shift($this->meta_info);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue