[Vtigercrm-commits] [vtiger-commits] r10389 - in /vtigercrm/branches/5.0.3: include/RelatedListView.php include/utils/ListViewUtils.php modules/Products/AddProductToPriceBooks.php modules/Products/AddProductsToPriceBook.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Mar 8 05:36:19 EST 2007


Author: saraj
Date: Thu Mar  8 03:36:10 2007
New Revision: 10389

Log:
fix Price Book Permissions problem. Fixes #3057  --Minnie

Modified:
    vtigercrm/branches/5.0.3/include/RelatedListView.php
    vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
    vtigercrm/branches/5.0.3/modules/Products/AddProductToPriceBooks.php
    vtigercrm/branches/5.0.3/modules/Products/AddProductsToPriceBook.php

Modified: vtigercrm/branches/5.0.3/include/RelatedListView.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/RelatedListView.php (original)
+++ vtigercrm/branches/5.0.3/include/RelatedListView.php Thu Mar  8 03:36:10 2007
@@ -492,7 +492,9 @@
 	$header[]=$mod_strings['LBL_PRODUCT_CODE'];
 	$header[]=$mod_strings['LBL_PRODUCT_UNIT_PRICE'];
 	$header[]=$mod_strings['LBL_PB_LIST_PRICE'];
-	$header[]=$mod_strings['LBL_ACTION'];
+	if(isPermitted("PriceBooks","EditView","") == 'yes' || isPermitted("PriceBooks","Delete","") == 'yes')
+		$header[]=$mod_strings['LBL_ACTION'];
+	
 
 	for($i=0; $i<$num_rows; $i++)
 	{
@@ -507,8 +509,17 @@
 		$entries[] = $adb->query_result($list_result,$i,"productcode");
 		$entries[] = $unit_price;
 		$entries[] = $listprice;
-		$entries[] = '<img style="cursor:pointer;" src="'.$image_path.'editfield.gif" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\''.$entity_id.'\',\''.$pricebook_id.'\',\''.$listprice.'\')" alt="'.$app_strings["LBL_EDIT_BUTTON"].'" title="'.$app_strings["LBL_EDIT_BUTTON"].'"/><!--a href="index.php?module=Products&action=EditListPrice&record='.$entity_id.'&pricebook_id='.$pricebook_id.'&listprice='.$listprice.'">edit</a-->&nbsp;|&nbsp;<img src="'.$image_path.'delete.gif" onclick="if(confirm(\'Are you sure?\')) deletePriceBookProductRel('.$entity_id.','.$pricebook_id.');" alt="'.$app_strings["LBL_DELETE"].'" title="'.$app_strings["LBL_DELETE"].'" style="cursor:pointer;" border="0">';
-
+		$action = "";
+		if(isPermitted("PriceBooks","EditView","") == 'yes')
+			$action .= '<img style="cursor:pointer;" src="'.$image_path.'editfield.gif" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\''.$entity_id.'\',\''.$pricebook_id.'\',\''.$listprice.'\')" alt="'.$app_strings["LBL_EDIT_BUTTON"].'" title="'.$app_strings["LBL_EDIT_BUTTON"].'"/>';
+		if(isPermitted("PriceBooks","Delete","") == 'yes')
+		{		
+			if($action != "")
+				$action .= '&nbsp;|&nbsp;';
+			$action .= '<img src="'.$image_path.'delete.gif" onclick="if(confirm(\'Are you sure?\')) deletePriceBookProductRel('.$entity_id.','.$pricebook_id.');" alt="'.$app_strings["LBL_DELETE"].'" title="'.$app_strings["LBL_DELETE"].'" style="cursor:pointer;" border="0">';	
+		}
+		if($action != "")		
+			$entries[] = $action;
 		$entries_list[] = $entries;
 	}
 	if($num_rows>0)

Modified: vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php Thu Mar  8 03:36:10 2007
@@ -123,8 +123,7 @@
 		{
 			$fieldname = $focus->list_fields_name[$name];
 		}
-
-		if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0 || in_array($fieldname,$field) )
+		if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0 || in_array($fieldname,$field) || $fieldname == '')
 		{
 			if(isset($focus->sortby_fields) && $focus->sortby_fields !='')
 			{
@@ -212,7 +211,8 @@
      }
 
 	//Added for Action - edit and delete link header in listview
-	$list_header[] = $app_strings["LBL_ACTION"];
+	if(isPermitted($module,"EditView","") == 'yes' || isPermitted($module,"Delete","") == 'yes')
+		$list_header[] = $app_strings["LBL_ACTION"];
 
 	$log->debug("Exiting getListViewHeader method ...");
 	return $list_header;
@@ -570,7 +570,6 @@
 					$fieldname = $oCv->list_fields_name[$name];
 				}
 			}
-
 			if($is_admin==true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0 || in_array($fieldname,$field) || $fieldname == '')
 			{
 
@@ -749,14 +748,21 @@
 		}
 
 		//Added for Actions ie., edit and delete links in listview 
-		$edit_link = getListViewEditLink($module,$entity_id,$relatedlist,$varreturnset,$list_result,$list_result_count);
-		$del_link = getListViewDeleteLink($module,$entity_id,$relatedlist,$varreturnset);
-
-		$links_info = "<a href=\"$edit_link\"> &nbsp;".$app_strings["LNK_EDIT"]." </a> ";
-		if($del_link != '')
-			$links_info .=	" | <a href='javascript:confirmdelete(\"$del_link\")'> ".$app_strings["LNK_DELETE"]." </a>";
-
-		$list_header[] = $links_info;
+		$links_info = "";
+		if(isPermitted($module,"EditView","") == 'yes'){
+			$edit_link = getListViewEditLink($module,$entity_id,$relatedlist,$varreturnset,$list_result,$list_result_count);
+			$links_info .= "<a href=\"$edit_link\"> &nbsp;".$app_strings["LNK_EDIT"]." </a> ";
+		}
+		
+			
+		if(isPermitted($module,"Delete","") == 'yes'){
+			if($links_info != "")
+				$links_info .=  " | ";
+			$del_link = getListViewDeleteLink($module,$entity_id,$relatedlist,$varreturnset);
+			$links_info .=	"<a href='javascript:confirmdelete(\"$del_link\")'> ".$app_strings["LNK_DELETE"]." </a>";
+		}	
+		if($links_info != "")
+			$list_header[] = $links_info;
 
 		echo '<script>
 				function confirmdelete(url)

Modified: vtigercrm/branches/5.0.3/modules/Products/AddProductToPriceBooks.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Products/AddProductToPriceBooks.php (original)
+++ vtigercrm/branches/5.0.3/modules/Products/AddProductToPriceBooks.php Thu Mar  8 03:36:10 2007
@@ -115,9 +115,12 @@
 		$field_name=$entity_id."_listprice";
 		$list_body .= '<td><INPUT type=checkbox NAME="selected_id" id="check_'.$entity_id.'" value= '.$entity_id.' onClick=\'toggleSelectAll(this.name,"selectall");updateListPrice("'.$unit_price.'","'.$field_name.'",this)\'></td>';
 		$list_body .= '<td>'.$adb->query_result($list_result,$i,"bookname").'</td>';
-		$list_body .= '<td>'.$unit_price.'</td>';
-		$list_body .= '<td><input type="text" name="'.$field_name.'" style="visibility:hidden;" id="'.$field_name.'"></td>';
-		$list_body .= '</tr>';
+		$list_body .= '<td>'.$unit_price.'</td><td>';
+		if(isPermitted("PriceBooks","EditView","") == 'yes')
+			$list_body .= '<input type="text" name="'.$field_name.'" style="visibility:hidden;" id="'.$field_name.'">';
+		else
+			$list_body .= '<input type="text" name="'.$field_name.'" style="visibility:hidden;" readonly id="'.$field_name.'">';	
+		$list_body .= '</td></tr>';
 	}
 
 }

Modified: vtigercrm/branches/5.0.3/modules/Products/AddProductsToPriceBook.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Products/AddProductsToPriceBook.php (original)
+++ vtigercrm/branches/5.0.3/modules/Products/AddProductsToPriceBook.php Thu Mar  8 03:36:10 2007
@@ -135,8 +135,12 @@
 		$list_body .= '<td><INPUT type=checkbox NAME="selected_id" id="check_'.$entity_id.'" value= '.$entity_id.' onClick=\'toggleSelectAll(this.name,"selectall");updateListPrice("'.$unit_price.'","'.$field_name.'",this)\'></td>';
 		$list_body .= '<td>'.$adb->query_result($list_result,$i,"productname").'</td>';
 		$list_body .= '<td>'.$adb->query_result($list_result,$i,"productcode").'</td>';
-		$list_body .= '<td>'.$unit_price.'</td>';
-		$list_body .= '<td><input type="text" name="'.$field_name.'" id="'.$field_name.'" style="visibility:hidden;"></td></tr>';
+		$list_body .= '<td>'.$unit_price.'</td><td>';
+		if(isPermitted("PriceBooks","EditView","") == 'yes')
+			$list_body .= '<input type="text" name="'.$field_name.'" style="visibility:hidden;" id="'.$field_name.'">';
+		else
+			$list_body .= '<input type="text" name="'.$field_name.'" style="visibility:hidden;" readonly id="'.$field_name.'">';
+		$list_body .= '</td></tr>';	
 	}
 }
 





More information about the vtigercrm-commits mailing list