Beispiel #1
0
 public function __construct($id = null, $type = null, Student $student = null, $term = null, HMS_Residence_Hall $hall = null, HMS_Bed $bed = null, $mealPlan = null, $mealCode = null, $percentRefund = null)
 {
     if (!is_null($id) && $id != 0) {
         $this->load();
         return;
     }
     if (is_null($type)) {
         return;
     }
     $this->type = $type;
     $this->asu_username = strtolower($student->getUsername());
     $this->term = $term;
     $this->building_code = $hall->getBannerBuildingCode();
     $this->bed_code = $bed->getBannerId();
     $this->meal_plan = $mealPlan;
     $this->meal_code = $mealCode;
     $this->percent_refund = $percentRefund;
 }
Beispiel #2
0
 /**
  * Queues a Remove Assignment
  *
  * NOTE: If the queue contains a Create Assignment for the same
  * user to the same room, this will NOT queue a room assignment,
  * but rather will delete the original assignment, UNLESS the
  * $force_queue flag is set.  The $force_queue flag being true will
  * queue a removal no matter what.
  *
  * MORE NOTE: If this requires immediate processing because banner
  * commits are enabled, the it will be sent straight to Banner,
  * and so the force_queue flag will be ignored.
  */
 public static function queueRemoveAssignment(Student $student, $term, HMS_Residence_Hall $hall, HMS_Bed $bed, $refund)
 {
     $entry = new BannerQueueItem(0, BANNER_QUEUE_REMOVAL, $student, $term, $hall, $bed, null, null, $refund);
     if (BannerQueue::processImmediately($term)) {
         return $entry->process();
     }
     // Otherwise, look for an corresponding assignment
     $db = new PHPWS_DB('hms_banner_queue');
     $db->addWhere('type', BANNER_QUEUE_ASSIGNMENT);
     $db->addWhere('asu_username', $student->getUsername());
     $db->addWhere('building_code', $hall->getBannerBuildingCode());
     $db->addWhere('bed_code', $bed->getBannerId());
     $db->addWhere('term', $term);
     $result = $db->count();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     if ($result == 0) {
         return $entry->save();
     } else {
         return $db->delete();
     }
 }