asset mgmt integration

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

asset mgmt integration

Post by dr_patso »

Script URL:
Version of script: 2.4.1
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

I am somewhat integrating a bit of asset mgmt into my hesk installation.... This just a simple left join query to html table. I display the ticket ID field associated with the asset (joining on a custom field for serial number)..... I was looking at the code for the show tickets function and how it links that ticket id to the url of the ticket with the tracking id...... it seems there are a lot of shortened codes and i cannot pinpoint how to pull this off with my table.. can any php gurus help me?

Simple Question: How can I make my ticket ID column in my query to HTML table make the ID results link to the ticket.

Code: Select all

<?php
/*******************************************************************************
*  Title: Help Desk Software HESK
*  Version: 2.4.1 from 18th August 2012
*  Author: Klemen Stirn
*  Website: http://www.hesk.com
********************************************************************************
*  COPYRIGHT AND TRADEMARK NOTICE
*  Copyright 2005-2012 Klemen Stirn. All Rights Reserved.
*  HESK is a registered trademark of Klemen Stirn.

*  The HESK may be used and modified free of charge by anyone
*  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
*  By using this code you agree to indemnify Klemen Stirn from any
*  liability that might arise from it's use.

*  Selling the code for this program, in part or full, without prior
*  written consent is expressly forbidden.

*  Using this code, in part or full, to create derivate work,
*  new scripts or products is expressly forbidden. Obtain permission
*  before redistributing this software over the Internet or in
*  any other medium. In all cases copyright and header must remain intact.
*  This Copyright is in full effect in any country that has International
*  Trade Agreements with the United States of America or
*  with the European Union.

*  Removing any of the copyright notices without purchasing a license
*  is expressly forbidden. To remove HESK copyright notice you must purchase
*  a license for this script. For more information on how to obtain
*  a license please visit the page below:
*  https://www.hesk.com/buy.php
*******************************************************************************/

define('IN_SCRIPT',1);
define('HESK_PATH','../');

/* Make sure the install folder is deleted */
if (is_dir(HESK_PATH . 'install')) {die('Please delete the <b>install</b> folder from your server for security reasons then refresh this page!');}

/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/database.inc.php');

hesk_session_start();
hesk_dbConnect();
hesk_isLoggedIn();

define('CALENDAR',1);
define('MAIN_PAGE',1);

/* Print header */
require_once(HESK_PATH . 'inc/header.inc.php');

/* Print admin navigation */
require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
?>

</td>
</tr>
<tr>
<td>

<?php
$con=mysqli_connect("localhost","heskusr","password","hesk");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT hesk_assets.CUST, hesk_assets.ASSET_SERIAL_NR, hesk_assets.ASSET_STATUS, hesk_assets.ASSET_SW_VERSION, hesk_assets.LAST, hesk_users.name, hesk_tickets.id FROM hesk_assets LEFT JOIN hesk_tickets ON hesk_assets.ASSET_SERIAL_NR = hesk_tickets.custom1 LEFT JOIN hesk_users ON hesk_users.id = hesk_tickets.owner WHERE NOT hesk_tickets.status = 4 AND hesk_assets.ASSET_SERIAL_NR = hesk_tickets.custom1 AND hesk_tickets.category =1");


?>


        <table style="width:100%;border:none;border-collapse:collapse;"><tr>
        <td style="width:25%">&nbsp;</td>
        <td style="width:50%;text-align:center"><h3>Current Assets</h3></td>
		<td style="width:25%;text-align:right">I don't know</td> 
        </tr></table>

		<br>

<center>
<?php

echo "<table border='1'>
<tr>
<th>Customer</th>
<th>Serial Number</th>
<th> Status</th>
<th>Code</th>
<th>Last Message</th>
<th>Owner</th>
<th>Ticket #</th>
</tr>";

while($row = mysqli_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['CUST'] . "</td>";
  echo "<td>" . $row['ASSET_SERIAL_NR'] . "</td>";
  echo "<td>" . $row['ASSET_STATUS'] . "</td>";
  echo "<td>" . $row['ASSET_SW_VERSION'] . "</td>";
  echo "<td>" . $row['LAST'] . "</td>";
  echo "<td>" . $row['name'] . "</td>";
  echo "<td>" . $row['id'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysqli_close($con);
?>
</center>
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: asset mgmt integration

Post by Klemen »

Something like this?

Code: Select all

echo "<td><a href="admin_ticket.php?track=TRACK_ID">" . $row['id'] . "</a></td>";
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: asset mgmt integration

Post by dr_patso »

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\admin\assets.php on line 111

Hi Klemen, thanks for your input!! with your command I received the above error.

I was able to get this line to work by removing the quotes but it doesn't pull the tracking ID it actually uses TRACKID

Code: Select all

echo "<td><a href=admin_ticket.php?track=TRACK_ID>" . $row['id'] . "</a></td>";
Am I not calling a hesk file I need to be calling for this to work? Or do I need to Select the Track ID as well in my query or something?

Image
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: asset mgmt integration

Post by Klemen »

You will need to fetch the "trackid" column from the hesk_tickets table as well and use $row['trackid'] to show it in the code.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: asset mgmt integration

Post by dr_patso »

LOLOL YAAA!!!! Klemen you rock. This is probably a weird way of doing this but it works....

Code: Select all

<echo "<td><a href=admin_ticket.php?track=" . $row['trackid'] . ">" . $row['id'] . "</a></td>";
So now the ticket ID displays in this column and links to the correct ticket by the tracking id.
Post Reply