Location: PHPKode > projects > Bcom > bcom-1.99.1/bcom/include/crmform_default.inc
<?
/*
 Name: default crm form
 Filename: crmform_default.inc
 Author(s):  Jeroen Houben, Tim Gunn
 Version: 2.0.0
 Purpose:
 	Default edit form for default CRM clients.
*/


print '
<SCRIPT LANGUAGE="JavaScript">
<!--//

function copyaddress()
{
	clientform.elements[\'details[paddress]\'].value = clientform.elements[\'details[address]\'].value;
	clientform.elements[\'details[paddress2]\'].value = clientform.elements[\'details[address2]\'].value;
	clientform.elements[\'details[psuburb]\'].value = clientform.elements[\'details[suburb]\'].value;
	clientform.elements[\'details[pstate]\'].value = clientform.elements[\'details[state]\'].value;
	clientform.elements[\'details[ppostcode]\'].value = clientform.elements[\'details[postcode]\'].value;
	clientform.elements[\'details[pcountry]\'].options[clientform.elements[\'details[country]\'].selectedIndex].selected = true; 
}
//-->
</SCRIPT>
<table width="100%">
<tr>
	<td valign="top">
	<TABLE WIDTH="100%" cellpadding="2" cellspacing="2" border="0">
		<TR>
		<TH colspan="2">'.$SECTIONS[$clienttype]['company']['description'].'</TH>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('gen-group').'</TD>
		<TD class="bar1" width="80%"><A HREF="javascript:bopenwindow(\'clientmanager.php?action=movetogroup&clientid='.$clientid.'&uinotitle=1\',\'MoveClient\',\'400,300\')">'.group_getname($client['c_group']).'</A></td>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('gen-name').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[c_name]',$client['c_name'],35).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-industry').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[industry]',client_getval($clientid,'industry'),35).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-address').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[address]',client_getval($clientid,'address'),30).'</td>
		</TR>
		<TD class="bar2" width="20%">'.LL('crm-address').' 2</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[address2]',client_getval($clientid,'address2'),30).'</td>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-suburb').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[suburb]',client_getval($clientid,'suburb'),30).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-state').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[state]',client_getval($clientid,'state'),3,3).'
		 '.LL('crm-postcode').'&nbsp;'.ui_textbox('details[postcode]',client_getval($clientid,'postcode'),6,8).'
		</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-country').'</TD>
		<TD class="bar1" width="80%">
		'.ui_selectbox('details[country]',unserialize(getoption('locale','countries')),client_getval($clientid,'country','AU')).'
		</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-areacode').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[areacode]',client_getval($clientid,'areacode'),3,3).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-phone').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[phone]',client_getval($clientid,'phone'),8,15).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-fax').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[fax]',client_getval($clientid,'fax'),8,15).'</TD>
		</TR>
		<TR>
		<TD WIDTH="20%" CLASS=bar2>'.LL('crm-web').'</TD>
		<TD WIDTH="80%" CLASS=bar1>'.ui_textbox('details[website]',client_getval($clientid,'website'),30).'</TD>
		</TR>
		<TR>
		<TD WIDTH="20%" CLASS=bar2>'.LL('crm-email').'</TD>
		<TD WIDTH="80%" CLASS=bar1>'.ui_textbox('details[email]',client_getval($clientid,'email'),30).'&nbsp;&nbsp;&nbsp;<A HREF="usermsg.php?display=compose&email[to]='.client_getval($clientid,'email').'">send e-mail</A></TD>
		</TR>
		<TR>
		<TD WIDTH="20%" CLASS=bar2>'.LL('crm-abn').'</TD>
		<TD WIDTH="80%" CLASS=bar1>'.ui_textbox('details[abn]',client_getval($clientid,'abn'),10).'</TD>
		</TR>';
		print showcustomfields('company');
	print '
	</TABLE>
	</td>';
	// ********* Postal Address ************************** //
	print '
	<td valign="top">
	<table WIDTH="100%" cellpadding="2" cellspacing="2" border="0">
	<TR>
	<TH colspan="2">
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<th align="left">'.$SECTIONS[$clienttype]['postal']['description'].'</th>
		<th align="right"><div align="right">'.getbutton('copy-address','javascript:copyaddress();').'</div></th>
	</tr>
	</table>
	</TH>
	</TR>
	<TR>
		<TD class="bar2" width="20%">'.LL('crm-address').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[paddress]',client_getval($clientid,'paddress'),30).'</td>
		</TR>
	<TR>
		<TD class="bar2" width="20%">'.LL('crm-address').' 2</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[paddress2]',client_getval($clientid,'paddress2'),30).'</td>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-suburb').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[psuburb]',client_getval($clientid,'psuburb'),30).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-pobox').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[ppobox]',client_getval($clientid,'ppobox'),6,8).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-state').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[pstate]',client_getval($clientid,'pstate'),3,3).'
		'.LL('crm-postcode').'&nbsp;'.ui_textbox('details[ppostcode]',client_getval($clientid,'ppostcode'),6,8).'
		</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-country').'</TD>
		<TD class="bar1" width="80%">
		'.ui_selectbox('details[pcountry]',unserialize(getoption('locale','countries')),client_getval($clientid,'pcountry','AU')).'
		</TD>
		</TR>';
		print showcustomfields('postal');
		print '
	</table>
	</td>
</tr>
</table>';

// ******************* Contact persons - can be multiple!! **************************
$current = 0; $max = 0;
print '
<table width="100%"><tr>';
if ($clientid == 0) {
	$num = 0;
} else {
	$result = bsql_query('SELECT cd_field FROM client_data WHERE cd_c_id = '.intval($clientid).' AND cd_field like \'lname_con%\' ORDER BY cd_field') or sdie();
	$num = bsql_numrows($result);
}
for ($i = 1;$i < $num + 1; $i++) {
	if($clientid != 0) {
		$current = bsql_getirow($result);
		$current = intval(substr($current[0],9,strlen($current[0])-9));
		$max = max($current,$max);
	} else { $current = 1; }
	print '<td width="50%"><TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="2" BORDER="0">
	<TR>
	<TH colspan="2">'.LL('crm-contact-person').'&nbsp;'.$i;
	if ($i > 1) { print '&nbsp;'.getbutton('delete',$PHP_SELF.'?action=contact_del&clientid='.$clientid.'&conid='.$current); }
	print '</TH>
	</TR>
	<TR>
	<TD WIDTH="20%" CLASS=bar2>'.LL('crm-position').'</TD>
	<TD WIDTH="80%" CLASS=bar1>'.ui_textbox('details[position_con'.$current.']',client_getval($clientid,'position_con'.$current),20).'</TD>
	</TR>
	<TR>
	<TD WIDTH="20%" CLASS=bar2>'.LL('crm-firstname').'</TD>
	<TD WIDTH="80%" CLASS=bar1>
	<SELECT NAME="details[title_con'.$current.']">';
	if(client_getval($clientid,'title_con'.$current.'') == 'M.') { print '<OPTION VALUE="M." SELECTED>M.'; } else { print '<OPTION VALUE="M.">M.'; }
	if(client_getval($clientid,'title_con'.$current.'') == 'Mr') { print '<OPTION VALUE="Mr" SELECTED>Mr'; } else { print '<OPTION VALUE="Mr">Mr'; }
	if(client_getval($clientid,'title_con'.$current.'') == 'Ms') { print'<OPTION VALUE="Ms" SELECTED>Ms'; } else { print '<OPTION VALUE="Ms">Ms'; }
	if(client_getval($clientid,'title_con'.$current.'') == 'Miss') { print'<OPTION VALUE="Miss" SELECTED>Miss'; } else { print '<OPTION VALUE="Miss">Miss'; }
	if(client_getval($clientid,'title_con'.$current.'') == 'Mrs') { print'<OPTION VALUE="Mrs" SELECTED>Mrs'; } else { print '<OPTION VALUE="Mrs">Mrs'; }
	if(client_getval($clientid,'title_con'.$current.'') == 'Dr') { print'<OPTION VALUE="Dr" SELECTED>Dr'; } else { print '<OPTION VALUE="Dr">Dr'; }
	if(client_getval($clientid,'title_con'.$current.'') == 'Drs') { print'<OPTION VALUE="Drs" SELECTED>Drs'; } else { print '<OPTION VALUE="Drs">Drs'; }
	print '</SELECT>
	'.ui_textbox('details[fname_con'.$current.']',client_getval($clientid,'fname_con'.$current.''),20).'
	</TD>
	</TR>
	<TR>
	<TD WIDTH="20%" CLASS="bar2">'.LL('crm-lastname').'<a name="conid'.($current).'"></a></TD>
	<TD WIDTH="80%" CLASS="bar1">'.ui_textbox('details[lname_con'.$current.']',client_getval($clientid,'lname_con'.$current.''),20).'</TD>
	</TR>
	<TR>
	<TD WIDTH="20%" CLASS="bar2">'.LL('crm-email').'</TD>
	<TD WIDTH="80%" CLASS="bar1">'.ui_textbox('details[email_con'.$current.']',client_getval($clientid,'email_con'.$current.''),30).'&nbsp;&nbsp;&nbsp;<A HREF="usermsg.php?display=compose&email[to]='.client_getval($clientid,'email_con'.$current).'">send e-mail</A></TD>
	</TR>
	<TR>
	<TD WIDTH="20%" CLASS="bar2">'.LL('crm-mobile').'</TD>
	<TD WIDTH="80%" CLASS="bar1">'.ui_textbox('details[mobile_con'.$current.']',client_getval($clientid,'mobile_con'.$current.''),10).'</TD>
	</TR>
	<TR>
	<TD WIDTH="20%" CLASS="bar2">'.LL('crm-direct-line').'</TD>
	<TD WIDTH="80%" CLASS="bar1">'.ui_textbox('details[directline_con'.$current.']',client_getval($clientid,'directline_con'.$current.''),10).'</TD>
	</TR>
	<TR>
	<TD WIDTH="20%" CLASS="bar2">'.LL('crm-extension').'</TD>
	<TD WIDTH="80%" CLASS="bar1">'.ui_textbox('details[ext_con'.$current.']',client_getval($clientid,'ext_con'.$current.''),4).'</TD>
	</TR>';
	print showcustomfields('contacts',$current);
	print '
	</TABLE>
	</td>';
	if ($i % 2 == 0) {
		echo '</tr><tr>';
	}
}
echo '</td></tr></table><table><tr><td>';
if($clientid != 0){
	print getbutton('add-contact',$PHP_SELF.'?action=contact_add&clientid='.$clientid.'&conid='.($max+1).'#conid'.($current-1));
}
print '</td></tr></table>';

?>
Return current item: Bcom