Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boost/boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

$proper_name = 'Internship Inventory';
$version = '1.1.0';
$version = '1.1.1';
$register = false;
$unregister = false;
$import_sql = true;
Expand Down
4 changes: 2 additions & 2 deletions boost/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,6 @@ CREATE TABLE intern_internship (
middle_name_meta VARCHAR,
last_name_meta VARCHAR,
preferred_name_meta VARCHAR,
loc_address VARCHAR NULL,
loc_city VARCHAR NULL,
loc_state VARCHAR NULL,
loc_zip VARCHAR NULL,
loc_province VARCHAR(255) NULL,
Expand Down Expand Up @@ -690,6 +688,8 @@ CREATE TABLE intern_internship (
host_id INT REFERENCES intern_host(id),
host_sub_id INT REFERENCES intern_special_host(id),
loc_phone VARCHAR,
remote SMALLINT,
remote_state VARCHAR,
PRIMARY KEY(id)
);

Expand Down
2 changes: 2 additions & 0 deletions boost/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ function intern_update(&$content, $currentVersion)
internRunDbMigration('update_01.00.00.sql');
PHPWS_Core::initModClass('users', 'Permission.php');
Users_Permission::registerPermissions('intern', $content);
case version_compare($currentVersion, '1.1.1', '<') :
internRunDbMigration('update_01.01.01.sql');
}

return TRUE;
Expand Down
2 changes: 2 additions & 0 deletions boost/updates/update_01.01.01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE intern_internship ADD COLUMN remote SMALLINT;
ALTER TABLE intern_internship ADD COLUMN remote_state VARCHAR;
4 changes: 2 additions & 2 deletions class/Command/AddInternship.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function execute() {

// If there are missing fields, redirect to the add internship interface
if(!empty($missingFieldList)) {
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Please complete the highlighted fields.");
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Banner ID must be in Student box before creating internship.");
$this->redirectToForm();
return;
}
Expand Down Expand Up @@ -140,7 +140,7 @@ private function checkForMissingInput() {
$missingFieldList = array();

// Check student ID
if (!isset($_POST['studentId']) || (isset($_POST['studentId']) && $_POST['studentId'] == '')) {
if (!isset($_POST['studentId']) || (isset($_POST['studentId']) && $_POST['studentId'] == '') || !preg_match('/^([0-9]){9}$/', $_POST['studentId'])) {
$missingFieldList[] = 'studentId';
}

Expand Down
7 changes: 7 additions & 0 deletions class/Command/SaveInternship.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ public function execute() {
$i->stipend = isset($_REQUEST['stipend']) && $i->paid;
$i->pay_rate = self::trimField($_REQUEST['pay_rate']);
$i->loc_phone = self::trimField($_REQUEST['host_phone']);
if (isset($_POST['remote'])){
$i->remote = 1;
$i->remote_state = $_POST['remote_state'];
} else{
$i->remote = 0;
$i->remote_state = NULL;
}

if (\Current_User::allow('intern', 'change_term')) {
$i->term = $_REQUEST['term'];
Expand Down
64 changes: 33 additions & 31 deletions class/DataProvider/Student/WebServiceDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class WebServiceDataProvider extends StudentDataProvider {
/**
* @param string $currentUserName - Username of the user currently logged in. Will be sent to web service
*/
public function __construct($currentUserName)
{
public function __construct($currentUserName){
$this->currentUserName = $currentUserName;

// Get the WSDL URI from module's settings
Expand All @@ -58,8 +57,7 @@ public function __construct($currentUserName)
* Returns a Student object with hard-coded data
* @return \Intern\Student
*/
public function getStudent($studentId)
{
public function getStudent($studentId){
if($studentId === null || $studentId == ''){
throw new \InvalidArgumentException('Missing student ID.');
}
Expand Down Expand Up @@ -93,20 +91,22 @@ public function getStudent($studentId)
// Log the request
$this->logRequest('getStudent', 'success', $params);

// Create the Student object and plugin the values
$student = new Student();
$this->plugStudentValues($student, $result);

// Create the Student object and plugin the values, Full check for missing data
try {
$student = new Student();
$this->plugStudentValues($student, $result);
}
catch(\Exception $e) {
throw new \Intern\Exception\StudentNotFoundException("Missing student data: $studentId");
}
return $student;
}

protected function sendRequest(Array $params)
{
protected function sendRequest(Array $params){
return $this->client->GetInternInfo($params);
}

public function getCreditHours(string $studentId, string $term)
{
public function getCreditHours(string $studentId, string $term){
if($studentId === null || $studentId == ''){
throw new \InvalidArgumentException('Missing student ID.');
}
Expand Down Expand Up @@ -139,8 +139,7 @@ public function getCreditHours(string $studentId, string $term)
}
}

public function getFacultyMember($facultyId)
{
public function getFacultyMember($facultyId){
if($facultyId === null || $facultyId == ''){
throw new \InvalidArgumentException('Missing student ID.');
}
Expand Down Expand Up @@ -181,33 +180,35 @@ public function getFacultyMember($facultyId)
* @param Student $student
* @param stdClass $data
*/
protected function plugStudentValues(&$student, \stdClass $data)
{
protected function plugStudentValues(&$student, \stdClass $data){
/**********************
* Basic Demographics *
**********************/
$student->setStudentId($data->bannerID);
$student->setUsername($data->userName);

$student->setFirstName($data->firstName);
$student->setMiddleName($data->middleName);
if(isset($data->middleName)){
$student->setMiddleName($data->middleName);
}
$student->setLastName($data->lastName);
$student->setPreferredName($data->preferredName);
if(isset($data->preferredName)){
$student->setPreferredName($data->preferredName);
}

if($data->confidential === 'N') {
if(isset($data->confidential) && $data->confidential === 'N') {
$student->setConfidentialFlag(false);
} else {
$student->setConfidentialFlag(true);
}

// Person type flags
if($data->isStudent == 1){
if(isset($data->isStudent) && $data->isStudent == 1){
$student->setStudentFlag(true);
} else {
$student->setStudentFlag(false);
}

if($data->isStaff == 1){
if(isset($data->isStaff) && $data->isStaff == 1){
$student->setStaffFlag(true);
} else {
$student->setStaffFlag(false);
Expand All @@ -218,10 +219,10 @@ protected function plugStudentValues(&$student, \stdClass $data)
*****************/

// Campus
if($data->campusDescription == WebServiceDataProvider::MAIN_CAMPUS) {
if(isset($data->campusDescription) && $data->campusDescription == WebServiceDataProvider::MAIN_CAMPUS) {
// If campus is 'Main Campus', then we know it's a main campus student
$student->setCampus(Student::MAIN_CAMPUS);
} else if ($data->campusDescription != '') {
} else if (isset($data->campusDescription) && $data->campusDescription != '') {
// If the campus is set, but is not 'Main Campus', then we know it's some other campus name (e.g. "Catawba EdD EdLead")
// We're not going to check for every possible campus name; as long as there's *something* there, we'll assume it's distance ed
$student->setCampus(Student::DISTANCE_ED);
Expand All @@ -233,9 +234,9 @@ protected function plugStudentValues(&$student, \stdClass $data)
}

// Check if level exist, if not add it
if(LevelFactory::checkLevelExist($data->studentLevel) && $student->getStudentFlag()){
if(isset($data->studentLevel) && LevelFactory::checkLevelExist($data->studentLevel) && $student->getStudentFlag()){
$student->setLevel($data->studentLevel);
} else if($student->getStudentFlag()) {
} else if(isset($data->studentLevel) && $student->getStudentFlag()) {
$newLevel = LevelFactory::saveNewCode($data->studentLevel);
$student->setLevel($newLevel);
}
Expand All @@ -255,12 +256,14 @@ protected function plugStudentValues(&$student, \stdClass $data)
// Grad date, if available
if(isset($data->gradDate) && $data->gradDate != '') {
$student->setGradDateFromString($data->gradDate);
} else if(isset($data->gradYear) && $data->gradYear != '') {
} /*else if(isset($data->gradYear) && $data->gradYear != '') {
$student->setGradDateFromString($data->gradYear);
}
}*/

// Contact info
$student->setPhone($data->phoneNumber);
if(isset($data->phoneNumber)){
$student->setPhone($data->phoneNumber);
}
}

/**
Expand Down Expand Up @@ -289,8 +292,7 @@ protected function plugFacultyValues(\stdClass $data) {
/**
* Logs this request to PHPWS' curlapi.log file
*/
private function logRequest($functionName, $result, Array $params)
{
private function logRequest($functionName, $result, Array $params) {
$args = implode(', ', $params);
$msg = "$functionName($args) result: $result";
\PHPWS_Core::log($msg, 'curlapi.log', 'CURLAPI');
Expand Down
13 changes: 13 additions & 0 deletions class/EditInternshipFormView.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@ public function buildInternshipForm() {
$this->tpl['LOCATION'] = 'International';
$this->form->addHidden('location', 'international');
}
// Remote
$this->form->addCheck('remote');
$this->form->setLabel('remote', 'This internship is remote.');

$this->form->addSelect('remote_state', State::$UNITED_STATES);
$this->form->setLabel('remote_state', 'Remote State');
$this->form->addCssClass('remote_state', 'form-control');

// Phone
$this->form->addText('host_phone');
$this->form->addCssClass('host_phone', 'form-control');
Expand Down Expand Up @@ -611,6 +619,11 @@ private function plugInternInfo() {
$this->formVals['credits'] = $this->intern->credits;
$this->formVals['avg_hours_week'] = $this->intern->avg_hours_week;

if ($this->intern->isRemote()) {
$this->form->setMatch('remote', '1');
$this->formVals['remote_state'] = $this->intern->remote_state;
}

if ($this->intern->paid) {
$this->form->setMatch('payment', 'paid');
$this->form->setMatch('stipend', $this->intern->stipend);
Expand Down
16 changes: 16 additions & 0 deletions class/Internship.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class Internship {
public $loc_state;
public $loc_country;
public $loc_phone;
public $remote;
public $remote_state;

// Term Info
public $term;
Expand Down Expand Up @@ -317,6 +319,8 @@ public function getCSV()
// Internship location data
$csv['Domestic'] = $this->isDomestic() ? 'Yes' : 'No';
$csv['International'] = $this->isInternational() ? 'Yes' : 'No';
$csv['Remote'] = $this->isRemote() ? 'Yes' : 'No';
$csv['Remote State'] = $this->remote_state;
$csv['Host Phone'] = $this->loc_phone;

// Gets host information
Expand Down Expand Up @@ -666,6 +670,14 @@ public function setOiedCertified($certified) {
}
}

public function isRemote() {
if($this->remote == 1){
return true;
}else{
return false;
}
}

public function isMultipart() {
if($this->multi_part == 1){
return true;
Expand Down Expand Up @@ -925,6 +937,10 @@ public function getPhoneNumber(){
return $this->phone;
}

public function getRemoteState(){
return $this->remote_state;
}

/**
* Returns this internship's term
*
Expand Down
34 changes: 14 additions & 20 deletions class/InternshipContractPdfView.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function generatePdf()
$f = $this->internship->getFaculty();
//$subject = $this->internship->getSubject();

$this->pdf->setSourceFile(PHPWS_SOURCE_DIR . 'mod/intern/pdf/Contract_Updated_202010.pdf');
$this->pdf->setSourceFile(PHPWS_SOURCE_DIR . 'mod/intern/pdf/Acknowledgment_Updated_202110.pdf');
$tplidx = $this->pdf->importPage(1);
$this->pdf->addPage();
$this->pdf->useTemplate($tplidx);
Expand Down Expand Up @@ -170,8 +170,6 @@ private function generatePdf()
$this->pdf->cell(81, 5, $addrFac2);
}



$this->pdf->setXY(29, 141);
$this->pdf->cell(77, 5, $f->getPhone());

Expand Down Expand Up @@ -209,6 +207,9 @@ private function generatePdf()
$this->pdf->cell(77, 5, $addr2);
}

$this->pdf->setXY(137, 174);
$this->pdf->cell(77,0, $this->internship->getRemoteState());

/**
* Supervisor info.
*/
Expand All @@ -234,31 +235,24 @@ private function generatePdf()
$this->pdf->setXY(113, 149);
$this->pdf->cell(78, 5, $super_address);
}else{
// Too long, need to use two lines
$host_info_len = strlen($superName) + strlen($supervisorTitle);
$newX = 113 + ($host_info_len * 2);
$endX = (203 - $newX) / 1.5;

//$superLine1 = substr($super_address, 0, $endX); // get first 55 chars
//$superLine2 = substr($super_address, $endX); // get the rest, hope it fits

$addrSup = wordwrap($host_address, $endX);
// Too long, need to use two lines, breaks string at whole word around 55 chars
$addrSup = wordwrap($super_address, 55);
$superLine1 = substr($addrSup, 0, strpos($addrSup, "\n"));
$superLine2 = substr($addrSup, strpos($addrSup, "\n"));

$this->pdf->setXY($newX, 144);
$this->pdf->cell(78, 5, $superLine1);
$this->pdf->setXY(113, 149);
$this->pdf->cell(78, 5, $superLine1);
$this->pdf->setXY(113, 155);
$this->pdf->cell(78, 5, $superLine2);
}

$this->pdf->setXY(125, 159);
$this->pdf->setXY(125, 166);
$this->pdf->cell(72, 5, $s->getSupervisorEmail());

$this->pdf->setXY(125, 154);
$this->pdf->setXY(125, 160);
$this->pdf->cell(33, 5, $s->getSupervisorPhoneNumber());

$this->pdf->setXY(166, 154);
$this->pdf->setXY(166, 160);
$this->pdf->cell(40, 5, $s->getSupervisorFaxNumber());


Expand All @@ -273,13 +267,13 @@ private function generatePdf()
if(sizeof($this->emergencyContacts) > 0){
$firstContact = $this->emergencyContacts[0];

$this->pdf->setXY(59, 271);
$this->pdf->setXY(59, 273);
$this->pdf->cell(52, 0, $firstContact->getName());

$this->pdf->setXY(134, 271);
$this->pdf->setXY(134, 273);
$this->pdf->cell(52, 0, $firstContact->getRelation());

$this->pdf->setXY(172, 271);
$this->pdf->setXY(172, 273);
$this->pdf->cell(52, 0, $firstContact->getPhone());
}
}
Expand Down
4 changes: 2 additions & 2 deletions class/Supervisor.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public function getSuperAddress(){
$add[] = $this->supervisor_address . ',';
}
if(!empty($this->supervisor_city)){
$add[] = $this->supervisor_city . ',';
$add[] = $this->supervisor_city . ', ';
}
if(!empty($this->supervisor_state)){
$add[] = $this->supervisor_state;
$add[] = $this->supervisor_state . ' ';
}
if(!empty($this->supervisor_zip)){
$add[] = $this->supervisor_zip;
Expand Down
Loading