mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Fix the email_from when using per domain settings
Remove extra new database objects to make the code more efficient
This commit is contained in:
@@ -98,7 +98,6 @@
|
||||
$parameters['fax_uuid'] = $fax_uuid;
|
||||
$parameters['user_uuid'] = $user_uuid;
|
||||
}
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
//set database fields as variables
|
||||
@@ -195,7 +194,6 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
//check if the domain is enabled
|
||||
$sql = "select domain_enabled::text from v_domains where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if ($row['domain_enabled'] == "true") {
|
||||
$domain_enabled = true;
|
||||
@@ -205,6 +203,9 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
//initialize database and settings
|
||||
$settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid, 'user_uuid' => $user_uuid]);
|
||||
|
||||
//clear file status cache
|
||||
clearstatcache();
|
||||
|
||||
@@ -680,7 +681,6 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
//get the fax mail to address and fax prefix
|
||||
$sql = "select * from v_fax where fax_uuid = :fax_uuid ";
|
||||
$parameters['fax_uuid'] = $fax_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
//$mail_to_address = $row["fax_email"];
|
||||
$fax_prefix = $row["fax_prefix"];
|
||||
@@ -692,7 +692,6 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
} else {
|
||||
$sql = "select user_email from v_users where user_uuid = :user_uuid ";
|
||||
$parameters['user_uuid'] = $user_uuid;
|
||||
$database = new database;
|
||||
$user_settings = $database->select($sql, $parameters, 'row');
|
||||
|
||||
$mail_to_address = $user_settings["user_email"];
|
||||
@@ -735,7 +734,6 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
$sql .= "and dialplan_detail_data like 'provider_prefix%' ";
|
||||
$sql .= "and dialplan_detail_enabled = 'true' ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
$dialplan_detail_data = $row["dialplan_detail_data"];
|
||||
unset($sql, $parameters, $row);
|
||||
@@ -846,7 +844,6 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
$p->add('fax_queue_add', 'temp');
|
||||
|
||||
//save the data
|
||||
$database = new database;
|
||||
$database->app_name = 'fax queue';
|
||||
$database->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
|
||||
$database->save($array);
|
||||
@@ -921,7 +918,6 @@ if (!defined('STDIN')) {
|
||||
}
|
||||
}
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$contacts = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
@@ -1226,4 +1222,5 @@ function showgrid($pdf) {
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
@@ -138,7 +138,6 @@
|
||||
}
|
||||
$parameters['limit'] = $fax_queue_limit;
|
||||
$parameters['retry_interval'] = $fax_retry_interval;
|
||||
$database = new database;
|
||||
$fax_queue = $database->select($sql, $parameters, 'all');
|
||||
unset($parameters);
|
||||
|
||||
|
||||
@@ -61,9 +61,6 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
//connect to the database
|
||||
$database = new database;
|
||||
|
||||
//shutdown call back function
|
||||
function shutdown() {
|
||||
//when the fax status is still sending
|
||||
@@ -72,7 +69,6 @@
|
||||
$sql .= "set fax_status = 'trying' ";
|
||||
$sql .= "where fax_queue_uuid = :fax_queue_uuid ";
|
||||
$sql .= "and fax_status = 'sending' ";
|
||||
$database = new database;
|
||||
$parameters['fax_queue_uuid'] = $fax_queue_uuid;
|
||||
$database->execute($sql, $parameters);
|
||||
unset($sql);
|
||||
@@ -184,6 +180,9 @@
|
||||
}
|
||||
unset($parameters);
|
||||
|
||||
//get the settings object
|
||||
$settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid]);
|
||||
|
||||
//prepare the smtp from and from name variables
|
||||
$email_from = $settings->get('fax','smtp_from');
|
||||
$email_from_name = $settings->get('fax','smtp_from_name');
|
||||
@@ -195,7 +194,6 @@
|
||||
}
|
||||
|
||||
//prepare the variables to send the fax
|
||||
$email_from_address = $email_from;
|
||||
$retry_limit = $settings->get('fax_queue','retry_limit');
|
||||
|
||||
//prepare the fax retry count
|
||||
@@ -389,7 +387,7 @@
|
||||
$dial_string .= "fax_uuid=" . $fax_uuid . ",";
|
||||
$dial_string .= "fax_queue_uuid=" . $fax_queue_uuid . ",";
|
||||
$dial_string .= "mailto_address='" . $fax_email_address . "',";
|
||||
$dial_string .= "mailfrom_address='" . $email_from_address . "',";
|
||||
$dial_string .= "mailfrom_address='" . $email_from . "',";
|
||||
$dial_string .= "fax_retry_attempts=" . $fax_retry_count . ",";
|
||||
$dial_string .= "fax_retry_limit=" . $retry_limit . ",";
|
||||
$dial_string .= "fax_recipient='" . escape_quote($fax_recipient) . "',";
|
||||
@@ -619,7 +617,7 @@
|
||||
$email->recipients = $email_address;
|
||||
$email->subject = $email_subject;
|
||||
$email->body = $email_body;
|
||||
$email->from_address = $email_from_address;
|
||||
$email->from_address = $email_from;
|
||||
$email->from_name = $email_from_name;
|
||||
$email->attachments = $email_attachments;
|
||||
$email->debug_level = 3;
|
||||
@@ -632,7 +630,7 @@
|
||||
echo "template_subcategory: ".$template_subcategory."\n";
|
||||
echo "email_adress: ".$email_address."\n";
|
||||
echo "email_from: ".$email_from_name."\n";
|
||||
echo "email_from_name: ".$email_from_address."\n";
|
||||
echo "email_from_name: ".$email_from."\n";
|
||||
echo "email_subject: ".$email_subject."\n";
|
||||
//echo "email_body: ".$email_body."\n";
|
||||
echo "email_error: ".$email_error."\n";
|
||||
|
||||
Reference in New Issue
Block a user