×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Wrong link to Event in JEvents

Wrong link to Event in JEvents 12 years 8 months ago #15673

  • Volkmar Miehling
  • Volkmar Miehling's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
I put up a connection to JEvents (latest version) and see the comments work great.

But I have one problem:
There is a comment for a certain Event. Now I have set up the module to show the latest comments for JEvents on the calendar page.

So far so good, but when I click on "more" on a certain comment showing in the module another event opens up (its always the same event) but this event has no comment, I think by clicking "more" in the latest comments module it should open the event which belongs to this comment.

Is there a way to fix this?

Thanks in advance.

Re: Wrong link to Event in JEvents 12 years 8 months ago #15712

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hm, that is really strange. Are those events repeating or normal?

Kind regards,
Daniel

Re: Wrong link to Event in JEvents 12 years 8 months ago #15716

  • Volkmar Miehling
  • Volkmar Miehling's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
This is a normal event.
Curious is that the link in the backend is ok and goes to the right Event.

Re: Wrong link to Event in JEvents 12 years 8 months ago #15718

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Volkmar,
Would you mind providing me with ftp and user access to your site? I can't replicate the issue on my developer machine and I'll have to look directly at your site.
Please start a new private ticket and provide me with the data needed to access the site and figure out + fix the issue.

Regards,
Daniel

Re: Wrong link to Event in JEvents 12 years 8 months ago #15727

  • Volkmar Miehling
  • Volkmar Miehling's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
Done.
If you need something else just let me know!

Thanks in advance!

Re: Wrong link to Event in JEvents 12 years 8 months ago #15768

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
The problem is already fixed for Volkmar and I want to share the solution for those of you that have it. (this is already fixed in the dev. code and it will be part of the next version).

the thing is that jevents has repeating events. The object that holds the information for the particular event has 2 properties -> ev_id and rp_id. rp_id is used when we have repeating events. We didn't take this into an account and our component was always reading the id out of ev_id, but for repeating events the ev_id is the same - where the rp_id is different. first change is in administrator\components\com_comment\plugin\com_jevents\josc_com_jevents.php
function output($row , $params) {
    if($row->_ev_id != $row->_rp_id) {
        $row->_ev_id = $row->_rp_id;
    }
	$comObject = JOSC_utils::ComPluginObject('com_jevents',$row);
	return  JOSC_utils::execJoomlaCommentPlugin($comObject, $row, $params, true);
 
}

with that code:
if($row->_ev_id != $row->_rp_id) {
$row->_ev_id = $row->_rp_id;
}
we check if we have different rp_id -> this means that we are dealing with a repeating event and we set this as the id of the item that we are interested in.

Next change is in:
administrator\components\com_comment\plugin\com_jevents\josc_com_jevents.class.php
public function getAlias($id) {
		$db = JFactory::getDBO();
		$query = 'SELECT summary FROM ' . $db->nameQuote('#__jevents_vevdetail') . ' AS vev '
                . ' WHERE vev.evdet_id = (
                        SELECT eventid
                        FROM ' . $db->nameQuote('#__jevents_repetition')
                .  ' WHERE rp_id = ' . $db->Quote($id) . ')';
		$db->setQuery($query, 0, 1);
		return $db->loadObject()->summary;
	}
and
	function mod_commentsGetOthersQuery($secids, $catids, $maxlines, $orderby) {
		$database = JFactory::getDBO();
 
		$limit = $maxlines >= 0 ? " limit $maxlines " : "";
 
		$where = array();
		if ($catids)
			$where[] = $this->componentCategoryTable . ".id IN ($catids)";
 
		if ($orderby == 'mostrated') {
			$mostrated = ", (c.voting_yes-c.voting_no)/2 AS mostrated";
			$where[] = "(c.voting_yes > 0 OR c.voting_no > 0)";
		} else {
			$mostrated = "";
			$orderby = "c.$orderby";
		}
 
		/*
		 * TODO: restrict according to user rights, dates and category/secitons published and dates...
		 */
 
 
		$query = "SELECT c.*, rep.eventid, ct." . $this->componentTableFieldTitle . " AS ctitle $mostrated "
				. "\n FROM `#__comment`    AS c "
				. "\n LEFT JOIN " . $database->nameQuote('#__jevents_repetition') . " AS rep ON rep.rp_id = c.contentid "
				. "\n LEFT JOIN " . $database->nameQuote($this->componentTable) . "    AS ct  ON ct.evdet_id = rep.eventid "
				. "\n WHERE c.published='1' "
				. "\n  AND c.component='$this->component' "
				. "\n " . (count($where) ? (" AND " . implode(" AND ", $where)) : "")
				. "\n ORDER BY $orderby DESC "
				. "\n $limit"
		;
		$database->SetQuery($query);
		$rows = $database->loadAssocList();
 
		return $rows;
	}

As you can see we go always trough the repetition table to get the proper ev_id for the event. If we don#t have the proper ev_id we cannot produce correct urls.

This is all for now :)
Cheers,
Daniel
The following user(s) said Thank You: Volkmar Miehling

Re: Wrong link to Event in JEvents 12 years 8 months ago #15771

  • Volkmar Miehling
  • Volkmar Miehling's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
Daniel,

thank you very much for the fix and the explanation!


Volkmar
  • Page:
  • 1
Time to create page: 0.107 seconds