Ejemplo n.º 1
0
 /**
  * constructor
  *
  * @param $person \b PSUPerson object
  * @param $level_or_data \b This can be 1 of two things:
  *                          - if a string, it is the Level code of student data (e.g. ug, gr, etc)
  *                          - if an array, it is an array of sgbstdn data
  * @param $term_code \b Effective term code
  */
 public function __construct($student, $level_or_data, $max_term_code = null, $term_code_eff = null)
 {
     parent::__construct();
     $data_loaders = array();
     $this->data_loaders = \PSU::params($data_loaders, $this->data_loaders);
     // make sure this object can access its associated PSU_Student
     if ($student instanceof \PSU\Student) {
         $this->student = $student;
     } else {
         $this->student = $person->student;
     }
     //end if
     // store the pidm globally to shorten the bind variables in queries :)
     $this->pidm = $this->student->person->pidm;
     if (is_array($level_or_data)) {
         $this->parse($level_or_data);
         $this->term_code = $max_term_code ? $max_term_code : \PSU\Student::getCurrentTerm($this->level_code);
     } else {
         $this->level_code = $level_or_data;
         $this->term_code = $max_term_code ? $max_term_code : \PSU\Student::getCurrentTerm($this->level_code);
         $this->term_code_eff = $term_code_eff;
         $this->load();
     }
     //end else
 }
 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;
 }
 /**
  * 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;
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
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
 }