class ClientForm !!!1191301.php!!! __construct(inout orm : ORM, inout context : ApplicationContext) : ABMForm parent::__construct($orm, $context); $this->setClass("Client") ->setTitle("Cliente") ->setMethod("post") ->setFormType(Form::FORM_OK_CANCEL) ->setId("id_form_client"); $clientNumber = new TextComponent(); $clientNumber->setLabel("Nro Cliente") ->setMaps('clientNumber'); $razonSocial = new TextComponent(); $razonSocial->setLabel("Razón Social") ->setSize(70) ->setMaps('name'); $userOptions = $orm->query('User')->filterBy("provider.id", '=', $context->getProvider()->getId()) ->attributes('id AS value', 'name as description') ->find(); $user = new SelectComponent(); $user->setLabel("Usuario") ->setMaps('user') ->setOptions($userOptions); $mail = new TextComponent(); $mail->setLabel("E-mail") ->setMaps('mail') ->setSize(40); $phone = new TextComponent(); $phone->setLabel("Telefono") ->setMaps('phone') ->setSize(40); $alternativePhone = new TextComponent(); $alternativePhone->setLabel("Telefono 2") ->setMaps('alternativePhone') ->setSize(40); $status = new SelectComponent(); $status->setLabel("Estado") ->setMaps('status') ->setSelected("1") ->setOptions(array(array("value" => "1", "description" => "Activo"), array("value" => "0", "description" => "Inactivo"))); $payplanOptions = $orm->query('PayPlan') ->attributes('id AS value', 'description') ->find(); $payplan = new SelectComponent(); $payplan->setLabel("Plan de Pago") ->setMaps('payPlan') ->setOptions($payplanOptions); $oLayout1 = new GridLayout(8 /*8*/, 1); $oLayout1->addComponent($clientNumber, 1, 1) ->addComponent($razonSocial, 2, 1) ->addComponent($user, 3, 1) ->addComponent($mail, 4, 1) ->addComponent($phone, 5, 1) ->addComponent($alternativePhone, 6, 1) ->addComponent($status, 7, 1) ->addComponent($payplan, 8, 1); $this->addComponent($oLayout1); $this->setAction($context->getCurrentAction()->getStringCommand()); return $this; !!!1221765.php!!! save(in context : ApplicationContext, in orm : ORM) : Client $id = $this->getValueOf('id'); //Validaciones $valido = $this->validate(); if ($id === null) { //Caso alta $oClient = new Client(); $this->setValuesToObject($oClient); $oClient->setReseller($context->getManager('Wholesale')->getCurrentReseller()); } else { //Caso modificar $oClient = $orm->load('Client', $this->getValueOf('id')); $this->setValuesToObject($oClient); } if ($valido === true) { $orm->save($oClient); return $oClient; } else { //Seteo error de contexto de validacion xd.- return $valido; }