Correct return of company fields.

This commit is contained in:
Miles Lott 2001-01-22 12:58:57 +00:00
parent 36acf4e5c6
commit 330fea80a4
3 changed files with 39 additions and 26 deletions

View File

@ -15,13 +15,13 @@
class addressbook_
{
var $id;
var $company;
var $owner;
var $access;
var $firstname;
var $lastname;
var $email;
var $wphone;
var $hphone;
var $company;
var $fax;
var $pager;
var $mphone;
@ -31,9 +31,11 @@
var $state;
var $zip;
var $bday;
var $company;
var $company_id;
var $url;
var $notes;
var $access;
var $searchreturn;
var $search_filter;
var $lang_showing;
@ -65,8 +67,11 @@
$this->state = stripslashes($phpgw->db->f("ab_state"));
$this->zip = stripslashes($phpgw->db->f("ab_zip"));
$this->bday = stripslashes($phpgw->db->f("ab_bday"));
$this->company = stripslashes($phpgw->db->f("ab_company"));
$this->company_id = stripslashes($phpgw->db->f("ab_company_id"));
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$this->company = stripslashes($phpgw->db->f("ab_company_id"));
} else {
$this->company = stripslashes($phpgw->db->f("ab_company"));
}
$this->notes = stripslashes($phpgw->db->f("ab_notes"));
$this->url = stripslashes($phpgw->db->f("ab_url"));
$this->access = stripslashes($phpgw->db->f("ab_access"));
@ -321,7 +326,7 @@
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$phpgw->db->query("SELECT a.ab_id,a.ab_owner,a.ab_firstname,a.ab_lastname,"
. "a.ab_email,a.ab_wphone,c.company_name "
. "from addressbook as a, customers as c where a.ab_company_id = c.company_id OR a.ab_company_id = '' OR a.ab_company_id = '0' "
. "from addressbook as a, customers as c where a.ab_company_id = c.company_id "
. "AND $filtermethod $ordermethod limit $limit",__LINE__,__FILE__);
} else {
$phpgw->db->query("SELECT * from addressbook WHERE $filtermethod $ordermethod limit $limit",__LINE__,__FILE__);
@ -350,9 +355,9 @@
$this->zip[$i] = htmlentities(stripslashes($phpgw->db->f("ab_zip")));
$this->bday[$i] = htmlentities(stripslashes($phpgw->db->f("ab_bday")));
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$this->company[$i] = htmlentities(stripslashes($phpgw->db->f("ab_company")));
} else {
$this->company[$i] = htmlentities(stripslashes($phpgw->db->f("company_name")));
} else {
$this->company[$i] = htmlentities(stripslashes($phpgw->db->f("ab_company")));
}
$this->company_id[$i] = htmlentities(stripslashes($phpgw->db->f("ab_company_id")));
$this->notes[$i] = htmlentities(stripslashes($phpgw->db->f("ab_notes")));

View File

@ -15,13 +15,13 @@
class addressbook_
{
var $id;
var $company;
var $owner;
var $access;
var $firstname;
var $lastname;
var $email;
var $wphone;
var $hphone;
var $company;
var $fax;
var $pager;
var $mphone;
@ -31,9 +31,11 @@
var $state;
var $zip;
var $bday;
var $company;
var $company_id;
var $url;
var $notes;
var $access;
var $searchreturn;
var $search_filter;
var $lang_showing;
@ -65,8 +67,11 @@
$this->state = stripslashes($phpgw->db->f("ab_state"));
$this->zip = stripslashes($phpgw->db->f("ab_zip"));
$this->bday = stripslashes($phpgw->db->f("ab_bday"));
$this->company = stripslashes($phpgw->db->f("ab_company"));
$this->company_id = stripslashes($phpgw->db->f("ab_company_id"));
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$this->company = stripslashes($phpgw->db->f("ab_company_id"));
} else {
$this->company = stripslashes($phpgw->db->f("ab_company"));
}
$this->notes = stripslashes($phpgw->db->f("ab_notes"));
$this->url = stripslashes($phpgw->db->f("ab_url"));
$this->access = stripslashes($phpgw->db->f("ab_access"));
@ -321,7 +326,7 @@
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$phpgw->db->query("SELECT a.ab_id,a.ab_owner,a.ab_firstname,a.ab_lastname,"
. "a.ab_email,a.ab_wphone,c.company_name "
. "from addressbook as a, customers as c where a.ab_company_id = c.company_id OR a.ab_company_id = '' OR a.ab_company_id = '0' "
. "from addressbook as a, customers as c where a.ab_company_id = c.company_id "
. "AND $filtermethod $ordermethod limit $limit",__LINE__,__FILE__);
} else {
$phpgw->db->query("SELECT * from addressbook WHERE $filtermethod $ordermethod limit $limit",__LINE__,__FILE__);
@ -350,9 +355,9 @@
$this->zip[$i] = htmlentities(stripslashes($phpgw->db->f("ab_zip")));
$this->bday[$i] = htmlentities(stripslashes($phpgw->db->f("ab_bday")));
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$this->company[$i] = htmlentities(stripslashes($phpgw->db->f("ab_company")));
} else {
$this->company[$i] = htmlentities(stripslashes($phpgw->db->f("company_name")));
} else {
$this->company[$i] = htmlentities(stripslashes($phpgw->db->f("ab_company")));
}
$this->company_id[$i] = htmlentities(stripslashes($phpgw->db->f("ab_company_id")));
$this->notes[$i] = htmlentities(stripslashes($phpgw->db->f("ab_notes")));

View File

@ -61,11 +61,10 @@
$access = $fields->access;
$ab_company = $fields->company;
$company_id = $fields->company_id;
$company_name = $fields->company_name;
$company_name = $fields->company;
$url = $fields->url;
if ($format != "view") {
$encurl = ($url);
$email = "<input name=\"email\" value=\"$email\">";
$firstname = "<input name=\"firstname\" value=\"$firstname\">";
$lastname = "<input name=\"lastname\" value=\"$lastname\">";
@ -81,20 +80,24 @@
$city = "<input name=\"city\" value=\"$city\">";
$state = "<input name=\"state\" value=\"$state\">";
$zip = "<input name=\"zip\" value=\"$zip\">";
// $url = "<input name=\"url\" value=\"$encurl\">";
if($phpgw_info["apps"]["timetrack"]["enabled"]) {
$company = '<select name="company">';
$company = '<select name="company">';
if (!$ab_company) {
$company .= '<option value="0" SELECTED>'. lang("none").'</option>';
} else {
$company .= '<option value="0">'. lang("none").'</option>';
}
$phpgw->db->query("select company_id,company_name from customers order by company_name");
while ($phpgw->db->next_record()) {
$ncust = $phpgw->db->f("company_id");
$company = $company . '<option value="' . $ncust . '"';
$company .= '<option value="' . $ncust . '"';
if ( $company_id == $ncust ) {
$company = $company . " selected";
$company .= " selected";
}
$company = $company . ">" . $phpgw->db->f("company_name") . "</option>";
}
$company = $company . "</select>";
$company .= ">" . $phpgw->db->f("company_name") . "</option>";
}
$company .= "</select>";
} else {
$company = "<input name=\"company\" value=\"$ab_company\">";
}