Upgrading osTicket 1.10.x to current 1.11.0

So you’re running osTicket version 1.10.x and you want to upgrade it to current which as of this writing is 1.11.0, and you need a little help. Well, you’ve come to the right place.  One very important thing to note: contrary to what the osTicket FAQ at http://osticket.com/faq says, you need a newer version of PHP than 5.3.  I would recommend any version from 5.6 to 7.2.  So if you have 5.3 go upgrade first.  This version introduces support for 5.6 to 7.2.  As of this writing I am running 7.2.15 in production on multiple sites.

If you have ever upgraded osTicket in the past your experience this time will not be much different than it was previously.

Before you start it is important to mention that if you have installed any mods or performed any custom coding (including changing graphics, translations, etc.) that upgrading will not be as simple as it sounds in this article and you will lose all the modifications that you have made. You could very well break your site or at the very least lose some of the functionality that you currently enjoy.

1. Put the site into offline mode.

To do this log into your site and navigate to Admin panel -> Settings -> Helpdesk Status and toggle the radial to “Offline (Disabled)”, scroll down and click “Save Changes”.

note: I personally leave the site open, but navigated back to the Client panel.

2. Make a backup of your database.

There are various ways to do this and I am not going to cover all of them. My preferred way is to use command line. You can do this by simply issuing a command similar to:

mysqldump -u userName -p databaseName > fileName.sql

note: change userName to your DB username, databaseName to the name of your DB, and fileName to what ever you want to call the backup file.

One other easy way to do backups (on windows) is to use MySQL Admin (deprecated) or MySQL WorkBench.

3. Make a backup of your site.

Once again there are various ways to achieve this. I trust that you know how you want to do it, just make sure that you do it.

NOTE: You should never rely on your ISPs automatic backups,
always make your own backups before upgrading!!!

While you are here, you may want to also make a separate copy of your /include/ost-config.php file. This file contains the database connection information.

4. Download the latest version of OSTicket. osticket.com/download.

Note: If you are running any plugins (especially any of the auth plugins), you should also download the new versions of those.

5. Extract it to your OSTicket directory. Yes, you can and should have it over write existing files.

Note: If you also downloaded upgrade to your plugins make sure that you put there in /include/plugins at this point.

6. re load your web page. When the page loads you should be looking at the image below. Since this is an upgrade you should be looking at the upgrader. This is important to note since the Upgrader looks different from the Installer.

fig 1 – upgrader
click image to enlarge

 

 

At this point you should be able to click the “Start Upgrade Now” button. The next screen should look like this:

fig 2 – upgrader, page 2
click image to enlarge

 

 

Unless you have a reason not to, go ahead and click the “Do It Now!” button. This should result in a small rectangle popping up in the middle of your screen like this:

fig 3 – upgrader upgrading

 

 

Once it has completed you should be looking at the following page:

fig 4 – upgrader, upgrade completed
click image to enlarge

 

 

Now, if you click on the Settings tab you should be looking at the following:

fig 5 – admin panel, version
click image to enlarge

 

 

While you are here, if you had previously put the site into Offline mode, you should put it back in Online mode (don’t forget to click Save Changes at the bottom of the page).

Congratulations! You’ve upgraded from 1.10.x to 1.11.0, however you are not quite finished yet.

7. Time for post install clean up.

Go into your OSTicket directory and delete [or rename] the setup folder. It is not needed for a live or production site and should never be left on a publicly accessible server. I recommend that you delete it, but some people like renaming it to keep the files around should they need it again. For the record you should not need it again, and if you did you can always just re-download the distribution archive. This will also get rid of the annoying nag screen at the top of the site.

Next go to your /include folder and make the ost-config.php read only. How to do this varies by OS.

That’s it for the “hard” stuff. I recommend that you take another backup of your site (both database and files) since you just made major changes to the site.

Enjoy!

ntozier / tmib

 

p.s. the instructions for installing and configuring the LDAP/AD plugin really haven’t changed.

Installing osTicket 1.10.4: Troubleshooting MySQL8 and PHP older than 7.1.16

MySQL 8 was released recently (to this writing) and of course that means people are going to start using it.  Since I have seen a couple posts on the forums with people using MySQL 8 I decided to fire up a new VM and install the following:

  • OS: Windows 2012 R2
  • Webserver: IIS 8
  • MySQL 8.0.12
  • PHP 5.6.31

note: PHP 5.6 is still the recommended version of PHP for osTicket until 1.11 is released.  You should not have this problem if you are running PHP 7.1.16+ or PHP 7.2.4+ but since osTicket does not support those versions yet.

After checking to make sure that: IIS was serving pages and PHP was working in IIS it was time to download and install osTicket.  The new website downloader is neat and allows you to download a languages and plugins together which can be a time saver. As a reminder always install osTicket with out any language packs and then add your desired language packs.

Running the installer resulted in the following error:

Database Connection information `Unabled to connect to MySQL Server: Server sent charset unknown to the client.`  Please report to the devs

To fix this you will need to locate and edit your MySQL configuration file (my.cnf or my.ini). Since this is a new MySQL 8 installation under windows it is at: C:\ProgramData\MySQL\MySQL Server 8.0\my.ini.  Once you located the file locate # character-set-server=.  Directly after it add the line:character-set-server=utf8

Next you will need to restart MySQL.  You might be able to do this with MySQL WorkBench or services.msc.  My server had some patches that installed so I just restarted the server for the patches to finish.

Running the installer again of course resulted in another error message:

Database connection information `Unable to connect to MySQL Server: The server requested authentication method unknown to the client`

Starting with MySQL 8.0.4, the default authentication plugin for MySQL server was changed from mysql_native_password to caching_sha2_password. There are two things that you need to do in MySQL to fix this. First: if you are running an older version of PHP (pre 7.1.16) you will need to set default_authentication_plugin=mysql_native_password in my.cnf. Restart the server.

Next you will need to edit the user account. I could not do this in the most recent version of MySQL WorkBench using the ui. You can do this one of two ways:
1. delete and recreate the user. Make sure authentication is set to ‘Standard’. Make sure you give the same permissions back that the user had.
2. run the following SQL Query (edit this for your user)
alter user 'username'@'localhost' identified with mysql_native_password by 'password';

After doing this the installer ran fine.

Add a client side open ticket list to osTicket 1.10+

Since I released my old article on how to add a client side open ticket list I've been meaning to rewrite the mod. The article that your reading now an updated and re-written version for 1.10 and 1.10.1 releases.

One of the features that I would love to see integrated into osTicket is an open ticket listing for clients. While I would like to see this added to code it would really need some more coding to make it viable as a PR. Being able to make this a plugin would be great, but I dont think that this is viable with out editing core files at this time.  

I feel that this simple mod gives users the ability to see what tickets are already open. This should cut down on duplicate tickets, and give the user a better idea of how many tickets are ahead of them when placing a request. This mod was originally written for osTicket 1.6ST and re-released for 1.7, 1.8, 1.9 and 1.10. This rewritten version utilizes the osTicket db access functions.  While this mod is here for everyone to be able to use, it would be great if the people who use it donated .

In the past I have included two ways to install (the mod). However with this release I am only including one way to install this (chiefly due to the fact that no one has ever donated a dime for this mod).

1. Save the display_open_topics.php into your base osTicket folder. Open it and edit the lines 18 through 24 to match your setup.

2. open osticketDirectory\assets\default\css\theme.css with your favorite text editor and scroll all the way to the bottom and add the following:

#openticks {
  padding:5px;
  background:#BFBFBF;
  -moz-border-radius: 5px;
  border-radius: 5px;
  -moz-box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
  -webkit-box-shadow: 3px 3px rgba(0, 0, 0, 0.4);
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
}

#openticks-a {
  border-right-style: solid;
  border-right-width: 1px;
  border-right-color: #BFBFBF;
  text-align:center;
  vertical-align:middle;
  padding-bottom:4px;
}

#openticks-b {
  text-align:center;
  vertical-align:middle;
  padding-bottom:4px;
}

3.  open and edit \index.php scroll down and replace line 79-82

</div>
</div>

<?php require(CLIENTINC_DIR.'footer.inc.php'); ?>

change to:

</div>
<p style="text-align:center">Be sure to browse both our <a href="kb/index.php">Featured Questions (FAQs)</a>, and the open tickets below before opening a ticket.  Thank you.
  <div id="openticks"><?php include('display_open_topics.php'); ?></div>
</p>
</div>

<?php require(CLIENTINC_DIR.'footer.inc.php'); ?>

The file archive for this mod can be downloaded here.

Running 1.9? Please see this article instead for that version: Add a client side open ticket list to osTicket 1.9 or 1.10rc2

Running 1.8? Please see this article instead for that version: Add a client side open ticket list to osTicket 1.8

Upgrading osTicket 1.9.x to current (1.10)

So you're running osTicket version 1.9.x and you want to upgrade it to current which as of this writing is 1.10, and you need a little help. Well, you've come to the right place.  One very important thing to note: contrary to what the osTicket FAQ at http://osticket.com/faq says, you need a newer version of PHP than 5.3.  I would recommend PHP 5.5 or 5.6 over any other versions at this time.  So if you have 5.3 go upgrade to 5.5 of 5.6.  This version introduces support for PHP 7.0, but there have been reports on the forums that newer versions of 7.0 and 7.1 have issues.

If you have ever upgraded osTicket in the past your experience this time will not be much different than it was previously.

Before you start it is important to mention that if you have installed any mods or performed any custom coding (including changing graphics, translations, etc.) that upgrading will not be as simple as it sounds in this article and you will lose all the modifications that you have made. You could very well break your site or at the very least lose some of the functionality that you currently enjoy.

  1. Put the site into offline mode.

To do this log into your site and navigate to Admin panel -> Settings -> Helpdesk Status and toggle the radial to "Offline (Disabled)", scroll down and click "Save Changes".

note: I personally leave the site open, but navigated back to the Client panel.

  2. Make a backup of your database.

There are various ways to do this and I am not going to cover all of them. My preferred way is to use command line. You can do this by simply issuing a command similar to:

mysqldump -u userName -p databaseName > fileName.sql

note: change userName to your DB username, databaseName to the name of your DB, and fileName to what ever you want to call the backup file.

One other easy way to do backups (on windows) is to use MySQL Admin (deprecated) or MySQL WorkBench.

  3. Make a backup of your site.

Once again there are various ways to achieve this. I trust that you know how you want to do it, just make sure that you do it.

NOTE: You should never rely on your ISPs automatic backups,
always make your own backups before upgrading!!!

While you are here, you may want to also make a separate copy of your /include/ost-config.php file. This file contains the database connection information.

  4. Download the latest version of OSTicket. osticket.com/download.

Note: If you are running any plugins (especially any of the auth plugins), you should also download the new versions of those.

  5. Extract it to your OSTicket directory. Yes, you can and should have it over write existing files.

Note: If you also downloaded upgrade to your plugins make sure that you put there in /include/plugins at this point.

  6. re load your web page. When the page loads you should be looking at the image below. Since this is an upgrade you should be looking at the upgrader. This is important to note since the Upgrader looks different from the Installer.

fig 1 – upgrader
click image to enlarge

 

At this point you should be able to click the "Start Upgrade Now" button. The next screen should look like this:

fig 2 – upgrader, page 2
click image to enlarge

 

Unless you have a reason not to, go ahead and click the "Do It Now!" button. This should result in a small rectangle popping up in the middle of your screen like this:

fig 3 – upgrader upgrading

 

Once it has completed you should be looking at the following page:

fig 4 – upgrader, upgrade completed
click image to enlarge

 

Now, if you click on the Settings tab you should be looking at the following:

fig 5 – admin panel, version
click image to enlarge

 

While you are here, if you had previously put the site into Offline mode, you should put it back in Online mode (don't forget to click Save Changes at the bottom of the page).

Congratulations! You've upgraded from 1.9.x to 1.10, however you are not quite finished yet.

  7. Time for post install clean up.

Go into your OSTicket directory and delete [or rename] the setup folder. It is not needed for a live or production site and should never be left on a publicly accessible server. I recommend that you delete it, but some people like renaming it to keep the files around should they need it again. For the record you should not need it again, and if you did you can always just re-download the distribution archive. This will also get rid of the annoying nag screen at the top of the site.

Next go to your /include folder and make the ost-config.php read only. How to do this varies by OS.

That's it for the "hard" stuff. I recommend that you take another backup of your site (both database and files) since you just made major changes to the site.

Enjoy!

N

tmib

 

p.s. the instructions for installing and configuring the LDAP/AD plugin really haven't changed.

Add a client side open ticket list to osTicket 1.9 or 1.10rc2

This mod was updated on 15 Dec 2015

Ever since 1.9 was released my old article on how to add a client side open ticket list has been deprecated. The article that your reading now is yet another updated version to work with both the 1.9.x and 1.10rc2 releases.

One of the features that I would love to see integrated into osTicket is an open ticket listing for clients. While I do beleive that this would be best added to core or made into a plugin this will have to suffice until one of those two things are realized.  

I feel that this simple version gives users the ability to see what tickets are already open so as to cut down on duplicate tickets, and gives the user a better idea of how many tickets are ahead of them when placing a request. This mod was originally written for osTicket 1.6ST and re-released for 1.7, 1.8 and now finally 1.9 and 1.10.  While this mod is here for everyone to be able to use, it would be great if the people who use it donated .

In the past I have included two ways to install (the mod). However with this release I am only including one way to install this (chiefly due to the fact that no one has ever donated a dime for this mod).

1. Save the display_open_topics.php into your base osTicket folder. Open it and edit the lines 18 through 24 to match your setup.

2. open osticketDirectory\assets\default\css\theme.css with your favorite text editor and scroll all the way to the bottom and add the following:

#openticks {
  padding:5px;
  background:#BFBFBF;
  -moz-border-radius: 5px;
  border-radius: 5px;
  -moz-box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
  -webkit-box-shadow: 3px 3px rgba(0, 0, 0, 0.4);
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
}

#openticks-a {
  border-right-style: solid;
  border-right-width: 1px;
  border-right-color: #BFBFBF;
  text-align:center;
  vertical-align:middle;
  padding-bottom:4px;
}

#openticks-b {
  text-align:center;
  vertical-align:middle;
  padding-bottom:4px;
}

3.  open and edit \index.php scroll down and replace line 79-82

</div>
</div>

<?php require(CLIENTINC_DIR.'footer.inc.php'); ?>

change to:

</div>
<p style="text-align:center">Be sure to browse both our <a href="kb/index.php">Featured Questions (FAQs)</a>, and the open tickets below before opening a ticket.  Thank you.
  <div id="openticks"><?php include('display_open_topics.php'); ?></div>
</p>
</div>

<?php require(CLIENTINC_DIR.'footer.inc.php'); ?>

The file archive for this mod can be downloaded here.

Running 1.8? Please use see this article instead for that version: Add a client side open ticket list to osTicket 1.8

Upgrading osTicket 1.8.1.2 to current (1.9rc)

So your running osTicket version 1.8.1.2 and you want to upgrade it to current which as of this writing is 1.9-rc1. Yopu’ve come to the right place. A couple notes before we get started. You may have read something on the forums about the pending release of 1.8.2 well due to the number of and the severity of changes in this new version it was decided that the 1.8.2 release number would be skipped and we would jump right to 1.9. This is not a minor release like originally planned, and I have to say that the beta group gave us some fantastic feedback. If you are interested in joining the osTicket AVid Users (Beta group) please go to https://groups.google.com/a/osticket.com/forum/#!forum/beta-testers

Now back to our regularly scheduled article.

Rember that 1.9-rc1 is not a stable release and should never be used on a production server in a production environment. You should really wait for 1.9ST to be released before you upgrade. The images in this article are for going from v 1.8.1.2 to 1.8.2 but this is the same thing as 1.9 as I stated previously the only real difference is the version number.

If you have ever upgraded osTicket in the past your experience this time will not be much different than it has been.

Before you start it is important to mention that if you have installed any mods or performed any custom coding (including changing graphics, translations, etc.) that upgrading will not be as simple as it sounds in this article and you will lose all the modifications that you made. You could very well break your site and at the very least lose some of the functionality that you now enjoy.

  1. Put the site into offline mode.

To do this log into your site and navigate to Admin panel -> Settings -> Helpdesk Status and toggle the radial to “Offline (Disabled)”, scroll down and click “Save Changes”.

note: I personally leave the site open, but navigated back to the Client panel.

2. Make a back up of your database.

There are various ways to do this and I am not going to cover all of them, but my preferred way is to use command line. You can do this simply by issuing a command similar to:

mysqldump -u userName -p databaseName > fileName.sql

note: change userName to your DB username, databaseName to the name of your DB, and fileName to what ever you want to call the back up file.

Another easy way to do backups (on windows) is to use MySQL Admin (deprecated) or MySQL WorkBench.

3. Make a back up of your site.

Once again there are various ways to achieve this. I trust that you know how you want to do it, just make sure that you do it.

NOTE: You should never rely on your ISPs automatic backups,
always make your own backups before upgrading!!!

While you are here, you may want to also make a separate copy of your /include/ost-config.php file. This file contains the database connection information.

4. Download the latest version of OSTicket.  Once 1.9ST is released you will be able to get it from GitHub, but for right now you can only get the Release Candidate from osTicket.com/download-edge.

5. Extract it to your OSTicket directory. Yes, you can and should have it over write existing files.

6. re load your web page. When the page loads you should be looking at the image below. Since this is an upgrade you should be looking at the upgrader. This is important to note since the Upgrader looks different from the Installer.

fig 1 – upgrader
click image to enlarge

 

You should at this point be able to click the “Start Upgrade Now” button. The next screen should look like this:

fig 2 – upgrader, page 2
click image to enlarge

 

Unless you have a reason not to, go ahead and click the “Do It Now!” button. This should result in a small rectangle popping up in the middle of your screen like this:

fig 3 – upgrader, actual upgrading
click image to enlarge

 

Once it has completed you should be looking at the following page:

fig 4 – upgrader, upgrade completed
click image to enlarge

 

Now if you click on the Settings tab you should be looking at the following:

fig 5 – admin panel, version
click image to enlarge

 

While you are here if you put the site into Offline mode you should put it back in Online mode (don’t forget to click Save Changes at the bottom of the page).

Congratulations! You’ve upgraded from 1.8.1.2 to 1.9, however you are not quite finished yet.

7. Time for post install clean up.

First go into your OSTicket directory and delete [or rename] the setup folder. It is not needed for a live or production site and should never be left on a publicly accessible server. I recommend that you delete it, but some people like renaming it to keep the files around should they need it again. For the record you should not need it again, and if you did you can always just re-download the distribution archive.

 

That’s it for the “hard” stuff. I would at this point recommend that you take another back up of your site (both database and files) since you just made major changes to the site.

As a side note, if you are upgrading from 1.8.2 (beta) to 1.9rc you will not see the upgrader because there were no database changes between those two versions.

Enjoy!

N

tmib

 

p.s. the instructions for installing and configuring the LDAP/AD plugin really haven’t changed.

How to add a configuration option to osTicket 1.8.1.2

So you wrote a mod or a plugin and want to add some configuration options directly to into the osTicket Admin panel. This is a short tutorial on how to add a setting to osTicket 1.8.1.2, and then have your mod (or plugin) check that setting.

First off realize that modding osTicket can result in the breaking of your site, and you should really perform a backup of both the site and your database prior to making changes.

Next is to decide what you want your setting to be; where you want to put it in the admin panel; and what you want to label it.  Personally I wrote a mod a while back that adds a client side open ticket list and think it would be great to be able to toggle this feature on and off, and control how many open tickets the mod displays.  You do not have to have this mod installed to follow this tutorial, but I figured a real world example might be easier so this tutorial will assume that mod is already installed. To that end I've decided on two settings:

  • "Display Open Tickets to Clients" which will be a check box., and have the help text of " Allow clients to view a safe summary of open tickets on the landing page"
  • "Display # open ticket to Clients:" which will be a text field, and have a help text of " (Limit the number of open tickets to display to clients – default 10)"

I've decided to put both of these settings in Admin panel -> Settings -> Tickets, as the last two options before the "Attachments" section.  So lets start editting with adding these fields there.

Let's open and edit: /include/class.config.php
Scroll down to line 304.
Just after the closing } add:

    function clientDisplayOpen() {
        return $this->get('client_display_open');
    }

    function clientDisplayNum() {
        return $this->get('client_display_num');
    }

This will let us use those functions to get the config variables values later.

Next scroll down to line 903.
After the line that reads:
'allow_client_updates'=>isset($vars['allow_client_updates'])?1:
add:
'client_display_open'=>isset($vars['client_display_open'])?1:0,
'client_display_num'=>$vars['client_display_num'],

This will make sure that our fields get updated when we hit save.

Now lets open and edit: /include/staff/settings-tickets.inc.php.
Scroll down to line 138.
Place your cursor after the </tr> and hit enter.
We are going to add a new tr here to display the settings on the page.
add:
        <tr>
            <td>Display Open Tickets to Clients:</td>
            <td>
                <input type="checkbox" name="client_display_open" <?php
                echo $config['client_display_open']?'checked="checked"':''; ?>>
                Allow clients to view a safe summary of open tickets on the landing page
            </td>
        </tr>
        <tr>
            <td>Display # open ticket to Clients:</td>
            <td>
                <?php
                    if($config['client_display_num'] == '0' || $config['client_display_num'] == null) {
                        $client_display_num = '10';
                    } else {
                        $client_display_num = $config['client_display_num'];
                    } ?>
                <input type="text" name="client_display_num" size=4 value="<?php echo $client_display_num ?>">
                <em>(Limit the number of open tickets to display to clients - default 10)</em>
            </td>
        </tr>

Let's go over this a little.
$config['client_display_open'] is the variable that holds if our check box is checked.
$config['client_display_num'] is the variable that holds the # of tickets to display.  Additionally it defaults to 10 if its not set, or is set to 0. This is redundant as its also checked in the display_help_topics.php also. 

Note: if you have a LOT of tickets open on a regular basis you may want to consider hard coding in a default for maximum also so that way staff cannot set it to say 500 and have it display 500 open tickets to the client.

Lastly we need to change the display logic a little to determine if we should be displaying the open ticket list.
lets open and edit: /index.php

replace last 9 lines with:
<?php
    if($cfg && $cfg->isKnowledgebaseEnabled()){ $displayfaq = '1'; }
    else { $displayfaq = '0'; }
    if ($ost->getConfig()->clientDisplayOpen()) { $displayopen = '1'; }
    else { $displayopen = '0'; }
    
    if ($displayopen == '1' && $displayfaq == '1') { ?>
        <p>Be sure to browse both our <a href="kb/index.php">Frequently Asked Questions (FAQs)</a>, and the open tickets below before opening a ticket.  Thank you.
        <div id="openticks"><?php include('display_open_topics.php'); ?></div>
        </p>
    <?php }
    else {
        if($displayfaq == '1') { ?>
            <p>Be sure to browse our <a href="kb/index.php">Frequently Asked Questions (FAQs)</a> before opening a ticket.  Thank you.
        <?php }
        if($displayopen == '1') { ?>
            <div id="openticks"><?php include('display_open_topics.php'); ?></div>
        <?php }   
    } ?></div><?php require(CLIENTINC_DIR.'footer.inc.php'); ?>

What this does is based on how displayfaq and displayopen are set it shows different things. The important part here if you're going to do this for something else is how we reference the setting specifically: $ost->getConfig()->clientDisplayOpen().

Lastly to be complete we need to edit the display_open_topics.php.  This file is not part of the standard osTicket distribution (yet?) and is included in the mod archive I mentioned earlier.  Currently its hard coded to display 10 records.  Locate lines 21-22 which should look like this:

// The maximum amount of open tickets that you want to display.
$limit = '10';

Replace them with the following:
// The maximum amount of open tickets that you want to display.
$limit = $ost->getConfig()->clientDisplayNum();

// if limit is 0 or null set to default [10].
if($limit == '0' || $limit == null) {
    $limit ='10';
}

What this does is check for the setting in the database and if it doesn't exist or is 0 for some reason sets the number to 10.  This is a little redundant because we also check to make sure that if its 0 or null that it gets set to 10 in /include/staff/settings-tickets.inc.php.

Now if you log into your osTicket installation and go to Admin panel -> Settings -> Settings -> Tickets you should see something like this:
new config options
 

Using the osTicket 1.8.1.2 API

One of the [I feel] less documented features of osTicket is the ticket API.  This API has been built into osTicket for quite some time and allows you to write your own html forms and push the data to osTicket to open tickets.  This means that you could write a contact block for your web page and have it submit to osTicket directly, or if you have another piece of software that can run a script you can write your own custom script to open tickets from that software.  Example a network monitoring system (like NOCOL/SNIPS) could open a ticket when a device stops responding.

Before you can start using the API you will need to do some configuring in osTicket.  Log into your osTicket installation with your admin account. and go to Admin panel -> Manage -> API Key.

api key start

On the right click on "Add New API Key".

osticket add api key

There are several things that you need to enter here.  First is the IP address of the source where the request will originate from.  This can be the server IP address assigned to your server that hosts the software. Next you will want to check "Can Create Tickets (XML/JSON/EMAIL)".  Then under "Admin Notes" put a note so that in the future you can go in and see what this API key was made for.  Something like: "API Key for automating X software opening tickets." where X is the name of the software your using.  Feel free to customize this to be what will relay to you the reason for this API key.  Next click "Add Key".

api key is setup

Take note of the "THISISAFAKEAPIKEYHERE!" (which of course will be a real API key for your installation).  You will need this for your script.

Next download the osTicket API example. The only thing in this archive is a file called: ost-api-example.php.   This is an example of how to use the API using PHP.  Obviously you will need to edit this file to suit your implementation of osTicket.  The two really important parts are on lines 18 and 19. 

'url'=>'http://your.domain.tld/api/tickets.json', // URL to site.tld/api/tickets.json 'key'=>'PUTyourAPIkeyHERE' // API Key goes here Edit line 18 to have your URL.
Edit line 19 by changing "PUTyourAPIkeyHERE" to your API key (aka the "THISISAFAKEAPIKEYHERE!" from earlier).

If you have any required custom fields you will want to add them to the $data = array (lines 39 through line 49).  There are examples of both a list and text field included (Agency and Site).

Next try to run the script.  You can do this by putting the script on a web server and browsing to it. [note: the webserver will need to have the IP address that you put in the API key!]

How to manually update a client/user phone number in osTicket 1.8.1.x

I'm not sure why anyone would WANT to do this, but on the off chance someone thinks that they need to and wants to try it here is how you can manually add or update an existing client/user phone number in osTicket at the SQL level.

  • First Look up user id in ost_user

SELECT id FROM ost_user where name='THE NAME';lets pretend it returns '15'.

  • Next look up the client phone field (by default this is 3, but we should check just in case.)

SELECT * FROM ost_form_field WHERE label = 'Phone Number';let's pretend that it returns an id = 3.

  • Look for it in ost_form_entry_values

SELECT * FROM ost_form_entry_values where entry_id = 15 and (field_id = 3 OR field_id = 10);You may get two records back. That look something like this:
15,3,XXXXX,NULL
15,10,XXXXX,NULL
where XXXXX is a phone number.

To add a missing number
INSERT INTO ost_form_entry_values VALUES(15,Y,'phonenumber','');where Y is 3 or 10 (the missing one)

To update an existing number
UPDATE ost_form_entry_values SET value='NEWphoneNUM' WHERE entry_id=15 AND field_id='Y';where Y is 3 or 10 (the one you want to update)
 

osTicket 1.8.1 – How to configure the LDAP Authentication and Lookup plugin

With the release of osTicket version 1.8.1ST and of course the first three official plugins many people have been curious how to install them and configure them.  This is especially true of the auth-ldap plugin. I've written a lot of responses on the forums, and thought that it might be good to actually collect some of the better snippets and put them in one place.  So here is that place.  As a side note I run Active Directory so this article is probably slanted towards that usage.

  • Download the auth-ldap plugin from either github.com or osticket.com.  If you get it from github copy the ldap-auth directory into your /plugins directory.  If you get it from osticket.com put the auth-ldap.phar in /plugins/ldap-auth directory.
    note: I have seen several complaints about the .phar file on the forums and recommend that you simply get the latest version from github.
  • Log into your osTicket installation and go to Admin panel -> Manage -> Plugins.
  • Click "Add New Plugin" in the upper right.
  • Click the Install button to the left of "LDAP Authentication and Lookup".
  • Click on "LDAP Authentication and Look up".
  • Fill out the settings in a manner that reflects your AD/LDAP server.  Here's how I configured mine.

Default domain: is your FQDN for your domain.  In my configuration its corp.SHORTDOMAINNAME.local.

DNS Servers: your dns server.  I use the IP Address for ours.

LDAP Servers: I put two entries in here, but you really only need one.  I personally entered the ip address of my AD server, and the FQDN of my AD server. (The FQDN of your AD server should be SERVERNAME.corp.SHORTDOMAINNAME.local.

Use TLS: I did not check this.  You may have to depending on what version of AD your running.

Connection Information
Search User: a username that has look up rights in AD. I had to user SHORTDOMAINNAME\username here to get it to bind right.

Password: the accounts password.

Search Base: I don't think that this is necessary, but I was playing with it a little.  Currently I have this set to:
OU=All_Users,DC=corp,DC=SHORTDOMAINNAME,DC=local

LDAP Schema: I have selected "Microsoft Active Directory".

  • Click the Save Changes button.
  • Up top in the menu bar click "Plugins".

Tick the check box to the left of "LDAP Authentication and Lookup" and then click the Enable button.

  • Now that you have installed, configured, and enabled the plugin, you have to give your users permission to use the authentication backend.

    Go to Admin panel -> Staff -> Staff Members
    Click on the staff that you want to be able to login and change "Authentication Backend" to "Active Directory of LDAP".  Once you have done that scroll down and click "Save Changes".

    Note: Yes even though its already set to "- Use any available backend -" it does not properly try AD/LDAP first and then fall back to local authentication.

Troubleshooting Questions:

In this section you will find some of the questions that I have been asked and my replies. If you have more questions that are not covered here please feel free to post over on the osTicket forums.
 

Q: Does someone have an example of how they configured this plugin for AD and what they had installed on their Windows 2008 server?
A: I've provided as much as I can as to how I configured it.  What we have installed on our Windows 2008 server though doesn't seem like its particularly important however.

Q: if it isn't needed, why the error?
A: The search user account is only needed for the lookup portion of the plugin.  Authentication should work with out it.

Q: Anyway, I don't see any type-ahead or lookup happening when I create a new ticket and I *thought* I had this working in the old 1.6 installation I used to have (but I didn't upgrade it, I started from scratch).
A: There was no LDAP plugin for 1.6.  Plugins were just introduced in version 1.8.1.  There was a mod on the forum that you might have used, but it was written by a community member and not the osTicket devs.

Q: Are there any simple step by step instructions to configure this plugin or at least a screen shot of a typical installation you can share?
A: No, but I have just replied with some generic instructions that might get you going.  Unfortunately there are a lot of ways that your AD could be configured, and your organizational units can vary from everyone else's.