| | |
| | | | | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | | Author: Tobias 'tri' Richter <tobias@datenwerkstatt-richter.de> | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | |
| | | } |
| | | |
| | | // setup some vars we need |
| | | $a_save_cols = array('name', 'email', 'first_name', 'middle_name', 'last_name', 'edu_title', 'addon', 'nickname', 'company', 'organisation', 'department', 'job_title', 'note', 'tel_work1_voice', 'tel_work2_voice', 'tel_home1_voice', 'tel_home2_voice', 'tel_cell_voice', 'tel_car_voice', 'tel_pager_voice', 'tel_additional', 'tel_work_fax', 'tel_home_fax', 'tel_isdn', 'tel_preferred', 'tel_telex', 'work_street', 'work_zip', 'work_city', 'work_region', 'work_country', 'home_street', 'home_zip', 'home_city', 'home_region', 'home_country', 'postal_street', 'postal_zip', 'postal_city', 'postal_region', 'postal_country', 'url_work', 'role', 'birthday', 'rev', 'lang'); |
| | | $a_save_cols = array('name', 'firstname', 'surname', 'email'); |
| | | $contacts_table = get_table_name('contacts'); |
| | | |
| | | // update an existing contact |
| | |
| | | if (sizeof($a_write_sql)) |
| | | { |
| | | $DB->query("UPDATE $contacts_table |
| | | SET changed=now(), ".join(', ', $a_write_sql)." |
| | | SET changed=".$DB->now().", ".join(', ', $a_write_sql)." |
| | | WHERE contact_id=? |
| | | AND user_id=? |
| | | AND del<>1", |
| | |
| | | |
| | | if ($updated) |
| | | { |
| | | $_action = 'show'; |
| | | show_message('successfullysaved', 'confirmation'); |
| | | |
| | | if ($_framed) |
| | | { |
| | | // define list of cols to be displayed |
| | |
| | | $_POST['_cid'], |
| | | array2js($a_js_cols))); |
| | | |
| | | // show confirmation |
| | | show_message('successfullysaved', 'confirmation'); |
| | | } |
| | | |
| | | // show confirmation |
| | | show_message('successfullysaved', 'confirmation'); |
| | | rcmail_overwrite_action('show'); |
| | | } |
| | | else |
| | | { |
| | |
| | | foreach ($emails as $email) |
| | | { |
| | | $DB->query("INSERT INTO $contacts_table |
| | | (user_id, name, email |
| | | (user_id, name, email) |
| | | VALUES ({$_SESSION['user_id']}," . $DB->quote($names[$n++]) . "," . |
| | | $DB->quote($email) . ")"); |
| | | $insert_id[] = $DB->insert_id(); |
| | |
| | | if (sizeof($a_insert_cols)) |
| | | { |
| | | $DB->query("INSERT INTO $contacts_table |
| | | (user_id, changed, del, ".join(', ', $a_insert_cols).") |
| | | VALUES (?, now(), 0, ".join(', ', $a_insert_values).")", |
| | | (user_id, changed, del, ".join(', ', $a_insert_cols).") |
| | | VALUES (?, ".$DB->now().", 0, ".join(', ', $a_insert_values).")", |
| | | $_SESSION['user_id']); |
| | | |
| | | $insert_id = $DB->insert_id(get_sequence_name('contacts')); |
| | |
| | | { |
| | | if (!$ldap_form) |
| | | { |
| | | $_action = 'show'; |
| | | $_GET['_cid'] = $insert_id; |
| | | |
| | | if ($_framed) |
| | | { |
| | | // add contact row or jump to the page where it should appear |
| | |
| | | $_SESSION['user_id']); |
| | | $commands .= rcmail_js_contacts_list($sql_result, $JS_OBJECT_NAME); |
| | | |
| | | $commands .= sprintf("if(parent.%s)parent.%s.select('%d');\n", |
| | | $commands .= sprintf("if(parent.%s)parent.%s.contact_list.select('%d');\n", |
| | | $JS_OBJECT_NAME, |
| | | $JS_OBJECT_NAME, |
| | | $insert_id); |
| | | |
| | | |
| | | // update record count display |
| | | $commands .= sprintf("if(parent.%s)parent.%s.set_rowcount('%s');\n", |
| | | $JS_OBJECT_NAME, |
| | |
| | | } |
| | | |
| | | // show confirmation |
| | | show_message('successfullysaved', 'confirmation'); |
| | | show_message('successfullysaved', 'confirmation'); |
| | | $_GET['_cid'] = $insert_id; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | // display the last insert id |
| | | $commands .= sprintf("if(parent.%s)parent.%s.select('%d');\n", |
| | | $commands .= sprintf("if(parent.%s)parent.%s.contact_list.select('%d');\n", |
| | | $JS_OBJECT_NAME, |
| | | $JS_OBJECT_NAME, |
| | | $last_id); |
| | |
| | | |
| | | // show confirmation |
| | | show_message('successfullysaved', 'confirmation'); |
| | | rcmail_overwrite_action('show'); |
| | | } |
| | | else |
| | | { |