Finished implementation of contact edit. This is now saving everything to the database. I hope to now leverage it for a new contact. This checkin includes a bit of code in the sitelink2pmgr script that sets the customer display name. It should have been checked in several revisions ago.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@217 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -278,7 +278,7 @@ addRow('contact_addresses',
|
||||
addRow('contacts_methods',
|
||||
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
|
||||
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
|
||||
'method' => 'POST',
|
||||
'method' => 'ADDRESS',
|
||||
'type' => 'MAIN',
|
||||
'preference' => 'PRIMARY' },
|
||||
1);
|
||||
@@ -292,7 +292,7 @@ addRow('contact_addresses',
|
||||
addRow('contacts_methods',
|
||||
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
|
||||
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
|
||||
'method' => 'POST',
|
||||
'method' => 'ADDRESS',
|
||||
'type' => 'HOME',
|
||||
'preference' => 'ALTERNATE' },
|
||||
1);
|
||||
@@ -306,7 +306,7 @@ addRow('contact_addresses',
|
||||
addRow('contacts_methods',
|
||||
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
|
||||
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
|
||||
'method' => 'POST',
|
||||
'method' => 'ADDRESS',
|
||||
'type' => 'HOME',
|
||||
'preference' => 'ALTERNATE' },
|
||||
1);
|
||||
@@ -757,7 +757,7 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
addRow('contacts_methods',
|
||||
{ 'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
|
||||
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
|
||||
'method' => 'POST',
|
||||
'method' => 'ADDRESS',
|
||||
'type' => 'HOME',
|
||||
'preference' => 'PRIMARY' },
|
||||
1);
|
||||
@@ -823,7 +823,7 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
addRow('contacts_methods',
|
||||
{ 'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'alt'},
|
||||
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
|
||||
'method' => 'POST',
|
||||
'method' => 'ADDRESS',
|
||||
'type' => 'MAIN',
|
||||
'preference' => 'PRIMARY' },
|
||||
1);
|
||||
@@ -1536,6 +1536,8 @@ buildTables();
|
||||
######################################################################
|
||||
## Security Deposits
|
||||
|
||||
print(STDERR "Set Lease Security Deposits...\n");
|
||||
|
||||
$query = "SELECT L.LedgerID, L.UnitID, C.ChargeAmount FROM TenantLedger L INNER JOIN Charges C ON C.LedgerID = L.LedgerID WHERE L.UnitID <> 'POS\$' AND C.ChargeDescription = 'Security Deposit' ORDER BY UnitID";
|
||||
|
||||
foreach $row (@{query($sdbh, $query)}) {
|
||||
@@ -1547,16 +1549,23 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## Ledger Assignments
|
||||
## Contact Display Names
|
||||
|
||||
# $query =
|
||||
# "UPDATE pmgr_accounts A, pmgr_ledgers L SET A.ledger_id = L.id" .
|
||||
# " WHERE A.id = L.account_id";
|
||||
# query($db_handle, $query);
|
||||
print(STDERR "Set Contact Display Names...\n");
|
||||
|
||||
$query =
|
||||
"UPDATE pmgr_contacts".
|
||||
" SET display_name =" .
|
||||
" IF(first_name IS NOT NULL AND last_name IS NOT NULL," .
|
||||
" CONCAT(last_name, ', ', first_name)," .
|
||||
" IF(first_name IS NOT NULL, first_name, last_name))";
|
||||
query($db_handle, $query);
|
||||
|
||||
######################################################################
|
||||
## Unit Lease Assignments
|
||||
|
||||
print(STDERR "Set Current Leases...\n");
|
||||
|
||||
$query = "UPDATE pmgr_units U, pmgr_leases L
|
||||
SET U.`current_lease_id` = L.id
|
||||
WHERE L.unit_id = U.id AND L.close_date IS NULL";
|
||||
|
||||
Reference in New Issue
Block a user