mirror of https://github.com/itflow-org/itflow
Update a few var names for the new mail addToMailQueue function
This commit is contained in:
parent
a35a6f3ea0
commit
cdaca0e06b
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
require_once "inc_all.php";
|
||||
|
||||
require_once "dashboard_nav.php";
|
||||
//require_once "dashboard_nav.php";
|
||||
|
||||
|
||||
// Enforce accountant / admin role for the financial dashboard
|
||||
|
|
@ -25,6 +25,42 @@ $sql_years_select = mysqli_query(
|
|||
ORDER BY all_years DESC
|
||||
");
|
||||
|
||||
?>
|
||||
|
||||
<form class="form-inline">
|
||||
|
||||
<select onchange="this.form.submit()" class="form-control mb-2 mr-sm-2" name="year">
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_years_select)) {
|
||||
$year_select = $row['all_years'];
|
||||
if (empty($year_select)) {
|
||||
$year_select = date('Y');
|
||||
}
|
||||
?>
|
||||
<option <?php if ($year == $year_select) { echo "selected"; } ?> > <?php echo $year_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<div class="custom-control custom-switch mr-sm-2 mb-2">
|
||||
<input type="checkbox" class="custom-control-input" id="customSwitch1" name="show_financial" value="1" <?php if(isset($_GET['show_financial']) == 1) { echo "checked"; } ?>>
|
||||
<label class="custom-control-label" for="customSwitch1">Toggle Financial</label>
|
||||
</div>
|
||||
|
||||
<div class="custom-control custom-switch mb-2">
|
||||
<input type="checkbox" class="custom-control-input" id="customSwitch2" name="show_technical" value="1" <?php if(isset($_GET['show_technical']) == 1) { echo "checked"; } ?>>
|
||||
<label class="custom-control-label" for="customSwitch2">Toggle Technical</label>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_GET['show_financial']) == 1) {
|
||||
|
||||
//Define var so it doesnt throw errors in logs
|
||||
$largest_income_month = 0;
|
||||
|
||||
|
|
@ -119,25 +155,6 @@ $vendors_added = intval($row['vendors_added']);
|
|||
|
||||
?>
|
||||
|
||||
<form class="mb-3">
|
||||
<select onchange="this.form.submit()" class="form-control" name="year">
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_years_select)) {
|
||||
$year_select = $row['all_years'];
|
||||
if (empty($year_select)) {
|
||||
$year_select = date('Y');
|
||||
}
|
||||
?>
|
||||
<option <?php if ($year == $year_select) { echo "selected"; } ?> > <?php echo $year_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<!-- Icon Cards-->
|
||||
<div class="row">
|
||||
<div class="col-lg-4 col-md-6 col-sm-12">
|
||||
|
|
@ -493,6 +510,161 @@ $vendors_added = intval($row['vendors_added']);
|
|||
</div>
|
||||
</div> <!-- row -->
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<!-- Technical Dashboard -->
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_GET['show_technical']) == 1) {
|
||||
|
||||
// Get Total Clients added
|
||||
$sql_clients = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('client_id') AS clients_added FROM clients
|
||||
WHERE YEAR(client_created_at) = $year"
|
||||
));
|
||||
$clients_added = $sql_clients['clients_added'];
|
||||
|
||||
// Get Total contacts added
|
||||
$sql_contacts = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('contact_id') AS contacts_added FROM contacts
|
||||
WHERE YEAR(contact_created_at) = $year"
|
||||
));
|
||||
$contacts_added = $sql_contacts['contacts_added'];
|
||||
|
||||
// Get Total assets added
|
||||
$sql_assets = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('asset_id') AS assets_added FROM assets
|
||||
WHERE YEAR(asset_created_at) = $year"
|
||||
));
|
||||
$assets_added = $sql_assets['assets_added'];
|
||||
|
||||
// Ticket count
|
||||
$sql_tickets = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('ticket_id') AS active_tickets
|
||||
FROM tickets
|
||||
WHERE ticket_status != 'Closed'"
|
||||
));
|
||||
$active_tickets = $sql_tickets['active_tickets'];
|
||||
|
||||
// Expiring domains (but not ones that have already expired)
|
||||
$sql_domains_expiring = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('domain_id') as expiring_domains
|
||||
FROM domains
|
||||
WHERE domain_expire IS NOT NULL
|
||||
AND domain_expire > CURRENT_DATE
|
||||
AND domain_expire < CURRENT_DATE + INTERVAL 30 DAY
|
||||
AND domain_archived_at IS NULL"
|
||||
));
|
||||
$expiring_domains = $sql_domains_expiring['expiring_domains'];
|
||||
|
||||
// Expiring Certificates (but not ones that have already expired)
|
||||
$sql_certs_expiring = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('certificate_id') as expiring_certs
|
||||
FROM certificates
|
||||
WHERE certificate_expire IS NOT NULL
|
||||
AND certificate_expire > CURRENT_DATE
|
||||
AND certificate_expire < CURRENT_DATE + INTERVAL 30 DAY
|
||||
AND certificate_archived_at IS NULL"
|
||||
));
|
||||
$expiring_certificates = $sql_certs_expiring['expiring_certs'];
|
||||
|
||||
?>
|
||||
|
||||
<!-- Icon Cards-->
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<!-- small box -->
|
||||
<a class="small-box bg-secondary" href="clients.php?date_from=<?php echo $year; ?>-01-01&date_to=<?php echo $year; ?>-12-31">
|
||||
<div class="inner">
|
||||
<h3><?php echo $clients_added; ?></h3>
|
||||
<p>New Clients</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-users"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<a class="small-box bg-success">
|
||||
<div class="inner">
|
||||
<h3><?php echo $contacts_added; ?></h3>
|
||||
<p>New Contacts</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<a class="small-box bg-info" href="/report_all_assets_by_client.php">
|
||||
<div class="inner">
|
||||
<h3><?php echo $assets_added; ?></h3>
|
||||
<p>New Assets</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-desktop"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<a class="small-box bg-danger" href="tickets.php">
|
||||
<div class="inner">
|
||||
<h3><?php echo $active_tickets; ?></h3>
|
||||
<p>Active Tickets</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-ticket-alt"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<a class="small-box bg-warning">
|
||||
<div class="inner">
|
||||
<h3><?php echo $expiring_domains; ?></h3>
|
||||
<p>Expiring Domains</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-globe"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<a class="small-box bg-primary">
|
||||
<div class="inner">
|
||||
<h3><?php echo $expiring_certificates; ?></h3>
|
||||
<p>Expiring Certificates</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-lock"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
|
||||
</div> <!-- rows -->
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<!-- End Tech Dashboard -->
|
||||
|
||||
<?php require_once "footer.php";
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -879,8 +879,8 @@ function addToMailQueue($mysqli, $data) {
|
|||
$config_invoice_from_name = strval(getSettingValue($mysqli, 'config_invoice_from_name'));
|
||||
|
||||
foreach ($data as $email) {
|
||||
$recipient = strval($email['email']);
|
||||
$recipient_name = strval($email['name']);
|
||||
$recipient = strval($email['recipient']);
|
||||
$recipient_name = strval($email['recipient_name']);
|
||||
$subject = strval($email['subject']);
|
||||
$body = strval($email['body']);
|
||||
|
||||
|
|
|
|||
|
|
@ -1002,8 +1002,8 @@ if (isset($_GET['email_invoice'])) {
|
|||
// Queue Mail
|
||||
$data = [
|
||||
[
|
||||
'email' => $contact_email_escaped,
|
||||
'name' => $contact_name_escaped,
|
||||
'recipient' => $contact_email_escaped,
|
||||
'recipient_name' => $contact_name_escaped,
|
||||
'subject' => $subject,
|
||||
'body' => $body
|
||||
]
|
||||
|
|
@ -1043,8 +1043,8 @@ if (isset($_GET['email_invoice'])) {
|
|||
|
||||
$data = [
|
||||
[
|
||||
'email' => $billing_contact_email,
|
||||
'name' => $billing_contact_name,
|
||||
'recipient' => $billing_contact_email,
|
||||
'recipient_name' => $billing_contact_name,
|
||||
'subject' => $subject,
|
||||
'body' => $body
|
||||
]
|
||||
|
|
@ -1172,8 +1172,8 @@ if (isset($_GET['force_recurring'])) {
|
|||
|
||||
$data = [
|
||||
[
|
||||
'email' => $contact_email,
|
||||
'name' => $contact_name,
|
||||
'recipient' => $contact_email,
|
||||
'recipient_name' => $contact_name,
|
||||
'subject' => $subject,
|
||||
'body' => $body
|
||||
]
|
||||
|
|
|
|||
|
|
@ -119,12 +119,13 @@ if (isset($_POST['add_ticket'])) {
|
|||
|
||||
// Email Ticket Contact
|
||||
// Queue Mail
|
||||
$data = [];
|
||||
$data[] = [
|
||||
'recipient' => $contact_email_escaped,
|
||||
'recipient_name' => $contact_name_escaped,
|
||||
'subject' => $subject_escaped,
|
||||
'body' => $body_escaped,
|
||||
$data = [
|
||||
[
|
||||
'recipient' => $contact_email_escaped,
|
||||
'recipient_name' => $contact_name_escaped,
|
||||
'subject' => $subject_escaped,
|
||||
'body' => $body_escaped,
|
||||
]
|
||||
];
|
||||
|
||||
// Also Email all the watchers
|
||||
|
|
@ -134,11 +135,13 @@ if (isset($_POST['add_ticket'])) {
|
|||
$watcher_email_escaped = sanitizeInput($row['watcher_email']);
|
||||
|
||||
// Queue Mail
|
||||
$data[] = [
|
||||
'recipient' => $watcher_email_escaped,
|
||||
'recipient_name' => $watcher_email_escaped,
|
||||
'subject' => $subject_escaped,
|
||||
'body' => $body_escaped,
|
||||
$data = [
|
||||
[
|
||||
'recipient' => $watcher_email_escaped,
|
||||
'recipient_name' => $watcher_email_escaped,
|
||||
'subject' => $subject_escaped,
|
||||
'body' => $body_escaped,
|
||||
]
|
||||
];
|
||||
}
|
||||
addToMailQueue($mysqli, $data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue