I just looked at this module for someone who was experiencing problems with it not sending emails for bulk uploads. What I found was that if you have a 1 or zero in the csv file for send_welcome (as per the formatting guide), then there was no way any email could be sent. The module version being referred to here is 1.05
The statement at line 70 of add_customers_backend.php:is going to insert a value of 1 for $send_welcome even if you have a 0 in that field, because it's not even checking for a 0. So even if you had all lines set to 0 for send_welcome, you'd expect that every line would get an email sent as a result of that error. However, at line 415, the only condition under which the email will be sent is:PHP Code:, 'send_welcome'=>(in_array(strtolower(get_row_id('send_welcome', $line)), array(false,'','n','no')) ? 0:1)
To correct this problem, line 70 of add_customers_backend.php should be changed to:PHP Code:if($send_welcome == 'send')
but wait - there's more...PHP Code:, 'send_welcome'=>(in_array(strtolower(get_row_id('send_welcome', $line)), array(false,'','n','no','0')) ? 0:'send')
at line 376, in the function insert_customer(), there is this code:Now, some people have been reporting in this thread that they are seeing php warnings from line 377 - this is why: there is no variable $entry_gender set. The variable that should be being checked is actually $customers_gender.PHP Code:if (ACCOUNT_GENDER == 'true') {
if (!in_array(array('m','f'), substr(strtolower($entry_gender), 0, 1))) {
$errors[] = 'Gender not recognised. Expected "m" or "f", got: ' . $entry_gender;
}
$sql_data_array['entry_gender'] = $entry_gender;
}
This check has no place here in this function anyway - it should be part of the function validate_customer() - and what's the point of using(using the correct variable) when $customers_gender has already been set to a single lowercase character string at lines 50 and 51?PHP Code:substr(strtolower($customers_gender), 0, 1)
One final point:
I also found during troubleshooting this module that if there was only a single error in the csv file, and you have it set to process only if no errors, you get bounced right back to the start with no error message and no customers processed. In the file add_customers.php at line 66 is this condition for displaying errors:That's fine if you have more than one error, but if you have only one, then it won't get displayed. That line needs to be:PHP Code:if (count($errors) > 1) {
A zip file with corrections for the above errors is attached to this post.PHP Code:if (count($errors) > 0) {


Reply With Quote
