Contact.php bug fix 305

From PikaDocs

Pika 3.05 has a list of cases at the bottom of a contact's screen. This may also be in verison 3.04 (?). The subtemplate in question is subtemplates/contact_full.html. The attorney on the case is supposed to show up, the subtemplate has the tag %%[atty_name]%%. Unfortunately, due to a bug in contact.php that template variable is not constructed. Here is how to fix it so that the attorney name will now show up.

Edit your contact.php.

First find this section, around line 75:

if (mysql_num_rows($result) > 1)
{
	// remind the user that edit the contact record will cascade thru the system
	$clean_contact_screen['preamble'] = '<p><strong>Note</strong>:  The contact information on this screen is linked to multiple cases.
			If you change the information on this screen, it will affect <strong>each</strong> of these cases.  
			Only change this information if this person/organization has changed their address, telephone number, etc.';
}

By the way, if you want to remove that warning from your screen to save screen space, comment out the whole section with /* and */

Anyway, after that code put a blank line and then paste the following in:

// Andrew Cameron 2006/9/13 get the staff array so can produce template variable atty_name during the next loop
$staff_array = pikaMisc::fetchStaffArray();

Change the name and date to your name and the date you made this change.

Now scroll down a few lines and find this:

$row['open_date'] = pl_date_unmogrify($row['open_date']);
$row['close_date'] = pl_date_unmogrify($row['close_date']);    

On the next line immediately after, paste in these 2 lines:

// Andrew Cameron 2006/9/13 bug fix Pika 3.05 missing atty_name which is needed in subtemplates/contact_full.html
$row['atty_name'] = $staff_array[$row['user_id']];

Keep the indenting the same as it was. Again, change the name and date to yours.

Now you're all set. The attorney's name should show up on the page.



Original entry by Andrew Cameron 2006/8/9
Legal Services Lawline of Vermont (http://www.lawlinevt.org/) and Vermont Legal Aid (http://www.vtlegalaid.org/)