-
AuthorPosts
-
timmieboy Friend
timmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
May 8, 2014 at 8:27 am #197515Hello,
I have a test account with enough jobs in it but when I add a job from the backend it tells me this: This user does not have enough the Standard posts amount. What seems to be the problem.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 12, 2014 at 4:00 am #534560As per my reply posted here, JA Jobboard has an issue with checking job posting left function.
In that post, the code only helps to fix for front-end. To get it fixed for back-end, please try solution below:Open the file:
administrator/components/com_jajobboard/models/jajobs.phpFind the code snippet:
[PHP]function checkPostingAmount($value, $user_id)
{
global $jbconfig;
$db = JFactory::getDbo();
$query = ‘SELECT * FROM #__ja_employers WHERE user_id=’ . $db->Quote($user_id);
$db->setQuery($query);
$employer = $db->loadObject();if ($employer && $employer->standard_posts_balance == 0 && $value == ‘0’ && $jbconfig[‘billing’]->get(‘posting_fee_enabled’, 0)) {
return false;
} elseif ($employer && $employer->premium_posts_balance == 0 && $value == ‘1’ && $jbconfig[‘billing’]->get(‘premium_posting_fee_enabled’, 0)) {
return false;
}return true;
}[/PHP]And replace it with:
[PHP]function checkPostingAmount($value, $user_id)
{
global $jbconfig;
$db = JFactory::getDbo();
$query = ‘SELECT * FROM #__ja_employers WHERE user_id=’ . $db->Quote($user_id);
$db->setQuery($query);
$employer = $db->loadObject();return checkJobPostingLeft($employer, $value);
}[/PHP]Apply the same solution for Import Job function, please open the file:
administrator/components/com_jajobboard/models/jaimportusers.phpFind the code below:
[PHP]function check_posting_amount($value, $user_id)
{
global $jbconfig;
$db = JFactory::getDbo();
$query = “SELECT * FROM #__ja_employers WHERE user_id=$user_id”;
$db->setQuery($query);
$employer = $db->loadObject();if ($employer && $employer->standard_posts_balance == 0 && $value == ‘0’ && $jbconfig[‘billing’]->get(‘posting_fee_enabled’, 0)) {
return false;
} else if ($employer && $employer->premium_posts_balance == 0 && $value == ‘1’ && $jbconfig[‘billing’]->get(‘premium_posting_fee_enabled’, 0)) {
return false;
}return true;
}[/PHP]And replace it with:
[PHP]function check_posting_amount($value, $user_id)
{
global $jbconfig;
$db = JFactory::getDbo();
$query = “SELECT * FROM #__ja_employers WHERE user_id=$user_id”;
$db->setQuery($query);
$employer = $db->loadObject();return checkJobPostingLeft($employer, $value);
}[/PHP]timmieboy Friendtimmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
May 13, 2014 at 9:06 am #534829I have changed it but it is not working, I still get the message that the employer has not enogh jobs available.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 13, 2014 at 9:45 am #534839To resolve this issue, please replace the function “checkJobPostingLeft” in the file
components/com_jajobboard/helper/jafunctions.class.phpwith the following:
[PHP]function checkJobPostingLeft($account, $premium = 0) {
global $jbconfig;
$premium = $premium ? 1 : 0;if(!is_object($account)) return false;
//allow All Employers To Post Premium jobs For Free
if(!$premium && !$jbconfig[‘billing’]->get(‘posting_fee_enabled’, 0)) return true;
//allow All Employers To Post Premium jobs For Free
if($premium && !$jbconfig[‘billing’]->get(‘premium_posting_fee_enabled’, 0)) return true;//get posted job
/*$db = JFactory::getDbo();
$query = “SELECT COUNT(*) FROM #__ja_jobs WHERE user_id = “.$db->quote($account->user_id).” AND is_hotjob = “.$db->quote($premium);
$db->setQuery($query);
$posted = $db->loadResult();*///do not need check posted job, since job posting left number is updated once user post a new job
$posted = 0;if ($jbconfig[‘posts’]->get(‘posts_expiry_date_by’, 1)) {
$num = $premium ? intval($account->premium_posts_balance) : intval($account->standard_posts_balance);
return ($num && $posted < $num);
} else {
$ext = $premium ? @$account->premium_posts_balance_ext : @$account->standard_posts_balance_ext;
//E.g: 15:30,10:100
$exts = explode(‘,’, $ext);
$num = 0;
if(count($exts)) {
foreach($exts as $ext) {
list($i, $d) = explode(‘:’, $ext);
$num += intval($i);
}
}
return ($num && $posted < $num);
}
}[/PHP]timmieboy Friendtimmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
May 20, 2014 at 10:25 am #535849Thanks I can add a job thru backend now but some problems:
1. No job were deducted from employers account
2. Expire date is not filled in, the database field says NULL
3. Why is the expire date field not in backend joblist while it is in field list customization.timmieboy Friendtimmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
May 20, 2014 at 10:26 am #535850Thanks I can add a job thru backend now but some problems:
1. No job were deducted from employers account
2. Expire date is not filled in, the database field says NULL
3. Why is the expire date field not in backend joblist while it is in field list customization.Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 21, 2014 at 3:55 am #535992Hope my answers below would help.
<blockquote>1. No job were deducted from employers account</blockquote>
I just fixed this issue in our dev version. For a quick fix, you can try the solution below:
– Open the file: /components/com_jajobboard/helper/jafunctions.class.php
– Adding code snippet below at the end of file:
[PHP]function updateJobPostingLeft($account, $job, $premium = 0) {
global $jbconfig;
$premium = $premium ? 1 : 0;if(!is_object($account)) return false;
//allow All Employers To Post Premium jobs For Free
if(!$premium && !$jbconfig[‘billing’]->get(‘posting_fee_enabled’, 0)) return true;
//allow All Employers To Post Premium jobs For Free
if($premium && !$jbconfig[‘billing’]->get(‘premium_posting_fee_enabled’, 0)) return true;$db = JFactory::getDbo();
if ($jbconfig[‘posts’]->get(‘posts_expiry_date_by’, 1)) {
$field = $premium ? ‘premium_posts_balance’ : ‘standard_posts_balance’;
$num = (int) $account->{$field};
$num = $num > 1 ? $num – 1 : 0;$query = “UPDATE #__ja_employers SET “.$db->quoteName($field).”=”.$db->quote($num)
.” WHERE user_id=”.$db->quote($account->user_id);
$db->setQuery($query);
$db->query();
} else {
$field = $premium ? ‘premium_posts_balance_ext’ : ‘standard_posts_balance_ext’;
$num = $account->{$field};if (empty($num)) {
$num = $premium ?
$jbconfig[‘account’]->get(‘begin_premium_posts’) . “:” . $jbconfig[‘posts’]->get(‘posts_show_days_elapsed’, 30) :
$jbconfig[‘account’]->get(‘begin_standard_posts’) . “:” . $jbconfig[‘posts’]->get(‘posts_display_days’, 30);
}//format: 10:30,20:60,…
$num = str_replace(” “, “”, $num);
$nums = explode(“,”, $num);foreach ($nums as $k => $value) {
list($left, $duration) = explode(“:”, $value);
$left = (int) $left;if ($left != -1 && isset($job->job_duration) && $duration == $job->job_duration) {
$left = $left > 1 ? $left – 1 : 0;if ($left == 0) {
unset($nums[$k]);
} else {
$nums[$k] = $left . “:” . $duration;
}
}
}$num = implode(“,”, $nums);
$query = “UPDATE #__ja_employers SET “.$db->quoteName($field).”=”.$db->quote($num)
.” WHERE user_id=”.$db->quote($account->user_id);
$db->setQuery($query);
$db->query();
}
}[/PHP]– Open the file: administratorcomponentscom_jajobboardmodelsjajobs.php
– Find the code snippet:
[PHP]function updateAcc($job, $hotjob)
{global $jbconfig;
$db = JFactory::getDbo();if (!$job->user_id) {
return;
}$user = JFactory::getUser($job->user_id);
$query = “SELECT * FROM #__ja_employers WHERE user_id=” . $db->Quote($user->id);
$db->setQuery($query);
$employer = $db->loadObjectList();if ($hotjob) {
if ($jbconfig[‘billing’]->get(‘premium_posting_fee_enabled’)) {
$num = $employer[0]->premium_posts_balance – 1;
$query = ‘UPDATE #__ja_employers SET premium_posts_balance=$num WHERE user_id=’ . $db->Quote($user->id);
$db->setQuery($query);
$db->query();
}
} else if ($jbconfig[‘billing’]->get(‘posting_fee_enabled’) && $employer) {
$num = $employer[0]->standard_posts_balance – 1;
$query = ‘UPDATE #__ja_employers SET standard_posts_balance=$num WHERE user_id=’ . $db->Quote($user->id);
$db->setQuery($query);
$db->query();
}
}[/PHP]– And replace it with:
[PHP]function updateAcc($job, $hotjob)
{
if (!$job->user_id) {
return;
}$account = getAccountByUserID($job->user_id);
updateJobPostingLeft($account, $job, $hotjob);
}[/PHP]<blockquote>2. Expire date is not filled in, the database field says NULL
3. Why is the expire date field not in backend joblist while it is in field list customization.</blockquote>Please ignore this field, Job’s expiry date is calculated based on publish date and its duration.
timmieboy Friendtimmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
May 21, 2014 at 1:38 pm #536073Nope, is not working.Credits are not deducted and job is placed
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 22, 2014 at 4:06 am #536165It will not decrease credit, I will decrease left Job Posting data when you post a new job.
Credit will be decreased when you buy a Post job package.
timmieboy Friendtimmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
May 22, 2014 at 8:59 am #536198<em>@Dead Code 428606 wrote:</em><blockquote>It will not decrease credit, I will decrease left Job Posting data when you post a new job.
Credit will be decreased when you buy a Post job package.
</blockquote>Sorry but with credits I mean packages. When I add a job thru the backend it does not decreases it from employer.
Example:
Employer 1 – has 1:30 jobs
After adding a job thru the backend the amount still is 1:30, so this will mean that an employer can add another job thru the front end.If I manual change the amount 1:30 into 3:30 without buying a packge thru the backend, is that possible or does this gives errors.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 22, 2014 at 9:49 am #536203I checked again and see this issue on your site when trying to post new Job in back-end for Employer test11. This issue occured because in back-end, Job form did not have a setting for “Select Job duration” as on front-end.
I have reported this issue to our dev team to get this fixed. You can check status of this issue here
http://pm.joomlart.com/browse/JAJBJ25-354timmieboy Friendtimmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
May 22, 2014 at 12:13 pm #536219OK, thanks. So I have to wait for this to be fixed of does it work now. Can it be that this was also the issue for not able to add a job thru the backend.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 26, 2014 at 7:53 am #536647We will try to fix this issue asap, and I will send you updated code then.
timmieboy Friendtimmieboy
- Join date:
- January 2013
- Posts:
- 344
- Downloads:
- 0
- Uploads:
- 59
- Thanks:
- 9
- Thanked:
- 5 times in 1 posts
June 25, 2014 at 2:34 pm #540167Any update on this
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
June 26, 2014 at 1:45 am #540203Hi,
Yes, we have fixed this issue, you can apply solution below to resolve this issue on your site:
– Open the file:
components/com_jajobboard/helper/jafunctions.class.php– Find the code snippet below:
[PHP]/**
* @param object $account – Employer account to check
* @param object $job – new job added
* @param int $premium – if 1, then is Premium job, otherwise is Standard job
* @return bool
*/
function updateJobPostingLeft($account, $job, $premium = 0) {[/PHP]– And add this code before it:
[PHP]function getNewJobDuration($account, $premium = 0) {
global $jbconfig;
$field = $premium ? ‘premium_posts_balance_ext’ : ‘standard_posts_balance_ext’;
$num = $account->{$field};if (empty($num)) {
$num = $premium ?
$jbconfig[‘account’]->get(‘begin_premium_posts’) . “:” . $jbconfig[‘posts’]->get(‘posts_show_days_elapsed’, 30) :
$jbconfig[‘account’]->get(‘begin_standard_posts’) . “:” . $jbconfig[‘posts’]->get(‘posts_display_days’, 30);
}//format: 10:30,20:60,…
$num = str_replace(” “, “”, $num);
$nums = explode(“,”, $num);foreach ($nums as $k => $value) {
list($left, $duration) = explode(“:”, $value);
$left = (int) $left;if($left == -1 || $left >= 1) {
return $duration;
}
}return 0;
}
[/PHP]– And open the file:
administrator/components/com_jajobboard/models/jajobs.php– Find the code snippet:
[PHP]if (!$newjob) {
$date =JFactory::getDate();
$row->mod_date = $date->toMySQL();
}[/PHP]– And replace it with following one:
[PHP]if (!$newjob) {
$date =JFactory::getDate();
$row->mod_date = $date->toMySQL();
} else {
if (!$jbconfig[‘posts’]->get(‘posts_expiry_date_by’, 1) && !isset($row->job_duration)) {
$account = getAccountByUserID($row->user_id);
$row->job_duration = getNewJobDuration($account, $row->is_hotjob);
}
}[/PHP]AuthorPostsThis topic contains 25 replies, has 2 voices, and was last updated by timmieboy 10 years, 5 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum