Merge pull request 'update' (#197) from zhangwei into dev

Reviewed-on: #197
This commit is contained in:
weiz 2024-01-19 11:43:39 +08:00
commit 371b7c2b0e
2 changed files with 15 additions and 2 deletions

View File

@ -45,7 +45,7 @@ class ProjectTravelReimbursementLists extends BaseAdminDataLists implements List
{
return [
'=' => ['trip_apply_id', 'project_id', 'reimbursement_type'],
'%like%' => ['apply_user'],
'%like%' => ['trip_reimbursement_code','apply_user'],
];
}

View File

@ -209,7 +209,20 @@ class ProjectTravelReimbursementLogic extends BaseLogic
*/
public static function delete(array $params): bool
{
return ProjectTravelReimbursement::destroy($params['id']);
Db::startTrans();
try {
$travel_reimbursement_detail_ids = ProjectTravelReimbursementDetail::where('travel_reimbursement_id',$params['id'])->column('id');
$travel_reimbursement_invoice_detail_ids = ProjectTravelReimbursementInvoiceDetail::where('travel_reimbursement_id',$params['id'])->column('id');
ProjectTravelReimbursement::destroy($params['id']);
ProjectTravelReimbursementDetail::destroy($travel_reimbursement_detail_ids);
ProjectTravelReimbursementInvoiceDetail::destroy($travel_reimbursement_invoice_detail_ids);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}