Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions db/cats_schema.sql

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions js/addressParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function AddressParser_parse(editBoxID, mode, indicatorID, arrowButtonID)
var lastNameField = document.getElementById('lastName');
var nameField = document.getElementById('name');
var addressField = document.getElementById('address');
var address2Field = document.getElementById('address2');
var phoneHomeField = document.getElementById('phoneHome');
var phoneCellField = document.getElementById('phoneCell');
var phoneWorkField = document.getElementById('phoneWork');
Expand Down Expand Up @@ -99,6 +100,7 @@ function AddressParser_parse(editBoxID, mode, indicatorID, arrowButtonID)
if (lastNameField) lastNameField.value = '';
if (nameField) nameField.value = '';
if (addressField) addressField.value = '';
if (address2Field) address2Field.value = '';
if (phoneHomeField) phoneHomeField.value = '';
if (phoneCellField) phoneCellField.value = '';
if (phoneWorkField) phoneWorkField.value = '';
Expand Down Expand Up @@ -182,15 +184,27 @@ function AddressParser_parse(editBoxID, mode, indicatorID, arrowButtonID)
if (addressLineOneNode.firstChild)
{
addressField.value = addressLineOneNode.firstChild.nodeValue;

if (addressLineTwoNode.firstChild && addressLineOneNode.firstChild != '')

if (address2Field)
{
if (addressLineTwoNode.firstChild && addressLineOneNode.firstChild != '')
{
address2Field.value = addressLineTwoNode.firstChild.nodeValue;
}
else
{
address2Field.value = '';
}
}
else if (addressLineTwoNode.firstChild && addressLineOneNode.firstChild != '')
{
addressField.value += "\n" + addressLineTwoNode.firstChild.nodeValue;
}
}
else
{
addressField.value = '';
if (address2Field) address2Field.value = '';
}
}

Expand Down
19 changes: 14 additions & 5 deletions lib/Candidates.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public function __construct($siteID)
* @param string Home phone number.
* @param string Mobile phone number.
* @param string Work phone number.
* @param string Address (can be multiple lines).
* @param string Address line 1.
* @param string Address line 2.
* @param string City.
* @param string State / province.
* @param string Postal code.
Expand All @@ -92,7 +93,7 @@ public function __construct($siteID)
* @return integer Candidate ID of new candidate, or -1 on failure.
*/
public function add($firstName, $middleName, $lastName, $email1, $email2,
$phoneHome, $phoneCell, $phoneWork, $address, $city, $state, $zip,
$phoneHome, $phoneCell, $phoneWork, $address, $address2, $city, $state, $zip,
$source, $keySkills, $dateAvailable, $currentEmployer, $canRelocate,
$currentPay, $desiredPay, $notes, $webSite, $bestTimeToCall, $enteredBy, $owner,
$gender = '', $race = '', $veteran = '', $disability = '',
Expand All @@ -109,6 +110,7 @@ public function add($firstName, $middleName, $lastName, $email1, $email2,
phone_cell,
phone_work,
address,
address2,
city,
state,
zip,
Expand Down Expand Up @@ -157,6 +159,7 @@ public function add($firstName, $middleName, $lastName, $email1, $email2,
%s,
%s,
%s,
%s,
0,
%s,
%s,
Expand All @@ -176,6 +179,7 @@ public function add($firstName, $middleName, $lastName, $email1, $email2,
$this->_db->makeQueryString($phoneCell),
$this->_db->makeQueryString($phoneWork),
$this->_db->makeQueryString($address),
$this->_db->makeQueryString($address2),
$this->_db->makeQueryString($city),
$this->_db->makeQueryString($state),
$this->_db->makeQueryString($zip),
Expand Down Expand Up @@ -226,7 +230,8 @@ public function add($firstName, $middleName, $lastName, $email1, $email2,
* @param string Home phone number.
* @param string Mobile phone number.
* @param string Work phone number.
* @param string Address (can be multiple lines).
* @param string Address line 1.
* @param string Address line 2.
* @param string City.
* @param string State / province.
* @param string Postal code.
Expand All @@ -247,7 +252,7 @@ public function add($firstName, $middleName, $lastName, $email1, $email2,
* @return boolean True if successful; false otherwise.
*/
public function update($candidateID, $isActive, $firstName, $middleName, $lastName,
$email1, $email2, $phoneHome, $phoneCell, $phoneWork, $address,
$email1, $email2, $phoneHome, $phoneCell, $phoneWork, $address, $address2,
$city, $state, $zip, $source, $keySkills, $dateAvailable,
$currentEmployer, $canRelocate, $currentPay, $desiredPay,
$notes, $webSite, $bestTimeToCall, $owner, $isHot, $email, $emailAddress,
Expand All @@ -267,6 +272,7 @@ public function update($candidateID, $isActive, $firstName, $middleName, $lastNa
phone_work = %s,
phone_cell = %s,
address = %s,
address2 = %s,
city = %s,
state = %s,
zip = %s,
Expand Down Expand Up @@ -301,6 +307,7 @@ public function update($candidateID, $isActive, $firstName, $middleName, $lastNa
$this->_db->makeQueryString($phoneWork),
$this->_db->makeQueryString($phoneCell),
$this->_db->makeQueryString($address),
$this->_db->makeQueryString($address2),
$this->_db->makeQueryString($city),
$this->_db->makeQueryString($state),
$this->_db->makeQueryString($zip),
Expand Down Expand Up @@ -470,6 +477,7 @@ public function get($candidateID)
candidate.phone_work AS phoneWork,
candidate.phone_cell AS phoneCell,
candidate.address AS address,
candidate.address2 AS address2,
candidate.city AS city,
candidate.state AS state,
candidate.zip AS zip,
Expand Down Expand Up @@ -606,6 +614,7 @@ public function getForEditing($candidateID)
candidate.phone_work AS phoneWork,
candidate.phone_cell AS phoneCell,
candidate.address AS address,
candidate.address2 AS address2,
candidate.city AS city,
candidate.state AS state,
candidate.zip AS zip,
Expand Down Expand Up @@ -1489,7 +1498,7 @@ public function mergeDuplicates($params, $rs)
{
$update .= ", ";
}
$update .= "address = '" . $rs['address'] . "', city = '" . $rs['city'] . "', zip = '" . $rs['zip'] . "', state = '" . $rs['state'] . "'";
$update .= "address = '" . $rs['address'] . "', address2 = '" . $rs['address2'] . "', city = '" . $rs['city'] . "', zip = '" . $rs['zip'] . "', state = '" . $rs['state'] . "'";
$comma = true;
}
if($params['website'] == "1")
Expand Down
15 changes: 11 additions & 4 deletions lib/Companies.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
* Adds a company to the database and returns its company ID.
*
* @param string Name
* @param string Address line
* @param string Address line 1
* @param string Address line 2
* @param string City
* @param string State
* @param string Zip code
Expand All @@ -82,14 +83,15 @@
* @param integer Owner user
* @return new Company ID, or -1 on failure.
*/
public function add($name, $address, $city, $state, $zip, $phone1,
public function add($name, $address, $address2, $city, $state, $zip, $phone1,

Check warning on line 86 in lib/Companies.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/Companies.php#L86

The method add has 15 parameters. Consider reducing the number of parameters to less than 10.
$phone2, $faxNumber, $url, $keyTechnologies, $isHot,
$notes, $enteredBy, $owner)
{
$company= Company::create(
$this->_siteID,
$name,
$address,
$address2,
$city,
$state,
$zip,
Expand Down Expand Up @@ -117,7 +119,8 @@
*
* @param integer Company ID
* @param string Name
* @param string Address line
* @param string Address line 1
* @param string Address line 2
* @param string City
* @param string State
* @param string Zip Code
Expand All @@ -131,7 +134,7 @@
* @param integer Billing contact ID
* @return boolean True if successful; false otherwise.
*/
public function update($companyID, $name, $address, $city, $state,
public function update($companyID, $name, $address, $address2, $city, $state,

Check warning on line 137 in lib/Companies.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/Companies.php#L137

The method update has 18 parameters. Consider reducing the number of parameters to less than 10.
$zip, $phone1, $phone2, $faxNumber, $url,
$keyTechnologies, $isHot, $notes, $owner,
$billingContact, $email, $emailAddress)
Expand All @@ -142,6 +145,7 @@
SET
name = %s,
address = %s,
address2 = %s,
city = %s,
state = %s,
zip = %s,
Expand All @@ -161,6 +165,7 @@
site_id = %s",
$this->_db->makeQueryString($name),
$this->_db->makeQueryString($address),
$this->_db->makeQueryString($address2),
$this->_db->makeQueryString($city),
$this->_db->makeQueryString($state),
$this->_db->makeQueryString($zip),
Expand Down Expand Up @@ -320,6 +325,7 @@
company.name AS name,
company.is_hot AS isHot,
company.address AS address,
company.address2 AS address2,
company.city AS city,
company.state AS state,
company.zip AS zip,
Expand Down Expand Up @@ -379,6 +385,7 @@
company.name AS name,
company.is_hot AS isHot,
company.address AS address,
company.address2 AS address2,
company.city AS city,
company.state AS state,
company.zip AS zip,
Expand Down
24 changes: 18 additions & 6 deletions lib/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public function __construct($siteID)
* @param string work phone number
* @param string cell phone number
* @param string other phone number
* @param string address line
* @param string address line 1
* @param string address line 2
* @param string city
* @param string state
* @param string zip code
Expand All @@ -79,7 +80,7 @@ public function __construct($siteID)
* @return new contact ID, or -1 on failure.
*/
public function add($companyID, $firstName, $lastName, $title, $department,
$reportsTo, $email1, $email2, $phoneWork, $phoneCell, $phoneOther, $address,
$reportsTo, $email1, $email2, $phoneWork, $phoneCell, $phoneOther, $address, $address2,
$city, $state, $zip, $isHot, $notes, $enteredBy, $owner)
{
/* Get the department ID of the selected department. */
Expand All @@ -101,6 +102,7 @@ public function add($companyID, $firstName, $lastName, $title, $department,
phone_cell,
phone_other,
address,
address2,
city,
state,
zip,
Expand Down Expand Up @@ -130,6 +132,7 @@ public function add($companyID, $firstName, $lastName, $title, $department,
%s,
%s,
%s,
%s,
0,
%s,
%s,
Expand All @@ -150,6 +153,7 @@ public function add($companyID, $firstName, $lastName, $title, $department,
$this->_db->makeQueryString($phoneCell),
$this->_db->makeQueryString($phoneOther),
$this->_db->makeQueryString($address),
$this->_db->makeQueryString($address2),
$this->_db->makeQueryString($city),
$this->_db->makeQueryString($state),
$this->_db->makeQueryString($zip),
Expand Down Expand Up @@ -188,7 +192,8 @@ public function add($companyID, $firstName, $lastName, $title, $department,
* @param string work phone number
* @param string cell phone number
* @param string other phone number
* @param string address line
* @param string address line 1
* @param string address line 2
* @param string city
* @param string state
* @param string zip code
Expand All @@ -203,7 +208,7 @@ public function add($companyID, $firstName, $lastName, $title, $department,
*/
public function update($contactID, $companyID, $firstName, $lastName,
$title, $department, $reportsTo, $email1, $email2, $phoneWork, $phoneCell,
$phoneOther, $address, $city, $state, $zip, $isHot,
$phoneOther, $address, $address2, $city, $state, $zip, $isHot,
$leftCompany, $notes, $owner, $email, $emailAddress)
{
/* Get the department ID of the selected department. */
Expand All @@ -227,6 +232,7 @@ public function update($contactID, $companyID, $firstName, $lastName,
contact.phone_cell = %s,
contact.phone_other = %s,
contact.address = %s,
contact.address2 = %s,
contact.city = %s,
contact.state = %s,
contact.zip = %s,
Expand All @@ -251,6 +257,7 @@ public function update($contactID, $companyID, $firstName, $lastName,
$this->_db->makeQueryString($phoneCell),
$this->_db->makeQueryString($phoneOther),
$this->_db->makeQueryString($address),
$this->_db->makeQueryString($address2),
$this->_db->makeQueryString($city),
$this->_db->makeQueryString($state),
$this->_db->makeQueryString($zip),
Expand Down Expand Up @@ -297,20 +304,22 @@ public function update($contactID, $companyID, $firstName, $lastName,
* Updates all contacts for a company (called when changing company details).
*
* @param integer company ID
* @param string address line
* @param string address line 1
* @param string address line 2
* @param string city
* @param string state
* @param string zip code
* @return boolean True if successful; false otherwise.
*/
public function updateByCompany($companyID, $address, $city,
public function updateByCompany($companyID, $address, $address2, $city,
$state, $zip)
{
$sql = sprintf(
"UPDATE
contact
SET
address = %s,
address2 = %s,
city = %s,
state = %s,
zip = %s,
Expand All @@ -322,6 +331,7 @@ public function updateByCompany($companyID, $address, $city,
AND
site_id = %s",
$this->_db->makeQueryString($address),
$this->_db->makeQueryString($address2),
$this->_db->makeQueryString($city),
$this->_db->makeQueryString($state),
$this->_db->makeQueryString($zip),
Expand Down Expand Up @@ -437,6 +447,7 @@ public function get($contactID)
contact.phone_cell AS phoneCell,
contact.phone_other AS phoneOther,
contact.address AS address,
contact.address2 AS address2,
contact.city AS city,
contact.state AS state,
contact.zip AS zip,
Expand Down Expand Up @@ -512,6 +523,7 @@ public function getForEditing($contactID)
contact.phone_cell AS phoneCell,
contact.phone_other AS phoneOther,
contact.address AS address,
contact.address2 AS address2,
contact.city AS city,
contact.state AS state,
contact.zip AS zip,
Expand Down
16 changes: 16 additions & 0 deletions lib/InfoString.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ private static function _contact($contactID, $siteID)
htmlspecialchars($infoRS['address'])
);

if (!empty($infoRS['address2']))
{
$infoString .= sprintf(
'<br />&nbsp;&nbsp;%s',
htmlspecialchars($infoRS['address2'])
);
}

if (!empty($infoRS['city']))
{
$infoString .= sprintf(
Expand Down Expand Up @@ -277,6 +285,14 @@ private static function _candidate($candidateID, $siteID)
htmlspecialchars($infoRS['address'])
);

if (!empty($infoRS['address2']))
{
$infoString .= sprintf(
'<br />&nbsp;&nbsp;%s',
htmlspecialchars($infoRS['address2'])
);
}

if (!empty($infoRS['city']))
{
$infoString .= sprintf(
Expand Down
Loading
Loading