@@ -83,6 +83,9 @@ |
||
| 83 | 83 | return $this->request($data, '/customers', 'POST'); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | + /** |
|
| 87 | + * @param string $method |
|
| 88 | + */ |
|
| 86 | 89 | public function request($data, $method, $type='GET') |
| 87 | 90 | { |
| 88 | 91 | $ch = curl_init(); |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | |
| 46 | 46 | if (!$this->Asaas->save($data)) { |
| 47 | 47 | $this->Session->setFlash('Erro ao atualizar dados!'); |
| 48 | - return $this->redirect('/asaas/configuracoes'); |
|
| 48 | + return $this->redirect('/asaas/configuracoes'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $this->Session->setFlash('Dados atualizados com sucesso!'); |
| 52 | - return $this->redirect('/asaas/configuracoes'); |
|
| 52 | + return $this->redirect('/asaas/configuracoes'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // \"customer\": \"{CUSTOMER_ID}\", |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | ) |
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | - if (!empty($exist)) { |
|
| 42 | + if ( ! empty($exist)) { |
|
| 43 | 43 | $this->Asaas->id = $exist['Asaas']['id']; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if (!$this->Asaas->save($data)) { |
|
| 46 | + if ( ! $this->Asaas->save($data)) { |
|
| 47 | 47 | $this->Session->setFlash('Erro ao atualizar dados!'); |
| 48 | 48 | return $this->redirect('/asaas/configuracoes'); |
| 49 | 49 | } |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | return $this->request($data, '/customers', 'POST'); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function request($data, $method, $type='GET') |
|
| 86 | + public function request($data, $method, $type = 'GET') |
|
| 87 | 87 | { |
| 88 | 88 | $ch = curl_init(); |
| 89 | 89 | |
| 90 | - curl_setopt($ch, CURLOPT_URL, $this->endpoint . $method); |
|
| 90 | + curl_setopt($ch, CURLOPT_URL, $this->endpoint.$method); |
|
| 91 | 91 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
| 92 | 92 | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
| 93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
| 100 | 100 | "Content-Type: application/json", |
| 101 | - "access_token: " . $this->loadToken() |
|
| 101 | + "access_token: ".$this->loadToken() |
|
| 102 | 102 | )); |
| 103 | 103 | |
| 104 | 104 | $response = curl_exec($ch); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | ) |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | - if (!empty($response)) { |
|
| 122 | + if ( ! empty($response)) { |
|
| 123 | 123 | return $response['Asaas']['api_key']; |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class LancamentoVendasController extends AppController { |
| 4 | 4 | |
| 5 | - public function salvar_lancamento($id_venda, $dados, $valor_total, $id_usuario, $orcamento=true) { |
|
| 6 | - $lancamento['venda_id'] = $id_venda; |
|
| 5 | + public function salvar_lancamento($id_venda, $dados, $valor_total, $id_usuario, $orcamento = true) { |
|
| 6 | + $lancamento['venda_id'] = $id_venda; |
|
| 7 | 7 | $lancamento['valor'] = $valor_total; |
| 8 | 8 | |
| 9 | 9 | if ($orcamento) { |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $lancamento['data_pgt'] = date('Y-m-d'); |
| 16 | - $lancamento['ativo'] = 1; |
|
| 16 | + $lancamento['ativo'] = 1; |
|
| 17 | 17 | $lancamento['usuario_id'] = $id_usuario; |
| 18 | 18 | $lancamento['forma_pagamento'] = $dados['forma_pagamento']; |
| 19 | 19 | |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | $this->EnderecoClienteCadastro->save($endereco); |
| 37 | 37 | |
| 38 | 38 | $this->Session->setFlash('Cliente salvo com sucesso!'); |
| 39 | - return $this->redirect('/cliente/listar_cadastros'); |
|
| 39 | + return $this->redirect('/cliente/listar_cadastros'); |
|
| 40 | 40 | } else { |
| 41 | 41 | $this->Session->setFlash('Ocorreu um erro ao salva o cliente!'); |
| 42 | - return $this->redirect('/cliente/listar_cadastros'); |
|
| 42 | + return $this->redirect('/cliente/listar_cadastros'); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | if ($this->Cliente->save($dados)) { |
| 93 | 93 | $this->Session->setFlash('Cliente editado com sucesso!'); |
| 94 | - return $this->redirect('/cliente/listar_cadastros'); |
|
| 94 | + return $this->redirect('/cliente/listar_cadastros'); |
|
| 95 | 95 | } else { |
| 96 | 96 | $this->Session->setFlash('Ocorreu um erro ao editar o cliente!'); |
| 97 | - return $this->redirect('/cliente/listar_cadastros'); |
|
| 97 | + return $this->redirect('/cliente/listar_cadastros'); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | function exportar_clientes() { |
| 102 | - $this->layout = 'ajax'; |
|
| 103 | - $this->set('event', $this->Cliente->find('all')); |
|
| 102 | + $this->layout = 'ajax'; |
|
| 103 | + $this->set('event', $this->Cliente->find('all')); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | function listar_pedidos($id) { |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | if (!$this->Venda->save($data)) { |
| 223 | 223 | $this->Session->setFlash('Erro ao emitir cobrança!'); |
| 224 | - return $this->redirect('/cliente/listar_pedidos/' . $cliente['Cliente']['id']); |
|
| 224 | + return $this->redirect('/cliente/listar_pedidos/' . $cliente['Cliente']['id']); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $this->Session->setFlash('Cobrança emitida com sucesso!'); |
| 228 | - return $this->redirect('/cliente/listar_pedidos/' . $cliente['Cliente']['id']); |
|
| 228 | + return $this->redirect('/cliente/listar_pedidos/' . $cliente['Cliente']['id']); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | } |
| 232 | 232 | \ No newline at end of file |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | require 'AsaasController.php'; |
| 4 | 4 | |
| 5 | -class ClienteController extends AppController{ |
|
| 5 | +class ClienteController extends AppController { |
|
| 6 | 6 | // public $helpers = array('Excel'); |
| 7 | 7 | |
| 8 | 8 | function home() { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | if ($this->Cliente->save($dados)) { |
| 31 | 31 | $endereco['id_usuario'] = $this->instancia; |
| 32 | 32 | $endereco['id_cliente'] = $this->Cliente->id; |
| 33 | - $endereco['ativo'] = 1; |
|
| 33 | + $endereco['ativo'] = 1; |
|
| 34 | 34 | |
| 35 | 35 | $this->loadModel('EnderecoClienteCadastro'); |
| 36 | 36 | $this->EnderecoClienteCadastro->save($endereco); |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $id = $this->request->data('id'); |
| 50 | 50 | |
| 51 | - $dados = array ('ativo' => '0'); |
|
| 52 | - $parametros = array ('id' => $id); |
|
| 51 | + $dados = array('ativo' => '0'); |
|
| 52 | + $parametros = array('id' => $id); |
|
| 53 | 53 | |
| 54 | - if ($this->Cliente->updateAll($dados,$parametros)) { |
|
| 54 | + if ($this->Cliente->updateAll($dados, $parametros)) { |
|
| 55 | 55 | echo json_encode(true); |
| 56 | 56 | } else { |
| 57 | 57 | echo json_encode(false); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | ) |
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | - if (!isset($lancamento['LancamentoVenda'])) { |
|
| 129 | + if ( ! isset($lancamento['LancamentoVenda'])) { |
|
| 130 | 130 | unset($vendas[$i]); |
| 131 | 131 | continue; |
| 132 | 132 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | if (empty($cliente['Cliente']['asaas_id'])) { |
| 178 | 178 | $cliente_data = array( |
| 179 | - "name" => $cliente['Cliente']['nome1'] . ' ' . $cliente['Cliente']['nome2'], |
|
| 179 | + "name" => $cliente['Cliente']['nome1'].' '.$cliente['Cliente']['nome2'], |
|
| 180 | 180 | "email" => $cliente['Cliente']['email'], |
| 181 | 181 | "cpfCnpj" => $cliente['Cliente']['documento1'], |
| 182 | 182 | "externalReference" => $cliente['Cliente']['id'] |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | "billingType" => "BOLETO", |
| 198 | 198 | "dueDate" => date('Y-m-d'), |
| 199 | 199 | "value" => $venda['Venda']['valor'], |
| 200 | - "description" => "Boleto referente a venda no sistema winners REFº " . $venda['Venda']['id'], |
|
| 200 | + "description" => "Boleto referente a venda no sistema winners REFº ".$venda['Venda']['id'], |
|
| 201 | 201 | "externalReference" => $venda['Venda']['id'] |
| 202 | 202 | ); |
| 203 | 203 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $this->Session->setFlash($error->description); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - return $this->redirect('/cliente/listar_pedidos/' . $cliente['Cliente']['id']); |
|
| 211 | + return $this->redirect('/cliente/listar_pedidos/'.$cliente['Cliente']['id']); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | $this->Venda->id = $venda_id; |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | 'asaas_transaction_id' => $response->id |
| 220 | 220 | ]; |
| 221 | 221 | |
| 222 | - if (!$this->Venda->save($data)) { |
|
| 222 | + if ( ! $this->Venda->save($data)) { |
|
| 223 | 223 | $this->Session->setFlash('Erro ao emitir cobrança!'); |
| 224 | - return $this->redirect('/cliente/listar_pedidos/' . $cliente['Cliente']['id']); |
|
| 224 | + return $this->redirect('/cliente/listar_pedidos/'.$cliente['Cliente']['id']); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $this->Session->setFlash('Cobrança emitida com sucesso!'); |
| 228 | - return $this->redirect('/cliente/listar_pedidos/' . $cliente['Cliente']['id']); |
|
| 228 | + return $this->redirect('/cliente/listar_pedidos/'.$cliente['Cliente']['id']); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | } |
| 232 | 232 | \ No newline at end of file |