mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Tons of UI and code cleanups, renamed many sql tables and fields, started adding created_at and updated_at fields
This commit is contained in:
100
cron.php
100
cron.php
@@ -8,74 +8,74 @@
|
||||
//DOMAINS EXPIRING
|
||||
|
||||
//Get Domains Expiring within 1 days
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM client_domains, clients
|
||||
WHERE client_domains.client_id = clients.client_id
|
||||
AND client_domain_expire = CURDATE() + INTERVAL 1 DAY
|
||||
ORDER BY client_domain_id DESC"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM domains, clients
|
||||
WHERE domains.client_id = clients.client_id
|
||||
AND domain_expire = CURDATE() + INTERVAL 1 DAY
|
||||
ORDER BY domain_id DESC"
|
||||
);
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_domain_id = $row['client_domain_id'];
|
||||
$client_domain_name = $row['client_domain_name'];
|
||||
$client_domain_expire = $row['client_domain_expire'];
|
||||
$domain_id = $row['domain_id'];
|
||||
$domain_name = $row['domain_name'];
|
||||
$domain_expire = $row['domain_expire'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $client_domain_name will expire tomorrow on $client_domain_expire', alert_date = CURDATE()");
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $domain_name will expire tomorrow on $domain_expire', alert_date = CURDATE()");
|
||||
|
||||
}
|
||||
|
||||
//Get Domains Expiring within 14 days
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM client_domains, clients
|
||||
WHERE client_domains.client_id = clients.client_id
|
||||
AND client_domain_expire = CURDATE() + INTERVAL 14 DAY
|
||||
ORDER BY client_domain_id DESC"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM domains, clients
|
||||
WHERE domains.client_id = clients.client_id
|
||||
AND domain_expire = CURDATE() + INTERVAL 1 DAY
|
||||
ORDER BY domain_id DESC"
|
||||
);
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_domain_id = $row['client_domain_id'];
|
||||
$client_domain_name = $row['client_domain_name'];
|
||||
$client_domain_expire = $row['client_domain_expire'];
|
||||
$domain_id = $row['domain_id'];
|
||||
$domain_name = $row['domain_name'];
|
||||
$domain_expire = $row['domain_expire'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $client_domain_name will expire in 14 Days on $client_domain_expire', alert_date = CURDATE()");
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $domain_name will expire in 14 Days on $domain_expire', alert_date = CURDATE()");
|
||||
|
||||
}
|
||||
|
||||
//Get Domains Expiring within 30 days
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM client_domains, clients
|
||||
WHERE client_domains.client_id = clients.client_id
|
||||
AND client_domain_expire = CURDATE() + INTERVAL 30 DAY
|
||||
ORDER BY client_domain_id DESC"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM domains, clients
|
||||
WHERE domains.client_id = clients.client_id
|
||||
AND domain_expire = CURDATE() + INTERVAL 1 DAY
|
||||
ORDER BY domain_id DESC"
|
||||
);
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_domain_id = $row['client_domain_id'];
|
||||
$client_domain_name = $row['client_domain_name'];
|
||||
$client_domain_expire = $row['client_domain_expire'];
|
||||
$domain_id = $row['domain_id'];
|
||||
$domain_name = $row['domain_name'];
|
||||
$domain_expire = $row['domain_expire'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $client_domain_name will expire in 30 Days on $client_domain_expire', alert_date = CURDATE()");
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $domain_name will expire in 30 Days on $domain_expire', alert_date = CURDATE()");
|
||||
|
||||
}
|
||||
|
||||
//Get Domains Expiring within 90 days
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM client_domains, clients
|
||||
WHERE client_domains.client_id = clients.client_id
|
||||
AND client_domain_expire = CURDATE() + INTERVAL 90 DAY
|
||||
ORDER BY client_domain_id DESC"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM domains, clients
|
||||
WHERE domains.client_id = clients.client_id
|
||||
AND domain_expire = CURDATE() + INTERVAL 1 DAY
|
||||
ORDER BY domain_id DESC"
|
||||
);
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_domain_id = $row['client_domain_id'];
|
||||
$client_domain_name = $row['client_domain_name'];
|
||||
$client_domain_expire = $row['client_domain_expire'];
|
||||
$domain_id = $row['domain_id'];
|
||||
$domain_name = $row['domain_name'];
|
||||
$domain_expire = $row['domain_expire'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $client_domain_name will expire in 90 Days on $client_domain_expire', alert_date = CURDATE()");
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Domain', alert_message = 'Domain $domain_name will expire in 90 Days on $domain_expire', alert_date = CURDATE()");
|
||||
|
||||
}
|
||||
|
||||
@@ -177,15 +177,15 @@ while($row = mysqli_fetch_array($sql)){
|
||||
|
||||
//Send Recurring Invoices that match todays date and are active
|
||||
|
||||
$sql_recurring_invoices = mysqli_query($mysqli,"SELECT * FROM recurring_invoices, clients, invoices WHERE clients.client_id = invoices.client_id AND invoices.invoice_id = recurring_invoices.invoice_id AND recurring_invoices.recurring_invoice_next_date = CURDATE() AND recurring_invoices.recurring_invoice_status = 1");
|
||||
$sql_recurring = mysqli_query($mysqli,"SELECT * FROM recurring, clients, invoices WHERE clients.client_id = invoices.client_id AND invoices.invoice_id = recurring.invoice_id AND recurring.recurring_next_date = CURDATE() AND recurring.recurring_status = 1");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_recurring_invoices)){
|
||||
$recurring_invoice_id = $row['recurring_invoice_id'];
|
||||
$recurring_invoice_frequency = $row['recurring_invoice_frequency'];
|
||||
$recurring_invoice_status = $row['recurring_invoice_status'];
|
||||
$recurring_invoice_start_date = $row['recurring_invoice_start_date'];
|
||||
$recurring_invoice_last_sent = $row['recurring_invoice_last_sent'];
|
||||
$recurring_invoice_next_date = $row['recurring_invoice_next_date'];
|
||||
$recurring_id = $row['recurring_id'];
|
||||
$recurring_frequency = $row['recurring_frequency'];
|
||||
$recurring_status = $row['recurring_status'];
|
||||
$recurring_start_date = $row['recurring_start_date'];
|
||||
$recurring_last_sent = $row['recurring_last_sent'];
|
||||
$recurring_next_date = $row['recurring_next_date'];
|
||||
$invoice_id = $row['invoice_id'];
|
||||
$invoice_status = $row['invoice_status'];
|
||||
$invoice_amount = $row['invoice_amount'];
|
||||
@@ -206,25 +206,25 @@ while($row = mysqli_fetch_array($sql_recurring_invoices)){
|
||||
|
||||
|
||||
//Copy Items from original invoice to new invoice
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY invoice_item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$invoice_item_id = $row['invoice_item_id'];
|
||||
$invoice_item_name = $row['invoice_item_name'];
|
||||
$invoice_item_description = $row['invoice_item_description'];
|
||||
$invoice_item_quantity = $row['invoice_item_quantity'];
|
||||
$invoice_item_price = $row['invoice_item_price'];
|
||||
$invoice_item_subtotal = $row['invoice_item_price'];
|
||||
$invoice_item_tax = $row['invoice_item_tax'];
|
||||
$invoice_item_total = $row['invoice_item_total'];
|
||||
$item_id = $row['item_id'];
|
||||
$item_name = $row['item_name'];
|
||||
$item_description = $row['item_description'];
|
||||
$item_quantity = $row['item_quantity'];
|
||||
$item_price = $row['item_price'];
|
||||
$item_subtotal = $row['item_price'];
|
||||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_items SET invoice_item_name = '$invoice_item_name', invoice_item_description = '$invoice_item_description', invoice_item_quantity = $invoice_item_quantity, invoice_item_price = '$invoice_item_price', invoice_item_subtotal = '$invoice_item_subtotal', invoice_item_tax = '$invoice_item_tax', invoice_item_total = '$invoice_item_total', invoice_id = $new_invoice_id");
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_items SET item_name = '$item_name', item_description = '$item_description', item_quantity = $item_quantity, item_price = '$item_price', item_subtotal = '$item_subtotal', item_tax = '$item_tax', item_total = '$item_total', invoice_id = $new_invoice_id");
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_history SET invoice_history_date = CURDATE(), invoice_history_status = 'Draft', invoice_history_description = 'INVOICE added!', invoice_id = $new_invoice_id");
|
||||
|
||||
//update the recurring invoice with the new dates
|
||||
mysqli_query($mysqli,"UPDATE recurring_invoices SET recurring_invoice_last_sent = CURDATE(), recurring_invoice_next_date = DATE_ADD(CURDATE(), INTERVAL 1 $recurring_invoice_frequency) , invoice_id = $new_invoice_id WHERE recurring_invoice_id = $recurring_invoice_id");
|
||||
mysqli_query($mysqli,"UPDATE recurring SET recurring_last_sent = CURDATE(), recurring_next_date = DATE_ADD(CURDATE(), INTERVAL 1 $recurring_frequency) , invoice_id = $new_invoice_id WHERE recurring_id = $recurring_id");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user