} else { $display['msg'] .= display_err_msg("$l_company : $l_insert_error"); $display['detail'] = dis_company_form($action, $params); } } } // Form data are not valid } else { $display['msg'] = display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_company_form($action, $params); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_company_data_form($params['company_id'], $params)) { $retour = run_query_company_update($params['company_id'], $params); if ($retour) { $addressbooks = OBM_AddressBook::search(); $contacts = $addressbooks->searchContacts("companyId:$params[company_id]"); foreach($contacts as $contact) { OBM_Contact::solrStore($contact); } OBM_IndexingService::commit('contact'); $display['msg'] .= display_ok_msg("$l_company : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_company : $l_update_error"); } $display['detail'] = dis_company_consult($params); } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']);
$display['detail'] = dis_domain_consult($params); } else { $display['msg'] .= display_err_msg($l_insert_error); $prop_q = run_query_domain_properties(); $display['detail'] = html_domain_form('','','', null, null, null, null, $prop_q,$params); } // Form data are not valid } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $prop_q = run_query_domain_properties(); $display['detail'] = html_domain_form('','','', null, null, null, null, $prop_q,$params); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_domain_data_form($params['domain_id'], $params) && check_domain_can_delete_mailserver($params)) { $retour = run_query_domain_update($params['domain_id'], $params); if ($retour) { set_update_state(); $display['msg'] .= display_ok_msg($l_update_ok); } else { $display['msg'] .= display_err_msg($l_update_error); } $display['detail'] = dis_domain_consult($params); } else { $display['msg'] .= display_err_msg($err['msg']); $prop_q = run_query_domain_properties($params['domain_id']); $display['detail'] = html_domain_form('','','', null, null, null, null, $prop_q, $params); } } elseif ($action == 'check_delete') {
$people->sendCreationNotice($params['user_id']); $display["msg"] .= display_ok_msg("$l_user : $l_insert_ok"); $display["detail"] = dis_people_consult($params); } else { $display["msg"] .= display_err_msg("$l_user : $l_insert_error"); $display["detail"] = html_people_form("", $params); } // Form data are not valid } else { $display["msg"] .= display_err_msg($l_invalid_data . " : " . $err["msg"]); $display["detail"] = html_people_form("", $params, $err["field"]); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_user_data_form($params['user_id'], $params)) { $retour = run_query_people_update($params['user_id'], $params); if ($retour) { set_update_state(); $display['msg'] .= display_ok_msg("$l_user : $l_update_ok"); $display['detail'] = dis_people_consult($params); } else { $display['msg'] .= display_err_msg("$l_user : $l_update_error"); $display['detail'] = html_people_form('', $params, $err['field']); } } else { $display['msg'] .= display_err_msg($err['msg']); $display['detail'] = html_people_form('', $params, $err['field']); } } elseif ($action == 'display') {
echo "({".$display['json']."})"; exit(); } else { json_error_msg($l_overbooking_not_allowed); echo "({".$display['json']."})"; exit(); } } else { json_error_msg($l_invalid_data . " : " . $err['msg']); echo "({".$display['json']."})"; exit(); } } elseif ($action == 'quick_insert') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_calendar_data_quick_form($params) && OBM_Acl::areAllowed($obm['uid'], 'calendar',array($params['entity_id']), 'access')) { if( OBM_Acl::areAllowed($obm['uid'], 'calendar',array($params['entity_id']), 'write' )) { $state = 'ACCEPTED'; } else { $state = 'NEEDS-ACTION'; } $id = run_query_calendar_quick_event_insert($params, $state); $params["calendar_id"] = $id; json_insert_event_data($id, $params, $current_view); $detailurl = basename($_SERVER['SCRIPT_NAME'])."?action=detailconsult&calendar_id=$id"; $detail = "<a class='B' href='$detailurl'>".phpStringToJsString($GLOBALS[l_details])."</a>"; json_ok_msg("$l_event : $l_insert_ok - $detail"); echo "({".$display['json']."})"; } else { echo "<script type=\"text/javascript\">".json_error_msg($l_invalid_data . ' : ' . $err['msg'])."</script>";
$params['resource_id'] = $rid; $display['msg'] .= display_ok_msg("$l_resource : $l_insert_ok"); $display['detail'] = dis_resource_consult($params); } else { $display['msg'] .= display_err_msg("$l_resource : $l_insert_error"); $display['search'] = html_resource_search_form($params); } // Form data are not valid } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = html_resource_form('', $params); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_resource_data_form($params['resource_id'], $params)) { $retour = run_query_resource_update($params['resource_id'], $params); if ($retour) { $display['msg'] .= display_ok_msg("$l_resource : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_resource : $l_update_error"); } $display['detail'] = dis_resource_consult($params); } else { $display['msg'] .= display_err_msg($err['msg']); $display['detail'] = html_resource_form('', $params); } } elseif ($action == 'check_delete') { /////////////////////////////////////////////////////////////////////////////// if (check_resource_update_rights($params)) {
} else { $display['msg'] .= display_warn_msg($err['msg']); $display['detail'] = dis_list_form($action, '', $params); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if ($params['criteria'] != '') { $dynlist = make_list_query_from_criteria($params); $params['query'] = $dynlist['query']; } else { // To change : we do not know if expert mode (query should be stripslashed) // or no more graphical criteria (query should be set to empty) $params['query'] = stripslashes($params['query']); } if (check_user_defined_rules() && check_list_data($params['list_id'], $params)) { $retour = run_query_list_update($params); if ($retour) { $display['msg'] .= display_ok_msg("$l_list : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_list : $l_update_error"); } $display['detail'] = dis_list_consult($params); } else { $display['msg'] .= display_warn_msg($err['msg']); $params_q = run_query_list_detail($params['list_id']); $display['detail'] = dis_list_form($action, $params_q, $params); } } elseif ($action == 'check_delete') { ///////////////////////////////////////////////////////////////////////////////
} } } elseif ($action == 'closing') { /////////////////////////////////////////////////////////////////////////////// if ($params['project_id'] > 0) { $display['detail'] = dis_project_closing($params); } } elseif ($action == 'closing_new') { /////////////////////////////////////////////////////////////////////////////// $display['detail'] = dis_project_closing_form($action, $params); } elseif ($action == 'closing_insert') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_project_closing_form($params)) { $params['closing_id'] = run_query_project_closing_insert($params); if ($params['closing_id'] > 0) { $display['msg'] .= display_ok_msg("$l_closing : $l_insert_ok"); $display['detail'] = dis_project_closing($params); } else { $display['msg'] .= display_err_msg("$l_closing : $l_insert_error : $err[msg]"); } } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_project_closing_form($action, $params); } } elseif ($action == 'allocate_update') { /////////////////////////////////////////////////////////////////////////////// // if (check_member_form($params['project_id'], $params)) {
echo OBM_Error::getInstance()->toJson(); exit(); } } elseif ($action == 'storeContact') { /////////////////////////////////////////////////////////////////////////////// $addressbooks = OBM_AddressBook::search(); $params['contact_id'] = $params['id']; if($params['addressbook']) $addressbook = $addressbooks[$params['addressbook']]; else $addressbook = $addressbooks->getMyContacts(); $current['addressbook'] = $addressbook->id; $current['contact'] = $params['id']; if ($addressbook && $addressbook->write && (check_contact_update_rights($params))) { if (check_user_defined_rules() && check_contact_data_form('', $params)) { if(isset($params['id'])) { $c = OBM_Contact::get($params['id']); $retour = run_query_contact_update($params); OBM_IndexingService::commit('contact'); $contact = OBM_Contact::get($params['id']); update_last_visit('contact', $params['id'], $action); } else { $contact = $addressbook->addContact($params); OBM_IndexingService::commit('contact'); } $subTemplate['card'] = new OBM_Template('card'); } else { header('HTTP', true, 400); //FIXME : Not compatible with the HTML/Ajax implemetation echo OBM_Error::getInstance()->toJson();
if (check_user_defined_rules() && check_invoice_data_form('', $params)) { $retour = run_query_invoice_insert($params); if ($retour) { $display['msg'] .= display_ok_msg("$l_invoice : $l_insert_ok"); } else { $display['msg'] .= display_err_msg("$l_invoice : $l_insert_error"); } $display['search'] = dis_invoice_search_form($params); } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_invoice_form($action, $params, $err['field']); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_invoice_data_form($params['invoice_id'], $params)) { $retour = run_query_invoice_update($params); if ($retour) { $display['msg'] .= display_ok_msg("$l_invoice : $l_update_ok"); } else { $display['msg'] .= display_ok_msg("$l_invoice : $l_update_error"); } $display['detail'] = dis_invoice_consult($params); } else { $display['msg'] .= display_err_msg($l_invalid_data . ' : ' . $err['msg']); $display['search'] = dis_invoice_form($action, $params, $err['field']); } } elseif ($action == 'check_delete') { /////////////////////////////////////////////////////////////////////////////// if (check_can_delete_invoice($params['invoice_id'])) {
if ($retour) { $display["msg"] .= display_ok_msg("$l_document : $l_update_ok"); } else { $display["msg"] .= display_err_msg("$l_document : $l_update_error $err[msg]"); } $doc_q = run_query_document_detail($params["document_id"]); $display["detailInfo"] .= display_record_info($doc_q); $display["detail"] = html_document_consult($doc_q); } else { $display["msg"] = display_warn_msg($l_invalid_data . " : " . $err["msg"]); $display["detail"] = dis_document_form($action, $params, ""); } } elseif ($action == "update_dir") { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_document_dir_data_form($params)) { $retour = run_query_document_update_dir($params); if ($retour) { $display["msg"] .= display_ok_msg("$l_dir : $l_update_ok"); } else { $display["msg"] .= display_err_msg("$l_dir : $l_update_error"); } $display["detail"] = html_document_tree($params,true); // Form data are not valid } else { $display["msg"] = display_warn_msg($l_invalid_data . " : " . $err["msg"]); $display["detail"] = html_document_dir_form($action, $params); } } elseif ($action == "check_delete") { ///////////////////////////////////////////////////////////////////////////////
$params["incident_id"] = run_query_incident_insert($params); if ($params["incident_id"] > 0) { $display["msg"] = display_ok_msg("$l_incident : $l_insert_ok"); $display["detail"] = dis_incident_consult($params); } else { $display["msg"] = display_err_msg("$l_incident : $l_insert_error"); $display["detail"] = dis_incident_form($action,$params); } } else { $display["msg"] = display_warn_msg($err["msg"]); $display["detail"] = dis_incident_form($action,$params); } } elseif ($action == "update") { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_incident_form($params)) { $ret = run_query_incident_update($params); if ($ret) { $display["msg"] = display_ok_msg("$l_incident : $l_update_ok"); $display["detail"] = dis_incident_consult($params); } else { $display["msg"] = display_error_msg("$l_incident : $l_update_error"); $display["detail"] = dis_incident_form($action,$params); } } else { $display["msg"] = display_warn_msg($err["msg"]); $display["detail"] = dis_incident_form($action,$params); } } elseif ($action == "check_delete") { ///////////////////////////////////////////////////////////////////////////////
if (check_publication_data($params['publication_id'], $params)) { $retour = run_query_publication_update($params['publication_id'], $params); if ($retour) { $display['msg'] .= display_ok_msg("$l_publication : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_publication : $l_update_error"); } $display['detail'] = dis_publication_consult($params); } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_publication_form($action, $params); } } elseif ($action == 'update_subscription') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_publication_data_subscription_form('', $params)) { $retour = run_query_publication_update_subscription($params); if ($retour) { $quit = " <script type=\"text/javascript\"> window.opener.location.href='".$params['ext_url']."'; window.close(); </script> "; $display['msg'] .= display_ok_msg("$l_subscription : $l_update_ok", false); $display['detail'] = $quit; } else { $display['msg'] .= display_err_msg("$l_subscription : $l_update_error"); } // Form data are not valid } else {
if ($params["contract_id"]) { $display["msg"] .= display_ok_msg("$l_contract : $l_insert_ok"); $display["detail"] = dis_contract_consult($params); } else { $display["msg"] .= display_err_msg("$l_contract : $l_insert_error"); } } } } else { $display["msg"] .= display_err_msg($err["msg"]); $display["detail"] = dis_contract_form($action, $params,""); } } elseif ($action == "update") { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_contract_form("", $params)) { $ret = run_query_contract_update($params); if ($ret) { $display["msg"] .= display_ok_msg("$l_contract : $l_update_ok"); } else { $display["msg"] .= display_err_msg("$l_contract : $l_update_error"); } $display["search"] = dis_contract_consult($params); } else { $display["msg"] .= display_err_msg($l_invalid_data. " : " . $err["msg"]); $display["detail"] = dis_contract_form($action, $params,""); } } elseif ($action == "check_delete") { /////////////////////////////////////////////////////////////////////////////// if (check_can_delete_contract($params["contract_id"])) {
if (check_user_defined_rules() && check_payment_data_form($params['payment_id'], $params)) { $retour = run_query_payment_update($params['payment_id'], $params); if ($retour) { $display['msg'] .= display_ok_msg("$l_payment : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_payment : $l_update_error"); } $display['detail'] = dis_payment_consult($params); } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_payment_form($action, $params); } } elseif ($action == 'invoice_update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_payment_invoice_data_form($params)) { $retour = run_query_payment_invoice_update($params['payment_id'], $params); if ($retour) { $display['msg'] .= display_ok_msg("$l_payment : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_payment : $l_update_error"); } $display['detail'] = dis_payment_consult($params); } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_payment_invoice($params); } } elseif ($action == 'check_delete') { /////////////////////////////////////////////////////////////////////////////// if (check_can_delete_payment($params['payment_id'])) {
} else { $display['msg'] .= display_err_msg("$l_group : $l_insert_error"); $display['search'] = html_group_search_form($params); } } } // Form data are not valid } else { $display['msg'] .= display_err_msg($err['msg']); $display['detail'] = html_group_form($action, '', $params, $err['field']); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_group_data_form($params)) { $retour = run_query_group_update($params); if ($retour) { // Set update state only if the update group is public $g = get_group_info($params['group_id']); if ($g['privacy'] == 0) { set_update_state(); } $display['msg'] .= display_ok_msg("$l_group : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_group : $l_update_error"); } $display['detail'] = dis_group_consult($params, $obm['uid']); } else { $display['msg'] .= display_err_msg($err['msg']); $params_q = run_query_group_detail($params['group_id']);
} $display['detail'] .= dis_todo_search_form($params); } else { $display['msg'] .= display_warn_msg($err['msg'], false); $display['msg'] .= display_warn_msg($l_cant_delete, false); $display['detail'] .= dis_todo_consult($params); } } else if ($action == 'detailupdate') { /////////////////////////////////////////////////////////////////////////////// $params_q = run_query_todo_detail($params); $display['detail'] = dis_todo_form($params, $params_q); } else if ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_todo_data_form($params)) { $retour = run_query_todo_update($params); if ($popup) { $display['result'] .= " <script language=\"javascript\"> window.opener.location.href=\"$path/todo/todo_index.php?action=index\"; window.close(); </script>"; } else { $display['detail'] = dis_todo_consult($params); } // Form data are not valid } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_todo_form($params);
$params['deal_id'] = run_query_deal_insert($params); if ($params['deal_id']) { $display['msg'] .= display_ok_msg("$l_deal : $l_insert_ok"); $display['detail'] = dis_deal_consult($params); } else { $display['msg'] .= display_err_msg("$l_deal : $l_insert_error : $err[msg]"); $display['search'] = dis_deal_index($params); } } else { $display['msg'] .= display_err_msg($err['msg']); $display['detail'] = dis_deal_form($params); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_deal_form('', $params)) { $retour = run_query_deal_update($params); if ($retour) { $display['msg'] .= display_ok_msg("$l_deal : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_deal : $l_update_error"); } $display['detail'] = dis_deal_consult($params); } else { $display['msg'] .= display_err_msg($err['msg']); $display['detail'] = dis_deal_form($params); } } elseif ($action == 'quick_update') { /////////////////////////////////////////////////////////////////////////////// if (check_deal_quick_form($params)) {
$display['msg'] = display_warn_msg($l_invalid_data . " : " . $err['msg']); $display['detail'] = html_profile_form($params); } } elseif ($action == 'detailconsult') { /////////////////////////////////////////////////////////////////////////////// $profile = run_query_profile_details($params['profile_id']); $display['detail'] = html_profile_consult($profile); } elseif ($action == 'detailupdate') { /////////////////////////////////////////////////////////////////////////////// $profile = run_query_profile_details($params['profile_id']); $display['detail'] = html_profile_form($profile); } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if(check_user_defined_rules() && check_profile_data_form($params)) { if (run_query_profile_update($params)) { $display['msg'] .= display_ok_msg("$l_profile : $l_update_ok"); $profile = run_query_profile_details($params['profile_id']); $display['detail'] = html_profile_consult($profile); } else { $display['msg'] .= display_err_msg("$l_profile : $l_update_error"); $display['detail'] = html_profile_form($params); } } else { $display['msg'] .= display_warn_msg($l_invalid_data . " : " . $err['msg']); $display['detail'] = html_profile_form($params); } } elseif ($action == 'check_delete') { ///////////////////////////////////////////////////////////////////////////////
require('account_js.inc'); $display['search'] = html_account_search_form($action, $params); $display['result'] = dis_account_search_list($params); } elseif ($action == 'new') { /////////////////////////////////////////////////////////////////////////////// if ($obm['profile'] != $perms_user) { require('account_js.inc'); $display['detail'] = html_account_form($obm_q_accounts, $action); } else { $display['msg'] = display_err_msg($l_error_permission); } } elseif ($action == 'insert') { /////////////////////////////////////////////////////////////////////////////// if(check_user_defined_rules()) { run_query_account_insert($params); $display['msg'] = display_ok_msg("$l_account : $l_insert_ok"); require('account_js.inc'); $display['search'] = html_account_search_form($action, $params); } else { $display['detail'] = html_account_form($obm_q_accounts, $action); $display['msg'] = display_err_msg($err); } } elseif ($action == 'detailconsult') { /////////////////////////////////////////////////////////////////////////////// require('account_js.inc'); if ($params['account_id'] > 0) { $ac_q = run_query_account_detail($params['account_id']); $display['detailInfo'] = display_record_info($ac_q);
$user_id = $params["user_id"]; $usr_q = run_query_userobm($user_id); if ($usr_q->next_record()) { organizationalchart_json_event($usr_q); echo "({".$display['json']."})"; exit(); } else { exit(); } } elseif ($action == "detailupdate") { /////////////////////////////////////////////////////////////////////////////// $display["detail"] = dis_organizationalchart_form($action, $params); } elseif ($action == "update") { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_organizationalchart_data_form($params)) { $retour = run_query_organizationalchart_update($params["organizationalchart_id"], $params); if ($retour) { $display["msg"] .= display_ok_msg("$l_organizationalchart : $l_update_ok"); } else { $display["msg"] .= display_err_msg("$l_organizationalchart : $l_update_error"); } $display["detail"] = dis_organizationalchart_consult($params, $view); } else { $display["msg"] .= display_warn_msg($l_invalid_data . " : " . $err["msg"]); $display["detail"] = dis_organizationalchart_form($action, $params); } } elseif ($action == "export_ldif") { /////////////////////////////////////////////////////////////////////////////// dis_organizationalchart_export_ldif($params);