[FIX] Cargo requests get deleted when requester cryos (#27190)

* Cargo requests delete when requester cryo's

* Update code/modules/supply/supply_order.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Chap <erwin@lombok.demon.nl>

---------

Signed-off-by: Chap <erwin@lombok.demon.nl>
Co-authored-by: Adrer <adrermail@gmail.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
Chap
2024-10-31 19:26:43 +01:00
committed by GitHub
parent 6257fef025
commit 6a28cfa30b
2 changed files with 12 additions and 2 deletions

View File

@@ -344,7 +344,7 @@
for(var/datum/station_department/department in SSjobs.station_departments)
if(department.department_account == selected_account)
order.ordered_by_department = department //now that we know which department this is for, attach it to the order
order.orderedbyaccount = selected_account
order.set_account(selected_account)
order.requires_head_approval = TRUE
if(length(order.object.department_restrictions) && !(department.department_name in order.object.department_restrictions))
@@ -358,7 +358,7 @@
//===Handle Supply Order===
if(selected_account.account_type == ACCOUNT_TYPE_PERSONAL)
//if the account is a personal account (and doesn't require CT approval), go ahead and pay for it now
order.orderedbyaccount = selected_account
order.set_account(selected_account)
if(attempt_account_authentification(selected_account, user))
var/paid_for = FALSE
if(!order.requires_cargo_approval && pay_with_account(selected_account, order.object.get_cost(), "[order.object.name] Crate Purchase", "Cargo Requests Console", user, account_database.vendor_account))

View File

@@ -22,6 +22,16 @@
name = "request form"
var/order_number
/// Set the account that made the request and make sure the request is deleted when the account is deleted
/datum/supply_order/proc/set_account(datum/money_account/account)
orderedbyaccount = account
RegisterSignal(orderedbyaccount, COMSIG_PARENT_QDELETING, PROC_REF(clear_request))
/// Clear the request from the request list and delete it
/datum/supply_order/proc/clear_request()
SSeconomy.request_list -= src
qdel(src)
/datum/supply_order/proc/createObject(atom/_loc, errors = 0)
if(!object)
return