Exemple #1
0
 public static function enable_pagination_hook($sort_data = array())
 {
     if (get_display_mode() != 'mobile') {
         foreach ($sort_data['sortable'] as $column_id => $options) {
             if (isset($options['extra_sort']) && $options['extra_sort'] && $options['owner_table']) {
                 // find all the visible extra fields for this item and add sorting buttons to them.
                 $defaults = module_extra::get_defaults($options['owner_table']);
                 $column_headers = array();
                 foreach ($defaults as $default) {
                     if (isset($default['display_type']) && $default['display_type'] == _EXTRA_DISPLAY_TYPE_COLUMN) {
                         $column_headers[$default['key']] = $default;
                     }
                 }
                 unset($sort_data['sortable'][$column_id]);
                 foreach ($column_headers as $column_header) {
                     $sort_data['sortable']['extra_header_' . $column_header['extra_default_id']] = array('extra_sort' => true, 'field' => $column_header['key'], 'default_field_id' => $column_header['extra_default_id'], 'owner_table' => $options['owner_table'], 'owner_id' => $options['owner_id'], 'field_type' => isset($column_header['field_type']) ? $column_header['field_type'] : false);
                 }
             }
         }
         self::$table_sort_options = $sort_data;
     }
 }
Exemple #2
0
    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;
        }
    }
Exemple #3
0
 /**
  * @param $invoice_id
  * @param $invoice_data
  * @return array
  *
  * todo: make this method call the other 'get_replace_fields' available in website/job/etc..
  */
 public static function get_replace_fields($invoice_id, $invoice_data = false)
 {
     if (!$invoice_data) {
         $invoice_data = self::get_invoice($invoice_id);
     }
     $customer_data = array();
     if ($invoice_data['customer_id']) {
         $customer_data = module_customer::get_replace_fields($invoice_data['customer_id'], $invoice_data['user_id']);
     }
     if (!is_array($customer_data)) {
         $customer_data = array();
     }
     $data = array_merge($customer_data, $invoice_data);
     // so we get total_amount_due and stuff.
     $data = array_merge($data, array('invoice_number' => htmlspecialchars($invoice_data['name']), 'project_type' => _l(module_config::c('project_name_single', 'Website')), 'print_link' => self::link_public_print($invoice_id), 'title' => module_config::s('admin_system_name'), 'invoice_paid' => $invoice_data['total_amount_due'] <= 0 ? '<p> <font style="font-size: 1.6em;"><strong>' . _l('INVOICE PAID') . '</strong></font> </p>' : '', 'is_invoice_paid' => $invoice_data['total_amount_due'] <= 0 ? 1 : '', 'date_create' => print_date($invoice_data['date_create']), 'due_date' => print_date($invoice_data['date_due'])));
     $data['total_amount'] = dollar($invoice_data['total_amount'], true, $invoice_data['currency_id']);
     $data['total_amount_due'] = dollar($invoice_data['total_amount_due'], true, $invoice_data['currency_id']);
     $data['total_amount_paid'] = dollar($invoice_data['total_amount_paid'], true, $invoice_data['currency_id']);
     $data['date_paid'] = print_date($invoice_data['date_paid']);
     $data['date_due'] = print_date($invoice_data['date_due']);
     $data['date_sent'] = print_date($invoice_data['date_sent']);
     $data['invoice_number'] = $invoice_data['name'];
     $data['invoice_url'] = module_invoice::link_public($invoice_id);
     $data['invoice_date_range'] = '';
     if ($invoice_data['date_renew'] != '0000-00-00') {
         $data['invoice_date_range'] = _l('%s to %s', print_date($invoice_data['date_create']), print_date(strtotime("-1 day", strtotime($invoice_data['date_renew']))));
     }
     if (isset($invoice_data['credit_note_id']) && $invoice_data['credit_note_id']) {
         $credit_invoice = module_invoice::get_invoice($invoice_data['credit_note_id'], true);
         $data['credit_invoice_number'] = htmlspecialchars($credit_invoice['name']);
     }
     $data['invoice_notes'] = '';
     // grab any public notes
     if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
         $notes = module_note::get_notes(array('public' => 1, 'owner_table' => 'invoice', 'owner_id' => $invoice_id));
         if (count($notes) > 1) {
             $data['invoice_notes'] .= '<ul>';
             foreach ($notes as $note) {
                 if ($note['public']) {
                     $data['invoice_notes'] .= '<li>';
                     $data['invoice_notes'] .= htmlspecialchars($note['note']);
                     $data['invoice_notes'] .= '</li>';
                 }
             }
             $data['invoice_notes'] .= '</ul>';
         } else {
             $note = array_shift($notes);
             $data['invoice_notes'] .= htmlspecialchars($note['note']);
         }
     }
     $job_names = $website_url = $project_names = $project_names_and_url = array();
     foreach ($invoice_data['job_ids'] as $job_id) {
         $job_data = module_job::get_job($job_id);
         if ($job_data && $job_data['job_id'] == $job_id) {
             $job_names[$job_data['job_id']] = $job_data['name'];
             if (module_config::c('job_invoice_show_date_range', 1)) {
                 // check if this job is a renewable job.
                 if ($job_data['date_renew'] != '0000-00-00') {
                     $data['invoice_date_range'] = _l('%s to %s', print_date($job_data['date_start']), print_date(strtotime("-1 day", strtotime($job_data['date_renew']))));
                 }
             }
             $fields = module_job::get_replace_fields($job_id, $job_data);
             foreach ($fields as $key => $val) {
                 if (!isset($data[$key]) || !$data[$key] && $val) {
                     $data[$key] = $val;
                 }
             }
             if ($job_data['website_id']) {
                 $website_data = module_website::get_website($job_data['website_id']);
                 if ($website_data && $website_data['website_id'] == $job_data['website_id']) {
                     if (isset($website_data['url']) && $website_data['url']) {
                         $website_url[$website_data['website_id']] = module_website::urlify($website_data['url']);
                         $website_data['name_url'] = $website_data['name'] . ' (' . module_website::urlify($website_data['url']) . ')';
                     } else {
                         $website_data['name_url'] = $website_data['name'];
                     }
                     $project_names[$website_data['website_id']] = $website_data['name'];
                     $project_names_and_url[$website_data['website_id']] = $website_data['name_url'];
                     $fields = module_website::get_replace_fields($website_data['website_id'], $website_data);
                     foreach ($fields as $key => $val) {
                         if (!isset($data[$key]) || !$data[$key] && $val) {
                             $data[$key] = $val;
                         }
                     }
                 }
             }
         }
     }
     if (isset($invoice_data['website_id']) && $invoice_data['website_id']) {
         $website_data = module_website::get_website($invoice_data['website_id']);
         if ($website_data && $website_data['website_id'] == $invoice_data['website_id']) {
             if (isset($website_data['url']) && $website_data['url']) {
                 $website_url[$website_data['website_id']] = module_website::urlify($website_data['url']);
                 $website_data['name_url'] = $website_data['name'] . ' (' . module_website::urlify($website_data['url']) . ')';
             } else {
                 $website_data['name_url'] = $website_data['name'];
             }
             $project_names[$website_data['website_id']] = $website_data['name'];
             $project_names_and_url[$website_data['website_id']] = $website_data['name_url'];
             $fields = module_website::get_replace_fields($website_data['website_id'], $website_data);
             foreach ($fields as $key => $val) {
                 if (!isset($data[$key]) || !$data[$key] && $val) {
                     $data[$key] = $val;
                 }
             }
         }
     }
     $data['website_name'] = $data['project_name'] = forum_text(count($project_names) ? implode(', ', $project_names) : '');
     $data['website_name_url'] = forum_text(count($project_names_and_url) ? implode(', ', $project_names_and_url) : '');
     $data['website_url'] = forum_text(count($website_url) ? implode(', ', $website_url) : '');
     $data['job_name'] = forum_text($job_names ? implode(', ', $job_names) : '');
     if (class_exists('module_group', false)) {
         // get the job groups
         $wg = array();
         $g = array();
         foreach ($invoice_data['job_ids'] as $group_job_id) {
             $group_job_id = (int) trim($group_job_id);
             if ($group_job_id > 0) {
                 $job_data = module_job::get_job($group_job_id);
                 foreach (module_group::get_groups_search(array('owner_table' => 'job', 'owner_id' => $group_job_id)) as $group) {
                     $g[$group['group_id']] = $group['name'];
                 }
                 // get the website groups
                 if ($job_data['website_id']) {
                     foreach (module_group::get_groups_search(array('owner_table' => 'website', 'owner_id' => $job_data['website_id'])) as $group) {
                         $wg[$group['group_id']] = $group['name'];
                     }
                 }
             }
         }
         if (isset($invoice_data['website_id']) && $invoice_data['website_id']) {
             foreach (module_group::get_groups_search(array('owner_table' => 'website', 'owner_id' => $invoice_data['website_id'])) as $group) {
                 $wg[$group['group_id']] = $group['name'];
             }
         }
         $data['job_group'] = implode(', ', $g);
         $data['website_group'] = implode(', ', $wg);
     }
     // addition. find all extra keys for this invoice and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('invoice');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'invoice', 'owner_id' => $invoice_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
     }
     $new_data = hook_handle_callback('invoice_replace_fields', $invoice_id, $data);
     if (is_array($new_data)) {
         foreach ($new_data as $new_d) {
             $data = array_merge($data, $new_d);
         }
     }
     return $data;
 }
Exemple #4
0
 public static function get_replace_fields($job_id, $job_data = false)
 {
     if (!$job_data) {
         $job_data = self::get_job($job_id);
     }
     $data = array('job_number' => htmlspecialchars($job_data['name']), 'project_type' => _l(module_config::c('project_name_single', 'Website')), 'print_link' => self::link_public($job_id), 'title' => module_config::s('admin_system_name'), 'due_date' => print_date($job_data['date_due']));
     //        $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();
     //        $data = array_merge($data,$customer_data,$website_data,$job_data);
     $data = array_merge($data, $job_data);
     if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
         // get the job groups
         $wg = array();
         $g = array();
         if ($job_id > 0) {
             $job_data = module_job::get_job($job_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'job', 'owner_id' => $job_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
             /*// get the website groups
               foreach(module_group::get_groups_search(array(
                   'owner_table' => 'website',
                   'owner_id' => $job_data['website_id'],
               )) as $group){
                   $wg[$group['group_id']] = $group['name'];
               }*/
         }
         $data['job_group'] = implode(', ', $g);
         /*$data['website_group'] = implode(', ',$wg);*/
     }
     // addition. find all extra keys for this job and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('job');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'job', 'owner_id' => $job_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
     }
     // also do this for customer fields
     /*if($job_data['customer_id']){
           $all_extra_fields = module_extra::get_defaults('customer');
           foreach($all_extra_fields as $e){
               $data[$e['key']] = _l('N/A');
           }
           $extras = module_extra::get_extras(array('owner_table'=>'customer','owner_id'=>$job_data['customer_id']));
           foreach($extras as $e){
               $data[$e['extra_key']] = $e['extra'];
           }
       }*/
     return $data;
 }
Exemple #5
0
 public static function get_replace_fields($quote_id, $quote_data = false)
 {
     if (!$quote_data) {
         $quote_data = self::get_quote($quote_id);
     }
     $data = array('quote_number' => htmlspecialchars($quote_data['name']), 'quote_name' => htmlspecialchars($quote_data['name']), 'project_type' => _l(module_config::c('project_name_single', 'Website')), 'print_link' => self::link_public_print($quote_id), 'quote_url' => self::link_public($quote_id), 'title' => module_config::s('admin_system_name'), 'create_date' => print_date($quote_data['date_create']));
     if (isset($quote_data['customer_id']) && $quote_data['customer_id']) {
         $customer_data = module_customer::get_replace_fields($quote_data['customer_id'], $quote_data['contact_user_id'] ? $quote_data['contact_user_id'] : false);
         $data = array_merge($data, $customer_data);
         // so we get total_amount_due and stuff.
     }
     $user_details = array('staff_first_name' => '', 'staff_last_name' => '', 'staff_email' => '', 'staff_phone' => '', 'staff_fax' => '', 'staff_mobile' => '');
     if (isset($quote_data['user_id']) && $quote_data['user_id']) {
         $user_data = module_user::get_user($quote_data['user_id'], false);
         if ($user_data && $user_data['user_id'] == $quote_data['user_id']) {
             $user_details = array('staff_first_name' => $user_data['name'], 'staff_last_name' => $user_data['last_name'], 'staff_email' => $user_data['email'], 'staff_phone' => $user_data['phone'], 'staff_fax' => $user_data['fax'], 'staff_mobile' => $user_data['mobile']);
         }
     }
     $data = array_merge($data, $user_details);
     foreach ($quote_data as $key => $val) {
         if (strpos($key, 'date') !== false) {
             $quote_data[$key] = print_date($val);
         }
     }
     if (isset($quote_data['description'])) {
         $quote_data['description'] = module_security::purify_html($quote_data['description']);
     }
     //        $customer_data = $quote_data['customer_id'] ? module_customer::get_replace_fields($quote_data['customer_id']) : array();
     //        $website_data = $quote_data['website_id'] ? module_website::get_replace_fields($quote_data['website_id']) : array();
     //        $data = array_merge($data,$customer_data,$website_data,$quote_data);
     $data = array_merge($data, $quote_data);
     $website_url = $project_names = $project_names_and_url = array();
     if ($quote_data['website_id']) {
         $website_data = module_website::get_website($quote_data['website_id']);
         if ($website_data && $website_data['website_id'] == $quote_data['website_id']) {
             if (isset($website_data['url']) && $website_data['url']) {
                 $website_url[$website_data['website_id']] = module_website::urlify($website_data['url']);
                 $website_data['name_url'] = $website_data['name'] . ' (' . module_website::urlify($website_data['url']) . ')';
             } else {
                 $website_data['name_url'] = $website_data['name'];
             }
             $project_names[$website_data['website_id']] = $website_data['name'];
             $project_names_and_url[$website_data['website_id']] = $website_data['name_url'];
             $fields = module_website::get_replace_fields($website_data['website_id'], $website_data);
             foreach ($fields as $key => $val) {
                 if (!isset($data[$key]) || !$data[$key] && $val) {
                     $data[$key] = $val;
                 }
             }
         }
     }
     $data['website_name'] = $data['project_name'] = forum_text(count($project_names) ? implode(', ', $project_names) : '');
     $data['website_name_url'] = forum_text(count($project_names_and_url) ? implode(', ', $project_names_and_url) : '');
     $data['website_url'] = forum_text(count($website_url) ? implode(', ', $website_url) : '');
     if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
         // get the quote groups
         $wg = array();
         $g = array();
         if ($quote_id > 0) {
             $quote_data = module_quote::get_quote($quote_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'quote', 'owner_id' => $quote_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
             /*// get the website groups
               foreach(module_group::get_groups_search(array(
                   'owner_table' => 'website',
                   'owner_id' => $quote_data['website_id'],
               )) as $group){
                   $wg[$group['group_id']] = $group['name'];
               }*/
         }
         $data['quote_group'] = implode(', ', $g);
         /*$data['website_group'] = implode(', ',$wg);*/
     }
     // addition. find all extra keys for this quote and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('quote');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'quote', 'owner_id' => $quote_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
     }
     // also do this for customer fields
     /*if($quote_data['customer_id']){
           $all_extra_fields = module_extra::get_defaults('customer');
           foreach($all_extra_fields as $e){
               $data[$e['key']] = _l('N/A');
           }
           $extras = module_extra::get_extras(array('owner_table'=>'customer','owner_id'=>$quote_data['customer_id']));
           foreach($extras as $e){
               $data[$e['extra_key']] = $e['extra'];
           }
       }*/
     return $data;
 }
}
// find available "to" recipients.
// customer contacts.
$to_select = false;
if ($file['customer_id']) {
    $customer = module_customer::get_customer($file['customer_id']);
    $file['customer_name'] = $customer['customer_name'];
    $to = module_user::get_contacts(array('customer_id' => $file['customer_id']));
    if ($customer['primary_user_id']) {
        $primary = module_user::get_user($customer['primary_user_id']);
        if ($primary) {
            $to_select = $primary['email'];
        }
    }
} else {
    $to = array();
}
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[$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[$e['extra_key']] = $e['extra'];
    }
}
$template->assign_values($file);
ob_start();
module_email::print_compose(array('title' => _l('Email File: %s', $file['file_name']), 'find_other_templates' => 'file_approval_email', 'current_template' => $template_name, 'customer_id' => $file['customer_id'], 'job_id' => $file['job_id'], 'file_id' => $file['file_id'], 'debug_message' => 'Sending file as email', 'to' => $to, 'to_select' => $to_select, 'bcc' => module_config::c('admin_email_address', ''), 'content' => $template->render('html'), 'subject' => $template->replace_description(), 'success_url' => module_file::link_open($file_id), 'success_callback' => 'module_file::email_sent', 'success_callback_args' => array('file_id' => $file_id), 'cancel_url' => module_file::link_open($file_id)));
    $x++;
}
?>
    <li>
        <fieldset>
            <legend>Please upload any attachments for this project below:</legend>
            <label><input type="file" name="customerfiles[]" value=""></label>
            <label><input type="file" name="customerfiles[]" value=""></label>
            <label><input type="file" name="customerfiles[]" value=""></label>
            <label><input type="file" name="customerfiles[]" value=""></label>
            <!-- add more files here by simply duplicating a line above -->
        </fieldset>
    </li>
    <?php 
$x = 1;
foreach (module_extra::get_defaults('website') as $default) {
    ?>
    <li>
        <label for="website_extra_<?php 
    echo $x;
    ?>
"><?php 
    echo htmlspecialchars($default['key']);
    ?>
</label>
        <input type="text" id="website_extra_<?php 
    echo $x;
    ?>
" name="website[extra][<?php 
    echo htmlspecialchars($default['key']);
    ?>
} else {
    ?>


    <h2>
        <!-- <span class="button">
            <?php 
    echo create_link("Add New Field", "add", module_extra::link_open_extra_default('new'));
    ?>
        </span> -->
        <?php 
    echo _l('Extra Fields');
    ?>
    </h2>
    <?php 
    $extra_defaults = module_extra::get_defaults();
    $visibility_types = module_extra::get_display_types();
    ?>


    <table width="100%" border="0" cellspacing="0" cellpadding="2" class="tableclass tableclass_rows">
        <thead>
        <tr class="title">
            <th><?php 
    echo _l('Section');
    ?>
</th>
            <th><?php 
    echo _l('Extra Field');
    ?>
</th>
function metis_print_extra_search_bar($callback, $owner_table, $options = array())
{
    ob_start();
    // let the themes override this search bar function.
    if (module_extra::can_i('view', 'Extra Fields')) {
        $defaults = module_extra::get_defaults($owner_table);
        $searchable_fields = array();
        foreach ($defaults as $default) {
            if (isset($default['searchable']) && $default['searchable']) {
                $searchable_fields[$default['key']] = $default;
            }
        }
        foreach ($searchable_fields as $searchable_field) {
            ?>
                <div class="form-group search_title">
                    <?php 
            echo htmlspecialchars($searchable_field['key']);
            ?>
:
                </div>
                <div class="form-group search_input">
                    <?php 
            module_form::generate_form_element(array('type' => 'text', 'name' => 'search[extra_fields][' . htmlspecialchars($searchable_field['key']) . ']'));
            ?>
                </div>
                <?php 
        }
    }
    return ob_get_clean();
}
Exemple #10
0
    public function external_hook($hook)
    {
        switch ($hook) {
            case 'subscribe_form':
                // handle subscriptions to the member database and also the newsletter system.
                // todo - tie in with "subscription" module to allow users to select which subscription they want as well.
            // handle subscriptions to the member database and also the newsletter system.
            // todo - tie in with "subscription" module to allow users to select which subscription they want as well.
            case 'subscribe':
                $member = isset($_REQUEST['member']) && is_array($_REQUEST['member']) ? $_REQUEST['member'] : false;
                $provided_member_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                $member_id = false;
                if ($member) {
                    if (isset($member['email']) && $member['email']) {
                        // proceed with signup
                        $email = filter_var(strtolower(trim($member['email'])), FILTER_VALIDATE_EMAIL);
                        if (strlen($email) > 3) {
                            $adding_new_member = true;
                            // are we adding a new member to the system or updating an old one
                            if ($provided_member_id && $hash) {
                                $real_hash = $this->link_public_details($provided_member_id, true);
                                if ($real_hash == $hash) {
                                    $existing_member = get_single('member', 'email', $email);
                                    if ($existing_member && $existing_member['member_id'] != $provided_member_id) {
                                        // this user is trying to update their email address to a user who exists in the system already
                                        $template = module_template::get_template_by_key('member_subscription_error');
                                        $template->page_title = htmlspecialchars(_l('Subscription'));
                                        $template->assign_values(array('message' => _l('The email address %s is already linked to another member.', htmlspecialchars($email))));
                                        echo $template->render('pretty_html');
                                        exit;
                                    }
                                    $adding_new_member = false;
                                    // updating details in the system.
                                    update_insert("member_id", $provided_member_id, "member", $member);
                                    $member_id = $provided_member_id;
                                    // update extra fields...
                                }
                            }
                            if (!$member_id) {
                                // add member to system.
                                $existing_member = get_single('member', 'email', $email);
                                if ($existing_member && $existing_member['member_id'] > 0) {
                                    // todo: give them link to change details.
                                    $template = module_template::get_template_by_key('member_subscription_error');
                                    $template->page_title = htmlspecialchars(_l('Subscription'));
                                    $template->assign_values(array('message' => _l('The email address %s is already a member. Please click the link in our newsletter to modify your details.', htmlspecialchars($email))));
                                    echo $template->render('pretty_html');
                                    exit;
                                }
                                // todo - sanatise input here, this will allow anyone to insert member details:
                                $member_id = update_insert("member_id", 'new', "member", $member);
                            }
                            if ($member_id) {
                                // save extra fields against member.
                                $extra_fields = module_extra::get_defaults('member');
                                $extra_values = array();
                                foreach ($extra_fields as $extra_field) {
                                    // check if this field was submitted.
                                    if (isset($member[$extra_field['key']])) {
                                        $extra_values[$extra_field['key']] = array('val' => $member[$extra_field['key']], 'key' => $extra_field['key']);
                                    }
                                }
                                if (count($extra_values)) {
                                    $_REQUEST['extra_member_field'] = $extra_values;
                                    module_extra::save_extras('member', 'member_id', $member_id, false);
                                }
                                if (class_exists('module_newsletter', false)) {
                                    $newsletter_member_id = module_newsletter::member_from_email(array('email' => $email, 'member_id' => $member_id, 'data_callback' => 'module_member::get_newsletter_recipient', 'data_args' => $member_id), true, true);
                                    module_newsletter::subscribe_member($email, $newsletter_member_id);
                                    // now add thsi member to the grups they have selected.
                                    if (isset($member['group']) && is_array($member['group'])) {
                                        $group_items = module_group::get_groups('newsletter_subscription');
                                        $public_group_ids = array();
                                        foreach ($group_items as $group_item) {
                                            $public_group_ids[$group_item['group_id']] = true;
                                            // remove user group all these groups.
                                            module_group::delete_member($member_id, 'newsletter_subscription');
                                        }
                                        //print_r($member['group']);print_r($public_group_ids);exit;
                                        foreach ($member['group'] as $group_id => $tf) {
                                            if ($tf && isset($public_group_ids[$group_id])) {
                                                // add member to group - but only public group ids!
                                                module_group::add_to_group($group_id, $member_id);
                                            }
                                        }
                                    }
                                }
                                // is the newsletter module giving us a subscription redirection?
                                if ($adding_new_member) {
                                    if (module_config::c('newsletter_subscribe_redirect', '')) {
                                        redirect_browser(module_config::c('newsletter_subscribe_redirect', ''));
                                    }
                                    $template = module_template::get_template_by_key('member_subscription_success');
                                    $template->page_title = htmlspecialchars(_l('Subscription'));
                                    $template->assign_values(array('email' => $email));
                                    echo $template->render('pretty_html');
                                    exit;
                                } else {
                                    if (module_config::c('newsletter_update_details_redirect', '')) {
                                        redirect_browser(module_config::c('newsletter_update_details_redirect', ''));
                                    }
                                    $template = module_template::get_template_by_key('member_update_details_success');
                                    $template->page_title = htmlspecialchars(_l('Subscription'));
                                    $template->assign_values(array('email' => $email));
                                    echo $template->render('pretty_html');
                                    exit;
                                }
                            } else {
                                echo 'database failure.. please try again.';
                            }
                        } else {
                            $template = module_template::get_template_by_key('member_subscription_error');
                            $template->page_title = htmlspecialchars(_l('Subscription'));
                            $template->assign_values(array('message' => _l('Sorry please go back and complete all required fields (especially email address)')));
                            echo $template->render('pretty_html');
                            exit;
                        }
                    } else {
                        $template = module_template::get_template_by_key('member_subscription_error');
                        $template->page_title = htmlspecialchars(_l('Subscription'));
                        $template->assign_values(array('message' => _l('Sorry please go back and complete all required fields')));
                        echo $template->render('pretty_html');
                        exit;
                    }
                } else {
                    $template = module_template::get_template_by_key('member_subscription_form');
                    $template->page_title = htmlspecialchars(_l('Subscription'));
                    // we also treat this as a subscription modification form.
                    $newsletter_subscriptions = array();
                    $member = array('email' => '', 'first_name' => '', 'last_name' => '', 'business' => '', 'phone' => '', 'mobile' => '');
                    // extra fields:
                    $extra_fields = module_extra::get_defaults('member');
                    foreach ($extra_fields as $extra_field) {
                        $member[$extra_field['key']] = '';
                    }
                    if ($provided_member_id && $hash) {
                        $real_hash = $this->link_public_details($provided_member_id, true);
                        if ($real_hash == $hash) {
                            // we can load these details into the forum successfully.
                            $member = array_merge($member, $this->get_member($provided_member_id));
                            // get their fields:
                            $extra_fields = module_extra::get_extras(array('owner_table' => 'member', 'owner_id' => $provided_member_id));
                            foreach ($extra_fields as $extra_field) {
                                $member[$extra_field['extra_key']] = $extra_field['extra'];
                            }
                            // find out what newsletter subscriptions this member has.
                            if (class_exists('module_newsletter', false)) {
                                $newsletter_member_id = module_newsletter::member_from_email($member, true, true);
                                $newsletter_subscriptions = module_group::get_member_groups('newsletter_subscription', $provided_member_id);
                            }
                        }
                    }
                    $template->assign_values($member);
                    if (class_exists('module_newsletter', false)) {
                        $group_items = module_group::get_groups('newsletter_subscription');
                        ob_start();
                        foreach ($group_items as $group_item) {
                            ?>

                            <div class="group_select">
                                <input type="checkbox" name="member[group][<?php 
                            echo $group_item['group_id'];
                            ?>
]" value="1"<?php 
                            foreach ($newsletter_subscriptions as $newsletter_subscription) {
                                if ($newsletter_subscription['group_id'] == $group_item['group_id']) {
                                    echo ' checked';
                                }
                            }
                            ?>
 > <?php 
                            echo htmlspecialchars($group_item['name']);
                            ?>

                            </div>
                            <?php 
                        }
                        $template->assign_values(array('newsletter_options' => ob_get_clean()));
                    } else {
                        $template->assign_values(array('newsletter_options' => ''));
                    }
                    echo $template->render('pretty_html');
                    exit;
                }
                break;
        }
    }
Exemple #11
0
 public static function get_replace_fields($customer_id, $primary_user_id = false)
 {
     $customer_data = module_customer::get_customer($customer_id);
     $address_combined = array();
     if (isset($customer_data['customer_address'])) {
         foreach ($customer_data['customer_address'] as $key => $val) {
             if (strlen(trim($val))) {
                 $address_combined[$key] = $val;
             }
         }
     }
     // do we use the primary contact or
     $contact_data = module_user::get_user($primary_user_id ? $primary_user_id : $customer_data['primary_user_id']);
     //print_r($contact_data);exit;
     if ($contact_data && $contact_data['customer_id'] != $customer_id && (!isset($contact_data['linked_parent_user_id']) || !$contact_data['linked_parent_user_id'])) {
         $contact_data = array('user_id' => 0, 'customer_id' => 0, 'name' => '', 'last_name' => '', 'email' => '', 'password' => '', 'phone' => '', 'mobile' => '', 'fax' => '');
     }
     $data = array('customer_details' => ' - todo - ', 'customer_name' => isset($customer_data['customer_name']) ? htmlspecialchars($customer_data['customer_name']) : _l('N/A'), 'customer_address' => htmlspecialchars(implode(', ', $address_combined)), 'contact_name' => $contact_data['name'] != $contact_data['email'] ? htmlspecialchars($contact_data['name'] . ' ' . $contact_data['last_name']) : '', 'contact_first_name' => $contact_data['name'], 'contact_last_name' => $contact_data['last_name'], 'first_name' => $contact_data['name'], 'last_name' => $contact_data['last_name'], 'contact_email' => htmlspecialchars($contact_data['email']), 'contact_phone' => htmlspecialchars($contact_data['phone']), 'contact_mobile' => htmlspecialchars($contact_data['mobile']), 'customer_invoice_prefix' => isset($customer_data['default_invoice_prefix']) ? $customer_data['default_invoice_prefix'] : '');
     $data = array_merge($customer_data, $data);
     foreach ($customer_data['customer_address'] as $key => $val) {
         $data['address_' . $key] = $val;
     }
     if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
         // get the customer groups
         $g = array();
         if ((int) $customer_data['customer_id'] > 0) {
             foreach (module_group::get_groups_search(array('owner_table' => 'customer', 'owner_id' => $customer_data['customer_id'])) as $group) {
                 $g[] = $group['name'];
             }
         }
         $data['customer_group'] = implode(', ', $g);
         // get the customer groups
         $g = array();
         if ($customer_id > 0) {
             $customer_data = module_customer::get_customer($customer_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'customer', 'owner_id' => $customer_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
         }
         $data['customer_group'] = implode(', ', $g);
     }
     // addition. find all extra keys for this customer and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('customer');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'customer', 'owner_id' => $customer_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
         // and the primary contact
         $all_extra_fields = module_extra::get_defaults('user');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         if ($contact_data && $contact_data['user_id']) {
             // and find the ones with values:
             $extras = module_extra::get_extras(array('owner_table' => 'user', 'owner_id' => $contact_data['user_id']));
             foreach ($extras as $e) {
                 $data[$e['extra_key']] = $e['extra'];
             }
         }
     }
     return $data;
 }
Exemple #12
0
 public static function get_replace_fields($user_id)
 {
     // do we use the primary contact or
     $contact_data = module_user::get_user($user_id);
     //print_r($contact_data);exit;
     if ($contact_data && $contact_data['user_id'] != $user_id) {
         $contact_data = array('user_id' => 0, 'customer_id' => 0, 'name' => '', 'last_name' => '', 'email' => '', 'password' => '', 'phone' => '', 'mobile' => '', 'fax' => '');
     }
     $contact_data['password'] = '';
     $contact_data['first_name'] = $contact_data['name'];
     // addition. find all extra keys for this customer and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         // and the primary contact
         $all_extra_fields = module_extra::get_defaults('user');
         foreach ($all_extra_fields as $e) {
             $contact_data[$e['key']] = _l('N/A');
         }
         if ($contact_data && $contact_data['user_id']) {
             // and find the ones with values:
             $extras = module_extra::get_extras(array('owner_table' => 'user', 'owner_id' => $contact_data['user_id']));
             foreach ($extras as $e) {
                 $contact_data[$e['extra_key']] = $e['extra'];
             }
         }
     }
     return $contact_data;
 }
Exemple #13
0
 public static function get_replace_fields($website_id, $website_data = false)
 {
     if (!$website_data) {
         $website_data = self::get_website($website_id);
     }
     $data = array('website_name' => $website_data['name'], 'website_url' => self::urlify($website_data['url']));
     $data = array_merge($data, $website_data);
     if (class_exists('module_group', false)) {
         // get the website groups
         $g = array();
         if ($website_id > 0) {
             $website_data = module_website::get_website($website_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'website', 'owner_id' => $website_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
         }
         $data['website_group'] = implode(', ', $g);
     }
     // addition. find all extra keys for this website and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     $all_extra_fields = module_extra::get_defaults('website');
     foreach ($all_extra_fields as $e) {
         $data[$e['key']] = _l('N/A');
     }
     // and find the ones with values:
     $extras = module_extra::get_extras(array('owner_table' => 'website', 'owner_id' => $website_id));
     foreach ($extras as $e) {
         $data[$e['extra_key']] = $e['extra'];
     }
     return $data;
 }
Exemple #14
0
 public static function get_replace_fields($ticket_id, $ticket_data = array())
 {
     if (!$ticket_data) {
         $ticket_data = module_ticket::get_ticket($ticket_id);
     }
     $staff_user_id = $ticket_data['assigned_user_id'] ? $ticket_data['assigned_user_id'] : module_config::c('ticket_default_user_id', 1);
     $to = module_user::get_user($staff_user_id);
     //$ticket_data['assigned_user_id']);
     $ticket_data['staff_name'] = $to['name'] . ' ' . $to['last_name'];
     $ticket_data['ticket_number'] = module_ticket::ticket_number($ticket_data['ticket_id']);
     $ticket_contact = module_user::get_user($ticket_data['user_id'], false);
     $ticket_data['contact_name'] = (isset($ticket_contact['name']) ? $ticket_contact['name'] . ' ' : '') . (isset($ticket_contact['last_name']) ? $ticket_contact['last_name'] : '');
     $ticket_data['contact_fname'] = isset($ticket_contact['name']) ? $ticket_contact['name'] : '';
     $ticket_data['contact_lname'] = isset($ticket_contact['last_name']) ? $ticket_contact['last_name'] : '';
     // addition. find all extra keys for this ticket and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('ticket');
         foreach ($all_extra_fields as $e) {
             $ticket_data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'ticket', 'owner_id' => $ticket_id));
         foreach ($extras as $e) {
             $ticket_data[$e['extra_key']] = $e['extra'];
         }
     }
     if (isset($ticket_data['faq_product_id']) && (int) $ticket_data['faq_product_id'] > 0) {
         $ticket_data['faq_product'] = friendly_key(module_faq::get_faq_products_rel(), $ticket_data['faq_product_id']);
     } else {
         $ticket_data['faq_product'] = _l('N/A');
     }
     // find any extra keys (defined in the db for ticket submission, not the module_extra extra keys)
     $extras = module_ticket::get_ticket_extras_keys();
     if (count($extras)) {
         foreach ($extras as $extra) {
             $key = strtolower($extra['key']);
             if (!isset($ticket_data[$key])) {
                 $ticket_data[$key] = isset($ticket_data['extra_data'][$extra['ticket_data_key_id']]) ? $ticket_data['extra_data'][$extra['ticket_data_key_id']]['value'] : '';
             }
         }
     }
     return $ticket_data;
 }