Skip to content

Commit

Permalink
[Acknowledgements] Fix for selecting all roles (#9209)
Browse files Browse the repository at this point in the history
Fix insert statement when too many roles are added by converting the fields from varchar(255) to text.

Fixes #9173
  • Loading branch information
skarya22 authored Apr 19, 2024
1 parent ab5caa7 commit 2167094
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions SQL/0000-00-00-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2111,9 +2111,9 @@ CREATE TABLE `acknowledgements` (
`ordering` varchar(255) DEFAULT NULL,
`full_name` varchar(255) DEFAULT NULL,
`citation_name` varchar(255) DEFAULT NULL,
`affiliations` varchar(255) DEFAULT NULL,
`degrees` varchar(255) DEFAULT NULL,
`roles` varchar(255) DEFAULT NULL,
`affiliations` text DEFAULT NULL,
`degrees` text DEFAULT NULL,
`roles` text DEFAULT NULL,
`start_date` date DEFAULT NULL,
`end_date` date DEFAULT NULL,
`present` enum('Yes', 'No') DEFAULT NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE acknowledgements MODIFY affiliations TEXT DEFAULT NULL;
ALTER TABLE acknowledgements MODIFY degrees TEXT DEFAULT NULL;
ALTER TABLE acknowledgements MODIFY roles TEXT DEFAULT NULL;
14 changes: 7 additions & 7 deletions modules/acknowledgements/php/acknowledgements.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,22 @@ class Acknowledgements extends \NDB_Menu_Filter_Form
if ($values['addPresent'] === 'Yes') {
$values['addEndDate'] = null;
}
$affiliations = is_array($values['addAffiliations']) ?
$affils = is_array($values['addAffiliations']) ?
implode(', ', $values['addAffiliations']) :
$values['addAffiliations'];
$degrees = is_array($values['addDegrees']) ?
$degs = is_array($values['addDegrees']) ?
implode(', ', $values['addDegrees']) :
$values['addDegrees'];
$roles = is_array($values['addRoles']) ?
$roles = is_array($values['addRoles']) ?
implode(', ', $values['addRoles']) :
$values['addRoles'];
$results = [
$results = [
'ordering' => $values['addOrdering'],
'full_name' => $values['addFullName'],
'citation_name' => $values['addCitationName'],
'affiliations' => $affiliations,
'degrees' => $degrees,
'roles' => $roles,
'affiliations' => implode(',', array_filter(explode(',', $affils))),
'degrees' => implode(',', array_filter(explode(',', $degs))),
'roles' => implode(',', array_filter(explode(',', $roles))),
'start_date' => $values['addStartDate'],
'end_date' => $values['addEndDate'],
'present' => $values['addPresent'],
Expand Down

0 comments on commit 2167094

Please sign in to comment.