?? content_45.php
字號:
<?php
function default_validate( )
{
global $connection;
global $customer_id;
global $customer_name;
global $manage_user;
$query2 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$manage_user."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$priv_no = $row2['PRIV_NO'];
}
$query3 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor3 = exequery( $connection, $query3 );
if ( $row3 = mysql_fetch_array( $cursor3 ) )
{
$login_priv_no = $row3['PRIV_NO'];
}
if ( $login_priv_no < $priv_no )
{
$purview_ses = "<a href=\"#\" onclick=\"onclick=\"openWindows('/general/crm/customer/detail.php.php?CUSTOMER_ID={$customer_id}');\">".$customer_name."</a>";
}
else
{
$purview_ses = false;
}
return $purview_ses;
}
function dept_validate( )
{
global $connection;
global $purview_dept;
if ( $purview_dept == "ALL_DEPT" )
{
return true;
}
$query2 = "select d.* from department as d, user as u where u.DEPT_ID=d.DEPT_ID and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$dept_id = $row2['DEPT_ID'];
}
if ( array_search( $dept_id, explode( ",", $purview_dept ) ) !== false )
{
return true;
}
else
{
return false;
}
}
function role_validate( )
{
global $connection;
global $purview_role;
$query2 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$login_priv_no = $row2['USER_PRIV'];
}
if ( array_search( $login_priv_no, explode( ",", $purview_role ) ) !== false )
{
return true;
}
else
{
return false;
}
}
function user_validate( )
{
global $connection;
global $purview_user;
if ( array_search( $_SESSION['LOGIN_USER_ID'], explode( ",", $purview_user ) ) !== false )
{
return true;
}
else
{
return false;
}
}
$paraarray = getindexpara( $block_id );
$rownum = $paraarray['block_row'];
$connection = openconnection( );
$query = "\r\n\t\tSELECT c.*, u.USER_NAME FROM customer as c, USER as u WHERE 1 group by c.CUSTOMER_NAME\r\n\t\t";
switch ( $_REQUEST['order'] )
{
case "customer_name" :
$query .= " order by c.CUSTOMER_NAME";
break;
case "tel_no" :
$query .= " order by c.TEL_NO";
break;
default :
$query .= " order by c.CUSTOMER_ID";
break;
}
$query .= $_REQUEST['sens'] ? " ASC" : " DESC";
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
$customer_id = $row['CUSTOMER_ID'];
$old_customer_name = $row['CUSTOMER_NAME'];
$tel_no = $row['TEL_NO'];
$fax_no = $row['FAX_NO'];
$customer_www = $row['CUSTOMER_WWW'];
$email = $row['EMAIL'];
$customer_add = $row['CUSTOMER_ADD'];
$postalcode = $row['POSTALCODE'];
$memo = $row['MEMO'];
$manage_user = $row['MANAGE_USER'];
$customer_type = $row['CUSTOMER_TYPE'];
$purview = $row['PURVIEW'];
$purview_dept = $row['PURVIEW_DEPT'];
$purview_role = $row['PURVIEW_ROLE'];
$purview_user = $row['PURVIEW_USER'];
$user_name = $row['USER_NAME'];
$query2 = "select LINKMAN_ID, LINKMAN_NAME from linkman where CUSTOMER_ID=".$customer_id;
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_row( $cursor2 ) )
{
$linkman_id = $row2[0];
$linkman_name = $row2[1];
}
switch ( $purview )
{
case "1" :
$purview_ses = default_validate( );
break;
case "2" :
$purview_ses = "<a href=\"#\" onclick=\"onclick=\"openWindows('/general/crm/customer/detail.php?CUSTOMER_ID={$customer_id}');\">".$customer_name."</a>";
break;
case "3" :
$dept_validate = dept_validate( );
$role_validate = role_validate( );
$user_validate = user_validate( );
if ( ( $dept_validate || $role_validate || $user_validate ) === false )
{
$purview_ses = default_validate( );
}
else
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
}
if ( $manage_user == $_SESSION['LOGIN_USER_ID'] || $manage_user == "" )
{
$purview_ses = "<a href=\"#\" onclick=\"onclick=\"openWindows('/general/crm/customer/detail.php?CUSTOMER_ID={$customer_id}');\">".$customer_name."</a>";
}
if ( $purview_ses == false )
{
}
else
{
$str_customer_id .= $customer_id.",";
}
}
$str_customer_id = substr( $str_customer_id, 0, -1 );
$str_customer_id = $str_customer_id == "" ? 0 : $str_customer_id;
$query = "\r\n\tSELECT c.*, u.USER_NAME FROM customer as c, USER as u WHERE 1 and c.CUSTOMER_ID IN(".$str_customer_id.") group by c.CUSTOMER_NAME \r\n\t";
switch ( $_REQUEST['order'] )
{
case "customer_name" :
$query .= " order by c.CUSTOMER_NAME";
break;
case "tel_no" :
$query .= " order by c.TEL_NO";
break;
default :
$query .= " order by c.CUSTOMER_ID";
break;
}
$query .= $_REQUEST['sens'] ? " ASC" : " DESC";
$query .= " LIMIT 0,{$rownum} ";
$cursor = exequery( $connection, $query );
$count = 0;
while ( $row = mysql_fetch_array( $cursor ) )
{
++$count;
$customer_id = $row['CUSTOMER_ID'];
$old_customer_name = $row['CUSTOMER_NAME'];
$tel_no = $row['TEL_NO'];
$fax_no = $row['FAX_NO'];
$customer_www = $row['CUSTOMER_WWW'];
$email = $row['EMAIL'];
$customer_add = $row['CUSTOMER_ADD'];
$postalcode = $row['POSTALCODE'];
$memo = $row['MEMO'];
$manage_user = $row['MANAGE_USER'];
$customer_type = $row['CUSTOMER_TYPE'];
$purview = $row['PURVIEW'];
$purview_dept = $row['PURVIEW_DEPT'];
$purview_role = $row['PURVIEW_ROLE'];
$purview_user = $row['PURVIEW_USER'];
$user_name = $row['USER_NAME'];
$query2 = "select LINKMAN_ID, LINKMAN_NAME from linkman where CUSTOMER_ID=".$customer_id." ORDER BY MOSTLY_LINKMAN DESC LIMIT 0,1";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_row( $cursor2 ) )
{
$linkman_id = $row2[0];
$linkman_name = $row2[1];
}
$customer_name = strlen( $old_customer_name ) <= 35 ? $old_customer_name : substr( $old_customer_name, 0, 35 ).chr( 0 )."...";
switch ( $purview )
{
case "1" :
$purview_ses = default_validate( );
break;
case "2" :
$purview_ses = "<a href=\"#\" onclick=\"onclick=\"openWindows('/general/crm/customer/detail.php?CUSTOMER_ID={$customer_id}')\">".$customer_name."</a>";
break;
case "3" :
$dept_validate = dept_validate( );
$role_validate = role_validate( );
$user_validate = user_validate( );
if ( ( $dept_validate || $role_validate || $user_validate ) === false )
{
$purview_ses = default_validate( );
}
else
{
$purview_ses = "<a href=\"#\" onclick=\"onclick=\"openWindows('/general/crm/customer/detail.php?CUSTOMER_ID={$customer_id}');\">".$customer_name."</a>";
}
}
if ( $manage_user == $_SESSION['LOGIN_USER_ID'] || $manage_user == "" )
{
$purview_ses = "<a href=\"#\" onclick=\"openWindows('/general/crm/customer/detail.php?CUSTOMER_ID={$customer_id}');\">".$customer_name."</a>";
}
if ( $manage_user != "" )
{
$sqlus = "SELECT USER_NAME FROM user WHERE USER_ID='".$manage_user."'";
$rsus = exequery( $connection, $sqlus );
$rowus = mysql_fetch_array( $rsus );
$user_name = $rowus['USER_NAME'];
}
else
{
$user_name = "";
}
{
}
else
{
echo "\t<div class=\"linkdiv\">\r\n\t<IMG SRC=\"/images/littlegif/news_bullet.gif\" WIDTH=\"15\" HEIGHT=\"10\" BORDER=\"0\" ALT=\"\">\r\n\t<a href=\"#\" onclick=\"openWindows('/general/crm/customer/detail.php?CUSTOMER_ID=";
echo $customer_id;
echo "');\">";
echo substrgb( $customer_name, $paraarray['subject_length'], "..." );
echo " \r\n </a>\r\n\t";
if ( $paraarray['is_show_creator'] == 1 )
{
$user_name = getusername( $manage_user );
echo "<span class =\"linkgray\">{$user_name}</span>";
}
echo "\t</div>\r\n ";
}
}
if ( $count < 1 )
{
echo $nothingdata;
}
echo "<div align=\"right\" style=\"padding:2px;font-size:12px;\"><a href=\"/general/crm/customer/query\">更多</a></div>";
?>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -