Nightly Service Location Update
Frank Zerillo (Deactivated) Brian Dixon
Nightly Service Location Update
/**
* Event: Custom PHP Event
* Frequency: Daily
* Time: 12:00am
* Listener Class: Core_Model_Event
* Listener Method: eventCustom
*/
$services = $this->query(
"SELECT S.RECID AS SERVICE_RECID, L.RECID AS LOCATION_RECID
FROM PCR360_PROD.SERVICES S
JOIN PCR360_PROD.PATHS P ON P.SERVICES_RECID = S.RECID
JOIN PCR360_PROD.PATH_LEGS PL ON PL.PATHS_RECID = P.RECID
JOIN PCR360_PROD.EQUIPMENT E ON PL.FROM_EQUIPMENT_RECID = E.RECID
JOIN PCR360_PROD.LOCATIONS L ON E.LOCATIONS_RECID = L.RECID
JOIN PCR360_PROD.EQP_CATALOG EC ON E.EQP_CATALOG_RECID = EC.RECID
WHERE S.MULTIPLE_LOCATIONS = 0
AND EC.PART_NUMBER = 'Jacks'
AND S.LOCATIONS_RECID != E.LOCATIONS_RECID"
);
PCR_Event::attachDb("services-bulk-update", [
"Application_Model_Service_Service" => "eventBulkUpdate"
]);
foreach ($services as $service) {
PCR_Event::trigger("services-bulk-update", [
"selectedServiceRecids" => [$service["SERVICE_RECID"]],
"location_enabled" => "1",
"location" => $service["LOCATION_RECID"],
"service_type_enabled" => "0",
"status_enabled" => "0",
"service_host_enabled" => "0",
"sla_enabled" => "0",
"contact_owner_enabled" => "0",
"dept_hier_owner_enabled" => "0",
"gla_enabled" => "0",
"pools_enabled" => "0",
"billable_enabled" => "0",
"directory_enabled" => "0",
"essential_enabled" => "0",
"report_911_enabled" => "0",
"isLocationRequired" => true,
"isServiceHostRequired" => false,
"selectedServiceTypeListRecid" => null,
"selectedServiceFilters" => [],
"billable" => "0",
"essential" => "0",
"directory" => "0",
"status" => "1",
"report_911" => "0",
"users_recid" => "2",
"contact" => "2",
"comment" => "nightly jack/service location update",
]);
}
{"serverDuration": 14, "requestCorrelationId": "d8551f0ad54743349dcb2512550a5b83"}