×

Notice

The forum is in read only mode.

Add function to saveResume

14 years 6 months ago - 14 years 5 months ago #1235 by Tartuffe
Hi,
Could you tell me in witch file I can add a function when a jobseeker saves his resume ?
I explain my question.
I would like to add fields\' values in an other table in database.
I looked file /components/com_jsjobs/models/jsjobs.php to find sql query \'INSERT TO\" js_job_resume but I don\'t kwon where add my code.

Could you help me please ?
Thanks a lot!
Best regards
Matine44
14 years 6 months ago #1242 by Ahmad
Replied by Ahmad on topic Add function to saveResume
Function storeResume

after $row->store(); before return you add your code.

Please write your valuable review JS Jobs and JS Support Ticket at JED.
14 years 6 months ago #1245 by Tartuffe
Replied by Tartuffe on topic Add function to saveResume
Hi and thanks for your response;

Is that here :

[PHP]
if (!$row->store())
{
$this->setError($this->_db->getErrorMsg());
return false;
}
//My code here
[/PHP]
14 years 6 months ago #1246 by Ahmad
Replied by Ahmad on topic Add function to saveResume
Yes

Please write your valuable review JS Jobs and JS Support Ticket at JED.
14 years 6 months ago #1249 by Tartuffe
Replied by Tartuffe on topic Add function to saveResume
Hi,

I tried this code :
		//Ajout pour enregistrement du cv dans jos_js_job_minicv
			
		$db->setQuery(\"SELECT application_title, iamavailable, date_start, job_category, jobsalaryrange,jobtype,employer,employer_position, employer_to_date, employer_leave_reason,heighestfinisheducation,total_experience,license_country,create_date FROM jos_js_job_resume WHERE uid = $uid\");
	
		$minicv = $db->loadObject() or die(\'Erreur SQL recup jos_js_job_resume<br>\'.$query.\'<br>\'.mysql_error());
		
		//$id_candidat = $minicv->uid;
		//$profil_candidat = $minicv->application_title;
		$disponibilite_candidat = $minicv->iamavailable;
		$date_disponibilite_candidat = $minicv->date_start;
		$secteur_candidat = $minicv->job_category;
		$type_contrat_candidat = $minicv->jobtype;
		$dernier_employeur_candidat = $minicv->employer;
		$dernier_poste_candidat = $minicv->employer_position;
		$date_fin_contrat_candidat = $minicv->employer_to_date;
		$raison_fin_contrat_candidat = $minicv->employer_leave_reason;
		$etudes_candidat = $minicv->heighestfinisheducation;
		$experience_candidat = $minicv->total_experience;
		$mobilite_candidat = $minicv->license_country;
		$time_date = $minicv->create_date;

		echo $time_date;
		echo \'<br/>\';
		echo $profil_candidat;
		echo \'<br/>\';
		echo $disponibilite_candidat;
		echo \'<br/>\';
		echo $date_disponibilite_candidat;
		echo \'<br/>\';
		echo $secteur_candidat;
		echo \'<br/>\';
		echo $type_contrat_candidat;
		echo \'<br/>\';
		echo $etudes_candidat;
		echo \'<br/>\';
		echo $dernier_employeur_candidat;
		echo \'<br/>\';
		echo $dernier_poste_candidat;
		echo \'<br/>\';
		echo $date_fin_contrat_candidat;
		echo \'<br/>\';
		echo $raison_fin_contrat_candidat;
		echo \'<br/>\';
		echo $experience_candidat;
		echo \'<br/>\';
		echo $mobilite_candidat;
		echo \'<br/>\';
		echo $id_candidat;
		
		//recuperation du secteur activite
		$query = \"SELECT cat_title FROM jos_js_job_categories WHERE id=$secteur_candidat\";
		$db->setQuery ($query);
		//$db->setQuery(\"SELECT cat_title FROM jos_js_job_categories WHERE id=$secteur_candidat\");
		$activite_candidat = $db->loadResult() or die(\'Erreur SQL recup secteur activite<br>\'.$query.\'<br>\'.mysql_error());

		//recuperation du type contrat
		$query = \"SELECT title FROM jos_js_job_jobtypes WHERE id=$type_contrat_candidat\";
		$db->setQuery ($query);
		//$db->setQuery(\"SELECT title FROM jos_js_job_jobtypes WHERE id=$type_contrat_candidat\");
		$contrat_candidat = $db->loadResult() or die(\'Erreur SQL type contrat!<br>\'.$query.\'<br>\'.mysql_error());

		//recuperation du niveau etudes
		$query = \"SELECT title FROM jos_js_job_heighesteducation WHERE id=$etudes_candidat\";
		$db->setQuery ($query);
		//$db->setQuery(\"SELECT title FROM jos_js_job_heighesteducation WHERE id=$etudes_candidat\");
		$niveau_etudes_candidat = $db->loadResult() or die(\'Erreur SQL niveau etudes!<br>\'.$query.\'<br>\'.mysql_error());

		//recuperation de experience totale
		$query = \"SELECT title FROM jos_js_job_experience WHERE id=$experience_candidat\";
		$db->setQuery ($query);
		//$db->setQuery(\"SELECT title FROM jos_js_job_experience WHERE id=$experience_candidat\");
		$total_experience_candidat = $db->loadResult() or die(\'Erreur SQL total experience!<br>\'.$query.\'<br>\'.mysql_error());

		echo $activite_candidat;
		echo \'<br/>\';
		echo $contrat_candidat;
		echo \'<br/>\';
		echo $niveau_etudes_candidat;
		echo \'<br/>\';
		echo $total_experience_candidat;
		echo \'<br/>\';

		//insertion des donnees dans la table jos_js_job_minicv
		$query = \"INSERT INTO jos_js_job_minicv (time_date, profil_candidat, disponibilite_candidat, date_disponibilite_candidat, secteur_candidat, type_contrat_candidat, niveau_etudes_candidat, dernier_employeur_candidat, dernier_poste_candidat, date_fin_contrat_candidat, raison_fin_contrat_candidat, experience_candidat, mobilite_candidat, id_candidat) VALUES (\'$time_date\', \'$profil_candidat\', \'$disponibilite_candidat\', \'$date_disponibilite_candidat\', \'$activite_candidat\', \'$contrat_candidat\', \'$niveau_etudes_candidat\', \'$dernier_employeur_candidat\', \'$dernier_poste_candidat\', \'$date_fin_contrat_candidat\', \'$raison_fin_contrat_candidat\', \'$total_experience_candidat\', \'$mobilite_candidat\', \'$id_candidat\')\";
		$db->setQuery ($query);
		//$db->setQuery(\"INSERT INTO jos_js_job_minicv (time_date, profil_candidat, disponibilite_candidat, date_disponibilite_candidat, secteur_candidat, type_contrat_candidat, niveau_etudes_candidat, dernier_employeur_candidat, dernier_poste_candidat, date_fin_contrat_candidat, raison_fin_contrat_candidat, experience_candidat, mobilite_candidat, id_candidat) VALUES (\'$time_date\', \'$profil_candidat\', \'$disponibilite_candidat\', \'$date_disponibilite_candidat\', \'$activite_candidat\', \'$contrat_candidat\', \'$niveau_etudes_candidat\', \'$dernier_employeur_candidat\', \'$dernier_poste_candidat\', \'$date_fin_contrat_candidat\', \'$raison_fin_contrat_candidat\', \'$total_experience_candidat\', \'$mobilite_candidat\', \'$id_candidat\')\");

		$db->query() or die(\'Erreur SQL jos_js_job_minicv!<br>\'.$query.\'<br>\'.mysql_error());

		//Fin ajout

But I have an error at this line :
$db->setQuery(\"SELECT application_title, iamavailable, date_start, job_category, jobsalaryrange,jobtype,employer,employer_position, employer_to_date, employer_leave_reason,heighestfinisheducation,total_experience,license_country,create_date FROM jos_js_job_resume WHERE uid = $uid\");

Sql error is :

Fatal error: Call to a member function setQuery() on a non-object in C:\\wamp\\www\\Joomla_1.5.15-FR\\components\\com_jsjobs\\models\\jsjobs.php on line 2703


I don\'t see where is my mistake, could you help me please ?

Thanks
Matine44
14 years 6 months ago #1252 by Ahmad
Replied by Ahmad on topic Add function to saveResume
This is sample query
		$db =& JFactory::getDBO();
		$resumequery = \"SELECT * FROM \".$db->nameQuote(\'#__js_job_resume\') .\" WHERE uid = \".$uid;
				$db->setQuery( $resumequery );
				$resume = $db->loadObject();
				if ( isset($resume) ){
echo $resume->title;
				}


Please write your valuable review JS Jobs and JS Support Ticket at JED.
Time to create page: 0.064 seconds

Please publish modules in offcanvas position.