if (count($res) <= 1 && $widget['customer_id'] && isset($c[$widget['customer_id']])) {
        $fieldset_data['elements']['change'] = array('title' => _l('Change Customer'), 'fields' => array(htmlspecialchars($c[$widget['customer_id']]), array('type' => 'hidden', 'name' => 'customer_id', 'value' => $widget['customer_id'])));
    } else {
        $fieldset_data['elements']['change'] = array('title' => _l('Change Customer'), 'fields' => array(array('type' => 'select', 'name' => 'customer_id', 'options' => $c, 'value' => $widget['customer_id'], 'help' => 'Changing a customer will also change all the current linked jobs and invoices across to this new customer.')));
    }
    echo module_form::generate_fieldset($fieldset_data);
}
if ((int) $widget_id > 0) {
    if (class_exists('module_group', false)) {
        module_group::display_groups(array('title' => 'Widget' . ' Groups', 'owner_table' => 'widget', 'owner_id' => $widget_id, 'view_link' => module_widget::link_open($widget_id)));
    }
    // and a hook for our new change request plugin
    hook_handle_callback('widget_sidebar', $widget_id);
}
hook_handle_callback('layout_column_half', 2, 65);
if ((int) $widget_id > 0) {
    if (class_exists('module_note', false)) {
        module_note::display_notes(array('title' => 'Widget' . ' Notes', 'owner_table' => 'widget', 'owner_id' => $widget_id, 'view_link' => module_widget::link_open($widget_id)));
    }
    // and a hook for our new change request plugin
    hook_handle_callback('widget_main', $widget_id);
}
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save ' . 'Widget')), array('ignore' => !((int) $widget_id && module_widget::can_i('delete', 'Widgets')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_widget::link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
?>



</form>
Ejemplo n.º 2
0
 public static function add_history($invoice_id, $message)
 {
     if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
         module_note::save_note(array('owner_table' => 'invoice', 'owner_id' => $invoice_id, 'note' => $message, 'rel_data' => self::link_open($invoice_id), 'note_time' => time()));
     }
 }
Ejemplo n.º 3
0
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
module_form::set_required(array('fields' => array('name' => 'Name', 'email' => 'Email')));
hook_handle_callback('layout_column_half', 1);
$title = 'User Details';
include module_theme::include_ucm('includes/plugin_user/pages/contact_admin_form.php');
if (module_config::c('users_have_address', 0)) {
    ob_start();
    handle_hook("address_block", $module, "physical", "user", "user_id");
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Address'), 'elements_before' => ob_get_clean());
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
}
if ((int) $user_id > 0) {
    //handle_hook("note_list",$module,"user","user_id",$user_id);
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'User Notes', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => $module->link_open($user_id)));
    }
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => 'User Groups', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => module_user::link_open($user_id)));
    }
}
hook_handle_callback('layout_column_half', 2);
if (is_file('includes/plugin_user/pages/user_admin_edit_login.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_login.php');
}
if (is_file('includes/plugin_user/pages/user_admin_edit_staff.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_staff.php');
}
if (is_file('includes/plugin_user/pages/user_admin_edit_company.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_company.php');
}
Ejemplo n.º 4
0
        $fieldset_data = array('heading' => array('title' => _l('Job Description'), 'type' => 'h3'), 'class' => 'tableclass tableclass_form tableclass_full');
        if (module_job::can_i('edit', 'Jobs')) {
            $fieldset_data['elements'] = array(array('field' => array('type' => 'wysiwyg', 'name' => 'description', 'value' => $job['description'])));
        } else {
            $fieldset_data['elements'] = array(array('fields' => array(module_security::purify_html($job['description']))));
        }
        echo module_form::generate_fieldset($fieldset_data);
        unset($fieldset_data);
    }
}
if ($job_id && $job_id != 'new') {
    $note_summary_owners = array();
    // generate a list of all possible notes we can display for this job.
    // display all the notes which are owned by all the sites we have access to
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'Job Notes', 'owner_table' => 'job', 'owner_id' => $job_id, 'view_link' => module_job::link_open($job_id)));
    }
    if (class_exists('module_job', false) && module_job::is_plugin_enabled()) {
        if (module_job::can_i('edit', 'Jobs')) {
            module_email::display_emails(array('title' => 'Job Emails', 'search' => array('job_id' => $job_id)));
        }
    }
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => 'Job Groups', 'owner_table' => 'job', 'owner_id' => $job_id, 'view_link' => $module->link_open($job_id)));
    }
}
if (module_job::can_i('view', 'Job Advanced')) {
    /***** JOB ADVANCED *****/
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Advanced'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array(array('title' => 'Customer Link', 'field' => array('type' => 'html', 'value' => '<a href="' . module_job::link_public($job_id) . '" target="_blank">' . _l('Click to view external link') . '</a>', 'help' => 'You can send this link to the customer and they can view progress on their job. They can also view a list of any invoices attached to this job. This is VERY useful to stop customers asking you "how far along are you" with a job because they can see exactly where you have logged up to in the system.'))));
    if ((int) $job_id > 0 && module_job::can_i('edit', 'Jobs')) {
        $fieldset_data['elements'][] = array('title' => 'Email Job', 'field' => array('type' => 'html', 'value' => '<a href="' . module_job::link_generate($job_id, array('arguments' => array('email' => 1))) . '">' . _l('Email this Job to Customer') . '</a>', 'help' => 'You can email the customer a copy of this job. This can be a progress report or as an initial quote. '));
Ejemplo n.º 5
0
                }
            }
        }
        // now find any subscription invoices that are linked to this website.
        if (class_exists('module_subscription', false)) {
            $members_subscriptions = module_subscription::get_subscriptions_by('website', $website_id);
            foreach ($members_subscriptions as $subscription_id => $subscription_info) {
                $history = module_subscription::get_subscription_history($subscription_id, 'website', $website_id);
                foreach ($history as $h) {
                    if (is_array($h) && isset($h['invoice_id']) && $h['invoice_id']) {
                        $note_summary_owners['invoice'][$h['invoice_id']] = $h['invoice_id'];
                    }
                }
            }
        }
        module_note::display_notes(array('title' => module_config::c('project_name_single', 'Website') . ' Notes', 'owner_table' => 'website', 'owner_id' => $website_id, 'view_link' => module_website::link_open($website_id), 'display_summary' => true, 'summary_owners' => $note_summary_owners));
    }
    if (class_exists('module_quote', false) && module_quote::is_plugin_enabled() && module_quote::can_i('view', 'Quotes')) {
        // show the jobs linked to this website.
        $quotes = module_quote::get_quotes(array('website_id' => $website_id));
        if (count($quotes) || module_quote::can_i('create', 'Quotes')) {
            $h = array('type' => 'h3', 'title' => module_config::c('project_name_single', 'Website') . ' Quotes');
            if (module_quote::can_i('create', 'Quotes')) {
                $h['button'] = array('title' => 'New Quote', 'url' => module_quote::link_generate('new', array('arguments' => array('website_id' => $website_id))));
            }
            $fieldset_data = array('heading' => $h);
            if (count($quotes)) {
                $c = 0;
                ob_start();
                ?>
Ejemplo n.º 6
0
 public static function delete_report($report_id)
 {
     $report_id = (int) $report_id;
     if (_DEMO_MODE && $report_id == 1) {
         return;
     }
     if ((int) $report_id > 0) {
         $original_report_data = self::get_report($report_id);
         if (!$original_report_data || $original_report_data['report_id'] != $report_id) {
             return false;
         }
     }
     if (!self::can_i('delete', 'reports')) {
         return false;
     }
     $sql = "DELETE FROM " . _DB_PREFIX . "report WHERE report_id = '" . $report_id . "' LIMIT 1";
     $res = query($sql);
     module_note::note_delete("report", $report_id);
     module_extra::delete_extras('report', 'report_id', $report_id);
 }
Ejemplo n.º 7
0
     $can_edit = $plugins[$options['owner_table']]->can_i('edit', $options['title']);
     $can_create = $plugins[$options['owner_table']]->can_i('create', $options['title']);
     $can_delete = $plugins[$options['owner_table']]->can_i('delete', $options['title']);
 } else {
     return;
 }
 if (!$can_view && !$can_edit) {
     return;
 }
 $note_id = (int) $_REQUEST['note_id'];
 if ($note_id > 0) {
     $note = module_note::get_note($note_id);
     $owner_table = $note['owner_table'];
     $owner_id = $note['owner_id'];
     if ($can_delete && isset($options['do_delete']) && $options['do_delete'] == 'yes' && isset($options['note_id']) && $options['note_id']) {
         module_note::note_delete($owner_table, $owner_id, $options['note_id']);
         set_message('Note deleted successfully');
         redirect_browser($note['rel_data']);
     }
 } else {
     $owner_table = isset($options['owner_table']) ? $options['owner_table'] : (isset($_REQUEST['owner_table']) ? htmlspecialchars($_REQUEST['owner_table']) : '');
     $owner_id = isset($options['owner_id']) ? $options['owner_id'] : (isset($_REQUEST['owner_id']) ? htmlspecialchars($_REQUEST['owner_id']) : '');
     $note = array("note_time" => time(), "note" => '', "reminder" => '', "user_id" => '', 'rel_data' => isset($rel_data) ? serialize($rel_data) : '', 'public' => 0);
 }
 $note_edit_safe = true;
 if (get_display_mode() != 'ajax') {
     print_heading('Note');
     //print_r($options);
     if (isset($options['view_link'])) {
         $note['rel_data'] = $options['view_link'];
     }
Ejemplo n.º 8
0
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <?php 
}
?>

                    
                    <?php 
if ($invoice_id && $invoice_id != 'new') {
    $note_summary_owners = array();
    // generate a list of all possible notes we can display for this invoice.
    // display all the notes which are owned by all the sites we have access to
    module_note::display_notes(array('title' => 'Invoice Notes', 'owner_table' => 'invoice', 'owner_id' => $invoice_id, 'view_link' => module_invoice::link_open($invoice_id)));
}
?>


                    <?php 
if ((int) $invoice_id > 0 && (!$invoice['date_sent'] || $invoice['date_sent'] == '0000-00-00') && module_security::is_page_editable()) {
    ?>


                    <h3 class="error_text"><?php 
    _e('Send Invoice');
    ?>
</h3>
                        <div class="tableclass_form content">
Ejemplo n.º 9
0
 public static function delete_quote($quote_id)
 {
     $quote_id = (int) $quote_id;
     if (_DEMO_MODE && $quote_id == 1) {
         return;
     }
     if ((int) $quote_id > 0) {
         $original_quote_data = self::get_quote($quote_id);
         if (!$original_quote_data || $original_quote_data['quote_id'] != $quote_id) {
             return false;
         }
     } else {
         return false;
     }
     if (!self::can_i('delete', 'Quotes')) {
         return false;
     }
     $sql = "DELETE FROM " . _DB_PREFIX . "quote WHERE quote_id = '" . $quote_id . "' LIMIT 1";
     $res = query($sql);
     $sql = "DELETE FROM " . _DB_PREFIX . "quote_tax WHERE quote_id = '" . $quote_id . "'";
     $res = query($sql);
     $sql = "DELETE FROM " . _DB_PREFIX . "quote_task WHERE quote_id = '" . $quote_id . "'";
     $res = query($sql);
     if (class_exists('module_file', false)) {
         $sql = "UPDATE " . _DB_PREFIX . "file SET quote_id = 0 WHERE quote_id = '" . $quote_id . "'";
         query($sql);
     }
     if (class_exists('module_group', false)) {
         module_group::delete_member($quote_id, 'quote');
     }
     if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
         module_note::note_delete("quote", $quote_id);
     }
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         module_extra::delete_extras('quote', 'quote_id', $quote_id);
     }
     hook_handle_callback('quote_delete', $quote_id);
     module_cache::clear('quote');
 }
Ejemplo n.º 10
0
              $note_summary_owners['website'][] = $val['website_id'];
          }
      }
      if(class_exists('module_job',false) && module_job::is_plugin_enabled()){
          foreach(module_job::get_jobs(array('vendor_id'=>$vendor_id)) as $val){
              $note_summary_owners['job'][] = $val['job_id'];
              foreach(module_invoice::get_invoices(array('job_id'=>$val['job_id'])) as $val){
                  $note_summary_owners['invoice'][$val['invoice_id']] = $val['invoice_id'];
              }
          }
      }
      if(class_exists('module_invoice',false) && module_invoice::is_plugin_enabled()){
          foreach(module_invoice::get_invoices(array('vendor_id'=>$vendor_id)) as $val){
              $note_summary_owners['invoice'][$val['invoice_id']] = $val['invoice_id'];
          }
      }*/
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'All ' . $page_type_single . ' Notes', 'owner_table' => 'vendor', 'owner_id' => $vendor_id, 'view_link' => $module->link_open($vendor_id), 'display_summary' => true, 'summary_owners' => $note_summary_owners));
    }
}
hook_handle_callback('vendor_edit', $vendor_id);
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'onclick' => "\$('#form_redirect').val('" . $module->link_open(false) . "');", 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')), array('ignore' => !(module_vendor::can_i('delete', 'Companies') && $vendor_id > 0), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . $module->link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
?>



</form>

Ejemplo n.º 11
0
 public static function add_history($customer_id, $message)
 {
     if (class_exists('module_note', false)) {
         module_note::save_note(array('owner_table' => 'customer', 'owner_id' => $customer_id, 'note' => $message, 'rel_data' => self::link_open($customer_id), 'note_time' => time()));
     }
 }
Ejemplo n.º 12
0
 public static function delete_user($user_id)
 {
     $user_id = (int) $user_id;
     if (_DEMO_MODE && $user_id == 1) {
         return;
     }
     $sql = "DELETE FROM " . _DB_PREFIX . "user WHERE user_id = '" . $user_id . "' LIMIT 1";
     query($sql);
     module_note::note_delete("user", $user_id);
     $sql = "DELETE FROM " . _DB_PREFIX . "user_customer_rel WHERE user_id = '" . $user_id . "'";
     query($sql);
     $sql = "DELETE FROM `" . _DB_PREFIX . "user_role` WHERE user_id = '" . (int) $user_id . "'";
     query($sql);
     $sql = "UPDATE " . _DB_PREFIX . "user SET linked_parent_user_id = 0 WHERE linked_parent_user_id = '" . $user_id . "'";
     query($sql);
 }
Ejemplo n.º 13
0
 public static function handle_import_row($row, $debug, $add_to_group, $extra_options)
 {
     $debug_string = '';
     if (!isset($row['name'])) {
         $row['name'] = '';
     }
     if (!isset($row['url'])) {
         $row['url'] = '';
     }
     if (isset($row['website_id']) && (int) $row['website_id'] > 0) {
         // check if this ID exists.
         $website = self::get_website($row['website_id']);
         if (!$website || $website['website_id'] != $row['website_id']) {
             $row['website_id'] = 0;
         }
     }
     if (!isset($row['website_id']) || !$row['website_id']) {
         $row['website_id'] = 0;
     }
     if (isset($row['name']) && strlen(trim($row['name']))) {
         // we have a website name!
         // search for a website based on name.
         $website = get_single('website', 'name', $row['name']);
         if ($website && $website['website_id'] > 0) {
             $row['website_id'] = $website['website_id'];
         }
     } else {
         if (isset($row['url'])) {
             $row['name'] = $row['url'];
         }
     }
     if (!$row['website_id'] && isset($row['url']) && strlen(trim($row['url']))) {
         // we have a url! find a match too.
         $website = get_single('website', 'url', $row['url']);
         if ($website && $website['website_id'] > 0) {
             $row['website_id'] = $website['website_id'];
         }
     }
     if (!strlen($row['name']) && !strlen($row['url'])) {
         $debug_string .= _l('No website data to import');
         if ($debug) {
             echo $debug_string;
         }
         return false;
     }
     // duplicates.
     //print_r($extra_options);exit;
     if (isset($extra_options['duplicates']) && $extra_options['duplicates'] == 'ignore' && (int) $row['website_id'] > 0) {
         if ($debug) {
             $debug_string .= _l('Skipping import, duplicate of website %s', self::link_open($row['website_id'], true));
             echo $debug_string;
         }
         // don't import duplicates
         return false;
     }
     $row['customer_id'] = 0;
     // todo - support importing of this id? nah
     if (isset($row['customer_name']) && strlen(trim($row['customer_name'])) > 0) {
         // check if this customer exists.
         $customer = get_single('customer', 'customer_name', $row['customer_name']);
         if ($customer && $customer['customer_id'] > 0) {
             $row['customer_id'] = $customer['customer_id'];
             $debug_string .= _l('Linked to customer %s', module_customer::link_open($row['customer_id'], true)) . ' ';
         } else {
             $debug_string .= _l('Create new customer: %s', htmlspecialchars($row['customer_name'])) . ' ';
         }
     } else {
         $debug_string .= _l('No customer') . ' ';
     }
     if ($row['website_id']) {
         $debug_string .= _l('Replace existing website: %s', self::link_open($row['website_id'], true)) . ' ';
     } else {
         $debug_string .= _l('Insert new website: %s', htmlspecialchars($row['url'])) . ' ';
     }
     $customer_primary_user_id = 0;
     if ($row['customer_id'] > 0 && isset($row['customer_contact_email']) && strlen(trim($row['customer_contact_email']))) {
         $users = module_user::get_users(array('customer_id' => $row['customer_id'] > 0));
         foreach ($users as $user) {
             if (strtolower(trim($user['email'])) == strtolower(trim($row['customer_contact_email']))) {
                 $customer_primary_user_id = $user['user_id'];
                 $debug_string .= _l('Customer primary contact is: %s', module_user::link_open_contact($customer_primary_user_id, true)) . ' ';
                 break;
             }
         }
     }
     if ($debug) {
         echo $debug_string;
         return true;
     }
     if (isset($extra_options['duplicates']) && $extra_options['duplicates'] == 'ignore' && $row['customer_id'] > 0) {
         // don't update customer record with new one.
     } else {
         if (isset($row['customer_name']) && strlen(trim($row['customer_name'])) > 0 || $row['customer_id'] > 0) {
             // update customer record with new one.
             $row['customer_id'] = update_insert('customer_id', $row['customer_id'], 'customer', $row);
             if (isset($row['customer_contact_fname']) || isset($row['customer_contact_email'])) {
                 $data = array('customer_id' => $row['customer_id']);
                 if (isset($row['customer_contact_fname'])) {
                     $data['name'] = $row['customer_contact_fname'];
                 }
                 if (isset($row['customer_contact_lname'])) {
                     $data['last_name'] = $row['customer_contact_lname'];
                 }
                 if (isset($row['customer_contact_email'])) {
                     $data['email'] = $row['customer_contact_email'];
                 }
                 if (isset($row['customer_contact_phone'])) {
                     $data['phone'] = $row['customer_contact_phone'];
                 }
                 $customer_primary_user_id = update_insert("user_id", $customer_primary_user_id, "user", $data);
                 module_customer::set_primary_user_id($row['customer_id'], $customer_primary_user_id);
             }
         }
     }
     $website_id = (int) $row['website_id'];
     // check if this ID exists.
     $website = self::get_website($website_id);
     if (!$website || $website['website_id'] != $website_id) {
         $website_id = 0;
     }
     $website_id = update_insert("website_id", $website_id, "website", $row);
     // ad notes if possible
     if (isset($row['notes']) && strlen(trim($row['notes']))) {
         if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
             module_note::save_note(array('owner_table' => 'website', 'owner_id' => $website_id, 'note' => trim($row['notes']), 'note_time' => time()));
         }
     }
     // handle any extra fields.
     $extra = array();
     foreach ($row as $key => $val) {
         if (!strlen(trim($val))) {
             continue;
         }
         if (strpos($key, 'extra:') !== false) {
             $extra_key = str_replace('extra:', '', $key);
             if (strlen($extra_key)) {
                 $extra[$extra_key] = $val;
             }
         }
     }
     if ($extra) {
         foreach ($extra as $extra_key => $extra_val) {
             // does this one exist?
             $existing_extra = module_extra::get_extras(array('owner_table' => 'website', 'owner_id' => $website_id, 'extra_key' => $extra_key));
             $extra_id = false;
             foreach ($existing_extra as $key => $val) {
                 if ($val['extra_key'] == $extra_key) {
                     $extra_id = $val['extra_id'];
                 }
             }
             $extra_db = array('extra_key' => $extra_key, 'extra' => $extra_val, 'owner_table' => 'website', 'owner_id' => $website_id);
             $extra_id = (int) $extra_id;
             update_insert('extra_id', $extra_id, 'extra', $extra_db);
         }
     }
     foreach ($add_to_group as $group_id => $tf) {
         module_group::add_to_group($group_id, $website_id, 'website');
     }
     return $website_id;
 }
Ejemplo n.º 14
0
        $fieldset_data = array('heading' => array('title' => _l('Quote Description'), 'type' => 'h3'), 'class' => 'tableclass tableclass_form tableclass_full');
        if (module_quote::can_i('edit', 'Quotes')) {
            $fieldset_data['elements'] = array(array('field' => array('type' => 'wysiwyg', 'name' => 'description', 'value' => $quote['description'])));
        } else {
            $fieldset_data['elements'] = array(array('fields' => array(module_security::purify_html($quote['description']))));
        }
        echo module_form::generate_fieldset($fieldset_data);
        unset($fieldset_data);
    }
}
if ($quote_id && $quote_id != 'new') {
    $note_summary_owners = array();
    // generate a list of all possible notes we can display for this quote.
    // display all the notes which are owned by all the sites we have access to
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'Quote Notes', 'owner_table' => 'quote', 'owner_id' => $quote_id, 'view_link' => module_quote::link_open($quote_id)));
    }
    if (class_exists('module_quote', false) && module_quote::is_plugin_enabled()) {
        if (module_quote::can_i('edit', 'Quotes')) {
            module_email::display_emails(array('title' => 'Quote Emails', 'search' => array('quote_id' => $quote_id)));
        }
    }
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => 'Quote Groups', 'owner_table' => 'quote', 'owner_id' => $quote_id, 'view_link' => $module->link_open($quote_id)));
    }
}
if (module_quote::can_i('view', 'Quote Advanced')) {
    /***** QUOTE ADVANCED *****/
    $fieldset_data = array('id' => 'quote_advanced', 'heading' => array('type' => 'h3', 'title' => 'Advanced'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array());
    if ((int) $quote_id > 0 && module_quote::can_i('edit', 'Quotes')) {
        $fieldset_data['elements'][] = array('title' => 'Customer Link', 'fields' => array('<a href="' . module_quote::link_public($quote_id) . '" target="_blank">' . _l('Click to view external link') . '</a>', _hr('You can send this link to the customer and they can view progress on their quote. They can also view a list of any invoices attached to this quote. This is VERY useful to stop customers asking you "how far along are you" with a quote because they can see exactly where you have logged up to in the system.')));
Ejemplo n.º 15
0
}
//(int)$ticket_id > 0 &&
if (file_exists(dirname(__FILE__) . '/../inc/ticket_extras_sidebar.php')) {
    include dirname(__FILE__) . '/../inc/ticket_extras_sidebar.php';
}
if (file_exists(dirname(__FILE__) . '/../inc/ticket_billing.php')) {
    include dirname(__FILE__) . '/../inc/ticket_billing.php';
}
if ((int) $ticket_id > 0 && file_exists(dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php')) {
    //if($ticket['priority'] == _TICKET_PRIORITY_STATUS_ID || (isset($ticket['invoice_id']) && $ticket['invoice_id'])){
    include dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php';
    // }
}
if (isset($ticket['ticket_id']) && (int) $ticket['ticket_id'] > 0 && module_ticket::can_edit_tickets()) {
    if (class_exists('module_note', false) && module_note::is_plugin_enabled() && module_config::c('ticket_enable_notes', 1)) {
        module_note::display_notes(array('title' => 'Ticket Notes', 'owner_table' => 'ticket', 'owner_id' => $ticket_id, 'view_link' => module_ticket::link_open($ticket['ticket_id'])));
    }
    if (class_exists('module_group', false) && module_config::c('ticket_enable_groups', 1)) {
        module_group::display_groups(array('title' => 'Ticket Groups', 'owner_table' => 'ticket', 'owner_id' => $ticket['ticket_id'], 'view_link' => module_ticket::link_open($ticket['ticket_id'])));
    }
}
if (module_ticket::can_edit_tickets()) {
    /** RELATED TO */
    $responsive_summary = array();
    $responsive_summary[] = module_customer::link_open($ticket['customer_id'], true);
    $fieldset_data = array('heading' => array('title' => _l('Related to'), 'type' => 'h3', 'responsive' => array('summary' => implode(', ', $responsive_summary))), 'elements' => array());
    $fieldset_data['elements'][] = array('title' => _l('Customer'), 'fields' => array(function () use($ticket_id, $ticket, $done_in_ticket_billing) {
        // moved to ticket billing..?
        if (module_ticket::can_edit_tickets() && !isset($done_in_ticket_billing)) {
            $c = array();
            $res = module_customer::get_customers();
Ejemplo n.º 16
0
 public static function delete_job($job_id)
 {
     $job_id = (int) $job_id;
     if (_DEMO_MODE && $job_id == 1) {
         return;
     }
     if ((int) $job_id > 0) {
         $original_job_data = self::get_job($job_id);
         if (!$original_job_data || $original_job_data['job_id'] != $job_id) {
             return false;
         }
     }
     if (!self::can_i('delete', 'Jobs')) {
         return false;
     }
     $sql = "DELETE FROM " . _DB_PREFIX . "job WHERE job_id = '" . $job_id . "' LIMIT 1";
     $res = query($sql);
     $sql = "DELETE FROM " . _DB_PREFIX . "task WHERE job_id = '" . $job_id . "'";
     $res = query($sql);
     $sql = "DELETE FROM " . _DB_PREFIX . "task_log WHERE job_id = '" . $job_id . "'";
     $res = query($sql);
     $sql = "UPDATE " . _DB_PREFIX . "job SET renew_job_id = NULL WHERE renew_job_id = '" . $job_id . "'";
     $res = query($sql);
     if (class_exists('module_file', false)) {
         $sql = "UPDATE " . _DB_PREFIX . "file SET job_id = 0 WHERE job_id = '" . $job_id . "'";
         query($sql);
     }
     if (class_exists('module_group', false)) {
         module_group::delete_member($job_id, 'job');
     }
     foreach (module_invoice::get_invoices(array('job_id' => $job_id)) as $val) {
         // only delete this invoice if it has no tasks left
         // it could be a combined invoice with other jobs now.
         $invoice_items = module_invoice::get_invoice_items($val['invoice_id']);
         if (!count($invoice_items)) {
             module_invoice::delete_invoice($val['invoice_id']);
         }
     }
     if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
         module_note::note_delete("job", $job_id);
     }
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         module_extra::delete_extras('job', 'job_id', $job_id);
     }
     hook_handle_callback('job_delete', $job_id);
     module_cache::clear('job');
 }
Ejemplo n.º 17
0
        $user_temp = module_user::get_user($invoice['user_id'], false);
        $c[$invoice['user_id']] = $user_temp['name'] . ' ' . $user_temp['last_name'] . ' ' . _l('(under different customer)');
    }
    $fieldset_data['elements'][] = array('title' => 'Contact', 'field' => array('type' => 'select', 'name' => 'user_id', 'value' => $invoice['user_id'], 'options' => $c, 'blank' => false));
}
echo module_form::generate_fieldset($fieldset_data);
unset($fieldset_data);
if ((int) $invoice_id > 0) {
    hook_handle_callback('invoice_sidebar', $invoice_id);
}
if ($invoice_id && $invoice_id != 'new') {
    $note_summary_owners = array();
    // generate a list of all possible notes we can display for this invoice.
    // display all the notes which are owned by all the sites we have access to
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'Invoice Notes', 'owner_table' => 'invoice', 'owner_id' => $invoice_id, 'view_link' => module_invoice::link_open($invoice_id), 'public' => array('enabled' => true, 'title' => 'Public', 'text' => 'Yes, show this note in invoice', 'help' => 'If this is ticked then this note will be available to the customer and will be included in the {INVOICE_NOTES} shortcode in the invoice template.')));
    }
    if (module_invoice::can_i('edit', 'Invoices')) {
        module_email::display_emails(array('title' => 'Invoice Emails', 'search' => array('invoice_id' => $invoice_id)));
    }
}
if ((int) $invoice_id > 0 && (!$invoice['date_sent'] || $invoice['date_sent'] == '0000-00-00') && module_security::is_page_editable()) {
    ob_start();
    ?>


            <div class="tableclass_form content">

                <p style="text-align: center;">
                    <input type="submit" name="butt_email" id="butt_email2" value="<?php 
    echo _l('Email Invoice');
Ejemplo n.º 18
0
        echo $user_data['name'];
    }
    if ($note_item['display_summary'] && $note_item['rel_data'] && $note_item['owner_id']) {
        global $plugins;
        if (module_config::c('note_show_creator', 1)) {
            echo ' / ';
        }
        echo $plugins[$note_item['owner_table']]->link_open($note_item['owner_id'], true);
    }
});
if ($can_delete) {
    $columns['del'] = array('title' => ' ', 'callback' => function ($note_item) {
        if ($note_item['can_delete']) {
            ?>
 <a href="<?php 
            echo module_note::link_open($note_item['note_id'], false, array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])));
            ?>
" data-options="<?php 
            echo htmlspecialchars(base64_encode(serialize(array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])))));
            ?>
" rel="<?php 
            echo $note_item['note_id'];
            ?>
" onclick="if(confirm('<?php 
            _e('Really Delete Note?');
            ?>
'))return true; else return false;" class="note_delete note_options_link delete ui-state-default ui-corner-all ui-icon ui-icon-trash">[x]</a> <?php 
        }
    });
}
$table_manager->set_columns($columns);
Ejemplo n.º 19
0
    public static function print_note($note_id, $note_item, $display_summary = false, $can_edit = true, $can_delete = true, $options = array())
    {
        if (!$note_item) {
            $note_item = self::get_note($note_id);
        }
        static $x = 0;
        global $plugins;
        $can_view = $can_edit = $can_create = $can_delete = false;
        // re-check permissions...
        if (isset($options) && isset($options['owner_table']) && $options['owner_table'] && isset($options['title']) && $options['title']) {
            $can_view = $plugins[$options['owner_table']]->can_i('view', $options['title']);
            $can_edit = $plugins[$options['owner_table']]->can_i('edit', $options['title']);
            $can_create = $plugins[$options['owner_table']]->can_i('create', $options['title']);
            $can_delete = $plugins[$options['owner_table']]->can_i('delete', $options['title']);
        } else {
        }
        if (!module_security::is_page_editable()) {
            //$can_edit=$can_create=$can_delete=false;
        }
        if (isset($options['summary_owners'])) {
            unset($options['summary_owners']);
        }
        if (isset($options['display_summary'])) {
            unset($options['display_summary']);
        }
        //
        if (!trim($note_item['note'])) {
            $note_item['note'] = 'none';
        }
        ob_start();
        /** START TABLE LAYOUT **/
        $table_manager = module_theme::new_table_manager();
        $columns = array();
        $columns['date'] = array('title' => 'Date', 'width' => 60, 'callback' => function ($note_item) {
            if ($note_item['reminder']) {
                echo '<strong>';
            }
            echo print_date($note_item['note_time']);
            if ($note_item['reminder']) {
                echo '</strong>';
            }
        });
        $columns['description'] = array('title' => 'Description', 'callback' => function ($note_item) {
            if (isset($note_item['public']) && $note_item['public']) {
                echo '* ';
            }
            if ($note_item['can_edit']) {
                $note_text = nl2br(htmlspecialchars(substr($note_item['note'], 0, module_config::c('note_trim_length', 35))));
                $note_text .= strlen($note_item['note']) > module_config::c('note_trim_length', 35) ? '...' : '';
                ?>

                <a href="<?php 
                echo module_note::link_open($note_item['note_id'], false, $note_item['options']);
                ?>
" data-options="<?php 
                echo htmlspecialchars(base64_encode(serialize($note_item['options'])));
                ?>
" class="note_edit note_options_link" rel="<?php 
                echo $note_item['note_id'];
                ?>
"> <?php 
                echo $note_text;
                ?>
 </a>
                <?php 
            } else {
                echo forum_text($note_item['note']);
            }
        });
        $columns['info'] = array('title' => 'Info', 'width' => 40, 'callback' => function ($note_item) {
            if ($note_item['display_summary']) {
                if ($note_item['rel_data']) {
                    global $plugins;
                    echo $plugins[$note_item['owner_table']]->link_open($note_item['owner_id'], true);
                }
            } else {
                // find the user name who made thsi note.
                $user_data = module_user::get_user($note_item['create_user_id']);
                echo $user_data['name'];
            }
        });
        if ($can_delete) {
            $columns['del'] = array('title' => ' ', 'callback' => function ($note_item) {
                if ($note_item['can_delete']) {
                    ?>
 <a href="<?php 
                    echo module_note::link_open($note_item['note_id'], false, array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])));
                    ?>
" data-options="<?php 
                    echo htmlspecialchars(base64_encode(serialize(array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])))));
                    ?>
" rel="<?php 
                    echo $note_item['note_id'];
                    ?>
" onclick="if(confirm('<?php 
                    _e('Really Delete Note?');
                    ?>
'))return true; else return false;" class="note_delete note_options_link delete ui-state-default ui-corner-all ui-icon ui-icon-trash">[x]</a> <?php 
                }
            });
        }
        $table_manager->set_columns($columns);
        $table_manager->inline_table = true;
        $table_manager->row_callback = function ($row_data, &$row_object) use($display_summary, $can_edit, $can_delete, &$options) {
            $row_data['display_summary'] = $display_summary;
            $row_data['can_edit'] = $can_edit;
            $row_data['can_delete'] = $can_delete;
            $row_data['options'] = $options;
            $row_object->row_id = 'note_' . $row_data['note_id'];
            return $row_data;
        };
        $table_manager->print_row($note_item);
        /*?>
        		<tr id="note_<?php echo $note_item['note_id'];?>" class="<?php echo ($x++%2)?'odd':'even';?>">
        			<td>
                        <?php
                        if($note_item['reminder'])echo '<strong>';
                        echo print_date($note_item['note_time']);
                        if($note_item['reminder'])echo '</strong>';
                        ?>
        			</td>
        			<td>
                        <?php
                        if(isset($note_item['public']) && $note_item['public'])echo '* ';
                        if($can_edit){
                            $note_text = nl2br(htmlspecialchars(substr($note_item['note'],0,module_config::c('note_trim_length',35))));
                            $note_text .= strlen($note_item['note']) > module_config::c('note_trim_length',35) ? '...' : '';
                            ?>
                        <a href="<?php echo self::link_open($note_item['note_id'],false,$options);?>" data-options="<?php echo htmlspecialchars(base64_encode(serialize($options)));?>" class="note_edit note_options_link" rel="<?php echo $note_item['note_id'];?>"> <?php echo $note_text; ?> </a>
                        <?php }else{
                            echo forum_text($note_item['note']);
                        } ?>
        			</td>
        			<td nowrap="nowrap">
        				<?php
        				if($display_summary){
        					if($note_item['rel_data']){
                                echo $plugins[$note_item['owner_table']]->link_open($note_item['owner_id'],true);
        					}
        				}else{
        					// find the user name who made thsi note.
        					$user_data = module_user::get_user($note_item['create_user_id']);
        					echo $user_data['name'];
        				}
        				?>
        			</td>
                    <?php if($can_delete){ ?>
                    <td><a href="<?php echo self::link_open($note_item['note_id'],false,array_merge($options,array('do_delete'=>'yes','note_id'=>$note_item['note_id'])));?>" data-options="<?php echo htmlspecialchars(base64_encode(serialize(array_merge($options,array('do_delete'=>'yes','note_id'=>$note_item['note_id'])))));?>" rel="<?php echo $note_item['note_id'];?>" onclick="if(confirm('<?php _e('Really Delete Note?');?>'))return true; else return false;" class="note_delete note_options_link delete ui-state-default ui-corner-all ui-icon ui-icon-trash">[x]</a></td>
                    <?php } ?>
        		</tr>
        		<?php
        		*/
        return ob_get_clean();
    }
Ejemplo n.º 20
0
 public static function delete_widget($widget_id)
 {
     $widget_id = (int) $widget_id;
     if (_DEMO_MODE && $widget_id == 1) {
         set_error('Sorry this is a Demo Widget. It cannot be deleted.');
         return;
     }
     if ((int) $widget_id > 0) {
         $original_widget_data = self::get_widget($widget_id);
         if (!$original_widget_data || $original_widget_data['widget_id'] != $widget_id) {
             return false;
         }
     }
     if (!self::can_i('delete', 'Widgets')) {
         return false;
     }
     hook_handle_callback('widget_deleted', $widget_id);
     $sql = "DELETE FROM " . _DB_PREFIX . "widget WHERE widget_id = '" . $widget_id . "' LIMIT 1";
     query($sql);
     if (class_exists('module_group', false)) {
         module_group::delete_member($widget_id, 'widget');
     }
     foreach (module_job::get_jobs(array('widget_id' => $widget_id)) as $val) {
         module_job::delete_job($val['widget_id']);
     }
     module_note::note_delete("widget", $widget_id);
     module_extra::delete_extras('widget', 'widget_id', $widget_id);
 }