Minor fixes and cleanup

This commit is contained in:
Dillon
2023-03-25 02:07:44 +08:00
parent 58bdfaaee7
commit b7487394d2
5 changed files with 6 additions and 34 deletions
@@ -11,7 +11,6 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class UpdatePerfexCRMPrelude implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@@ -40,14 +39,6 @@ class UpdatePerfexCRMPrelude implements ShouldQueue
public function handle()
{
// //dd(json_encode($supplier));
// // if($this->transaction->payment_method == PaymentMethodType::CASH)
// $supplier = (App()->make(FetchesCompany::class))->execute(['id' => $this->transaction->receiver]);
// $purchaseOrder = $booking->transactions()
// ->where('type', TransactionType::PURCHASE_ORDER)
// ->complete()
// ->first();
$serviceTypeName = $this->transaction->owner->company->services()->where('id', $this->transaction->owner->service_id)->first()->name;
$booking = $this->transaction->booking;
$bank = $booking->bank;
@@ -82,28 +73,9 @@ class UpdatePerfexCRMPrelude implements ShouldQueue
$result = $this->replacePlaceholders($this->updatePerfexCRMObject->getTasks(), $data);
$this->updatePerfexCRMObject->setTasks($result);
//cief todo: cleanup
// // Do some work here
// $result = 'some result';
// // Return the result
// return $result;
// dd(json_encode($this->updatePerfexCRMObject->getTasks()));
// return $this->updatePerfexCRMObject;
$this->nextJob::dispatch($this->updatePerfexCRMObject);
}
// public function then($callback)
// {
// $result = $this->result;
// dd(json_encode($result));
// // Execute the callback with the result
// $callback($result);
// }
function replacePlaceholders($template, $data, $prefix = '')
{
foreach ($template as $key => $value) {
@@ -88,7 +88,7 @@ class CreatePerfexCRMInvoiceProcessor
$number = 'EXC-'.$number;
$date = Carbon::parse($booking->created_at)->format('Y-m-d');
$dueDate = Carbon::parse($booking->created_at)->format('Y-m-d');
$currency = 1; //cief TODO: To look into Malaysia and Chinese currency
$currency = 1;
$subTotal = 0.00;
$total = 0.00;
@@ -50,6 +50,7 @@ class TransactionToPerfexCRMProcessor
PerfexCRMTasks::TASK_1_DAY_TRANSFER_1,
PerfexCRMTasks::TASK_1_DAY_TRANSFER_2,
PerfexCRMTasks::TASK_1_DAY_TRANSFER_3,
PerfexCRMTasks::TASK_1_DAY_TRANSFER_3_1,
PerfexCRMTasks::TASK_1_DAY_TRANSFER_4,
PerfexCRMTasks::TASK_1_DAY_TRANSFER_5,
PerfexCRMTasks::TASK_1_DAY_TRANSFER_6,
@@ -61,6 +62,7 @@ class TransactionToPerfexCRMProcessor
PerfexCRMTasks::TASK_3_DAY_TRANSFER_1,
PerfexCRMTasks::TASK_3_DAY_TRANSFER_2,
PerfexCRMTasks::TASK_3_DAY_TRANSFER_3,
PerfexCRMTasks::TASK_3_DAY_TRANSFER_3_1,
PerfexCRMTasks::TASK_3_DAY_TRANSFER_4,
PerfexCRMTasks::TASK_3_DAY_TRANSFER_5,
PerfexCRMTasks::TASK_3_DAY_TRANSFER_6,
@@ -72,6 +74,7 @@ class TransactionToPerfexCRMProcessor
PerfexCRMTasks::TASK_1688_PAYMENT_1,
PerfexCRMTasks::TASK_1688_PAYMENT_2,
PerfexCRMTasks::TASK_1688_PAYMENT_3,
PerfexCRMTasks::TASK_1688_PAYMENT_3_1,
PerfexCRMTasks::TASK_1688_PAYMENT_4,
PerfexCRMTasks::TASK_1688_PAYMENT_5,
PerfexCRMTasks::TASK_1688_PAYMENT_6,
@@ -162,8 +162,6 @@ class UpdatePerfexCRMProcessor
if(isset($result->payload)){
$project = $result->payload[0];
$projectId = $project['id'];
//cief todo: need to cater in case of project is completed? what situation will an update not require
//if the project status is anything but PerfexCRMProjectStatus::NOT_STARTED, update the project
if($updatePerfexCRMObject->getProjectStatus() != PerfexCRMProjectStatus::NOT_STARTED && $project['status'] == PerfexCRMProjectStatus::NOT_STARTED)
{
$this->updatesPerfexCRMProject->execute($project, $updatePerfexCRMObject->getProjectStatus());
@@ -205,7 +203,6 @@ class UpdatePerfexCRMProcessor
// Get existing or create task
$result = $this->fetchesPerfexCRMTask->execute($tasks[$count]['name'], $milestoneId, 'project', $projectId);
//cief todo: need to cater in case of task is completed? what situation will an update not require
if(isset($result->payload)){
if($taskStatus != PerfexCRMTaskStatus::NOT_STARTED && $result->payload[0]['status'] == PerfexCRMTaskStatus::NOT_STARTED)
{
@@ -61,7 +61,7 @@ class PerfexCRMTasks
○ Outcomes: An invoice will be issued in accounting software for the customer\'s payment.<br>',
'milestone' => '',
'reference' => 'TASK_1_DAY_TRANSFER_3',
'on_task_completion' => 'TASK_1_DAY_TRANSFER_4',
'on_task_completion' => 'TASK_1_DAY_TRANSFER_3_1',
'department' => 'Accounts',
'status' => '',
'priority' => PerfexCRMTaskPriority::MEDIUM,
@@ -304,7 +304,7 @@ class PerfexCRMTasks
○ Outcomes: An invoice will be issued in accounting software for the customer\'s payment.<br>',
'milestone' => '',
'reference' => 'TASK_1688_PAYMENT_3',
'on_task_completion' => 'TASK_1688_PAYMENT_4',
'on_task_completion' => 'TASK_1688_PAYMENT_3_1',
'department' => 'Accounts',
'status' => '',
'priority' => PerfexCRMTaskPriority::MEDIUM,