mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
replace all instances of mysqli_fetch_array with mysqli_fetch_assoc for better performance and memory usage
This commit is contained in:
@@ -43,7 +43,7 @@ $assets_sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($assets_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($assets_sql)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
$asset_description = nullable_htmlentities($row['asset_description']);
|
||||
|
||||
@@ -33,7 +33,7 @@ $certificates_sql = mysqli_query($mysqli, "SELECT certificate_id, certificate_na
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($certificates_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($certificates_sql)) {
|
||||
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
||||
$certificate_domain = nullable_htmlentities($row['certificate_domain']);
|
||||
$certificate_issued_by = nullable_htmlentities($row['certificate_issued_by']);
|
||||
|
||||
@@ -28,7 +28,7 @@ $sql_contact = mysqli_query(
|
||||
WHERE contact_id = $contact_id AND contact_client_id = $session_client_id AND contacts.contact_archived_at IS NULL LIMIT 1"
|
||||
);
|
||||
|
||||
$row = mysqli_fetch_array($sql_contact);
|
||||
$row = mysqli_fetch_assoc($sql_contact);
|
||||
|
||||
if ($row) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
|
||||
@@ -40,7 +40,7 @@ $contacts_sql = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($contacts_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($contacts_sql)) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
|
||||
@@ -35,7 +35,7 @@ $sql_document = mysqli_query($mysqli,
|
||||
LIMIT 1"
|
||||
);
|
||||
|
||||
$row = mysqli_fetch_array($sql_document);
|
||||
$row = mysqli_fetch_assoc($sql_document);
|
||||
|
||||
if ($row) {
|
||||
$document_id = intval($row['document_id']);
|
||||
@@ -73,7 +73,7 @@ $sql_files = mysqli_query($mysqli,
|
||||
<?php
|
||||
// Check if this document has attached files and handle accordingly
|
||||
if (mysqli_num_rows($sql_files) > 0) {
|
||||
$file_row = mysqli_fetch_array($sql_files);
|
||||
$file_row = mysqli_fetch_assoc($sql_files);
|
||||
$file_id = intval($file_row['file_id']);
|
||||
$file_name = nullable_htmlentities($file_row['file_name']);
|
||||
$file_reference_name = nullable_htmlentities($file_row['file_reference_name']);
|
||||
@@ -81,9 +81,9 @@ if (mysqli_num_rows($sql_files) > 0) {
|
||||
$file_size = intval($file_row['file_size']);
|
||||
$file_mime_type = nullable_htmlentities($file_row['file_mime_type']);
|
||||
$file_size_formatted = formatBytes($file_size);
|
||||
|
||||
|
||||
$file_path = "../uploads/clients/$session_client_id/$file_reference_name";
|
||||
|
||||
|
||||
// For PDF files, display them inline
|
||||
if ($file_ext == 'pdf') {
|
||||
?>
|
||||
@@ -185,7 +185,7 @@ if (mysqli_num_rows($sql_files) > 0) {
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// Regular text-based document (no files attached)
|
||||
?>
|
||||
|
||||
@@ -45,7 +45,7 @@ $documents_sql = mysqli_query($mysqli, "SELECT document_id, document_name, docum
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($documents_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($documents_sql)) {
|
||||
$document_id = intval($row['document_id']);
|
||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||
$document_name = nullable_htmlentities($row['document_name']);
|
||||
@@ -159,7 +159,7 @@ $documents_sql = mysqli_query($mysqli, "SELECT document_id, document_name, docum
|
||||
|
||||
<div class="form-group">
|
||||
<label>Upload File <strong class="text-danger">*</strong></label>
|
||||
<input type="file" class="form-control-file" name="document_file" id="documentFileInput"
|
||||
<input type="file" class="form-control-file" name="document_file" id="documentFileInput"
|
||||
accept=".pdf,.doc,.docx,.txt,.md,.odt,.rtf" required>
|
||||
<small class="text-secondary">Supported formats: PDF, Word documents, text files</small>
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@ $domains_sql = mysqli_query($mysqli, "SELECT domain_id, domain_name, domain_expi
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($domains_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($domains_sql)) {
|
||||
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ function verifyContactTicketAccess($requested_ticket_id, $expected_ticket_state)
|
||||
}
|
||||
|
||||
// Verify the contact has access to the provided ticket ID
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $requested_ticket_id AND $ticket_state_snippet AND ticket_client_id = $session_client_id LIMIT 1"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $requested_ticket_id AND $ticket_state_snippet AND ticket_client_id = $session_client_id LIMIT 1"));
|
||||
if ($row) {
|
||||
$ticket_id = $row['ticket_id'];
|
||||
|
||||
@@ -43,7 +43,7 @@ function verifyContactTicketAccess($requested_ticket_id, $expected_ticket_state)
|
||||
*/
|
||||
function getFileIcon($file_extension) {
|
||||
$file_extension = strtolower($file_extension);
|
||||
|
||||
|
||||
// Document icons
|
||||
if (in_array($file_extension, ['pdf'])) {
|
||||
return 'file-pdf';
|
||||
@@ -75,10 +75,10 @@ function getFileIcon($file_extension) {
|
||||
*/
|
||||
function formatBytes($bytes, $precision = 2) {
|
||||
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||
|
||||
|
||||
for ($i = 0; $bytes > 1024 && $i < count($units) - 1; $i++) {
|
||||
$bytes /= 1024;
|
||||
}
|
||||
|
||||
|
||||
return round($bytes, $precision) . ' ' . $units[$i];
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ $session_user_id = intval($_SESSION['user_id']);
|
||||
|
||||
// Get company info from database
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
|
||||
$session_company_name = $row['company_name'];
|
||||
$session_company_country = $row['company_country'];
|
||||
@@ -53,7 +53,7 @@ $session_company_logo = $row['company_logo'];
|
||||
|
||||
// Get contact info
|
||||
$contact_sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = $session_contact_id AND contact_client_id = $session_client_id");
|
||||
$contact = mysqli_fetch_array($contact_sql);
|
||||
$contact = mysqli_fetch_assoc($contact_sql);
|
||||
|
||||
$session_contact_name = sanitizeInput($contact['contact_name']);
|
||||
$session_contact_initials = initials($session_contact_name);
|
||||
@@ -74,6 +74,6 @@ if ($contact['contact_billing'] == 1) {
|
||||
|
||||
// Get client info
|
||||
$client_sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = $session_client_id");
|
||||
$client = mysqli_fetch_array($client_sql);
|
||||
$client = mysqli_fetch_assoc($client_sql);
|
||||
|
||||
$session_client_name = $client['client_name'];
|
||||
|
||||
@@ -84,7 +84,7 @@ header("X-Frame-Options: DENY"); // Legacy
|
||||
ORDER BY custom_link_order ASC, custom_link_name ASC"
|
||||
);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_custom_links)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
||||
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
||||
$custom_link_uri = nullable_htmlentities($row['custom_link_uri']);
|
||||
$custom_link_new_tab = intval($row['custom_link_new_tab']);
|
||||
|
||||
@@ -11,12 +11,12 @@ require_once "includes/inc_all.php";
|
||||
// Billing Card Queries
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_invoice_amounts = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $session_client_id AND invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable'");
|
||||
$row = mysqli_fetch_array($sql_invoice_amounts);
|
||||
$row = mysqli_fetch_assoc($sql_invoice_amounts);
|
||||
|
||||
$invoice_amounts = floatval($row['invoice_amounts']);
|
||||
|
||||
$sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $session_client_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
$row = mysqli_fetch_assoc($sql_amount_paid);
|
||||
|
||||
$amount_paid = floatval($row['amount_paid']);
|
||||
|
||||
@@ -24,13 +24,13 @@ $balance = $invoice_amounts - $amount_paid;
|
||||
|
||||
//Get Monthly Recurring Total
|
||||
$sql_recurring_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_monthly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'month' AND recurring_invoice_client_id = $session_client_id");
|
||||
$row = mysqli_fetch_array($sql_recurring_monthly_total);
|
||||
$row = mysqli_fetch_assoc($sql_recurring_monthly_total);
|
||||
|
||||
$recurring_monthly_total = floatval($row['recurring_monthly_total']);
|
||||
|
||||
//Get Yearly Recurring Total
|
||||
$sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_yearly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'year' AND recurring_invoice_client_id = $session_client_id");
|
||||
$row = mysqli_fetch_array($sql_recurring_yearly_total);
|
||||
$row = mysqli_fetch_assoc($sql_recurring_yearly_total);
|
||||
|
||||
$recurring_yearly_total = floatval($row['recurring_yearly_total']) / 12;
|
||||
|
||||
@@ -226,7 +226,7 @@ if ($session_contact_primary == 1 || $session_contact_is_technical_contact) {
|
||||
<div class="card-body">
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_domains_expiring)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_domains_expiring)) {
|
||||
$domain_id = intval($row['domain_id']);
|
||||
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
||||
@@ -265,7 +265,7 @@ if ($session_contact_primary == 1 || $session_contact_is_technical_contact) {
|
||||
<table>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_assigned_assets)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_assigned_assets)) {
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||
$asset_uri_client = sanitize_url($row['asset_uri_client']);
|
||||
|
||||
@@ -36,7 +36,7 @@ $invoices_sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_clie
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($invoices_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($invoices_sql)) {
|
||||
$invoice_id = intval($row['invoice_id']);
|
||||
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
|
||||
$invoice_number = intval($row['invoice_number']);
|
||||
@@ -99,4 +99,3 @@ $invoices_sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_clie
|
||||
|
||||
<?php
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ $session_ip = sanitizeInput(getIP());
|
||||
$session_user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
$sql_settings = mysqli_query($mysqli, "SELECT config_azure_client_id, config_azure_client_secret FROM settings WHERE company_id = 1");
|
||||
$settings = mysqli_fetch_array($sql_settings);
|
||||
$settings = mysqli_fetch_assoc($sql_settings);
|
||||
|
||||
$client_id = $settings['config_azure_client_id'];
|
||||
$client_secret = $settings['config_azure_client_secret'];
|
||||
@@ -110,7 +110,7 @@ if (isset($_POST['code']) && $_POST['state'] == session_id()) {
|
||||
AND user_status = 1
|
||||
LIMIT 1"
|
||||
);
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_id = intval($row['contact_client_id']);
|
||||
$user_id = intval($row['user_id']);
|
||||
$session_user_id = $user_id; // to pass the user_id to logAction function
|
||||
|
||||
@@ -40,7 +40,7 @@ $user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
// Get Company Info
|
||||
$company_sql = mysqli_query($mysqli, "SELECT company_name, company_phone FROM companies WHERE company_id = 1");
|
||||
$company_results = mysqli_fetch_array($company_sql);
|
||||
$company_results = mysqli_fetch_assoc($company_sql);
|
||||
$company_name = sanitizeInput($company_results['company_name']);
|
||||
$company_phone = sanitizeInput(formatPhoneNumber($company_results['company_phone']));
|
||||
$company_name_display = $company_results['company_name'];
|
||||
@@ -118,7 +118,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
|
||||
// Query user
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM users LEFT JOIN contacts ON user_id = contact_user_id WHERE user_email = '$email' AND user_password_reset_token = '$token' AND contact_client_id = $client AND user_auth_method = 'local' AND user_type = 2 AND user_status = 1 AND user_archived_at IS NULL LIMIT 1");
|
||||
$user_row = mysqli_fetch_array($sql);
|
||||
$user_row = mysqli_fetch_assoc($sql);
|
||||
$contact_id = intval($user_row['contact_id']);
|
||||
$user_id = intval($user_row['user_id']);
|
||||
$name = sanitizeInput($user_row['contact_name']);
|
||||
@@ -216,7 +216,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
$client = intval($_GET['client']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM users LEFT JOIN contacts ON user_id = contact_user_id WHERE user_email = '$email' AND user_password_reset_token = '$token' AND contact_client_id = $client LIMIT 1");
|
||||
$user_row = mysqli_fetch_array($sql);
|
||||
$user_row = mysqli_fetch_assoc($sql);
|
||||
|
||||
// Sanity check
|
||||
if (sha1($user_row['user_password_reset_token']) == sha1($token)) { ?>
|
||||
|
||||
@@ -104,7 +104,7 @@ if (isset($_POST['add_ticket_comment'])) {
|
||||
|
||||
|
||||
// Get ticket details & Notify the assigned tech (if any)
|
||||
$ticket_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
$ticket_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
|
||||
$ticket_number = intval($ticket_details['ticket_number']);
|
||||
$ticket_assigned_to = intval($ticket_details['ticket_assigned_to']);
|
||||
@@ -114,7 +114,7 @@ if (isset($_POST['add_ticket_comment'])) {
|
||||
if ($ticket_details && $ticket_assigned_to !== 0) {
|
||||
|
||||
// Get tech details
|
||||
$tech_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_email, user_name FROM users WHERE user_id = $ticket_assigned_to LIMIT 1"));
|
||||
$tech_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT user_email, user_name FROM users WHERE user_id = $ticket_assigned_to LIMIT 1"));
|
||||
$tech_email = sanitizeInput($tech_details['user_email']);
|
||||
$tech_name = sanitizeInput($tech_details['user_name']);
|
||||
|
||||
@@ -191,7 +191,7 @@ if (isset($_GET['approve_ticket_task'])) {
|
||||
$approval_id = intval($_GET['approval_id']);
|
||||
$url_key = sanitizeInput($_GET['approval_url_key']);
|
||||
|
||||
$approval_row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM task_approvals LEFT JOIN tasks on task_id = approval_task_id WHERE approval_id = $approval_id AND approval_task_id = $task_id AND approval_url_key = '$url_key' AND approval_status = 'pending' AND approval_scope = 'client'"));
|
||||
$approval_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM task_approvals LEFT JOIN tasks on task_id = approval_task_id WHERE approval_id = $approval_id AND approval_task_id = $task_id AND approval_url_key = '$url_key' AND approval_status = 'pending' AND approval_scope = 'client'"));
|
||||
|
||||
$task_name = nullable_htmlentities($approval_row['task_name']);
|
||||
$scope = nullable_htmlentities($approval_row['approval_scope']);
|
||||
@@ -235,7 +235,7 @@ if (isset($_POST['add_ticket_feedback'])) {
|
||||
|
||||
// Notify on bad feedback
|
||||
if ($feedback == "Bad") {
|
||||
$ticket_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT ticket_number FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
$ticket_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_number FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
$ticket_number = intval($ticket_details['ticket_number']);
|
||||
appNotify("Feedback", "$session_contact_name rated ticket $config_ticket_prefix$ticket_number as bad (ID: $ticket_id)", "/agent/ticket.php?ticket_id=$ticket_id", $session_client_id, $ticket_id);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ if (isset($_GET['resolve_ticket'])) {
|
||||
$ticket_id = intval($_GET['resolve_ticket']);
|
||||
|
||||
// Get ticket details for logging
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
@@ -289,7 +289,7 @@ if (isset($_GET['reopen_ticket'])) {
|
||||
$ticket_id = intval($_GET['reopen_ticket']);
|
||||
|
||||
// Get ticket details for logging
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
@@ -322,7 +322,7 @@ if (isset($_GET['close_ticket'])) {
|
||||
$ticket_id = intval($_GET['close_ticket']);
|
||||
|
||||
// Get ticket details for logging
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"));
|
||||
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
@@ -439,7 +439,7 @@ if (isset($_POST['edit_contact'])) {
|
||||
|
||||
// Get the existing contact_user_id - we look it up ourselves so the user can't just overwrite random users
|
||||
$sql = mysqli_query($mysqli,"SELECT contact_user_id FROM contacts WHERE contact_id = $contact_id AND contact_client_id = $session_client_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$contact_user_id = intval($row['contact_user_id']);
|
||||
|
||||
// Check the email isn't already in use
|
||||
@@ -485,7 +485,7 @@ if (isset($_GET['add_payment_by_provider'])) {
|
||||
LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1
|
||||
WHERE invoice_id = $invoice_id AND client_id = $session_client_id"
|
||||
);
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$invoice_number = intval($row['invoice_number']);
|
||||
$invoice_status = sanitizeInput($row['invoice_status']);
|
||||
$invoice_amount = floatval($row['invoice_amount']);
|
||||
@@ -509,7 +509,7 @@ if (isset($_GET['add_payment_by_provider'])) {
|
||||
|
||||
// Get ITFlow company details
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$company_name = sanitizeInput($row['company_name']);
|
||||
$company_country = sanitizeInput($row['company_country']);
|
||||
$company_address = sanitizeInput($row['company_address']);
|
||||
@@ -526,7 +526,7 @@ if (isset($_GET['add_payment_by_provider'])) {
|
||||
|
||||
// Get Client Payment Details
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM client_saved_payment_methods LEFT JOIN payment_providers ON saved_payment_provider_id = payment_provider_id LEFT JOIN client_payment_provider ON saved_payment_client_id = client_id WHERE saved_payment_id = $saved_payment_id LIMIT 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
|
||||
$public_key = sanitizeInput($row['payment_provider_public_key']);
|
||||
$private_key = sanitizeInput($row['payment_provider_private_key']);
|
||||
@@ -684,7 +684,7 @@ if (isset($_POST['create_stripe_customer'])) {
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
$stripe_provider = mysqli_fetch_array($stripe_provider_result);
|
||||
$stripe_provider = mysqli_fetch_assoc($stripe_provider_result);
|
||||
if (!$stripe_provider) {
|
||||
flash_alert("Stripe provider is not configured in the system.", 'danger');
|
||||
redirect("saved_payment_methods.php");
|
||||
@@ -699,7 +699,7 @@ if (isset($_POST['create_stripe_customer'])) {
|
||||
}
|
||||
|
||||
// Check if client already has a Stripe customer
|
||||
$existing_customer = mysqli_fetch_array(mysqli_query($mysqli, "
|
||||
$existing_customer = mysqli_fetch_assoc(mysqli_query($mysqli, "
|
||||
SELECT payment_provider_client
|
||||
FROM client_payment_provider
|
||||
WHERE client_id = $session_client_id
|
||||
@@ -772,7 +772,7 @@ if (isset($_GET['create_stripe_checkout'])) {
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
$stripe_provider = mysqli_fetch_array($stripe_provider_result);
|
||||
$stripe_provider = mysqli_fetch_assoc($stripe_provider_result);
|
||||
if (!$stripe_provider) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Stripe provider not configured']);
|
||||
@@ -840,7 +840,7 @@ if (isset($_GET['stripe_save_card'])) {
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
$stripe_provider = mysqli_fetch_array($stripe_provider_result);
|
||||
$stripe_provider = mysqli_fetch_assoc($stripe_provider_result);
|
||||
if (!$stripe_provider) {
|
||||
flash_alert("Stripe provider not configured.", 'danger');
|
||||
redirect("saved_payment_methods.php");
|
||||
@@ -862,7 +862,7 @@ if (isset($_GET['stripe_save_card'])) {
|
||||
AND payment_provider_id = $stripe_provider_id
|
||||
LIMIT 1
|
||||
");
|
||||
$client_provider = mysqli_fetch_array($client_provider_query);
|
||||
$client_provider = mysqli_fetch_assoc($client_provider_query);
|
||||
$stripe_customer_id = sanitizeInput($client_provider['payment_provider_client'] ?? '');
|
||||
|
||||
if (empty($stripe_customer_id)) {
|
||||
@@ -921,7 +921,7 @@ if (isset($_GET['stripe_save_card'])) {
|
||||
WHERE companies.company_id = settings.company_id
|
||||
AND companies.company_id = 1
|
||||
");
|
||||
$row = mysqli_fetch_array($sql_settings);
|
||||
$row = mysqli_fetch_assoc($sql_settings);
|
||||
|
||||
$company_name = sanitizeInput($row['company_name']);
|
||||
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||
@@ -970,7 +970,7 @@ if (isset($_GET['delete_saved_payment'])) {
|
||||
AND payment_provider_active = 1
|
||||
LIMIT 1
|
||||
");
|
||||
$stripe_provider = mysqli_fetch_array($stripe_provider_result);
|
||||
$stripe_provider = mysqli_fetch_assoc($stripe_provider_result);
|
||||
|
||||
if (!$stripe_provider) {
|
||||
flash_alert("Stripe provider is not configured.", 'danger');
|
||||
@@ -994,7 +994,7 @@ if (isset($_GET['delete_saved_payment'])) {
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
$saved_payment = mysqli_fetch_array($saved_payment_result);
|
||||
$saved_payment = mysqli_fetch_assoc($saved_payment_result);
|
||||
|
||||
if (!$saved_payment) {
|
||||
flash_alert("Payment method not found or does not belong to you.", 'danger');
|
||||
@@ -1040,7 +1040,7 @@ if (isset($_GET['delete_saved_payment'])) {
|
||||
WHERE recurring_invoice_client_id = $session_client_id
|
||||
");
|
||||
|
||||
while ($row = mysqli_fetch_array($recurring_invoices)) {
|
||||
while ($row = mysqli_fetch_assoc($recurring_invoices)) {
|
||||
$recurring_invoice_id = intval($row['recurring_invoice_id']);
|
||||
|
||||
mysqli_query($mysqli, "
|
||||
@@ -1064,7 +1064,7 @@ if (isset($_POST['set_recurring_payment'])) {
|
||||
|
||||
// Get Recurring Invoice Info for logging and alerting
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id AND recurring_invoice_client_id = $session_client_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']);
|
||||
$recurring_invoice_number = intval($row['recurring_invoice_number']);
|
||||
$recurring_invoice_currency_code = sanitizeInput($row['recurring_invoice_currency_code']);
|
||||
@@ -1081,7 +1081,7 @@ if (isset($_POST['set_recurring_payment'])) {
|
||||
AND payment_provider_active = 1
|
||||
");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
|
||||
$provider_id = intval($row['payment_provider_id']);
|
||||
$provider_name = sanitizeInput($row['payment_provider_name']);
|
||||
|
||||
@@ -34,7 +34,7 @@ $quotes_sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_client_id
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($quotes_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($quotes_sql)) {
|
||||
$quote_id = intval($row['quote_id']);
|
||||
$quote_prefix = nullable_htmlentities($row['quote_prefix']);
|
||||
$quote_number = intval($row['quote_number']);
|
||||
|
||||
@@ -14,7 +14,7 @@ if ($session_contact_primary == 0 && !$session_contact_is_billing_contact) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$recurring_invoices_sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoices
|
||||
$recurring_invoices_sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoices
|
||||
LEFT JOIN recurring_payments ON recurring_payment_recurring_invoice_id = recurring_invoice_id
|
||||
WHERE recurring_invoice_client_id = $session_client_id
|
||||
AND recurring_invoice_status = 1
|
||||
@@ -23,7 +23,7 @@ $recurring_invoices_sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoice
|
||||
|
||||
// Get Payment Provide Details
|
||||
$payment_provider_sql = mysqli_query($mysqli, "SELECT * FROM payment_providers WHERE payment_provider_active = 1 LIMIT 1");
|
||||
$row = mysqli_fetch_array($payment_provider_sql);
|
||||
$row = mysqli_fetch_assoc($payment_provider_sql);
|
||||
$payment_provider_id = intval($row['payment_provider_id']);
|
||||
$payment_provider_name = nullable_htmlentities($row['payment_provider_name']);
|
||||
$payment_provider_threshold = floatval($row['payment_provider_threshold']);
|
||||
@@ -50,7 +50,7 @@ $payment_provider_threshold = floatval($row['payment_provider_threshold']);
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($recurring_invoices_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($recurring_invoices_sql)) {
|
||||
$recurring_invoice_id = intval($row['recurring_invoice_id']);
|
||||
$recurring_invoice_prefix = nullable_htmlentities($row['recurring_invoice_prefix']);
|
||||
$recurring_invoice_number = intval($row['recurring_invoice_number']);
|
||||
@@ -62,7 +62,7 @@ $payment_provider_threshold = floatval($row['payment_provider_threshold']);
|
||||
$recurring_payment_id = intval($row['recurring_payment_id']);
|
||||
$recurring_payment_recurring_invoice_id = intval($row['recurring_payment_recurring_invoice_id']);
|
||||
$recurring_payment_saved_payment_id = intval($row['recurring_payment_saved_payment_id']);
|
||||
|
||||
|
||||
if (empty($recurring_invoice_scope)) {
|
||||
$recurring_invoice_scope_display = "-";
|
||||
} else {
|
||||
@@ -85,7 +85,7 @@ $payment_provider_threshold = floatval($row['payment_provider_threshold']);
|
||||
<select class="form-control select2" name="saved_payment_id" onchange="this.form.submit()">
|
||||
<option value="0">Disabled</option>
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$saved_payment_id = intval($row['saved_payment_id']);
|
||||
$saved_payment_description = nullable_htmlentities($row['saved_payment_description']);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ require_once '../plugins/stripe-php/init.php';
|
||||
$stripe_provider_query = mysqli_query($mysqli, "
|
||||
SELECT * FROM payment_providers WHERE payment_provider_name = 'Stripe' LIMIT 1
|
||||
");
|
||||
$stripe_provider = mysqli_fetch_array($stripe_provider_query);
|
||||
$stripe_provider = mysqli_fetch_assoc($stripe_provider_query);
|
||||
|
||||
if (!$stripe_provider) {
|
||||
echo "Stripe payment error - Stripe provider is not configured.";
|
||||
@@ -35,7 +35,7 @@ $stripe_customer_query = mysqli_query($mysqli, "
|
||||
WHERE client_id = $session_client_id AND payment_provider_id = $stripe_provider_id
|
||||
LIMIT 1
|
||||
");
|
||||
$stripe_customer = mysqli_fetch_array($stripe_customer_query);
|
||||
$stripe_customer = mysqli_fetch_assoc($stripe_customer_query);
|
||||
$stripe_customer_id = $stripe_customer ? sanitizeInput($stripe_customer['payment_provider_client']) : null;
|
||||
|
||||
// Get saved payment methods
|
||||
@@ -46,7 +46,7 @@ $saved_methods_query = mysqli_query($mysqli, "
|
||||
");
|
||||
|
||||
$saved_methods = [];
|
||||
while ($row = mysqli_fetch_array($saved_methods_query)) {
|
||||
while ($row = mysqli_fetch_assoc($saved_methods_query)) {
|
||||
$saved_methods[] = $row;
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ if (!$stripe_public_key || !$stripe_secret_key) {
|
||||
<br><br>
|
||||
|
||||
<form action="post.php" method="POST">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success" name="create_stripe_customer"><strong><i class="fas fa-check mr-2"></i>I grant consent for automatic payments</strong></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<b>Manage saved payment methods</b><br><br>
|
||||
|
||||
@@ -34,7 +34,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
||||
$ticket_contact_snippet"
|
||||
);
|
||||
|
||||
$ticket_row = mysqli_fetch_array($ticket_sql);
|
||||
$ticket_row = mysqli_fetch_assoc($ticket_sql);
|
||||
|
||||
if ($ticket_row) {
|
||||
|
||||
@@ -128,7 +128,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
||||
<?php echo $ticket_details ?>
|
||||
|
||||
<?php
|
||||
while ($ticket_attachment = mysqli_fetch_array($sql_ticket_attachments)) {
|
||||
while ($ticket_attachment = mysqli_fetch_assoc($sql_ticket_attachments)) {
|
||||
$name = nullable_htmlentities($ticket_attachment['ticket_attachment_name']);
|
||||
$ref_name = nullable_htmlentities($ticket_attachment['ticket_attachment_reference_name']);
|
||||
echo "<hr><i class='fas fa-fw fa-paperclip text-secondary mr-1'></i>$name | <a href='../uploads/tickets/$ticket_id/$ref_name' download='$name'><i class='fas fa-fw fa-download mr-1'></i>Download</a> | <a target='_blank' href='../uploads/tickets/$ticket_id/$ref_name'><i class='fas fa-fw fa-external-link-alt mr-1'></i>View</a>";
|
||||
@@ -147,7 +147,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
while ($approvals = mysqli_fetch_array($sql_task_approvals)) {
|
||||
while ($approvals = mysqli_fetch_assoc($sql_task_approvals)) {
|
||||
$task_id = intval($approvals['task_id']);
|
||||
$approval_id = intval($approvals['approval_id']);
|
||||
$task_name = nullable_htmlentities($approvals['task_name']);
|
||||
@@ -256,7 +256,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_replies LEFT JOIN users ON ticket_reply_by = user_id LEFT JOIN contacts ON ticket_reply_by = contact_id WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL AND ticket_reply_type != 'Internal' ORDER BY ticket_reply_id DESC");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$ticket_reply_id = intval($row['ticket_reply_id']);
|
||||
$ticket_reply = $purifier->purify($row['ticket_reply']);
|
||||
$ticket_reply_created_at = nullable_htmlentities($row['ticket_reply_created_at']);
|
||||
@@ -318,7 +318,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
||||
<?php echo $ticket_reply; ?>
|
||||
|
||||
<?php
|
||||
while ($ticket_attachment = mysqli_fetch_array($sql_ticket_reply_attachments)) {
|
||||
while ($ticket_attachment = mysqli_fetch_assoc($sql_ticket_reply_attachments)) {
|
||||
$name = nullable_htmlentities($ticket_attachment['ticket_attachment_name']);
|
||||
$ref_name = nullable_htmlentities($ticket_attachment['ticket_attachment_reference_name']);
|
||||
echo "<hr><i class='fas fa-fw fa-paperclip text-secondary mr-1'></i>$name | <a href='../uploads/tickets/$ticket_id/$ref_name' download='$name'><i class='fas fa-fw fa-download mr-1'></i>Download</a> | <a target='_blank' href='../uploads/tickets/$ticket_id/$ref_name'><i class='fas fa-fw fa-external-link-alt mr-1'></i>View</a>";
|
||||
@@ -345,5 +345,3 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
||||
}
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ $sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type FRO
|
||||
<option value="0">- No Category -</option>
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Ticket' AND category_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = nullable_htmlentities($row['category_name']);
|
||||
|
||||
@@ -89,7 +89,7 @@ $sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type FRO
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_assets)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = sanitizeInput($row['asset_name']);
|
||||
$asset_type = sanitizeInput($row['asset_type']);
|
||||
@@ -116,4 +116,3 @@ $sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type FRO
|
||||
|
||||
<?php
|
||||
require_once 'includes/footer.php';
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ $all_tickets = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_nu
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($all_tickets)) {
|
||||
while ($row = mysqli_fetch_assoc($all_tickets)) {
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
@@ -75,4 +75,3 @@ $all_tickets = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_nu
|
||||
|
||||
<?php
|
||||
require_once 'includes/footer.php';
|
||||
|
||||
|
||||
@@ -26,17 +26,17 @@ $contact_tickets = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticke
|
||||
|
||||
//Get Total tickets closed
|
||||
$sql_total_tickets_closed = mysqli_query($mysqli, "SELECT COUNT(ticket_id) AS total_tickets_closed FROM tickets WHERE ticket_closed_at IS NOT NULL AND ticket_client_id = $session_client_id AND ticket_contact_id = $session_contact_id");
|
||||
$row = mysqli_fetch_array($sql_total_tickets_closed);
|
||||
$row = mysqli_fetch_assoc($sql_total_tickets_closed);
|
||||
$total_tickets_closed = intval($row['total_tickets_closed']);
|
||||
|
||||
//Get Total tickets open
|
||||
$sql_total_tickets_open = mysqli_query($mysqli, "SELECT COUNT(ticket_id) AS total_tickets_open FROM tickets WHERE ticket_closed_at IS NULL AND ticket_client_id = $session_client_id AND ticket_contact_id = $session_contact_id");
|
||||
$row = mysqli_fetch_array($sql_total_tickets_open);
|
||||
$row = mysqli_fetch_assoc($sql_total_tickets_open);
|
||||
$total_tickets_open = intval($row['total_tickets_open']);
|
||||
|
||||
//Get Total tickets
|
||||
$sql_total_tickets = mysqli_query($mysqli, "SELECT COUNT(ticket_id) AS total_tickets FROM tickets WHERE ticket_client_id = $session_client_id AND ticket_contact_id = $session_contact_id");
|
||||
$row = mysqli_fetch_array($sql_total_tickets);
|
||||
$row = mysqli_fetch_assoc($sql_total_tickets);
|
||||
$total_tickets = intval($row['total_tickets']);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ $total_tickets = intval($row['total_tickets']);
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($contact_tickets)) {
|
||||
while ($row = mysqli_fetch_assoc($contact_tickets)) {
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
|
||||
@@ -21,7 +21,7 @@ $invoices_sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_clie
|
||||
|
||||
// Payment Provider Active Query
|
||||
$sql_payment_provider = mysqli_query($mysqli, "SELECT * FROM payment_providers WHERE payment_provider_active = 1 LIMIT 1;");
|
||||
$row = mysqli_fetch_array($sql_payment_provider);
|
||||
$row = mysqli_fetch_assoc($sql_payment_provider);
|
||||
$payment_provider_id = intval($row['payment_provider_id']);
|
||||
$payment_provider_active = intval($row['payment_provider_active']);
|
||||
$payment_provider_threshold = floatval($row['payment_provider_threshold']);
|
||||
@@ -29,7 +29,7 @@ $payment_provider_threshold = floatval($row['payment_provider_threshold']);
|
||||
// Saved Payment Methods
|
||||
$sql_saved_payment_methods = mysqli_query($mysqli, "
|
||||
SELECT * FROM client_saved_payment_methods
|
||||
LEFT JOIN payment_providers
|
||||
LEFT JOIN payment_providers
|
||||
ON client_saved_payment_methods.saved_payment_provider_id = payment_providers.payment_provider_id
|
||||
WHERE saved_payment_client_id = $session_client_id
|
||||
AND payment_provider_active = 1;
|
||||
@@ -39,12 +39,12 @@ $sql_saved_payment_methods = mysqli_query($mysqli, "
|
||||
// Billing Card Queries
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_invoice_amounts = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $session_client_id AND invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable'");
|
||||
$row = mysqli_fetch_array($sql_invoice_amounts);
|
||||
$row = mysqli_fetch_assoc($sql_invoice_amounts);
|
||||
|
||||
$invoice_amounts = floatval($row['invoice_amounts']);
|
||||
|
||||
$sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $session_client_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
$row = mysqli_fetch_assoc($sql_amount_paid);
|
||||
|
||||
$amount_paid = floatval($row['amount_paid']);
|
||||
|
||||
@@ -61,11 +61,11 @@ $balance = $invoice_amounts - $amount_paid;
|
||||
<button type="button" class="btn btn-outline-success dropdown-toggle float-right" data-toggle="dropdown"><i class="fa fa-fw fa-credit-card mr-2"></i>Pay Balance <strong>(<?php echo numfmt_format_currency($currency_format, $balance, $session_company_currency); ?>)</strong></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="//<?php echo $config_base_url ?>/guest/guest_pay_invoice_stripe.php?invoice_id=<?php echo "$invoice_id&url_key=$invoice_url_key"; ?>">Enter Card Manually</a>
|
||||
<?php
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_saved_payment_methods) > 0) { ?>
|
||||
<h6 class="dropdown-header text-left">Pay with a Saved Card</h6>
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_saved_payment_methods)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_saved_payment_methods)) {
|
||||
$saved_payment_id = intval($row['saved_payment_id']);
|
||||
$saved_payment_description = nullable_htmlentities($row['saved_payment_description']);
|
||||
$payment_provider_name = nullable_htmlentities($row['payment_provider_name']);
|
||||
@@ -96,7 +96,7 @@ $balance = $invoice_amounts - $amount_paid;
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($invoices_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($invoices_sql)) {
|
||||
$invoice_id = intval($row['invoice_id']);
|
||||
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
|
||||
$invoice_number = intval($row['invoice_number']);
|
||||
@@ -150,17 +150,17 @@ $balance = $invoice_amounts - $amount_paid;
|
||||
(
|
||||
$payment_provider_threshold == 0 ||
|
||||
$payment_provider_threshold > $invoice_amount
|
||||
)
|
||||
)
|
||||
){ ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-success dropdown-toggle" data-toggle="dropdown"><i class="fa fa-fw fa-credit-card mr-2"></i>Pay</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="//<?php echo $config_base_url ?>/guest/guest_pay_invoice_stripe.php?invoice_id=<?php echo "$invoice_id&url_key=$invoice_url_key"; ?>">Enter Card Manually</a>
|
||||
|
||||
<?php
|
||||
|
||||
<?php
|
||||
// Saved Payment Methods
|
||||
$sql_saved_payment_methods = mysqli_query($mysqli, "
|
||||
SELECT * FROM client_saved_payment_methods
|
||||
LEFT JOIN payment_providers
|
||||
LEFT JOIN payment_providers
|
||||
ON client_saved_payment_methods.saved_payment_provider_id = payment_providers.payment_provider_id
|
||||
WHERE saved_payment_client_id = $session_client_id
|
||||
AND payment_provider_active = 1;
|
||||
@@ -168,7 +168,7 @@ $balance = $invoice_amounts - $amount_paid;
|
||||
if (mysqli_num_rows($sql_saved_payment_methods) > 0) { ?>
|
||||
<h6 class="dropdown-header text-left">Pay with a Saved Card</h6>
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_saved_payment_methods)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_saved_payment_methods)) {
|
||||
$saved_payment_id = intval($row['saved_payment_id']);
|
||||
$saved_payment_description = nullable_htmlentities($row['saved_payment_description']);
|
||||
$payment_icon = "fas fa-credit-card"; // default icon
|
||||
@@ -207,4 +207,3 @@ $balance = $invoice_amounts - $amount_paid;
|
||||
|
||||
<?php
|
||||
require_once "includes/footer.php";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user