fix ContactID null on contact_show using data from url
This commit is contained in:
parent
6b94cb3293
commit
11fd53ada6
@ -26,40 +26,41 @@ class ContactModel extends Model {
|
|||||||
public function getContactWithDetail($ContactID) {
|
public function getContactWithDetail($ContactID) {
|
||||||
$rows = $this->where('contact.ContactID', $ContactID)->join('contactdetail cd', 'contact.ContactID=cd.ContactID','left')->get()->getResultArray();
|
$rows = $this->where('contact.ContactID', $ContactID)->join('contactdetail cd', 'contact.ContactID=cd.ContactID','left')->get()->getResultArray();
|
||||||
$contact = [];
|
$contact = [];
|
||||||
if(!empty($rows)) {
|
|
||||||
$contact = [
|
foreach ($rows as $row) {
|
||||||
'ContactID' => $rows[0]['ContactID'] ?? null,
|
if(empty($contact['NameFirst'])) {
|
||||||
'NameFirst' => $rows[0]['NameFirst'] ?? null,
|
$contact = [
|
||||||
'NameLast' => $rows[0]['NameLast'] ?? null,
|
'ContactID' => $ContactID,
|
||||||
'Title' => $rows[0]['Title'] ?? null,
|
'NameFirst' => $row['NameFirst'] ?? null,
|
||||||
'Initial' => $rows[0]['Initial'] ?? null,
|
'NameLast' => $row['NameLast'] ?? null,
|
||||||
'Birthdate' => $rows[0]['Birthdate'] ?? null,
|
'Title' => $row['Title'] ?? null,
|
||||||
'EmailAddress1' => $rows[0]['EmailAddress1'] ?? null,
|
'Initial' => $row['Initial'] ?? null,
|
||||||
'EmailAddress2' => $rows[0]['EmailAddress2'] ?? null,
|
'Birthdate' => $row['Birthdate'] ?? null,
|
||||||
'Phone' => $rows[0]['Phone'] ?? null,
|
'EmailAddress1' => $row['EmailAddress1'] ?? null,
|
||||||
'MobilePhone1' => $rows[0]['MobilePhone1'] ?? null,
|
'EmailAddress2' => $row['EmailAddress2'] ?? null,
|
||||||
'MobilePhone2' => $rows[0]['MobilePhone2'] ?? null,
|
'Phone' => $row['Phone'] ?? null,
|
||||||
'Specialty' => $rows[0]['Specialty'] ?? null,
|
'MobilePhone1' => $row['MobilePhone1'] ?? null,
|
||||||
'SubSpecialty' => $rows[0]['SubSpecialty'] ?? null,
|
'MobilePhone2' => $row['MobilePhone2'] ?? null,
|
||||||
'Details' => []
|
'Specialty' => $row['Specialty'] ?? null,
|
||||||
];
|
'SubSpecialty' => $row['SubSpecialty'] ?? null,
|
||||||
|
'Details' => []
|
||||||
foreach ($rows as $row) {
|
];
|
||||||
if (!empty($row['ContactDetID'])) {
|
}
|
||||||
$contact['Details'][] = [
|
if (!empty($row['ContactDetID'])) {
|
||||||
'SiteID' => $row['SiteID'] ?? null,
|
$contact['Details'][] = [
|
||||||
'ContactDetID' => $row['ContactDetID'],
|
'SiteID' => $row['SiteID'] ?? null,
|
||||||
'ContactCode' => $row['ContactCode'] ?? null,
|
'ContactDetID' => $row['ContactDetID'],
|
||||||
'ContactEmail' => $row['DetailPhone'] ?? null,
|
'ContactCode' => $row['ContactCode'] ?? null,
|
||||||
'OccupationID' => $row['OccupationID'] ?? null,
|
'ContactEmail' => $row['DetailPhone'] ?? null,
|
||||||
'JobTitle' => $row['JobTitle'] ?? null,
|
'OccupationID' => $row['OccupationID'] ?? null,
|
||||||
'Department' => $row['Department'] ?? null,
|
'JobTitle' => $row['JobTitle'] ?? null,
|
||||||
'ContactStartDate' => $row['ContactStartDate'] ?? null,
|
'Department' => $row['Department'] ?? null,
|
||||||
'ContactEndDate' => $row['ContactEndDate'] ?? null
|
'ContactStartDate' => $row['ContactStartDate'] ?? null,
|
||||||
];
|
'ContactEndDate' => $row['ContactEndDate'] ?? null
|
||||||
}
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $contact;
|
return $contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user