×

Notice

The forum is in read only mode.

Can't delete resume search

13 years 11 months ago #1329 by Tartuffe
Hi,
When I would like to delete a resumesearch it does't work.

In my file my_resumesearches.php I have this link to execute function :

<td class="maintext" align="center" valign="middle">
<a href="index.php?option=com_jsjobs&c=jsjobs&task=deleteresumesearch&bd=<?php echo $search->id; ?>">
<img width="15" height="15" src="components/com_jsjobs/images/delete.png" /></a>
</td>


In my file /controllers/jsjobs.php I have this code :
function deleteresumesearch() //delete resume search
	{
		global $mainframe;

		$model = $this->getModel('jsjobs', 'JSJobsModel');
		$session = &JFactory::getSession();
		$user	=& JFactory::getUser();
		$uid=$user->id;
		$params = & $mainframe->getPageParameters('com_jsjobs');
		$Itemid =  JRequest::getVar('Itemid');
		$params = & $mainframe->getPageParameters('com_jsjobs');
		$data = JRequest :: get('post');
		$link = 'index.php?option=com_jsjobs&c=jsjobs&view=employer&layout=my_resumesearches&Itemid='.$Itemid;
		$searchid =  JRequest::getVar('rs');
		$return_value = $model->deleteResumeSearch($searchid, $uid);

		if ($return_value == 1)	{
			$msg = JText :: _('JS_SEARCH_DELETED');
		}elseif ($return_value == 2){
			$msg = JText :: _('JS_NOT_YOUR_SEARCH');
		}else{
			$msg = JText :: _('JS_ERROR_DELETING_SEARCH');
		}
		$this->setRedirect($link, $msg);
		//$this->setRedirect(JRoute::_($link), $msg);
	}
And in file /models/jsjobs.php this one :
function deleteResumeSearch($searchid, $uid)
	{
		
		$db = &$this->getDBO();
		$row = &$this->getTable('resumesearch');
		if (is_numeric($searchid) == false) return false;

		$query = "SELECT COUNT(search.id) FROM ".$db->nameQuote('#__js_job_resumesearches')." AS search  
					WHERE search.id = ".$searchid." AND search.uid = ".$uid;
		//echo '<br> SQL '.$query;
		$db->setQuery($query);
		$searchtotal = $db->loadResult();
		
		if ($searchtotal > 0){ // this search is same user
		
			if (!$row->delete($searchid))
			{
				$this->setError($row->getErrorMsg());
				return false;
			}
		}else return 2;	

		return true;
	}

But when I click on image, nothing happens !!!
Could you help me please ?

Thanks a lot & Best regards
Matine44
13 years 11 months ago #1332 by Ahmad
Replied by Ahmad on topic Can't delete resume search
1-Change link
<td class="maintext" align="center" valign="middle">
<a href="index.php?option=com_jsjobs&c=jsjobs&task=deleteresumesearch&rs=<?php echo $search->id; ?>">
<img width="15" height="15" src="components/com_jsjobs/images/delete.png" /></a>
</td>

2-Update controller method
function deleteresumesearch() //delete resume search
{
global $mainframe;

$model = $this->getModel('jsjobs', 'JSJobsModel');
$user =& JFactory::getUser();
$uid=$user->id;
$Itemid =  JRequest::getVar('Itemid');
$link = 'index.php?option=com_jsjobs&c=jsjobs&view=employer&layout=my_resumesearches&Itemid='.$Itemid;
$searchid =  JRequest::getVar('rs');
$return_value = $model->deleteResumeSearch($searchid, $uid);

if ($return_value == 1) {
$msg = JText :: _('JS_SEARCH_DELETED');
}elseif ($return_value == 2){
$msg = JText :: _('JS_NOT_YOUR_SEARCH');
}else{
$msg = JText :: _('JS_ERROR_DELETING_SEARCH');
}
$this->setRedirect($link, $msg);
//$this->setRedirect(JRoute::_($link), $msg);
}

Please write your valuable review JS Jobs and JS Support Ticket at JED.
13 years 11 months ago #1338 by Tartuffe
Replied by Tartuffe on topic Can't delete resume search
Hi Ahmad !
It works... thanks a lot!

Best regards
Matine44
Time to create page: 0.073 seconds

Please publish modules in offcanvas position.