formDin icon indicating copy to clipboard operation
formDin copied to clipboard

Bug: setMessage

Open bjverde opened this issue 6 years ago • 2 comments

usar o setMessage gera um problema travando a tela

bjverde avatar Oct 11 '19 02:10 bjverde

Exemplo para reproduzir o problema. Quando é chamada um acao Save que utiliza $frm->setMessage( $e->getMessage() ); no catch a tela fica travada e não sai.

chamando uma controller com

    public function save( Pessoa_juridicaVO $objVo )
    {
        $tpdo = New TPDOConnectionObj();
        $result = null;
        try{
            $tpdo->beginTransaction();
            //throw new DomainException('xxx');
            throw new Exception('aaaa');
            $tpdo->commit();            
        }catch (Exception $e) {
            $tpdo->rollBack();
            MessageHelper::logRecord($e);
            throw new Exception($e->getMessage());
        }
        return $result;
        
        /*
        $result = null;
        if( $objVo->getIdpessoa_juridica() ) {
            $result = $this->dao->update( $objVo );
        } else {
            $result = $this->dao->insert( $objVo );
        }
        return $result;
        */
    }

bjverde avatar Oct 11 '19 03:10 bjverde

A origem do problema provavelmente a função setMessage não limpar tudo como acontece no addMessage

TForm->setMessage linha 2539 https://github.com/bjverde/formDin/blob/master/base/classes/webform/TForm.class.php#L2539

TForm->addMessage linha 2597 https://github.com/bjverde/formDin/blob/master/base/classes/webform/TForm.class.php#L2597

bjverde avatar Oct 11 '19 03:10 bjverde