Changing Red Flags
From PikaDocs
By Matthew Friedlander
Pika Software (http://www.pikasoftware.com/)
Under the pika case screen there are a number of warning flags that may appear determined by the case data that has been, or has not been, entered. The flags themselves are generated by the case_screen.php file located under the /modules directory in your Pika installation
case_screen.php
6 if (!$case_row['asset0'] || !$case_row['asset1'] || !$case_row['asset2'] ||
7 !$case_row['asset3'] || !$case_row['asset4'])
8 {
9 $warnings .= pl_warning('Asset Info is Blank');
10 }
In the above example we have the first few lines of the case_screen.php file displayed showing the creation of a single flag that is displayed if the asset info has not been filled in on the eligibility screen. The if statement tests each of the asset fields then if any are found to be blank it appends the flag html to the $warnings variable which is output on the case screen. You can include any number of additional if statements and test on any of the fields in the familar $case_row variable which includes all fields from the table cases.
It is possible to do red flags on client information as opposed to case information.
Example 1, flag a blank DOB:
if (!$case_row['birth_date'])
{
$warnings .= pl_warning('DOB is Blank');
}
Example 2, flag a blank SSN:
if (!$case_row['ssn'])
{
$warnings .= pl_warning('SSN is Blank');
}
(Note that although these flag missing client information, the flags only appear on the case screens, not on the address book screens).
Andrew Cameron
More examples
1) This code will flag you if you have an income amount but no income type for that amount.
if (
(!$case_row['income_type0'] && (($case_row['annual0'])&&($case_row['annual0']!='0.00')) )
|| (!$case_row['income_type1'] && (($case_row['annual1'])&&($case_row['annual1']!='0.00')) )
|| (!$case_row['income_type2'] && (($case_row['annual2'])&&($case_row['annual2']!='0.00')) )
|| (!$case_row['income_type3'] && (($case_row['annual3'])&&($case_row['annual3']!='0.00')) )
|| (!$case_row['income_type4'] && (($case_row['annual4'])&&($case_row['annual4']!='0.00')) )
)
{
$warnings .= pl_warning('Income Amount, but no Type');
}
Andrew Cameron 2006/3/23
2) Here's an example that shows how to compare dates. You should convert strings to timestamps before doing the comparison. With this code we want to catch if a screener forgets to calculate the % of poverty. But we don't want this flag showing up on thousands of old cases that were opened before we switched to Pika.
// detect if % of poverty is blank on cases screened after transition to Pika
if ( !($case_row['poverty'])
&& (strtotime($case_row['open_date'])>=strtotime('2006-6-12'))
)
{
$warnings .= pl_warning('Please Calculate the % of Poverty');
}
Andrew Cameron 2006/8/15
