[Vtigercrm-commits] [vtiger-commits] r10206 - in /vtigercrm/branches/5.0.3/modules/Reports: ReportRun.php Reports.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue Feb 20 08:03:39 EST 2007
Author: saraj
Date: Tue Feb 20 06:03:32 2007
New Revision: 10206
Log:
Security rules in report module, user date format not reflected in reports - fixed. Fixes #2692 and #2581
Modified:
vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php
vtigercrm/branches/5.0.3/modules/Reports/Reports.php
Modified: vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php (original)
+++ vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php Tue Feb 20 06:03:32 2007
@@ -102,6 +102,14 @@
elseif($selectedfields[0] == 'vtiger_activity' && $selectedfields[1] == 'date_start')
{
$columnslist[$fieldcolname] = "concat(vtiger_activity.date_start,' ',vtiger_activity.time_start) as Calendar_Start_Date_and_Time";
+ }
+ elseif(stristr($selectedfields[0],"vtiger_users") && $selectedfields[1] == 'user_name')
+ {
+ $columnslist[$fieldcolname] = " case when (".$selectedfields[0].".user_name not like '') then ".$selectedfields[0].".user_name else vtiger_groups.groupname end as ".$this->primarymodule."_Assigned_To";
+ }
+ elseif($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ {
+ $columnslist[$fieldcolname] = "vtiger_crmentity.".$selectedfields[1]." AS '".$selectedfields[2]."'";
}
else
{
@@ -136,7 +144,7 @@
}
else
{
- $query .= " vtiger_field.tabid=(select tabid from vtiger_tab where vtiger_tab.name='".$module."') and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList." group by vtiger_field.fieldid order by block,sequence";
+ $query .= " vtiger_field.tabid in (select tabid from vtiger_tab where vtiger_tab.name in ('".$this->primarymodule."','".$this->secondarymodule."')) and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList." group by vtiger_field.fieldid order by block,sequence";
}
$result = $adb->query($query);
@@ -217,6 +225,8 @@
if($ordercolumnsequal)
{
$selectedfields = explode(":",$fieldcolname);
+ if($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ $selectedfields[0] = "vtiger_crmentity";
$sSQLList[] = $selectedfields[0].".".$selectedfields[1]." '".$selectedfields[2]."'";
}
}
@@ -359,13 +369,17 @@
{
$fieldvalue = "(case when (vtiger_activity.status not like '') then vtiger_activity.status else vtiger_activity.eventstatus end)".$this->getAdvComparator($comparator,trim($value),$datatype);
}
- /* elseif($selectedfields[0] == 'vtiger_crmentityRelHelpDesk' && $selectedfields[1] == 'setype')
- {
- $fieldvalue = "(case vtiger_crmentityRelHelpDesk.setype when 'Accounts' then vtiger_accountRelHelpDesk.accountname else concat(vtiger_contactdetailsRelHelpDesk.lastname,' ',vtiger_contactdetailsRelHelpDesk.firstname) end) ". $this->getAdvComparator($comparator,trim($value),$datatype);
- }*/
+ elseif($selectedfields[0] == "vtiger_users".$this->primarymodule && $selectedfields[1] == 'user_name')
+ {
+ $fieldvalue = " case when (".$selectedfields[0].".user_name not like '') then ".$selectedfields[0].".user_name else vtiger_groups.groupname end ".$this->getAdvComparator($comparator,trim($value),$datatype);
+ }
+ elseif($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ {
+ $fieldvalue = "vtiger_crmentity.".$selectedfields[1]." ".$this->getAdvComparator($comparator,trim($value),$datatype);
+ }
elseif($selectedfields[0] == 'vtiger_crmentityRelHelpDesk' && $selectedfields[1]=='setype')
{
- $fieldvalue = "(vtiger_accountRelHelpDesk.accountname ".$this->getAdvComparator($comparator,trim($value),$datatype)." or vtiger_contactdetailsRelHelpDesk.lastname ".$this->getAdvComparator($comparator,trim($value),$datatype)." or vtiger_contactdetailsRelHelpDesk.firstname ".$this->getAdvComparator($comparator,trim($value),$datatype).")";
+ $fieldvalue = "(vtiger_accountRelHelpDesk.accountname ".$this->getAdvComparator($comparator,trim($value),$datatype)." or vtiger_contactdetailsRelHelpDesk.lastname ".$this->getAdvComparator($comparator,trim($value),$datatype)." or vtiger_contactdetailsRelHelpDesk.firstname ".$this->getAdvComparator($comparator,trim($value),$datatype).")";
}
else
{
@@ -409,16 +423,17 @@
if($fieldcolname != "none")
{
+ $selectedfields = explode(":",$fieldcolname);
+ if($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ $selectedfields[0] = "vtiger_crmentity";
if($datefilter == "custom")
{
if($startdate != "0000-00-00" && $enddate != "0000-00-00")
{
- $selectedfields = explode(":",$fieldcolname);
$stdfilterlist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." between '".$startdate."' and '".$enddate."'";
}
}else
{
- $selectedfields = explode(":",$fieldcolname);
$startenddate = $this->getStandarFiltersStartAndEndDate($datefilter);
if($startenddate[0] != "" && $startenddate[1] != "")
{
@@ -444,18 +459,19 @@
{
if($filtercolumn != "none")
{
+ $selectedfields = explode(":",$filtercolumn);
+ if($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ $selectedfields[0] = "vtiger_crmentity";
if($filter == "custom")
{
if($startdate != "" && $enddate != "")
{
- $selectedfields = explode(":",$filtercolumn);
$stdfilterlist[$filtercolumn] = $selectedfields[0].".".$selectedfields[1]." between '".$startdate."' and '".$enddate."'";
}
}else
{
if($startdate != "" && $enddate != "")
{
- $selectedfields = explode(":",$filtercolumn);
$startenddate = $this->getStandarFiltersStartAndEndDate($filter);
if($startenddate[0] != "" && $startenddate[1] != "")
{
@@ -496,16 +512,17 @@
if($fieldcolname != "none")
{
+ $selectedfields = explode(":",$fieldcolname);
+ if($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ $selectedfields[0] = "vtiger_crmentity";
if($datefilter == "custom")
{
if($startdate != "0000-00-00" && $enddate != "0000-00-00")
{
- $selectedfields = explode(":",$fieldcolname);
$sSQL .= $selectedfields[0].".".$selectedfields[1]." between '".$startdate."' and '".$enddate."'";
}
}else
{
- $selectedfields = explode(":",$fieldcolname);
$startenddate = $this->getStandarFiltersStartAndEndDate($datefilter);
if($startenddate[0] != "" && $startenddate[1] != "")
{
@@ -764,6 +781,8 @@
if($fieldcolname != "none")
{
$selectedfields = explode(":",$fieldcolname);
+ if($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ $selectedfields[0] = "vtiger_crmentity";
$sqlvalue = $selectedfields[0].".".$selectedfields[1]." ".$sortorder;
$grouplist[$fieldcolname] = $sqlvalue;
$this->groupbylist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." ".$selectedfields[2];
@@ -818,6 +837,8 @@
$sSQL .= ", ";
$this->orderbylistsql .= ", ";
}
+ if($selectedfields[0] == "vtiger_crmentity".$this->primarymodule)
+ $selectedfields[0] = "vtiger_crmentity";
$sSQL .= $selectedfields[0].".".$selectedfields[1]." ".$sortorder;
$this->orderbylistsql .= $selectedfields[0].".".$selectedfields[1]." ".$selectedfields[2];
}
@@ -1190,87 +1211,100 @@
if($module == "Leads")
{
$query = "from vtiger_leaddetails
- inner join vtiger_crmentity as vtiger_crmentityLeads on vtiger_crmentityLeads.crmid=vtiger_leaddetails.leadid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid
inner join vtiger_leadsubdetails on vtiger_leadsubdetails.leadsubscriptionid=vtiger_leaddetails.leadid
inner join vtiger_leadaddress on vtiger_leadaddress.leadaddressid=vtiger_leadsubdetails.leadsubscriptionid
inner join vtiger_leadscf on vtiger_leaddetails.leadid = vtiger_leadscf.leadid
- left join vtiger_users as vtiger_usersLeads on vtiger_usersLeads.id = vtiger_crmentityLeads.smownerid
- where vtiger_crmentityLeads.deleted=0 and vtiger_leaddetails.converted=0";
+ left join vtiger_leadgrouprelation on vtiger_leaddetails.leadid = vtiger_leadgrouprelation.leadid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_leadgrouprelation.groupname
+ left join vtiger_users as vtiger_usersLeads on vtiger_usersLeads.id = vtiger_crmentity.smownerid
+ where vtiger_crmentity.deleted=0 and vtiger_leaddetails.converted=0";
}
if($module == "Accounts")
{
$query = "from vtiger_account
- inner join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid
inner join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
inner join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
inner join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_accountgrouprelation on vtiger_account.accountid = vtiger_accountgrouprelation.accountid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_accountgrouprelation.groupname
left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
- left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid
+ left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentity.smownerid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityAccounts.deleted=0 ";
+ where vtiger_crmentity.deleted=0 ";
}
if($module == "Contacts")
{
$query = "from vtiger_contactdetails
- inner join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid
inner join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
inner join vtiger_customerdetails on vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
inner join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
inner join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ left join vtiger_contactgrouprelation on vtiger_contactdetails.contactid = vtiger_contactgrouprelation.contactid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_contactgrouprelation.groupname
left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid
+ left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentity.smownerid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityContacts.deleted=0";
+ where vtiger_crmentity.deleted=0";
}
if($module == "Potentials")
{
$query = "from vtiger_potential
- inner join vtiger_crmentity as vtiger_crmentityPotentials on vtiger_crmentityPotentials.crmid=vtiger_potential.potentialid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_potential.potentialid
inner join vtiger_account as vtiger_accountPotentials on vtiger_potential.accountid = vtiger_accountPotentials.accountid
inner join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid
- left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentityPotentials.smownerid
+ left join vtiger_potentialgrouprelation on vtiger_potential.potentialid = vtiger_potentialgrouprelation.potentialid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_potentialgrouprelation.groupname
+ left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentity.smownerid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityPotentials.deleted=0 ";
+ where vtiger_crmentity.deleted=0 ";
}
//For this Product - we can related Accounts, Contacts (Also Leads, Potentials)
if($module == "Products")
{
$query = "from vtiger_products
- inner join vtiger_crmentity as vtiger_crmentityProducts on vtiger_crmentityProducts.crmid=vtiger_products.productid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_products.productid
left join vtiger_productcf on vtiger_products.productid = vtiger_productcf.productid
- left join vtiger_users as vtiger_usersProducts on vtiger_usersProducts.id = vtiger_crmentityProducts.smownerid
+ left join vtiger_users as vtiger_usersProducts on vtiger_usersProducts.id = vtiger_crmentity.smownerid
left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_products.vendor_id
left join vtiger_seproductsrel on vtiger_seproductsrel.productid= vtiger_products.productid and vtiger_seproductsrel.setype='".$this->secondarymodule."'
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityProducts.deleted=0";
+ where vtiger_crmentity.deleted=0";
}
if($module == "HelpDesk")
{
$query = "from vtiger_troubletickets
- inner join vtiger_crmentity as vtiger_crmentityHelpDesk
- on vtiger_crmentityHelpDesk.crmid=vtiger_troubletickets.ticketid
+ inner join vtiger_crmentity
+ on vtiger_crmentity.crmid=vtiger_troubletickets.ticketid
inner join vtiger_ticketcf on vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid
left join vtiger_crmentity as vtiger_crmentityRelHelpDesk on vtiger_crmentityRelHelpDesk.crmid = vtiger_troubletickets.parent_id
left join vtiger_account as vtiger_accountRelHelpDesk on vtiger_accountRelHelpDesk.accountid=vtiger_crmentityRelHelpDesk.crmid
left join vtiger_contactdetails as vtiger_contactdetailsRelHelpDesk on vtiger_contactdetailsRelHelpDesk.contactid= vtiger_crmentityRelHelpDesk.crmid
left join vtiger_products as vtiger_productsRel on vtiger_productsRel.productid = vtiger_troubletickets.product_id
- left join vtiger_users as vtiger_usersHelpDesk on vtiger_crmentityHelpDesk.smownerid=vtiger_usersHelpDesk.id
+ left join vtiger_ticketgrouprelation on vtiger_troubletickets.ticketid = vtiger_ticketgrouprelation.ticketid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_ticketgrouprelation.groupname
+
+ left join vtiger_users as vtiger_usersHelpDesk on vtiger_crmentity.smownerid=vtiger_usersHelpDesk.id
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityHelpDesk.deleted=0 ";
+ where vtiger_crmentity.deleted=0 ";
}
if($module == "Calendar")
{
$query = "from vtiger_activity
- inner join vtiger_crmentity as vtiger_crmentityCalendar on vtiger_crmentityCalendar.crmid=vtiger_activity.activityid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid
left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid
left join vtiger_contactdetails as vtiger_contactdetailsCalendar on vtiger_contactdetailsCalendar.contactid= vtiger_cntactivityrel.contactid
- left join vtiger_users as vtiger_usersCalendar on vtiger_usersCalendar.id = vtiger_crmentityCalendar.smownerid
+ left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid = vtiger_crmentity.crmid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname
+ left join vtiger_users as vtiger_usersCalendar on vtiger_usersCalendar.id = vtiger_crmentity.smownerid
left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid
left join vtiger_crmentity as vtiger_crmentityRelCalendar on vtiger_crmentityRelCalendar.crmid = vtiger_seactivityrel.crmid
left join vtiger_account as vtiger_accountRelCalendar on vtiger_accountRelCalendar.accountid=vtiger_crmentityRelCalendar.crmid
@@ -1280,55 +1314,61 @@
left join vtiger_purchaseorder as vtiger_purchaseorderRelCalendar on vtiger_purchaseorderRelCalendar.purchaseorderid = vtiger_crmentityRelCalendar.crmid
left join vtiger_invoice as vtiger_invoiceRelCalendar on vtiger_invoiceRelCalendar.invoiceid = vtiger_crmentityRelCalendar.crmid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- WHERE vtiger_crmentityCalendar.deleted=0 and (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task')";
+ WHERE vtiger_crmentity.deleted=0 and (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task')";
}
if($module == "Quotes")
{
$query = "from vtiger_quotes
- inner join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_quotes.quoteid
inner join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
inner join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
left join vtiger_quotescf on vtiger_quotes.quoteid = vtiger_quotescf.quoteid
- left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
+ left join vtiger_quotegrouprelation on vtiger_quotes.quoteid = vtiger_quotegrouprelation.quoteid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_quotegrouprelation.groupname
+ left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentity.smownerid
left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
left join vtiger_contactdetails as vtiger_contactdetailsQuotes on vtiger_contactdetailsQuotes.contactid = vtiger_quotes.contactid
left join vtiger_account as vtiger_accountQuotes on vtiger_accountQuotes.accountid = vtiger_quotes.accountid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityQuotes.deleted=0";
+ where vtiger_crmentity.deleted=0";
}
if($module == "PurchaseOrder")
{
$query = "from vtiger_purchaseorder
- inner join vtiger_crmentity as vtiger_crmentityPurchaseOrder on vtiger_crmentityPurchaseOrder.crmid=vtiger_purchaseorder.purchaseorderid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_purchaseorder.purchaseorderid
inner join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid
inner join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid
left join vtiger_purchaseordercf on vtiger_purchaseorder.purchaseorderid = vtiger_purchaseordercf.purchaseorderid
- left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentityPurchaseOrder.smownerid
+ left join vtiger_pogrouprelation on vtiger_purchaseorder.purchaseorderid = vtiger_pogrouprelation.purchaseorderid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_pogrouprelation.groupname
+ left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentity.smownerid
left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_purchaseorder.vendorid
left join vtiger_contactdetails as vtiger_contactdetailsPurchaseOrder on vtiger_contactdetailsPurchaseOrder.contactid = vtiger_purchaseorder.contactid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityPurchaseOrder.deleted=0";
+ where vtiger_crmentity.deleted=0";
}
if($module == "Invoice")
{
$query = "from vtiger_invoice
- inner join vtiger_crmentity as vtiger_crmentityInvoice on vtiger_crmentityInvoice.crmid=vtiger_invoice.invoiceid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_invoice.invoiceid
inner join vtiger_invoicebillads on vtiger_invoice.invoiceid=vtiger_invoicebillads.invoicebilladdressid
inner join vtiger_invoiceshipads on vtiger_invoice.invoiceid=vtiger_invoiceshipads.invoiceshipaddressid
left join vtiger_invoicecf on vtiger_invoice.invoiceid = vtiger_invoicecf.invoiceid
- left join vtiger_users as vtiger_usersInvoice on vtiger_usersInvoice.id = vtiger_crmentityInvoice.smownerid
+ left join vtiger_invoicegrouprelation on vtiger_invoice.invoiceid = vtiger_invoicegrouprelation.invoiceid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_invoicegrouprelation.groupname
+ left join vtiger_users as vtiger_usersInvoice on vtiger_usersInvoice.id = vtiger_crmentity.smownerid
left join vtiger_account as vtiger_accountInvoice on vtiger_accountInvoice.accountid = vtiger_invoice.accountid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityInvoice.deleted=0";
+ where vtiger_crmentity.deleted=0";
}
if($module == "SalesOrder")
{
$query = "from vtiger_salesorder
- inner join vtiger_crmentity as vtiger_crmentitySalesOrder on vtiger_crmentitySalesOrder.crmid=vtiger_salesorder.salesorderid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_salesorder.salesorderid
inner join vtiger_sobillads on vtiger_salesorder.salesorderid=vtiger_sobillads.sobilladdressid
inner join vtiger_soshipads on vtiger_salesorder.salesorderid=vtiger_soshipads.soshipaddressid
left join vtiger_salesordercf on vtiger_salesorder.salesorderid = vtiger_salesordercf.salesorderid
@@ -1336,8 +1376,10 @@
left join vtiger_quotes as vtiger_quotesSalesOrder on vtiger_quotesSalesOrder.quoteid = vtiger_salesorder.quoteid
left join vtiger_account as vtiger_accountSalesOrder on vtiger_accountSalesOrder.accountid = vtiger_salesorder.accountid
left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_salesorder.potentialid
- left join vtiger_users as vtiger_usersSalesOrder on vtiger_usersSalesOrder.id = vtiger_crmentitySalesOrder.smownerid
- where vtiger_crmentitySalesOrder.deleted=0";
+ left join vtiger_sogrouprelation on vtiger_salesorder.salesorderid = vtiger_sogrouprelation.salesorderid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_sogrouprelation.groupname
+ left join vtiger_users as vtiger_usersSalesOrder on vtiger_usersSalesOrder.id = vtiger_crmentity.smownerid
+ where vtiger_crmentity.deleted=0";
}
@@ -1345,11 +1387,13 @@
{
$query = "from vtiger_campaign
inner join vtiger_campaignscf as vtiger_campaignscf on vtiger_campaignscf.campaignid=vtiger_campaign.campaignid
- inner join vtiger_crmentity as vtiger_crmentityCampaigns on vtiger_crmentityCampaigns.crmid=vtiger_campaign.campaignid
-
- left join vtiger_users as vtiger_usersCampaigns on vtiger_usersCampaigns.id = vtiger_crmentityCampaigns.smownerid
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_campaign.campaignid
+ left join vtiger_campaigngrouprelation on vtiger_campaign.campaignid = vtiger_campaigngrouprelation.campaignid
+ left join vtiger_groups on vtiger_groups.groupname = vtiger_campaigngrouprelation.groupname
+
+ left join vtiger_users as vtiger_usersCampaigns on vtiger_usersCampaigns.id = vtiger_crmentity.smownerid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
- where vtiger_crmentityCampaigns.deleted=0";
+ where vtiger_crmentity.deleted=0";
}
$log->info("ReportRun :: Successfully returned getReportsQuery".$module);
return $query;
@@ -1373,6 +1417,10 @@
$columnstotallist = $this->getColumnsTotal($reportid);
$advfilterlist = $this->getAdvFilterList($reportid);
$this->totallist = $columnstotallist;
+ global $current_user;
+ require('user_privileges/user_privileges_'.$current_user->id.'.php');
+ require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+ $tab_id = getTabid($this->primarymodule);
if($this->reporttype == "summary")
{
if(isset($this->groupbylist))
@@ -1452,6 +1500,12 @@
$reportquery = "select ".$selectedcolumns." ".$reportquery." ".$wheresql;
}
}
+ if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
+ {
+ $sec_parameter=getListViewSecurityParameter($this->primarymodule);
+ $reportquery .= $sec_parameter;
+ }
+
$log->info("ReportRun :: Successfully returned sGetSQLforReport".$reportid);
return $reportquery;
@@ -1527,6 +1581,10 @@
{
$fieldvalue = "-";
}
+ else if(stristr($fld->name, "_Date") || stristr($fld->name, "_Created_Time") || stristr($fld->name, "_Modified_Time")){
+ $fieldvalue = getDisplayDate($fieldvalue);
+ }
+
if(($lastvalue == $fieldvalue) && $this->reporttype == "summary")
{
if($this->reporttype == "summary")
@@ -1615,6 +1673,9 @@
{
$fieldvalue = "-";
}
+ else if(stristr($fld->name, "_Date") || stristr($fld->name, "_Created_Time") || stristr($fld->name, "_Modified_Time")){
+ $fieldvalue = getDisplayDate($fieldvalue);
+ }
$arraylists[str_replace($modules," ",$this->getLstringforReportHeaders($fld->name))] = $fieldvalue;
}
$arr_val[] = $arraylists;
@@ -1749,6 +1810,9 @@
if($fieldvalue == "" )
{
$fieldvalue = "-";
+ }
+ else if(stristr($fld->name, "_Date") || stristr($fld->name, "_Created_Time") || stristr($fld->name, "_Modified_Time")){
+ $fieldvalue = getDisplayDate($fieldvalue);
}
if(($lastvalue == $fieldvalue) && $this->reporttype == "summary")
{
Modified: vtigercrm/branches/5.0.3/modules/Reports/Reports.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Reports/Reports.php (original)
+++ vtigercrm/branches/5.0.3/modules/Reports/Reports.php Tue Feb 20 06:03:32 2007
@@ -230,7 +230,8 @@
$report_details ['description'] = $report["description"];
$report_details ['reportname'] = $report["reportname"];
- $returndata []=$report_details;
+ if(isPermitted($report["primarymodule"],'index') == "yes")
+ $returndata []=$report_details;
}while($report = $adb->fetch_array($result));
}
@@ -776,9 +777,8 @@
}
else
{
- $query .= " vtiger_field.tabid=(select tabid from vtiger_tab where vtiger_tab.name='".$module."') and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList." group by vtiger_field.fieldid order by block,sequence";
- }
-
+ $query .= " vtiger_field.tabid in (select tabid from vtiger_tab where vtiger_tab.name in ('".$this->primodule."','".$this->secmodule."')) and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList." group by vtiger_field.fieldid order by block,sequence";
+ }
$result = $adb->query($query);
@@ -840,25 +840,22 @@
$ssql .= " where vtiger_report.reportid =".$reportid;
$ssql .= " order by vtiger_selectcolumn.columnindex";
$result = $adb->query($ssql);
-
$permitted_fields = Array();
while($columnslistrow = $adb->fetch_array($result))
{
$fieldname ="";
$fieldcolname = $columnslistrow["columnname"];
- list($tablename,$fieldname,$module_field,$colname,$single) = split(":",$fieldcolname);
+ list($tablename,$colname,$module_field,$fieldname,$single) = split(":",$fieldcolname);
require('user_privileges/user_privileges_'.$current_user->id.'.php');
- if(sizeof($permitted_fields) == 0 && $is_admin != true && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1)
+ if(sizeof($permitted_fields) == 0 && $is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1)
{
list($module,$field) = split("_",$module_field);
$permitted_fields = $this->getaccesfield($module);
}
$selectedfields = explode(":",$fieldcolname);
-
$querycolumns = $this->getEscapedColumns($selectedfields);
-
$mod_strings = return_module_language($current_language,$module);
$fieldlabel = trim(str_replace($module," ",$selectedfields[2]));
$fieldlabel = trim(str_replace("_"," ",$fieldlabel));
More information about the vtigercrm-commits
mailing list