@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once(ROOT . DS . 'vendor' . DS . 'autoload.php'); |
|
| 3 | +require_once(ROOT.DS.'vendor'.DS.'autoload.php'); |
|
| 4 | 4 | |
| 5 | 5 | use Dompdf\Dompdf; |
| 6 | 6 | |
| 7 | -class ProdutoController extends AppController{ |
|
| 7 | +class ProdutoController extends AppController { |
|
| 8 | 8 | |
| 9 | 9 | public function listar_cadastros() { |
| 10 | 10 | $this->layout = 'wadmin'; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function listar_cadastros_ajax() { |
| 14 | 14 | $this->layout = 'ajax'; |
| 15 | 15 | |
| 16 | - $aColumns = array( 'sku', 'imagem', 'nome', 'preco', 'estoque' ); |
|
| 16 | + $aColumns = array('sku', 'imagem', 'nome', 'preco', 'estoque'); |
|
| 17 | 17 | |
| 18 | 18 | $conditions = array('conditions' => |
| 19 | 19 | array( |
@@ -24,26 +24,26 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $allProdutos = $this->Produto->find('all', $conditions); |
| 26 | 26 | |
| 27 | - if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' ) |
|
| 27 | + if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') |
|
| 28 | 28 | { |
| 29 | 29 | $conditions['offset'] = $_GET['iDisplayStart']; |
| 30 | 30 | $conditions['limit'] = $_GET['iDisplayLength']; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if ( isset( $_GET['iSortCol_0'] ) ) |
|
| 33 | + if (isset($_GET['iSortCol_0'])) |
|
| 34 | 34 | { |
| 35 | - for ( $i=0 ; $i < intval( $_GET['iSortingCols'] ) ; $i++ ) |
|
| 35 | + for ($i = 0; $i < intval($_GET['iSortingCols']); $i++) |
|
| 36 | 36 | { |
| 37 | - if ( $_GET[ 'bSortable_' . intval($_GET['iSortCol_' . $i]) ] == "true" ) |
|
| 37 | + if ($_GET['bSortable_'.intval($_GET['iSortCol_'.$i])] == "true") |
|
| 38 | 38 | { |
| 39 | - $conditions['order'] = array('Produto.' . $aColumns[intval($_GET['iSortCol_' . $i])] => $_GET['sSortDir_'.$i]); |
|
| 39 | + $conditions['order'] = array('Produto.'.$aColumns[intval($_GET['iSortCol_'.$i])] => $_GET['sSortDir_'.$i]); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if ( isset( $_GET['sSearch'] ) && !empty( $_GET['sSearch'] ) ) |
|
| 44 | + if (isset($_GET['sSearch']) && ! empty($_GET['sSearch'])) |
|
| 45 | 45 | { |
| 46 | - $conditions['conditions']['Produto.nome LIKE '] = '%' . $_GET['sSearch'] . '%'; |
|
| 46 | + $conditions['conditions']['Produto.nome LIKE '] = '%'.$_GET['sSearch'].'%'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $produtos = $this->Produto->find('all', $conditions); |
@@ -55,19 +55,19 @@ discard block |
||
| 55 | 55 | "aaData" => array() |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - foreach ( $produtos as $i => $produto ) |
|
| 58 | + foreach ($produtos as $i => $produto) |
|
| 59 | 59 | { |
| 60 | 60 | $row = array(); |
| 61 | 61 | |
| 62 | - for ( $i=0 ; $i < count($aColumns) ; $i++ ) |
|
| 62 | + for ($i = 0; $i < count($aColumns); $i++) |
|
| 63 | 63 | { |
| 64 | 64 | $value = $produto['Produto'][$aColumns[$i]]; |
| 65 | 65 | |
| 66 | 66 | if ($aColumns[$i] == "imagem") |
| 67 | 67 | { |
| 68 | - $value = '<img src="/uploads/produto/imagens/' . $produto['Produto'][$aColumns[$i]] . '" width="120" height="120">'; |
|
| 68 | + $value = '<img src="/uploads/produto/imagens/'.$produto['Produto'][$aColumns[$i]].'" width="120" height="120">'; |
|
| 69 | 69 | |
| 70 | - if (!isset($produto['Produto'][$aColumns[$i]]) || empty($produto['Produto'][$aColumns[$i]])) |
|
| 70 | + if ( ! isset($produto['Produto'][$aColumns[$i]]) || empty($produto['Produto'][$aColumns[$i]])) |
|
| 71 | 71 | { |
| 72 | 72 | $value = '<img src="/images/no_image.png" width="120" height="120">'; |
| 73 | 73 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $row[] = $value; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $btEdit = '<a class="btn btn-info" href="/produto/editar_cadastro/' . $produto['Produto']['id'] . '"><i class="fa fa-pencil"></i></a>'; |
|
| 79 | + $btEdit = '<a class="btn btn-info" href="/produto/editar_cadastro/'.$produto['Produto']['id'].'"><i class="fa fa-pencil"></i></a>'; |
|
| 80 | 80 | |
| 81 | 81 | $row[] = $btEdit; |
| 82 | 82 | |
@@ -87,15 +87,15 @@ discard block |
||
| 87 | 87 | exit; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function listar_cadastros_estoque_minimo(){ |
|
| 90 | + public function listar_cadastros_estoque_minimo() { |
|
| 91 | 91 | $this->layout = 'wadmin'; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function listar_cadastros_estoque_minimo_ajax(){ |
|
| 94 | + public function listar_cadastros_estoque_minimo_ajax() { |
|
| 95 | 95 | |
| 96 | 96 | $this->layout = 'ajax'; |
| 97 | 97 | |
| 98 | - $aColumns = array( 'sku', 'imagem', 'nome', 'preco', 'estoque' ); |
|
| 98 | + $aColumns = array('sku', 'imagem', 'nome', 'preco', 'estoque'); |
|
| 99 | 99 | |
| 100 | 100 | $this->loadModel('Usuario'); |
| 101 | 101 | |
@@ -117,30 +117,30 @@ discard block |
||
| 117 | 117 | ) |
| 118 | 118 | ); |
| 119 | 119 | |
| 120 | - $allProdutos = $this->Produto->query("select * from produtos where estoque < quantidade_minima and id_usuario = " . $this->instancia . " and ativo = 1"); |
|
| 120 | + $allProdutos = $this->Produto->query("select * from produtos where estoque < quantidade_minima and id_usuario = ".$this->instancia." and ativo = 1"); |
|
| 121 | 121 | |
| 122 | 122 | |
| 123 | - $sql = "select * from produtos as Produto where estoque < quantidade_minima and id_usuario = " . $this->instancia . " and ativo = 1"; |
|
| 123 | + $sql = "select * from produtos as Produto where estoque < quantidade_minima and id_usuario = ".$this->instancia." and ativo = 1"; |
|
| 124 | 124 | |
| 125 | - if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' ) |
|
| 125 | + if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') |
|
| 126 | 126 | { |
| 127 | - $sql .= ' LIMIT ' . $_GET['iDisplayLength'] . ' OFFSET ' . $_GET['iDisplayStart']; |
|
| 127 | + $sql .= ' LIMIT '.$_GET['iDisplayLength'].' OFFSET '.$_GET['iDisplayStart']; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( isset( $_GET['iSortCol_0'] ) ) |
|
| 130 | + if (isset($_GET['iSortCol_0'])) |
|
| 131 | 131 | { |
| 132 | - for ( $i=0 ; $i < intval( $_GET['iSortingCols'] ) ; $i++ ) |
|
| 132 | + for ($i = 0; $i < intval($_GET['iSortingCols']); $i++) |
|
| 133 | 133 | { |
| 134 | - if ( $_GET[ 'bSortable_' . intval($_GET['iSortCol_' . $i]) ] == "true" ) |
|
| 134 | + if ($_GET['bSortable_'.intval($_GET['iSortCol_'.$i])] == "true") |
|
| 135 | 135 | { |
| 136 | - $conditions['order'] = array('Produto.' . $aColumns[intval($_GET['iSortCol_' . $i])] => $_GET['sSortDir_'.$i]); |
|
| 136 | + $conditions['order'] = array('Produto.'.$aColumns[intval($_GET['iSortCol_'.$i])] => $_GET['sSortDir_'.$i]); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ( isset( $_GET['sSearch'] ) && !empty( $_GET['sSearch'] ) ) |
|
| 141 | + if (isset($_GET['sSearch']) && ! empty($_GET['sSearch'])) |
|
| 142 | 142 | { |
| 143 | - $conditions['conditions']['Produto.nome LIKE '] = '%' . $_GET['sSearch'] . '%'; |
|
| 143 | + $conditions['conditions']['Produto.nome LIKE '] = '%'.$_GET['sSearch'].'%'; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $produtos = $this->Produto->query($sql); |
@@ -152,19 +152,19 @@ discard block |
||
| 152 | 152 | "aaData" => array() |
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | - foreach ( $produtos as $i => $produto ) |
|
| 155 | + foreach ($produtos as $i => $produto) |
|
| 156 | 156 | { |
| 157 | 157 | $row = array(); |
| 158 | 158 | |
| 159 | - for ( $i=0 ; $i < count($aColumns) ; $i++ ) |
|
| 159 | + for ($i = 0; $i < count($aColumns); $i++) |
|
| 160 | 160 | { |
| 161 | 161 | $value = $produto['Produto'][$aColumns[$i]]; |
| 162 | 162 | |
| 163 | 163 | if ($aColumns[$i] == "imagem") |
| 164 | 164 | { |
| 165 | - $value = '<img src="/uploads/produto/imagens/' . $produto['Produto'][$aColumns[$i]] . '" width="120" height="120">'; |
|
| 165 | + $value = '<img src="/uploads/produto/imagens/'.$produto['Produto'][$aColumns[$i]].'" width="120" height="120">'; |
|
| 166 | 166 | |
| 167 | - if (!isset($produto['Produto'][$aColumns[$i]]) || empty($produto['Produto'][$aColumns[$i]])) |
|
| 167 | + if ( ! isset($produto['Produto'][$aColumns[$i]]) || empty($produto['Produto'][$aColumns[$i]])) |
|
| 168 | 168 | { |
| 169 | 169 | $value = '<img src="/images/no_image.png" width="120" height="120">'; |
| 170 | 170 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | ) |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - $produtos = $this->Produto->query("select * from produtos as Produto where estoque < quantidade_minima and id_usuario = " . $this->instancia . " and ativo = 1"); |
|
| 207 | + $produtos = $this->Produto->query("select * from produtos as Produto where estoque < quantidade_minima and id_usuario = ".$this->instancia." and ativo = 1"); |
|
| 208 | 208 | |
| 209 | 209 | $html = $this->getProdutosEstoqueMinimoComoHtml($produtos); |
| 210 | 210 | |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | foreach ($produtos as $i => $produto) { |
| 261 | 261 | $html .= ' <tr>'; |
| 262 | - $html .= ' <td>' . $produto['Produto']['nome'] . '</td>'; |
|
| 263 | - $html .= ' <td>' . $produto['Produto']['estoque'] . '</td>'; |
|
| 264 | - $html .= ' <td>R$ ' . number_format($produto['Produto']['custo'], 2, ',', '.') . '</td>'; |
|
| 262 | + $html .= ' <td>'.$produto['Produto']['nome'].'</td>'; |
|
| 263 | + $html .= ' <td>'.$produto['Produto']['estoque'].'</td>'; |
|
| 264 | + $html .= ' <td>R$ '.number_format($produto['Produto']['custo'], 2, ',', '.').'</td>'; |
|
| 265 | 265 | $html .= ' </tr>'; |
| 266 | 266 | } |
| 267 | 267 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $html .= ''; |
| 274 | 274 | $html .= '</body>'; |
| 275 | 275 | $html .= '</html>'; |
| 276 | - echo $html;exit; |
|
| 276 | + echo $html; exit; |
|
| 277 | 277 | return $html; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -293,15 +293,15 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | public function s_adicionar_cadastro() { |
| 296 | - $dados = $this->request->data('dados'); |
|
| 296 | + $dados = $this->request->data('dados'); |
|
| 297 | 297 | |
| 298 | 298 | $variacoes = $this->request->data('variacao'); |
| 299 | 299 | |
| 300 | - $image = $_FILES['imagem']; |
|
| 300 | + $image = $_FILES['imagem']; |
|
| 301 | 301 | |
| 302 | 302 | $retorno = $this->uploadImage($image); |
| 303 | 303 | |
| 304 | - if (!$retorno['status']) |
|
| 304 | + if ( ! $retorno['status']) |
|
| 305 | 305 | $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
| 306 | 306 | |
| 307 | 307 | $dados['imagem'] = $retorno['nome']; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $dados['ativo'] = 1; |
| 310 | 310 | $dados['id_alias'] = $this->id_alias(); |
| 311 | 311 | |
| 312 | - if($this->Produto->save($dados)) { |
|
| 312 | + if ($this->Produto->save($dados)) { |
|
| 313 | 313 | $produto_id = $this->Produto->getLastInsertId(); |
| 314 | 314 | |
| 315 | 315 | require 'VariacaoController.php'; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | $this->loadModel('Variacao'); |
| 335 | 335 | |
| 336 | - $query = array ( |
|
| 336 | + $query = array( |
|
| 337 | 337 | 'joins' => array( |
| 338 | 338 | array( |
| 339 | 339 | 'table' => 'produtos', |
@@ -376,12 +376,12 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | $variacoes = $this->request->data('variacao'); |
| 378 | 378 | |
| 379 | - $image = $_FILES['imagem']; |
|
| 379 | + $image = $_FILES['imagem']; |
|
| 380 | 380 | |
| 381 | - if (!empty($image['name'])) { |
|
| 381 | + if ( ! empty($image['name'])) { |
|
| 382 | 382 | $retorno = $this->uploadImage($image); |
| 383 | 383 | |
| 384 | - if (!$retorno['status']) |
|
| 384 | + if ( ! $retorno['status']) |
|
| 385 | 385 | $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
| 386 | 386 | |
| 387 | 387 | $dados['imagem'] = $retorno['nome']; |
@@ -401,10 +401,10 @@ discard block |
||
| 401 | 401 | $objVariacaoController->desativar_variacoes($id); |
| 402 | 402 | $objVariacaoController->s_adicionar_variacao($variacoes, $id, $this->instancia); |
| 403 | 403 | |
| 404 | - $this->Session->setFlash('Produto editado com sucesso!','default','good'); |
|
| 404 | + $this->Session->setFlash('Produto editado com sucesso!', 'default', 'good'); |
|
| 405 | 405 | return $this->redirect('/produto/listar_cadastros'); |
| 406 | 406 | } else { |
| 407 | - $this->Session->setFlash('Ocorreu um erro ao editar o produto!','default','good'); |
|
| 407 | + $this->Session->setFlash('Ocorreu um erro ao editar o produto!', 'default', 'good'); |
|
| 408 | 408 | return $this->redirect('/produto/listar_cadastros'); |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | ) |
| 447 | 447 | ); |
| 448 | 448 | |
| 449 | - if (!$this->validar_estoque($retorno)) { |
|
| 449 | + if ( ! $this->validar_estoque($retorno)) { |
|
| 450 | 450 | return false; |
| 451 | 451 | } |
| 452 | 452 | |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | if ($user_active[0]['Usuario']['sale_without_stock']) |
| 477 | 477 | return true; |
| 478 | 478 | |
| 479 | - if (empty($produto) && !isset($produto)) { |
|
| 479 | + if (empty($produto) && ! isset($produto)) { |
|
| 480 | 480 | return false; |
| 481 | 481 | } |
| 482 | 482 | |
@@ -488,11 +488,11 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | public function calcular_preco_produto_venda($preco, $qnt) { |
| 491 | - if (empty($preco) || !isset($preco)) { |
|
| 491 | + if (empty($preco) || ! isset($preco)) { |
|
| 492 | 492 | return false; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if (!is_numeric($qnt)) { |
|
| 495 | + if ( ! is_numeric($qnt)) { |
|
| 496 | 496 | return false; |
| 497 | 497 | } |
| 498 | 498 | |
@@ -503,12 +503,12 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | public function uploadImage(&$image) { |
| 505 | 505 | $type = substr($image['name'], -4); |
| 506 | - $nameImage = uniqid() . md5($image['name']) . $type; |
|
| 507 | - $dir = APP . 'webroot/uploads/produto/imagens/'; |
|
| 506 | + $nameImage = uniqid().md5($image['name']).$type; |
|
| 507 | + $dir = APP.'webroot/uploads/produto/imagens/'; |
|
| 508 | 508 | |
| 509 | - $returnUpload = move_uploaded_file($image['tmp_name'], $dir . $nameImage); |
|
| 509 | + $returnUpload = move_uploaded_file($image['tmp_name'], $dir.$nameImage); |
|
| 510 | 510 | |
| 511 | - if (!$returnUpload) |
|
| 511 | + if ( ! $returnUpload) |
|
| 512 | 512 | return array('nome' => null, 'status' => false); |
| 513 | 513 | |
| 514 | 514 | return array('nome' => $nameImage, 'status' => true); |
@@ -534,8 +534,8 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | public function exportar_excel_exemplo() { |
| 537 | - include(APP . 'Vendor/PHPExcel/PHPExcel.php'); |
|
| 538 | - include(APP . 'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 537 | + include(APP.'Vendor/PHPExcel/PHPExcel.php'); |
|
| 538 | + include(APP.'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 539 | 539 | |
| 540 | 540 | $objPHPExcel = new PHPExcel(); |
| 541 | 541 | // Definimos o estilo da fonte |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | public function importar_produtos_planilha() { |
| 575 | - if (!isset($_FILES['arquivo']['tmp_name']) && empty($_FILES['arquivo']['tmp_name'])) |
|
| 575 | + if ( ! isset($_FILES['arquivo']['tmp_name']) && empty($_FILES['arquivo']['tmp_name'])) |
|
| 576 | 576 | { |
| 577 | 577 | $this->Session->setFlash("Erro ao subir a planilha, tente novamente."); |
| 578 | 578 | $this->redirect("/produto/listar_cadastros"); |
@@ -580,13 +580,13 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | $typesPermissions = ['application/vnd.ms-excel']; |
| 582 | 582 | |
| 583 | - if (!in_array($_FILES['arquivo']['type'], $typesPermissions)) |
|
| 583 | + if ( ! in_array($_FILES['arquivo']['type'], $typesPermissions)) |
|
| 584 | 584 | { |
| 585 | 585 | $this->Session->setFlash("O arquivo deve ser no formato .xls."); |
| 586 | 586 | $this->redirect("/produto/listar_cadastros"); |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - $caminho = APP . 'webroot/uploads/produto/planilhas/' . uniqid() . '.xls'; |
|
| 589 | + $caminho = APP.'webroot/uploads/produto/planilhas/'.uniqid().'.xls'; |
|
| 590 | 590 | |
| 591 | 591 | $inputFileName = $_FILES['arquivo']['tmp_name']; |
| 592 | 592 | |
@@ -627,17 +627,17 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | public function processar_planilhas($inputFileName, $usuarioId, $planilhaId) { |
| 630 | - include(APP . 'Vendor/PHPExcel/PHPExcel.php'); |
|
| 631 | - include(APP . 'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 630 | + include(APP.'Vendor/PHPExcel/PHPExcel.php'); |
|
| 631 | + include(APP.'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 632 | 632 | |
| 633 | 633 | $objPHPExcel = new PHPExcel(); |
| 634 | 634 | |
| 635 | 635 | try { |
| 636 | - $inputFileType = PHPExcel_IOFactory::identify($inputFileName); |
|
| 637 | - $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
|
| 638 | - $objPHPExcel = $objReader->load($inputFileName); |
|
| 639 | - } catch(Exception $e) { |
|
| 640 | - die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); |
|
| 636 | + $inputFileType = PHPExcel_IOFactory::identify($inputFileName); |
|
| 637 | + $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
|
| 638 | + $objPHPExcel = $objReader->load($inputFileName); |
|
| 639 | + } catch (Exception $e) { |
|
| 640 | + die('Error loading file "'.pathinfo($inputFileName, PATHINFO_BASENAME).'": '.$e->getMessage()); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | $dados = []; |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | |
| 685 | 685 | $errors = $this->processar_lista_produtos($dados); |
| 686 | 686 | |
| 687 | - if (isset($errors) && !empty($errors)) |
|
| 687 | + if (isset($errors) && ! empty($errors)) |
|
| 688 | 688 | { |
| 689 | 689 | $this->QueueProduct->planilhaProcessedIncomplete($planilhaId); |
| 690 | 690 | } |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | ) |
| 711 | 711 | ); |
| 712 | 712 | |
| 713 | - if (isset($existProduto) && !empty($existProduto)) |
|
| 713 | + if (isset($existProduto) && ! empty($existProduto)) |
|
| 714 | 714 | { |
| 715 | 715 | $this->Produto->id = $existProduto[0]['Produto']['id']; |
| 716 | 716 | $this->Produto->save($dado); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | |
| 720 | 720 | $this->Produto->create(); |
| 721 | 721 | |
| 722 | - if (!$this->Produto->save($dado)) |
|
| 722 | + if ( ! $this->Produto->save($dado)) |
|
| 723 | 723 | { |
| 724 | 724 | $errors[] = $dado; |
| 725 | 725 | } |