function btn_delete($id = 0) { global $db, $messageStack; validate_security($this->security_id, 4); // OK to delete $result = $db->Execute("select description from " . $this->db_table . " where kt_id = '" . $id . "'"); $db->Execute("delete from " . $this->db_table . " where kt_id = '" . $id . "'"); gen_add_audit_log(SETUP_TAX_AUTHS_LOG . TEXT_DELETE, $result->fields['description']); return true; }
function btn_delete($id = 0) { global $db, $messageStack; validate_security($this->security_id, 4); // Don't allow delete if there is account activity for this account $sql = "select max(debit_amount) as debit, max(credit_amount) as credit, max(beginning_balance) as beg_bal \n\t\tfrom " . TABLE_CHART_OF_ACCOUNTS_HISTORY . " where account_id = '" . $this->gl_acct_id . "'"; $result = $db->Execute($sql); if ($result->fields['debit'] != 0 || $result->fields['credit'] != 0 || $result->fields['beg_bal'] != 0) { $messageStack->add(GL_ERROR_CANT_DELETE, 'error'); return false; } // OK to delete $result = $db->Execute("select description from " . $this->db_table . " where till_id = '" . $id . "'"); $db->Execute("delete from " . $this->db_table . " where till_id = '" . $id . "'"); gen_add_audit_log(SETUP_TAX_AUTHS_LOG . TEXT_DELETE, $result->fields['description']); return true; }
if ($_POST['crm_action'] != '' || $_POST['crm_note'] != '') { $sql_data_array = array('contact_id' => $cInfo->id, 'log_date' => $_POST['crm_date'], 'entered_by' => $_POST['crm_rep_id'], 'action' => $_POST['crm_action'], 'notes' => db_prepare_input($_POST['crm_note'])); db_perform(TABLE_CONTACTS_LOG, $sql_data_array, 'insert'); } $_REQUEST['action'] = 'main'; break; } $_REQUEST['action'] = 'edit'; break; case 'edit': case 'properties': $cInfo->getContact(); break; case 'delete': case 'crm_delete': validate_security($security_level, 4); $short_name = gen_get_contact_name($cInfo->id); $temp = $cInfo->delete(); if ($temp == true) { gen_add_audit_log(TEXT_CONTACTS . '-' . TEXT_DELETE . '-' . constant('ACT_' . strtoupper($type) . '_TYPE_NAME'), $short_name); } else { $error = $messageStack->add($temp, 'error'); } break; case 'download': $cID = db_prepare_input($_POST['id']); $imgID = db_prepare_input($_POST['rowSeq']); $filename = 'contacts_' . $cID . '_' . $imgID . '.zip'; if (file_exists(CONTACTS_DIR_ATTACHMENTS . $filename)) { require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup();