Example #1
0
 public static function external_hook($hook)
 {
     switch ($hook) {
         case 'public':
             $job_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
             $task_id = isset($_REQUEST['t']) ? (int) $_REQUEST['t'] : false;
             $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
             if ($job_id && $task_id && $hash) {
                 $correct_hash = self::link_public($job_id, $task_id, true);
                 if ($correct_hash == $hash) {
                     module_job_discussion::print_discussion($job_id, $task_id);
                 }
             }
             break;
     }
 }
Example #2
0
        }));
    }
    //
    if (module_config::c('job_show_task_numbers', 1)) {
        $fieldset_data['elements'][] = array('title' => 'Task Numbers', 'field' => array('type' => 'select', 'options' => array(0 => _l('Automatic'), 1 => _l('Manual'), 2 => _l('Hidden')), 'name' => 'auto_task_numbers', 'value' => $job['auto_task_numbers']));
    }
    $fieldset_data['elements'][] = array('title' => 'Task Type', 'field' => array('type' => 'select', 'options' => module_job::get_task_types(), 'name' => 'default_task_type', 'value' => isset($job['default_task_type']) ? $job['default_task_type'] : 0, 'help' => 'The default is hourly rate + amount. This will show the "Hours" column along with an "Amount" column. Inputing a number of hours will auto complete the price based on the job hourly rate. <br>Quantity and Amount will allow you to input a Quantity (eg: 2) and an Amount (eg: $100) and the final price will be $200 (Quantity x Amount). The last option "Amount Only" will just have the amount column for manual input of price. Change the advanced setting "default_task_type" between 0, 1 and 2 to change the default here.'));
    $fieldset_data['elements'][] = array('title' => 'Discount Amount', 'fields' => array(function () use($job_id, &$job) {
        echo !module_security::is_page_editable() ? '<span class="currency">' . dollar($job['discount_amount'], true, $job['currency_id']) . '</span>' : currency('<input type="text" name="discount_amount" value="' . number_out($job['discount_amount']) . '" class="currency">');
        echo ' ';
    }, array('type' => 'html', 'value' => '', 'help' => 'Here you can apply a before tax discount to this job. You can name this anything, eg: DISCOUNT, CREDIT, REFUND, etc..')));
    $fieldset_data['elements'][] = array('title' => 'Discount Name', 'fields' => array(function () use($job_id, &$job) {
        echo !module_security::is_page_editable() ? htmlspecialchars(_l($job['discount_description'])) : '<input type="text" name="discount_description" value="' . htmlspecialchars(_l($job['discount_description'])) . '" style="width:80px;">';
    }));
    $fieldset_data['elements'][] = array('title' => 'Discount Type', 'field' => array('type' => 'select', 'options' => array('0' => _l('Before Tax'), 1 => _l('After Tax')), 'name' => 'discount_type', 'value' => $job['discount_type']));
    if (class_exists('module_job_discussion', false) && isset($job['job_discussion']) && module_job_discussion::is_plugin_enabled()) {
        $fieldset_data['elements'][] = array('title' => 'Job Discussion', 'field' => array('type' => 'select', 'options' => array(0 => _l('Allowed'), 1 => _l('Disabled & Hidden'), 2 => _l('Disabled & Shown')), 'name' => 'job_discussion', 'value' => isset($job['job_discussion']) ? $job['job_discussion'] : 0));
    }
    if ((int) $job_id > 0 && module_invoice::can_i('create', 'Invoices')) {
        $fieldset_data['elements'][] = array('title' => 'Job Deposit', 'fields' => array(array('type' => 'currency', 'name' => 'job_deposit', 'value' => ''), array('type' => 'submit', 'name' => 'butt_create_deposit', 'value' => 'Create Deposit Invoice', 'class' => 'exit_button small_button', 'help' => 'Enter a dollar value here to create a deposit invoice for this job. Also supports entering a percentage (eg: 20%%)')));
    }
    $fieldset_data['elements'][] = array('title' => 'Job Completed', 'fields' => array(array('type' => 'text', 'name' => 'total_percent_complete_override', 'value' => $job['total_percent_complete_manual'] ? $job['total_percent_complete'] * 100 : '', 'style' => 'width:30px;'), '%', $job['total_percent_complete_manual'] ? _l('(calculated: %s%%)', $job['total_percent_complete_calculated'] * 100) : '', array('type' => 'html', 'value' => '', 'help' => 'Enter a manual job "percent completed" here and this will be used instead of the automatically calculated value.')));
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
}
$form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'onclick' => "\$('#form_redirect').val('" . module_job::link_open(false) . "');", 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save Job')), array('ignore' => !((int) $job_id && module_job::can_i('delete', 'Jobs')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_job::link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
?>


    </form>