public function getInputFilterSpecification() { return ['email' => ['validators' => [FormUtil::notEmptyValidator(), FormUtil::emailValidator()], 'filters' => []], 'password' => ['required' => true, 'validators' => [FormUtil::notEmptyValidator(), FormUtil::lengthValidator(6)], 'filters' => [FormUtil::callbackFilter(function ($input) { // trim if greater than 100 chars to prevent heavy processing return substr($input, 0, 100); })]]]; }
public function init() { $this->add(['name' => 'name', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'email', 'required' => true, 'validators' => [FormUtil::notEmptyValidator(), FormUtil::emailValidator(), FormUtil::noRecordExistsValidator('email', User::class, $this->em(), ['id' => $this->getRecordIdOrNull()])], 'filters' => []]); $this->add(['name' => 'contact_no', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'address', 'required' => false, 'validators' => [], 'filters' => []]); }
public function init() { $this->add(['name' => 'name', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::noRecordExistsValidator('name', StockUnit::class, $this->em(), ['id' => $this->getRecordIdOrNull()])], 'filters' => []]); $this->add(['name' => 'type', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::noRecordExistsValidator('id', UnitType::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), UnitType::class)]]); $this->add(['name' => 'description', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'ratio', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::floatValidator(), FormUtil::greaterThanValidator(0, false)], 'filters' => []]); }
public function init() { $this->add(['name' => 'name', 'required' => true, 'validators' => [FormUtil::notEmptyValidator(), FormUtil::noRecordExistsValidator('name', Warehouse::class, $this->em(), ['id' => $this->getRecordIdOrNull()])], 'filters' => []]); $this->add(['name' => 'description', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'address', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'latitude', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'longitude', 'required' => false, 'validators' => [], 'filters' => []]); }
public function init() { $this->add(['name' => 'type', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::recordExistsValidator('id', IngredientType::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), IngredientType::class)]]); $this->add(['name' => 'menu', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::recordExistsValidator('id', Menu::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), Menu::class)]]); $this->add(['name' => 'stock_item', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::recordExistsValidator('id', StockItem::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), StockItem::class)]]); $this->add(['name' => 'quantity', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::floatValidator(), FormUtil::greaterThanValidator(0, true)], 'filters' => []]); $this->add(['name' => 'qty_price', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::floatValidator(), FormUtil::greaterThanValidator(0, true)], 'filters' => []]); $this->add(['name' => 'note', 'required' => false, 'validators' => [], 'filters' => []]); }
public function init() { $this->add(['name' => 'name', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::noRecordExistsValidator('name', Menu::class, $this->em(), ['id' => $this->getRecordIdOrNull()])], 'filters' => []]); $this->add(['name' => 'description', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'serving_unit', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'note', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'default_price', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::floatValidator()], 'filters' => []]); $this->add(['name' => 'types', 'required' => false, 'validators' => [FormUtil::recordExistsValidator('id', Type::class, $this->em())], 'filters' => [FormUtil::entityReferenceCollectionFilter($this->em(), Type::class)]]); $this->add(['name' => 'parent', 'required' => false, 'validators' => [FormUtil::noRecordExistsValidator('id', Menu::class, $this->em()), FormUtil::callbackValidator(function ($input) { $id = $input instanceof Menu ? $input->getId() : $input; return in_array($id, $this->getParentMenuOptions()); })], 'filters' => [FormUtil::entityReferenceFilter($this->em(), Menu::class)]]); }
public function init() { $this->add(['name' => 'storage_unit', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::recordExistsValidator('id', StockUnit::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), StockUnit::class)]]); $this->add(['name' => 'usage_unit', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::recordExistsValidator('id', StockUnit::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), StockUnit::class)]]); $this->add(['name' => 'categories', 'required' => false, 'validators' => [FormUtil::recordExistsValidator('id', Category::class, $this->em())], 'filters' => [FormUtil::entityReferenceCollectionFilter($this->em(), Category::class)]]); $this->add(['name' => 'type', 'required' => false, 'validators' => [FormUtil::recordExistsValidator('id', StorageType::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), StorageType::class)]]); $this->add(['name' => 'code', 'required' => false, 'validators' => [FormUtil::noRecordExistsValidator('code', StockItem::class, $this->em(), ['id' => $this->getRecordIdOrNull()])], 'filters' => [FormUtil::callbackFilter(function ($input) { return trim($input) ? $input : null; })]]); $this->add(['name' => 'name', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'description', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'note', 'required' => false, 'validators' => [], 'filters' => []]); }
public function init() { $this->add(['name' => 'title', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'outlet', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::recordExistsValidator('id', Outlet::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), Outlet::class)]]); $this->add(['name' => 'currency', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'type', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'note', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'ordered_at', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::dateValidator('M d, Y')], 'filters' => [FormUtil::dateFilter('M d, Y')]]); $this->add(['name' => 'raw_items', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::callbackValidator(function ($input) { if (!is_array($input)) { return false; } foreach ($input as $spec) { switch (true) { case !is_numeric($spec['quantity']) || $spec['quantity'] < 0: case !is_numeric($spec['subtotal']) || $spec['subtotal'] < 0: case !is_numeric($spec['unit_price']) || $spec['unit_price'] < 0: case !is_numeric($spec['total']) || $spec['total'] < 0: return false; } } return true; }, "Qty. dan total harus valid setiap baris item.")], 'filters' => [FormUtil::callbackFilter(function ($input) { $return = []; if (is_array($input)) { $defaults = ['menu_price' => null, 'item_name' => '', 'quantity' => 0, 'unit_price' => 0, 'subtotal' => 0, 'total' => 0]; foreach ($input as $i => $spec) { $spec += $defaults; if ($spec['item_name']) { // convert numbers $spec['quantity'] = preg_replace('/[^0-9]/', null, $spec['quantity']); $spec['unit_price'] = preg_replace('/[^0-9]/', null, $spec['unit_price']); $spec['subtotal'] = preg_replace('/[^0-9]/', null, $spec['subtotal']); $spec['total'] = preg_replace('/[^0-9]/', null, $spec['total']); $return[] = $spec; } } } return $return; })]]); }
public function init() { $this->add(['name' => 'name', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::noRecordExistsValidator('name', Classification::class, $this->em(), ['id' => $this->getRecordIdOrNull()])], 'filters' => []]); }
public function getInputFilterSpecification() { return ['name' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'email' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'contact_no' => ['required' => false, 'validators' => [], 'filters' => []], 'type' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'severity' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'need_reply' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'message' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []]]; }
public function getInputFilterSpecification() { return ['old_password' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'new_password' => ['validators' => [FormUtil::notEmptyValidator(), FormUtil::lengthValidator(6, 100)], 'filters' => []], 'confirm_password' => ['validators' => [FormUtil::notEmptyValidator(), FormUtil::identicalValidator('new_password', 'Password tidak sama dengan diatas.')], 'filters' => []]]; }
public function init() { $this->add(['name' => 'title', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'warehouse', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::recordExistsValidator('id', Warehouse::class, $this->em())], 'filters' => [FormUtil::entityReferenceFilter($this->em(), Warehouse::class)]]); $this->add(['name' => 'supplier_name', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'currency', 'validators' => [FormUtil::notEmptyValidator()], 'filters' => []]); $this->add(['name' => 'note', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'po_number', 'required' => false, 'validators' => [], 'filters' => []]); $this->add(['name' => 'status', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::inArrayValidator(self::getStatusOptions()), FormUtil::workflowValidator(self::getStatusOptions(), $this->getRecordIdOrNull(), true)], 'filters' => []]); $this->add(['name' => 'ordered_at', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::dateValidator('M d, Y')], 'filters' => [FormUtil::dateFilter('M d, Y', true)]]); $this->add(['name' => 'delivered_at', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::dateValidator('M d, Y')], 'filters' => [FormUtil::dateFilter('M d, Y', true)]]); $this->add(['name' => 'raw_items', 'validators' => [FormUtil::notEmptyValidator("Belum ada item yang ditambahkan."), FormUtil::callbackValidator(function ($input) { if (!is_array($input)) { return false; } foreach ($input as $spec) { switch (true) { case trim($spec['item_name']) == '': case !is_numeric($spec['quantity']) || $spec['quantity'] < 0: case !is_numeric($spec['total']) || $spec['total'] < 0: return false; } } return true; }, "Qty. dan total harus valid setiap baris item.")], 'filters' => [FormUtil::callbackFilter(function ($input) { $return = []; if (is_array($input)) { $defaults = ['stock' => null, 'item_name' => '', 'quantity' => 0, 'unit' => 0, 'unit_price' => 0, 'subtotal' => 0, 'total' => 0]; foreach ($input as $i => $spec) { $spec += $defaults; if ($spec['item_name']) { // convert numbers $spec['quantity'] = preg_replace('/[^0-9]/', null, $spec['quantity']); $spec['unit_price'] = preg_replace('/[^0-9]/', null, $spec['unit_price']); $spec['subtotal'] = preg_replace('/[^0-9]/', null, $spec['subtotal']); $spec['total'] = preg_replace('/[^0-9]/', null, $spec['total']); $return[] = $spec; } } } return $return; })]]); }
/** * @return array */ public function getInputFilterSpecification() { return ['name' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'billing_user' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => [FormUtil::entityReferenceFilter($this->em(), User::class)]], 'address' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'phone' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'fax' => ['required' => false, 'validators' => [], 'filters' => []], 'email' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'website' => ['required' => false, 'validators' => [], 'filters' => []], 'facebook' => ['required' => false, 'validators' => [], 'filters' => []], 'twitter' => ['required' => false, 'validators' => [], 'filters' => []], 'default_timezone' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'default_currency' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'default_locale' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []]]; }
/** * @return array */ public function getInputFilterSpecification() { return ['name' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'address' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'phone' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'fax' => ['required' => false, 'validators' => [], 'filters' => []], 'email' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'website' => ['required' => false, 'validators' => [], 'filters' => []], 'facebook' => ['required' => false, 'validators' => [], 'filters' => []], 'twitter' => ['required' => false, 'validators' => [], 'filters' => []], 'default_timezone' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'default_currency' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'default_locale' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'max_users' => ['required' => false, 'validators' => [], 'filters' => []], 'max_warehouses' => ['required' => false, 'validators' => [], 'filters' => []], 'max_outlets' => ['required' => false, 'validators' => [], 'filters' => []], 'max_menus' => ['required' => false, 'validators' => [], 'filters' => []], 'max_stock_items' => ['required' => false, 'validators' => [], 'filters' => []], 'next_due_date' => ['required' => false, 'validators' => [FormUtil::dateValidator('Y-m-d')], 'filters' => []], 'user_name' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'user_email' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'password' => ['validators' => [FormUtil::notEmptyValidator()], 'filters' => []], 'confirm_password' => ['validators' => [FormUtil::notEmptyValidator(), FormUtil::identicalValidator('password')], 'filters' => []]]; }
public function init() { $this->add(['name' => 'name', 'validators' => [FormUtil::notEmptyValidator(), FormUtil::noRecordExistsValidator('name', Category::class, $this->em(), ['id' => $this->getRecordIdOrNull()])], 'filters' => []]); $this->add(['name' => 'color', 'required' => false, 'validators' => [], 'filters' => []]); }