0
Good Morning
I need help because I am creating a form to save only dates......
the view is already created with 4 fields for dates... and there in the controller I’m half lost.
I’ve debugged the $data and it brings the information in the bank inserted in the Marra...so far so good. the commented part I left for when bring the saved dates and inform whether it worked or not...
Controller
public function desligamentocliente()
{
//$this->verifica_ausencia_dados($this->request->data['idCliente']);
$this->loadModel( "DesligamentoCliente" );
$idCliente = ( isset( $this->request->params['pass'][0] ) ) ? $this->request->params['pass'][0] : 0;
$dados = $this->DesligamentoCliente->find( "all", array( "conditions" => array("_esc_codigo" => $idCliente )));
/*
$dados == 1 ? $this->Desligamentos->DesligamentoCliente->save("data_financeiro", "data_fiscal", "data_contabil", "data_pessoal") :
$this->request->data['DesligamentosCliente']['data_financeiro'] = General::formata_data_mysql($this->request->data['DesligamentosCliente']['data_financeiro'] );
$this->request->data['DesligamentosCliente']['data_fiscal'] = General::formata_data_mysql($this->request->data['DesligamentosCliente']['data_fiscal'] );
$this->request->data['DesligamentosCliente']['data_contabil'] = General::formata_data_mysql($this->request->data['DesligamentosCliente']['data_contabil'] );
$this->request->data['DesligamentosCliente']['data_pessoal'] = General::formata_data_mysql($this->request->data['DesligamentosCliente']['data_pessoal'] );
if ($this->Desligamentos->desligamentocliente->updateAll( array("data_financeiro" => $data_financeiro, "data_fiscal" => $data_fiscal, "data_contabil" => $data_contabil, "data_pessoal" => $data_pessoal)
)
) {
$msg = "Ocorreu um erro ao tentar salvar as datas";
if ($this->Desligamentos->desligamentocliente->save($this->request->data)) {
$msg = "Datas salvas com sucesso";
$class = "alert alert-success";
}
}
$this->Session->setFlash($msg, "alerta", array("class" => $class));
$this ->redirect("/clientes");
*/ }
Thanks for your help... =)
I didn’t get it right, he is saving in the bank, but with the wrong dates? in what format is your dates in the view (format br? d/m/Y?)
– Jeferson Assis
I will try to explain better @Jefersonassis , what I’m having difficulty is to mondar if...(ñ know if that’s right) that receive the dates informed in the form and save them in the bank. I debugged the variable data...pretty much the way it is..."print_r($data); die()" and it showed me data that I manually entered in table q it should receive.
– luiz_pool
I’ll post the answer, maybe that’s what you need
– Jeferson Assis
So what I need......
– luiz_pool
Thanks @Jefersonassis... very grateful =)
– luiz_pool
I answered, see if it helps you answer.
– Jeferson Assis