Skip to content

Commit

Permalink
CRN suffix on merge field title; Comments (v3.0.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsthompson committed May 15, 2024
1 parent ffcff7f commit fa0513c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions includes/hooks/bpay_getCRN_byCUST.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// BPAY for WHMCS - (v3.0.1) - Reliable CRN Generation & Handling (this file: GENERATION BY CUSTOMER ID)
// BPAY for WHMCS - (v3.0.2) - Reliable CRN Generation & Handling (this file: GENERATION BY CUSTOMER ID)
//
// Adds a BPAY CRN with a MOD10 version 5 check digit for client-related emails and returns it as a merge field.
// You can then use the {$bpay_reference} merge field in WHMCS Admin > Email Templates, to render the CRN.
Expand Down Expand Up @@ -30,6 +30,7 @@
die('This file cannot be accessed directly');
}

// Customer ID generation method requires DB to cross-reference unique (rel) ID
use WHMCS\Database\Capsule;

/**
Expand Down Expand Up @@ -62,6 +63,7 @@ function addMod10v5CheckDigit($number) {
return $number . $checkdigit;
}

// Suffix the check digit through the above function; then return the Merge Field
add_hook('EmailPreSend', 1, function($vars) {
// Initialise merge fields array
$merge_fields = [];
Expand Down Expand Up @@ -90,8 +92,9 @@ function addMod10v5CheckDigit($number) {
return $merge_fields;
});

// Present the Merge Field in the GUI, when editing Email Templates
add_hook('EmailTplMergeFields', 1, function($vars) {
$merge_fields = [];
$merge_fields['bpay_reference'] = "BPAY Reference";
$merge_fields['bpay_reference'] = "BPAY Reference (CRN)";
return $merge_fields;
});
6 changes: 4 additions & 2 deletions includes/hooks/bpay_getCRN_byINV.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// BPAY for WHMCS - (v3.0.1) - Reliable CRN Generation & Handling (this file: GENERATION BY INVOICE ID)
// BPAY for WHMCS - (v3.0.2) - Reliable CRN Generation & Handling (this file: GENERATION BY INVOICE ID)
//
// Adds a BPAY CRN with a MOD10 version 5 check digit for client-related emails and returns it as a merge field.
// You can then use the {$bpay_reference} merge field in WHMCS Admin > Email Templates, to render the CRN.
Expand Down Expand Up @@ -60,6 +60,7 @@ function addMod10v5CheckDigit($number) {
return $number . $checkdigit;
}

// Suffix the check digit through the above function; then return the Merge Field
add_hook('EmailPreSend', 1, function($vars) {
// Initialise merge fields array
$merge_fields = [];
Expand All @@ -83,8 +84,9 @@ function addMod10v5CheckDigit($number) {
return $merge_fields;
});

// Present the Merge Field in the GUI, when editing Email Templates
add_hook('EmailTplMergeFields', 1, function($vars) {
$merge_fields = [];
$merge_fields['bpay_reference'] = "BPAY Reference";
$merge_fields['bpay_reference'] = "BPAY Reference (CRN)";
return $merge_fields;
});

0 comments on commit fa0513c

Please sign in to comment.