Add hub rejection log file #800
This commit is contained in:
parent
57b4227da9
commit
8992fdeec0
3 changed files with 20 additions and 4 deletions
|
|
@ -65,7 +65,7 @@ class BaseHubFilter
|
|||
$this->hub_filter_logger->logFilteredHub($hub, $this->getID(), $this->getJOID(), $this->getCustomerID());
|
||||
}
|
||||
|
||||
protected function createRejectionEntry($jo_id, $hub, $remarks = ""): JORejection
|
||||
protected function createRejectionEntry($jo_id, $hub, $reason, $remarks = ""): JORejection
|
||||
{
|
||||
$jo = $this->em->getRepository(JobOrder::class)->find($jo_id);
|
||||
|
||||
|
|
@ -73,12 +73,27 @@ class BaseHubFilter
|
|||
$robj->setDateCreate(new DateTime())
|
||||
->setHub($hub)
|
||||
->setJobOrder($jo)
|
||||
->setReason(JORejectionReason::NO_STOCK_SALES)
|
||||
->setReason($reason)
|
||||
->setRemarks(implode(" ", ["Automatically filtered by hub selector.", $remarks]));
|
||||
|
||||
$this->em->persist($robj);
|
||||
$this->em->flush();
|
||||
|
||||
// log to file
|
||||
$filename = '/../../var/log/hub_rejection.log';
|
||||
$date = date("Y-m-d H:i:s");
|
||||
|
||||
// build log entry
|
||||
$entry = implode("", [
|
||||
"[JO: " . $jo_id . "]",
|
||||
"[HUB:" . $hub->getID() . "]",
|
||||
"[" . $date . "]",
|
||||
$reason,
|
||||
$remarks ? " - " . $remarks : "",
|
||||
]);
|
||||
|
||||
@file_put_contents(__DIR__ . $filename, $entry, FILE_APPEND);
|
||||
|
||||
return $robj;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ class InventoryHubFilter extends BaseHubFilter implements HubFilterInterface
|
|||
$robj = $this->createRejectionEntry(
|
||||
$jo_id,
|
||||
$hub,
|
||||
"SKU(s): " . $battery_string
|
||||
JORejectionReason::NO_STOCK_SALES,
|
||||
"SKU(s): " . $battery_string,
|
||||
);
|
||||
|
||||
// build SMS message
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class RiderAvailabilityHubFilter extends BaseHubFilter implements HubFilterInter
|
|||
// if we have a JO, create rejection record and notify
|
||||
if (!empty($jo_id)) {
|
||||
// create rejection report entry
|
||||
$robj = $this->createRejectionEntry($jo_id, $hub);
|
||||
$robj = $this->createRejectionEntry($jo_id, $hub, JORejectionReason::NO_RIDER_AVAILABLE);
|
||||
|
||||
// build SMS message
|
||||
$this->sendSMSMessage(
|
||||
|
|
|
|||
Loading…
Reference in a new issue