Archive for the 'WebJobs' Category


Add company name to billing history

Thursday, May 1st, 2008

Problem: When viewing the billing history table in Smartway — the administrative area of webjobs — it is difficult to tell what company paid for the job b/c it only includes the user ID.

Solution: — Add the company name to the billing table.
1. In smartway/modules/billing_history.php, around line 78, add this line into the array:

‘company_name’ => ‘company_name’,

2.Around line 236, add:

$company_name = $input[’company_name’];

3.Around line 312, add the following line into the array:

‘company_name’ => $company_name,

4. Around line 541, after this line:

$constraints[] = “bh.user_id = ‘” . $user_id . ‘\”;

add:

$constraints[] = “u.id = ‘” . $user_id . ‘\”;

5. For the entire SELECT statement and array around line 604, change it to this:

‘SELECT bh.user_id, u.company_name, bh.id, bh.timestamp, bh.name, bh.quantity, bh.price, bh.type, bh.pending, bh.comment ‘ .
‘FROM `jb_billing_history` AS bh, `jb_users` AS u ‘ .
‘WHERE bh.user_id=u.id ‘ .
“AND $constraints $order_clause”,
array(’user_id’, ‘invoice’, ‘company_name’,'id’, ‘timestamp’, ‘name’, ‘quantity’, ‘price’, ‘type’, ‘pending’, ‘comment’, ‘controls’));

6. Change the SQL query around line 706 to:

$sql->query(’SELECT bh.user_id, u.company_name, u.login, bh.timestamp, bh.name, bh.type, bh.quantity, bh.duration, bh.price, bh.comment, bh.pending ‘ .
‘FROM `jb_billing_history` AS bh LEFT JOIN `jb_users` AS u ON(bh.user_id = u.id) ‘ .
“WHERE bh.id = $id LIMIT 1″);

7. Change the language file so that the Company label appears in the table. Open smartway/conf/lang/eng/text.billing_history.php and add

‘company_name’ => ‘Company:’,

on the line below this comment

// Smartway translations for modules billing_history.php

You’re done! If all went as planned, company name should show up in the table after the invoice number.

How to add the pricing plan to another page on your site in WebJobs

Thursday, April 17th, 2008

Problem: The dynamic list of prices for posting jobs is only viewable to employers who are logged in.

Solution:

In your new page in engine/pages/new_page.php , make sure the following is included near the top:

require_once ’smartway/lib/table.lib’;

Then add the following two classes, which originate in the engine/pages/employer_home.php file:

class employer_job_plans_table_renderer extends sql_table_renderer{
function employer_job_plans_table_renderer(){
$application =& application();
parent::sql_table_renderer();
$this->table_class = ’seeker_search_res_wide’;
$this->header_class = $this->footer_class = ’seeker_search_ends_wide’;
$this->row_1_class = ’seeker_search_row1_wide’;
$this->row_2_class = ’seeker_search_row2_wide’;
$this->header_navbar_class = ‘narrow_navbar_top’;
$this->footer_navbar_class = ‘narrow_navbar_bottom’;
}

function handle_duration($f){
$application =& application();
return $f[’duration’] .’ ‘.$application->text(’days’);
}
function handle_quantity($f){
$application =& application();
return $f[’quantity’];
}

function handle_price($f){
$application =& application();
if(ceil($f[’price’])==0){
return $application->text(’Free’);
}
else{
return $application->config(’currency_symbol’) . util_funcs::number_format($f[’price’], 2);
}
}
function handle_type($f){
$application =& application();
return $application->text($f[’type’]);
}
function handle_controls($row)
{
$application =& application();
$text = $application->text();
$service = $application->input(’service’);
$PHP_SELF = $application->server(’PHP_SELF’);

if($row[’type’]==’job_postings’){
if(ceil($row[’price’]) != 0){
$output = ” <a href=’$PHP_SELF?page=post_single_job1&job_post_type={$row[’name’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
else{ // User is getting a free plan
$output = ” <a href=’$PHP_SELF?page=employer_home&action=free_plan&plan_id={$row[’id’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
}
else{ // Resume View
if(ceil($row[’price’])!=0){
$output = ” <a href=’$PHP_SELF?page=resume_searches&searches_type={$row[’name’]}’>\n {$text[’purchase’]}</a> \n ” ;
}
else{ // User is getting a free plan
$output = ” <a href=’$PHP_SELF?page=employer_home&action=free_plan&plan_id={$row[’id’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
}
return $output;
} // handle_controls
} // employer_job_plans_table_renderer

class employer_combo_plans_table_renderer extends sql_table_renderer{
function employer_combo_plans_table_renderer(){
$application =& application();
parent::sql_table_renderer();
$this->table_class = ’seeker_search_res_wide’;
$this->header_class = $this->footer_class = ’seeker_search_ends_wide’;
$this->row_1_class = ’seeker_search_row1_wide’;
$this->row_2_class = ’seeker_search_row2_wide’;
$this->header_navbar_class = ‘narrow_navbar_top’;
$this->footer_navbar_class = ‘narrow_navbar_bottom’;
}

function handle_price($f){
$application =& application();
if(ceil($f[’price’])==0){
return $application->text(’Free’);
}
else{
return $application->config(’currency_symbol’) . util_funcs::number_format($f[’price’], 2);
}
}

function handle_posting_plan($f){
return $f[’posting_plan_name’];
}

function handle_resume_plan($f){
return $f[’resume_plan_name’];
}

function handle_name($f){
return $f[’name’];
}

function handle_controls($row)
{
$application =& application();
$text = $application->text();
$service = $application->input(’service’);
$PHP_SELF = $application->server(’PHP_SELF’);

if(ceil($row[’price’])!=0){
return ” <a href=’$PHP_SELF?page=combo_package&plan_id={$row[’id’]}’>\n {$text[’purchase’]}</a> \n ” ;
}
else{ // User is getting a free plan
return ” <a href=’$PHP_SELF?page=employer_home&action=free_combo&plan_id={$row[’id’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
} // handle_controls
} // class employer_combo_plans_table_renderer

(more…)

Add a pending check payment notification email to webjobs

Wednesday, April 16th, 2008

Problem: If you have enabled “Notify admin of new job postings?:” from Admin Area -> Email Notification, an email will be sent to the Admin notifying him when a job has been posted. However, if check payment is selected there will be no email sent to the admin.

In theory, I guess the email ISN’T needed because it is assumed that the siteowner doesn’t need to worry about activating the job until the check is received. However, on one Webjobs site I used the check module as a request from the employer to be invoiced, instead of paying by credit card. The siteowners had to remember to check the Pending Check area in Smartway to see if any employers were waiting to be invoiced.

Solution: Thanks to the new upgraded Webjobs 2.0, the solution is now very simple. Previously, it was difficult to figure out where to generate the email , because of the long posting process (post_single_job2, post_single_job3, confirm_purchase, etc. Where does it go??). Fortunately, this version has a new file — engine/pages/check.php that makes it easy to send the email at the right time in the posting process. (more…)