fix loctype to use vid

This commit is contained in:
mahdahar 2025-09-22 15:40:45 +07:00
parent 4db1a61e04
commit 07eb2a04d8

View File

@ -20,7 +20,7 @@ class Location extends Controller {
$rows = $this->db->table('location l')
->select("l.LocationID, LocCode, Parent, LocFull, LocType, v.VDesc ")
->join("locationaddress la", "l.LocationID=la.LocationID", 'left')
->join("valueset v", "v.VSetID=12 and v.VValue=l.LocType", 'left')
->join("valueset v", "v.VSetID=12 and v.VID=l.loctype", 'left')
->get()->getResultArray();
if (empty($rows)) {
@ -42,7 +42,7 @@ class Location extends Controller {
$rows = $this->db->table('location l')
->select("l.*, la.*, v.*")
->join("locationaddress la", "l.LocationID=la.LocationID", "left")
->join("valueset v", "v.VSetID=12 and v.VValue=l.loctype", "left")
->join("valueset v", "v.VSetID=12 and v.VID=l.loctype", "left")
->where('l.LocationID', (int) $LocationID)
->get()->getResultArray();
@ -192,6 +192,7 @@ class Location extends Controller {
"LocCode" => $input['LocCode'] ?? null,
"Parent" => $input['Parent'] ?? null,
"LocFull" => $input['LocFull'] ?? null,
"LocType" => $input['LocType'] ?? null,
"Description" => $input['Description'] ?? null,
];