
 Tom Fitzgerald - 2012-11-13 23:27:33
function adjustStringLength($str, $limit = 30)
        {
            $encode_string = urlencode($str);
			
            $len = strlen($encode_string);
            if( $len > $limit )
            {
                $diff = $len - $limit;
                $newlimit = $limit + $diff;
				
                return substr($str, 0, $limit+$diff-1);//FIXED was $limit-$diff-1
            }
            else
                return substr($str, 0, $limit-1);
        }
................
function prepareCreateInvoice($aryData, $aryItems)
        {
{.............}
$nLoop = count($aryItems);
            for($cnt=0;$cnt<$nLoop;$cnt++)
            {
                
if(trim(@$aryItems[$cnt]['name'])!= "")
  $aryCreateInvoice["invoice.itemList.item($cnt).name"] = $this->adjustStringLength($aryItems[$cnt]['name']);//FIXED was item_name
if(trim(@$aryItems[$cnt]['description'])!= "")
  $aryCreateInvoice["invoice.itemList.item($cnt).description"]= $this->adjustStringLength($aryItems[$cnt]['description']);//FIXED  was item_description
if(trim(@$aryItems[$cnt]['quantity'])!= "")
  $aryCreateInvoice["invoice.itemList.item($cnt).quantity"] = $this->adjustStringLength($aryItems[$cnt]['quantity']);//FIXED  was item_quantity				
if(trim(@$aryItems[$cnt]['unitprice'])!= "")
  $aryCreateInvoice["invoice.itemList.item($cnt).unitPrice"] = $this->adjustStringLength($aryItems[$cnt]['unitprice']);//FIXED  was item_unitprice
...............