[Vtigercrm-developers] wtsclib character encode problem

Prasad prasad at vtiger.com
Mon Nov 2 05:32:50 PST 2009


I was able to successfully create the SalesOrder base information record
with the following:

---- START ----
<?php
require_once('vtwsclib/Vtiger/WSClient.php');

$vtwsclib = new Vtiger_WSClient('http://vtiger.server.url');
$login= $vtwsclib->doLogin('admin', 'accessKey');

$data = array(
    'subject' => 'Test SalesOrder',
    'sostatus' => 'Created',
    'invoicestatus'=>'AutoCreated',
    'account_id'=> '3x2', // Existing account id

    'bill_street' => 'Bill Street',
    'ship_street' => 'Ship Street',
);
$result = $vtwsclib->doCreate('SalesOrder', $data);

var_dump($vtwsclib->lastError());
var_dump($result);
---- END ----

Hope this helps.

Regards,
Prasad
vtiger Team

On 11/2/09, Fusioncore <ml at arceva.fr> wrote:
>
> This is the script.
> I don't find the info about the product and service add syntax. but it's
> plan on a second time
>
>     $client = new Vtiger_WSClient($crm_url);
>
>     $login = $client->doLogin($crm_username, $crm_accesskey);
>     if(!$login)
>         echo 'Login Failed';
>     else
>         {
>         echo "Login Successful<br />";
>         $module = 'SalesOrder';
>
>         $record = $client->doCreate($module,
>             array(
>                 'subject'=>"$pack_number",
>                 'duedate'=>"$_t",
>                 'description'=>"$comment_t",
>                 'recurring_frequency'=>"$bill_reccuring_t",
>                 'cf_548'=>"$pay_method",
>                 'cf_547'=>"$ip",
>                 'cf_546'=>"$date",
>                 'cf_540'=>"$pack_number",
>                 'accountid'=>"$account_number",
>                 'sostatus'=>"$sostatus",
>                 'total'=>"$total",
>                 'subtotal'=>"$subtotal",
>                 'taxtype'=>"$taxtype",
>                 'contactid'=>"$fact_contactid",
>             )
>         );
>         $error = $client->lasterror();
>         if($error) {echo $error['code'] . ' : ' . $error['message'];
>         }
>
>         if($record) {
>             $salesorderid = $client->getRecordId($record['id']);
>             }
>         echo "<br />new SaleOrder id : $salesorderid <br />";
>         }
>
> When my website will be open, I think I clean my code and enhance the
> css and translation to publish it on the extension vtiger site. It's a
> complete commerce solution totaly integrate with vtiger.
>
> Thanks for your help,
>
>
> Bruno
> French-vtiger Manager
>
>
> Prasad a écrit :
> > Hi Bruno,
> >
>
> > Can you share the script?
> >
>
> > On 11/2/09, *Fusioncore* <ml at arceva.fr <mailto:ml at arceva.fr>> wrote:
> >
> >     Hi Prasad,
> >
> >     The encode problem was solve by the update with the last release
> >     of the
> >     vtwsclib.
> >     But I have a new problem. When I use DoCreate action to create a
> >     salesorder, I have this error : ACCESS_DENIED : Permission to perform
> >     the operation is denied
> >
> >     The vtwslib user have all write permission on the crm. Do you have
> >     an idea ?
> >
> >
> >     Thanks,
> >
> >     Bruno
> >     French-vtiger manager
> >
> >
> >
> >     Prasad a écrit :
> >     > Hi Bruno,
> >     >
> >
> >     > php curl is required by vtwsclib and recommended to be present for
> >     > vtiger CRM as well.
> >     >
> >     > I was pointing to
> >     > http://in2.php.net/manual/en/function.urlencode.php#92424, for
> >     > urlencode API
> >     >
> >     > Its used in:
> >     >
> >     >     * function doGet (Vtiger_HTTP_Client) and
> >     >     * function send_post_data (Curl_HTTP_Client, file:
> >     >       vtwsclib/third-party/curl_http_client.php)
> >     >
> >     > Regards,
> >     > Prasad
> >     > vtiger Team
> >     >
> >
> >     > On 10/7/09, *Fusioncore* <ml at arceva.fr <mailto:ml at arceva.fr>
>
> >     <mailto:ml at arceva.fr <mailto:ml at arceva.fr>>> wrote:
> >     >
> >     >     php curl must be install on both server ?
> >     >     My class was on the website server and vtiger was on an
> >     other server.
> >     >     Actually curl was present only on the website server
> >     >     I don't understand your other hint urlencode API, where she
> >     is use ?
> >     >     I search on the HTTP_Client.php and I return my feedback soon
> >     >
> >     >
> >     >     Thanks,
> >     >
> >     >     Bruno
> >     >     French-vtiger manager
> >     >
> >     >
> >     >     Prasad a écrit :
> >     >
> >     >     > Hi Bruno,
> >     >     >
> >     >     > PHP CURL API's are used to handle the communication.
> >     >     > You might need to tune the UTF-8 support in function
> >     __construct of
> >     >     > class Vtiger_HTTP_Client (file:
> >     vtwsclib/Vtiger/Net/HTTP_Client.php)
> >     >     >
> >     >     > I found the following article to be related:
> >     >     > http://markmail.org/message/m27ctd3qzzg7ts3i
> >     >     > Please update if you find any information.
> >     >     >
> >     >     > Another hint: urlencode API is being used which could be
> >     causing
> >     >     issue
> >     >     > with UTF-8, please watch out during your analysis.
> >     >     >
> >     >     > Regards,
> >     >     > Prasad
> >     >     > vtiger Team
> >     >     >
> >     >
> >     >     > On 10/7/09, *Fusioncore* <ml at arceva.fr
> >     <mailto:ml at arceva.fr> <mailto:ml at arceva.fr <mailto:ml at arceva.fr>>
> >
> >     >     <mailto:ml at arceva.fr <mailto:ml at arceva.fr>
> >     <mailto:ml at arceva.fr <mailto:ml at arceva.fr>>>> wrote:
> >     >     >
> >     >     >     Hi,
> >     >     >     I have create a bridge who sent my website user on the
> >     account
> >     >     >     table on
> >     >     >     vtiger.
> >     >     >     This bridge extract data from the website database
> >     (utf8_general
> >     >     >     encode)
> >     >     >     and send it to vtiger with vtwsclib. (vtiger database was
> >     >     full utf8)
> >     >     >     I have a problem with the accent on some string. For
> >     example, I
> >     >     >     have an
> >     >     >     address "Avenue Jean Sébastien BACH" on my website and
> >     when
> >     >     I sync
> >     >     >     with
> >     >     >     crm, the address save on the crm was "Avenue Jean S"
> >     >     >     Does vtwsclib support accent ?
> >     >     >
> >     >     >     Thanks,
> >     >     >
> >     >     >     Bruno
> >     >     >     French-vtiger manager
> >     >     >     _______________________________________________
> >     >     >     Reach hundreds of potential candidates -
> >     http://jobs.vtiger.com
> >     >     >
> >     >     >
> >     >
> >     >     >
> >     >
> >
> ------------------------------------------------------------------------
> >     >
> >     >     >
> >     >     > _______________________________________________
> >     >     > Reach hundreds of potential candidates -
> >     http://jobs.vtiger.com
> >     >     _______________________________________________
> >     >     Reach hundreds of potential candidates -
> http://jobs.vtiger.com
> >     >
> >     >
> >
> >     >
> >
> ------------------------------------------------------------------------
> >
> >     >
> >     > _______________________________________________
> >     > Reach hundreds of potential candidates - http://jobs.vtiger.com
> >     _______________________________________________
> >     Reach hundreds of potential candidates - http://jobs.vtiger.com
> >
> >
>
> > ------------------------------------------------------------------------
>
> >
> > _______________________________________________
> > Reach hundreds of potential candidates - http://jobs.vtiger.com
> _______________________________________________
> Reach hundreds of potential candidates - http://jobs.vtiger.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20091102/51577703/attachment-0003.html 


More information about the vtigercrm-developers mailing list