<div dir="ltr">Hi Chris,<div><br></div><div>If you trying to get list-view outside crm it's not possible because we are looking for a information about logged in user, that (user_privileges) file information.</div><div>
<br></div><div>If your trying to get list-view based on logged-in user info,then please do include these files.</div><div><div><ol><li>include_once 'include/database/PearDatabase.php';<br></li><li>include_once 'includes/Loader.php';<br>
</li><li>include_once 'includes/runtime/Globals.php';<br></li><li>include_once 'includes/runtime/BaseModel.php';<br></li><li>include_once 'vtlib/Vtiger/ModuleBasic.php';<br></li><li>include_once 'vtlib/Vtiger/Module.php';<br>
</li><li>include_once('modules/Vtiger/models/Module.php');<br></li><li>include_once('modules/Vtiger/models/ListView.php');<br></li><li>include_once('modules/Products/models/ListView.php');<br></li>
</ol></div></div><div>Regards</div><div>Uma S</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 19, 2014 at 10:40 AM, Hamono, Chris (DPC) <span dir="ltr"><<a href="mailto:Chris.Hamono@sa.gov.au" target="_blank">Chris.Hamono@sa.gov.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-AU" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">My module acts as a webservice amongst other tasks. It is designed to integrate with both drupal and moodle.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I had wondered if it was an authentication issue. While testing I have not made any attempts to authenticate.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The module needs to remotely manage contact creation, product listing and account listing, preferably filtered on the custom fields also it must do a few other functions like be run as cronjob to do housekeeping and uses an event to push some details to another website when an account is paid or a new product is created.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Therefore it makes sense to create a separate module rather than just use webservices. Unfortunately the api is very opaque to the new user many includes are called as required rather than in the head of the file making it even more obtuse. But of course that’s a worthy trade off for efficiency.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Working out which functions to call and which files to include is a pain.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Chris<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a> [mailto:<a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a>] <b>On Behalf Of </b>Uma S<br>
<b>Sent:</b> Tuesday, 18 March 2014 6:29 PM</span></p><div><div class="h5"><br><b>To:</b> <a href="mailto:vtigercrm-developers@lists.vtigercrm.com" target="_blank">vtigercrm-developers@lists.vtigercrm.com</a><br><b>Subject:</b> Re: [Vtigercrm-developers] getting a list of products<u></u><u></u></div>
</div><p></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Hi Chirs,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I need a bit of clarification on your request. Are you trying to get list-view records within crm? or from outside external script?. If its from external script that's not possible because, while getting records we are looking for user privileges which is not available outside crm.<u></u><u></u></p>
</div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Tue, Mar 18, 2014 at 9:05 AM, Hamono, Chris (DPC) <<a href="mailto:Chris.Hamono@sa.gov.au" target="_blank">Chris.Hamono@sa.gov.au</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Uma</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thank you for this. </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Can you tell me what files I need to include to create the listview</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I have tried including the following..</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">require_once('include/utils/CommonUtils.php');</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">require_once('include/utils/ListViewUtils.php');</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">require_once('modules/Vtiger/models/ListView.php'); </span><span style="font-size:11.0pt;font-family:Wingdings;color:#1f497d">ç</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> script quits here with no errors</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">$listViewModel = Vtiger_ListView_Model::getInstance('Products', 47); //&viewname=47</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Is there some documentation on what files I need to include?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The module acts as a simple webservice so I will want to authenticate against a user with limited roles. So how do I do authentication?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Chris</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a> [mailto:<a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a>] <b>On Behalf Of </b>Uma S<br>
<b>Sent:</b> Monday, 17 March 2014 4:06 PM<br><b>To:</b> <a href="mailto:vtigercrm-developers@lists.vtigercrm.com" target="_blank">vtigercrm-developers@lists.vtigercrm.com</a><br><b>Subject:</b> Re: [Vtigercrm-developers] getting a list of products</span><u></u><u></u></p>
<div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">Hi Chris,<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Their is a way to achieve your requirement. <u></u><u></u></p>
</div><div><ol start="1" type="1"><li class="MsoNormal">Please create a filter with all custom-fields that you would like get in list-view. <u></u><u></u></li><li class="MsoNormal">Now create a list-view model of a module (products), by passing moduleName and filter-id. <u></u><u></u></li>
<li class="MsoNormal">Then on this list-view model you can call getListViewEntries() api to get entries of list-view with all custom fields.<u></u><u></u></li></ol><div><p class="MsoNormal">Regards<u></u><u></u></p></div>
</div><div><p class="MsoNormal">Uma S<u></u><u></u></p></div><div><p class="MsoNormal">Vtiger Team<u></u><u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"> <u></u><u></u></p><div><p class="MsoNormal">
On Mon, Mar 17, 2014 at 4:32 AM, Hamono, Chris (DPC) <<a href="mailto:Chris.Hamono@sa.gov.au" target="_blank">Chris.Hamono@sa.gov.au</a>> wrote:<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">In answer to my own question.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I don’t know what the official ways is to get a list including custom fields but this is what I have discovered…</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">When a custom field is made it adds a new column to the table vtiger_ Modulenamecf in my case vtiger_ productcf. The field name is something along the lines of cf_### where ### = some number, for me this was cf_716.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This is recorded in the vtiger_fields table, the important fields for my purpose are “column name” “tablename” and “fieldlabel” these contain the information required to map the mysterious cf_### column name to the custom field.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I assume there is a method that will do all of this for you but as far as I can find to get a list of products I will have to find all the custom fields using vtiger_fields manually build a sql statement to include those fields and then run that query.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Chris</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a> [mailto:<a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a>] <b>On Behalf Of </b>Hamono, Chris (DPC)<br>
<b>Sent:</b> Friday, 14 March 2014 11:26 AM<br><b>To:</b> <a href="mailto:vtigercrm-developers@lists.vtigercrm.com" target="_blank">vtigercrm-developers@lists.vtigercrm.com</a><br><b>Subject:</b> [Vtigercrm-developers] getting a list of products</span><u></u><u></u></p>
</div></div><div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif"">Hi All</span><u></u><u></u></p></div><div><p class="MsoNormal">
<span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif"">I am hoping someone can help me</span><u></u><u></u></p>
</div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif"">I am developing a module to integrate vtiger with drupal for a bespoke system. I have a need to get a list of products complete with custom fields. I also need to filter this list by range (limit) and by product type</span><u></u><u></u></p>
</div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif"">What is the recommended way to query a module for a list. I have tried to look through the source code but its very obtuse and haven’t yet found what I need.</span><u></u><u></u></p>
</div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif"">Any assistance would be appreciated</span><u></u><u></u></p>
</div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif"">Chris</span><u></u><u></u></p>
</div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p>
</div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p></div></div></div></div></div><p class="MsoNormal"><br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><u></u><u></u></p></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><p class="MsoNormal">
-- <u></u><u></u></p><div><p class="MsoNormal">With<br>Best Regards<br>Uma.S<u></u><u></u></p><div><p class="MsoNormal">Vtiger Team<u></u><u></u></p></div></div></div></div></div></div></div><p class="MsoNormal"><br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><u></u><u></u></p></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">
-- <u></u><u></u></p><div><p class="MsoNormal">With<br>Best Regards<br>Uma.S<u></u><u></u></p><div><p class="MsoNormal">Vtiger Team<u></u><u></u></p></div></div></div></div></div></div></div><br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">With<br>Best Regards<br>Uma.S<br><div>Vtiger Team</div></div>
</div>