From d08ca90692d6c4f30a6a31e86a0de303d989ef50 Mon Sep 17 00:00:00 2001 From: seek3r Date: Wed, 4 Oct 2000 17:49:36 +0000 Subject: [PATCH] Added simple version management and added massive updates to the addressbook that were submited by neotexan, so that things will interact with his application better --- addressbook/add.php | 37 +++++++++++++-- addressbook/delete.php | 14 +++--- addressbook/edit.php | 38 +++++++++++++-- addressbook/inc/functions.inc.php | 55 +++++++++++++++++++-- addressbook/index.php | 79 ++++++++++++++++++++++++------- addressbook/view.php | 13 ++++- header.inc.php.sample | 2 + setup/createtables_mysql.inc.php | 24 +++++++++- setup/createtables_pgsql.inc.php | 5 +- setup/default_records.inc.php | 18 +++---- setup/index.php | 7 +-- setup/upgradetables_mysql.inc.php | 50 +++++++++++++------ version.inc.php | 1 + 13 files changed, 274 insertions(+), 69 deletions(-) create mode 100644 version.inc.php diff --git a/addressbook/add.php b/addressbook/add.php index 1564d2416c..37034da862 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -32,12 +32,14 @@ $bday = "$bday_month/$bday_day/$bday_year"; $access = $phpgw->accounts->array_to_string($access,$n_groups); - - $sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_email," - . "ab_hphone,ab_wphone,ab_fax,ab_pager,ab_mphone,ab_ophone,ab_street,ab_city,ab_state,ab_zip,ab_bday," - . "ab_notes,ab_company) values ('" . $phpgw_info["user"]["userid"] . "','$access','" + if($phpgw_info["apps"]["timetrack"]["enabled"]) { + $sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_title,ab_email," + . "ab_hphone,ab_wphone,ab_fax,ab_pager,ab_mphone,ab_ophone,ab_street,ab_address2,ab_city," + . "ab_state,ab_zip,ab_bday," + . "ab_notes,ab_company_id) values ('" . $phpgw_info["user"]["userid"] . "','$access','" . addslashes($firstname). "','" . addslashes($lastname) . "','" + . addslashes($title) . "','" . addslashes($email) . "','" . addslashes($hphone) . "','" . addslashes($wphone) . "','" @@ -46,12 +48,37 @@ . addslashes($mphone) . "','" . addslashes($ophone) . "','" . addslashes($street) . "','" + . addslashes($address2) . "','" . addslashes($city) . "','" . addslashes($state) . "','" . addslashes($zip) . "','" . addslashes($bday) . "','" . addslashes($notes) . "','" . addslashes($company). "')"; + } else { + $sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_title,ab_email," + . "ab_hphone,ab_wphone,ab_fax,ab_pager,ab_mphone,ab_ophone,ab_street,ab_address2,ab_city," + . "ab_state,ab_zip,ab_bday," + . "ab_notes,ab_company) values ('" . $phpgw_info["user"]["userid"] . "','$access','" + . addslashes($firstname). "','" + . addslashes($lastname) . "','" + . addslashes($title) . "','" + . addslashes($email) . "','" + . addslashes($hphone) . "','" + . addslashes($wphone) . "','" + . addslashes($fax) . "','" + . addslashes($pager) . "','" + . addslashes($mphone) . "','" + . addslashes($ophone) . "','" + . addslashes($street) . "','" + . addslashes($address2) . "','" + . addslashes($city) . "','" + . addslashes($state) . "','" + . addslashes($zip) . "','" + . addslashes($bday) . "','" + . addslashes($notes) . "','" + . addslashes($company). "')"; + } $phpgw->db->query($sql); Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/", @@ -89,4 +116,4 @@ common->phpgw_footer(); -?> +?> \ No newline at end of file diff --git a/addressbook/delete.php b/addressbook/delete.php index a16511ea87..9d1cc25412 100755 --- a/addressbook/delete.php +++ b/addressbook/delete.php @@ -19,32 +19,32 @@ $phpgw_info["flags"]["currentapp"] = "addressbook"; include("../header.inc.php"); - if (! $con) { + if (! $ab_id) { Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/")); } if ($confirm != "true") { - $phpgw->db->query("select owner from addressbook where con='$con'"); + $phpgw->db->query("select ab_owner from addressbook where ab_id='$ab_id'"); $phpgw->db->next_record(); - if ($phpgw->db->f("owner") != $phpgw_info["user"]["userid"]) + if ($phpgw->db->f("ab_owner") != $phpgw_info["user"]["userid"]) Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/")); ?>

link("view.php","&ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"); ?>">         - ">
db->query("delete from addressbook where owner='" . $phpgw_info["user"]["userid"] - . "' and con='$con'"); + $phpgw->db->query("delete from addressbook where ab_owner='" . $phpgw_info["user"]["userid"] + . "' and ab_id='$ab_id'"); Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/", "cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query")); } diff --git a/addressbook/edit.php b/addressbook/edit.php index 129a155559..af0c2f436d 100755 --- a/addressbook/edit.php +++ b/addressbook/edit.php @@ -35,6 +35,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 +44,13 @@ '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"), 'notes' => $phpgw->db->f("ab_notes") ); @@ -55,11 +58,15 @@ } else { $bday = $bday_month . "/" . $bday_day . "/" . $bday_year; - $access = $phpgw->accounts->array_to_string($access,$n_groups); + if ($access != "private" && $access != "public") { + $access = $phpgw->accounts->array_to_string($access,$n_groups); + } - $sql = "UPDATE addressbook set ab_email='" . addslashes($email) - . "', ab_firstname='". addslashes($firstname) + if($phpgw_info["apps"]["timetrack"]["enabled"]) { + $sql = "UPDATE addressbook set ab_email='" . addslashes($email) + . "', ab_firstname='". addslashes($firstname) . "', ab_lastname='" . addslashes($lastname) + . "', ab_title='" . addslashes($title) . "', ab_hphone='" . addslashes($hphone) . "', ab_wphone='" . addslashes($wphone) . "', ab_fax='" . addslashes($fax) @@ -67,14 +74,37 @@ . "', ab_mphone='" . addslashes($mphone) . "', ab_ophone='" . addslashes($ophone) . "', ab_street='" . addslashes($street) + . "', ab_address2='" . addslashes($address2) . "', ab_city='" . addslashes($city) . "', ab_state='" . addslashes($state) . "', ab_zip='" . addslashes($zip) . "', ab_bday='" . addslashes($bday) . "', ab_notes='" . addslashes($notes) - . "', ab_company='" . addslashes($company) + . "', ab_company_id='" . addslashes($company) . "', ab_access='" . addslashes($access) . "' WHERE ab_owner='" . $phpgw_info["user"]["userid"] . "' AND ab_id=$ab_id"; + } else { + $sql = "UPDATE addressbook set ab_email='" . addslashes($email) + . "', ab_firstname='". addslashes($firstname) + . "', ab_lastname='" . addslashes($lastname) + . "', ab_title='" . addslashes($title) + . "', ab_hphone='" . addslashes($hphone) + . "', ab_wphone='" . addslashes($wphone) + . "', ab_fax='" . addslashes($fax) + . "', ab_pager='" . addslashes($pager) + . "', ab_mphone='" . addslashes($mphone) + . "', ab_ophone='" . addslashes($ophone) + . "', ab_street='" . addslashes($street) + . "', ab_address2='" . addslashes($address2) + . "', ab_city='" . addslashes($city) + . "', ab_state='" . addslashes($state) + . "', ab_zip='" . addslashes($zip) + . "', ab_bday='" . addslashes($bday) + . "', ab_notes='" . addslashes($notes) + . "', ab_company='" . addslashes($company) + . "', ab_access='" . addslashes($access) + . "' WHERE ab_owner='" . $phpgw_info["user"]["userid"] . "' AND ab_id=$ab_id"; + } $phpgw->db->query($sql); diff --git a/addressbook/inc/functions.inc.php b/addressbook/inc/functions.inc.php index 09f5acc727..63d28760d7 100755 --- a/addressbook/inc/functions.inc.php +++ b/addressbook/inc/functions.inc.php @@ -15,10 +15,12 @@ function form($format,$action,$title,$fields) { global $phpgw; + global $phpgw_info; $email = $fields["email"]; $firstname = $fields["firstname"]; $lastname = $fields["lastname"]; + $title = $fields["title"]; $hphone = $fields["hphone"]; $wphone = $fields["wphone"]; $fax = $fields["fax"]; @@ -26,18 +28,22 @@ $mphone = $fields["mphone"]; $ophone = $fields["ophone"]; $street = $fields["street"]; + $address2 = $fields["address2"]; $city = $fields["city"]; $state = $fields["state"]; $zip = $fields["zip"]; $bday = $fields["bday"]; $notes = $fields["notes"]; $access = $fields["access"]; - $company = $fields["company"]; + $ab_company = $fields["company"]; + $company_id = $fields["company_id"]; + $company_name = $fields["company_name"]; if ($format != "view") { $email = ""; $firstname = ""; $lastname = ""; + $title = ""; $hphone = ""; $wphone = ""; $fax = ""; @@ -45,10 +51,25 @@ $mphone = ""; $ophone = ""; $street = ""; + $address2 = ""; $city = ""; $state = ""; $zip = ""; - $company = ""; + if($phpgw_info["apps"]["timetrack"]["enabled"]) { + $company = '"; + } else { + $company = ""; + } if (strlen($bday) > 2) { list( $month, $day, $year ) = split( '/', $bday ); @@ -100,12 +121,20 @@ . $notes . ""; if ($bday == "//") $bday = ""; + if($phpgw_info["apps"]["timetrack"]["enabled"]) { + $company = $company_name; + } else { + $company = $ab_company; + } } if ($action) { echo "
link($action)."\" method=\"post\">\n"; } + // test: + //echo "Time track app status = " . $phpgw_info["apps"]["timetrack"]["enabled"]; + ?> @@ -123,13 +152,22 @@ + + + + + + + + + + + '; } 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 ''; }; 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 " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -192,7 +189,7 @@ break; default: if (isset($oldversion)){ - if ($newversion == $oldversion){ + if ($phpgw_info["server"]["version"] == $oldversion){ echo "phpGroupWare Setup\n"; echo "\n"; echo "
- : + : + + + + + : -
: @@ -185,6 +223,15 @@
: + + +
: 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 ''; echo ''; - echo $email; + echo '' . $email . ''; echo '
You appear to be running version $oldversion of phpGroupWare.
\n"; - echo " We will automaticly update your tables/records to $newversion, but we highly recommend backing up your tables incase the script causes damage to your data.\n"; + echo " We will automaticly update your tables/records to ".$phpgw_info["server"]["version"].", but we highly recommend backing up your tables incase the script causes damage to your data.\n"; echo " These automated scripts can easily destroy your data. Please backup before going any further!
\n"; diff --git a/setup/upgradetables_mysql.inc.php b/setup/upgradetables_mysql.inc.php index 1d39caf3d5..6634faeda9 100644 --- a/setup/upgradetables_mysql.inc.php +++ b/setup/upgradetables_mysql.inc.php @@ -99,7 +99,7 @@ } } function v9072000to0_9_1(){ - global $currentver, $newversion, $db; + global $currentver, $phpgw_info, $db; $didupgrade = True; if ($currentver == "9072000"){ @@ -181,22 +181,42 @@ echo " \n"; echo " \n"; echo " \n"; - $currentver = "0_9_1"; + $currentver = "0.9.1"; } } - - function v0_9_1to0_9_2() - { - global $currentver, $newversion, $db; + function v0_9_1to0_9_2pre1(){ + global $currentver, $phpgw_info, $db; $didupgrade = True; - if ($currentver == "9072000") { - $db->query("alter table access_log change lo lo varchar(255)"); + if ($currentver == "0.9.1"){ + + $db->query("alter table access_log change lo lo varchar(255)"); + $db->query("alter table addressbook change ab_id ab_id int(11) NOT NULL auto_increment"); + $db->query("alter table addressbook add ab_company_id int(10) unsigned"); + $db->query("alter table addressbook add ab_title varchar(60)"); + $db->query("alter table addressbook add ab_address2 varchar(60)"); + + $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); + + echo " \n"; + echo " \n"; + echo " \n"; + $currentver = "0.9.2pre1"; } - echo " \n"; - echo " \n"; - echo " \n"; - $currentver = "0_9_2"; } echo "
Upgrade from 9072000 to 0.9.1 is completed.
Upgrade from 0.9.1 to 0.9.2pre1 is completed.
Upgrade from 0.9.1 to 0.9.2 is completed.
\n"; @@ -209,8 +229,8 @@ v8212000to9052000(); v9052000to9072000(); v9072000to0_9_1(); - v0_9_1to0_9_2(); - $db->query("update applications set app_version='$newversion' where (app_name='admin' or app_name='filemanager' or app_name='addressbook' or app_name='todo' or app_name='calendar' or app_name='email' or app_name='nntp' or app_name='cron_apps')"); + v0_9_1to0_9_2pre1(); + $db->query("update applications set app_version='".$phpgw_info["server"]["version"]."' where (app_name='admin' or app_name='filemanager' or app_name='addressbook' or app_name='todo' or app_name='calendar' or app_name='email' or app_name='nntp' or app_name='cron_apps')"); if (!$didupgrade == True){ echo " \n"; @@ -219,4 +239,4 @@ } echo "
\n"; -?> +?> \ No newline at end of file diff --git a/version.inc.php b/version.inc.php new file mode 100644 index 0000000000..04e0ec3ddb --- /dev/null +++ b/version.inc.php @@ -0,0 +1 @@ + \ No newline at end of file