Enable "view all" button to grouped sms sent to more than 1 user

into file: /plugin/feature/report/user_outgoing.php change as described and youu’ll see "view all (2, 3 or different number deoending on how many destinations you sent one sms!)

//FIX to group all sametime sent SMS to different destinations to ENABLE GROUP in sent sms withlink:“view all”
//
//into file: /plugin/feature/report/user_outgoing.php
//
//////////////////////////////////////////
//
// FROM:
//
//////////////////////////////////////////

case "user_outgoing":
	$search_category = array(
		_('Time') => 'p_datetime',
		_('To') => 'p_dst',
		_('Message') => 'p_msg',
		_('Footer') => 'p_footer' 
	);
	
	$base_url = 'index.php?app=main&inc=feature_report&route=user_outgoing&op=user_outgoing';
	$queue_label = "";
	$queue_home_link = "";
	
	if ($queue_code = trim($_REQUEST['queue_code'])) {
		$queue_label = "<h4>" . sprintf(_('List of queue %s'), $queue_code) . "</h4>";
		$queue_home_link = _back($base_url);
		$base_url .= '&queue_code=' . $queue_code;
		$search = themes_search($search_category, $base_url);
		$conditions = array(
			'A.queue_code' => $queue_code,
			'A.uid' => $user_config['uid'],
			'A.flag_deleted' => 0 
		);
		$keywords = $search['dba_keywords'];
		$table = _DB_PREF_ . '_tblSMSOutgoing';
		$join = "INNER JOIN " . _DB_PREF_ . "_tblUser AS B ON B.flag_deleted='0' AND A.uid=B.uid";
		$count = dba_count($table . ' AS A', $conditions, $keywords, '', $join);
		$nav = themes_nav($count, $search['url']);
		$extras = array(
			'ORDER BY' => 'A.smslog_id DESC',
			'LIMIT' => $nav['limit'],
			'OFFSET' => $nav['offset'] 
		);
		$list = dba_search($table . ' AS A', 'A.smslog_id, A.p_dst, A.p_sms_type, A.p_msg, A.p_footer, A.p_datetime, A.p_update, A.p_status, A.uid, A.queue_code', $conditions, $keywords, $extras, $join);
	} else {
		$search = themes_search($search_category, $base_url);
		$conditions = array(
			'A.uid' => $user_config['uid'],
			'A.flag_deleted' => 0 
		);
		$keywords = $search['dba_keywords'];
		$table = _DB_PREF_ . '_tblSMSOutgoing';
		$join = "INNER JOIN " . _DB_PREF_ . "_tblUser AS B ON B.flag_deleted='0' AND A.uid=B.uid";
		$list = dba_search($table . ' AS A', 'A.id', $conditions, $keywords, array(
			'GROUP BY' => 'A.queue_code, A.id'
		), $join);
		$count = count($list);
		$nav = themes_nav($count, $search['url']);
		$extras = array(
			'GROUP BY' => 'A.queue_code, A.id',
			'ORDER BY' => 'A.smslog_id DESC',
			'LIMIT' => $nav['limit'],
			'OFFSET' => $nav['offset'] 
		);
		$list = dba_search($table . ' AS A', 'A.smslog_id, A.p_dst, A.p_sms_type, A.p_msg, A.p_footer, A.p_datetime, A.p_update, A.p_status, A.uid, A.queue_code, COUNT(*) AS queue_count', $conditions, $keywords, $extras, $join);
	}
	
	$content = _dialog() . "

////////////////////////////////////////////////////////////////////////////
//
// TO:
//
////////////////////////////////////////////////////////////////////////////

case "user_outgoing":
	$search_category = array(
	_('Gateway') => 'p_gateway',
	_('SMSC') => 'p_smsc',
	_('Time') => 'p_datetime',
	_('To') => 'p_dst',
	_('Message') => 'p_msg',
	_('Footer') => 'p_footer',
	_('Queue') => 'queue_code',
	);
	
	$base_url = 'index.php?app=main&inc=feature_report&route=user_outgoing&op=user_outgoing';
	$queue_label = "";
	$queue_home_link = "";
	
	$table = _DB_PREF_ . "_tblSMSOutgoing AS A";
	$fields = "B.username, A.p_gateway, A.p_smsc, A.smslog_id, A.p_dst, A.p_sms_type, A.p_msg, A.p_footer, A.p_datetime, A.p_update, A.p_status, B.uid, A.queue_code";
	$conditions = [
		'B.uid' => $_SESSION['uid'],
		'A.flag_deleted' => 0,		];
	$extras = [];
	
	if ($queue_code = trim($_REQUEST['queue_code'])) {
		$conditions['A.queue_code'] = $queue_code;
		$queue_label = "<p class=lead>" . sprintf(_('List of queue %s'), $queue_code) . "</p>";
		$queue_home_link = _back($base_url);
		$base_url .= '&queue_code=' . $queue_code;
	} else {
		$fields .= ", COUNT(A.queue_code) AS queue_count";
		$extras['GROUP BY'] = "A.queue_code";
	}
	
	$search = themes_search($search_category, $base_url);
	$keywords = $search['dba_keywords'];
	$extras['ORDER BY'] = "A.smslog_id DESC";
	$join = "INNER JOIN " . _DB_PREF_ . "_tblUser AS B ON A.uid=B.uid AND A.flag_deleted=B.flag_deleted";
	$list = dba_search($table, $fields, $conditions, $keywords, $extras, $join);

	$nav = themes_nav(count($list), $search['url']);
	$extras['LIMIT'] = $nav['limit'];
	$extras['OFFSET'] = $nav['offset'];
	$list = dba_search($table, $fields, $conditions, $keywords, $extras, $join);

	$content = _dialog() . "

////////////////////////////////////////////////////////////////////////////////////////////////////

all works as on playsms 1.5.0 b5 where view all button is enabled and working!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.