web/website/integrations/osticket/bank-credit-review.php

15 lines
1.3 KiB
PHP

<?php
// Render only within the native staff ticket view, after its access check.
if (!defined('OSTSTAFFINC') || !$thisstaff || !$ticket || !$ticket->checkStaffPerm($thisstaff)) return;
$result = db_query('SELECT application_id FROM dune_bank_credit_tickets WHERE ticket_id='.(int)$ticket->getId().' LIMIT 1');
$binding = $result ? db_fetch_array($result) : null;
$application = $binding['application_id'] ?? '';
if (!preg_match('/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i', $application)) return;
$base = 'https://cp.dunerealms.com/?creditApplication='.rawurlencode($application);
?>
<span class="dune-credit-review" style="display:block;margin:16px 0;color:#eee2bd">
<strong>Imperial Postbank · Credit decision</strong><br>
<a class="button" target="_top" href="<?=htmlspecialchars($base.'&creditDecision=approve#bank/loan-administration', ENT_QUOTES, 'UTF-8')?>">Approve application…</a>
<a class="button" target="_top" href="<?=htmlspecialchars($base.'&creditDecision=decline#bank/loan-administration', ENT_QUOTES, 'UTF-8')?>">Reject application…</a>
<small style="display:block;margin-top:10px">Confirm your decision in CP. A different bank manager must review applications you submitted or control. The linked ticket updates after a recorded decision.</small>
</span>