public function query($args = array())
 {
     $defaults = array('term_code' => null, 'level_code' => 'UG');
     $args = PSU::params($args, $defaults);
     if (!isset($args['term_code'])) {
         $args['term_code'] = \PSU\Student::getCurrentTerm($args['level_code']);
     }
     $sql = "\n\t\t\tSELECT DISTINCT gobsrid_sourced_id\n\t\t\tFROM gobsrid, baninst1.as_student_enrollment_summary \n\t\t\tWHERE gobsrid_pidm = pidm_key \n\t\t\tAND majr_code1 = '0000' \n\t\t\tAND ests_code = 'EL' \n\t\t\tAND stst_code = 'AS' \n\t\t\tAND term_code_key = :term_code \n\t\t\tAND styp_code = 'N' \n\t\t\tAND levl_code = :level_code\n\t\t";
     return PSU::db('banner')->GetCol($sql, $args);
 }
 public function query($args = array())
 {
     $defaults = array('term_code' => null, 'level_code' => 'UG');
     $args = PSU::params($args, $defaults);
     if (!isset($args['term_code'])) {
         $args['term_code'] = \PSU\Student::getCurrentTerm($args['level_code']);
     }
     $sql = "\n\t\t\tSELECT sgbstdn_pidm FROM sgbstdn WHERE\n\t\t\tsgbstdn_stst_code = 'AS' AND\n\t\t\tsgbstdn_styp_code IN ('I', 'N', 'T') AND\n\t\t\tsgbstdn_term_code_admit = :term_code AND\n\t\t\tsgbstdn_levl_code = :level_code\n\t\t";
     $matches = PSU::db('banner')->GetCol($sql, $args);
     return $matches;
 }
Пример #3
0
 public static function load($term_code = null)
 {
     $data = array();
     if (!$term_code) {
         $term_code = \PSU\Student::currentTermCode();
     }
     //end if
     $sql = "SELECT * FROM tbbterm WHERE tbbterm_term_code = :term_code";
     $data = \PSU::db('banner')->GetRow($sql, array('term_code' => $term_code));
     $data = \PSU::cleanKeys('tbbterm_', '', $data);
     return $data;
 }
 /**
  * Looking for courses array to be in the following format:
  * array(
  *	'BU.4600',
  *	'AG.4900',
  *	'EPL.3960',
  * );
  * This way we won't be limited by CRN, but can grab multiple sections 
  * and enrolments.
  */
 public function query($args = array())
 {
     $defaults = array('identifier' => 'sourced_id', 'term_code' => \PSU\Student::getCurrentTerm($args['level_code']), 'courses' => NULL);
     $args = PSU::params($args, $defaults);
     foreach ((array) $args['courses'] as $course) {
         $course = explode('.', $course);
         $where .= "(ssbsect_subj_code='" . $course[0] . "' AND ssbsect_crse_numb='" . $course[1] . "') OR ";
     }
     //end foreach
     $where = rtrim($where, ' OR ');
     $sql = "\n\t\t\tSELECT DISTINCT " . $args['identifier'] . "\n\t\t      FROM sfrstcr \n\t\t\t  JOIN psu_identity.person_identifiers\n\t\t\t    ON sfrstcr_pidm = pid\n\t\t\t  JOIN ssbsect\n\t\t\t    ON (sfrstcr_crn = ssbsect_crn AND \n\t\t\t\t    sfrstcr_term_code = ssbsect_term_code)\n\t\t\t  WHERE " . $where . " \n\t\t\t\tAND sfrstcr_term_code >= :term_code\n\t\t\t\tAND sfrstcr_rsts_code IN ('RE', 'RW')\n\t\t";
     unset($args['courses']);
     unset($args['identifier']);
     $matches = PSU::db('banner')->GetCol($sql, $args);
     return $matches;
 }
Пример #5
0
 /**
  * loads data for the person
  */
 protected function load()
 {
     $args = array('pidm' => $this->pidm, 'levl_code' => $this->level_code, 'term_code' => $this->term_code_eff);
     if ($this->term_code_eff) {
         $sql = \PSU\Student::dataSQL(true, true);
     } else {
         $sql = \PSU\Student::dataSQL(true, false);
     }
     //end else
     // store term code to prevent overwiting in the execution of dataSQL
     $term_code = $this->term_code;
     if ($row = \PSU::db('banner')->GetRow($sql, $args)) {
         $this->parse($row);
     }
     //end if
     // fix the overwritten term_code
     $this->term_code = $term_code;
 }
Пример #6
0
 /**
  * we want to skip terms that aren't in the current aid year
  */
 public function apply_skip_terms($value, $bill, $level)
 {
     if (!$value) {
         $value = array();
     }
     //end if
     if (strtoupper($level) == 'UG') {
         foreach ((array) $bill->all_term_balances as $term => $amount) {
             if (\PSU\Student::getAidYear() != \PSU\Student::getAidYear($term)) {
                 $value[] = $term;
             }
             //end if
         }
         //end foreach
     }
     //end if
     return $value;
 }
Пример #7
0
 /**
  * sight
  *
  * Function called to loop over an array of users and mark them as 
  * sighted in moodle in Banner.
  *
  * @param array $args (Optional) args for population selection
  */
 public static function sight($args = NULL)
 {
     $defaults = array('timestamp' => time(), 'termcode' => \PSU\Student::getCurrentTerm('UG'));
     $args = \PSU::params($args, $defaults);
     $BannerStudent = new \BannerStudent(\PSU::db('banner'));
     $successes = array();
     foreach ((array) self::get_active_users($args) as $idnumber) {
         $pidm = \PSU::get('idmobject')->getIdentifier($idnumber, 'psu_id', 'pid');
         if (\PSU::db('psc1')->GetOne("SELECT 1 FROM v_student_active WHERE pidm = :pidm", array('pidm' => $pidm))) {
             if ($BannerStudent->sightStudent($pidm, 'MC')) {
                 $successes[] = $idnumber;
             }
             //end if
         }
         //end if
     }
     //end foreach
     return $successes;
 }
Пример #8
0
 public function query($args = array())
 {
     $defaults = array('identifier' => 'sourced_id', 'term_code' => NULL, 'subj_code' => 'UG', 'level_code' => 'UG', 'rsts_code' => 'RE');
     $args = PSU::params($args, $defaults);
     if (!isset($args['term_code'])) {
         $args['term_code'] = \PSU\Student::getCurrentTerm($args['level_code']);
     }
     foreach ((array) $args['subj_code'] as $subj_code) {
         $subj_where .= "ssbsect_subj_code = '" . $subj_code . "' OR ";
     }
     $subj_where = substr($subj_where, 0, -4);
     foreach ((array) $args['rsts_code'] as $rsts_code) {
         $rsts_where .= "sfrstcr_rsts_code = '" . $rsts_code . "' OR ";
     }
     $rsts_where = substr($rsts_where, 0, -4);
     $sql = "\n\t\t\tSELECT DISTINCT " . $args['identifier'] . "\n\t\t      FROM sfrstcr \n\t\t\t  JOIN psu_identity.person_identifiers\n\t\t\t    ON sfrstcr_pidm = pid\n\t\t\t  JOIN ssbsect\n\t\t\t    ON (sfrstcr_crn = ssbsect_crn AND \n\t\t\t\t    sfrstcr_term_code = ssbsect_term_code)\n\t\t\t  WHERE (" . $subj_where . ") \n\t\t\t\tAND (" . $rsts_where . ") \n\t\t\t\tAND sfrstcr_term_code >= :term_code \n\t\t";
     $matches = PSU::db('banner')->GetCol($sql, $args);
     return $matches;
 }
 public function __construct($pidm, $aid_year = null)
 {
     $this->pidm = $pidm;
     $this->aid_year = $aid_year ? $aid_year : \PSU\Student::getAidYear();
 }
Пример #10
0
 /**
  * @param $pidm
  * @param $aid_year string i.e. '1011'
  * @param $fund_messages stdClass an object for reading fund messages
  */
 public function __construct($pidm, $aid_year = null, $fund_messages = null)
 {
     $this->pidm = $pidm;
     $this->aid_year = $aid_year ? $aid_year : \PSU\Student::getAidYear();
     $this->fund_messages = $fund_messages ? $fund_messages : new PSU_Student_Finaid_Awards_Messages($pidm, $this->aid_year);
 }
Пример #11
0
 /**
  * split transaction into receivable entries
  *
  * @param $record_template \b bare-bones TBRACCD field array that will be used for all TBRACCD records during transaction processing
  */
 public function split($record_template)
 {
     $this->amount_paid_remaining = $this->amount;
     /**
      * Implementing the below code to work with AR office in an effort 
      * to have student payments only apply to the term that they select 
      * within the online billing app.
      */
     $term_code = $record_template['term_code'] ?: $this->term_code;
     $this->term_payment($term_code, $record_template, $this->amount);
     return $this;
     //------------Currently Ignoring Everything Below Here---------------
     // find the earliest unsatisfied term
     $early_term = $this->person->bill->earliest_unsatisfied_term;
     $only_term_types = array();
     $pre_apply = array();
     $skip = array();
     // populate $only_term_types via filter if filter exists and level has been set
     if (\PSU::has_filter('transaction_term_types') && $this->level) {
         $only_term_types = \PSU::apply_filters('transaction_term_types', $only_term_types, $this->level);
     }
     //end if
     // populate $skip via filter if filter exists
     if (\PSU::has_filter('transaction_term_skip') && $this->level) {
         $skip = \PSU::apply_filters('transaction_term_skip', $skip, $this->person->bill, $this->level);
     }
     //end if
     // populate $pre_apply via filter if filter is set
     if (\PSU::has_filter('transaction_split_pre_apply')) {
         $pre_apply = \PSU::apply_filters('transaction_split_pre_apply', $pre_apply, $this->person->bill);
         // loop over terms to pre-apply payments to
         foreach ($pre_apply as $term => $value) {
             $this->term_payment($term, $record_template, $value);
         }
         //end while
     }
     //end if
     $found_term = false;
     // loop over term balances
     foreach ((array) $this->person->bill->all_term_balances as $term => $value) {
         // find the current term
         if (!$found_term && $term != $early_term) {
             continue;
         } elseif ($term == $early_term) {
             $found_term = true;
         } elseif ($value <= 0) {
             continue;
         }
         // if there are values in $only_term_types then we only want to put
         // transactions in specific terms.  If this term is not in the list
         // of allowable terms, then skip it.
         if (!empty($only_term_types)) {
             if (!in_array(\PSU\Student::term_type($term), $only_term_types)) {
                 continue;
             }
             //end if
         }
         //end if
         // if there are values in $skip then we want to be sure
         // we skip it.
         if (!empty($skip)) {
             if (in_array($term, $skip)) {
                 continue;
             }
             //end if
         }
         //end if
         $this->term_payment($term, $record_template, $value);
     }
     //end while
     // if there is STILL money needing to be posted, prep a dummy term and post
     if ($this->amount_paid_remaining > 0) {
         // We don't want to find old activity, and if we are here, we have applied funds to the current ter,
         // Target the next term specified by the bursar otherwise fall back to this term
         $term = \PSU\AR::bursar_future_term(strtolower($this->level)) ?: $this->person->bill->last_balance_term();
         $payment = $record_template;
         $payment['term_code'] = $term;
         $payment['amount'] = $this->amount_paid_remaining;
         $this->amount_paid_remaining = 0;
         $this->add_entry($payment);
     }
     //end if
     return $this;
 }
Пример #12
0
 /**
  * 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;
 }
 public function url($user)
 {
     $person = PSUPerson::get($user);
     if (!$person->pidm) {
         throw new ECommerceException(ECommerceException::INVALID_PIDM);
     }
     $processor = 'UG Tuition/Housing Deposit';
     $server = $_SERVER['URANUS'] ? 'test' : 'prod';
     $term_code_entry = PSU::db('banner')->GetOne("SELECT term_code_entry FROM v_ug_app WHERE pidm = :pidm", array('pidm' => $person->pidm));
     if ($person->isActiveStudent() || $term_code_entry) {
         $this->setURLParam('userChoice2', PSU::nvl($person->student->ug->term_code_admit, $term_code_entry, \PSU\Student::getCurrentTerm('UG')));
         $this->setURLParam('orderType', $processor);
         $this->setURLParam('orderNumber', $person->id);
         $this->setURLParam('orderName', $person->formatName('l, f m'));
         $this->setURLParam('orderDescription', $processor);
         return $this->_url($server);
     } else {
         throw new ECommerceException(ECommerceException::INVALID_STUDENT);
     }
     //end else
 }