function page_execute() { print "Checking for service invoices...\n"; // generate new service periods service_periods_generate(NULL); // generate any invoices required service_invoices_generate(NULL); print "Service invoicing complete.\n"; }
$sql_obj = new sql_query(); $sql_obj->string = "INSERT INTO services_customers_periods (id_service_customer, date_start, date_end) VALUES ('" . $obj_customer->id_service_customer . "', '" . $data["migration_date_period_usage_first"] . "', '" . $tmp_date . "')"; $sql_obj->execute(); } } else { /* Adjust an existing service "*/ // enable/disable service if needed if ($obj_customer->service_get_status() != $data["active"]) { if ($data["active"]) { // service has been enabled $obj_customer->service_enable(); // generate service period - this won't invoice, but allows us to get a date // for when the invoice will be generated service_periods_generate($obj_customer->id); } else { // service has been disabled $obj_customer->service_disable(); } } // adjust dates if possible - only possible for services that have yet to be billed, any periods that currently // exist are uninvoiced and can be safely deleted. if ($data["date_period_first"]) { log_write("notification", "process", "Adjusted service start date to " . time_format_humandate($data["date_period_first"]) . ""); // handle service information $obj_sql = new sql_query(); $obj_sql->string = "UPDATE services_customers SET date_period_first='" . $data["date_period_first"] . "', date_period_next='" . $data["date_period_next"] . "' WHERE id='" . $obj_customer->id_service_customer . "' LIMIT 1"; $obj_sql->execute(); unset($obj_sql); // delete service periods
include_once "../include/services/inc_services_traffic.php"; if (user_permissions_get('customers_write')) { ///////////////////////// $id = @security_script_input('/^[0-9]*$/', $_GET["customerid"]); // make sure the customer actually exists $sql_obj = new sql_query(); $sql_obj->string = "SELECT id FROM `customers` WHERE id='{$id}' LIMIT 1"; $sql_obj->execute(); if (!$sql_obj->num_rows()) { log_write("error", "process", "The customer you have attempted to edit - {$id} - does not exist in this system."); } //// ERROR CHECKING /////////////////////// /// if there was an error, go back to the entry page if ($_SESSION["error"]["message"]) { header("Location: ../index.php?page=customers/services.php&id={$id}"); exit(0); } else { // execute functions service_periods_generate($id); service_invoices_generate($id); // display updated details header("Location: ../index.php?page=customers/invoices.php&id={$id}"); exit(0); } ///////////////////////// } else { // user does not have perms to view this page/isn't logged on error_render_noperms(); header("Location: ../index.php?page=message.php"); exit(0); }