Fix a bunch of PHP Errors regarding various variable issues non existent vars, cleaned up client export documentation and export assets etc

This commit is contained in:
johnnyq
2021-12-09 15:26:21 -05:00
parent d78a24f3a5
commit a5a8fbc319
7 changed files with 17 additions and 30 deletions

View File

@@ -93,7 +93,7 @@
<select class="form-control select2" name="country"> <select class="form-control select2" name="country">
<option value="">- Country -</option> <option value="">- Country -</option>
<?php foreach($countries_array as $country_name) { ?> <?php foreach($countries_array as $country_name) { ?>
<option <?php if($config_default_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option> <option <?php if($session_company_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>

View File

@@ -113,7 +113,7 @@
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_ticket_updates" value="1" checked> <input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_ticket_updates" value="1" checked>
<label class="custom-control-label" for="customControlAutosizing">Email ticket updates <span class="text-secondary"><?php echo $client_email; ?></span></label> <label class="custom-control-label" for="customControlAutosizing">Email ticket updates <span class="text-secondary"><?php echo $contact_email; ?></span></label>
</div> </div>
</div> </div>

View File

@@ -117,7 +117,7 @@
<select class="form-control select2" name="country"> <select class="form-control select2" name="country">
<option value="">- Country -</option> <option value="">- Country -</option>
<?php foreach($countries_array as $country_name) { ?> <?php foreach($countries_array as $country_name) { ?>
<option <?php if($config_default_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option> <option <?php if($session_company_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>

View File

@@ -30,15 +30,18 @@ if(isset($_GET['client_id'])){
$client_net_terms = $config_default_net_terms; $client_net_terms = $config_default_net_terms;
} }
$client_support = $row['client_support']; $client_support = $row['client_support'];
$client_notes = $row['client_notes']; $client_notes = $row['client_notes'];
$client_created_at = $row['client_created_at'];
$primary_contact = $row['primary_contact']; $primary_contact = $row['primary_contact'];
$primary_location = $row['primary_location']; $primary_location = $row['primary_location'];
$contact_id = $row['contact_id'];
$contact_name = $row['contact_name']; $contact_name = $row['contact_name'];
$contact_title = $row['contact_title']; $contact_title = $row['contact_title'];
$contact_email = $row['contact_email']; $contact_email = $row['contact_email'];
$contact_phone = $row['contact_phone']; $contact_phone = $row['contact_phone'];
$contact_extension = $row['contact_extension']; $contact_extension = $row['contact_extension'];
$contact_mobile = $row['contact_mobile']; $contact_mobile = $row['contact_mobile'];
$location_id = $row['location_id'];
$location_name = $row['location_name']; $location_name = $row['location_name'];
$location_address = $row['location_address']; $location_address = $row['location_address'];
$location_city = $row['location_city']; $location_city = $row['location_city'];

View File

@@ -116,7 +116,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
} }
$location_photo = $row['location_photo']; $location_photo = $row['location_photo'];
$location_notes = $row['location_notes']; $location_notes = $row['location_notes'];
$location_primary = $row['location_primary'];
$location_created_at = $row['location_created_at']; $location_created_at = $row['location_created_at'];
$location_contact_id = $row['location_contact_id']; $location_contact_id = $row['location_contact_id'];
if($location_id == $primary_location){ if($location_id == $primary_location){

View File

@@ -42,7 +42,7 @@
<option value="">- Category -</option> <option value="">- Category -</option>
<?php <?php
$sql_income_category = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$income_created_at' OR category_archived_at IS NULL) AND company_id = $session_company_id ORDER BY category_name ASC"); $sql_income_category = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$invoice_created_at' OR category_archived_at IS NULL) AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql_income_category)){ while($row = mysqli_fetch_array($sql_income_category)){
$category_id_select= $row['category_id']; $category_id_select= $row['category_id'];
$category_name_select = $row['category_name']; $category_name_select = $row['category_name'];

View File

@@ -4121,7 +4121,7 @@ if(isset($_GET['export_client_assets_csv'])){
$client_name = $row['client_name']; $client_name = $row['client_name'];
$sql = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC"); $sql = mysqli_query($mysqli,"SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id LEFT JOIN locations ON asset_location_id = location_id WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
if($sql->num_rows > 0){ if($sql->num_rows > 0){
$delimiter = ","; $delimiter = ",";
$filename = $client_name . "-Assets-" . date('Y-m-d') . ".csv"; $filename = $client_name . "-Assets-" . date('Y-m-d') . ".csv";
@@ -4130,12 +4130,12 @@ if(isset($_GET['export_client_assets_csv'])){
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
//set column headers //set column headers
$fields = array('Name', 'Type', 'Make', 'Model', 'Serial Number', 'MAC Address', 'IP Address', 'Operating System', 'Purchase Date', 'Warranty Expiration Date', 'Notes'); $fields = array('Name', 'Type', 'Make', 'Model', 'Serial Number', 'Operating System', 'Purchase Date', 'Warranty Expire', 'Install Date', 'Assigned To', 'Location', 'Notes');
fputcsv($f, $fields, $delimiter); fputcsv($f, $fields, $delimiter);
//output each row of the data, format line as csv and write to file pointer //output each row of the data, format line as csv and write to file pointer
while($row = $sql->fetch_assoc()){ while($row = $sql->fetch_assoc()){
$lineData = array($row['asset_name'], $row['asset_type'], $row['asset_make'], $row['asset_model'], $row['asset_serial'], $row['asset_mac'], $row['asset_ip'], $row['asset_os'], $row['asset_purchase_date'], $row['asset_warranty_expire'], $row['asset_notes']); $lineData = array($row['asset_name'], $row['asset_type'], $row['asset_make'], $row['asset_model'], $row['asset_serial'], $row['asset_os'], $row['asset_purchase_date'], $row['asset_warranty_expire'], $row['asset_install_date'], $row['contact_name'], $row['location_name'], $row['asset_notes']);
fputcsv($f, $lineData, $delimiter); fputcsv($f, $lineData, $delimiter);
} }
@@ -5404,7 +5404,7 @@ if(isset($_GET['export_client_pdf'])){
var docDefinition = { var docDefinition = {
info: { info: {
title: '<?php echo $client_name; ?>- IT Documentation', title: '<?php echo $client_name; ?>- IT Documentation',
author: <?php echo json_encode($company_name); ?> author: <?php echo json_encode($session_company_name); ?>
}, },
footer: { footer: {
columns: [ columns: [
@@ -5787,20 +5787,12 @@ if(isset($_GET['export_client_pdf'])){
text: 'Model', text: 'Model',
style: 'itemHeader' style: 'itemHeader'
}, },
{
text: 'OS',
style: 'itemHeader'
},
{ {
text: 'Serial', text: 'Serial',
style: 'itemHeader' style: 'itemHeader'
}, },
{ {
text: 'IP', text: 'OS',
style: 'itemHeader'
},
{
text: 'MAC',
style: 'itemHeader' style: 'itemHeader'
}, },
{ {
@@ -5812,7 +5804,7 @@ if(isset($_GET['export_client_pdf'])){
style: 'itemHeader' style: 'itemHeader'
}, },
{ {
text: 'Notes', text: 'Install Date',
style: 'itemHeader' style: 'itemHeader'
} }
], ],
@@ -5829,6 +5821,7 @@ if(isset($_GET['export_client_pdf'])){
$asset_mac = $row['asset_mac']; $asset_mac = $row['asset_mac'];
$asset_purchase_date = $row['asset_purchase_date']; $asset_purchase_date = $row['asset_purchase_date'];
$asset_warranty_expire = $row['asset_warranty_expire']; $asset_warranty_expire = $row['asset_warranty_expire'];
$asset_install_date = $row['asset_install_date'];
$asset_notes = $row['asset_notes']; $asset_notes = $row['asset_notes'];
?> ?>
@@ -5845,20 +5838,12 @@ if(isset($_GET['export_client_pdf'])){
text: <?php echo json_encode("$asset_make $asset_model"); ?>, text: <?php echo json_encode("$asset_make $asset_model"); ?>,
style: 'item' style: 'item'
}, },
{
text: <?php echo json_encode($asset_os); ?>,
style: 'item'
},
{ {
text: <?php echo json_encode($asset_serial); ?>, text: <?php echo json_encode($asset_serial); ?>,
style: 'item' style: 'item'
}, },
{ {
text: <?php echo json_encode($asset_ip); ?>, text: <?php echo json_encode($asset_os); ?>,
style: 'item'
},
{
text: <?php echo json_encode($asset_mac); ?>,
style: 'item' style: 'item'
}, },
{ {
@@ -5870,7 +5855,7 @@ if(isset($_GET['export_client_pdf'])){
style: 'item' style: 'item'
}, },
{ {
text: <?php echo json_encode($asset_notes); ?>, text: <?php echo json_encode($asset_install_date); ?>,
style: 'item' style: 'item'
} }
], ],