Skip to content

Commit

Permalink
Using preferred name in reports if defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stardog committed Feb 15, 2022
1 parent 9180a13 commit 06d2f49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions class/Factory/CSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

namespace volunteer\Factory;

if (!defined('VOL_USE_PREFERRED_ON_REPORT')) {
define('VOL_USE_PREFERRED_ON_REPORT', true);
}

class CSV
{

Expand All @@ -25,8 +29,12 @@ public static function buildRows(array $list, string $type)
$reason = $reasons[$listRow['reasonId']]['title'];
}
if ($type === 'sponsor') {
$csvrow['firstName'] = $listRow['firstName'];
$csvrow['preferredName'] = $listRow['preferredName'] ?? '';
if (VOL_USE_PREFERRED_ON_REPORT) {
$csvrow['firstName'] = $listRow['preferredName'] ?? $listRow['firstName'];
} else {
$csvrow['firstName'] = $listRow['firstName'];
$csvrow['preferredName'] = $listRow['preferredName'] ?? '';
}
$csvrow['lastName'] = $listRow['lastName'];
$csvrow['bannerId'] = $listRow['bannerId'];
} else {
Expand Down
1 change: 1 addition & 0 deletions config/defines.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
define('VOL_SHIB_LOGOUT_TAG', '');
define('VOL_SHIB_USERNAME_TAG', ''); // name of SERVER variable containing the username
define('VOL_CONTACT_EMAIL', '');
define('VOL_USE_PREFERRED_ON_REPORT', true);

0 comments on commit 06d2f49

Please sign in to comment.