function cw_accounting_assign_info(&$record) { global $tables; $record['attachements'] = cw_file_area_get_list('accounting_records_files', $record['accounting_record_id']); if ($record['reference']) { $ref_types = array('O' => array('target' => 'orders', 'tbl' => 'docs'), 'P' => array('target' => 'supplier_orders', 'tbl' => 'docs')); $record['reference_data']['url'] = 'index.php?target=' . $ref_types[$record['reference_type']]['target'] . '&mode=details&doc_id=' . $record['reference']; $record['reference_data']['display_id'] = cw_query_first_cell($sql = "select display_id from " . $tables[$ref_types[$record['reference_type']]['tbl']] . " where doc_id='{$record['reference']}'"); } }
function cw_faq_get_article($id, $lang = '', $full_info = true, $only_active = true) { global $tables, $var_dirs, $var_dirs_web; global $current_language; if (!$lang) { $lang = $current_language; } $data = cw_query_first("select {$tables['faq_questions']}.*, IF({$tables['faq_questions_lng']}.question_id != '', {$tables['faq_questions_lng']}.thema, {$tables['faq_questions']}.thema) as thema, IF({$tables['faq_questions_lng']}.question_id != '', {$tables['faq_questions_lng']}.content, {$tables['faq_questions']}.content) as content from {$tables['faq_questions']} left join {$tables['faq_questions_lng']} on {$tables['faq_questions']}.question_id={$tables['faq_questions_lng']}.question_id and {$tables['faq_questions_lng']}.code='{$lang}' where {$tables['faq_questions']}.question_id='{$id}'" . ($only_active ? ' and active=1' : '')); if (!$data) { return false; } if ($full_info) { $data['related'] = cw_query("select {$tables['faq_questions']}.question_id from {$tables['faq_questions']} where {$tables['faq_questions']}.active=1 and {$tables['faq_questions']}.rubrik_id = '" . $data['rubrik_id'] . "' and {$tables['faq_questions']}.question_id != '{$id}' order by {$tables['faq_questions']}.date desc"); if ($data['related']) { foreach ($data['related'] as $k => $v) { $data['related'][$k] = cw_faq_get_article($v['question_id'], $lang, false, true); } } $data['comments'] = cw_query("select email, comment from {$tables['faq_comments']} WHERE question_id = '{$id}'"); } $data['files'] = cw_file_area_get_list('faq_files', $id); $data['votes'] = cw_faq_get_votes($id); $data['views'] = cw_faq_get_views($id); $data['faq_show_ratings'] = true; return $data; }
function cw_user_get_generated_docs($user, $where = '') { global $tables; cw_load('file_area'); return cw_file_area_get_list('customers_generated_docs', $user, $where); }