Skip to content

Commit

Permalink
Merge pull request #629 from RamonSilva20/hotfix/os-warranty-expirati…
Browse files Browse the repository at this point in the history
…on-date

Hotfix/os warranty expiration date
  • Loading branch information
RamonSilva20 authored Mar 27, 2020
2 parents 4bb5f31 + af4a25c commit cdbc5ff
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 204 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Todas as alterações serão documentadas neste arquivo
Formato baseado em [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
e [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.1.2] - 2020-03-26

### Fixed

- Corrigido problema em cálculo exibição de data de vencimento da garantia de OS finalizada. [@Pr3d4dor](https://github.com/Pr3d4dor)
- Atualizado bibliotecas do composer. [@Pr3d4dor](https://github.com/Pr3d4dor)

## [4.1.1] - 2020-03-22

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

![MapOS](https://raw.githubusercontent.com/RamonSilva20/mapos/master/assets/img/logo.png)

![version](https://img.shields.io/badge/version-4.1.1-blue.svg?longCache=true&style=flat-square)
![version](https://img.shields.io/badge/version-4.1.2-blue.svg?longCache=true&style=flat-square)
![license](https://img.shields.io/badge/license-MIT-green.svg?longCache=true&style=flat-square)
![theme](https://img.shields.io/badge/theme-Matrix--Admin-lightgrey.svg?longCache=true&style=flat-square)
![issues](https://img.shields.io/github/issues/RamonSilva20/mapos.svg?longCache=true&style=flat-square)
Expand Down
2 changes: 1 addition & 1 deletion application/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
| $autoload['helper'] = array('url', 'file');
*/

$autoload['helper'] = array('url','audit');
$autoload['helper'] = array('url', 'audit', 'date');


/*
Expand Down
2 changes: 1 addition & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* App current version
*/
$config['app_version'] = '4.1.1';
$config['app_version'] = '4.1.2';

/**
* Nome do sistema
Expand Down
17 changes: 17 additions & 0 deletions application/helpers/date_helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

function dateInterval($startDate, $finalDate)
{
$data = date('d/m/Y', strtotime($startDate));

// Criar o objeto representando a data
$obj_data = DateTime::createFromFormat('d/m/Y', $data);
$obj_data->setTime(0, 0, 0);

// Realizar a soma de dias
$intervalo = new DateInterval('P' . intval($finalDate) . 'D');
$obj_data->add($intervalo);

// Formatar a data obtida
return $obj_data->format('d/m/Y');
}
17 changes: 2 additions & 15 deletions application/views/os/imprimirOs.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,7 @@
<?php if ($result->status == 'Finalizado') { ?>
VENC. DA GARANTIA:
</b>
<?php
$data = date('d/m/Y', strtotime($result->dataFinal));

// Criar o objeto representando a data
$obj_data = DateTime::createFromFormat('d/m/Y', $data);
$obj_data->setTime(0, 0, 0);

// Realizar a soma de dias
$intervalo = new DateInterval('P' . $result->garantia . 'D');
$obj_data->add($intervalo);

// Formatar a data obtida
echo $obj_data->format('d/m/Y'); ?><?php } ?>

<?php echo dateInterval($result->dataFinal, $result->garantia); ?><?php } ?>
</tr>
<?php } ?>

Expand Down Expand Up @@ -273,4 +260,4 @@

</body>

</html>
</html>
19 changes: 5 additions & 14 deletions application/views/os/os.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
</tr>
</thead>
<tbody>
<?php
<?php

if(!$results){
echo '<tr>
<td colspan="9">Nenhuma OS Cadastrada</td>
Expand Down Expand Up @@ -106,19 +106,10 @@
}
$vencGarantia = '';

if($r->garantia && is_numeric($r->garantia)){
// Criar o objeto representando a data
$obj_data = DateTime::createFromFormat('d/m/Y', $dataFinal);
$obj_data->setTime(0, 0, 0);

// Realizar a soma de dias
$intervalo = new DateInterval('P' . $r->garantia . 'D');
$obj_data->add($intervalo);

// Formatar a data obtida
$vencGarantia = $obj_data->format('d/m/Y');
if ($r->garantia && is_numeric($r->garantia)) {
$vencGarantia = dateInterval($dataFinal, $r->garantia);
}

echo '<tr>';
echo '<td>' . $r->idOs . '</td>';
echo '<td>' . $r->nomeCliente . '</td>';
Expand Down
18 changes: 3 additions & 15 deletions application/views/os/visualizarOs.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,7 @@
<?php if ($result->status == 'Finalizado') { ?>
VENC. DA GARANTIA:
</b>
<?php
$data = date('d/m/Y', strtotime($result->dataFinal));

// Criar o objeto representando a data
$obj_data = DateTime::createFromFormat('d/m/Y', $data);
$obj_data->setTime(0, 0, 0);

// Realizar a soma de dias
$intervalo = new DateInterval('P' . $result->garantia . 'D');
$obj_data->add($intervalo);

// Formatar a data obtida
echo $obj_data->format('d/m/Y'); ?><?php } ?>
<?php echo dateInterval($result->dataFinal, $result->garantia); ?><?php } ?>
</td>
<?php if ($result->refGarantia != '') { ?>
<td>
Expand Down Expand Up @@ -257,11 +245,11 @@
echo '<form action="'.site_url().'" method="POST">
<script src="https://www.mercadopago.com.br/integrations/v1/web-payment-checkout.js" data-preference-id="'.$preference->id.'" data-button-label="Gerar Pagamento">
</script>
</form>';
</form>';
}
}
} ?>

</div>
</div>
</div>
</div>
Loading

0 comments on commit cdbc5ff

Please sign in to comment.