for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Inventory Item Number Field Class.
*
* @package InventoryField
* @copyright YetiForce S.A.
* @license YetiForce Public License 5.0 (licenses/LicenseEN.txt or yetiforce.com)
* @author Mariusz Krzaczkowski <[email protected]>
* @author Radosław Skrzypczak <[email protected]>
*/
class Vtiger_ItemNumber_InventoryField extends Vtiger_Basic_InventoryField
{
protected $type = 'ItemNumber';
protected $defaultLabel = 'LBL_ITEM_NUMBER';
protected $columnName = 'seq';
protected $purifyType = \App\Purifier::INTEGER;
/** {@inheritdoc} */
public function getDBValue($value, ?string $name = '')
return (int) $value;
}
public function validate($value, string $columnName, bool $isUserFormat, $originalValue = null)
if ($value && (!is_numeric($value) || (string) $value !== (string) filter_var($value, FILTER_VALIDATE_INT))) {
throw new \App\Exceptions\Security('ERR_ILLEGAL_FIELD_VALUE||' . $columnName . '||' . $this->getModuleName() . '||' . $value, 406);
public function compare($value, $prevValue, string $column): bool
return (int) $value === (int) $prevValue;