[Vtigercrm-developers] How to sync local SQLite database in mobile and Server side Vtiger mysql database
Ola Sikström
ola.sikstrom at creativetools.se
Wed Jul 25 04:44:43 PDT 2012
A little correction to the last mail:
I do get different results based on if i'm admin or not - just not the
expected result
admin:
returns entities owned by current user
not admin:
returns nothing at all (except for some php warnings): normal
200-response, but no json-data
2012/7/25 Ola Sikström <ola.sikstrom at creativetools.se>:
> That sounds great indeed, but unfortunately I can't get it to work.
>
> I actually see no difference to the result at all, if i pass
> syncType=application.
>
> I can see in the code for vtws_sync that it should throw an
> ACCESS_DENIED error if I am not an administrator. Even though i am not
> an administrator i do not get this error, but I still don't get any
> data other than my own.
>
> I have tried using an admin account as well, but get the same results.
>
> I did submit a bug report on this, as you may have seen:
> http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7456, although I think
> I understand the problem a bit better now. I suspect this is related
> to a php-warning, as mentioned in the bug report:
> Warning: Missing argument 4 for vtws_sync() in
> /mnt/data/www/html/vtigercrm-5.4.0/include/Webservices/GetUpdates.php
> on line 14
>
> This indicates that the user is not passed to the function at all.
> Either that, or the user is passed as the third argument, which is in
> fact $syncType.
>
> This piece of code, from vtws_sync, strenghtens my belief that this is
> the case, ie user is passed in place of the syncType argument, and
> user is left empty.
>
> $applicationSync = false;
> if(is_object($syncType) && ($syncType instanceof Users)){
> $user = $syncType;
> } else if($syncType == 'application'){
> $applicationSync = true;
> }
>
> This means that the syncType argument never gets passed to vtws_sync.
> If you want my opinion, the problem that the above snippet tries to
> solve should have been solve in the calling function. This just makes
> obscure code in my opinion.
>
> Is this perhaps fixed already in the development branch? If you have
> any fixes for this, would it be possible to get a patch?
>
> 2012/7/25 Vikas Jain <vikas at vtiger.com>:
>> Hi,
>>
>> You can use vtws_sync for synchronizing entities across the application. In
>> 5.4.0 we have added another parameter 'syncType'
>> which lets you control the type of synchronization i.e. user level or
>> application level. Pass value as 'application' to this parameter.
>> I apologize for not updating the wiki document. Let us know if this helps
>> you.
>>
>> On 25 July 2012 01:50, Ola Sikström <ola.sikstrom at creativetools.se> wrote:
>>>
>>> The sync-function only reports entities owned by the current user. I
>>> think the best bet is to make a custom sync function, based on the
>>> query function, and filter by modification date like Adam wrote.
>>>
>>> I have already investigated this a bit, since I have similar plans
>>> (i.e. syncing data with other applications).
>>>
>>> 2012/7/24 Alan Lord (News) <alanslists at gmail.com>:
>>> > On 24/07/12 05:40, ram prasad wrote:
>>> >>
>>> >> Please provide suggestions to start sync local database in mobile with
>>> >> the Vtiger mysql database.
>>> >
>>> > How about using the sync function in the webservices API?
>>> >
>>> > https://wiki.vtiger.com/index.php/Webservices_tutorials#Sync
>>> >
>>> > HTH
>>> >
>>> > Al
>>> >
>>> >
>>> >
>>> > --
>>> > Libertus Solutions
>>> > http://www.libertus.co.uk
>>> >
>>> > _______________________________________________
>>> > http://www.vtiger.com/
>>>
>>>
>>>
>>> --
>>> Ola Sikström
>>> Creative Tools AB
>>>
>>> _______________________________________________
>>> http://www.vtiger.com/
>>
>>
>>
>>
>> --
>> Regards
>> Vikas
>> Vtiger Team
>>
>> _______________________________________________
>> http://www.vtiger.com/
>
>
>
> --
> Ola Sikström
> Creative Tools AB
--
Ola Sikström
Creative Tools AB
035-77 77 893
More information about the vtigercrm-developers
mailing list