Hi All,
Thank you for the previous post.
Now I put 3 type of cases, I created a contact and I created a case for the first type of case, I looked at the case summary page and everything sounded good...THEN I put another type of case to the same contact, I looked at the corresponding case summary page and I found as CASE TYPE, in the top side of the page, the first type of case that I had put..NOT THE ACTUAL TYPE OF CASE...
I went inside the code in the file CRM/Case/BAO/Case.php:
static function getCaseType( $caseId, $colName = 'label' )
{
$caseType = null;
if ( !$caseId ) return $caseType;
$sql = "
SELECT ov.{$colName}
FROM civicrm_case ca
INNER JOIN civicrm_option_group og ON og.name='case_type'
INNER JOIN civicrm_option_value ov ON (ca.case_type_id=ov.value AND ov.option_group_id=og.id)";
return CRM_Core_DAO::singleValueQuery( $sql );
}
I think this code is wrong because the query grabs all the type names of cases but the function "singleValueQuery" gives me only the first row of the results (I don't know why?) and then the $caseId of the case (passed correctly as argument) is never used so I couldn't ever have the right case type name
Please, could someone give me some explanation about this!!
Ps. on your demo it seems to work

Rob