First shot at an actual working form to enter contact information. It only handles phone numbers at the moment, and it does NOT handle existing ones. It's a decent start though, and worth checking in. Next I'll have to handle existing phone numbers, and then addresses and emails. Of course, after that, I'll have to actually save everything to the database.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@209 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-05 15:01:18 +00:00
parent dea1454dcd
commit dc850f4e8e
6 changed files with 245 additions and 147 deletions

View File

@@ -50,17 +50,20 @@ class FormatHelper extends AppHelper {
return self::$time->nice($datetime);
}
function phone($phone) {
function phone($phone, $ext = null) {
if (!isset($phone))
return null;
$phone = preg_replace("/\D/", "", $phone);
if(strlen($phone) == 7)
return preg_replace("/(\d{3})(\d{4})/", "$1-$2", $phone);
$phone = preg_replace("/(\d{3})(\d{4})/", "$1-$2", $phone);
elseif(strlen($phone) == 10)
return preg_replace("/(\d{3})(\d{3})(\d{4})/", "$1-$2-$3", $phone);
else
return $phone;
$phone = preg_replace("/(\d{3})(\d{3})(\d{4})/", "$1-$2-$3", $phone);
if ($ext)
$phone .= ' x' . $ext;
return $phone;
}
function comment($comment) {