Started converting fields names to work with Oracle

This commit is contained in:
jengo 2000-09-18 20:00:25 +00:00
parent fcee44d929
commit 8d4a0aded9
7 changed files with 166 additions and 171 deletions

View File

@ -33,9 +33,9 @@
$access = $phpgw->accounts->array_to_string($access,$n_groups); $access = $phpgw->accounts->array_to_string($access,$n_groups);
$sql = "insert into addressbook (owner,access,firstname,lastname,email," $sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_email,"
. "hphone,wphone,fax,pager,mphone,ophone,street,city,state,zip,bday," . "ab_hphone,ab_wphone,ab_fax,ab_pager,ab_mphone,ab_ophone,ab_street,ab_city,ab_state,ab_zip,ab_bday,"
. "notes,company) values ('" . $phpgw_info["user"]["userid"] . "','$access','" . "ab_notes,ab_company) values ('" . $phpgw_info["user"]["userid"] . "','$access','"
. addslashes($firstname). "','" . addslashes($firstname). "','"
. addslashes($lastname) . "','" . addslashes($lastname) . "','"
. addslashes($email) . "','" . addslashes($email) . "','"

View File

@ -12,45 +12,44 @@
/* $Id$ */ /* $Id$ */
if ($submit) { if ($submit || ! $ab_id) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
$phpgw_info["flags"]["currentapp"] = "addressbook"; $phpgw_info["flags"]["currentapp"] = "addressbook";
include("../header.inc.php"); include("../header.inc.php");
if (! $con) { if (! $ab_id) {
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/", Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/",
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query")); "cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
exit; exit;
} }
if (! $submit) { if (! $submit) {
$phpgw->db->query("SELECT * FROM addressbook WHERE owner='" $phpgw->db->query("SELECT * FROM addressbook WHERE ab_owner='"
. $phpgw_info["user"]["userid"] . "' AND con='$con'"); . $phpgw_info["user"]["userid"] . "' AND ab_id='$ab_id'");
$phpgw->db->next_record(); $phpgw->db->next_record();
$fields = array( $fields = array('ab_id' => $phpgw->db->f("ab_id"),
'con' => $phpgw->db->f("con"), 'owner' => $phpgw->db->f("ab_owner"),
'owner' => $phpgw->db->f("owner"), 'access' => $phpgw->db->f("ab_access"),
'access' => $phpgw->db->f("access"), 'firstname' => $phpgw->db->f("ab_firstname"),
'firstname' => $phpgw->db->f("firstname"), 'lastname' => $phpgw->db->f("ab_lastname"),
'lastname' => $phpgw->db->f("lastname"), 'email' => $phpgw->db->f("ab_email"),
'email' => $phpgw->db->f("email"), 'hphone' => $phpgw->db->f("ab_hphone"),
'hphone' => $phpgw->db->f("hphone"), 'wphone' => $phpgw->db->f("ab_wphone"),
'wphone' => $phpgw->db->f("wphone"), 'fax' => $phpgw->db->f("ab_fax"),
'fax' => $phpgw->db->f("fax"), 'pager' => $phpgw->db->f("ab_pager"),
'pager' => $phpgw->db->f("pager"), 'mphone' => $phpgw->db->f("ab_mphone"),
'mphone' => $phpgw->db->f("mphone"), 'ophone' => $phpgw->db->f("ab_ophone"),
'ophone' => $phpgw->db->f("ophone"), 'street' => $phpgw->db->f("ab_street"),
'street' => $phpgw->db->f("street"), 'city' => $phpgw->db->f("ab_city"),
'city' => $phpgw->db->f("city"), 'state' => $phpgw->db->f("ab_state"),
'state' => $phpgw->db->f("state"), 'zip' => $phpgw->db->f("ab_zip"),
'zip' => $phpgw->db->f("zip"), 'bday' => $phpgw->db->f("ab_bday"),
'bday' => $phpgw->db->f("bday"), 'company' => $phpgw->db->f("ab_company"),
'notes' => $phpgw->db->f("notes"), 'notes' => $phpgw->db->f("ab_notes")
'company' => $phpgw->db->f("company") );
);
form("","edit.php","Edit",$fields); form("","edit.php","Edit",$fields);
@ -58,29 +57,29 @@
$bday = $bday_month . "/" . $bday_day . "/" . $bday_year; $bday = $bday_month . "/" . $bday_day . "/" . $bday_year;
$access = $phpgw->accounts->array_to_string($access,$n_groups); $access = $phpgw->accounts->array_to_string($access,$n_groups);
$sql = "UPDATE addressbook set email='" . addslashes($email) $sql = "UPDATE addressbook set ab_email='" . addslashes($email)
. "', firstname='" . addslashes($firstname) . "', ab_firstname='". addslashes($firstname)
. "', lastname='" . addslashes($lastname) . "', ab_lastname='" . addslashes($lastname)
. "', hphone='" . addslashes($hphone) . "', ab_hphone='" . addslashes($hphone)
. "', wphone='" . addslashes($wphone) . "', ab_wphone='" . addslashes($wphone)
. "', fax='" . addslashes($fax) . "', ab_fax='" . addslashes($fax)
. "', pager='" . addslashes($pager) . "', ab_pager='" . addslashes($pager)
. "', mphone='" . addslashes($mphone) . "', ab_mphone='" . addslashes($mphone)
. "', ophone='" . addslashes($ophone) . "', ab_ophone='" . addslashes($ophone)
. "', street='" . addslashes($street) . "', ab_street='" . addslashes($street)
. "', city='" . addslashes($city) . "', ab_city='" . addslashes($city)
. "', state='" . addslashes($state) . "', ab_state='" . addslashes($state)
. "', zip='" . addslashes($zip) . "', ab_zip='" . addslashes($zip)
. "', bday='" . addslashes($bday) . "', ab_bday='" . addslashes($bday)
. "', notes='" . addslashes($notes) . "', ab_notes='" . addslashes($notes)
. "', company='" . addslashes($company) . "', ab_company='" . addslashes($company)
. "', access='" . addslashes($access) . "', ab_access='" . addslashes($access)
. "' WHERE owner='" . $phpgw_info["user"]["userid"] . "' AND con='$con'"; . "' WHERE ab_owner='" . $phpgw_info["user"]["userid"] . "' AND ab_id='$ab_id'";
$phpgw->db->query($sql); $phpgw->db->query($sql);
Header("Location: " . $phpgw->link("view.php","&con=$con&order=$order&sort=$sort&filter=" Header("Location: " . $phpgw->link("view.php","&con=$con&order=$order&sort=$sort&filter="
. "$filter&start=$start")); . "$filter&start=$start"));
exit; exit;
} }

View File

@ -26,7 +26,7 @@
if ($order) if ($order)
$ordermethod = "order by $order $sort"; $ordermethod = "order by $order $sort";
else else
$ordermethod = "order by lastname,firstname,email asc"; $ordermethod = "order by ab_lastname,ab_firstname,ab_email asc";
if (! $filter) { if (! $filter) {
$filter = "none"; $filter = "none";
@ -34,21 +34,21 @@
if ($filter != "private") { if ($filter != "private") {
if ($filter != "none") { if ($filter != "none") {
$filtermethod = " access like '%,$filter,%' "; $filtermethod = " ab_access like '%,$filter,%' ";
} else { } else {
$filtermethod = " (owner='" . $phpgw_info["user"]["userid"] ."' OR access='public' " $filtermethod = " (ab_owner='" . $phpgw_info["user"]["userid"] ."' OR ab_access='public' "
. $phpgw->accounts->sql_search("access") . " ) "; . $phpgw->accounts->sql_search("ab_access") . " ) ";
} }
} else { } else {
$filtermethod = " owner='" . $phpgw_info["user"]["userid"] . "' "; $filtermethod = " ab_owner='" . $phpgw_info["user"]["userid"] . "' ";
} }
if ($query) { if ($query) {
$phpgw->db->query("select count(*) from addressbook where $filtermethod AND (lastname " $phpgw->db->query("select count(*) from addressbook where $filtermethod AND (ab_lastname "
. "like '%$query%' OR firstname like '%$query%' OR email like '%$query%" . "like '%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%"
. "' OR street like '%$query%' OR city like '%$query%' OR state like '" . "' OR ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state like '"
. "%$query%' OR zip like '%$query%' OR notes like '%$query%' OR company" . "%$query%' OR ab_zip like '%$query%' OR ab_notes like '%$query%' OR ab_company"
. " like '%$query%')"); . " like '%$query%')");
$phpgw->db->next_record(); $phpgw->db->next_record();
@ -70,9 +70,8 @@
?> ?>
<?php <?php
$phpgw->nextmatchs->show("index.php",$start,$phpgw->db->f(0), $phpgw->nextmatchs->show("index.php",$start,$phpgw->db->f(0),"&order=$order&filter=$filter&sort="
"&order=$order&filter=$filter&sort=" . "$sort&query=$query", "75%", $phpgw_info["theme"][th_bg]);
. "$sort&query=$query", "75%", $phpgw_info["theme"][th_bg]);
?> ?>
<table width=75% border=0 cellspacing=1 cellpadding=3> <table width=75% border=0 cellspacing=1 cellpadding=3>
@ -81,35 +80,34 @@
if ( $phpgw_info["user"]["preferences"]["addressbook_view_company"] == "True" ) { if ( $phpgw_info["user"]["preferences"]["addressbook_view_company"] == "True" ) {
echo '<td height="21">'; echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">'; echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"company",$order,"index.php", echo $phpgw->nextmatchs->show_sort_order($sort,"ab_company",$order,"index.php",lang("Company Name"));
lang("Company Name"));
echo '</font></td>'; echo '</font></td>';
} }
if ( $phpgw_info["user"]["preferences"]["addressbook_view_lastname"] == "True" ) { if ( $phpgw_info["user"]["preferences"]["addressbook_view_lastname"] == "True" ) {
echo '<td height="21">'; echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">'; echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"lastname",$order,"index.php", echo $phpgw->nextmatchs->show_sort_order($sort,"ab_lastname",$order,"index.php",
lang("Last Name")); lang("Last Name"));
echo '</font></td>'; echo '</font></td>';
} }
if ( $phpgw_info["user"]["preferences"]["addressbook_view_firstname"] == "True" ) { if ( $phpgw_info["user"]["preferences"]["addressbook_view_firstname"] == "True" ) {
echo '<td height="21">'; echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">'; echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"firstname",$order,"index.php", echo $phpgw->nextmatchs->show_sort_order($sort,"ab_firstname",$order,"index.php",
lang("First Name")); lang("First Name"));
echo '</font></td>'; echo '</font></td>';
} }
if ( $phpgw_info["user"]["preferences"]["addressbook_view_email"] == "True" ) { if ( $phpgw_info["user"]["preferences"]["addressbook_view_email"] == "True" ) {
echo '<td height="21">'; echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">'; echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"email",$order,"index.php", echo $phpgw->nextmatchs->show_sort_order($sort,"ab_email",$order,"index.php",
lang("Email")); lang("Email"));
echo '</font></td>'; echo '</font></td>';
} }
if ( $phpgw_info["user"]["preferences"]["addressbook_view_wphone"] == "True" ) { if ( $phpgw_info["user"]["preferences"]["addressbook_view_wphone"] == "True" ) {
echo '<td height="21">'; echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">'; echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"wphone",$order,"index.php", echo $phpgw->nextmatchs->show_sort_order($sort,"ab_wphone",$order,"index.php",
lang("Work Phone")); lang("Work Phone"));
echo '</font></td>'; echo '</font></td>';
} }
@ -131,25 +129,24 @@
<?php <?php
if ($query) { if ($query) {
$phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod AND (lastname like '" $phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod AND (ab_lastname like '"
. "%$query%' OR firstname like '%$query%' OR email like '%$query%' OR " . "%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%' OR "
. "street like '%$query%' OR city like '%$query%' OR state " . "ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state "
. "like '%$query%' OR zip like '%$query%' OR notes like " . "like '%$query%' OR ab_zip like '%$query%' OR ab_notes like "
. "'%$query%' OR company like %$query%') $ordermethod limit $limit"); . "'%$query%' OR ab_company like %$query%') $ordermethod limit $limit");
} else { } else {
$phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod $ordermethod limit " $phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod $ordermethod limit $limit");
. $limit);
} }
while ($phpgw->db->next_record()) { while ($phpgw->db->next_record()) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$firstname = $phpgw->db->f("firstname"); $firstname = $phpgw->db->f("ab_firstname");
$lastname = $phpgw->db->f("lastname"); $lastname = $phpgw->db->f("ab_lastname");
$email = $phpgw->db->f("email"); $email = $phpgw->db->f("ab_email");
$company = $phpgw->db->f("company"); $company = $phpgw->db->f("ab_company");
$wphone = $phpgw->db->f("wphone"); $wphone = $phpgw->db->f("ab_wphone");
$con = $phpgw->db->f("con"); $ab_id = $phpgw->db->f("ab_id");
if($firstname == "") $firstname = "&nbsp;"; if($firstname == "") $firstname = "&nbsp;";
if($lastname == "") $lastname = "&nbsp;"; if($lastname == "") $lastname = "&nbsp;";
@ -193,14 +190,14 @@
?> ?>
<td valign=top width=3%> <td valign=top width=3%>
<font face=Arial, Helvetica, sans-serif size=2> <font face=Arial, Helvetica, sans-serif size=2>
<a href="<?php echo $phpgw->link("view.php","con=$con&start=$start&order=$order&filter=" <a href="<?php echo $phpgw->link("view.php","ab_id=$ab_id&start=$start&order=$order&filter="
. "$filter&query=$query&sort=$sort"); . "$filter&query=$query&sort=$sort");
?>"> <?php echo lang("View"); ?> </a> ?>"> <?php echo lang("View"); ?> </a>
</font> </font>
</td> </td>
<td valign=top width=5%> <td valign=top width=5%>
<font face=Arial, Helvetica, sans-serif size=2> <font face=Arial, Helvetica, sans-serif size=2>
<?php echo $phpgw->common->check_owner($phpgw->db->f("owner"),"edit.php",lang("edit"),"con=" . $phpgw->db->f("con")); ?> <?php echo $phpgw->common->check_owner($phpgw->db->f("ab_owner"),"edit.php",lang("edit"),"ab_id=" . $phpgw->db->f("ab_id")); ?>
</font> </font>
</td> </td>
</tr> </tr>

View File

@ -12,47 +12,47 @@
/* $Id$ */ /* $Id$ */
if ($submit) { if ($submit || ! $ab_id) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
$phpgw_info["flags"]["currentapp"] = "addressbook"; $phpgw_info["flags"]["currentapp"] = "addressbook";
include("../header.inc.php"); include("../header.inc.php");
if (! $con)
Header("Location: " . $phpgw_info["server"]["webserver_url"] . if (! $ab_id) {
"/addressbook/?sessionid=" . $phpgw_info["user"]["sessionid"]); Header("Location: " . $phpgw->link("index.php"));
}
if ($filter != "private") if ($filter != "private")
$filtermethod = " or access='public' " . $phpgw->accounts->sql_search("access"); $filtermethod = " or ab_access='public' " . $phpgw->accounts->sql_search("ab_access");
$phpgw->db->query("SELECT * FROM addressbook WHERE con='$con' AND (owner='" $phpgw->db->query("SELECT * FROM addressbook WHERE ab_id='$ab_id' AND (ab_owner='"
. $phpgw_info["user"]["userid"] . "' $filtermethod)"); . $phpgw_info["user"]["userid"] . "' $filtermethod)");
$phpgw->db->next_record(); $phpgw->db->next_record();
$fields = array( $fields = array('ab_id' => $phpgw->db->f("ab_id"),
'con' => $phpgw->db->f("con"), 'owner' => $phpgw->db->f("ab_owner"),
'owner' => $phpgw->db->f("owner"), 'access' => $phpgw->db->f("ab_access"),
'access' => $phpgw->db->f("access"), 'firstname' => $phpgw->db->f("ab_firstname"),
'firstname' => $phpgw->db->f("firstname"), 'lastname' => $phpgw->db->f("ab_lastname"),
'lastname' => $phpgw->db->f("lastname"), 'email' => $phpgw->db->f("ab_email"),
'email' => $phpgw->db->f("email"), 'hphone' => $phpgw->db->f("ab_hphone"),
'hphone' => $phpgw->db->f("hphone"), 'wphone' => $phpgw->db->f("ab_wphone"),
'wphone' => $phpgw->db->f("wphone"), 'fax' => $phpgw->db->f("ab_fax"),
'fax' => $phpgw->db->f("fax"), 'pager' => $phpgw->db->f("ab_pager"),
'pager' => $phpgw->db->f("pager"), 'mphone' => $phpgw->db->f("ab_mphone"),
'mphone' => $phpgw->db->f("mphone"), 'ophone' => $phpgw->db->f("ab_ophone"),
'ophone' => $phpgw->db->f("ophone"), 'street' => $phpgw->db->f("ab_street"),
'street' => $phpgw->db->f("street"), 'city' => $phpgw->db->f("ab_city"),
'city' => $phpgw->db->f("city"), 'state' => $phpgw->db->f("ab_state"),
'state' => $phpgw->db->f("state"), 'zip' => $phpgw->db->f("ab_zip"),
'zip' => $phpgw->db->f("zip"), 'bday' => $phpgw->db->f("ab_bday"),
'bday' => $phpgw->db->f("bday"), 'company' => $phpgw->db->f("ab_company"),
'company' => $phpgw->db->f("company"), 'notes' => $phpgw->db->f("ab_notes")
'notes' => $phpgw->db->f("notes") );
);
$owner = $phpgw->db->f("owner"); $owner = $phpgw->db->f("ab_owner");
$con = $phpgw->db->f("con"); $ab_id = $phpgw->db->f("ab_id");
form("view","","View",$fields); form("view","","View",$fields);
?> ?>
@ -65,7 +65,7 @@
<TR> <TR>
<TD align=left> <TD align=left>
<?php <?php
echo $phpgw->common->check_owner($con,$owner,"Edit"); echo $phpgw->common->check_owner($ab_id,$owner,"Edit");
?> ?>
</TD> </TD>
<TD align=left> <TD align=left>
@ -79,5 +79,4 @@
</TBODY> </TBODY>
</TABLE> </TABLE>
</DIV> </DIV>
<?php <?php include($phpgw_info["server"]["api_dir"] . "/footer.inc.php"); ?>
//include($directorys["include_root"] . "/footer.inc.php");

View File

@ -97,26 +97,26 @@ CREATE TABLE profiles (
); );
CREATE TABLE addressbook ( CREATE TABLE addressbook (
con int(11) DEFAULT '0' NOT NULL auto_increment, ab_id int(11) DEFAULT '0' NOT NULL auto_increment,
owner varchar(25), ab_owner varchar(25),
access varchar(10), ab_access varchar(10),
firstname varchar(255), ab_firstname varchar(255),
lastname varchar(255), ab_lastname varchar(255),
email varchar(255), ab_email varchar(255),
hphone varchar(255), ab_hphone varchar(255),
wphone varchar(255), ab_wphone varchar(255),
fax varchar(255), ab_fax varchar(255),
pager varchar(255), ab_pager varchar(255),
mphone varchar(255), ab_mphone varchar(255),
ophone varchar(255), ab_ophone varchar(255),
street varchar(255), ab_street varchar(255),
city varchar(255), ab_city varchar(255),
state varchar(255), ab_state varchar(255),
zip varchar(255), ab_zip varchar(255),
bday varchar(255), ab_bday varchar(255),
notes text, ab_notes text,
company varchar(255), ab_company varchar(255),
PRIMARY KEY (con) PRIMARY KEY (ab_id)
); );
CREATE TABLE todo ( CREATE TABLE todo (

View File

@ -209,26 +209,26 @@ end;
----------------- -----------------
CREATE TABLE addressbook ( CREATE TABLE addressbook (
con number(11) DEFAULT '0' NOT NULL , --auto-increment ab_id number(11) DEFAULT '0' NOT NULL , --auto-increment
owner varchar2(25), ab_owner varchar2(25),
addr_access varchar2(10), ab_addr_access varchar2(10),
firstname varchar2(255), ab_firstname varchar2(255),
lastname varchar2(255), ab_lastname varchar2(255),
email varchar2(255), ab_email varchar2(255),
hphone varchar2(255), ab_hphone varchar2(255),
wphone varchar2(255), ab_wphone varchar2(255),
fax varchar2(255), ab_fax varchar2(255),
pager varchar2(255), ab_pager varchar2(255),
mphone varchar2(255), ab_mphone varchar2(255),
ophone varchar2(255), ab_ophone varchar2(255),
street varchar2(255), ab_street varchar2(255),
city varchar2(255), ab_city varchar2(255),
state varchar2(255), ab_state varchar2(255),
zip varchar2(255), ab_zip varchar2(255),
bday varchar2(255), ab_bday varchar2(255),
notes varchar2(4000), ab_notes varchar2(4000),
company varchar2(255), ab_company varchar2(255),
PRIMARY KEY (con) PRIMARY KEY (ab_id)
); );
create sequence addressbook_seq create sequence addressbook_seq

View File

@ -94,24 +94,24 @@ CREATE TABLE profiles (
); );
create table addressbook ( create table addressbook (
con serial, ab_id serial,
owner varchar(25), ab_owner varchar(25),
access varchar(10), ab_access varchar(10),
firstname varchar(255), ab_firstname varchar(255),
lastname varchar(255), ab_lastname varchar(255),
email varchar(255), ab_email varchar(255),
hphone varchar(255), ab_hphone varchar(255),
wphone varchar(255), ab_wphone varchar(255),
fax varchar(255), ab_fax varchar(255),
pager varchar(255), ab_pager varchar(255),
mphone varchar(255), ab_mphone varchar(255),
ophone varchar(255), ab_ophone varchar(255),
street varchar(255), ab_street varchar(255),
city varchar(255), ab_city varchar(255),
state varchar(255), ab_state varchar(255),
zip varchar(255), ab_zip varchar(255),
bday varchar(255), ab_bday varchar(255),
notes TEXT, ab_notes TEXT,
company varchar(255) company varchar(255)
); );