<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Комментарии: Пользовательское условие на вывод данных в listview</title>
	<atom:link href="/listview-user-where.html/feed" rel="self" type="application/rss+xml" />
	<link>http://sugartalk.ru/listview-user-where.html</link>
	<description>Русскоязычный блог для администраторов и разработчиков SugarCRM</description>
	<lastBuildDate>Fri, 27 Jul 2012 10:48:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>Автор: snegg</title>
		<link>http://sugartalk.ru/listview-user-where.html/comment-page-1#comment-36664</link>
		<dc:creator>snegg</dc:creator>
		<pubDate>Fri, 24 Jun 2011 14:52:59 +0000</pubDate>
		<guid isPermaLink="false">http://sugartalk.ru/?p=58#comment-36664</guid>
		<description>Спасибо огромное!!!!!!!!!  :-D 
Правда я сделал 1-ым способом, изменил чуть запрос и все заработало. Кому интересно:
сделал все действия, которые описаны в статье (добавил новую функцию именно в list_view_where.php , не знаю почему, но не работало через отдельный файл...)
[php]
function limit_meeting_list(&amp;$view, $module_name)
{
	global $current_user;
	if ($module_name == &#039;Meetings&#039; and !is_admin($current_user))
	{
		$view-&gt;where = &quot;meetings_cstm.not_importent_c = 0 or (meetings_cstm.not_importent_c = 1 and meetings.assigned_user_id =&#039;&quot;.$current_user-&gt;id.&quot;&#039;)&quot;;

	}
}
[/php]</description>
		<content:encoded><![CDATA[<p>Спасибо огромное!!!!!!!!!  <img src='/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />  </p><p>Правда я сделал 1-ым способом, изменил чуть запрос и все заработало. Кому интересно:</p><p>сделал все действия, которые описаны в статье (добавил новую функцию именно в list_view_where.php , не знаю почему, но не работало через отдельный файл...)</p><p><pre class="brush: php; title: ; notranslate">
function limit_meeting_list(&amp;$view, $module_name)
{
	global $current_user;
	if ($module_name == 'Meetings' and !is_admin($current_user))
	{
		$view-&gt;where = &quot;meetings_cstm.not_importent_c = 0 or (meetings_cstm.not_importent_c = 1 and meetings.assigned_user_id ='&quot;.$current_user-&gt;id.&quot;')&quot;;

	}
}
</pre></p>]]></content:encoded>
	</item>
	<item>
		<title>Автор: Шуга Админ</title>
		<link>http://sugartalk.ru/listview-user-where.html/comment-page-1#comment-36663</link>
		<dc:creator>Шуга Админ</dc:creator>
		<pubDate>Fri, 24 Jun 2011 11:46:31 +0000</pubDate>
		<guid isPermaLink="false">http://sugartalk.ru/?p=58#comment-36663</guid>
		<description>Необходимо делать как здесь: &lt;a href=&quot;http://sugartalk.ru/listview-user-filter.html rel=&quot;nofollow&quot;&gt;условие в listview&lt;/a&gt;

Условие [php]$this-&gt;where .= &quot; sales_stage NOT IN (&#039;Closed Won&#039;, &#039;Closed Lost&#039;) &quot;;[/php]


Меняете на свое: [php]global $current_user; $this-&gt;where .= &quot; (meeting_cstm.not_importent_c = 0 OR (meeting_cstm.not_importent_c = 1 AND meeting_cstm.assigned_user_id == $current_user-&gt;id)) &quot;;[/php]

Примерно так.</description>
		<content:encoded><![CDATA[<p>Необходимо делать как здесь: <a href="/listview-user-filter.html rel=" nofollow">условие в listview</a></p><p>Условие <pre class="brush: php; title: ; notranslate">$this-&gt;where .= &quot; sales_stage NOT IN ('Closed Won', 'Closed Lost') &quot;;</pre></p><p>Меняете на свое: <pre class="brush: php; title: ; notranslate">global $current_user; $this-&gt;where .= &quot; (meeting_cstm.not_importent_c = 0 OR (meeting_cstm.not_importent_c = 1 AND meeting_cstm.assigned_user_id == $current_user-&gt;id)) &quot;;</pre></p><p>Примерно так.</p>]]></content:encoded>
	</item>
	<item>
		<title>Автор: snegg</title>
		<link>http://sugartalk.ru/listview-user-where.html/comment-page-1#comment-36662</link>
		<dc:creator>snegg</dc:creator>
		<pubDate>Fri, 24 Jun 2011 11:22:58 +0000</pubDate>
		<guid isPermaLink="false">http://sugartalk.ru/?p=58#comment-36662</guid>
		<description>Здравствуйте, у меня такая ситуация:
В модуле &quot;Встерчи&quot; мне нужно добавить чекбокс ответственный за важность встречи (его я создал в студии, он занесся в таблицу &quot;meeting_cstm&quot;, название поля &quot;not_importent_c&quot;), то есть при назначении новой встречи, при галочке на чекбоксе видеть должен её только он.
Я делаю таким образом в файле custom/custom_script/list_view_meeting.php
[php]
&lt;?php
}
function limit_meeting_list(&amp;$view, $module_name)
{
	global $current_user;
        var &amp;current_user_id = $current_user-&gt;id; //вот тут я не уверен в корректности
	if($module_name == &#039;Meetings&#039; and !is_admin($current_user) and $current_user_id! ==&#039;created_by&#039;) /* вот тут 100% неправильно (мне так кажется...как проверить, создатель ли данной записи текущий юзер? может быть есть функция is_owner($current_user) :?:  )*/
	{
		$view-&gt;where = &quot;not_importent_c &lt;&gt; 1&quot; //тип чекбокса в базе TINYINT
	}
}
?&gt;
[/php] 
и подключаю её в listviewdefs.php v /custom.../metadata и в modules/.../metadata собственно по гайду) 
Спасибо большое!</description>
		<content:encoded><![CDATA[<p>Здравствуйте, у меня такая ситуация:</p><p>В модуле &laquo;Встерчи&raquo; мне нужно добавить чекбокс ответственный за важность встречи (его я создал в студии, он занесся в таблицу &laquo;meeting_cstm&raquo;, название поля &laquo;not_importent_c&raquo;), то есть при назначении новой встречи, при галочке на чекбоксе видеть должен её только он.</p><p>Я делаю таким образом в файле custom/custom_script/list_view_meeting.php</p><p><pre class="brush: php; title: ; notranslate">
&lt;?php
}
function limit_meeting_list(&amp;$view, $module_name)
{
	global $current_user;
        var &amp;current_user_id = $current_user-&gt;id; //вот тут я не уверен в корректности
	if($module_name == 'Meetings' and !is_admin($current_user) and $current_user_id! =='created_by') /* вот тут 100% неправильно (мне так кажется...как проверить, создатель ли данной записи текущий юзер? может быть есть функция is_owner($current_user) <img src='/wp-includes/images/smilies/icon_question.gif' alt=':?:' class='wp-smiley' />   )*/
	{
		$view-&gt;where = &quot;not_importent_c &lt;&gt; 1&quot; //тип чекбокса в базе TINYINT
	}
}
?&gt;
</pre> </p><p>и подключаю её в listviewdefs.php v /custom.../metadata и в modules/.../metadata собственно по гайду) </p><p>Спасибо большое!</p>]]></content:encoded>
	</item>
</channel>
</rss>
