Skip to content

Commit

Permalink
Merge pull request #25 from TAMULib/tamu_orcid
Browse files Browse the repository at this point in the history
Added ability for admin to remove an orcid. If an orcid is set to null i...
  • Loading branch information
jeremythuff committed Oct 6, 2014
2 parents 40f4803 + b2931dd commit 1275746
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
36 changes: 20 additions & 16 deletions app/controllers/ViewTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,27 @@ public static void updateJSON(Long subId, String field, String value){
//ORCID
} else if("orcid".equals(field)) {

value = Utilities.formatOrcidAsDashedId(value);

if(!Utilities.validateOrcidFormat(value))
throw new RuntimeException("The provided ORCiD is not in a valid format.");

// Verify the ORCID id by pinging their API
boolean orcidVerify = true;
if (settingRepo.getConfigBoolean(AppConfig.ORCID_VALIDATION)) {
if (settingRepo.getConfigBoolean(AppConfig.ORCID_AUTHENTICATION))
orcidVerify = Utilities.verifyOrcid(value, submission.getStudentFirstName(), submission.getStudentLastName());
else
orcidVerify = Utilities.verifyOrcid(value);
if (value == null || value.length()==0) {
submission.setOrcid(null);
} else {
value = Utilities.formatOrcidAsDashedId(value);

if(!Utilities.validateOrcidFormat(value))
throw new RuntimeException("The provided ORCiD is not in a valid format.");

// Verify the ORCID id by pinging their API
boolean orcidVerify = true;
if (settingRepo.getConfigBoolean(AppConfig.ORCID_VALIDATION)) {
if (settingRepo.getConfigBoolean(AppConfig.ORCID_AUTHENTICATION))
orcidVerify = Utilities.verifyOrcid(value, submission.getStudentFirstName(), submission.getStudentLastName());
else
orcidVerify = Utilities.verifyOrcid(value);
}
if (!orcidVerify)
throw new RuntimeException("The provided ORCiD could not be validated.");

submission.setOrcid(value);
}
if (!orcidVerify)
throw new RuntimeException("The provided ORCiD could not be validated.");

submission.setOrcid(value);
currentValue = submission.getOrcid();

//Permanent Phone
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/submit/PersonalInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ public static void personalInfo(Long subId) {
firstName = sub.getStudentFirstName();
middleName = sub.getStudentMiddleName();
lastName = sub.getStudentLastName();
orcid = sub.getOrcid();
if(sub.getOrcid() != null)
orcid = sub.getOrcid();
birthYear = sub.getStudentBirthYear() != null ? String.valueOf(sub.getStudentBirthYear()) : null;
program = sub.getProgram();
college = sub.getCollege();
Expand Down

0 comments on commit 1275746

Please sign in to comment.