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

View File

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

View File

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