diff --git a/addressbook/inc/functions.inc.php b/addressbook/inc/functions.inc.php index 63d28760d7..e083d8294f 100755 --- a/addressbook/inc/functions.inc.php +++ b/addressbook/inc/functions.inc.php @@ -12,31 +12,49 @@ /* $Id$ */ + $abc = array('company' => 'company', // AddressBook Columns and their descriptions + 'firstname' => 'first name', + 'lastname' => 'last name', + 'email' => 'email', + 'wphone' => 'work phone', + 'hphone' => 'home phone', + 'fax' => 'fax', + 'pager' => 'pager', + 'mphone' => 'mobile phone', + 'ophone' => 'other phone', + 'street' => 'street', + 'city' => 'city', + 'state' => 'state', + 'zip' => 'zip code', + 'bday' => 'birthday', + 'url' => 'URL' + ); + 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"]; - $pager = $fields["pager"]; - $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"]; - $ab_company = $fields["company"]; - $company_id = $fields["company_id"]; + $email = $fields["email"]; + $firstname = $fields["firstname"]; + $lastname = $fields["lastname"]; + $title = $fields["title"]; + $hphone = $fields["hphone"]; + $wphone = $fields["wphone"]; + $fax = $fields["fax"]; + $pager = $fields["pager"]; + $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"]; + $ab_company = $fields["company"]; + $company_id = $fields["company_id"]; $company_name = $fields["company_name"]; if ($format != "view") { diff --git a/addressbook/index.php b/addressbook/index.php index af5d88b3dd..efbf002feb 100755 --- a/addressbook/index.php +++ b/addressbook/index.php @@ -52,7 +52,7 @@ . "%$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%')"); + . "'%$query%' OR c.company_name like '%$query%' OR a.ab_url like '%$query%')"); // . "'%$query%' OR c.company_name like '%$query%')" // . " $ordermethod limit $limit"); } else { @@ -62,7 +62,7 @@ . "%$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%')"); + . "'%$query%' OR ab_company like '%$query%' OR ab_url like '%$query$%')"); // . "'%$query%' OR ab_company like '%$query%')" // . " $ordermethod limit $limit"); } @@ -100,39 +100,17 @@ "> '; - echo ''; - echo $phpgw->nextmatchs->show_sort_order($sort,$company_sortorder,$order,"index.php",lang("Company Name")); - echo ''; - } - if ($phpgw_info["user"]["preferences"]["addressbook"]["lastname"]) { - echo ''; - } - if ($phpgw_info["user"]["preferences"]["addressbook"]["firstname"]) { - echo ''; - } - if ($phpgw_info["user"]["preferences"]["addressbook"]["email"]) { - echo ''; - } - if ($phpgw_info["user"]["preferences"]["addressbook"]["wphone"]) { - echo ''; + while ($column = each($abc)) { + if ($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) { + echo ''; + echo "\n"; + + // To be used when displaying the rows + $columns_to_display[$column[0]] = True; + } } ?> @@ -149,97 +127,80 @@ - 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"); - } + 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 { - 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"); - } - } + 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 * from addressbook WHERE $filtermethod $ordermethod limit $limit"); + } + } // else $query while ($phpgw->db->next_record()) { $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + echo ''; + + while ($column = each($columns_to_display)) { + if ($phpgw_info["apps"]["timetrack"]["enabled"]) { + if ($column[0] == "company") { + $field = $phpgw->db->f("company_name"); + } else { + $field = $phpgw->db->f("ab_company"); + } + } else { + $field = $phpgw->db->f("ab_" . $column[0]); + } - $firstname = $phpgw->db->f("ab_firstname"); - $lastname = $phpgw->db->f("ab_lastname"); - $email = $phpgw->db->f("ab_email"); - if ($phpgw_info["apps"]["timetrack"]["enabled"]) { - $company = $phpgw->db->f("company_name"); - } else { - $company = $phpgw->db->f("ab_company"); + if (! $field) { + $field = " "; + } else { + $field = htmlentities($field); + } + + // Some fields require special formating. + if ($column[0] == "url") { + echo ''; + } else if ($column[0] == "email") { + if ($phpgw_info["user"]["apps"]["email"]) { + echo ''; + } else { + echo ''; + } + } else { + echo ''; + } + } - $wphone = $phpgw->db->f("ab_wphone"); - $ab_id = $phpgw->db->f("ab_id"); - - if ($firstname == "") $firstname = " "; - if ($lastname == "") $lastname = " "; - if ($email == "") $email = " "; - if ($company == "") $company = " "; - if ($wphone == "") $wphone = " "; - ?> - '; - if ($phpgw_info["user"]["preferences"]["addressbook"]["company"]) { - echo ''; - }; - if ($phpgw_info["user"]["preferences"]["addressbook"]["lastname"]) { - echo ''; - }; - if ($phpgw_info["user"]["preferences"]["addressbook"]["firstname"]) { - echo ''; - }; - if ($phpgw_info["user"]["preferences"]["addressbook"]["email"]) { - echo ''; - }; - if ($phpgw_info["user"]["preferences"]["addressbook"]["wphone"]) { - echo ''; - }; - ?> - '; - $abc = get_abc(); # AddressBook Columns $i = 0; $j = 0; $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); echo ''; while (list($col, $descr) = each($abc)) { +// echo "
test: $col - $i $j - " . count($abc); $i++; $j++; + echo ''; - if ($i ==3) { + if ($i == 3) { echo ""; $i = 0; } @@ -66,6 +67,12 @@ echo ''; } if ($j == count($abc)) { + if ($i == 1) { + echo ""; + } + if ($i == 2) { + echo ""; + } echo ""; } } diff --git a/doc/CHANGELOG b/doc/CHANGELOG index e8bb537d40..fd8d53866e 100755 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -19,6 +19,7 @@ - mcrypt should be working correctly now. - Fixed problem with email's addressbook not retrieving records. - Applied patch for accounts->listusers(). Thanks Mathieu van Loon + - Fixed check for new version not working. [0.9.2] - Fixed sorting bug in currentusers.php - Cleaned up error reporting and form in newaccount.php diff --git a/index.php b/index.php index f06c37dc4d..612a420677 100755 --- a/index.php +++ b/index.php @@ -33,8 +33,17 @@ $phpgw->common->read_preferences($phpgw_info["user"]["userid"],"addressbook",True); $phpgw->common->read_preferences($phpgw_info["user"]["userid"],"email",True); $phpgw->common->read_preferences($phpgw_info["user"]["userid"],"calendar",True); + + if ($phpgw_info["user"]["apps"]["admin"]) { + if ($phpgw_info["server"]["version"] > $phpgw_info["server"]["phpgroupware_api_version"]) { + echo "

" . lang("Your are running a newer version of phpGroupWare then your database is setup for") + . "
" . lang("It is recommend that you run setup to upgrade your tables to the current version") + . "
"; + + } + } - if ($phpgw_info["user"]["permissions"]["admin"] && $phpgw_info["server"]["checkfornewversion"]) { + if ($phpgw_info["user"]["apps"]["admin"] && $phpgw_info["server"]["checkfornewversion"]) { $phpgw->network->set_addcrlf(False); if ($phpgw->network->open_port("phpgroupware.org",80,30)) { $phpgw->network->write_port("GET /currentversion HTTP/1.0\nHOST: www.phpgroupware.org\n\n"); diff --git a/setup/createtables_mysql.inc.php b/setup/createtables_mysql.inc.php index d3e85e5cfb..98b3380a81 100644 --- a/setup/createtables_mysql.inc.php +++ b/setup/createtables_mysql.inc.php @@ -223,8 +223,9 @@ PRIMARY KEY (message_id,app_name,lang) )"; $db->query($sql); - - $sql = "create table domains ( + + // I decied too hold off on this table until 0.9.4pre1 (jengo) +/* $sql = "create table domains ( domain_id int NOT NULL auto_increment, domain_name varchar(255), domain_database varchar(255), @@ -232,5 +233,6 @@ primary key(domain_id) )"; $db->query($sql); +*/ ?> diff --git a/setup/default_records.inc.php b/setup/default_records.inc.php index 5bca3df6fc..c58696a92a 100644 --- a/setup/default_records.inc.php +++ b/setup/default_records.inc.php @@ -126,5 +126,6 @@ $db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','firstname','True','addressbook')"); $db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','lastname','True','addressbook')"); $db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','company','True','addressbook')"); - + + $db->query("insert into config (config_name, config_value) values ('phpgroupware_api_version','" . $phpgw_info["server"]["version"] . "')"); ?> diff --git a/setup/upgradetables_mysql.inc.php b/setup/upgradetables_mysql.inc.php index 8cfbc5ef04..cba5eb9401 100644 --- a/setup/upgradetables_mysql.inc.php +++ b/setup/upgradetables_mysql.inc.php @@ -294,17 +294,19 @@ if ($currentver == "0.9.3pre4") { $db->query("alter table config change config_name config_name varchar(255) NOT NULL"); - $db->query("create table domains (domain_id int NOT NULL auto_increment, domain_name varchar(255)," - . "domain_database varchar(255),domain_status enum('Active,Disabled'),primary key(domain_id))"); + + // I decied too hold off on this table until 0.9.4pre1 (jengo) +// $db->query("create table domains (domain_id int NOT NULL auto_increment, domain_name varchar(255)," +// . "domain_database varchar(255),domain_status enum('Active,Disabled'),primary key(domain_id))"); $currentver = "0.9.3pre5"; update_version_table(); } if ($currentver == "0.9.3pre5") { $db->query("CREATE TABLE categories ( - cat_id int(9) DEFAULT '0' NOT NULL auto_increment, - account_id int(11) DEFAULT '0' NOT NULL, - app_name varchar(25) NOT NULL, - cat_name varchar(150) NOT NULL, + cat_id int(9) DEFAULT '0' NOT NULL auto_increment, + account_id int(11) DEFAULT '0' NOT NULL, + app_name varchar(25) NOT NULL, + cat_name varchar(150) NOT NULL, cat_description text NOT NULL, PRIMARY KEY (cat_id))" ); @@ -330,6 +332,9 @@ v9072000to0_9_1(); v0_9_1to0_9_2(); v0_9_2to0_9_3(); + + $db->query("update config set config_value='" . $phpgw_info["server"]["version"] . "' where " + . "config_name='phpgroupware_api_version'"); if (!$tablechanges == True){ echo "

\n"; diff --git a/setup/upgradetables_pgsql.inc.php b/setup/upgradetables_pgsql.inc.php index 820d4e1345..02e4032ee5 100644 --- a/setup/upgradetables_pgsql.inc.php +++ b/setup/upgradetables_pgsql.inc.php @@ -310,6 +310,10 @@ v0_9_2to0_9_3pre5(); $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')"); + $db->query("update config set config_value='" . $phpgw_info["server"]["version"] . "' where " + . "config_name='phpgroupware_api_version'"); + + if (!$didupgrade == True){ echo " \n"; echo " \n";
'; - echo ''; - echo $phpgw->nextmatchs->show_sort_order($sort,"ab_lastname",$order,"index.php", - lang("Last Name")); - echo ''; - echo ''; - echo $phpgw->nextmatchs->show_sort_order($sort,"ab_firstname",$order,"index.php", - lang("First Name")); - echo ''; - echo ''; - echo $phpgw->nextmatchs->show_sort_order($sort,"ab_email",$order,"index.php", - lang("Email")); - echo ''; - echo ''; - echo $phpgw->nextmatchs->show_sort_order($sort,"ab_wphone",$order,"index.php", - lang("Work Phone")); - echo ''; + echo ''; + echo $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1])); + echo '
' + . '' . $field. '' + . '' . $field . '' + . '' . $field. '' + . $field . ''; - echo ''; - echo $company; - echo ''; - echo ''; - echo $lastname; - echo ''; - echo ''; - echo $firstname; - echo ''; - echo ''; - echo '' . $email . ''; - echo ''; - echo ''; - echo $wphone; - echo ' +  
' . $descr . '
   
No table changes were needed. The script only updated your version setting.