-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Communication History #606
Open
vanoudt
wants to merge
26
commits into
tbar0970:master
Choose a base branch
from
vanoudt:communication_notes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
525babe
Inital separation of communication logs from other notes
vanoudt 2fa286d
Create new Person_Comm class to hold communication logs
vanoudt f442c69
Default to saving a copy of SMS messages
vanoudt 6ba95f5
Move existing SMS messages to the comms table
vanoudt 66bcd84
Save SMS Messages as Comms rather than Notes
vanoudt a21c0b5
Wording on failure to save
vanoudt a511fe0
Make sure that the header has the right line breaks
vanoudt 8ceccb7
Had some issues with the constraints complaining, so disabled them. N…
vanoudt a03fa3d
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt 9ed05e4
Optional saving of messages
vanoudt 4637a27
Update sample to make saving sms comms optional
vanoudt 0415ea9
Make sms logging optional
vanoudt 8ff3d0c
Make saving sms communications optional
vanoudt 694ad81
Missing ) in comment
vanoudt 0591b05
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt 92f6f02
Merge branch 'communication_notes' of github.com:vanoudt/jethro-pmm i…
vanoudt a866b4b
Merge branch 'master' into communication_notes
5251109
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt 48a78bc
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt a44d24a
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt 28e029c
Update 2019-upgrade-to-2.28.sql
vanoudt 5f78263
Update comm_reply.class.php
vanoudt 55665c0
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt 61908a2
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt fd5ae9d
Merge remote-tracking branch 'upstream/master' into communication_notes
vanoudt ab91952
Actually obey the option to save communication notes
vanoudt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
include_once 'include/db_object.class.php'; | ||
class Comm_Reply extends DB_Object | ||
{ | ||
protected $_load_permission_level = PERM_VIEWNOTE; | ||
protected $_save_permission_level = PERM_EDITNOTE; | ||
|
||
protected static function _getFields() | ||
{ | ||
return Array( | ||
'commid' => Array( | ||
'type' => 'int', | ||
'references' => 'abstract_note', | ||
'editable' => false, | ||
'label' => 'Response to', | ||
), | ||
'creator' => Array( | ||
'type' => 'int', | ||
'editable' => false, | ||
'references' => 'person', | ||
), | ||
'created' => Array( | ||
'type' => 'datetime', | ||
'readonly' => true, | ||
), | ||
'contents' => Array( | ||
'type' => 'text', | ||
'width' => 50, | ||
'height' => 5, | ||
'initial_cap' => true, | ||
'label' => '', | ||
'class' => 'initial-focus' | ||
), | ||
); | ||
} | ||
|
||
function getInitSQL($table_name=NULL) | ||
{ | ||
return " | ||
CREATE TABLE `comm_reply` ( | ||
`id` int(11) NOT NULL auto_increment, | ||
`commid` int(11) NOT NULL default '0', | ||
`creator` int(11) NOT NULL default '0', | ||
`created` timestamp NOT NULL default CURRENT_TIMESTAMP, | ||
`contents` text NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB ; | ||
"; | ||
} | ||
|
||
function getInstancesQueryComps($params, $logic, $order) | ||
{ | ||
$res = parent::getInstancesQueryComps($params, $logic, $order); | ||
$res['from'] = '('.$res['from'].') LEFT OUTER JOIN person creator ON comm_reply.creator = creator.id'; | ||
$res['select'][] = 'creator.first_name as creator_fn'; | ||
$res['select'][] = 'creator.last_name as creator_ln'; | ||
return $res; | ||
|
||
} | ||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
include_once 'db_objects/abstract_note.class.php'; | ||
class Person_Comm extends Abstract_Note | ||
{ | ||
protected static function _getFields() | ||
{ | ||
return Array( | ||
'personid' => Array( | ||
'type' => 'int', | ||
'references' => 'person', | ||
'editable' => false, | ||
'label' => 'Person', | ||
), | ||
); | ||
|
||
} | ||
|
||
|
||
function getInitSQL($table_name=NULL) | ||
{ | ||
return " | ||
CREATE TABLE `person_comm` ( | ||
`personid` int(11) NOT NULL default '0', | ||
`id` int(11) NOT NULL default '0', | ||
PRIMARY KEY (`personid`,`id`), | ||
CONSTRAINT `pn_personid` FOREIGN KEY (personid) REFERENCES _person(id) ON DELETE CASCADE, | ||
CONSTRAINT pn_id FOREIGN KEY (id) REFERENCES abstract_note(id) ON DELETE CASCADE | ||
) ENGINE=InnoDB ; | ||
"; | ||
} | ||
|
||
function printFieldValue($name, $value=NULL) | ||
{ | ||
if (is_null($value)) $value = $this->values[$name]; | ||
if ($name == 'personid') { | ||
if (!empty($value)) { | ||
$person = $GLOBALS['system']->getDBObject('person', $value); | ||
?> | ||
<a href="?view=persons&personid=<?php echo $value; ?>"><?php echo $person->toString(); ?></a> (#<?php echo $value; ?>) | ||
<?php | ||
return; | ||
} | ||
} | ||
return parent::printFieldValue($name, $value); | ||
} | ||
|
||
function getInstancesQueryComps($params, $logic, $order) | ||
{ | ||
$res = parent::getInstancesQueryComps($params, $logic, $order); | ||
$res['from'] = '('.$res['from'].') LEFT OUTER JOIN person person ON person_comm.personid = person.id'; | ||
$res['select'][] = 'person.first_name as person_fn'; | ||
$res['select'][] = 'person.last_name as person_ln'; | ||
return $res; | ||
} | ||
|
||
function printFieldInterface($name, $prefix = '') { | ||
parent::printFieldInterface($name, $prefix); | ||
} | ||
|
||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div class="notes-history-container"> | ||
<?php | ||
$GLOBALS['system']->includeDBClass('abstract_note'); | ||
$dummy = new Abstract_Note(); | ||
foreach ($comms as $id => $entry) { | ||
include 'single_comm.template.php'; | ||
} | ||
?> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
/** | ||
* @var $id | ||
* $var $entry | ||
* @var $show_form | ||
* @var $show_edit_link | ||
*/ | ||
|
||
$dummy->populate($id, $entry); | ||
$type = 1; | ||
$icon = 'phone'; | ||
?> | ||
<a name="note_<?php echo $id; ?>"></a> | ||
<div class="notes-history-entry well <?php echo $type; ?>-note" id="note_<?php echo $id; ?>"> | ||
|
||
|
||
<?php | ||
if (!empty($show_names)) { | ||
if ($entry['type'] === 1) { | ||
$type = 'sms'; | ||
$icon = 'phone'; | ||
} else { | ||
$type = 'email'; | ||
$icon = 'envelope'; | ||
} | ||
$notee = $entry['person_fn'].' '.$entry['person_ln']; | ||
$view_url = '?view=persons&personid='.$entry['personid'].'#comm_'.$id; | ||
?> | ||
<h4><a href="<?php echo $view_url; ?>"><?php echo ents($notee); ?></a></h4> | ||
<?php | ||
} | ||
?> | ||
<i class="icon-<?php echo $icon; ?>"></i> | ||
<blockquote> | ||
<p class="subject"><?php echo ents($entry['subject']); ?></p> | ||
<?php | ||
if (strlen($entry['details'])) { | ||
?> | ||
<p class="content"><?php echo nl2br(ents($entry['details'])); ?></p> | ||
<?php | ||
} | ||
?> | ||
<small class="author"> | ||
<?php echo $entry['creator_fn'].' '.$entry['creator_ln'].' <span class="visible-desktop">(#'.$entry['creator'].')</span>,'; ?> | ||
<?php echo format_datetime($entry['created']); ?> | ||
<?php | ||
?> | ||
</small> | ||
</blockquote> | ||
<?php | ||
if (!empty($entry['comments'])) { | ||
?> | ||
<div class="comments"> | ||
<?php | ||
foreach ($entry['comments'] as $comment) { | ||
?> | ||
<blockquote> | ||
<p><?php echo nl2br(ents(trim($comment['contents']))); ?></p> | ||
<small class="author"> | ||
<?php echo $comment['creator_fn'].' '.$comment['creator_ln'].' <span class="visible-desktop">(#'.$entry['creator'].')</span>, '; ?> | ||
<?php echo format_datetime($comment['created']); ?> | ||
</small> | ||
</blockquote> | ||
<?php | ||
} | ||
?> | ||
</div> | ||
<?php | ||
} | ||
|
||
|
||
?> | ||
|
||
</div> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want the roster reminder to be saved as a person_comm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Tom! Sorry to have taken so long to get back to you on this. I figured that a roster reminder was a communication to a person, and so should be saved to the communication log. Perhaps it would be better to make this optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just threw together an option which would make it optional! :-)