Skip to content

Commit

Permalink
Merge pull request #21 from mmarum-sugarcrm/Issue-19
Browse files Browse the repository at this point in the history
Fix for Issue-19. Add Student death reporting support.
  • Loading branch information
lschaefer-sugarcrm committed Feb 5, 2018
2 parents a25da99 + 162c6a9 commit 8602534
Show file tree
Hide file tree
Showing 19 changed files with 283 additions and 29 deletions.
20 changes: 3 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,9 @@ All of the tutorials at UnCon 2017 will be based on Professor M's School for Gif
## About the scenario
Professor M aka Professor Marum has created an exclusive not-for-profit school for gifted coders.

The school uses Sugar for the following use cases:
- Managing applicants, current students, former students, and professors
- Tracking super groups
- Soliciting donations from alumni and alumni affiliated super groups

For those familiar with Sugar, you'll notice that some of the standard modules have been renamed.

| Professor M Module | Original Sugar Module |
| :--- | :--- |
| Super Groups | Accounts |
| Applicants | Leads |
| Students | Contacts |
| Professors | New custom person-type module |
| Donations | Opportunities |
| Funding Line Items | Revenue Line Items|

Get all of the details on the Professor M scenario in the video below.
Learn more about the implemented [Use Cases](docs/UseCases.md) in the [docs](docs/).

Want a quick summary? Watch the video below we put together for SugarCon 2017.
[![The Professor M Scenario Part 1 - What is it and why should you care?](images/profmvideo1.png)](https://youtu.be/aKBTKcaney4 "The Professor M Scenario Part 1 - What is it and why should you care?")

## Installation instructions
Expand Down
14 changes: 7 additions & 7 deletions data/ProfessorM_PostmanCollection.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"grant_type\":\"password\",\n \"client_id\":\"sugar\",\n \"client_secret\":\"\",\n \"username\":\"{{username}}\",\n \"password\":\"{{password}}\",\n \"platform\":\"api\"\n}"
"raw": "{\n \"grant_type\":\"password\",\n \"client_id\":\"sugar\",\n \"client_secret\":\"\",\n \"username\":\"{{username}}\",\n \"password\":\"{{password}}\",\n \"platform\":\"profm_import\"\n}"
},
"description": ""
},
Expand Down Expand Up @@ -1441,7 +1441,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n\t\"status_c\":\"Alumnus\",\n\t\"tag\":[\"Mutants\"],\n\t\"preferred_language\":\"en_us\",\n\t\"salutation\":\"Mr.\",\n\t\"lead_source\":\"Self Generated\",\n\t\"first_name\":\"Val\",\n\t\"last_name\":\"Eisenhower\",\n\t\"alias_c\":\"Attracto\",\n\t\"birthdate\":\"1928-08-05\",\n\t\"account_id\":\"{{SuperGroup_Brotherhood}}\"\n}"
"raw": "{\n\t\"vitals_c\":\"active\",\n\t\"status_c\":\"Alumnus\",\n\t\"tag\":[\"Mutants\"],\n\t\"preferred_language\":\"en_us\",\n\t\"salutation\":\"Mr.\",\n\t\"lead_source\":\"Self Generated\",\n\t\"first_name\":\"Val\",\n\t\"last_name\":\"Eisenhower\",\n\t\"alias_c\":\"Attracto\",\n\t\"birthdate\":\"1928-08-05\",\n\t\"account_id\":\"{{SuperGroup_Brotherhood}}\"\n}"
},
"description": ""
},
Expand Down Expand Up @@ -1479,7 +1479,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n\t\"status_c\":\"Current Student\",\n\t\"tag\":[\"Assassin\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Partner\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Annette\",\n\t\"last_name\":\"Mary\",\n\t\"alias_c\":\"Rascal\",\n\t\"birthdate\":\"1989-12-26\",\n\t\"account_id\":\"{{SuperGroup_M-Men}}\",\n\t\"primary_address_city\":\"Caldecott\",\n\t\"primary_address_state\":\"MS\",\n\t\"primary_address_country\":\"USA\"\n}"
"raw": "{\n\t\"vitals_c\":\"active\",\n\t\"status_c\":\"Current Student\",\n\t\"tag\":[\"Assassin\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Partner\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Annette\",\n\t\"last_name\":\"Mary\",\n\t\"alias_c\":\"Rascal\",\n\t\"birthdate\":\"1989-12-26\",\n\t\"account_id\":\"{{SuperGroup_M-Men}}\",\n\t\"primary_address_city\":\"Caldecott\",\n\t\"primary_address_state\":\"MS\",\n\t\"primary_address_country\":\"USA\"\n}"
},
"description": ""
},
Expand Down Expand Up @@ -1517,7 +1517,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n\t\"status_c\":\"Alumnus\",\n\t\"tag\":[\"Genetically Enhanced\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Cold Call\",\n\t\"salutation\":\"Mr.\",\n\t\"first_name\":\"Jimmy\",\n\t\"last_name\":\"Harwit\",\n\t\"alias_c\":\"Honey Badger\",\n\t\"birthdate\":\"1887-05-08\",\n\t\"account_id\":\"{{SuperGroup_M-Men}}\",\n\t\"primary_address_city\":\"Whitehorse\",\n\t\"primary_address_state\":\"YT\",\n\t\"primary_address_country\":\"Canada\"\n}"
"raw": "{\n\t\"vitals_c\":\"active\",\n\t\"status_c\":\"Alumnus\",\n\t\"tag\":[\"Genetically Enhanced\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Cold Call\",\n\t\"salutation\":\"Mr.\",\n\t\"first_name\":\"Jimmy\",\n\t\"last_name\":\"Harwit\",\n\t\"alias_c\":\"Honey Badger\",\n\t\"birthdate\":\"1887-05-08\",\n\t\"account_id\":\"{{SuperGroup_M-Men}}\",\n\t\"primary_address_city\":\"Whitehorse\",\n\t\"primary_address_state\":\"YT\",\n\t\"primary_address_country\":\"Canada\"\n}"
},
"description": ""
},
Expand Down Expand Up @@ -1555,7 +1555,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n\t\"status_c\":\"Past Student\",\n\t\"tag\":[\"Genius\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Partner\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Symone\",\n\t\"last_name\":\"Lighthome\",\n\t\"alias_c\":\"Glamour\",\n\t\"birthdate\":\"1961-07-11\",\n\t\"account_id\":\"{{SuperGroup_Brotherhood}}\"\n}"
"raw": "{\n\t\"vitals_c\":\"active\",\n\t\"status_c\":\"Past Student\",\n\t\"tag\":[\"Genius\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Partner\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Symone\",\n\t\"last_name\":\"Lighthome\",\n\t\"alias_c\":\"Glamour\",\n\t\"birthdate\":\"1961-07-11\",\n\t\"account_id\":\"{{SuperGroup_Brotherhood}}\"\n}"
},
"description": ""
},
Expand Down Expand Up @@ -1593,7 +1593,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n\t\"status_c\":\"Alumnus\",\n\t\"tag\":[\"Assassin\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Employee\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Janice\",\n\t\"last_name\":\"Beige\",\n\t\"alias_c\":\"Firebird\",\n\t\"birthdate\":\"1975-05-22\",\n\t\"account_id\":\"{{SuperGroup_M-Men}}\"\n}"
"raw": "{\n\t\"vitals_c\":\"active\",\n\t\"status_c\":\"Alumnus\",\n\t\"tag\":[\"Assassin\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Employee\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Janice\",\n\t\"last_name\":\"Beige\",\n\t\"alias_c\":\"Firebird\",\n\t\"birthdate\":\"1975-05-22\",\n\t\"account_id\":\"{{SuperGroup_M-Men}}\"\n}"
},
"description": ""
},
Expand Down Expand Up @@ -1665,7 +1665,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n\t\"status_c\":\"Prospective Student\",\n\t\"tag\":[\"Human\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Partner\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Cate\",\n\t\"last_name\":\"Purry\",\n\t\"alias_c\":\"Shadylynx\",\n\t\"birthdate\":\"1992-01-24\",\n\t\"account_id\":\"{{SuperGroup_Young}}\",\n\t\"primary_address_city\":\"Deerfield\",\n\t\"primary_address_state\":\"IL\",\n\t\"primary_address_country\":\"USA\"\n}"
"raw": "{\n\t\"vitals_c\":\"active\",\n\t\"status_c\":\"Prospective Student\",\n\t\"tag\":[\"Human\"],\n\t\"preferred_language\":\"en_us\",\n\t\"lead_source\":\"Partner\",\n\t\"salutation\":\"Ms.\",\n\t\"first_name\":\"Cate\",\n\t\"last_name\":\"Purry\",\n\t\"alias_c\":\"Shadylynx\",\n\t\"birthdate\":\"1992-01-24\",\n\t\"account_id\":\"{{SuperGroup_Young}}\",\n\t\"primary_address_city\":\"Deerfield\",\n\t\"primary_address_state\":\"IL\",\n\t\"primary_address_country\":\"USA\"\n}"
},
"description": ""
},
Expand Down
45 changes: 45 additions & 0 deletions docs/StudentVitalTracking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Student Vital Tracking

When doing battle against the forces of evil, it is possible that a coder is incapacitated by carpal tunnel syndrome or even killed in a freak hoverboard accident. Professor M needs to report on the cause of death of any coder who has died in order to prevent the same mistakes from happening again.

## Implementation Technique

Sugar Studio was used to add custom fields, add a new drop down list, and to make Record View customizations within a dev instance. Sugar Logic is used with simple manually created custom Dependencies that are applied to conditionally change Record view panel visibility and make fields required.

Finally, these changes are extracted out of dev instance and included in this package.

Adding these fields is enough to allow Prof. M to use out of the box functionality to create reports or list view filters to achieve his business goals.

## Implementation Details

A custom Vitals dropdown field (`vital_c`) was added to the Students module and the Record view. The following vital statuses are selectable.

'active' => 'Active'
'injured' => 'Injured'
'comatose' => 'Comatose'
'deceased' => 'Deceased'

When `deceased` is selected, a new Death Information panel appears on the Record view and users are required to enter a Cause of Death (`cause_of_death_c`).

Professor M can then build reports based upon vital status and the common causes of death.

## Extensions

| Module | Extension | Name | Description |
| :--- | :--- | :---- | :---- |
|Contacts|Vardefs|`vital_c`|Dropdown for tracking vital status of student.|
|Contacts|Vardefs|`cause_of_death_c`|Text field that allows Prof. M to enter cause of death.|
|Contacts|Vardefs|`flowers_sent_c`|Checkbox field that allows Prof M. to track if flowers were ordered.|
|Contacts|Dependencies|`cause_of_death_required`|Makes `cause_of_death_c` a required field when `vital_c` is set to `deceased`.|
|Contacts|Dependencies|`show_death_panel`|Displays the `death_panel` in the Contacts Record View when `vital_c` is set to `deceased`.|
|application|Language|`sugar_vitals_list`|List of supported dropdown values for `vitals_c`. Described above.|

## View customizations

| Module | View | Description |
| :--- | :--- | :--- |
|Contacts|Record|Vitals dropdown (`vital_c`) has been added to main business card. A Death Information (`death_panel`) panel was also added that contains custom fields named `cause_of_death_c` and `flowers_sent_c`.|




30 changes: 30 additions & 0 deletions docs/UseCases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## About Professor M's School for Gifted Coders
Professor M aka Professor Marum has created an exclusive not-for-profit school for gifted coders. Coders are a subspecies of human who are born with superhuman capabilities in technology, analysis, and problem solving.

The Professor M School is gathering the best and brightest to train them to do battle against the forces of evil (specifically bad customer experiences and poor project implementations). It is hazardous and demanding work.

The Professor M School has deployed Sugar as a platform to help them manage both students and faculty so they can focus on their core organizational goals of developing talented coders and being a force for good.

## High Level Use Cases

The Professor M School uses Sugar for the following high level use cases:
- Managing applicants, current students, former students, and professors
- Tracking super groups
- Soliciting donations from alumni and alumni affiliated super groups

## Modules Summary

| Professor M Module | Sugar Module | Description |
| :--- | :--- | :---- |
| Super Groups | Accounts | Super Groups are organizations of affiliated coders. |
| Applicants | Leads | Applicants are prospective students that need to be accepted or rejected. |
| Students | Contacts | Students are coders who have been admitted to the Professor M School. |
| Donations | Opportunities | Donations are opportunities to raise funds as charitable contributions. |
| Funding Line Items | Revenue Line Items| Charitable contributions broken down by line item. |
| Professors | *Custom* | Person-type module. School staff that helps Professor M teach student coders. |

## Implemented Use Cases

[Student Vital Tracking](StudentVitalTracking.md)


2 changes: 1 addition & 1 deletion package/PackageGenerator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

// Copyright 2018 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
namespace Sugarcrm\ProfessorM;

use function array_push;
Expand Down
74 changes: 73 additions & 1 deletion package/pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


<?php
// Copyright 2017 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
// Copyright 2018 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
require("../vendor/autoload.php");

use Sugarcrm\ProfessorM\PackageGenerator;
Expand Down Expand Up @@ -195,6 +195,78 @@
'ext3' => NULL,
'ext4' => NULL,
),
'Contactsvitals_c' =>
array (
'id' => 'Contactsvitals_c',
'name' => 'vitals_c',
'label' => 'LBL_VITALS',
'comments' => NULL,
'help' => NULL,
'module' => 'Contacts',
'type' => 'enum',
'max_size' => '100',
'require_option' => '0',
'default_value' => 'active',
'date_modified' => '2018-02-01 21:32:16',
'deleted' => '0',
'audited' => '0',
'mass_update' => '1',
'duplicate_merge' => '1',
'reportable' => '1',
'importable' => 'true',
'ext1' => 'vitals_list',
'ext2' => NULL,
'ext3' => NULL,
'ext4' => NULL,
),
'Contactscause_of_death_c' =>
array (
'id' => 'Contactscause_of_death_c',
'name' => 'cause_of_death_c',
'label' => 'LBL_CAUSE_OF_DEATH',
'comments' => NULL,
'help' => NULL,
'module' => 'Contacts',
'type' => 'varchar',
'max_size' => '255',
'require_option' => '0',
'default_value' => NULL,
'date_modified' => '2018-01-31 21:21:44',
'deleted' => '0',
'audited' => '0',
'mass_update' => '0',
'duplicate_merge' => '1',
'reportable' => '1',
'importable' => 'true',
'ext1' => NULL,
'ext2' => NULL,
'ext3' => NULL,
'ext4' => NULL,
),
'Contactsflowers_sent_c' =>
array (
'id' => 'Contactsflowers_sent_c',
'name' => 'flowers_sent_c',
'label' => 'LBL_FLOWERS_SENT',
'comments' => NULL,
'help' => NULL,
'module' => 'Contacts',
'type' => 'bool',
'max_size' => '255',
'require_option' => '0',
'default_value' => '0',
'date_modified' => '2018-01-31 21:23:13',
'deleted' => '0',
'audited' => '0',
'mass_update' => '0',
'duplicate_merge' => '1',
'reportable' => '1',
'importable' => 'true',
'ext1' => NULL,
'ext2' => NULL,
'ext3' => NULL,
'ext4' => NULL,
),
'Leadsalias_c' =>
array (
'id' => 'Leadsalias_c',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
$app_list_strings['vitals_list'] = array (
'active' => 'Active',
'injured' => 'Injured',
'comatose' => 'Comatose',
'deceased' => 'Deceased',
);
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
// Copyright 2018 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
/*
* A valid platform name requires:
* - Max length of 127 characters
* - Valid characters are: a-z, A-Z, 0-9 - (hypen) _ (underscore)
*/
$platforms[] = 'api';
$platforms[] = 'profm_import';

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
// Copyright 2018 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
/**
* We use a SetRequired action to make Cause of Death a required field when Student is deceased.
*/
$dependencies['Contacts']['cause_of_death_required'] = array(
'hooks' => array("edit"),
'trigger' => 'true',
'triggerFields' => array('vitals_c'), // Triggered only when vitals_c changes
'onload' => true,
'actions' => array(
array(
'name' => 'SetRequired', //If formula is true, then we make target field required
'params' => array(
'target' => 'cause_of_death_c',
'value' => 'equal($vitals_c, "deceased")'
)
),
),
//Actions fire if the trigger is false. Optional.
'notActions' => array(),
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
// Copyright 2018 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
/**
* Show death panel when Student is Dead. :-(
*/
$dependencies['Contacts']['show_death_panel'] = array(
'hooks' => array("edit"),
'trigger' => 'equal($vitals_c, "deceased")', // Formula to determine if we run actions (true) or notActions (false)
'triggerFields' => array('vitals_c'),
'onload' => true,
'actions' => array( // Shows panel when deceased
array(
'name' => 'SetPanelVisibility', // Action that can set visibility on target panel
'params' => array(
'target' => 'death_panel',
'value' => 'true'
)
),
),
'notActions' => array( // Hides panel when not deceased
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'death_panel',
'value' => 'false'
)
),
),
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
// WARNING: The contents of this file are auto-generated.
$mod_strings['LBL_CAUSE_OF_DEATH'] = 'Cause of Death';
$mod_strings['LBL_FLOWERS_SENT'] = 'Flowers sent?';
$mod_strings['LBL_RECORDVIEW_PANEL1'] = 'Death Information';
$mod_strings['LBL_VITALS'] = 'Vitals';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// created: 2017-08-07 16:15:53
// created: 2018-02-01 21:17:38
$dictionary['Contact']['fields']['alias_c']['labelValue']='Alias';
$dictionary['Contact']['fields']['alias_c']['full_text_search']=array (
'enabled' => '0',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
// created: 2018-01-31 21:21:45
$dictionary['Contact']['fields']['cause_of_death_c']['labelValue']='Cause of Death';
$dictionary['Contact']['fields']['cause_of_death_c']['full_text_search']=array (
'enabled' => '0',
'boost' => '1',
'searchable' => false,
);
$dictionary['Contact']['fields']['cause_of_death_c']['enforced']='';
$dictionary['Contact']['fields']['cause_of_death_c']['dependency']='';

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
// created: 2018-01-31 21:23:14
$dictionary['Contact']['fields']['flowers_sent_c']['labelValue']='Flowers sent?';
$dictionary['Contact']['fields']['flowers_sent_c']['enforced']='';
$dictionary['Contact']['fields']['flowers_sent_c']['dependency']='';

?>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// created: 2017-08-07 16:24:53
// created: 2018-02-01 21:17:38
$dictionary['Contact']['fields']['status_c']['labelValue']='Status';
$dictionary['Contact']['fields']['status_c']['dependency']='';
$dictionary['Contact']['fields']['status_c']['visibility_grid']='';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
// created: 2018-02-01 21:32:23
$dictionary['Contact']['fields']['vitals_c']['labelValue']='Vitals';
$dictionary['Contact']['fields']['vitals_c']['dependency']='';
$dictionary['Contact']['fields']['vitals_c']['visibility_grid']='';

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
// WARNING: The contents of this file are auto-generated.
$mod_strings['LBL_CURRENCY_0'] = 'LBL_CURRENCY';
$mod_strings['LBL_CURRENCY_1'] = 'LBL_CURRENCY';
Loading

0 comments on commit 8602534

Please sign in to comment.