New Version of the PHP_ToolKit 2012.2


Netsuite has recently released a new version of their php toolkit (version 2012.2). It looks like they did a pretty big rewrite of a lot of the code. For those of you familiar with the old version of the toolkit, this is good news. I haven’t had a chance to look it over yet, but it looks to be promising. You can check out the office page here.

Posted in Netsuite PHPToolkit | Tagged , , , , , | 5 Comments

Netsuite API Raw XML Request

Recently someone asked me if I could send them a copy of the XML that gets sent back and forth when you make a Netsuite API call. This could be useful if you want to implement the Netsuite API in a language that they don’t provide libraries for. Anyway, here is the xml:

<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:core_2009_2.platform.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:messages_2009_2.platform.webservices.netsuite.com">
    <Header>
        <passport actor="http://schemas.xmlsoap.org/soap/actor/next">
            <email>myemail@mydomain.com</email>
            <password>mypassword</password>
            <account>234234</account>
            <role internalId="23" xsi:type="RecordRef"/>
        </passport>
    </Header>
    <Body>
        <get>
            <baseRef internalId="706" type="inventoryItem" xsi:type="RecordRef"/>
        </get>
    </Body>
</Envelope>

And here is the response (a lot of the content has been removed to keep it short):

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2009_2.platform.webservices.netsuite.com">
            <platformMsgs:nsId>[Content removed]</platformMsgs:nsId>
        </platformMsgs:documentInfo>
    </soapenv:Header>
    <soapenv:Body>
        <getResponse xmlns="urn:messages_2009_2.platform.webservices.netsuite.com">
            <readResponse>
                <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2009_2.platform.webservices.netsuite.com"/>
                <record internalId="706" externalId="ITEM706" xsi:type="listAcct:InventoryItem" xmlns:listAcct="urn:accounting_2009_2.lists.webservices.netsuite.com">
                    <!--Lots more stuff here-->
                </record>
            </readResponse>
        </getResponse>
    </soapenv:Body>
</soapenv:Envelope>

This xml was generated using the PHP_Toolkit and a modification of this test script.

If you want to see the xml from your own requests generated using the PHP Toolkit, just create a folder called “nslog” in the root directory of the toolkit. Then all requests and responses will be logged to that folder. Be careful though, it will fill up fast.

Posted in Beginning with the PHPToolkit, Netsuite PHPToolkit | Tagged , , , , , | 1 Comment

Netsuite API Testing Script

Although I have posted many code samples on this site, I have rarely included a fully functional script. Often login information or execution code was not included since it wasn’t relevant to the particular post. However, here is a complete script that will fetch a record and then var dump it.

Although this may seem useless, its a very handy script. Before saving my own object to Netsuite, I often load one and var_dump it so that I can understand it’s structure.

Here is the code:

#!/usr/bin/php
<?php
//Values you MUST change
require_once('/your/path/here/PHP_Toolkit_v2009_2/PHPtoolkit.php');
$accountNumber = '1111111';
$roleNumber = '1';
$pass = 'yourNetsuitePassword';
$email = 'yourEmail@domain.com';
$id = 111; //must be a valid internalId

//Values you may have to change
$recordType = 'nonInventoryResaleItem';//Change if you want

//execution code
global $myNSclient;
global $myDirectory;
$myNSclient = new nsClient(nsHost::live);
$myNSclient->setPassport($email,$pass,$accountNumber,$roleNumber);
$ref = new nsRecordRef();
$ref->setFields(array(
        'internalId' => $id,
        'type' => $recordType
));
$readResponse = $myNSclient->get($ref);
var_dump($readResponse);
?>

Assuming you set the values correctly, this script should be functional. You should see a large amount of output that will either be an error report from Netsuite or the object you requested (wrapped inside a read response object). Its worth noting that this script is designed to run on Linux, so the #!/usr/bin/php would not apply to users of other operating systems.

Posted in Beginning with the PHPToolkit | Tagged , , , , , , | 1 Comment

o3ProtectedInput.js — JQuery Plugin to Protect Inputs

Today we are releasing a JQuery plugin we have written under an open source license (MIT). It is a small plugin that makes an input harder to edit. Although this may seem counter productive, it is acctually quite useful for forms where you don’t normally change certain fields. Consider a form that allows you to edit a product. Chances are you will never change the serial number of the product, but you want to allow the user to change it just in case something was mistyped the first time. This plugin allows you to do just that. It prevents you from accidentally modifying it, but still makes it easy to change. It will also prevent an input from being “tabbed” to.

Here is a demo:

Protected Select:

Code:


$(document).ready(function(){

    $('.protectedInput').o3ProtectedInput({

        backgroundImage: 'http://common.ozonesolutions.com/images/stripe.png'

    });

});

If all you want to do is prevent a user from changing a field, you can use the “readonly” attribute. However, this plugin is great for situations where you want something to start readonly, but still be editable if the user is sure they want to change it.

Downloads

If you want to use this plugin, you can download it here:
O3 Protected Input Download — complete bundle (.tar.gz)
O3 Protected Input Download — complete bundle (.zip)
O3 Protected Input Download — javascript only (does not include stylesheets or images. Functional but less pretty)
GitHub Page (for developers)


Posted in JavaScript, jQuery, Plugin, Uncategorized | Tagged , , , , , , , , , , | Leave a comment

BlueProximity on Ubuntu 12.04


I just tried installed BlueProximity on Ubuntu 12.04. Although it works pretty well, there was a pretty funny glitch. The GUI to configure blueproximity only showed up on the first launch. After that the window didn’t show up. It seemed to be not running. However, a quick “ps -e | grep “blueproximity” revealed that it was in fact running. As it turns out, if the .blueproximity folder is present in your home drive, the program won’t run the configuration GUI. To fix this problem, simply remove the folder (rm -r ./blueproximity), but be aware that this will lose your current configuration.

Posted in Networking | Tagged , , , , , , , , , , | 2 Comments

Strange Android Network Problem

Android Logo
We recently moved some of our APs to a new subnet on our network. Although desktop and laptop computers were unaffected by the change, all Android smart phones refused to work. Although they could connect to the network, they couldn’t access the Internet. After trying many different things, I finally realized it was a DNS problem. Our DHCP was serving up several name servers. The first two were local DNS servers which (to the best of my knowledge) are working fine. However, the Android phones were not resolving host names. Although the DHCP was offering more name server, it appears that Android devices only pay attention to the first two. By moving up an external DNS server to the second spot in my DHCP I was able to fix the problem. However, it would be nice to know why it didn’t work in the first place.

Posted in Networking | Tagged , , , , , , | Leave a comment

Nice job Google

Today I received the following email from Google stating that someone had tried to log into my account and Google correctly noticed it was suspicious. Someone was trying to log into my account from a city I have never visited. I am quite impressed that Google caught the attempt and stopped it. Congrats Google on keeping my account safe for me! Its always nice to see a computer company going above and beyond to protect their users.

(some content removed below for privacy.)

Daniel,

Someone recently tried to use an application to sign in to your Google Account, **email**@gmail.com. We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:

Friday, July 20, 2012 6:20:55 AM GMT
IP Address: **remoteIP**
Location: **remoteLocation**

If you do not recognize this sign-in attempt, someone else might be trying to access your account. You should sign in to your account and reset your password immediately. Find out how at http://support.google.com/accounts?p=reset_pw

If this was you, and you want to give this application access to your account, complete the troubleshooting steps listed at http://support.google.com/mail?p=client_login

Sincerely,
The Google Accounts Team

Posted in Uncategorized | Tagged , , , | Leave a comment

PHP whitespace issues when exporting to csv files

Exporting data to a simple CSV file has provided me an array of problems.

The problem:  In every exported .csv file the first row of the document was blank and then the data started in the second row.  The methods I used were: fopen, fputcsv, fclose to put the data into a csv file and setHTTPHeader with renderText and file_get_contents  to export the file for a download.  I tried testing if the loop index was off and was creating the problem but it was not the case.  I also tried making sure I was not inserting any newline characters to the csv file.

The solution:  After trying to debug every step, I have realized that the problem was caused by having an extra two lines at the end of the php file in which the download was called.  After doing more testing, I realized that it only worked for me if there was a blank line and then the ending ?> for my program to work.  Make sure there is a blank line before your PHP end tag and also make sure there are no blank lines after it.

Posted in PHP | 2 Comments

Updated Website

After many hours of programming, we are proud to announce the release of our updated website. We have been working on a number of changes and improvements for our site so we are excited to see them finally go live. Among other things, we shifted the site to the Symfony Framework. So far we have been quite happy with the Symfony Framework and it looks to make future changes much easier.

Anyway, along with the new release we are running a number of discounts on ozone equipment, as well as giveaways, so feel free to check it out.

Posted in Uncategorized | Tagged , | Leave a comment

Brasero Disk Burner Gets Stuck Creating Image Checksum

When I was trying to burn a new copy of the latest version of Ubuntu, Brasero was getting stuck on the “Creating Image Checksum”. My first thought was to disable the check-sum feature (which you can do via the edit > plugins), but that did no good. Then Brasero got stuck on “preparing to write”. Finally, I tried running Brasero from the command line using “brasero -g”. This spits out lots of debug info. It turns out brasero was waiting for the cd drive to be ready. Apparently some other program was holding some sort of lock on it. However, a simple restart fixed the problem.

Posted in Linux, System Administration | Tagged , , , , , , | 1 Comment