Skip to content

Commit

Permalink
Family External Information Verify (#1570)
Browse files Browse the repository at this point in the history
* 1st commit for verify code

working views
- enter data
- view family

* add get people by Role

* fixed get photo

* using SystemURLs::getDocumentRoot()

* added getPeopleSorted

* sRootPath = SystemURLs::getRootPath()

* no longer passing sRootPath

* people are displayed in order

* added Tokens table

* removed invalid head Classification

* added missing SystemURLs use

* fixed ORM debug string

* verify by token is working

* added valid token check

* Renamed the class token not tokens

* final tokens table sql

* check to make sure we have the family in the db before rendering

* fixed renaming

* added more helper methdos and new isValid Logic

* added verify api to create the token for now

* php cleanup

* added getId

* moved FamilyVerify to API call

* Moved family verify to API call

* moved verifyDownloadPDF to button click and remove Email PDF

* there is no role 7

* Send Email with Verification Token

* Moved Confirm PDF email to Email Classes

* Moved ConfirmReport to Member Dashbaord

No need to hide it

* removed unsued buttons

* created BaseFamilyVerification

* added default index to getURL

* MVP no self request of the info

* moved JS to new JS file

* passing token to page

* new flooting buttons for verify/update/remove info

* now consume a use if a token has a max count

* Update Token Table

- renamed useCount to setRemainingUses
- updated verify to verifyFamily
- added verifyPerson

* renamed emails var to toAddresses

* updated route to /families/{id}/family

* default auth on smtp is off

* fixed naming issue

* Single verify button

* added gettext where missing

* added 404 page

* check group size

* select verification

* adding note when user submits info

* submit data and handle errors

* fixed getSendNewsletter

* fixed SMTP

* delete old token for the fmaily

* format cleanup

* Updated Confirm button with text also

* Apply fixes from StyleCI (#1619)
  • Loading branch information
DawoudIO authored Jan 9, 2017
1 parent 10b03c3 commit 50a6680
Show file tree
Hide file tree
Showing 34 changed files with 1,957 additions and 1,150 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ trim_trailing_whitespace = true

# 2 space indentation
[*.{php,scss,js,json}]
indent_size = 2
indent_size = 4
charset = utf-8
2 changes: 1 addition & 1 deletion demo/ChurchCRM-Database.sql

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions propel/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,17 @@
</vendor>
</table>

<table name="tokens" idMethod="native" phpName="Token">
<column name="token" phpName="Token" type="VARCHAR" primaryKey="true" required="true"/>
<column name="type" phpName="Type" type="VARCHAR" required="true"/>
<column name="valid_until_date" phpName="ValidUntilDate" type="DATE"/>
<column name="reference_id" phpName="ReferenceId" type="INTEGER" defaultValue=""/>
<column name="remainingUses" phpName="RemainingUses" type="INTEGER" defaultValue="0"/>
<vendor type="mysql">
<parameter name="Engine" value="MyISAM"/>
</vendor>
</table>

<!--
<table name="istlookup_lu" idMethod="native" phpName="IstlookupLu" >
<column name="lu_fam_ID" phpName="LuFamId" type="SMALLINT" size="9" primaryKey="true" required="true" defaultValue="0"/>
Expand Down
48 changes: 48 additions & 0 deletions src/ChurchCRM/Emails/BaseEmail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
namespace ChurchCRM\Emails;

use ChurchCRM\dto\SystemConfig;

class BaseEmail
{
protected $ChurchName;
/** @var \PHPMailer */
protected $mail;

public function __construct($toAddresses)
{
$this->setConnection();
$this->ChurchName = SystemConfig::getValue("sChurchName");
$this->mail->setFrom(SystemConfig::getValue("sChurchEmail"), $this->ChurchEmail);
foreach ($toAddresses as $email) {
$this->mail->addAddress($email);
}
}

private function setConnection()
{

$this->mail = new \PHPMailer();
$this->mail->IsSMTP();
$this->mail->CharSet = 'UTF-8';
$this->mail->Host = SystemConfig::getValue("sSMTPHost");
if (SystemConfig::getBooleanValue("sSMTPAuth")) {
$this->mail->SMTPAuth = true;
$this->mail->Username = SystemConfig::getValue("sSMTPUser");
$this->mail->Password = SystemConfig::getValue("sSMTPPass");
}
//$this->mail->SMTPDebug = 2;
}

public function send(){
return $this->mail->send();
}

public function getError(){
return $this->mail->ErrorInfo;
}

public function addStringAttachment($string,$filename) {
$this->mail->addStringAttachment($string,$filename);
}
}
40 changes: 40 additions & 0 deletions src/ChurchCRM/Emails/BaseFamilyVerification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace ChurchCRM\Emails;

use ChurchCRM\dto\SystemConfig;

abstract class BaseFamilyVerification extends BaseEmail
{

protected $familyName;

public function __construct($emails, $familyName)
{
parent::__construct($emails);
$this->familyName = $familyName;
$this->mail->Subject = gettext($familyName . ": " . gettext("Please verify your family's information"));
$this->mail->isHTML(true);
$this->mail->msgHTML($this->buildMessage());
}

protected function buildMessage(){
$msg = array();
array_push($msg, $this->buildMessageHeader());
array_push($msg, $this->buildMessageBody());
array_push($msg, $this->buildMessageFooter());
return implode("<p/>", $msg);
}

protected function buildMessageHeader()
{
return gettext("Dear") ." " . $this->familyName . " " . gettext("Family");
}

protected function buildMessageFooter()
{
return gettext("Sincerely") . "<br/>" . SystemConfig::getValue("sConfirmSigner");
}

protected abstract function buildMessageBody();

}
20 changes: 20 additions & 0 deletions src/ChurchCRM/Emails/FamilyVerificationEmail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
namespace ChurchCRM\Emails;
use ChurchCRM\dto\SystemURLs;

class FamilyVerificationEmail extends BaseFamilyVerification
{

private $link;

public function __construct($emails, $familyName, $token)
{
$this->link = SystemURLs::getURL() . "external/verify/" . $token;
parent::__construct($emails, $familyName);
}

protected function buildMessageBody() {
return "<a href='".$this->link."'>".$this->link."</a>";
}

}
14 changes: 14 additions & 0 deletions src/ChurchCRM/Emails/FamilyVerificationPDFEmail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace ChurchCRM\Emails;

use ChurchCRM\dto\SystemConfig;
use ChurchCRM\dto\SystemURLs;

class FamilyVerificationPDFEmail extends BaseFamilyVerification
{

protected function buildMessageBody() {
return SystemConfig::getValue("sConfirm1");
}

}
Loading

0 comments on commit 50a6680

Please sign in to comment.