array_push($array_m_push_update, $push_data_array); unset($push_data_array); $delete_record_count += 1; } update_m_push($array_m_push_update, 'update'); unset($array_m_push_update); $array_m_push_update = array(); } } //end of delete fp_pe //echo "<br /><br />"; //print_r($new_entry); //echo "3rd <br /><br />"; //echo "TABLE $new_entry[4]"; $new_id = ''; $insert_text = insert_values($new_entry, $new_id); if ($new_entry[4] == 'm_consult_notes_complaint' || $new_entry[4] == 'm_consult_notes_dxclass') { if ($new_entry[4] == 'm_consult_notes_complaint') { $check_sql = mysql_query("SELECT * FROM {$new_entry['4']} WHERE notes_id = '{$new_entry['7']}' AND consult_id = '{$new_entry['7']}' AND complaint_id ='{$new_entry['10']}'") or die("Error 229 : " . mysql_error()); $insert_text = "'" . $new_entry[7] . "','" . $new_entry[8] . "','" . $new_entry[9] . "','" . $new_entry[10] . "','" . $new_entry[11] . "','" . $new_entry[12] . "','" . $new_entry[13] . "'"; } else { $check_sql = mysql_query("SELECT * FROM {$new_entry['4']} WHERE notes_id = '{$new_entry['7']}' AND consult_id = '{$new_entry['7']}' AND class_id ='{$new_entry['10']}'") or die("Error 229 : " . mysql_error()); $insert_text = "'" . $new_entry[7] . "','" . $new_entry[8] . "','" . $new_entry[9] . "','" . $new_entry[10] . "','" . $new_entry[11] . "','" . $new_entry[12] . "','" . $new_entry[13] . "'"; } if (mysql_num_rows($check_sql) == 0) { //echo "BADBAD". $insert_text; insert_query($insert_text, $new_entry[4]); } /* lite_connect($_POST['sync_user']); $where_clause = "notes_id = '$new_entry[2]' AND patient_id = '$new_entry[0]'";
$spotted = str_truncate($spotted, 1000, '...'); insert_row('spotted', [new DBCol('spotted_datetime', 'NOW()', '-'), new DBCol('spotted_message', $spotted, 's'), new DBCol('spotted_chat_id', $update['message']['chat']['id'], 'd'), new DBCol('spotted_approved', 0, '-')]); refresh_admin_keyboard($update['message']['chat']['id'], $spotted, $first_name, $last_name, $username); $spotters = query_value("SELECT COUNT(*) as count FROM {$T('spotter')}", 'count'); apiRequest('sendMessage', ['chat_id' => $update['message']['chat']['id'], 'text' => sprintf(_("Il messaggio\n<code>" . $spotted . "</code>\ne' stato acquisito ed ora è in coda di moderazione per esser mandato a <b>%d</b> persone.\n"), $spotters), 'parse_mode' => 'HTML']); } } elseif (is_command($text, 'Pubblica')) { $spotted_ID = (int) trim(str_replace('Pubblica', '', $text)); if ($spotted_ID) { query(sprintf("UPDATE {$T('spotted')} " . "SET " . "spotted_approved = 1 " . "WHERE " . "spotted_ID = %d", $spotted_ID)); $spotters = query_results("SELECT spotter_ID FROM {$T('spotter')}", 'Spotter'); $fifo_rows = []; foreach ($spotters as $spotter) { $fifo_rows[] = [$spotted_ID, $spotter->spotter_ID]; } insert_values('fifo', ['spotted_ID' => 'd', 'spotter_ID' => 'd'], $fifo_rows); } refresh_admin_keyboard($update['message']['chat']['id'], "Messaggio pubblicato"); } elseif (is_command($text, 'Elimina')) { $spotted_ID = (int) trim(str_replace("Elimina", '', $text)); $spotted_ID && query(sprintf("DELETE FROM {$T('spotted')} WHERE spotted_ID = %d", $spotted_ID)); refresh_admin_keyboard($update['message']['chat']['id'], "Messaggio eliminato"); } elseif (is_command($text, '/help')) { $text = ltrim(str_replace('/help', '', $text)); if (strlen($text) === 0) { apiRequest('sendMessage', ['chat_id' => $update['message']['chat']['id'], 'text' => _("Per inviare un messaggio ai programmatori, scrivi <code>/help messaggio</code>.\n" . "(Es. /help Salve, non riesco a mandare uno spot perche'...)"), 'parse_mode' => 'HTML']); } else { apiRequest('sendMessage', ['chat_id' => WANZO, 'text' => _("E' stato richiesto un help con messaggio: " . $text . "\nDa: " . $first_name . " " . $last_name . " @" . $username . " " . $chat_id), 'parse_mode' => 'HTML']); } } elseif (is_command($text, '/messaggio')) { $text = ltrim(str_replace('/messaggio', '', $text));
function insert_picklist_table($picklist) { global $adb; $picklist_uniqueid = $adb->getUniqueID("vtiger_picklist"); $adb->query("insert into vtiger_picklist values('{$picklist_uniqueid}','{$picklist}')"); insert_values($picklist, $picklist_uniqueid); }