예제 #1
0
    function init()
    {
        $this->version = 2.12;
        //2.1 - new option that can be used for cheque/check payments
        //2.11 - 2014-11-27 - updated defaults
        //2.12 - 2015-03-14 - better default payment method options
        $this->module_name = "paymethod_other";
        $this->module_position = 8899;
        if (class_exists('module_template', false)) {
            module_template::init_template('paymethod_other', 'Hello,
Please make payment as per the below details:

{OTHER_DETAILS}

If you have any questions please feel free to contact us.

Please <a href="{LINK}" target="_blank">click here</a> to return to your previous page.

Thank you
', 'Displayed when this payment method is selected from invoice page.');
            module_template::init_template('paymethod_other_details', 'Payable To: <strong>Name Here</strong>
Post To: <strong>123 Your Address, LA</strong>
Amount: <strong>{AMOUNT}</strong>', 'Details displayed on the invoice payments area.');
        }
    }
예제 #2
0
    function init()
    {
        $this->version = 2.241;
        //2.21 - currency fix.
        //2.22 - edit template
        //2.23 - improved settings page
        //2.24 - 2014-03-16 - added more tags to bank transfer templates
        //2.241 - 2015-03-14 - better default payment method options
        $this->module_name = "paymethod_banktransfer";
        $this->module_position = 8882;
        if (class_exists('module_template', false)) {
            module_template::init_template('paymethod_banktransfer', 'Hello,
Please make payment via Bank Transfer using the following details:

{BANK_DETAILS}

If you have any questions please feel free to contact us.

Please <a href="{LINK}" target="_blank">click here</a> to return to your previous page.

Thank you
', 'Displayed when Bank Transfer payment method is selected.');
            module_template::init_template('paymethod_banktransfer_details', 'Bank Name: <strong>Name Here</strong>
Bank Account: <strong>123456</strong>
Payment Reference: <strong>{NAME}</strong>
Amount: <strong>{AMOUNT}</strong>', 'Bank transfer details for invoice payments.');
        }
    }
예제 #3
0
    function init()
    {
        $this->links = array();
        $this->module_name = "job_discussion";
        $this->module_position = 17.1;
        //17 is job
        $this->version = 2.149;
        // 2.1 - initial
        // 2.11 - date change
        // 2.12 - better linking and auto open
        // 2.13 - possible bug fix in discussion saving
        // 2.14 - bug fixing.
        // 2.141 - bug fix for IE.
        // 2.142 - send email to staff option (as well as customer)
        // 2.143 - 2013-07-29 - new _UCM_SECRET hash in config.php
        // 2.144 - 2013-12-06 - javascript for for new jquery
        // 2.145 - 2014-03-17 - make discussion button stand out a bit more ( job_discussion_button_label )
        // 2.146 - 2014-03-18 - fix for disabling job discussion plugin
        // 2.147 - 2014-05-27 - email discussions to multiple customer contacts
        // 2.148 - 2015-01-08 - AdminLTE modal popup discussions (thanks 3wCorner!)
        // 2.149 - 2015-01-10 - job discussion bug fix
        if (self::is_plugin_enabled()) {
            module_config::register_css('job_discussion', 'job_discussion.css');
            module_config::register_js('job_discussion', 'job_discussion.js');
            //if(self::can_i('view','Job Discussions')){
            if (get_display_mode() != 'mobile') {
                hook_add('job_task_after', 'module_job_discussion::hook_job_task_after');
            }
        }
        if (class_exists('module_template', false)) {
            module_template::init_template('job_discussion_email_customer', 'Dear {CUSTOMER_NAME},<br>
<br>
A new comment has been added to a task in your job: {JOB_NAME}.<br><br>
Task: {TASK_NAME} <br/><br/>
Note: {NOTE}<br/><br/>
You can view this job and the comments online by <a href="{JOB_URL}">clicking here</a>.<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'New Job Comment: {JOB_NAME}', array('CUSTOMER_NAME' => 'Customers Name', 'JOB_NAME' => 'Job Name', 'FROM_NAME' => 'Your name', 'JOB_URL' => 'Link to job for customer', 'TASK_NAME' => 'name of the task the note was added to', 'NOTE' => 'Copy of the note'));
            module_template::init_template('job_discussion_email_staff', 'Dear {STAFF_NAME},<br>
<br>
A new comment has been added to a task in your job: {JOB_NAME}.<br><br>
Task: {TASK_NAME} <br/><br/>
Note: {NOTE}<br/><br/>
You can view this job and the comments online by <a href="{JOB_URL}">clicking here</a>.<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'New Comment on your Job: {JOB_NAME}', array('STAFF_NAME' => 'Staff Name', 'JOB_NAME' => 'Job Name', 'FROM_NAME' => 'Your name', 'JOB_URL' => 'Link to job for staff member', 'TASK_NAME' => 'name of the task the note was added to', 'NOTE' => 'Copy of the note'));
        }
    }
예제 #4
0
파일: faq.php 프로젝트: sgh1986915/php-crm
    public function init()
    {
        $this->links = array();
        $this->module_name = "faq";
        $this->module_position = 30;
        hook_add('api_callback_faq', 'module_faq::api_filter_faq');
        if (class_exists('module_template', false)) {
            module_template::init_template('faq_item', '
<a href="{FAQ_BACK}" class="faq_back">&laquo; Return to FAQ Database</a>
<h2>{QUESTION}</h2>
{ANSWER}<br/>
', 'Used when displaying an individual FAQ item to the public.', 'code');
            module_template::init_template('faq_list', '
<h2>FAQ Database</h2>
{LISTING}<br/>
', 'Used when displaying the list of FAQ items to the public.', 'code');
        }
    }
예제 #5
0
    function init()
    {
        $this->version = 2.11;
        //2.1 - 2014-11-27 - initial release
        //2.11 - 2015-03-14 - better default payment method options
        $this->module_name = "paymethod_check";
        $this->module_position = 8882;
        if (class_exists('module_template', false)) {
            module_template::init_template('paymethod_check', 'Hello,
Please make payment by Check as per the below details:

{CHECK_DETAILS}

If you have any questions please feel free to contact us.

Please <a href="{LINK}" target="_blank">click here</a> to return to your previous page.

Thank you
', 'Displayed when Check payment method is selected.');
            module_template::init_template('paymethod_check_details', 'Payable To: <strong>Your Name Here</strong>
Post To: <strong>123 Your Address, LA</strong>
Amount: <strong>{AMOUNT}</strong>', 'Check details for invoice payments.');
        }
    }
예제 #6
0
 */
if (!$file_safe) {
    die('wrong page');
}
if (!module_file::can_i('edit', 'File Approval')) {
    die('no perms');
}
$ucm_file = new ucm_file($file_id);
$ucm_file->check_page_permissions();
$file = $ucm_file->get_data();
$file_id = (int) $file['file_id'];
// sanatisation/permission check
module_template::init_template('file_approval_email', 'Dear {CUSTOMER_NAME},<br>
<br>
This email is regarding your file <strong>{FILE_NAME}</strong>{if:JOB_LINK} related to the job <a href="{JOB_LINK}">{JOB_NAME}</a>{endif:JOB_LINK}.<br><br>
Please view this file and comments online by <a href="{FILE_URL}">clicking here</a>.<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'File for Approval: {FILE_NAME}', array('CUSTOMER_NAME' => 'Customers Name', 'FILE_NAME' => 'File Name', 'JOB_NAME' => 'Job Name', 'FROM_NAME' => 'Your name', 'FILE_URL' => 'Link to file for customer'));
// template for sending emails.
// are we sending the paid one? or the dueone.
//$template_name = 'file_email';
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : 'file_approval_email';
$template = module_template::get_template_by_key($template_name);
$file['from_name'] = module_security::get_loggedin_name();
$file['file_url'] = module_file::link_public($file_id);
if (class_exists('module_job', false) && $file['job_id']) {
    $job_data = module_job::get_job($file['job_id'], false);
    $file['job_name'] = htmlspecialchars($job_data['name']);
    $file['job_link'] = module_job::link_public($file['job_id']);
} else {
예제 #7
0
    public static function start_payment($invoice_id, $payment_amount, $invoice_payment_id, $user_id = false)
    {
        if ($invoice_id && $payment_amount && $invoice_payment_id) {
            // we are starting a payment via authorize!
            // setup a pending payment and redirect to authorize.
            $invoice_data = module_invoice::get_invoice($invoice_id);
            if (!$user_id) {
                $user_id = $invoice_data['user_id'];
            }
            if (!$user_id) {
                $user_id = module_security::get_loggedin_id();
            }
            $invoice_payment_data = module_invoice::get_invoice_payment($invoice_payment_id);
            if ($invoice_payment_data && $invoice_payment_data['invoice_id'] == $invoice_data['invoice_id']) {
                //self::authorize_redirect($description,$payment_amount,$user_id,$invoice_payment_id,$invoice_id,$invoice_payment_data['currency_id']);
                $currency = module_config::get_currency($invoice_payment_data['currency_id']);
                $currency_code = $currency['code'];
                ob_start();
                include 'includes/plugin_paymethod_authorize/pages/authorize_form_default.php';
                module_template::init_template('authorize_credit_card_form', ob_get_clean(), 'Form displayed for payments via Authorize.net', 'code');
                $form = module_template::get_template_by_key('authorize_credit_card_form');
                //                $form = new module_template();
                //                $form->content = ob_get_clean();
                ob_start();
                ?>
                <form action="<?php 
                echo full_link(_EXTERNAL_TUNNEL . '?m=paymethod_authorize&h=pay&method=authorize');
                ?>
" method="POST" id="authorize-payment-form">
                <input type="hidden" name="invoice_payment_id" value="<?php 
                echo $invoice_payment_id;
                ?>
">
                <input type="hidden" name="invoice_id" value="<?php 
                echo $invoice_id;
                ?>
">
                <input type="hidden" name="invoice_num" value="<?php 
                echo htmlspecialchars($invoice_data['name']);
                ?>
">
                <input type="hidden" name="description" value="<?php 
                _e('Payment for Invoice #%', htmlspecialchars($invoice_data['name']));
                ?>
">
                    <?php 
                echo $form->content;
                ?>
                </form>
                <?php 
                $form->content = ob_get_clean();
                $form->assign_values(array('INVOICE_NUMBER' => $invoice_data['name'], 'AMOUNT' => dollar($invoice_payment_data['amount'], true, $invoice_payment_data['currency_id']), 'CANCEL_URL' => module_invoice::link_public($invoice_id)));
                // we also want to grab all the normal invoice replace fields and add those in as well.
                $form->assign_values(module_invoice::get_replace_fields($invoice_id, $invoice_data));
                echo $form->render('pretty_html');
            }
            exit;
        }
        return false;
    }
예제 #8
0
파일: file.php 프로젝트: sgh1986915/php-crm
    public function external_hook($hook)
    {
        switch ($hook) {
            case 'view':
                $file_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                if ($file_id && $hash) {
                    $correct_hash = $this->link_public($file_id, true);
                    if ($correct_hash == $hash) {
                        // all good to print a receipt for this payment.
                        $file_data = $this->get_file($file_id, false);
                        if ($file_data && $file_data['file_id'] == $file_id) {
                            if (isset($_POST['save_file_comments'])) {
                                if (isset($_POST['file_approve']) && isset($_POST['file_approve_go']) && isset($_POST['file_approve_name']) && strlen($_POST['file_approve_name']) > 0) {
                                    update_insert('file_id', $file_id, 'file', array('approved_time' => time(), 'approved_by' => $_POST['file_approve_name']));
                                    // send email, same 'updated' email as before.
                                    $this->send_file_changed_notice($file_id, false, true);
                                    //redirect_browser($this->link_public($file_id));
                                    $_REQUEST['new_comment_text'] = _l('File was approved at %s by %s', print_date(time(), true), htmlspecialchars($_POST['file_approve_name']));
                                }
                                if (isset($_POST['pointers'])) {
                                    update_insert('file_id', $file_id, 'file', array('pointers' => $_POST['pointers']));
                                }
                                $this->save_file_comments($file_id);
                                redirect_browser($this->link_public($file_id));
                            }
                            module_template::init_template('file_approval_view', '<h2>File Details</h2>
    File Name: <strong>{FILE_NAME}</strong> <br/>
    Download: <strong><a href="{FILE_DOWNLOAD_URL}">Click Here</a></strong> <br/>
    Status: <strong>{STATUS}</strong> <br/>
    Customer: <strong>{CUSTOMER_NAME}</strong> <br/>
    {if:JOB_NAME}Job: <strong>{JOB_NAME}</strong> <br/>{endif:JOB_NAME}
    {if:FILE_APPROVAL_PENDING}
    <h2>File Approval Pending</h2>
    <p>If you would like to approve this file please complete the form below:</p>
    <p>Your Name: <input type="text" name="file_approve_name"> </p>
    <p><input type="checkbox" name="file_approve_go" value="yes"> Yes, I approve this file. </p>
    <p><input type="submit" name="file_approve" value="Approve File" class="submit_button save_button"></p>
    {endif:FILE_APPROVAL_PENDING}
    {if:FILE_APPROVED}
    <h2>File Has Been Approved</h2>
    <p>Thank you, the file was approved by <strong>{APPROVED_BY}</strong> on <strong>{APPROVED_TIME}</strong>.</p>
    {endif:FILE_APPROVED}
    <h2>File Comments</h2>
    <p>Please feel free to add comments to this file using the form below.</p>
    {FILE_COMMENTS}
    {if:FILE_PREVIEW}
    <h2>File Preview</h2>
    <div style="overflow:scroll;">{FILE_PREVIEW}</div>
    {endif:FILE_PREVIEW}
    ', 'Used when displaying the file to a customer for approval.', 'code');
                            $template = module_template::get_template_by_key('file_approval_view');
                            // generate the html for the task output
                            $job_data = $file_data['job_id'] ? module_job::get_replace_fields($file_data['job_id']) : array();
                            if (class_exists('module_quote', false)) {
                                $quote_data = $file_data['quote_id'] ? module_quote::get_replace_fields($file_data['quote_id']) : array();
                            }
                            $customer_data = $file_data['customer_id'] ? module_customer::get_replace_fields($file_data['customer_id']) : array();
                            $file_data['file_preview'] = module_file::generate_preview($file_id, $file_data['file_name'], $file_data);
                            $file_data['FILE_DOWNLOAD_URL'] = module_file::link_public_view($file_id);
                            if (isset($file_data['approved_time'])) {
                                switch ($file_data['approved_time']) {
                                    case -1:
                                        $file_data['FILE_APPROVAL_PENDING'] = 1;
                                        break;
                                    case 0:
                                        break;
                                    default:
                                        $file_data['FILE_APPROVED'] = 1;
                                        $file_data['APPROVED_TIME'] = print_date($file_data['approved_time'], true);
                                }
                            }
                            if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
                                $all_extra_fields = module_extra::get_defaults('file');
                                foreach ($all_extra_fields as $e) {
                                    $file_data[$e['key']] = _l('N/A');
                                }
                                // and find the ones with values:
                                $extras = module_extra::get_extras(array('owner_table' => 'file', 'owner_id' => $file_id));
                                foreach ($extras as $e) {
                                    $file_data[$e['extra_key']] = $e['extra'];
                                }
                            }
                            ob_start();
                            ?>

                            <div id="file_notes">
                            <div style="border-top:1px dashed #CCCCCC; padding:3px; margin:3px 0;">
                                <textarea name="new_comment_text" style="width:100%;" class="no_permissions"></textarea>
                                <div style="text-align: right;">
                                <input type="submit" name="butt_save_note" id="butt_save_note" value="<?php 
                            echo _l('Add Comment');
                            ?>
" class="submit_button no_permissions">
                                    </div>
                            </div>
                            <?php 
                            foreach (module_file::get_file_comments($file_id) as $item) {
                                $note_text = forum_text($item['comment']);
                                if (preg_match_all('/#(\\d+)/', $note_text, $matches)) {
                                    //
                                    foreach ($matches[1] as $digit) {
                                        $note_text = preg_replace('/#' . $digit . '([^\\d]*)/', '<span node_id=' . $digit . ' class="pointer-ids pointer-id-' . $digit . '">#' . $digit . '</span>$1', $note_text);
                                    }
                                }
                                ?>

                                <div style="border-top:1px dashed #CCCCCC; padding:3px; margin:3px 0;">
                                    <?php 
                                echo $note_text;
                                ?>

                                    <div style="font-size:10px; text-align:right; color:#CCCCCC;">From <?php 
                                echo $item['create_user_id'] ? module_user::link_open($item['create_user_id'], true) : _l('Customer');
                                ?>
 on <?php 
                                echo print_date($item['date_created'], true);
                                ?>

                                    </div>
                                </div>

                                <?php 
                            }
                            ?>

                            </div>
                            <?php 
                            $file_data['file_comments'] = ob_get_clean();
                            $template->assign_values($file_data);
                            $template->assign_values($customer_data);
                            $template->assign_values($job_data);
                            if (class_exists('module_quote', false)) {
                                $quote_data['quote_approved_by'] = $quote_data['approved_by'];
                                $quote_data['quote_date_approved'] = $quote_data['date_approved'];
                                unset($quote_data['approved_by']);
                                unset($quote_data['date_approved']);
                                $template->assign_values($quote_data);
                            }
                            $template->page_title = $file_data['file_name'];
                            $template->content = '<form action="" method="post"><input type="hidden" name="save_file_comments" value="1">' . $template->content . '</form>';
                            echo $template->render('pretty_html');
                        }
                    }
                }
                break;
            case 'download_bucket':
                @ob_end_clean();
                $file_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                if ($file_id && $hash) {
                    $correct_hash = $this->link_public_download_bucket($file_id, true);
                    if ($correct_hash == $hash) {
                        // all good to print a receipt for this payment.
                        $file_data = $this->get_file($file_id, false);
                        @ignore_user_abort(true);
                        $search = array();
                        $search['bucket_parent_file_id'] = $file_id;
                        $files = module_file::get_files($search);
                        //Create ZIP
                        $zip = new ZipArchive();
                        $zipName = "bucket-" . $file_id . "-" . md5($file_id . _UCM_SECRET) . ".zip";
                        if ($zip->open(_FILE_UPLOAD_PATH . $zipName, ZIPARCHIVE::CREATE) !== TRUE) {
                            echo 'Failed to create bucket zip file';
                            exit;
                        }
                        foreach ($files as $file) {
                            if (is_file($file['file_path'])) {
                                $zip->addFromString($file['file_name'], file_get_contents($file['file_path']));
                            }
                        }
                        $zip->close();
                        //Set headers
                        header("Pragma: public");
                        header("Expires: 0");
                        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                        header("Cache-Control: public");
                        header("Content-Description: File Transfer");
                        header("Content-type: application/octet-stream");
                        //header("Content-Disposition: attachment; filename='" . $zipName . "'");
                        header("Content-Disposition: attachment; filename=\"" . preg_replace("#[^a-zA-Z0-9]+#", "-", $file_data['file_name']) . ".zip\";");
                        header("Content-Transfer-Encoding: binary");
                        header("Content-Length: " . filesize(_FILE_UPLOAD_PATH . $zipName));
                        @clearstatcache();
                        //Make sure the file size isn't cached
                        $size = @readfile(_FILE_UPLOAD_PATH . $zipName);
                        if (!$size) {
                            echo file_get_contents(_FILE_UPLOAD_PATH . $zipName);
                        }
                        @unlink(_FILE_UPLOAD_PATH . $zipName);
                    }
                }
                exit;
                break;
            case 'download':
                @ob_end_clean();
                $file_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                if ($file_id && $hash) {
                    $correct_hash = $this->link_public_view($file_id, true);
                    if ($correct_hash == $hash) {
                        // all good to print a receipt for this payment.
                        $file_data = $this->get_file($file_id, false);
                        if (isset($file_data['file_url']) && strlen($file_data['file_url'])) {
                            redirect_browser($file_data['file_url']);
                        } else {
                            if (is_file($file_data['file_path'])) {
                                header("Pragma: public");
                                header("Expires: 0");
                                header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                                header("Cache-Control: private", false);
                                header("Content-type: " . dtbaker_mime_type($file_data['file_name'], $file_data['file_path']));
                                if (!isset($_REQUEST['embed'])) {
                                    header("Content-Disposition: attachment; filename=\"" . $file_data['file_name'] . "\";");
                                    header("Content-Transfer-Encoding: binary");
                                }
                                header("Content-Length: " . filesize($file_data['file_path']));
                                //readfile($file_data['file_path']);
                                $size = @readfile($file_data['file_path']);
                                if (!$size) {
                                    echo file_get_contents($file_data['file_path']);
                                }
                            } else {
                                echo 'Not found';
                            }
                        }
                    }
                }
                exit;
                break;
        }
    }
예제 #9
0
    public function render($type = 'html', $options = array())
    {
        ob_start();
        switch ($type) {
            case 'pretty_html':
                // header and footer so plain contnet can be rendered nicely.
                $display_mode = get_display_mode();
                // addition - woah! we pass this through to the template module for re-rending again:
                ob_start();
                ?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>{PAGE_TITLE}</title>
    {FAVICON}
    {AUTOMATIC_STYLES}
    {AUTOMATIC_SCRIPTS}
    <style type="text/css">
        body{
            margin:0;
        }
    </style>
</head>
<body>
<div class="pretty_content_wrap">
    {CONTENT}
</div>
</body>
</html>
                <?php 
                /*$c = $this->replace_content();
                  if(!$this->wysiwyg){
                      //$c = nl2br($c);
                  }
                  echo $c;*/
                module_template::init_template('external_template', ob_get_clean(), 'Used when displaying the external content such as "External Jobs" and "External Invoices" and "External Tickets".', 'code', array('CONTENT' => 'The inner content', 'PAGE_TITLE' => 'in the <title> tag', 'FAVICON' => 'if the theme specifies a favicon it will be here', 'AUTOMATIC_STYLES' => 'system generated stylesheets', 'AUTOMATIC_SCRIPTS' => 'system generated javascripts'));
                ob_start();
                ?>

                <link rel="stylesheet" href="<?php 
                echo _BASE_HREF;
                ?>
css/desktop.css" type="text/css">
                <link rel="stylesheet" href="<?php 
                echo _BASE_HREF;
                ?>
css/print.css" type="text/css" media="print">
                <link rel="stylesheet" href="<?php 
                echo _BASE_HREF;
                ?>
css/styles.css" type="text/css">
                <link type="text/css" href="<?php 
                echo _BASE_HREF;
                ?>
css/smoothness/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" />
                <?php 
                module_config::print_css();
                ?>
 <?php 
                $css = ob_get_clean();
                ob_start();
                ?>

                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/jquery-1.8.3.min.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/jquery-ui-1.9.2.custom.min.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/timepicker.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/cookie.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/javascript.js?ver=2"></script>
                <?php 
                module_config::print_js();
                ?>

                <?php 
                $scripts = ob_get_clean();
                $external_template = self::get_template_by_key('external_template');
                $external_template->assign_values(array('CONTENT' => $this->replace_content(), 'PAGE_TITLE' => $this->page_title ? $this->page_title : module_config::s('admin_system_name'), 'FAVICON' => module_theme::get_config('theme_favicon', '') ? '<link rel="icon" href="' . htmlspecialchars(module_theme::get_config('theme_favicon', '')) . '">' : '', 'AUTOMATIC_STYLES' => $css, 'AUTOMATIC_SCRIPTS' => $scripts));
                echo $external_template->render('raw');
                break;
            case 'html':
            default:
                $c = $this->replace_content();
                if ($this->wysiwyg) {
                    //$c = nl2br($c);
                }
                echo $c;
                break;
        }
        return ob_get_clean();
    }
예제 #10
0
파일: job.php 프로젝트: sgh1986915/php-crm
    public function external_hook($hook)
    {
        switch ($hook) {
            case 'public':
                $job_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                if ($job_id && $hash) {
                    $correct_hash = $this->link_public($job_id, true);
                    if ($correct_hash == $hash) {
                        // all good to print a receipt for this payment.
                        $job_data = $this->get_job($job_id);
                        if ($job_data) {
                            $job_data = self::get_replace_fields($job_id, $job_data);
                            $customer_data = $job_data['customer_id'] ? module_customer::get_replace_fields($job_data['customer_id']) : array();
                            $website_data = $job_data['website_id'] ? module_website::get_replace_fields($job_data['website_id']) : array();
                            module_template::init_template('external_job', '{HEADER}<h2>Job Overview</h2>
Job Name: <strong>{JOB_NAME}</strong> <br/>
{PROJECT_TYPE} Name: <strong>{PROJECT_NAME}</strong> <br/>

<br/>
<h3>Task List: {TASK_PERCENT_COMPLETED}</h3> <br/>
{TASK_LIST}
<br/><br/>
{JOB_INVOICES}
', 'Used when displaying the external view of a job.', 'code');
                            // correct!
                            // load up the receipt template.
                            $template = module_template::get_template_by_key('external_job');
                            // generate the html for the task output
                            ob_start();
                            include module_theme::include_ucm('includes/plugin_job/pages/job_public.php');
                            $public_html = ob_get_clean();
                            $job_data['task_list'] = $public_html;
                            // do we link the job name?
                            $job_data['header'] = '';
                            if (module_security::is_logged_in() && $this->can_i('edit', 'Jobs')) {
                                $job_data['header'] = '<div style="text-align: center; padding: 0 0 10px 0; font-style: italic;">' . _l('You can send this page to your customer as a quote or progress update (this message will be hidden).') . '</div>';
                            }
                            // is this a job or a quote?
                            if ($job_data['date_quote'] != '0000-00-00' && ($job_data['date_start'] == '0000-00-00' && $job_data['date_completed'] == '0000-00-00')) {
                                $job_data['job_or_quote'] = _l('Quote');
                            } else {
                                $job_data['job_or_quote'] = _l('Job');
                            }
                            //$job_data['job_name'] = $job_data['name'];
                            $job_data['job_name'] = self::link_open($job_id, true);
                            // format some dates:
                            $job_data['date_quote'] = $job_data['date_quote'] == '0000-00-00' ? _l('N/A') : print_date($job_data['date_quote']);
                            $job_data['date_start'] = $job_data['date_start'] == '0000-00-00' ? _l('N/A') : print_date($job_data['date_start']);
                            $job_data['date_due'] = $job_data['date_due'] == '0000-00-00' ? _l('N/A') : print_date($job_data['date_due']);
                            $job_data['date_completed'] = $job_data['date_completed'] == '0000-00-00' ? _l('N/A') : print_date($job_data['date_completed']);
                            $job_data['TASK_PERCENT_COMPLETED'] = $job_data['total_percent_complete'] > 0 ? _l('(%s%% completed)', $job_data['total_percent_complete'] * 100) : '';
                            $job_data['job_invoices'] = '';
                            $invoices = module_invoice::get_invoices(array('job_id' => $job_id));
                            $job_data['project_type'] = _l(module_config::c('project_name_single', 'Website'));
                            //$website_data = $job_data['website_id'] ? module_website::get_website($job_data['website_id']) : array();
                            $job_data['project_name'] = isset($website_data['name']) && strlen($website_data['name']) ? $website_data['name'] : _l('N/A');
                            if (count($invoices)) {
                                $job_data['job_invoices'] .= '<h3>' . _l('Job Invoices:') . '</h3>';
                                $job_data['job_invoices'] .= '<ul>';
                                foreach ($invoices as $invoice) {
                                    $job_data['job_invoices'] .= '<li>';
                                    $invoice = module_invoice::get_invoice($invoice['invoice_id']);
                                    $job_data['job_invoices'] .= module_invoice::link_open($invoice['invoice_id'], true);
                                    $job_data['job_invoices'] .= "<br/>";
                                    $job_data['job_invoices'] .= _l('Total: ') . dollar($invoice['total_amount'], true, $invoice['currency_id']);
                                    $job_data['job_invoices'] .= "<br/>";
                                    $job_data['job_invoices'] .= '<span class="';
                                    if ($invoice['total_amount_due'] > 0) {
                                        $job_data['job_invoices'] .= 'error_text';
                                    } else {
                                        $job_data['job_invoices'] .= 'success_text';
                                    }
                                    $job_data['job_invoices'] .= '">';
                                    if ($invoice['total_amount_due'] > 0) {
                                        $job_data['job_invoices'] .= dollar($invoice['total_amount_due'], true, $invoice['currency_id']);
                                        $job_data['job_invoices'] .= ' ' . _l('due');
                                    } else {
                                        $job_data['job_invoices'] .= _l('All paid');
                                    }
                                    $job_data['job_invoices'] .= '</span>';
                                    $job_data['job_invoices'] .= "<br>";
                                    // view receipts:
                                    $payments = module_invoice::get_invoice_payments($invoice['invoice_id']);
                                    if (count($payments)) {
                                        $job_data['job_invoices'] .= "<ul>";
                                        foreach ($payments as $invoice_payment_id => $invoice_payment_data) {
                                            $job_data['job_invoices'] .= "<li>";
                                            $job_data['job_invoices'] .= '<a href="' . module_invoice::link_receipt($invoice_payment_data['invoice_payment_id']) . '" target="_blank">' . _l('View Receipt for payment of %s', dollar($invoice_payment_data['amount'], true, $invoice_payment_data['currency_id'])) . '</a>';
                                            $job_data['job_invoices'] .= "</li>";
                                        }
                                        $job_data['job_invoices'] .= "</ul>";
                                    }
                                    $job_data['job_invoices'] .= '</li>';
                                }
                                $job_data['job_invoices'] .= '</ul>';
                            }
                            $template->assign_values($customer_data);
                            $template->assign_values($website_data);
                            $template->assign_values($job_data);
                            $template->page_title = $job_data['name'];
                            echo $template->render('pretty_html');
                        }
                    }
                }
                break;
        }
    }
예제 #11
0
    public function external_hook($hook)
    {
        switch ($hook) {
            case 'popup':
                // popup not used any more. cross domain issues.
                // load up the full script to be injected into our clients website.
                $website_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $change_request_id = $change_id = isset($_REQUEST['change_id']) ? (int) $_REQUEST['change_id'] : false;
                $hash = isset($_REQUEST['hash']) ? $_REQUEST['hash'] : false;
                $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : false;
                if ($type == 'popupjs') {
                    @ob_end_clean();
                    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                    header("Cache-Control: no-cache");
                    header("Pragma: no-cache");
                    header("Content-type: text/javascript");
                }
                if ($website_id && $hash && module_change_request::link_popup($website_id, true) == $hash) {
                    $change_history = module_change_request::get_remaining_changes($website_id);
                    $step = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0;
                    // get the change details out
                    if ($change_request_id) {
                        $change_request = module_change_request::get_change_request_by_website($website_id, $change_request_id);
                    } else {
                        $change_request = array();
                    }
                    if (!$change_request) {
                        $change_request = array('change_request_id' => 0, 'name' => '', 'request' => '', 'attachments' => array());
                    }
                    switch ($type) {
                        case 'save':
                            // saving a change.
                            $data = $_POST;
                            $data['url'] = urldecode($data['url']);
                            $data['website_id'] = $website_id;
                            $data['change_request_id'] = $change_request['change_request_id'];
                            if (isset($_REQUEST['completed_test'])) {
                                if (!isset($_REQUEST['completed']) || !$_REQUEST['completed']) {
                                    $data['status'] = _CHANGE_REQUEST_STATUS_NEW;
                                    // not completed.
                                } else {
                                    $data['status'] = _CHANGE_REQUEST_STATUS_COMPLETE;
                                    // completed!
                                }
                            }
                            if (isset($_REQUEST['delete_request'])) {
                                $data['status'] = _CHANGE_REQUEST_STATUS_DELETE;
                                // deleted
                            }
                            $change_request_id = update_insert('change_request_id', $change_request['change_request_id'], 'change_request', $data);
                            // redirect to send email page if we're logged in
                            if (module_security::is_logged_in() && isset($_REQUEST['completed_send_email']) && $_REQUEST['completed_send_email'] && self::can_i('edit', 'Change Requests')) {
                                // don't do the template, do the redirect to the email page (todo!)
                                redirect_browser(self::link_open($change_request_id));
                            } else {
                                // send email to administrator (everyone with change request edit permissions?) about this change request.
                                $alert_users = module_user::get_users_by_permission(array('category' => 'Change Request', 'name' => 'Change Requests', 'module' => 'change_request', 'edit' => 1));
                                $email_data = get_single('change_request', 'change_request_id', $change_request_id);
                                $customer_data = $website_data = array();
                                if ($website_id) {
                                    $website_data = module_website::get_website($website_id);
                                    $email_data['website_name'] = $website_data['name'];
                                    $email_data['website_link'] = module_website::link_open($website_id, true);
                                    if ($website_data && $website_data['customer_id']) {
                                        $customer_data = module_customer::get_customer($website_data['customer_id'], true);
                                    }
                                }
                                if (isset($email_data['request'])) {
                                    $email_data['request'] = nl2br($email_data['request']);
                                    // for the plain text emails.
                                }
                                foreach ($alert_users as $alert_user) {
                                    // todo: make sure this staff member has access to this website?
                                    // nfi how to figure this out. maybe we just look for staff members who are assigned jobs/tasks against this website?
                                    $template = module_template::get_template_by_key('change_request_alert_email');
                                    $template->assign_values(array_merge($customer_data, $website_data, $email_data));
                                    $html = $template->render('html');
                                    // send an email to this user.
                                    $email = module_email::new_email();
                                    $email->replace_values = array_merge($customer_data, $website_data, $email_data);
                                    $email->set_to('user', $alert_user['user_id']);
                                    $email->set_from('user', module_security::get_loggedin_id() ? module_security::get_loggedin_id() : isset($customer_data['primary_user_id']) ? $customer_data['primary_user_id'] : 0);
                                    $email->set_subject($template->description);
                                    // do we send images inline?
                                    $email->set_html($html);
                                    if ($email->send()) {
                                        // it worked successfully!!
                                        // sweet.
                                    } else {
                                        /// log err?
                                        set_error(_l('Failed to send change notification email to User ID: %s Email: %s Status: %s Error: %s', $alert_user['user_id'], json_encode($email->to), $email->status, $email->error_text));
                                    }
                                }
                            }
                            // display thankyou template.
                            module_template::init_template('change_request_submitted', '<h2>Change Request</h2>
    <p>Thank you. Your change request has been submitted successfully.</p>
    <p>Please <a href="{URL}">click here</a> to continue.</p>
    ', 'Displayed after a change request is created/updated.', 'code');
                            // correct!
                            // load up the receipt template.
                            $template = module_template::get_template_by_key('change_request_submitted');
                            $template->page_title = _l("Change Request");
                            foreach ($data as $key => $val) {
                                if (!is_array($val)) {
                                    $data[$key] = htmlspecialchars($val);
                                }
                            }
                            $template->assign_values($data);
                            echo $template->render('pretty_html');
                            exit;
                            break;
                        case 'display_change':
                            ob_start();
                            ?>

                            <div class="title">
                                <?php 
                            _e('Change request');
                            ?>

                            </div>
                            <div class="content">
                                <p><?php 
                            echo nl2br(htmlspecialchars($change_request['request']));
                            ?>
</p>
                                <div class="wp3changerequest_actions">
                                    <p>
                                       <!-- <strong><?php 
                            _e('Attachments:');
                            ?>
</strong>
                                        <?php 
                            if (!$change_request['attachments']) {
                                ?>
 - none - <?php 
                            } else {
                                foreach ($change_request['attachments'] as $attachment) {
                                    ?>

                                            <a href="#"><?php 
                                    echo htmlspecialchars($attachment->name);
                                    ?>
</a>
                                            <?php 
                                }
                                ?>

                                        <?php 
                            }
                            ?>

                                        <br/>-->
                                        <strong><?php 
                            _e('Created by:');
                            ?>
</strong> <?php 
                            echo htmlspecialchars($change_request['name']);
                            ?>
 <br/>
                                        <strong><?php 
                            _e('Created on:');
                            ?>
</strong> <?php 
                            echo print_date($change_request['date_created'], true);
                            ?>

	                                    <?php 
                            if (isset($change_request['job_id']) && $change_request['job_id']) {
                                ?>
 <br/>
		                                    <strong><?php 
                                _e('Converted to job:');
                                ?>
</strong> <?php 
                                _e('This task has been converted to a Job');
                                ?>

	                                    <?php 
                            }
                            ?>

                                    </p>
                                    <?php 
                            if (!isset($change_request['job_id']) || !$change_request['job_id'] || self::can_i('edit', 'Change Requests')) {
                                ?>

                                    <p align="center">
                                        <input type="button" name="edit" value="<?php 
                                _e('Edit');
                                ?>
" class="wp3changerequest_button wp3changerequest_button_small"  onclick="dtbaker_changerequest.edit(<?php 
                                echo $change_request_id;
                                ?>
); return false;">
                                    </p>
	                                <?php 
                            }
                            ?>

                                </div>
                            </div>
                            <?php 
                            $change_request['html'] = preg_replace('/\\s+/', ' ', ob_get_clean());
                            //                                echo json_encode($change_request);
                            //                                exit;
                            @ob_end_clean();
                            header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                            header("Cache-Control: no-cache");
                            header("Pragma: no-cache");
                            header("Content-type: text/javascript");
                            ?>


                            var t = dtbaker_changerequest;
                            var change_id = <?php 
                            echo $change_request_id;
                            ?>
;
                                var msg = <?php 
                            echo json_encode($change_request);
                            ?>
;

                            jQuery('body').prepend('<div class="wp3changerequest_change" id="dtbaker_change_'+change_id+'" style="'+((!t.show_postits) ? 'display:none;':'')+'"></div>');
                            var box = jQuery('#dtbaker_change_'+change_id);
                            box.html(msg.html);
                            if(msg.status == 0){
                                box.addClass('wp3changerequest_change_pending');
                            }else if(msg.status == 2){
                                box.addClass('wp3changerequest_change_complete');
                            }else if(msg.status == 3){
                                box.addClass('wp3changerequest_change_deleted');
                            }
                            box.css('top',msg.y+'px');
                            box.data('window_width',msg.window_width);
                            box.data('left',msg.x);
                            t.set_left(change_id);
                            with({i:change_id}){
                                jQuery(window).resize(function () {
                                    t.set_left(i);
                                });
                            }
                            box.data('original_height',box.height());
                            box.css('overflow','hidden');
                            jQuery('.title',box).slideUp();
                            box.stop(true, true).animate({
                                height: t.min_height,
                                width: t.min_width
                            },500);
                            box.hover(function(){
                                jQuery(this).addClass('wp3changerequest_change_active');
                                jQuery('.title',this).stop(true, true).slideDown();
                                jQuery(this).stop().animate({
                                    width: t.max_width,
                                    height: jQuery(this).data('original_height'),
                                    opacity: 1
                                },500);
                            },function(){
                                jQuery('.title',this).stop(true, true).slideUp();
                                jQuery(this).stop().animate({
                                    width: t.min_width,
                                    height: t.min_height,
                                    opacity: 0.7
                                },500,function(){
                                    jQuery(this).removeClass('wp3changerequest_change_active');
                                });
                            })


                                <?php 
                            break;
                        default:
                            @ob_end_clean();
                            header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                            header("Cache-Control: no-cache");
                            header("Pragma: no-cache");
                            header("Content-type: text/javascript");
                            ob_start();
                            include 'pages/popup.php';
                            $html = ob_get_clean();
                            $html = addcslashes($html, "'");
                            $html = preg_replace('#\\r|\\n#', "' +\n'", $html);
                            // inject using javascript. fixes cross domain issues
                            ?>

                            if(!jQuery('#dtbaker_changerequest_inlinewizard').length){
                                // fix for jQuery 1.9+
                                jQuery('body').append('<div id="dtbaker_changerequest_inlinewizard" style="display:none;"></div>');
                            }
                            jQuery('#dtbaker_changerequest_inlinewizard').html('<?php 
                            echo $html;
                            ?>
');
                            <?php 
                    }
                }
                exit;
                break;
            case 'script':
                // load up the full script to be injected into our clients website.
                $website_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? $_REQUEST['hash'] : false;
                @ob_end_clean();
                header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                header("Cache-Control: no-cache");
                header("Pragma: no-cache");
                header("Content-type: text/javascript");
                if ($website_id && $hash && module_change_request::link_script($website_id, true) == $hash) {
                    include "js/client.js";
                    $client_url = isset($_REQUEST['url']) ? $_REQUEST['url'] : false;
                    if ($client_url) {
                        $change_requests = self::get_change_requests(array('website_id' => $website_id, 'url' => $client_url));
                        // todo - option this out incase url causes issues. ie: old js check method
                        ?>

                        jQuery(function(){
                            <?php 
                        foreach ($change_requests as $change_request) {
                            $displayed = false;
                            if ($change_request['status'] == _CHANGE_REQUEST_STATUS_NEW) {
                                $displayed = true;
                                ?>

                                    dtbaker_changerequest.display_change(<?php 
                                echo $change_request['change_request_id'];
                                ?>
);
                            <?php 
                            }
                            if (isset($_SESSION['_change_request_highlight']) && $_SESSION['_change_request_highlight'] == $change_request['change_request_id']) {
                                ?>

                                    <?php 
                                if (!$displayed) {
                                    ?>

                                    dtbaker_changerequest.display_change(<?php 
                                    echo $change_request['change_request_id'];
                                    ?>
);
                                    <?php 
                                }
                                ?>

                                    dtbaker_changerequest.highlight(<?php 
                                echo (int) $_SESSION['_change_request_highlight'];
                                ?>
);
                                    <?php 
                                unset($_SESSION['_change_request_highlight']);
                            }
                        }
                        ?>

                        });
                        <?php 
                    } else {
                        // not posting the URL, some setups do not like this
                        // get list of active change requests
                        $change_requests = self::get_change_requests(array('website_id' => $website_id, 'status' => _CHANGE_REQUEST_STATUS_NEW));
                        // we also do completed ones because the change request highlight countbe in there
                        $completed_change_requests = self::get_change_requests(array('website_id' => $website_id, 'status' => _CHANGE_REQUEST_STATUS_COMPLETE));
                        ?>


                        jQuery(function(){
                            var current_url = window.location.href;
                            <?php 
                        foreach ($change_requests as $change_request) {
                            ?>

                            if(current_url == '<?php 
                            echo addcslashes(htmlspecialchars($change_request['url']), "'");
                            ?>
'){
                                // todo: do this better!
                                dtbaker_changerequest.display_change(<?php 
                            echo $change_request['change_request_id'];
                            ?>
);
                            }
                            <?php 
                        }
                        ?>

                            <?php 
                        // todo: do we display all previous change requests on the page or not?
                        if (isset($_SESSION['_change_request_highlight']) && $_SESSION['_change_request_highlight']) {
                            echo '// Checking for request: ' . (int) $_SESSION['_change_request_highlight'];
                            foreach ($completed_change_requests as $complete_change_request) {
                                if ($complete_change_request['change_request_id'] == $_SESSION['_change_request_highlight']) {
                                    // show this completed one as well.
                                    ?>

                                        dtbaker_changerequest.display_change(<?php 
                                    echo $complete_change_request['change_request_id'];
                                    ?>
);
                                        <?php 
                                }
                            }
                            ?>

                            dtbaker_changerequest.highlight(<?php 
                            echo (int) $_SESSION['_change_request_highlight'];
                            ?>
);
                            <?php 
                            // todo: move this unset over to the "display_change" callback so we only remove the session when we know it has been displayed.
                            unset($_SESSION['_change_request_highlight']);
                        }
                        ?>

                        });
                        <?php 
                    }
                }
                exit;
                break;
            case 'public':
                $website_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? $_REQUEST['hash'] : false;
                if ($website_id && $hash && module_change_request::link_public($website_id, true) == $hash) {
                    // correct!
                    // redirect to website with our "change_request" url parameter, that is picked up by the included text.
                    $website = module_website::get_website($website_id);
                    $change_request_website = get_single('change_request_website', 'website_id', $website_id);
                    if ($change_request_website && $change_request_website['enabled']) {
                        $url = module_website::urlify($website['url']);
                        // todo - pass this to a (yet to be created) method in website that will deal with https:// or http:// based on user input. stop hardcoding http!
                        if (isset($_REQUEST['change_request_id'])) {
                            $selected_change_request = self::get_change_request_by_website($website_id, (int) $_REQUEST['change_request_id']);
                            if ($selected_change_request && $selected_change_request['url']) {
                                $url = $selected_change_request['url'];
                            }
                            //$url .= "&change_request_id=".(int)$_REQUEST['change_request_id'];
                            $_SESSION['_change_request_highlight'] = (int) $_REQUEST['change_request_id'];
                        }
                        $url = $url . (strpos($url, '?') === false ? '?' : '&') . 'change_request=' . self::link_script($website_id, true);
                        redirect_browser($url);
                    }
                }
                echo "Change request disabled.";
                break;
        }
    }
예제 #12
0
    public static function start_payment($invoice_id, $payment_amount, $invoice_payment_id, $user_id = false)
    {
        if ($invoice_id && $payment_amount && $invoice_payment_id) {
            // we are starting a payment via stripe!
            // setup a pending payment and redirect to stripe.
            $invoice_data = module_invoice::get_invoice($invoice_id);
            if (!$user_id) {
                $user_id = $invoice_data['user_id'];
            }
            if (!$user_id) {
                $user_id = isset($invoice_data['primary_user_id']) ? $invoice_data['primary_user_id'] : 0;
            }
            if (!$user_id) {
                $user_id = module_security::get_loggedin_id();
            }
            $user_data = module_user::get_user($user_id);
            if (!$user_data || !strpos($user_data['email'], '@')) {
                die('Please ensure your user account has a valid email address before paying with stripe');
            }
            $invoice_payment_data = module_invoice::get_invoice_payment($invoice_payment_id);
            // we add the fee details to the invoice payment record so that the new invoice total can be calculated.
            $fee_percent = module_config::c('payment_method_stripe_charge_percent', 0);
            $fee_amount = module_config::c('payment_method_stripe_charge_amount', 0);
            $fee_description = module_config::c('payment_method_stripe_charge_description', 'Stripe Fee');
            $fee_total = 0;
            if ($fee_percent != 0 || $fee_amount != 0) {
                $fee_total = module_invoice::calculate_fee($invoice_id, $invoice_data, $payment_amount, array('percent' => $fee_percent, 'amount' => $fee_amount, 'description' => $fee_description));
                if ($fee_total != 0) {
                    // add this percent/amount to the invoice payment
                    $payment_amount = $payment_amount + $fee_total;
                    update_insert('invoice_payment_id', $invoice_payment_id, 'invoice_payment', array('fee_percent' => $fee_percent, 'fee_amount' => $fee_amount, 'fee_description' => $fee_description, 'fee_total' => $fee_total, 'amount' => $payment_amount));
                }
            }
            // we check if this payment is a recurring payment or a standard one off payment.
            if (module_config::c('payment_method_stripe_subscriptions', 0)) {
                // we support subscriptions!
                // first check if the subscription module is active, and if this invoice is part of an active subscription.
                $is_subscription = false;
                if (class_exists('module_subscription', false)) {
                    $subscription_history = get_single('subscription_history', 'invoice_id', $invoice_id);
                    if ($subscription_history && $subscription_history['subscription_id']) {
                        // this invoice is for a subscription! woo!
                        // work out when we should bill for this subscription.
                        $subscription = module_subscription::get_subscription($subscription_history['subscription_id']);
                        $subscription_owner = module_subscription::get_subscription_owner($subscription_history['subscription_owner_id']);
                        if ($subscription_owner['owner_table'] && $subscription_owner['owner_id']) {
                            // work out when the next invoice will be generated for this subscription.
                            $members_subscriptions = module_subscription::get_subscriptions_by($subscription_owner['owner_table'], $subscription_owner['owner_id']);
                            if (isset($members_subscriptions[$subscription_history['subscription_id']])) {
                                $member_subscription = $members_subscriptions[$subscription_history['subscription_id']];
                                // everything checks out! good to go....
                                // for now we just do a basic "EVERY X TIME" subscription
                                // todo: work out how long until next generate date, and set that (possibly smaller) time period as the first portion of the subscription
                                /*echo '<pre>';
                                  print_r($subscription_history);
                                  print_r($subscription);
                                  print_r($subscription_owner);
                                  print_r($member_subscription);
                                  exit;*/
                                $is_subscription = array();
                                if ($subscription['days'] > 0) {
                                    $is_subscription['days'] = $subscription['days'];
                                }
                                if ($subscription['months'] > 0) {
                                    $is_subscription['months'] = $subscription['months'];
                                }
                                if ($subscription['years'] > 0) {
                                    $is_subscription['years'] = $subscription['years'];
                                }
                                if (count($is_subscription)) {
                                    $is_subscription['name'] = $subscription['name'];
                                    $is_subscription['id'] = $subscription_history['subscription_id'];
                                }
                            }
                        }
                    }
                }
                // todo: check if this invoice has a manual renewal date, perform subscription feature as above.
                if ($is_subscription) {
                    $bits = array();
                    if (isset($is_subscription['days']) && $is_subscription['days'] > 0) {
                        $bits[] = _l('%s days', $is_subscription['days']);
                    }
                    if (isset($is_subscription['months']) && $is_subscription['months'] > 0) {
                        $bits[] = _l('%s months', $is_subscription['months']);
                    }
                    if (isset($is_subscription['years']) && $is_subscription['years'] > 0) {
                        $bits[] = _l('%s years', $is_subscription['years']);
                    }
                    $invoice_payment_data = module_invoice::get_invoice_payment($invoice_payment_id);
                    if (isset($invoice_payment_data['invoice_payment_subscription_id']) && (int) $invoice_payment_data['invoice_payment_subscription_id'] > 0) {
                        // existing subscription already!
                        // not really sure what to do here, just redirect to stripe as if the user is doing it for the first time.
                        $_REQUEST['payment_subscription'] = true;
                        // hacks!
                    }
                    if (isset($_REQUEST['payment_subscription']) || module_config::c('payment_method_stripe_force_subscription', 0)) {
                        // user is setting up a subscription! yes!!
                        // we create an entry in our database for this particular subscription
                        // or if one exists for this payment already then we just continue with that (ie: the user is going in again to redo it)
                        // setup a new subscription in the database for us.
                        if (isset($invoice_payment_data['invoice_payment_subscription_id']) && (int) $invoice_payment_data['invoice_payment_subscription_id'] > 0) {
                            $invoice_payment_subscription_id = $invoice_payment_data['invoice_payment_subscription_id'];
                        } else {
                            $invoice_payment_subscription_id = update_insert('invoice_payment_subscription_id', false, 'invoice_payment_subscription', array('status' => _INVOICE_SUBSCRIPTION_PENDING, 'days' => isset($is_subscription['days']) ? $is_subscription['days'] : 0, 'months' => isset($is_subscription['months']) ? $is_subscription['months'] : 0, 'years' => isset($is_subscription['years']) ? $is_subscription['years'] : 0, 'date_start' => '0000-00-00', 'date_last_pay' => '0000-00-00', 'date_next' => '0000-00-00'));
                            update_insert('invoice_payment_id', $invoice_payment_id, 'invoice_payment', array('invoice_payment_subscription_id' => $invoice_payment_subscription_id));
                        }
                        $description = _l('Recurring payment for %s every %s', $is_subscription['name'], implode(', ', $bits));
                        $subscription_name = $is_subscription['name'];
                        unset($is_subscription['name']);
                        // so reset/key cals below rosk.
                        $subscription_id = $is_subscription['id'];
                        unset($is_subscription['id']);
                        // so reset/key cals below rosk.
                        $currency = module_config::get_currency($invoice_payment_data['currency_id']);
                        // if there are more than 1 recurring amounts then we convert it to weeks, as stripe only supports one time period.
                        if (count($is_subscription) > 1) {
                            $days = isset($is_subscription['days']) ? $is_subscription['days'] : 0;
                            if (isset($is_subscription['months'])) {
                                $days += $is_subscription['months'] * 30;
                                unset($is_subscription['months']);
                            }
                            if (isset($is_subscription['years'])) {
                                $days += $is_subscription['years'] * 365;
                                unset($is_subscription['years']);
                            }
                            $is_subscription['days'] = $days;
                        }
                        reset($is_subscription);
                        $time = key($is_subscription);
                        if ($time == 'days') {
                            // convert days to weeks
                            //$time = 'week';
                            $time = 'day';
                            $period = $is_subscription['days'];
                            //$period = max(1,floor($is_subscription['days'] / 7));
                        } else {
                            if ($time == 'months') {
                                $time = 'month';
                                $period = $is_subscription['months'];
                            } else {
                                if ($time == 'years') {
                                    $time = 'year';
                                    $period = $is_subscription['years'];
                                } else {
                                    die('Failed to create subscription, invalid settings');
                                }
                            }
                        }
                        $stripe_amount = $payment_amount * 100;
                        ini_set('display_errors', true);
                        ini_set('error_reporting', E_ALL);
                        // create or retrieve this subscription.
                        require_once 'includes/plugin_paymethod_stripe/stripe-php/lib/Stripe.php';
                        $stripe = array("secret_key" => module_config::c('payment_method_stripe_secret_key'), "publishable_key" => module_config::c('payment_method_stripe_publishable_key'));
                        Stripe::setApiKey($stripe['secret_key']);
                        $stripe_plan_id = 'sub_' . $subscription_id;
                        $stripe_plan = false;
                        if ($stripe_plan_id) {
                            // get this plan from stripe, and check it's still valid:
                            try {
                                $stripe_plan = Stripe_Plan::retrieve($stripe_plan_id);
                            } catch (Exception $e) {
                                //print_r($e);
                            }
                            if ($stripe_plan && $stripe_plan->interval == $time && $stripe_plan->interval_count == $period && $stripe_plan->amount == $stripe_amount) {
                                // still have a valid plan! yes!
                            } else {
                                // plan no longer exists or has changed
                                $stripe_plan = false;
                            }
                        }
                        if (!$stripe_plan) {
                            try {
                                $settings = array("amount" => $stripe_amount, "interval" => $time, 'interval_count' => $period, "name" => $subscription_name, "currency" => $currency['code'], "id" => $stripe_plan_id, 'metadata' => array('subscription_id' => $subscription_id));
                                $stripe_plan = Stripe_Plan::create($settings);
                            } catch (Exception $e) {
                                //print_r($e);
                            }
                            //                            print_r($stripe_plan);
                        }
                        if ($stripe_plan) {
                            // right to go!
                            // display the stripe payment form (same as stripe_form.php, just we do a subscription rather than once off payment)
                            //self::stripe_redirect($description,$payment_amount,$user_id,$invoice_payment_id,$invoice_id,$invoice_payment_data['currency_id']);
                            $currency = module_config::get_currency($invoice_payment_data['currency_id']);
                            $currency_code = $currency['code'];
                            $template = new module_template();
                            ob_start();
                            ?>
                                <h1><?php 
                            echo htmlspecialchars($description);
                            ?>
</h1>
                                <form action="<?php 
                            echo full_link(_EXTERNAL_TUNNEL . '?m=paymethod_stripe&h=pay_subscription&method=stripe');
                            ?>
" method="post">
                                    <input type="hidden" name="invoice_payment_subscription_id" value="<?php 
                            echo $invoice_payment_subscription_id;
                            ?>
">
                                    <input type="hidden" name="invoice_payment_id" value="<?php 
                            echo $invoice_payment_id;
                            ?>
">
                                    <input type="hidden" name="invoice_id" value="<?php 
                            echo $invoice_id;
                            ?>
">
                                    <input type="hidden" name="stripe_plan_id" value="<?php 
                            echo $stripe_plan_id;
                            ?>
">
                                    <input type="hidden" name="description" value="<?php 
                            echo htmlspecialchars($description);
                            ?>
">
                                    <input type="hidden" name="user_id" value="<?php 
                            echo htmlspecialchars($user_id);
                            ?>
">
                                  <script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
                                          data-key="<?php 
                            echo $stripe['publishable_key'];
                            ?>
"
                                          data-amount="<?php 
                            echo $payment_amount * 100;
                            ?>
"
                                          <?php 
                            if (isset($user_data['email']) && strlen($user_data['email'])) {
                                ?>
                                          data-email="<?php 
                                echo htmlspecialchars($user_data['email']);
                                ?>
"
                                            <?php 
                            }
                            ?>
                                          data-currency="<?php 
                            echo htmlspecialchars($currency_code);
                            ?>
"
                                          data-label="<?php 
                            _e('Pay %s by Credit Card', dollar($payment_amount, true, $invoice_payment_data['currency_id']));
                            ?>
"
                                          data-description="<?php 
                            echo htmlspecialchars($description);
                            ?>
"></script>
                                </form>

                                <p>&nbsp;</p>
                                <p>

                                <a href="<?php 
                            echo module_invoice::link_public($invoice_id);
                            ?>
"><?php 
                            _e("Cancel");
                            ?>
</a>
                                </p>
                                <?php 
                            $template->content = ob_get_clean();
                            echo $template->render('pretty_html');
                            exit;
                        } else {
                            die('Failed to create stripe plan. Please check settings: ' . var_export($stripe_plan, true));
                        }
                    } else {
                        if (isset($_REQUEST['payment_single'])) {
                            // use is choosing to continue payment as a once off amount
                        } else {
                            // give the user an option
                            module_template::init_template('invoice_payment_subscription', '<h2>Payment for Invoice {INVOICE_NUMBER}</h2>
                        <p>Please choose from the available payment options below:</p>
                        <form action="{PAYMENT_URL}" method="post">
                        <input type="hidden" name="invoice_payment_id" value="{INVOICE_PAYMENT_ID}">
                        <input type="hidden" name="payment_method" value="{PAYMENT_METHOD}">
                        <input type="hidden" name="payment_amount" value="{PAYMENT_AMOUNT}">
                        <p><input type="submit" name="payment_single" value="Pay a Once Off amount of {PRETTY_PAYMENT_AMOUNT}"></p>
                        <p><input type="submit" name="payment_subscription" value="Setup Automatic Payments of {PRETTY_PAYMENT_AMOUNT} every {SUBSCRIPTION_PERIOD}"></p>
                        </form>
                        ', 'Used when a customer tries to pay an invoice that has a subscription option.', 'code');
                            $template = module_template::get_template_by_key('invoice_payment_subscription');
                            $template->page_title = htmlspecialchars($invoice_data['name']);
                            $template->assign_values($invoice_payment_data);
                            $template->assign_values(module_invoice::get_replace_fields($invoice_data['invoice_id'], $invoice_data));
                            $template->assign_values(array('invoice_payment_id' => $invoice_payment_id, 'payment_url' => module_invoice::link_public_pay($invoice_data['invoice_id']), 'payment_method' => 'paymethod_stripe', 'payment_amount' => $payment_amount, 'pretty_payment_amount' => dollar($payment_amount, true, $invoice_data['currency_id']), 'subscription_period' => implode(', ', $bits), 'fee_amount' => dollar($fee_amount, true, $invoice_data['currency_id']), 'fee_total' => dollar($fee_total, true, $invoice_data['currency_id']), 'fee_percent' => $fee_percent, 'fee_description' => $fee_description));
                            echo $template->render('pretty_html');
                            exit;
                        }
                    }
                }
            }
            $description = _l('Payment for invoice %s', $invoice_data['name']);
            //self::stripe_redirect($description,$payment_amount,$user_id,$invoice_payment_id,$invoice_id,$invoice_payment_data['currency_id']);
            $currency = module_config::get_currency($invoice_payment_data['currency_id']);
            $currency_code = $currency['code'];
            $template = new module_template();
            ob_start();
            include module_theme::include_ucm('includes/plugin_paymethod_stripe/pages/stripe_form.php');
            $template->content = ob_get_clean();
            echo $template->render('pretty_html');
            exit;
        }
        return false;
    }
예제 #13
0
    public function init()
    {
        $this->links = array();
        $this->newsletter_types = array();
        $this->module_name = "newsletter";
        $this->module_position = 22;
        if ($this->can_i('view', 'Newsletters')) {
            $this->links[] = array("name" => module_config::c('newsletter_tab_name', 'Newsletters'), "p" => "newsletter_admin", 'args' => array('newsletter_id' => false), 'icon_name' => 'envelope-o');
            if (isset($_REQUEST['member_id']) && (int) $_REQUEST['member_id'] > 0) {
                $this->links[] = array("name" => "Member Newsletters", "p" => "newsletter_member", 'args' => array('newsletter_id' => false, 'member_id' => (int) $_REQUEST['member_id']), 'holder_module' => 'member', 'holder_module_page' => 'member_admin', 'menu_include_parent' => 1, 'allow_nesting' => 1);
            }
        }
        if (module_config::can_i('view', 'Settings')) {
            $this->links[] = array("name" => module_config::c('newsletter_tab_name', 'Newsletters'), "p" => "newsletter_settings", "args" => array('user_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0, 'order' => 3);
        }
        module_config::register_css('newsletter', 'newsletter.css');
        // todo - search the newsletter_send list for subjects as well..
        /*$this->ajax_search_keys = array(
              _DB_PREFIX.'newsletter' => array(
                  'plugin' => 'newsletter',
                  'search_fields' => array(
                      'subject',
                  ),
                  'key' => 'newsletter_id',
                  'title' => _l('Newsletter: '),
              ),
          );*/
        if (class_exists('module_template', false)) {
            module_template::init_template('newsletter_unsubscribe_done', '<h2>Unsubscribe Successful</h2>
    <p>Email Address: <strong>{EMAIL}</strong> </p>
    <p>You have been successfully unsubscribed from the newsletter system.</p>
    ', 'Displayed when unsubscription is complete.', 'code', array('EMAIL' => 'The users email address'));
            module_template::init_template('newsletter_unsubscribe', '<h2>Unsubscribe</h2>
<form action="" method="post">
    <p>Please Enter Your Email Address: <input type="text" name="email" value="{EMAIL}"> </p>
    <p><input type="submit" name="confirm" value="Unsubscribe"></p>
</form>
    ', 'Used when a user wishes to unsubscribe.', 'code', array('EMAIL' => 'The users email address', 'UNSUB_CONFIRM' => 'The URL to confirm unsubscription'));
            module_template::init_template('member_subscription_double_optin', '<h2>Confirm Subscription</h2>
<p>Thank you for subscribing to our newsletter system. Please click the link below to confirm your subscription.</p>
<p><a href="{LINK}">{LINK}</a></p>
    ', 'Sent to a user when they subscribe via your website.', 'code', array('EMAIL' => 'The users email address', 'LINK' => 'The URL to confirm subscription'));
            module_template::init_template('member_subscription_confirmed', '<h2>Subscription Confirmed</h2>
<p>Thank you for confirming your newsletter subscription.</p>
    ', 'Displayed after use clicks their double opt-in link.', 'code', array());
        }
    }
예제 #14
0
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!$job_safe) {
    die('failed');
}
if (!module_job::can_i('edit', 'Jobs')) {
    die('no perms');
}
$job_id = (int) $_REQUEST['job_id'];
$job = module_job::get_job($job_id);
module_template::init_template('job_email', 'Dear {CUSTOMER_NAME},<br>
<br>
Please find below details on your job request: {JOB_NAME}.<br><br>
You can also view this job online by <a href="{JOB_URL}">clicking here</a>.<br><br>
{JOB_TASKS}<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'Job: {JOB_NAME}', array('CUSTOMER_NAME' => 'Customers Name', 'JOB_NAME' => 'Job Name', 'TOTAL_AMOUNT' => 'Total amount of job', 'TOTAL_AMOUNT_DUE' => 'Total amount of job remaining to be paid', 'FROM_NAME' => 'Your name', 'JOB_URL' => 'Link to job for customer', 'JOB_TASKS' => 'Output of job tasks similar to public link'));
// template for sending emails.
// are we sending the paid one? or the dueone.
//$template_name = 'job_email';
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : 'job_email';
$template = module_template::get_template_by_key($template_name);
$job['total_amount_print'] = dollar($job['total_amount'], true, $job['currency_id']);
$job['total_amount_due_print'] = dollar($job['total_amount_due'], true, $job['currency_id']);
$job['job_name'] = $job['name'];
$job['from_name'] = module_security::get_loggedin_name();
$job['job_url'] = module_job::link_public($job_id);
ob_start();
$job_data = $job;
예제 #15
0
    public function external_hook($hook)
    {
        switch ($hook) {
            case 'attachment':
                $ticket_id = isset($_REQUEST['t']) ? (int) $_REQUEST['t'] : false;
                $ticket_message_attachment_id = isset($_REQUEST['tma']) ? (int) $_REQUEST['tma'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                if ($ticket_id && $ticket_message_attachment_id && $hash) {
                    $correct_hash = $this->link_open_attachment($ticket_id, $ticket_message_attachment_id, true);
                    if ($correct_hash == $hash) {
                        $attach = get_single('ticket_message_attachment', 'ticket_message_attachment_id', $ticket_message_attachment_id);
                        if (file_exists('includes/plugin_ticket/attachments/' . $attach['ticket_message_attachment_id'])) {
                            header("Content-type: application/octet-stream");
                            header('Content-Disposition: attachment; filename="' . $attach['file_name'] . '";');
                            $size = @readfile('includes/plugin_ticket/attachments/' . $attach['ticket_message_attachment_id']);
                            if (!$size) {
                                echo file_get_contents('includes/plugin_ticket/attachments/' . $attach['ticket_message_attachment_id']);
                            }
                        } else {
                            echo 'File no longer exists';
                        }
                    }
                }
                exit;
                break;
            case 'status':
                ob_start();
                ?>


                    <table class="wpetss wpetss_status">
                        <tbody>
                        <tr>
                            <th><?php 
                _e('New/Pending Tickets');
                ?>
</th>
                            <td>
                                <?php 
                $sql = "SELECT COUNT(ticket_id) AS c FROM `" . _DB_PREFIX . "ticket` WHERE status_id = 1 OR status_id = 2";
                $res = qa1($sql);
                echo $res['c'];
                ?>

                            </td>
                        </tr>
                        <tr>
                            <th><?php 
                _e('In Progress Tickets');
                ?>
</th>
                            <td>
                                <?php 
                $sql = "SELECT COUNT(ticket_id) AS c FROM `" . _DB_PREFIX . "ticket` WHERE status_id = 3 OR status_id = " . _TICKET_STATUS_IN_PROGRESS_ID;
                $res = qa1($sql);
                echo $res['c'];
                ?>

                            </td>
                        </tr>
                        <tr>
                            <th><?php 
                _e('Resolved Tickets');
                ?>
</th>
                            <td>
                                <?php 
                $sql = "SELECT COUNT(ticket_id) AS c FROM `" . _DB_PREFIX . "ticket` WHERE status_id >= " . _TICKET_STATUS_RESOLVED_ID;
                $res = qa1($sql);
                echo $res['c'];
                ?>

                            </td>
                        </tr>
                        <tr>
                            <th><?php 
                _e('Estimated Turn Around');
                ?>
</th>
                            <td>
                                <?php 
                echo _l('We will reply within %s and %s %S', module_config::c('ticket_turn_around_days_min', 2), module_config::c('ticket_turn_around_days', 5), module_config::c('ticket_turn_around_period', 'days'));
                ?>

                            </td>
                        </tr>
                        <tr>
                            <th><?php 
                _e('Current Reply Rate');
                ?>
</th>
                            <td>
                                <?php 
                $rate = module_ticket::get_reply_rate();
                echo _l('We are currently processing %s tickets every 24 hours', $rate['daily']);
                ?>

                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <?php 
                echo preg_replace('/\\s+/', ' ', ob_get_clean());
                exit;
                break;
            case 'public_new':
                $ticket_id = 'new';
                $ticket_account_id = module_config::c('ticket_default_account_id', 0);
                //todo: set from a hashed variable in GET string.
                if ($ticket_account_id) {
                    $ticket_account = self::get_ticket_account($ticket_account_id);
                } else {
                    $ticket_account_id = 0;
                    $ticket_account = array();
                }
                if (!$ticket_account || $ticket_account['ticket_account_id'] != $ticket_account_id) {
                    // dont support accounts yet. work out the default customer id etc.. from settings.
                    $ticket_account = array('ticket_account_id' => 0, 'default_customer_id' => module_config::c('ticket_default_customer_id', 1), 'default_user_id' => module_config::c('ticket_default_user_id', 1), 'default_type' => module_config::c('ticket_type_id_default', 0));
                }
                // hack to better support recaptcha errors.
                $save_public_ticket = false;
                $errors = array();
                if (isset($_REQUEST['_process']) && $_REQUEST['_process'] == 'save_public_ticket') {
                    // user is saving the ticket.
                    // process it!
                    $save_public_ticket = true;
                    if (module_config::c('ticket_recaptcha', 1)) {
                        if (!module_captcha::check_captcha_form()) {
                            // captcha was wrong.
                            $errors[] = _l('Sorry the captcha code you entered was incorrect. Please try again.');
                            if (isset($_FILES['attachment']) && isset($_FILES['attachment']['tmp_name']) && is_array($_FILES['attachment']['tmp_name'])) {
                                foreach ($_FILES['attachment']['tmp_name'] as $key => $val) {
                                    if (is_uploaded_file($val)) {
                                        $errors[] = _l('Please select your file attachments again as well.');
                                        break;
                                    }
                                }
                            }
                            $save_public_ticket = false;
                        }
                    }
                }
                if ($save_public_ticket && isset($_POST['new_ticket_message']) && strlen($_POST['new_ticket_message']) > 1) {
                    // this allows input variables to be added to our $_POST
                    // like extra fields etc.. from envato module.
                    handle_hook('ticket_create_post', $ticket_id);
                    // we're posting from a public account.
                    // check required fields.
                    if (!trim($_POST['subject'])) {
                        return false;
                    }
                    // check this user has a valid email address, find/create a user in the ticket user table.
                    // see if this email address exists in the wp user table, and link that user there.
                    $email = trim(strtolower($_POST['email']));
                    $name = trim($_POST['name']);
                    if (strpos($email, '@')) {
                        //todo - validate email.
                        $sql = "SELECT * FROM `" . _DB_PREFIX . "user` u WHERE u.`email` LIKE '" . mysql_real_escape_string($email) . "'";
                        $from_user = qa1($sql);
                        if ($from_user) {
                            $from_user_id = $from_user['user_id'];
                            // woo!! found a user. assign this customer to the ticket.
                            if ($from_user['customer_id']) {
                                $ticket_account['default_customer_id'] = $from_user['customer_id'];
                            }
                        } else {
                            // create a user under this account customer.
                            $default_customer_id = 0;
                            if ($ticket_account && $ticket_account['default_customer_id']) {
                                $default_customer_id = $ticket_account['default_customer_id'];
                            }
                            // create a new support user! go go!
                            if (strlen($name)) {
                                $bits = explode(' ', $name);
                                $first_name = array_shift($bits);
                                $last_name = implode(' ', $bits);
                            } else {
                                $first_name = $email;
                                $last_name = '';
                            }
                            $from_user = array('name' => $first_name, 'last_name' => $last_name, 'customer_id' => $default_customer_id, 'email' => $email, 'status_id' => 1, 'password' => substr(md5(time() . mt_rand(0, 600)), 3, 7));
                            global $plugins;
                            $from_user_id = $plugins['user']->create_user($from_user);
                            // todo: set the default role for this user
                            // based on the settings
                            /*}else{
                                  echo 'Failed - no from accoutn set';
                                  return;
                              }*/
                        }
                        if (!$from_user_id) {
                            echo 'Failed - cannot find the from user id';
                            echo $email . ' to support<hr>';
                            return;
                        }
                        // what type of ticket is this?
                        $public_types = $this->get_types(true);
                        $ticket_type_id = $ticket_account['default_type'];
                        if (isset($_POST['ticket_type_id']) && isset($public_types[$_POST['ticket_type_id']])) {
                            $ticket_type_id = $_POST['ticket_type_id'];
                        }
                        //                                echo $ticket_type_id;exit;
                        $ticket_data = array('user_id' => $from_user_id, 'force_logged_in_user_id' => $from_user_id, 'assigned_user_id' => $ticket_account['default_user_id'] ? $ticket_account['default_user_id'] : 0, 'ticket_type_id' => $ticket_type_id, 'customer_id' => $ticket_account['default_customer_id'], 'status_id' => 2, 'ticket_account_id' => $ticket_account_id, 'unread' => 1, 'subject' => $_POST['subject'], 'new_ticket_message' => $_POST['new_ticket_message'], 'ticket_extra' => isset($_POST['ticket_extra']) && is_array($_POST['ticket_extra']) ? $_POST['ticket_extra'] : array(), 'faq_product_id' => isset($_POST['faq_product_id']) ? (int) $_POST['faq_product_id'] : 0);
                        if (isset($public_types[$ticket_type_id]) && isset($public_types[$ticket_type_id]['default_user_id']) && $public_types[$ticket_type_id]['default_user_id'] > 0) {
                            $ticket_data['assigned_user_id'] = $public_types[$ticket_type_id]['default_user_id'];
                        }
                        if (module_config::c('ticket_allow_priority_selection', 0) && isset($_POST['priority'])) {
                            $priorities = $this->get_ticket_priorities();
                            if (isset($priorities[$_POST['priority']])) {
                                $ticket_data['priority'] = $_POST['priority'];
                            }
                        }
                        $ticket_id = $this->save_ticket('new', $ticket_data);
                        // check if they want a priority support
                        if (isset($_POST['do_priority']) && $_POST['do_priority']) {
                            // generate a "priority invoice" against this support ticket using the invoice module.
                            // this will display the invoice in the sidebar and the user can pay.
                            $this->generate_priority_invoice($ticket_id);
                        }
                        handle_hook('ticket_public_created', $ticket_id);
                        // where to redirect?
                        $url = module_config::c('ticket_public_new_redirect', '');
                        if (!$url) {
                            $url = $this->link_public($ticket_id);
                        }
                        redirect_browser($url);
                    }
                }
                $ticket = self::get_ticket($ticket_id);
                include 'public/ticket_customer_new.php';
                break;
            case 'public_status':
                $ticket_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $new_status_id = isset($_REQUEST['s']) ? (int) $_REQUEST['s'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                if ($ticket_id && $new_status_id && $hash) {
                    $correct_hash = $this->link_public_status($ticket_id, $new_status_id, true);
                    if ($correct_hash == $hash) {
                        // change the status.
                        update_insert('ticket_id', $ticket_id, 'ticket', array('status_id' => $new_status_id));
                        module_template::init_template('ticket_status_change', '<h2>Ticket</h2>
<p>Thank you. Your support ticket status has been adjusted.</p>
<p>Please <a href="{TICKET_URL}">click here</a> to view your ticket.</p>
', 'Displayed after an external ticket status is changed.', 'code');
                        // correct!
                        // load up the receipt template.
                        $template = module_template::get_template_by_key('ticket_status_change');
                        $data = $this->get_ticket($ticket_id);
                        $data['ticket_url'] = $this->link_public($ticket_id);
                        $template->page_title = _l("Ticket");
                        $template->assign_values(self::get_replace_fields($ticket_id, $data));
                        $template->assign_values($data);
                        echo $template->render('pretty_html');
                    }
                }
                exit;
                break;
            case 'public':
                $ticket_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                if ($ticket_id && $hash) {
                    $correct_hash = $this->link_public($ticket_id, true);
                    if ($correct_hash == $hash) {
                        // all good to print a receipt for this payment.
                        $ticket = $this->get_ticket($ticket_id);
                        if (isset($_POST['_process']) && $_POST['_process'] == 'send_public_ticket') {
                            // user is saving the ticket.
                            // process it!
                            if (isset($_POST['new_ticket_message']) && strlen($_POST['new_ticket_message']) > 1) {
                                // post a new reply to this message.
                                // who are we replying to?
                                // it's either a reply from the admin, or from the user via the web interface.
                                $ticket_creator = $ticket['user_id'];
                                $to_user_id = $ticket['assigned_user_id'] ? $ticket['assigned_user_id'] : module_config::c('ticket_default_user_id', 1);
                                $ticket_message_id = $this->send_reply($ticket_id, $_POST['new_ticket_message'], $ticket_creator, $to_user_id, 'end_user');
                                /*$new_status_id = $ticket['status_id'];
                                  if($ticket['status_id']>=6){
                                      // it's cancelled or resolved.
                                  }*/
                                $new_status_id = 5;
                                if ($ticket_message_id) {
                                    // so we can track a history of ticket status changes
                                    update_insert("ticket_message_id", $ticket_message_id, "ticket_message", array('status_id' => $new_status_id));
                                }
                                update_insert("ticket_id", $ticket_id, "ticket", array('unread' => 1, 'status_id' => $new_status_id));
                            }
                            if (isset($_REQUEST['generate_priority_invoice'])) {
                                $invoice_id = $this->generate_priority_invoice($ticket_id);
                                redirect_browser(module_invoice::link_public($invoice_id));
                            }
                            // where to redirect?
                            $url = module_config::c('ticket_public_reply_redirect', '');
                            if (!$url) {
                                $url = $this->link_public($ticket_id);
                            }
                            redirect_browser($url);
                        }
                        if ($ticket && $ticket['ticket_id'] == $ticket_id) {
                            $admins_rel = self::get_ticket_staff_rel();
                            /*if(!isset($logged_in_user) || !$logged_in_user){
                                  // we assume the user is on the public side.
                                  // use the creator id as the logged in id.
                                  $logged_in_user = module_security::get_loggedin_id();
                              }*/
                            // public hack, we are the ticket responder.
                            $logged_in_user = $ticket['user_id'];
                            $ticket_creator = $ticket['user_id'];
                            if ($ticket_creator == $logged_in_user) {
                                // we are sending a reply back to the admin, from the end user.
                                $to_user_id = $ticket['assigned_user_id'] ? $ticket['assigned_user_id'] : module_config::c('ticket_default_user_id', 1);
                                $from_user_id = $logged_in_user;
                            } else {
                                // we are sending a reply back to the ticket user.
                                $to_user_id = $ticket['user_id'];
                                $from_user_id = $logged_in_user;
                            }
                            $to_user_a = module_user::get_user($to_user_id, false);
                            $from_user_a = module_user::get_user($from_user_id, false);
                            if (isset($ticket['ticket_account_id']) && $ticket['ticket_account_id']) {
                                $ticket_account = module_ticket::get_ticket_account($ticket['ticket_account_id']);
                            } else {
                                $ticket_account = false;
                            }
                            if ($ticket_account && $ticket_account['email']) {
                                $reply_to_address = $ticket_account['email'];
                                $reply_to_name = $ticket_account['name'];
                            } else {
                                // reply to creator.
                                $reply_to_address = $from_user_a['email'];
                                $reply_to_name = $from_user_a['name'];
                            }
                            if ($ticket_creator == $logged_in_user) {
                                $send_as_name = $from_user_a['name'];
                                $send_as_address = $from_user_a['email'];
                            } else {
                                $send_as_address = $reply_to_address;
                                $send_as_name = $reply_to_name;
                            }
                            $admins_rel = self::get_ticket_staff_rel();
                            ob_start();
                            include 'public/ticket_customer_view.php';
                            $html = ob_get_clean();
                            module_template::init_template('external_ticket_public_view', '{TICKET_HTML}', 'Used when displaying the external view of a ticket to the customer.', 'code');
                            $template = module_template::get_template_by_key('external_ticket_public_view');
                            $template->assign_values(array('ticket_html' => $html));
                            $template->page_title = _l('Ticket: %s', module_ticket::ticket_number($ticket['ticket_id']));
                            echo $template->render('pretty_html');
                            exit;
                        } else {
                            _e('Permission Denied. Please logout and try again.');
                        }
                    }
                }
                break;
        }
    }
예제 #16
0
 public static function start_payment($invoice_id, $payment_amount, $invoice_payment_id, $user_id = false)
 {
     if ($invoice_id && $payment_amount && $invoice_payment_id) {
         // we are starting a payment via paypal!
         // setup a pending payment and redirect to paypal.
         $invoice_data = module_invoice::get_invoice($invoice_id);
         if (!$user_id) {
             $user_id = $invoice_data['user_id'];
         }
         if (!$user_id) {
             $user_id = isset($invoice_data['primary_user_id']) ? $invoice_data['primary_user_id'] : 0;
         }
         $invoice_payment_data = module_invoice::get_invoice_payment($invoice_payment_id);
         // we add the fee details to the invoice payment record so that the new invoice total can be calculated.
         $fee_percent = module_config::c('payment_method_paypal_charge_percent', 0);
         $fee_amount = module_config::c('payment_method_paypal_charge_amount', 0);
         $fee_description = module_config::c('payment_method_paypal_charge_description', 'PayPal Fee');
         $fee_total = 0;
         if ($fee_percent != 0 || $fee_amount != 0) {
             $fee_total = module_invoice::calculate_fee($invoice_id, $invoice_data, $payment_amount, array('percent' => $fee_percent, 'amount' => $fee_amount, 'description' => $fee_description));
             if ($fee_total != 0) {
                 // add this percent/amount to the invoice payment
                 $payment_amount = $payment_amount + $fee_total;
                 update_insert('invoice_payment_id', $invoice_payment_id, 'invoice_payment', array('fee_percent' => $fee_percent, 'fee_amount' => $fee_amount, 'fee_description' => $fee_description, 'fee_total' => $fee_total, 'amount' => $payment_amount));
             }
         }
         // we check if this payment is a recurring payment or a standard one off payment.
         if (module_config::c('payment_method_paypal_subscriptions', 0)) {
             // we support subscriptions!
             // first check if the subscription module is active, and if this invoice is part of an active subscription.
             $is_subscription = false;
             if (class_exists('module_subscription', false)) {
                 $subscription_history = get_single('subscription_history', 'invoice_id', $invoice_id);
                 if ($subscription_history && $subscription_history['subscription_id']) {
                     // this invoice is for a subscription! woo!
                     // work out when we should bill for this subscription.
                     $subscription = module_subscription::get_subscription($subscription_history['subscription_id']);
                     $subscription_owner = module_subscription::get_subscription_owner($subscription_history['subscription_owner_id']);
                     if ($subscription_owner['owner_table'] && $subscription_owner['owner_id']) {
                         // work out when the next invoice will be generated for this subscription.
                         $members_subscriptions = module_subscription::get_subscriptions_by($subscription_owner['owner_table'], $subscription_owner['owner_id']);
                         if (isset($members_subscriptions[$subscription_history['subscription_id']])) {
                             $member_subscription = $members_subscriptions[$subscription_history['subscription_id']];
                             // everything checks out! good to go....
                             // for now we just do a basic "EVERY X TIME" subscription
                             // todo: work out how long until next generate date, and set that (possibly smaller) time period as the first portion of the subscription
                             /*echo '<pre>';
                               print_r($subscription_history);
                               print_r($subscription);
                               print_r($subscription_owner);
                               print_r($member_subscription);
                               exit;*/
                             $is_subscription = array();
                             if ($subscription['days'] > 0) {
                                 $is_subscription['days'] = $subscription['days'];
                             }
                             if ($subscription['months'] > 0) {
                                 $is_subscription['months'] = $subscription['months'];
                             }
                             if ($subscription['years'] > 0) {
                                 $is_subscription['years'] = $subscription['years'];
                             }
                             if (count($is_subscription)) {
                                 $is_subscription['name'] = $subscription['name'];
                             }
                         }
                     }
                 }
             }
             // todo: check if this invoice has a manual renewal date, perform subscription feature as above.
             if ($is_subscription) {
                 $bits = array();
                 if (isset($is_subscription['days']) && $is_subscription['days'] > 0) {
                     $bits[] = _l('%s days', $is_subscription['days']);
                 }
                 if (isset($is_subscription['months']) && $is_subscription['months'] > 0) {
                     $bits[] = _l('%s months', $is_subscription['months']);
                 }
                 if (isset($is_subscription['years']) && $is_subscription['years'] > 0) {
                     $bits[] = _l('%s years', $is_subscription['years']);
                 }
                 $invoice_payment_data = module_invoice::get_invoice_payment($invoice_payment_id);
                 if (isset($invoice_payment_data['invoice_payment_subscription_id']) && (int) $invoice_payment_data['invoice_payment_subscription_id'] > 0) {
                     // existing subscription already!
                     // not really sure what to do here, just redirect to paypal as if the user is doing it for the first time.
                     $_REQUEST['payment_subscription'] = true;
                     // hacks!
                 }
                 if (isset($_REQUEST['payment_subscription']) || module_config::c('payment_method_paypal_force_subscription', 0)) {
                     // user is setting up a subscription! yes!!
                     // we create an entry in our database for this particular subscription
                     // or if one exists for this payment already then we just continue with that (ie: the user is going in again to redo it)
                     // setup a new subscription in the database for us.
                     if (isset($invoice_payment_data['invoice_payment_subscription_id']) && (int) $invoice_payment_data['invoice_payment_subscription_id'] > 0) {
                         $invoice_payment_subscription_id = $invoice_payment_data['invoice_payment_subscription_id'];
                     } else {
                         $invoice_payment_subscription_id = update_insert('invoice_payment_subscription_id', false, 'invoice_payment_subscription', array('status' => _INVOICE_SUBSCRIPTION_PENDING, 'days' => isset($is_subscription['days']) ? $is_subscription['days'] : 0, 'months' => isset($is_subscription['months']) ? $is_subscription['months'] : 0, 'years' => isset($is_subscription['years']) ? $is_subscription['years'] : 0, 'date_start' => '0000-00-00', 'date_last_pay' => '0000-00-00', 'date_next' => '0000-00-00'));
                         update_insert('invoice_payment_id', $invoice_payment_id, 'invoice_payment', array('invoice_payment_subscription_id' => $invoice_payment_subscription_id));
                     }
                     $description = _l('Recurring payment for %s every %s', $is_subscription['name'], implode(', ', $bits));
                     unset($is_subscription['name']);
                     // so reset/key cals below rosk.
                     $currency = module_config::get_currency($invoice_payment_data['currency_id']);
                     $url = 'https://www.' . (self::is_sandbox() ? 'sandbox.' : '') . 'paypal.com/cgi-bin/webscr?';
                     // if there are more than 1 recurring amounts then we convert it to days, as paypal only supports one time period.
                     if (count($is_subscription) > 1) {
                         $days = isset($is_subscription['days']) ? $is_subscription['days'] : 0;
                         if (isset($is_subscription['months'])) {
                             $days += $is_subscription['months'] * 30;
                             unset($is_subscription['months']);
                         }
                         if (isset($is_subscription['years'])) {
                             $days += $is_subscription['years'] * 365;
                             unset($is_subscription['years']);
                         }
                         $is_subscription['days'] = $days;
                     }
                     reset($is_subscription);
                     $time = key($is_subscription);
                     if ($time == 'days') {
                         $time = 'D';
                     } else {
                         if ($time == 'months') {
                             $time = 'M';
                         } else {
                             if ($time == 'years') {
                                 $time = 'Y';
                             }
                         }
                     }
                     $fields = array('cmd' => '_xclick-subscriptions', 'business' => module_config::c('payment_method_paypal_email', _ERROR_EMAIL), 'currency_code' => $currency['code'], 'item_name' => $description, 'no_shipping' => 1, 'page_style' => module_config::c('paypal_page_style', ''), 'return' => module_invoice::link_public_payment_complete($invoice_id), 'rm' => 1, 'cancel_return' => module_invoice::link_public($invoice_id), 'notify_url' => full_link(_EXTERNAL_TUNNEL . '?m=paymethod_paypal&h=ipn&method=paypal'), 'custom' => self::paypal_custom($user_id, $invoice_payment_id, $invoice_id, $invoice_payment_subscription_id), 'a3' => $payment_amount, 'p3' => current($is_subscription), 't3' => $time, 'src' => 1, 'sra' => 1, 'no_note' => 1);
                     // is there a subscription trail period
                     if (isset($subscription['settings']['trial_period']) && $subscription['settings']['trial_period'] > 0) {
                         // we have to hacck the payment_amount here.
                         // $payment_amount will be the discounted amount (eg: $5 instead of $10)
                         // so we reverse that discounted amount for the real amount.
                         $real_amount = $payment_amount - $fee_amount - (isset($subscription['settings']['trial_price_adjust']) ? $subscription['settings']['trial_price_adjust'] : 0);
                         $real_fee_total = module_invoice::calculate_fee($invoice_id, $invoice_data, $real_amount, array('percent' => $fee_percent, 'amount' => $fee_amount, 'description' => $fee_description));
                         $real_amount += $real_fee_total;
                         $fields['a3'] = $real_amount;
                         $fields['a1'] = $payment_amount;
                         // $real_amount + (isset($subscription['settings']['trial_price_adjust']) ? $subscription['settings']['trial_price_adjust'] : 0);
                         $fields['p1'] = current($is_subscription);
                         // * $subscription['settings']['trial_period'];
                         $fields['t1'] = $time;
                     }
                     //echo '<pre>'; print_r($fields);exit;
                     foreach ($fields as $key => $val) {
                         $url .= $key . '=' . urlencode($val) . '&';
                     }
                     //echo '<a href="'.$url.'">'.$url.'</a>';exit;
                     redirect_browser($url);
                 } else {
                     if (isset($_REQUEST['payment_single'])) {
                         // use is choosing to continue payment as a once off amount
                     } else {
                         // give the user an option
                         module_template::init_template('invoice_payment_subscription', '<h2>Payment for Invoice {INVOICE_NUMBER}</h2>
                     <p>Please choose from the available payment options below:</p>
                     <form action="{PAYMENT_URL}" method="post">
                     <input type="hidden" name="invoice_payment_id" value="{INVOICE_PAYMENT_ID}">
                     <input type="hidden" name="payment_method" value="{PAYMENT_METHOD}">
                     <input type="hidden" name="payment_amount" value="{PAYMENT_AMOUNT}">
                     <p><input type="submit" name="payment_single" value="Pay a Once Off amount of {PRETTY_PAYMENT_AMOUNT}"></p>
                     <p><input type="submit" name="payment_subscription" value="Setup Automatic Payments of {PRETTY_PAYMENT_AMOUNT} every {SUBSCRIPTION_PERIOD}"></p>
                     </form>
                     ', 'Used when a customer tries to pay an invoice that has a subscription option.', 'code');
                         $template = module_template::get_template_by_key('invoice_payment_subscription');
                         $template->page_title = htmlspecialchars($invoice_data['name']);
                         $template->assign_values($invoice_payment_data);
                         $template->assign_values(module_invoice::get_replace_fields($invoice_data['invoice_id'], $invoice_data));
                         $template->assign_values(array('invoice_payment_id' => $invoice_payment_id, 'payment_url' => module_invoice::link_public_pay($invoice_data['invoice_id']), 'payment_method' => 'paymethod_paypal', 'payment_amount' => $payment_amount, 'pretty_payment_amount' => dollar($payment_amount, true, $invoice_data['currency_id']), 'subscription_period' => implode(', ', $bits), 'fee_amount' => dollar($fee_amount, true, $invoice_data['currency_id']), 'fee_total' => dollar($fee_total, true, $invoice_data['currency_id']), 'fee_percent' => $fee_percent, 'fee_description' => $fee_description));
                         echo $template->render('pretty_html');
                         exit;
                     }
                 }
             }
         }
         $description = _l('Payment for Invoice %s', $invoice_data['name']);
         self::paypal_redirect($description, $payment_amount, $user_id, $invoice_payment_id, $invoice_id, $invoice_payment_data['currency_id']);
         return true;
     }
     return false;
 }
예제 #17
0
            </td>
            <td style="text-align: right;">
                {ITEM_TOTAL}
            </td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="5">&nbsp;</td>
        </tr>
        {QUOTE_SUMMARY}
    </tfoot>
</table>

<?php 
module_template::init_template('quote_task_list', ob_get_clean(), 'Used when displaying the quote tasks.', 'code');
$t = false;
if (isset($quote_template_suffix) && strlen($quote_template_suffix) > 0) {
    $t = module_template::get_template_by_key('quote_task_list' . $quote_template_suffix);
    if (!$t->template_id) {
        $t = false;
    }
}
if (!$t) {
    $t = module_template::get_template_by_key('quote_task_list');
}
$replace = array();
if ($quote['default_task_type'] == _TASK_TYPE_AMOUNT_ONLY) {
    $replace['title_qty_or_hours'] = '';
} else {
    if ($quote['default_task_type'] == _TASK_TYPE_QTY_AMOUNT) {
예제 #18
0
        <td style="width:8%;">{ITEM_NUMBER}</td>
        <td style="text-align:left; padding-left:10px;">{ITEM_DESCRIPTION}</td>
        <td style="width:15%;">{ITEM_DATE}</td>
        <td class="mono" style="width:15%;">{ITEM_QTY_OR_HOURS}</td>
		<td style="width:15%;" class="mono">{ITEM_AMOUNT_OR_RATE}</td>
        <td style="width:15%;" class="mono">{ITEM_TOTAL}</td>
    </tr>
    <tr>
        <td colspan="4"></td>
        <td></td>
        <td></td>
    </tr>
    {INVOICE_SUMMARY}
</table>
<?php 
module_template::init_template('invoice_task_list_basic', ob_get_clean(), 'Used when displaying the invoice tasks when invoice_print_basic template is used.', 'code');
$t = false;
if (isset($invoice_template_suffix) && strlen($invoice_template_suffix) > 0) {
    $t = module_template::get_template_by_key('invoice_task_list' . $invoice_template_suffix);
    if (!$t->template_id) {
        $t = false;
    }
}
if (!$t) {
    $t = module_template::get_template_by_key('invoice_task_list');
}
$replace = array();
if ($invoice['default_task_type'] == _TASK_TYPE_AMOUNT_ONLY) {
    $replace['title_qty_or_hours'] = '';
} else {
    if ($invoice['default_task_type'] == _TASK_TYPE_QTY_AMOUNT) {
예제 #19
0
    public function init()
    {
        $this->links = array();
        $this->quote_types = array();
        $this->module_name = "quote";
        $this->module_position = 15.9;
        module_config::register_css('quote', 'quote.css');
        module_config::register_js('quote', 'quote.js');
        if (class_exists('module_template', false) && module_security::is_logged_in()) {
            module_template::init_template('quote_external', '{HEADER}<h2>Quote Overview</h2>
Quote Name: <strong>{QUOTE_NAME}</strong> <br/>
{PROJECT_TYPE} Name: <strong>{PROJECT_NAME}</strong> <br/>
Create Date: <strong>{DATE_CREATE}</strong><br/>
Quote Status: <strong>{if:DATE_APPROVED}Accepted on {DATE_APPROVED}{else}Pending{endif:DATE_APPROVED}</strong> <br/>
{DESCRIPTION}
<br/>
{if:date_approved}
<h2>Quote Has Been Accepted</h2>
<p>Thank you, the quote was accepted by <strong>{APPROVED_BY}</strong> on <strong>{DATE_APPROVED}</strong>.</p>
{else}
<h2>Quote Approval Pending</h2>
<p>If you would like to approve this quote please complete the form below:</p>
<form action="" method="POST">
<p>Your Name: <input type="text" name="quote_approve_name"> </p>
<p><input type="checkbox" name="quote_approve_go" value="yes"> Yes, I approve this quote. </p>
<p><input type="submit" name="quote_approve" value="Approve Quote" class="submit_button save_button"></p>
</form>
{endif:date_approved}

<h2>Task List</h2> <br/>
{TASK_LIST}
', 'Used when displaying the external view of a quote for approval.', 'code');
            module_template::init_template('quote_pdf', '<html>
<head>
<title>Quote</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body{
font-family:Helvetica, sans-serif;
padding:0;
margin:0;
}
td{
font-family:Helvetica, sans-serif;
padding:2px;
}
h3{
font-size: 22px;
font-weight: bold;
margin:10px 0 10px 0;
padding:0 0 5px 0;
border-bottom:1px solid #6f6f6f;
width:100%;
}
.style11 {
font-size: 24px;
font-weight: bold;
margin:0;
padding:0;
}
.task_header,
.task_header th{
background-color:#e8e8e8;
color: #6f6f6f;
font-weight: bold;
}
tr.odd{
background-color:#f9f9f9;
}
</style>
</head>
<body>
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="1" align="center">
<tbody>
<tr>
<td colspan="2" align="left" valign="top"><img title="Logo" src="http://ultimateclientmanager.com/images/logo_ucm.png" alt="Logo" width="202" height="60" /></td>
<td colspan="2" align="left" valign="top"><span class="style11">QUOTE</span></td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td width="43%">&nbsp;</td>
<td width="14%">&nbsp;</td>
<td width="31%">&nbsp;</td>
</tr>
<tr>
<td><strong>ABN:</strong></td>
<td>12 345 678 912</td>
<td><strong>Quote No: <br /> </strong></td>
<td>{QUOTE_NUMBER}</td>
</tr>
<tr>
<td><strong>Email: </strong></td>
<td>your@company.com</td>
<td><strong>Issued Date:</strong></td>
<td>{DATE_CREATE}</td>
</tr>
<tr>
<td><strong>Web: </strong></td>
<td>www.company.com</td>
<td><strong>Valid Until:</strong></td>
<td>{DATE_CREATE+30d}</td>
</tr>
</tbody>
</table>
<h3>RECIPIENT</h3>
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="1" align="center">
<tbody>
<tr>
<td valign="top" width="12%"><strong>Company:</strong></td>
<td valign="top" width="43%">{CUSTOMER_NAME}</td>
<td valign="top" width="14%"><strong>Email:</strong></td>
<td valign="top" width="31%">{CONTACT_EMAIL}</td>
</tr>
<tr>
<td valign="top"><strong>Contact:</strong></td>
<td valign="top">{CONTACT_NAME}</td>
<td valign="top"><strong>{PROJECT_TYPE}:</strong>&nbsp;</td>
<td valign="top">{PROJECT_NAME}&nbsp;</td>
</tr>
<tr>
<td valign="top"><strong>Phone:</strong></td>
<td valign="top">{CONTACT_PHONE}</td>
<td valign="top">&nbsp;</td>
<td valign="top">&nbsp;</td>
</tr>
</tbody>
</table>
<h3>QUOTE DETAILS</h3>
<div>{TASK_LIST}</div>
<p>&nbsp;</p>
<h3>QUOTE APPROVAL</h3>
<p>{if:DATE_APPROVED}Thank you, this Quote was approved by <strong>{APPROVED_BY}</strong> on <strong>{DATE_APPROVED}</strong>{else} If you are happy with this quote please click the buttom below to process approval.</p>
<p><a href="{QUOTE_LINK}">Approve This Quote</a>{endif:DATE_APPROVED}</p>
</body>
</html>', 'Used for printing out an quote for the customer.', 'html');
            module_template::init_template('quote_email', 'Dear {CUSTOMER_NAME},<br>
<br>
Please find attached details on your quote: {QUOTE_NAME}.<br><br>
You can view and approve this quote online by <a href="{QUOTE_URL}">clicking here</a>.<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'Quote: {QUOTE_NAME}', array('CUSTOMER_NAME' => 'Customers Name', 'QUOTE_NAME' => 'Quote Name', 'TOTAL_AMOUNT' => 'Total amount of quote', 'TOTAL_AMOUNT_DUE' => 'Total amount of quote remaining to be paid', 'FROM_NAME' => 'Your name', 'QUOTE_URL' => 'Link to quote for customer', 'QUOTE_TASKS' => 'Output of quote tasks similar to public link'));
            module_template::init_template('quote_staff_email', 'Dear {STAFF_NAME},<br>
<br>
Please find below your {TASK_COUNT} assigned tasks for quote: {QUOTE_NAME}.<br><br>
You can view this quote by <a href="{QUOTE_URL}">clicking here</a>.<br><br>
{QUOTE_TASKS}<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'Assigned Quote Tasks: {QUOTE_NAME}', array('STAFF_NAME' => 'Customers Name', 'QUOTE_NAME' => 'Quote Name', 'TASK_COUNT' => 'Number of assigned tasks', 'QUOTE_URL' => 'Link to quote for customer', 'QUOTE_TASKS' => 'Output of quote tasks for this staff member'));
            module_template::init_template('quote_approved_email', 'Dear {TO_NAME},<br>
<br>
This Quote has been approved: {QUOTE_NAME}.<br><br>
This Quote was approved by <strong>{APPROVED_BY}</strong> on <strong>{DATE_APPROVED}</strong>
You can view this quote by <a href="{QUOTE_URL}">clicking here</a>.<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'Quote Approved: {QUOTE_NAME}', array('QUOTE_NAME' => 'Quote Name', 'QUOTE_URL' => 'Link to quote for customer'));
        }
    }
예제 #20
0
    public function init()
    {
        $this->links = array();
        $this->customer_types = array();
        $this->module_name = "customer";
        $this->module_position = 5.1;
        $this->version = 2.46;
        //2.46 - 2015-10-17 - email optional required field
        //2.459 - 2015-09-27 - customer_signup_email_welcome_template config variable
        //2.458 - 2015-09-25 - ability to create more customer types
        //2.457 - 2015-09-25 - ability to create more customer types
        //2.456 - 2015-09-23 - ability to create more customer types
        //2.455 - 2015-07-18 - customer map
        //2.454 - 2015-06-15 - customer creation bug fix
        //2.453 - 2015-06-08 - leads permission fix
        //2.452 - 2015-06-08 - leads permission fix
        //2.451 - 2015-06-07 - bug fix
        //2.45 - 2015-05-17 - signup ajax fix
        //2.449 - 2015-05-03 - responsive improvements
        //2.448 - 2015-03-08 - extra field permission fix
        //2.447 - 2015-02-12 - customer/lead staff import/export
        //2.446 - 2015-01-28 - customer list sort by extra field support
        //2.445 - 2015-01-23 - hook for custom data integration
        //2.444 - 2015-01-14 - hooks added to table print out and data processing
        //2.443 - 2015-01-08 - signup fixes
        //2.442 - 2014-12-19 - signup form required fields
        //2.441 - 2014-12-17 - signup form on login
        //2.44 - 2014-12-12 - customer signup css bug fix
        //2.439 - 2014-12-09 - customer signup improvements
        //2.438 - 2014-12-08 - customer signup improvements
        //2.437 - 2014-11-26 - job extra fields added to signup
        //2.436 - 2014-11-26 - invoice delete speed improvement
        //2.435 - 2014-11-05 - import notes into system
        //2.434 - 2014-09-18 - cron job debug customer status information
        //2.433 - 2014-09-03 - delete quote when customer is deleted
        //2.432 - 2014-08-28 - invoice prefix back up
        //2.431 - 2014-08-27 - started work on customer statement email feature
        //2.43 - 2014-08-20 - customer group signup
        //2.429 - 2014-07-31 - responsive improvements
        //2.427 - 2014-07-21 - company permission improvement
        //2.426 - 2014-07-16 - cache speed fix
        //2.425 - 2014-07-15 - translation fix
        //2.424 - 2014-07-14 - import + export fixes
        //2.423 - 2014-07-02 - permission improvement
        //2.422 - 2014-06-19 - company permission fix
        //2.421 - 2014-04-15 - merged customer contact fix
        //2.42 - 2014-04-10 - customer signup subscription start
        //2.419 - 2014-03-31 - customer CSV export contact extra fields
        //2.418 - 2014-03-26 - save and return button added
        //2.417 - 2014-03-15 - password reset fix for customer contacts
        //2.416 - 2014-03-04 - return credit to customer after invoice payment is deleted
        //2.415 - 2014-03-03 - currency format fix for credit balance
        //2.414 - 2014-02-17 - leads_enabled fix
        //2.413 - 2014-01-31 - demo fix
        //2.412 - 2014-01-24 - delete customer fix
        //2.411 - 2014-01-23 - searching by extra fields
        //2.41 - 2014-01-23 - deleting customer fix
        //2.399 - 2014-01-21 - lead from customer signup page
        //2.398 - 2014-01-20 - new leads feature
        //2.397 - 2014-01-18 - new leads feature
        //2.396 - 2014-01-10 - phone / email links in contact listings
        //2.395 - 2014-01-01 - leads feature
        //2.394 - 2013-12-15 - working on new UI
        //2.393 - 2013-11-11 - new UI work
        //2.392 - 2013-11-03 - contact extra fields supported in invoice
        //2.391 - 2013-09-26 - fax/mobile added to customer import
        //2.389 - 2013-09-20 - update customer status after invoice cancel
        //2.388 - 2013-09-12 - update customer status after invoice delete
        //2.387 - 2013-09-12 - create new link fixes
        //2.386 - 2013-09-11 - customer dropdown selection fix in job creation
        //2.385 - 2013-09-10 - dashboard speed fixes
        //2.384 - 2013-09-09 - cache fix
        //2.383 - 2013-09-06 - customer signup send invoice fix
        //2.382 - 2013-09-06 - easier to disable certain plugins
        //2.381 - 2013-09-05 - subscriptions on customer signup, option for auto sending invoice
        //2.38 - 2013-09-03 - subscriptions added to customer signup form
        //2.379 - 2013-08-30 - added memcache support for huge speed improvements
        //2.378 - 2013-07-30 - customer delete improvement
        //2.377 - 2013-07-16 - customer delete fix
        //2.376 - 2013-06-21 - permission update
        //2.375 - 2013-06-18 - customer signup fixes
        //2.374 - 2013-06-18 - making room for the upcoming company feature
        //2.373 - 2013-06-14 - customer color coding
        //2.372 - 2013-05-28 - email template field first_name/last_name fix
        //2.371 - 2013-05-28 - email template field customer_address fix
        //2.37 - 2013-05-28 - email template field improvements
        //2.369 - 2013-04-27 - fix for large customer lists
        //2.31 - added group export
        //2.32 - added search by group
        //2.33 - search group permissions
        //2.331 - fix for group perms on main listing
        //2.332 - fix for customer_id null in get. retured an array with address.
        //2.333 - customer importing extra fields.
        //2.334 - customer contacts - all permissions on main customer listing.
        //2.335 - delete customer from group
        //2.336 - delete button on new customer page.
        //2.337 - import customers fixed.
        //2.34 - new feature: customer logo preview
        //2.35 - support for "ajax_contact_list" used in ticket edit area.
        //2.351 - more button on primary contact header in customer
        //2.352 - customer link htmlspecialchars fix
        //2.353 - showing notes in manual invoices
        //2.355 - importing user passwords and roles.
        //2.356 - subscriptions for customers
        //2.357 - bug fix on customers editing logos and searching by last name
        //2.358 - php5/6 fix
        //2.359 - create customer from ticket
        //2.360 - speed improvements
        //2.361 - address search fix for customers
        //2.362 - better moving customer contacts between customers
        //2.363 - show invoice list on main customer page (turn off with customer_list_show_invoices setting)
        //2.364 - extra fields update - show in main listing option
        //2.365 - support for customer signup system
        //2.366 - customer signup fixes
        //2.367 - 2013-04-10 - new customer permissions and staff selection
        //2.368 - 2013-04-10 - fix for new customer permissions
        module_config::register_css('customer', 'customer.css');
        hook_add('customer_list', 'module_customer::hook_filter_var_customer_list');
        if (class_exists('module_template', false)) {
            if (file_exists(dirname(__FILE__) . '/pages/customer_signup.php')) {
                module_template::init_template('customer_signup_thank_you_page', '<h2>Thank You</h2>
    <p>Thank you. Your  request has been submitted successfully.</p>
    <p>Please check your email.</p>
    ', 'Displayed after a customer signs up.', 'code');
                module_template::init_template('customer_signup_email_welcome', 'Dear {CUSTOMER_NAME},<br>
<br>
Thank you for completing the information form on our website. We will be in touch shortly.<br><br>
Kind Regards,<br><br>
{FROM_NAME}
', 'Welcome {CUSTOMER_NAME}', array());
                module_template::init_template('customer_signup_email_admin', 'Dear Admin,<br>
<br>
A customer has signed up in the system!<br><br>
View/Edit this customer by going here: {CUSTOMER_NAME_LINK}<br><br>
Website: {WEBSITE_NAME_LINK}<br><br>
Jobs: {JOB_LINKS}<br><br>
Notes: {NOTES}<br><br>
{UPLOADED_FILES}<br><br>
{SYSTEM_NOTE}
', 'New Customer Signup: {CUSTOMER_NAME}', array());
                module_template::init_template('customer_signup_form_wrapper', '{SIGNUP_FORM}
', 'Customer Signup Form', array());
            }
        }
    }
예제 #21
0
 public function pre_menu()
 {
     if (module_security::has_feature_access(array('name' => 'Settings', 'module' => 'config', 'category' => 'Config', 'view' => 1, 'description' => 'view')) && $this->can_i('view', 'Security Roles', 'Security')) {
         $this->links[] = array("name" => "User Roles", "p" => "security_role", "args" => array('security_role_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0, 'order' => 4);
         $this->links[] = array("name" => "Login History", "p" => "login_history", "args" => array('security_role_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0, 'order' => 40);
     }
     if (class_exists('module_template', false)) {
         module_template::init_template('password_reset', 'Dear {NAME},<br>
 <br>
 Please click the link below to login and reset your password.<br><br>
 <a href="{AUTO_LOGIN_URL}">CLICK HERE</a> <br/><br/>
 Thank you,<br><br>
 {FROM_NAME}
 ', 'Reset your password', array('NAME' => 'Users Name'));
     }
 }
예제 #22
0
    public function pre_menu()
    {
        if ($this->can_i('view', 'Members')) {
            // how many members are there?
            $link_name = _l('Members');
            if (module_config::c('member_show_summary', 1)) {
                $member_count = module_cache::get('member', 'member_menu_count');
                if ($member_count === false) {
                    $sql = "SELECT COUNT(member_id) AS c FROM `" . _DB_PREFIX . "member` m";
                    $res = qa1($sql);
                    $member_count = $res['c'];
                    module_cache::put('member', 'member_menu_count', $member_count);
                }
                if ($member_count > 0) {
                    $link_name .= " <span class='menu_label'>" . $member_count . "</span> ";
                }
            }
            $this->links['members'] = array("name" => $link_name, "p" => "member_admin", "args" => array('member_id' => false));
            if (class_exists('module_newsletter', false) && module_config::c('member_menu_under_newsletter', 1)) {
                $this->links['members']['holder_module'] = 'newsletter';
                $this->links['members']['holder_module_page'] = 'newsletter_admin';
                $this->links['members']['menu_include_parent'] = 0;
                $this->links['members']['allow_nesting'] = 1;
            }
        }
        if (class_exists('module_template', false)) {
            module_template::init_template('member_subscription_form', '<h2>Subscribe</h2>
<form action="" method="post">
    <p>Please Enter Your Email Address: <input type="text" name="member[email]" value="{EMAIL}"> </p>
    <p>Please Enter Your First Name: <input type="text" name="member[first_name]" value="{FIRST_NAME}"> </p>
    <p>Please Enter Your Last Name: <input type="text" name="member[last_name]" value="{LAST_NAME}"> </p>
    <p>Please Enter Your Business Name: <input type="text" name="member[business]" value="{BUSINESS}"> </p>
    <p>Please Enter Your Phone Number: <input type="text" name="member[phone]" value="{PHONE}"> </p>
    <p>
    Please choose your newsletter subscription options: <br/>
    {NEWSLETTER_OPTIONS}
    </p>
    <p><input type="submit" name="confirm" value="Subscribe"></p>
</form>
    ', 'Used when a user wishes to subscribe.', 'code', array());
            module_template::init_template('member_subscription_error', '<h2>Subscription Error</h2>
    <p>Sorry there was an error when processing your request:</p>
    <p>{MESSAGE}</p>
    ', 'Displayed when subscription fails (eg: missing email address).', 'code', array('MESSAGE' => 'Message to the user'));
            module_template::init_template('member_subscription_success', '<h2>Subscription Success</h2>
    <p>Thank you, subscription successful.</p>
    <p>A message has been sent to your email address ({EMAIL}) to confirm your newsletter subscription.</p>
    ', 'Displayed when subscription is successful.', 'code', array('EMAIL' => 'Users email address'));
            module_template::init_template('member_update_details_success', '<h2>Subscription Success</h2>
    <p>Thank you, subscription details updated.</p>
    <p>Your email address: ({EMAIL})</p>
    ', 'Displayed when updating details is successful.', 'code', array('EMAIL' => 'Users email address'));
        }
    }
예제 #23
0
파일: home.php 프로젝트: sgh1986915/php-crm
$home_widgets = handle_hook('dashboard_widgets', $calling_module);
$home_widgets2 = hook_handle_callback('dashboard_widgets');
if (is_array($home_widgets2)) {
    $home_widgets = array_merge($home_widgets, $home_widgets2);
}
// group the widgets into columsn.
// the default columns is 3, but each widget can specify which column group they want to appear in.
// layout the default widget structure in the order we want it to display on the page:
$widget_columns = array();
$widget_columns[4] = array(1 => array(), 2 => array(), 3 => array(), 4 => array());
$widget_columns[1] = array(1 => array());
$widget_columns[2] = array(1 => array(), 2 => array());
$widget_columns[3] = array(1 => array(), 2 => array(), 3 => array());
// then display the welcome message:
module_template::init_template('welcome_message', '<p>
   Hi {USER_NAME}, and Welcome to {SYSTEM_NAME}
</p>', 'Welcome message on Dashboard', array('USER_NAME' => 'Current user name', 'SYSTEM_NAME' => 'System name from settings area'));
// check if there is a template for this user role.
$my_account = module_user::get_user(module_security::get_loggedin_id());
$security_role = current($my_account['roles']);
$template = false;
if ($security_role && isset($security_role['security_role_id'])) {
    $template = module_template::get_template_by_key('welcome_message_role_' . $security_role['security_role_id']);
}
if (!$template || !$template->template_key) {
    $template = module_template::get_template_by_key('welcome_message');
}
$template->assign_values(array('user_name' => htmlspecialchars($_SESSION['_user_name']), 'system_name' => htmlspecialchars(module_config::s('admin_system_name'))));
$widget_sort_json = @json_decode(module_config::c('dash_widgets_sort_' . module_security::get_loggedin_id()), true);
if (!is_array($widget_sort_json)) {
    $widget_sort_json = array();
예제 #24
0
if (class_exists('module_security', false)) {
    if ($customer_id > 0 && $customer['customer_id'] == $customer_id) {
        // if they are not allowed to "edit" a page, but the "view" permission exists
        // then we automatically grab the page and regex all the crap out of it that they are not allowed to change
        // eg: form elements, submit buttons, etc..
        module_security::check_page(array('category' => 'Customer', 'page_name' => $page_type, 'module' => 'customer', 'feature' => 'Edit'));
    } else {
        module_security::check_page(array('category' => 'Customer', 'page_name' => $page_type, 'module' => 'customer', 'feature' => 'Create'));
    }
    module_security::sanatise_data('customer', $customer);
}
if (isset($_REQUEST['preview_email'])) {
    module_template::init_template('customer_statement_email', 'Dear {CUSTOMER_NAME},<br>
<br>
Please find below a copy of your details.<br><br>
{EMAIL_DETAILS}<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'Customer Statement: {CUSTOMER_NAME}', array('CUSTOMER_NAME' => 'Customers Name'));
    $template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : 'customer_statement_email';
    $template = module_template::get_template_by_key($template_name);
    $to = module_user::get_contacts(array('customer_id' => $customer['customer_id']));
    $to_select = false;
    if ($customer['primary_user_id']) {
        $primary = module_user::get_user($customer['primary_user_id']);
        if ($primary) {
            $to_select = $primary['email'];
        }
    }
    $template->assign_values(module_customer::get_replace_fields($customer_id));
    $email_details = '';
예제 #25
0
 public static function invoice_html($invoice_id, $invoice_data, $mode = 'html')
 {
     if ($invoice_id && $invoice_data) {
         // spit out the invoice html into a file, then pass it to the pdf converter
         // to convert it into a PDF.
         ob_start();
         include module_theme::include_ucm('includes/plugin_invoice/template/invoice_print.php');
         module_template::init_template('invoice_print', ob_get_clean(), 'Used for printing out an invoice for the customer.', 'html');
         ob_start();
         include module_theme::include_ucm('includes/plugin_invoice/template/invoice_print_basic.php');
         module_template::init_template('invoice_print_basic', ob_get_clean(), 'Alternative template for printing out an invoice for the customer.', 'html');
         ob_start();
         include module_theme::include_ucm('includes/plugin_invoice/template/credit_note_pdf.php');
         module_template::init_template('credit_note_pdf', ob_get_clean(), 'Used for printing out a a credit note for the customer.', 'html');
         $invoice = $invoice_data;
         if (class_exists('module_company', false) && isset($invoice_data['company_id']) && (int) $invoice_data['company_id'] > 0) {
             module_company::set_current_company_id($invoice_data['company_id']);
         }
         $job_data = module_job::get_job(current($invoice_data['job_ids']));
         $website_data = $job_data['website_id'] ? module_website::get_website($job_data['website_id']) : array();
         $website_data = array_merge($website_data, isset($invoice_data['website_id']) && $invoice_data['website_id'] ? module_website::get_website($invoice_data['website_id']) : array());
         $invoice_template = isset($invoice_data['invoice_template_print']) && strlen($invoice_data['invoice_template_print']) ? $invoice_data['invoice_template_print'] : module_config::c('invoice_template_print_default', 'invoice_print');
         $invoice_template_suffix = '';
         if ($invoice_template != 'invoice_print') {
             $invoice_template_suffix = str_replace('invoice_print', '', $invoice_template);
         }
         ob_start();
         include module_theme::include_ucm('includes/plugin_invoice/template/invoice_task_list.php');
         $task_list_html = ob_get_clean();
         ob_start();
         include module_theme::include_ucm('includes/plugin_invoice/template/invoice_payment_history.php');
         $payment_history = ob_get_clean();
         ob_start();
         include module_theme::include_ucm('includes/plugin_invoice/template/invoice_payment_methods.php');
         $payment_methods = ob_get_clean();
         $replace = self::get_replace_fields($invoice_id, $invoice_data);
         $replace['payment_history'] = $payment_history;
         $replace['payment_methods'] = $payment_methods;
         $replace['task_list'] = $task_list_html;
         $replace['external_invoice_template_html'] = '';
         //$external_invoice_template = module_template::get_template_by_key('external_invoice');
         $external_invoice_template = false;
         if (isset($invoice_template_suffix) && strlen($invoice_template_suffix) > 0) {
             $external_invoice_template = module_template::get_template_by_key('external_invoice' . $invoice_template_suffix);
             if (!$external_invoice_template->template_id) {
                 $external_invoice_template = false;
             }
         }
         if (!$external_invoice_template) {
             $external_invoice_template = module_template::get_template_by_key('external_invoice');
         }
         $external_invoice_template->assign_values($replace);
         $replace['external_invoice_template_html'] = $external_invoice_template->replace_content();
         if (isset($invoice_data['credit_note_id']) && $invoice_data['credit_note_id']) {
             if ($invoice_data['invoice_template_print']) {
                 $invoice_data['invoice_template_print'] = 'credit_note_pdf';
             }
             $invoice_template = 'credit_note_pdf';
         }
         ob_start();
         $template = module_template::get_template_by_key($invoice_template);
         if (!$template || $template->template_key != $invoice_template) {
             echo "Invoice template {$invoice_template} not found";
         } else {
             $template->assign_values($replace);
             echo $template->render('html');
         }
         $invoice_html = ob_get_clean();
         return $invoice_html;
     }
     return false;
 }
예제 #26
0
    ?>

                        <?php 
    if (module_config::c('ticket_allow_priority', 0)) {
        ?>

                        <tr>
                            <th class="width1">
                                <?php 
        echo _l('Priority Support');
        ?>

                            </th>
                            <td>
                                <?php 
        module_template::init_template('ticket_priority_support', '<em>New!</em> Need a <strong>fast</strong> reply? Priority support will place your ticket at the front of the support queue. <br/>Priority Support Cost: {COST}<br/>{CHECKBOX} <label for="do_priority">Yes, upgrade to <strong>priority support</strong> and move my ticket to position: {TICKET_POSITION}</label>', 'Displayed at the bottom of ticket support signup', 'code', array('cost' => 'Cost as defined by ticket_priority_code advanced setting', 'TICKET_POSITION' => 'displays the string (example) "1st out of 44"'));
        $template = module_template::get_template_by_key('ticket_priority_support');
        $template->assign_values(array('cost' => dollar(module_config::c('ticket_priority_cost', 10), true, module_config::c('ticket_priority_currency', 1)), 'TICKET_POSITION' => _l('%s out of %s', ordinal(module_ticket::ticket_count('priority') + 1), $ticket['total_pending']), 'CHECKBOX' => '<input type="checkbox" name="do_priority" id="do_priority" value="1">'));
        echo $template->replace_content();
        ?>


                            </td>
                        </tr>
                            <?php 
    }
    ?>

                        <?php 
    if (module_config::c('ticket_turn_around_days_show', 1)) {
        ?>
예제 #27
0
         <td>
             {ITEM_PAYMENT_METHOD}
         </td>
         <td>
             {ITEM_PAYMENT_DETAILS}
         </td>
         <td>
             {ITEM_PAYMENT_AMOUNT}
         </td>
         <td align="center">
             <a href="{ITEM_PAYMENT_RECEIPT_URL}" target="_blank">{l:View Receipt}</a>
         </td>
     </tr>
 </table>
 <?php 
 module_template::init_template('invoice_payment_history_basic', ob_get_clean(), 'Used when displaying the invoice payment history in the basic invoice template.', 'code');
 $t = false;
 if (isset($invoice_template_suffix) && strlen($invoice_template_suffix) > 0) {
     $t = module_template::get_template_by_key('invoice_payment_history' . $invoice_template_suffix);
     if (!$t->template_id) {
         $t = false;
     }
 }
 if (!$t) {
     $t = module_template::get_template_by_key('invoice_payment_history');
 }
 $replace = array();
 if (!isset($mode) || $mode == 'html') {
     $replace['title'] = '<h3>' . _l('Payment History:') . '</h3>';
 } else {
     $replace['title'] = '<strong>' . _l('Payment History:') . '</strong><br/>';
예제 #28
0
 * IP Address: 67.79.165.254
 */
if (!module_change_request::can_i('edit', 'Change Requests')) {
    die('no perms');
}
$change_request_id = (int) $_REQUEST['change_request_id'];
$change_request = module_change_request::get_change_request($change_request_id);
if (!$change_request['website_id']) {
    die('no linked website');
}
$website_data = module_website::get_website($change_request['website_id']);
print_heading(_l('Email Change Request: %s', $change_request['url']));
module_template::init_template('change_request_email', 'Dear {NAME},<br>
<br>
This email is regarding your recent change request on the website {URL}.<br><br>
<em>{REQUEST}</em><br><br>
You can view and modify this change request by <a href="{CHANGE_REQUEST_URL}">clicking here</a>.<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'Change Request: {URL}', array('NAME' => 'Customers Name', 'URL' => 'Website address', 'REQUEST' => 'Change REquest', 'FROM_NAME' => 'Your name', 'CHANGE_REQUEST_URL' => 'Link to change request for customer'));
// template for sending emails.
// are we sending the paid one? or the dueone.
//$template_name = 'change_request_email';
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : 'change_request_email';
$template = module_template::get_template_by_key($template_name);
$change_request['from_name'] = module_security::get_loggedin_name();
$change_request['change_request_url'] = module_change_request::link_public_change($website_data['website_id'], $change_request_id);
ob_start();
$change_request['change_request_tasks'] = ob_get_clean();
// find available "to" recipients.
// customer contacts.
$to_select = false;