|
|
@@ -4,7 +4,7 @@ class Test extends Model {
|
|
|
|
|
|
protected static $table = "test";
|
|
|
protected static $id_field = "id";
|
|
|
- protected static $fillable_fields = ["project_id", "location_id", "tester_id", "status", "status_tester_invoice", "test_fee", "test_time", "test_travel_cost", "shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes", "dts_due", "dts_start", "dts_end", "dts_tester_invoice_generated", "dts_tester_invoice_paid", "verifier_id", "verifier_notes", "pass", "retest", "dts_created", "dts_updated", "dts_assigned", "dts_verified"];
|
|
|
+ protected static $fillable_fields = ["project_id", "location_id", "tester_id", "status", "status_tester_invoice", "customer_fee", "test_fee", "test_time", "test_travel_cost", "shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes", "dts_due", "dts_start", "dts_end", "dts_tester_invoice_generated", "dts_tester_invoice_paid", "verifier_id", "verifier_notes", "pass", "retest", "dts_created", "dts_updated", "dts_assigned", "dts_verified"];
|
|
|
|
|
|
const TEST_FIELDS = ["shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes"];
|
|
|
|
|
|
@@ -55,13 +55,13 @@ class Test extends Model {
|
|
|
public static function getStatusTesterInvoiceText($status) {
|
|
|
switch($status) {
|
|
|
case Test::STATUS_TESTER_INVOICE_NONE:
|
|
|
- return _("No Invoice Generated");
|
|
|
+ return __("No Invoice Generated");
|
|
|
case Test::STATUS_TESTER_INVOICE_PENDING:
|
|
|
- return _("Pending Payment");
|
|
|
+ return __("Pending Payment");
|
|
|
case Test::STATUS_TESTER_INVOICE_PAID:
|
|
|
- return _("Paid");
|
|
|
+ return __("Paid");
|
|
|
}
|
|
|
- return _("Unknown");
|
|
|
+ return __("Unknown");
|
|
|
}
|
|
|
|
|
|
public static function getStatusTesterInvoiceClass($status) {
|
|
|
@@ -94,39 +94,39 @@ class Test extends Model {
|
|
|
|
|
|
// Build
|
|
|
$builder = new EmailBuilder;
|
|
|
- $builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
|
|
|
- $builder->addLeadParagraph(_("Congrats, you have been allocated a test!"));
|
|
|
+ $builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
|
|
|
+ $builder->addLeadParagraph(__("Congrats, you have been allocated a test!"));
|
|
|
|
|
|
if($project->isNighttime()) {
|
|
|
- $builder->addParagraph("<b><font color=\"red\">" . _("Evening Test to be done between 7PM and midnight.") . "</font></b>");
|
|
|
+ $builder->addParagraph("<b><font color=\"red\">" . __("Evening Test to be done between 7PM and midnight.") . "</font></b>");
|
|
|
}
|
|
|
|
|
|
if($message) {
|
|
|
$builder->addParagraph($message);
|
|
|
}
|
|
|
|
|
|
- $builder->addParagraph(sprintf(_("We need you to confirm if you are able to do the test. Please check the details below and then confirm by pressing the %sAccept%s or %sDecline%s buttons and once you tap %sAccept%s, the test will be allocated to you."),
|
|
|
+ $builder->addParagraph(sprintf(__("We need you to confirm if you are able to do the test. Please check the details below and then confirm by pressing the %sAccept%s or %sDecline%s buttons and once you tap %sAccept%s, the test will be allocated to you."),
|
|
|
'<b>', '</b>',
|
|
|
'<b>', '</b>',
|
|
|
'<b>', '</b>'
|
|
|
));
|
|
|
$builder->addAcceptDeclineButtons($base_url);
|
|
|
- $builder->addParagraph(sprintf(_("The site address is: %s"), "<b>{$address}</b>"));
|
|
|
- $builder->addParagraph(sprintf(_("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
|
|
|
- $builder->addParagraph(sprintf(_("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
|
|
|
+ $builder->addParagraph(sprintf(__("The site address is: %s"), "<b>{$address}</b>"));
|
|
|
+ $builder->addParagraph(sprintf(__("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
|
|
|
+ $builder->addParagraph(sprintf(__("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
|
|
|
'<b>', '</b>',
|
|
|
'<b>', '</b>'
|
|
|
));
|
|
|
- $builder->addParagraph(sprintf(_("If you agree to conduct the test, log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
|
|
|
+ $builder->addParagraph(sprintf(__("If you agree to conduct the test, log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
|
|
|
'<b>', '</b>',
|
|
|
'<b>', '</b>'
|
|
|
));
|
|
|
- $builder->addParagraph(sprintf(_("If you have any questions please send them to %s or call %s on %s."),
|
|
|
+ $builder->addParagraph(sprintf(__("If you have any questions please send them to %s or call %s on %s."),
|
|
|
"<a href=\"mailto:tests@check-policy.com\">tests@check-policy.com</a>",
|
|
|
"<b>$admin_first_name</b>",
|
|
|
"<b>$admin_phone</b>"
|
|
|
));
|
|
|
- $builder->addParagraph(sprintf(_("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete. Please accept the test by tapping the %sAccept%s button and email us back saying you would like an offline form."),
|
|
|
+ $builder->addParagraph(sprintf(__("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete. Please accept the test by tapping the %sAccept%s button and email us back saying you would like an offline form."),
|
|
|
'<b>', '</b>'
|
|
|
));
|
|
|
$content = $builder->build();
|
|
|
@@ -136,7 +136,7 @@ class Test extends Model {
|
|
|
$mail->setHtmlContent($content);
|
|
|
$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
|
|
|
$mail->addAddress($tester->email, $tester->getDisplayName());
|
|
|
- $mail->setSubject(_("You have been allocated a test"));
|
|
|
+ $mail->setSubject(__("You have been allocated a test"));
|
|
|
$mail->send();
|
|
|
}
|
|
|
|
|
|
@@ -153,29 +153,29 @@ class Test extends Model {
|
|
|
|
|
|
// Build
|
|
|
$builder = new EmailBuilder;
|
|
|
- $builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
|
|
|
- $builder->addLeadParagraph(_("Congrats, you have claimed a test!"));
|
|
|
+ $builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
|
|
|
+ $builder->addLeadParagraph(__("Congrats, you have claimed a test!"));
|
|
|
|
|
|
if($project->isNighttime()) {
|
|
|
- $builder->addParagraph("<b><font color=\"red\">" . _("Evening Test to be done between 7PM and midnight.") . "</font></b>");
|
|
|
+ $builder->addParagraph("<b><font color=\"red\">" . __("Evening Test to be done between 7PM and midnight.") . "</font></b>");
|
|
|
}
|
|
|
|
|
|
- $builder->addParagraph(sprintf(_("The site address is: %s"), "<b>$address</b>"));
|
|
|
- $builder->addParagraph(sprintf(_("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
|
|
|
- $builder->addParagraph(sprintf(_("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
|
|
|
+ $builder->addParagraph(sprintf(__("The site address is: %s"), "<b>$address</b>"));
|
|
|
+ $builder->addParagraph(sprintf(__("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
|
|
|
+ $builder->addParagraph(sprintf(__("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
|
|
|
'<b>', '</b>',
|
|
|
'<b>', '</b>'
|
|
|
));
|
|
|
- $builder->addParagraph(sprintf(_("Log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
|
|
|
+ $builder->addParagraph(sprintf(__("Log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
|
|
|
'<b>', '</b>',
|
|
|
'<b>', '</b>'
|
|
|
));
|
|
|
- $builder->addParagraph(sprintf(_("If you have any questions please send them to %s or call %s on %s."),
|
|
|
+ $builder->addParagraph(sprintf(__("If you have any questions please send them to %s or call %s on %s."),
|
|
|
"<a href=\"mailto:tests@check-policy.com\">tests@check-policy.com</a>",
|
|
|
"<b>$admin_first_name</b>",
|
|
|
"<b>$admin_phone</b>"
|
|
|
));
|
|
|
- $builder->addParagraph(_("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete."));
|
|
|
+ $builder->addParagraph(__("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete."));
|
|
|
$content = $builder->build();
|
|
|
|
|
|
// Send
|
|
|
@@ -183,7 +183,7 @@ class Test extends Model {
|
|
|
$mail->setHtmlContent($content);
|
|
|
$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
|
|
|
$mail->addAddress($tester->email, $tester->getDisplayName());
|
|
|
- $mail->setSubject(_("You have claimed a test"));
|
|
|
+ $mail->setSubject(__("You have claimed a test"));
|
|
|
$mail->send();
|
|
|
}
|
|
|
|
|
|
@@ -216,7 +216,7 @@ class Test extends Model {
|
|
|
$mail = new Email;
|
|
|
$mail->setHtmlContent($content);
|
|
|
$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
|
|
|
- $mail->addAddress(EMAIL_CONTACT, "Check Policy Contact");
|
|
|
+ $mail->addAddress(EMAIL_CONTACT, APP_NAME . " Contact");
|
|
|
$mail->setSubject("Test declined: $project->name / $location->name");
|
|
|
$mail->send();
|
|
|
}
|
|
|
@@ -258,9 +258,16 @@ class Test extends Model {
|
|
|
$pdf_path = $this->getDirectory() . "/pdf.pdf";
|
|
|
$pdf_name = implode(" - ", array_filter([$location->internal_id, date("jS M Y")])) . ".pdf";
|
|
|
|
|
|
+ // Lead paragraph
|
|
|
+ $lead_paragraph = "";
|
|
|
+ if($this->pass) {
|
|
|
+ $lead_paragraph .= "Congratulations!<br />";
|
|
|
+ }
|
|
|
+ $lead_paragraph .= "A test has been completed at your location.";
|
|
|
+
|
|
|
// Build
|
|
|
$builder = new EmailBuilder;
|
|
|
- $builder->addLeadParagraph("Congratulations!<br />A test has been completed at your location.");
|
|
|
+ $builder->addLeadParagraph($lead_paragraph);
|
|
|
$builder->addParagraph("Please see attached PDF and do not hesitate to contact us if you have any questions.");
|
|
|
$content = $builder->build();
|
|
|
|
|
|
@@ -379,7 +386,7 @@ class Test extends Model {
|
|
|
|
|
|
public function getPassText() {
|
|
|
if(is_null($this->pass)) return "Pending";
|
|
|
- return $this->pass ? _("Pass") : _("Fail");
|
|
|
+ return $this->pass ? __("Pass") : __("Fail");
|
|
|
}
|
|
|
|
|
|
public function getMPDF() {
|