Fix issues found when saving archive data. #762

This commit is contained in:
Korina Cordero 2023-09-11 15:10:08 +08:00 committed by Korina Cordero
parent a74bce2e35
commit 12edc9915d

View file

@ -44,6 +44,8 @@ class GetJobOrderArchiveDataCommand extends Command
$period = $input->getArgument('period');
$cutoff_date = $input->getArgument('cutoff_date');
$cutoff_date_time = $cutoff_date . ' 23:59:59';
$em = $this->em;
$db = $em->getConnection();
@ -112,7 +114,8 @@ class GetJobOrderArchiveDataCommand extends Command
caller_classification,
inventory_count
FROM job_order
WHERE DATE_CREATE < DATE_SUB(:cutoff_date, INTERVAL ' . $period . ' YEAR)';
WHERE DATE_CREATE <= DATE_SUB(:cutoff_date, INTERVAL ' . $period . ' YEAR)
ORDER BY date_create';
$query_stmt = $db->prepare($query_sql);
$query_stmt->bindValue('cutoff_date', $cutoff_date, PDO::PARAM_STR);
@ -250,9 +253,8 @@ class GetJobOrderArchiveDataCommand extends Command
$status = $row['status'];
// TODO: might need to clean delivery address and delivery instructions
$del_instructions = $row['delivery_instructions'];
$del_address = $row['delivery_address'];
$del_instructions = $this->cleanData($row['delivery_instructions']);
$del_address = $this->cleanData($row['delivery_address']);
$create_user_id = '\N';
if ($row['create_user_id'] != NULL)
@ -284,11 +286,13 @@ class GetJobOrderArchiveDataCommand extends Command
if ($row['ref_jo_id'] != NULL)
$ref_jo_id = $row['ref_jo_id'];
$tier1_notes = $row['tier1_notes'];
$tier2_notes = $row['tier2_notes'];
$tier1_notes = $this->cleanData($row['tier1_notes']);
$tier2_notes = $this->cleanData($row['tier2_notes']);
$mode_of_payment = $row['mode_of_payment'];
$or_name = $row['or_name'];
$landmark = $row['landmark'];
$landmark = $this->cleanData($row['landmark']);
$promo_details = $row['promo_detail'];
$or_num = '\N';
@ -367,7 +371,7 @@ class GetJobOrderArchiveDataCommand extends Command
$remarks = '\N';
if ($row['remarks'] != NULL)
$remarks = $row['remarks'];
$remarks = $this->cleanData(row['remarks']);
$initial_concern = '\N';
if ($row['initial_concern'] != NULL)
@ -504,4 +508,15 @@ class GetJobOrderArchiveDataCommand extends Command
// TODO: delete file?
}
protected function cleanData($text)
{
$clean_text = '';
// replace the new lines with whitespace
$clean_text = preg_replace("/[\n\r]/", ' ', $text);
return $clean_text;
}
}