Jump to content

Exclude custom "trigger" for "never expires plan"


claudio taragnolini

Recommended Posts

Hi,

 

i did a customization in order to integrate Jevents/RSVP Booking system with jreview.

So like now user will so a button in jreview listing "Book" and when the first user click them, a new entry is created in jevents/RSVP in order to create a events with same title, start and end date. On this way the owner of the listing will be able to manage his participants in RSVP Page.

 

But, exist many plans, so i need to manage the "end date" update when the plan is a "Renew" and its okay.

The problem is only when the plan is a "Addon" that has a "never expires" features.

Infact, my actual code in order to update the date is:

 

function changeExpire($orderid)

{

$db = JFactory::getDBO();

$query = "SELECT listing_id, order_expires FROM #__jreviews_paid_orders WHERE order_id=".$orderid;

$db->setQuery($query);

$orderdata = $db->loadObject();

$expires = strtotime($orderdata->order_expires);

$query = "Select ev_id FROM #__jevents_vevent WHERE article_id=".$orderdata->listing_id;

$db->setQuery($query);

$evid = $db->loadResult();

if($evid && $expires!="0000-00-00")

{

$query = "UPDATE #__jevents_vevdetail SET dtend=".$expires." WHERE evdet_id=".$evid;

$db->setQuery($query);

$db->query();

$query = "UPDATE #__jevents_repetition SET endrepeat='".$orderdata->order_expires."' WHERE eventid=".$evid;

$db->setQuery($query);

$db->query();

$query = "UPDATE #__jev_attendance SET regclose='".$orderdata->order_expires."',cancelclose='".$orderdata->order_expires."' WHERE ev_id=".$evid;

$db->setQuery($query);

$db->query();

$query = "UPDATE #__content SET state=1 WHERE id=".$orderdata->listing_id;

$db->setQuery($query);

$db->query();

}

}

//Editing ends

 

But, i am not able to exclude by the date "0000-00-00", i also changed to "0000-00-00 00:00:00" but also on this way they trigger start and change the "end date" of RSVP with the minimum possible in joomla.

 

I don't understand how can i do to exclude the "add-on listing" from this trigger...

 

Thanks

Link to comment
×
×
  • Create New...