fix(penilai): perbaikkan luas tanah, bangunan, dan print out sederhana, dan rap
This commit is contained in:
@@ -485,7 +485,7 @@ function calculateSLA($permohonan, $type)
|
||||
* @param int $jenisLegalitas
|
||||
* @return int
|
||||
*/
|
||||
function calculateTotalLuas($detailsArray, $key, $jenisLegalitas)
|
||||
function calculateTotalLuas($detailsArray, $key, $jenisLegalitas, $defaultJenisLegalitas)
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
@@ -503,7 +503,57 @@ function calculateTotalLuas($detailsArray, $key, $jenisLegalitas)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Jika total masih 0, gunakan jenis jaminan ppjb
|
||||
if ($total === 0) {
|
||||
foreach ($detailsArray as $item) {
|
||||
if (isset($item->jenis_legalitas_jaminan_id) && $item->jenis_legalitas_jaminan_id === $defaultJenisLegalitas) {
|
||||
$details = json_decode($item->details, true);
|
||||
|
||||
if (is_array($details)) {
|
||||
foreach ($details as $detail) {
|
||||
if (isset($detail[$key]) && $detail[$key] !== null) {
|
||||
$total += (int) $detail[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// jika total masih kosong juga maka gunakan ppb
|
||||
if ($total === 0 && $fallbackJenisLegalitas !== null) {
|
||||
foreach ($detailsArray as $item) {
|
||||
if (isset($item->jenis_legalitas_jaminan_id) && $item->jenis_legalitas_jaminan_id === $fallbackJenisLegalitas) {
|
||||
$details = json_decode($item->details, true);
|
||||
|
||||
if (is_array($details)) {
|
||||
foreach ($details as $detail) {
|
||||
if (isset($detail[$key]) && $detail[$key] !== null) {
|
||||
$total += (int) $detail[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $total;
|
||||
return $total > 0 ? $total : 0;
|
||||
}
|
||||
|
||||
|
||||
function ubahNomorHp($nomorHp) {
|
||||
|
||||
$nomorHp = preg_replace('/\D/', '', $nomorHp);
|
||||
if (strpos($nomorHp, '62') === 0) {
|
||||
$nomorBaru = substr($nomorHp, 0, 5) . "xxxxx";
|
||||
return '+' . $nomorBaru;
|
||||
} elseif (strpos($nomorHp, '0') === 0) {
|
||||
|
||||
$nomorBaru = substr($nomorHp, 0, 5) . "xxxxxx";
|
||||
return $nomorBaru;
|
||||
} else {
|
||||
return "Nomor HP tidak valid";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user