/** * Executed when the user chooses the record */ function onSelect($param) { $key = $param['key']; $prefix = TSession::getValue('prefix'); try { $model = isset($param['model']) ? $param['model'] : TSession::getValue('model'); TTransaction::open(TSession::getValue('banco')); // load the active record $campos = new $model($key); $cliente = new stdClass(); foreach (TSession::getValue('campos') as $field => $label) { $cliente->{$prefix . '_' . $field} = $campos->{$field}; } TForm::sendData(TSession::getValue('parent'), $cliente); parent::closeWindow(); // closes the window } catch (Exception $e) { throw new Exception('Erro com a mensagem ' . $e->getMesage()); // undo pending operations TTransaction::rollback(); } parent::closeWindow(); }
/** * Executed when the user chooses the record */ public function onSelect($param) { try { $key = $param['key']; TTransaction::open('library'); // load the active record $rep = new TRepository('Item'); $criteria = new TCriteria(); $criteria->add(new TFilter('barcode', '=', $key)); $objects = $rep->load($criteria); if ($objects) { $item = $objects[0]; $object = new StdClass(); $object->barcode_input = $item->barcode; $object->book_title_input = $item->title; TForm::sendData('form_Loan', $object); } else { $object = new StdClass(); $object->barcode_input = ''; $object->book_title_input = ''; TForm::sendData('form_Loan', $object); } // closes the transaction TTransaction::close(); parent::closeWindow(); // closes the window } catch (Exception $e) { // exibe a mensagem gerada pela exceção new TMessage('error', $e->getMessage()); // desfaz todas alterações no banco de dados TTransaction::rollback(); } }
/** * Select the register by ID and return the information to the main form * When using onblur signal, AJAX passes all needed parameters via GET * instead of calling onSetup before. */ public function onSelect($param) { $key = $param['key']; $database = isset($param['database']) ? $param['database'] : TSession::getValue('standard_seek_database'); $receive_key = isset($param['receive_key']) ? $param['receive_key'] : TSession::getValue('standard_seek_receive_key'); $receive_field = isset($param['receive_field']) ? $param['receive_field'] : TSession::getValue('standard_seek_receive_field'); $display_field = isset($param['display_field']) ? $param['display_field'] : TSession::getValue('standard_seek_display_field'); $parent = isset($param['parent']) ? $param['parent'] : TSession::getValue('standard_seek_parent'); try { TTransaction::open($database); // load the active record $model = isset($param['model']) ? $param['model'] : TSession::getValue('standard_seek_model'); $activeRecord = new $model($key); TTransaction::close(); $object = new StdClass(); $object->{$receive_key} = $activeRecord->{'id'}; $object->{$receive_field} = $activeRecord->{$display_field}; TForm::sendData($parent, $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // clear fields $object = new StdClass(); $object->{$receive_key} = ''; $object->{$receive_field} = ''; TForm::sendData($parent, $object); // undo all pending operations TTransaction::rollback(); } }
/** * Executed when the user chooses the record */ function onSelect($param) { try { $key = $param['key']; TTransaction::open('samples'); // load the active record $city = new City($key); // closes the transaction TTransaction::close(); $object = new StdClass(); $object->city_id1 = $city->id; $object->city_name1 = $city->name; TForm::sendData('form_seek_sample', $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // em caso de exceção // clear fields $object = new StdClass(); $object->city_id1 = ''; $object->city_name1 = ''; TForm::sendData('form_seek_sample', $object); // undo pending operations TTransaction::rollback(); } }
/** * Executed when the user chooses the record */ function onSelect($param) { try { $key = $param['key']; TTransaction::open('tecbiz'); // load the active record $pessoa = new Pessoa($key); // closes the transaction TTransaction::close(); $object = new StdClass(); $object->city_id1 = $pessoa->pessoa_codigo; $object->city_name1 = $pessoa->pessoa_nome; TForm::sendData('form_seek_sample', $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // clear fields $object = new StdClass(); $object->city_id1 = ''; $object->city_name1 = ''; TForm::sendData('form_seek_sample', $object); // undo pending operations TTransaction::rollback(); } }
/** * method onSelect() * Selects the record */ public function onSelect($param) { try { $key = $param['key']; TTransaction::open('samples'); $city = new City($key); // close the transaction TTransaction::close(); $object = new StdClass(); $object->city_id = $city->id; $object->city_name = $city->name; TForm::sendData('form_customer', $object); parent::closeWindow(); // close the window } catch (Exception $e) { // clear fields $object = new StdClass(); $object->city_id = ''; $object->city_name = ''; TForm::sendData('form_customer', $object); // undo pending operations TTransaction::rollback(); } }
/** * Executed when the user chooses the record */ function onSelect($param) { try { $key = $param['key']; TTransaction::open('atividade'); // load the active record $pessoa = new Pessoa($key); $object = new StdClass(); $object->solicitante_id = $pessoa->pessoa_codigo; $object->solicitante_nome = $pessoa->pessoa_nome; $object->origem_nome = $pessoa->origem_nome; // closes the transaction TTransaction::close(); TForm::sendData('form_Ticket', $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // clear fields $object = new StdClass(); $object->solicitante_id = ''; $object->solicitante_nome = ''; $object->origem_nome = ''; TForm::sendData('form_Ticket', $object); // undo pending operations TTransaction::rollback(); } }