/** * create or update a payment plan memo */ public static function updatePaymentPlan($data) { $time = time(); try { $pidm = \IDMObject::getIdentifier($data['psu_id'], 'psu_id', 'pidm'); if (!$pidm) { throw new \Exception("Invalid ID: ID does not exist"); } //end if } catch (Exception $i) { self::markPaymentPlanAsProcessed($data['id']); throw new \Exception("Invalid ID: ID does not exist"); } //end catch $data['plan_type'] = strtolower($data['plan_type']); $record = array('pidm' => $pidm, 'userfield' => 'TMS_PAYMENT_PLAN', 'user' => 'TMS_PAYMENT_PLAN', 'entry_date' => $time, 'effective_date' => $time, 'activity_date' => $time, 'srce_code' => 'Z', 'data_origin' => 'feed_' . $data['file_sub_type'], 'create_user' => 'tms_' . $data['tms_customer_number'], 'detail_code' => $data['plan_type'] == 'annual' ? 'IQPP' : 'IQPQ', 'billing_ind' => 'N'); $term_code = $record['term_code'] = \PSU\Student::getCurrentTerm('ug'); $del_data = array('pidm' => $pidm, 'detail_code' => 'IQPP', 'user' => 'TMS_PAYMENT_PLAN', 'data_origin' => 'feed_' . $data['file_sub_type'], 'create_user' => 'tms_' . $data['tms_customer_number']); $memo = new \PSU\AR\Memo($del_data); $memo->delete(); $del_data['detail_code'] = 'IQPQ'; $memo = new \PSU\AR\Memo($del_data); $memo->delete(); $max_tran_number = \PSU\AR\Memos::max_tran_number($pidm); $record['tran_number'] = $max_tran_number + 1; if ($data['report_group'] == 'UG') { self::parsePaymentPlanUG($term_code, $record, $data); } else { self::parsePaymentPlanGR($record, $data); } //end else // payment plan parsing was successful for this record. mark it as processed. self::markPaymentPlanAsProcessed($data['id']); $person = null; return true; }