mirror of https://github.com/itflow-org/itflow
DB Structure Update table name alerts is now notifications also update the fields accordingly to the notifications table - Reworked Notifications a bit
This commit is contained in:
parent
fab9bcfa23
commit
05e7b160b1
55
alerts.php
55
alerts.php
|
|
@ -1,55 +0,0 @@
|
|||
<?php include("header.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM alerts WHERE alert_ack_date IS NULL AND company_id = $session_company_id ORDER BY alert_id DESC");
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-exclamation-triangle"></i> Alerts</h3>
|
||||
<div class="card-tools">
|
||||
<a href="post.php?ack_all_alerts" class="btn btn-primary"> <i class="fa fa-check"></i> Acknowledge All</a>
|
||||
<a href="alerts_archived.php" class="btn btn-secondary">Archived</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Type</th>
|
||||
<th>Alert</th>
|
||||
<th class="text-center">Ack</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$alert_id = $row['alert_id'];
|
||||
$alert_type = $row['alert_type'];
|
||||
$alert_message = $row['alert_message'];
|
||||
$alert_date = $row['alert_date'];
|
||||
|
||||
?>
|
||||
<tr class="row-danger">
|
||||
<td><?php echo $alert_date; ?></td>
|
||||
<td><?php echo $alert_type; ?></td>
|
||||
<td><?php echo $alert_message; ?></td>
|
||||
<td class="text-center"><a class="btn btn-success btn-sm" href="post.php?alert_ack=<?php echo $alert_id; ?>"><i class="fa fa-check"></a></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("footer.php");
|
||||
|
|
@ -85,9 +85,9 @@
|
|||
$session_map_source = "google";
|
||||
}
|
||||
|
||||
//Get unAcked Alert Count for the badge on the top nav
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('alert_id') AS num FROM alerts WHERE alert_ack_date IS NULL AND company_id = $session_company_id"));
|
||||
$num_alerts = $row['num'];
|
||||
//Get Notification Count for the badge on the top nav
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('notification_id') AS num FROM notifications WHERE notification_dismissed_at IS NULL AND company_id = $session_company_id"));
|
||||
$num_notifications = $row['num'];
|
||||
|
||||
//Set Currency Format
|
||||
$currency_format = numfmt_create($session_company_locale, NumberFormatter::CURRENCY);
|
||||
|
|
|
|||
12
cron.php
12
cron.php
|
|
@ -44,7 +44,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
|
||||
if($config_enable_cron == 1){
|
||||
|
||||
// GET ALERTS
|
||||
// GET Notifications
|
||||
|
||||
// DOMAINS EXPIRING
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $domain_name for $client_name will expire in $day Days on $domain_expire', alert_date = NOW(), company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Domain', notification = 'Domain $domain_name for $client_name will expire in $day Days on $domain_expire', notification_timestamp = NOW(), company_id = $company_id");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Certificate', alert_message = 'Certificate $certificate_name for $client_name will expire in $day Days on $certificate_expire', alert_date = NOW(), company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Certificate', notification = 'Certificate $certificate_name for $client_name will expire in $day Days on $certificate_expire', notification_timestamp = NOW(), company_id = $company_id");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$contact_name = $row['contact_name'];
|
||||
$contact_email = $row['contact_email'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Invoice', alert_message = 'Invoice $invoice_prefix$invoice_number for $client_name in the amount of $invoice_amount is overdue by $day days', alert_date = NOW(), company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Invoice', notification = 'Invoice $invoice_prefix$invoice_number for $client_name in the amount of $invoice_amount is overdue by $day days', notification_timestamp = NOW(), company_id = $company_id");
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Invoice Generated from Recurring!', history_created_at = NOW(), history_invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Recurring', alert_message = 'Recurring Invoice $config_invoice_prefix$new_invoice_number for $client_name Sent', alert_date = NOW(), company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Recurring', notification = 'Recurring Invoice $config_invoice_prefix$new_invoice_number for $client_name Sent', notification_timestamp = NOW(), company_id = $company_id");
|
||||
|
||||
//Update recurring dates
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
} //End if Autosend is on
|
||||
} //End Recurring Invoices Loop
|
||||
//Send Alert to inform Cron was run
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Cron', alert_message = 'Cron.php successfully executed', alert_date = NOW(), company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Cron', notification = 'Cron.php successfully executed', notification_timestamp = NOW(), company_id = $company_id");
|
||||
} //End Cron Check
|
||||
|
||||
} //End Company Loop through
|
||||
|
|
|
|||
41
db.sql
41
db.sql
|
|
@ -36,24 +36,6 @@ CREATE TABLE `accounts` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `alerts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `alerts`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `alerts` (
|
||||
`alert_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`alert_type` varchar(200) NOT NULL,
|
||||
`alert_message` varchar(255) NOT NULL,
|
||||
`alert_date` datetime NOT NULL,
|
||||
`alert_ack_date` datetime DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`alert_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `api_keys`
|
||||
--
|
||||
|
|
@ -541,6 +523,8 @@ DROP TABLE IF EXISTS `folders`;
|
|||
CREATE TABLE `folders` (
|
||||
`folder_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`folder_name` varchar(200) NOT NULL,
|
||||
`parent_folder` int(11) DEFAULT NULL,
|
||||
`folder_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`folder_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
@ -753,6 +737,25 @@ CREATE TABLE `networks` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `notifications`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `notifications`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `notifications` (
|
||||
`notification_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`notification_type` varchar(200) NOT NULL,
|
||||
`notification` varchar(255) NOT NULL,
|
||||
`notification_timestamp` datetime NOT NULL,
|
||||
`notification_dismissed_at` datetime DEFAULT NULL,
|
||||
`notification_dismissed_by` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`notification_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `payments`
|
||||
--
|
||||
|
|
@ -1445,4 +1448,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-02-20 17:01:28
|
||||
-- Dump completed on 2022-02-21 21:19:40
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ $config_ticket_next_number = $row['config_ticket_next_number'];
|
|||
$config_ticket_from_name = $row['config_ticket_from_name'];
|
||||
$config_ticket_from_email = $row['config_ticket_from_email'];
|
||||
|
||||
//Alerts
|
||||
// Alerts
|
||||
$config_enable_cron = $row['config_enable_cron'];
|
||||
|
||||
$config_recurring_auto_send_invoice = $row['config_recurring_auto_send_invoice'];
|
||||
|
|
@ -57,15 +57,19 @@ $config_enable_alert_domain_expire = $row['config_enable_alert_domain_expire'];
|
|||
$config_send_invoice_reminders = $row['config_send_invoice_reminders'];
|
||||
$config_invoice_overdue_reminders = $row['config_invoice_overdue_reminders'];
|
||||
|
||||
//Online Payment
|
||||
// Online Payment
|
||||
$config_stripe_enable = $row['config_stripe_enable'];
|
||||
$config_stripe_publishable = $row['config_stripe_publishable'];
|
||||
$config_stripe_secret = $row['config_stripe_secret'];
|
||||
|
||||
//Currency
|
||||
// Currency
|
||||
|
||||
$config_currency_format = "US_en";
|
||||
|
||||
// Theme
|
||||
$config_enable_dark_mode = "dark_mode";
|
||||
|
||||
|
||||
$colors_array = array(
|
||||
'green',
|
||||
'olive',
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
|
||||
//Prevent SQL Error if client_name has ' in their name example Bill's Market
|
||||
$client_name_escaped = mysqli_escape_string($mysqli,$client_name);
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Invoice Viewed', alert_message = 'Invoice $invoice_number has been viewed by $client_name_escaped - $ip - $os - $browser', alert_date = NOW(), company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Invoice Viewed', notification = 'Invoice $invoice_number has been viewed by $client_name_escaped - $ip - $os - $browser', notification_timestamp = NOW(), company_id = $company_id");
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
<!-- <link href="plugins/dropzone/min/dropzone.min.css" rel="stylesheet"> -->
|
||||
|
||||
</head>
|
||||
<body class="hold-transition sidebar-mini">
|
||||
<body class="hold-transition sidebar-mini dark-mod accent-purple <?php echo $config_enable_dark_mode; ?>">
|
||||
<div class="wrapper text-sm">
|
||||
<?php include("top_nav.php"); ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
<?php include("header.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM notifications WHERE notification_dismissed_at IS NULL AND company_id = $session_company_id ORDER BY notification_id DESC");
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-bell"></i> Notifications</h3>
|
||||
<div class="card-tools">
|
||||
|
||||
<?php if(mysqli_num_rows($sql) > 0){ ?><a href="post.php?dismiss_all_notifications" class="btn btn-primary"><i class="fa fa-check"></i> Dismiss All</a><?php } ?>
|
||||
<a href="notifications_dismissed.php" class="btn btn-secondary"><i class="fa fa-history"></i> Dismissed</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if(mysqli_num_rows($sql) > 0){ ?>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>Type</th>
|
||||
<th>Notification</th>
|
||||
<th class="text-center">Dismiss</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$notification_id = $row['notification_id'];
|
||||
$notification_type = $row['notification_type'];
|
||||
$notification = $row['notification'];
|
||||
$notification_timestamp = $row['notification_timestamp'];
|
||||
|
||||
?>
|
||||
<tr class="row-danger">
|
||||
<td><?php echo $notification_timestamp; ?></td>
|
||||
<td><?php echo $notification_type; ?></td>
|
||||
<td><?php echo $notification; ?></td>
|
||||
<td class="text-center"><a class="btn btn-info btn-sm" href="post.php?dismiss_notification=<?php echo $notification_id; ?>"><i class="fa fa-check"></a></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<center class="my-5">
|
||||
<i class='far fa-fw fa-6x fa-bell-slash text-secondary'></i><h3 class='text-secondary mt-3'>No Notifications</h3>
|
||||
</center>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php include("footer.php");
|
||||
|
|
@ -22,7 +22,7 @@ if(isset($_GET['q'])){
|
|||
if(!empty($_GET['sb'])){
|
||||
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
|
||||
}else{
|
||||
$sb = "alert_date";
|
||||
$sb = "notification_timestamp";
|
||||
}
|
||||
|
||||
//Column Order Filter
|
||||
|
|
@ -52,7 +52,7 @@ if(!empty($_GET['dtf'])){
|
|||
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM alerts WHERE (alert_type LIKE '%$q%' OR alert_message LIKE '%$q%') AND DATE(alert_date) BETWEEN '$dtf' AND '$dtt' AND company_id = $session_company_id AND alert_ack_date IS NOT NULL ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM notifications LEFT JOIN users ON notification_dismissed_by = user_id WHERE (notification_type LIKE '%$q%' OR notification LIKE '%$q%' OR user_name LIKE '%$q%') AND DATE(notification_timestamp) BETWEEN '$dtf' AND '$dtt' AND company_id = $session_company_id AND notification_dismissed_at IS NOT NULL ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
||||
|
|
@ -60,14 +60,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-3">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-exclamation-triangle"></i> Archived Alerts</h3>
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-bell"></i> Dismissed Notications</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form class="mb-4" autocomplete="off">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search Alerts">
|
||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search Dismissed Notifications">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
|
|
@ -98,28 +98,31 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<table class="table table-hover">
|
||||
<thead class="<?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=alert_date&o=<?php echo $disp; ?>">Alert Date <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=alert_type&o=<?php echo $disp; ?>">Type <i class="fa fa-sort-alpha<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=alert_message&o=<?php echo $disp; ?>">Alert <i class="fa fa-sort-alpha<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=alert_ack_date&o=<?php echo $disp; ?>">Ack Date <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_timestamp&o=<?php echo $disp; ?>">Timestamp <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_type&o=<?php echo $disp; ?>">Type <i class="fa fa-sort-alpha<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification&o=<?php echo $disp; ?>">Notification <i class="fa fa-sort-alpha<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_dismissed_at&o=<?php echo $disp; ?>">Dismissed At <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">Dismissed By <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$alert_id = $row['alert_id'];
|
||||
$alert_date = $row['alert_date'];
|
||||
$alert_type = $row['alert_type'];
|
||||
$alert_message = $row['alert_message'];
|
||||
$alert_ack_date = $row['alert_ack_date'];
|
||||
$notification_id = $row['notification_id'];
|
||||
$notification_timestamp = $row['notification_timestamp'];
|
||||
$notification_type = $row['notification_type'];
|
||||
$notification = $row['notification'];
|
||||
$notification_dismissed_at = $row['notification_dismissed_at'];
|
||||
$user_name = $row['user_name'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $alert_date; ?></td>
|
||||
<td><?php echo $alert_type; ?></td>
|
||||
<td><?php echo $alert_message; ?></td>
|
||||
<td><?php echo $alert_ack_date; ?></td>
|
||||
<td><?php echo $notification_timestamp; ?></td>
|
||||
<td><?php echo $notification_type; ?></td>
|
||||
<td><?php echo $notification; ?></td>
|
||||
<td><?php echo $notification_dismissed_at; ?></td>
|
||||
<td><?php echo $user_name; ?></td>
|
||||
|
||||
<?php
|
||||
|
||||
34
post.php
34
post.php
|
|
@ -637,7 +637,7 @@ if(isset($_GET['delete_company'])){
|
|||
//Delete Company and all relational data A-Z
|
||||
|
||||
mysqli_query($mysqli,"DELETE FROM accounts WHERE company_id = $company_id");
|
||||
mysqli_query($mysqli,"DELETE FROM alerts WHERE company_id = $company_id");
|
||||
mysqli_query($mysqli,"DELETE FROM notifications WHERE company_id = $company_id");
|
||||
mysqli_query($mysqli,"DELETE FROM assets WHERE company_id = $company_id");
|
||||
mysqli_query($mysqli,"DELETE FROM calendars WHERE company_id = $company_id");
|
||||
mysqli_query($mysqli,"DELETE FROM categories WHERE company_id = $company_id");
|
||||
|
|
@ -1044,7 +1044,7 @@ if(isset($_POST['backup_master_key'])){
|
|||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Download', log_description = '$session_name retrieved the master encryption key', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_created_at = NOW(), log_user_id = $session_user_id, company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Settings', alert_message = '$session_name retrieved the master encryption key', alert_date = NOW(), company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Settings', notification = '$session_name retrieved the master encryption key', notification_timestamp = NOW(), company_id = $session_company_id");
|
||||
|
||||
|
||||
echo "==============================";
|
||||
|
|
@ -2322,41 +2322,41 @@ if(isset($_GET['delete_custom_link'])){
|
|||
}
|
||||
//End Custom Link
|
||||
|
||||
if(isset($_GET['alert_ack'])){
|
||||
if(isset($_GET['dismiss_notification'])){
|
||||
|
||||
$alert_id = intval($_GET['alert_ack']);
|
||||
$notification_id = intval($_GET['dismiss_notification']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE alerts SET alert_ack_date = CURDATE() WHERE alert_id = $alert_id AND company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"UPDATE notifications SET notification_dismissed_at = CURDATE() WHERE notification_id = $notification_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Alerts', log_action = 'Modify', log_description = '$alert_id Acknowledged', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Notifications', log_action = 'Modify', log_description = '$Notification Dismissed', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Alert Acknowledged";
|
||||
$_SESSION['alert_message'] = "Notification Dismissed";
|
||||
|
||||
header("Location: alerts.php");
|
||||
header("Location: notifications.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['ack_all_alerts'])){
|
||||
if(isset($_GET['dismiss_all_notifications'])){
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM alerts WHERE company_id = $session_company_id AND alert_ack_date IS NULL");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM notifications WHERE company_id = $session_company_id AND notification_dismissed_at IS NULL");
|
||||
|
||||
$num_alerts = mysqli_num_rows($sql);
|
||||
$num_notifications = mysqli_num_rows($sql);
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$alert_id = $row['alert_id'];
|
||||
$alert_ack_date = $row['alert_ack_date'];
|
||||
$notification_id = $row['notification_id'];
|
||||
$notification_dismissed_at = $row['notification_dismissed_at'];
|
||||
|
||||
mysqli_query($mysqli,"UPDATE alerts SET alert_ack_date = CURDATE() WHERE alert_id = $alert_id");
|
||||
mysqli_query($mysqli,"UPDATE notifications SET notification_dismissed_at = CURDATE() WHERE notification_id = $notification_id");
|
||||
|
||||
}
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Alerts', log_action = 'Modifed', log_description = 'Acknowledged all alerts', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Notifications', log_action = 'Modifed', log_description = 'Dismissed all notifications', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "$num_alerts Alerts Acknowledged";
|
||||
$_SESSION['alert_message'] = "$num_notifications Notifications Dismissed";
|
||||
|
||||
header("Location: alerts.php");
|
||||
header("Location: notifications.php");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -332,4 +332,5 @@
|
|||
<!-- /.sidebar-menu -->
|
||||
</div>
|
||||
<!-- /.sidebar -->
|
||||
|
||||
</aside>
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
<ul class="navbar-nav ml-auto">
|
||||
<!-- Notifications -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="alerts.php">
|
||||
<a class="nav-link" href="notifications.php">
|
||||
<i class="fas fa-bell mr-2"></i>
|
||||
<?php if($num_alerts > 0){ ?>
|
||||
<span class="badge badge-danger navbar-badge"><?php echo $num_alerts; ?></span>
|
||||
<?php if($num_notifications > 0){ ?>
|
||||
<span class="badge badge-danger navbar-badge"><?php echo $num_notifications; ?></span>
|
||||
<?php } ?>
|
||||
</a>
|
||||
</li>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<li class="nav-item dropdown user-menu">
|
||||
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
|
||||
<?php if(empty($session_avatar)){ ?>
|
||||
<i class="fas fa-user-circle"></i>
|
||||
<i class="fas fa-user"></i>
|
||||
<?php }else{ ?>
|
||||
<img src="<?php echo "uploads/users/$session_user_id/$session_avatar"; ?>" class="user-image img-circle">
|
||||
<?php } ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue