Skip to content

Commit

Permalink
Merge pull request #346 from secultce/develop
Browse files Browse the repository at this point in the history
Merge develop to homolog
  • Loading branch information
Junior-Shyko authored Dec 18, 2024
2 parents 16cc05d + 6d903ea commit 8d9cda1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,23 @@ public static function getFinancialReportsAccountability($registration_id)

return $result;
}

/**
* Verifica se quem está logado tem controle na opp. e se é o fiscal de uma diligência
* @param $registration
* @return DiligenceEntity|null
*/
public static function getIsAuditor($registration)
{
$app = App::i();
$auditorDiligence = $app->repo(DiligenceEntity::class)->findOneBy(['registration' => $registration], ['id' => 'desc']);

$isAdmin = $auditorDiligence->registration->opportunity->canUser("@control", $app->user);
if($auditorDiligence->openAgent->userId !== $app->user->id && !$isAdmin) {
$app->setCookie("denied-auditor", 'Esse monitoramento já está sendo acompanhado por outro Fiscal', time()+3600);;
$app->redirect($app->createUrl('oportunidade', $auditorDiligence->registration->opportunity->id));
}
return $auditorDiligence;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

use MapasCulturais\i;
use Diligence\Entities\Diligence as EntityDiligence;
use Diligence\Entities\AnswerDiligence;
Expand All @@ -9,6 +8,9 @@

$this->applyTemplateHook("body-diligence-multi", "before");
$this->applyTemplateHook("body-diligence-multi-div", "begin");

DiligenceRepo::getIsAuditor($entity->id);

?>
<div>
<hr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<?php $this->applyTemplateHook('opportunity-evaluations--committee--table','before'); ?>
<?php
use MapasCulturais\App;

$app = App::i();

$this->applyTemplateHook('opportunity-evaluations--committee--table','before'); ?>
<header id="header-inscritos" class="clearfix">
<?php $this->applyTemplateHook('opportunity-evaluations--committee--table','begin'); ?>

<h3><?php \MapasCulturais\i::_e("Avaliações");?></h3>
</header>

<?php
if(!empty($app->getCookie("denied-auditor"))) {
echo '<div class="alert danger">' . $app->getCookie("denied-auditor") . ' </div>';
$app->deleteCookie("denied-auditor");
}

if($entity->isUserEvaluationsSent()): ?>
<div id='status-info' class="alert success">
Expand Down

0 comments on commit 8d9cda1

Please sign in to comment.