: |
diff --git a/addressbook/index.php b/addressbook/index.php
index c6be5971d1..51939b01eb 100755
--- a/addressbook/index.php
+++ b/addressbook/index.php
@@ -17,6 +17,7 @@
include("../header.inc.php");
echo "" . lang("Address book");
+ //echo " Time track = " . $phpgw_info["apps"]["timetrack"]["enabled"];
if (! $start)
$start = 0;
@@ -44,11 +45,25 @@
}
if ($query) {
- $phpgw->db->query("select count(*) from addressbook where $filtermethod AND (ab_lastname "
- . "like '%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%"
- . "' OR ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state like '"
- . "%$query%' OR ab_zip like '%$query%' OR ab_notes like '%$query%' OR ab_company"
- . " like '%$query%')");
+ if ($phpgw_info["apps"]["timetrack"]["enabled"]){
+ $phpgw->db->query("SELECT count(*) "
+ . "from addressbook as a, customers as c where a.ab_company_id = c.company_id "
+ . "AND $filtermethod AND (a.ab_lastname like '"
+ . "%$query%' OR a.ab_firstname like '%$query%' OR a.ab_email like '%$query%' OR "
+ . "a.ab_street like '%$query%' OR a.ab_city like '%$query%' OR a.ab_state "
+ . "like '%$query%' OR a.ab_zip like '%$query%' OR a.ab_notes like "
+ . "'%$query%' OR c.company_name like '%$query%')"
+ . " $ordermethod limit $limit");
+ } else {
+ $phpgw->db->query("SELECT count(*) "
+ . "from addressbook "
+ . "WHERE $filtermethod AND (ab_lastname like '"
+ . "%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%' OR "
+ . "ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state "
+ . "like '%$query%' OR ab_zip like '%$query%' OR ab_notes like "
+ . "'%$query%' OR ab_company like '%$query%')"
+ . " $ordermethod limit $limit");
+ }
$phpgw->db->next_record();
@@ -58,9 +73,14 @@
echo " " . lang("your search returned x matchs",$phpgw->db->f(0));
} else {
$phpgw->db->query("select count(*) from addressbook where $filtermethod");
+ $phpgw->db->next_record();
}
+ if($phpgw_info["apps"]["timetrack"]["enabled"])
+ $company_sortorder = "c.company_name";
+ else
+ $company_sortorder = "ab_company";
- $phpgw->db->next_record();
+ //$phpgw->db->next_record();
if ($phpgw->db->f(0) > $phpgw_info["user"]["preferences"]["maxmatchs"])
echo " " . lang("showing x - x of x",($start + 1),
@@ -80,7 +100,7 @@
if ( $phpgw_info["user"]["preferences"]["addressbook_view_company"] == "True" ) {
echo '';
echo '';
- echo $phpgw->nextmatchs->show_sort_order($sort,"ab_company",$order,"index.php",lang("Company Name"));
+ echo $phpgw->nextmatchs->show_sort_order($sort,$company_sortorder,$order,"index.php",lang("Company Name"));
echo ' | ';
}
if ( $phpgw_info["user"]["preferences"]["addressbook_view_lastname"] == "True" ) {
@@ -129,13 +149,37 @@
db->query("SELECT * FROM addressbook WHERE $filtermethod AND (ab_lastname like '"
- . "%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%' OR "
- . "ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state "
- . "like '%$query%' OR ab_zip like '%$query%' OR ab_notes like "
- . "'%$query%' OR ab_company like '%$query%') $ordermethod limit $limit");
+ 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 "
+ . "AND $filtermethod AND (a.ab_lastname like '"
+ . "%$query%' OR a.ab_firstname like '%$query%' OR a.ab_email like '%$query%' OR "
+ . "a.ab_street like '%$query%' OR a.ab_city like '%$query%' OR a.ab_state "
+ . "like '%$query%' OR a.ab_zip like '%$query%' OR a.ab_notes like "
+ . "'%$query%' OR c.company_name like '%$query%') $ordermethod limit $limit");
+ } else {
+ $phpgw->db->query("SELECT ab_id,ab_owner,ab_firstname,ab_lastname,"
+ . "ab_email,ab_wphone,ab_company "
+ . "from addressbook "
+ . "WHERE $filtermethod AND (ab_lastname like '"
+ . "%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%' OR "
+ . "ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state "
+ . "like '%$query%' OR ab_zip like '%$query%' OR ab_notes like "
+ . "'%$query%' OR ab_company like '%$query%') $ordermethod limit $limit");
+ }
} else {
- $phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod $ordermethod limit $limit");
+ 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 "
+ . "AND $filtermethod $ordermethod limit $limit");
+ } else {
+ $phpgw->db->query("SELECT ab_id,ab_owner,ab_firstname,ab_lastname,"
+ . "ab_email,ab_wphone,ab_company "
+ . "from addressbook "
+ . "WHERE $filtermethod $ordermethod limit $limit");
+ }
}
while ($phpgw->db->next_record()) {
@@ -144,7 +188,10 @@
$firstname = $phpgw->db->f("ab_firstname");
$lastname = $phpgw->db->f("ab_lastname");
$email = $phpgw->db->f("ab_email");
- $company = $phpgw->db->f("ab_company");
+ if($phpgw_info["apps"]["timetrack"]["enabled"])
+ $company = $phpgw->db->f("company_name");
+ else
+ $company = $phpgw->db->f("company");
$wphone = $phpgw->db->f("ab_wphone");
$ab_id = $phpgw->db->f("ab_id");
@@ -178,7 +225,7 @@
if ( $phpgw_info["user"]["preferences"]["addressbook_view_email"] == 'True' ) {
echo '';
echo '';
- echo $email;
+ echo '' . $email . '';
echo ' | ';
};
if ( $phpgw_info["user"]["preferences"]["addressbook_view_wphone"] == 'True' ) {
@@ -229,4 +276,4 @@
common->phpgw_footer();
-?>
+?>
\ No newline at end of file
diff --git a/addressbook/view.php b/addressbook/view.php
index 94aa4ded03..3e906d7f49 100755
--- a/addressbook/view.php
+++ b/addressbook/view.php
@@ -26,8 +26,15 @@
if ($filter != "private")
$filtermethod = " or ab_access='public' " . $phpgw->accounts->sql_search("ab_access");
- $phpgw->db->query("SELECT * FROM addressbook WHERE ab_id=$ab_id AND (ab_owner='"
+ if($phpgw_info["apps"]["timetrack"]["enabled"]) {
+ $phpgw->db->query("SELECT * FROM addressbook as a, customers as c WHERE a.ab_company_id = c.company_id "
+ . "AND ab_id=$ab_id AND (ab_owner='"
. $phpgw_info["user"]["userid"] . "' $filtermethod)");
+ } else {
+ $phpgw->db->query("SELECT * FROM addressbook "
+ . "WHERE ab_id=$ab_id AND (ab_owner='"
+ . $phpgw_info["user"]["userid"] . "' $filtermethod)");
+ }
$phpgw->db->next_record();
$fields = array('ab_id' => $phpgw->db->f("ab_id"),
@@ -35,6 +42,7 @@
'access' => $phpgw->db->f("ab_access"),
'firstname' => $phpgw->db->f("ab_firstname"),
'lastname' => $phpgw->db->f("ab_lastname"),
+ 'title' => $phpgw->db->f("ab_title"),
'email' => $phpgw->db->f("ab_email"),
'hphone' => $phpgw->db->f("ab_hphone"),
'wphone' => $phpgw->db->f("ab_wphone"),
@@ -43,11 +51,14 @@
'mphone' => $phpgw->db->f("ab_mphone"),
'ophone' => $phpgw->db->f("ab_ophone"),
'street' => $phpgw->db->f("ab_street"),
+ 'address2' => $phpgw->db->f("ab_address2"),
'city' => $phpgw->db->f("ab_city"),
'state' => $phpgw->db->f("ab_state"),
'zip' => $phpgw->db->f("ab_zip"),
'bday' => $phpgw->db->f("ab_bday"),
'company' => $phpgw->db->f("ab_company"),
+ 'company_id' => $phpgw->db->f("ab_company_id"),
+ 'company_name' => $phpgw->db->f("company_name"),
'notes' => $phpgw->db->f("ab_notes")
);
diff --git a/header.inc.php.sample b/header.inc.php.sample
index bc4d3d5f59..d7015344ad 100644
--- a/header.inc.php.sample
+++ b/header.inc.php.sample
@@ -37,6 +37,8 @@
/**************************************************************************\
* Do not edit these lines *
\**************************************************************************/
+ include($phpgw_info["server"]["server_root"]."/version.inc.php");
+ $phpgw_info["server"]["header_version"] = "1.1";
if (!$phpgw_info["flags"]["noapi"] == True){
include($phpgw_info["server"]["include_root"] . "/phpgwapi/phpgw.inc.php");
}
diff --git a/setup/createtables_mysql.inc.php b/setup/createtables_mysql.inc.php
index 0a5170892d..e344bf7f21 100644
--- a/setup/createtables_mysql.inc.php
+++ b/setup/createtables_mysql.inc.php
@@ -86,7 +86,7 @@
loginid varchar(30),
ip varchar(30),
li int,
- lo int
+ lo varchar(255)
)";
$db->query($sql);
@@ -103,7 +103,7 @@
$db->query($sql);
$sql = "CREATE TABLE addressbook (
- ab_id int(11) DEFAULT '0' NOT NULL auto_increment,
+ ab_id int(11) NOT NULL auto_increment,
ab_owner varchar(25),
ab_access varchar(10),
ab_firstname varchar(255),
@@ -122,10 +122,30 @@
ab_bday varchar(255),
ab_notes text,
ab_company varchar(255),
+ ab_company_id int(10) unsigned,
+ ab_title varchar(60),
+ ab_address2 varchar(60),
PRIMARY KEY (ab_id)
)";
$db->query($sql);
+
+ $sql = "CREATE TABLE customers (
+ company_id int(10) unsigned NOT NULL auto_increment,
+ company_name varchar(255),
+ website varchar(80),
+ ftpsite varchar(80),
+ industry_type varchar(50),
+ status varchar(30),
+ software varchar(40),
+ lastjobnum int(10) unsigned,
+ lastjobfinished date,
+ busrelationship varchar(30),
+ notes text,
+ PRIMARY KEY (company_id)
+ );";
+ $db->query($sql);
+
$sql = "CREATE TABLE todo (
todo_id int(11) DEFAULT '0' NOT NULL auto_increment,
todo_owner varchar(25),
diff --git a/setup/createtables_pgsql.inc.php b/setup/createtables_pgsql.inc.php
index e7713448b2..62bf8e72be 100644
--- a/setup/createtables_pgsql.inc.php
+++ b/setup/createtables_pgsql.inc.php
@@ -86,7 +86,7 @@
loginid varchar(30),
ip varchar(30),
li int,
- lo int
+ lo varchar(255)
)";
$db->query($sql);
@@ -121,6 +121,9 @@
ab_bday varchar(255),
ab_notes TEXT,
ab_company varchar(255)
+ ab_company_id int(10) unsigned,
+ ab_title varchar(60),
+ ab_address2 varchar(60),
)";
$db->query($sql);
diff --git a/setup/default_records.inc.php b/setup/default_records.inc.php
index b0a9d4e833..3e6a5adfeb 100644
--- a/setup/default_records.inc.php
+++ b/setup/default_records.inc.php
@@ -12,7 +12,7 @@
/* $Id$ */
function add_default_server_config(){
- global $db, $newversion;
+ global $db, $phpgw_info;
$db->query("insert into config (config_name, config_value) values ('default_tplset', 'default')");
$db->query("insert into config (config_name, config_value) values ('temp_dir', '/path/to/tmp')");
$db->query("insert into config (config_name, config_value) values ('files_dir', '/path/to/dir/phpgroupware/files')");
@@ -94,18 +94,18 @@
}else{
add_default_server_config();
}
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('admin', 'Administration', 1, 1, NULL, '$newversion')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('admin', 'Administration', 1, 1, NULL, '".$phpgw_info["server"]["version"]."')");
$db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('tts', 'Trouble Ticket System', 0, 2, NULL, '0.0.0')");
$db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('inv', 'Inventory', 0, 3, NULL, '0.0.0')");
$db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('chat', 'Chat', 0, 4, NULL, '0.0.0')");
$db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('headlines', 'Headlines', 0, 5, 'news_sites,news_headlines,users_headlines', '0.0.0')");
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('filemanager', 'File manager', 1, 6, NULL, '$newversion')");
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('addressbook', 'Address Book', 1, 7, 'addressbook', '$newversion')");
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('todo', 'ToDo List', 1, 8, 'todo', '$newversion')");
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('calendar', 'Calendar', 1, 9, 'webcal_entry,webcal_entry_users,webcal_entry_groups,webcal_repeats', '$newversion')");
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('email', 'Email', 1, 10,NULL, '$newversion')");
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('nntp', 'NNTP', 1, 11, 'newsgroups,users_newsgroups', '$newversion')");
- $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('cron_apps', 'cron_apps', 0, 0, NULL, '$newversion')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('filemanager', 'File manager', 1, 6, NULL, '".$phpgw_info["server"]["version"]."')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('addressbook', 'Address Book', 1, 7, 'addressbook', '".$phpgw_info["server"]["version"]."')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('todo', 'ToDo List', 1, 8, 'todo', '".$phpgw_info["server"]["version"]."')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('calendar', 'Calendar', 1, 9, 'webcal_entry,webcal_entry_users,webcal_entry_groups,webcal_repeats', '".$phpgw_info["server"]["version"]."')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('email', 'Email', 1, 10,NULL, '".$phpgw_info["server"]["version"]."')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('nntp', 'NNTP', 1, 11, 'newsgroups,users_newsgroups', '".$phpgw_info["server"]["version"]."')");
+ $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('cron_apps', 'cron_apps', 0, 0, NULL, '".$phpgw_info["server"]["version"]."')");
$db->query("insert into accounts (account_lid,account_pwd,account_firstname,account_lastname,account_permissions,account_groups,account_status) values ('demo','81dc9bdb52d04dc20036dbd8313ed055','Demo','Account',':admin:email:todo:addressbook:calendar:',',1,','A')");
diff --git a/setup/index.php b/setup/index.php
index 5b9cbc4eb4..b763c61384 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -11,9 +11,6 @@
/* $Id$ */
- /* !!! This needs to be changed each time we do an update !!! */
- $newversion = "0.9.2";
-
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", "noapi" => True);
include("../header.inc.php");
@@ -70,7 +67,7 @@
echo " |
\n";
echo "