Skip to content

Instantly share code, notes, and snippets.

@fayqLs
Last active July 8, 2022 20:55
Show Gist options
  • Save fayqLs/90ad400a7277a64d3fd38e6344fa532c to your computer and use it in GitHub Desktop.
Save fayqLs/90ad400a7277a64d3fd38e6344fa532c to your computer and use it in GitHub Desktop.
PEGA O ID DA UNIDADE LOGADA NO SISTEMA
<?php
public function onSave($param = null)
{
try
{
TTransaction::open(self::$database);
$this->form->validate();
$object = new Lancamento();
$data = $this->form->getData();
$object->fromArray((array) $data);
if (empty($object->id)) {
# CAPTURA E SALVA A UNIDADE LOGADA
$object->system_unit_id = TSession::getValue('userunitid');
}
$object->store();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment