コード例 #1
0
 public function add_options($wpod)
 {
     $years = Util::get_years();
     $year_tabs = array();
     foreach ($years as $year) {
         $stats_manager = new Stats($year);
         $year_tabs['easy_customer_invoices_stats_' . $year] = array('title' => $year, 'description' => sprintf(__('Here you can find detailed stats about your business in %s.', 'easy-customer-invoices'), $year), 'callback' => array($stats_manager, 'output_stats'));
     }
     $wpod->add_components(array('easy_customer_invoices_menu' => array('label' => __('Invoice Manager', 'easy-customer-invoices'), 'icon' => 'dashicons-clipboard', 'screens' => array('easy_customer_invoices_stats' => array('title' => __('Stats', 'easy-customer-invoices'), 'label' => __('Stats', 'easy-customer-invoices'), 'position' => 40, 'tabs' => $year_tabs), 'easy_customer_invoices_options' => array('title' => __('Settings', 'easy-customer-invoices'), 'label' => __('Settings', 'easy-customer-invoices'), 'position' => 50, 'tabs' => array('easy_customer_invoices_vendor' => array('title' => __('Vendor Data', 'easy-customer-invoices'), 'description' => __('Here you should enter information about your own business or about yourself as a vendor.', 'easy-customer-invoices'), 'mode' => 'draggable', 'sections' => array('general' => array('title' => __('General Information', 'easy-customer-invoices'), 'description' => __('Here you can enter static information for your business that will likely never change.', 'easy-customer-invoices'), 'fields' => array('first_name' => array('title' => __('First Name', 'easy-customer-invoices'), 'type' => 'text', 'required' => true), 'last_name' => array('title' => __('Last Name', 'easy-customer-invoices'), 'type' => 'text', 'required' => true), 'company' => array('title' => __('Company Information', 'easy-customer-invoices'), 'type' => 'repeatable', 'repeatable' => array('fields' => array('name' => array('title' => __('Name', 'easy-customer-invoices'), 'type' => 'text'), 'logo' => array('title' => __('Logo', 'easy-customer-invoices'), 'type' => 'media'), 'valid_from' => array('title' => __('Valid from...', 'easy-customer-invoices'), 'type' => 'date')))))), 'details' => array('title' => __('Details', 'easy-customer-invoices'), 'description' => __('Specify more detailed information about your business. The following information may change from time to time - if it does, simply add a new row and fill in the information.', 'easy-customer-invoices'), 'fields' => array('address' => array('title' => __('Address', 'easy-customer-invoices'), 'type' => 'repeatable', 'repeatable' => array('fields' => array('street_no' => array('title' => __('Street & No.', 'easy-customer-invoices'), 'type' => 'text'), 'zip_code' => array('title' => __('ZIP Code', 'easy-customer-invoices'), 'type' => 'text'), 'city' => array('title' => __('City', 'easy-customer-invoices'), 'type' => 'text'), 'valid_from' => array('title' => __('Valid from...', 'easy-customer-invoices'), 'type' => 'date')))), 'contact' => array('title' => __('Contact Information', 'easy-customer-invoices'), 'type' => 'repeatable', 'repeatable' => array('fields' => array('phone' => array('title' => __('Phone', 'easy-customer-invoices'), 'type' => 'tel'), 'email' => array('title' => __('Email', 'easy-customer-invoices'), 'type' => 'email'), 'website' => array('title' => __('Website', 'easy-customer-invoices'), 'type' => 'url'), 'valid_from' => array('title' => __('Valid from...', 'easy-customer-invoices'), 'type' => 'date')))), 'bank_account' => array('title' => __('Bank Account', 'easy-customer-invoices'), 'type' => 'repeatable', 'repeatable' => array('fields' => array('account_number' => array('title' => __('Account Number', 'easy-customer-invoices'), 'type' => 'text'), 'bank_code' => array('title' => __('Bank Code', 'easy-customer-invoices'), 'type' => 'text'), 'bank_name' => array('title' => __('Bank Name', 'easy-customer-invoices'), 'type' => 'text'), 'iban' => array('title' => __('IBAN', 'easy-customer-invoices'), 'type' => 'text'), 'bic' => array('title' => __('BIC (SWIFT)', 'easy-customer-invoices'), 'type' => 'text'), 'valid_from' => array('title' => __('Valid from...', 'easy-customer-invoices'), 'type' => 'date')))), 'legal' => array('title' => __('Legal Data', 'easy-customer-invoices'), 'type' => 'repeatable', 'repeatable' => array('fields' => array('tax_number' => array('title' => __('Tax Number', 'easy-customer-invoices'), 'type' => 'text'), 'tax_id' => array('title' => __('Tax ID', 'easy-customer-invoices'), 'type' => 'text'), 'tax_authority' => array('title' => __('Tax Authority', 'easy-customer-invoices'), 'type' => 'text'), 'valid_from' => array('title' => __('Valid from...', 'easy-customer-invoices'), 'type' => 'date')))))))), 'easy_customer_invoices_data' => array('title' => __('Options', 'easy-customer-invoices'), 'description' => __('Here you can adjust some plugin settings.', 'easy-customer-invoices'), 'mode' => 'draggable', 'sections' => array('general' => array('title' => __('General', 'easy-customer-invoices'), 'description' => __('Define general settings for the overall behavior.', 'easy-customer-invoices'), 'fields' => array('reference_prefix' => array('title' => __('Reference Prefix', 'easy-customer-invoices'), 'type' => 'text'), 'base_currency' => array('title' => __('Base Currency', 'easy-customer-invoices'), 'type' => 'select', 'options' => Util::get_currencies()), 'default_tax_mode' => array('title' => __('Default Tax Mode', 'easy-customer-invoices'), 'type' => 'select', 'options' => Util::get_tax_modes()), 'default_payment_method' => array('title' => __('Default Payment Method', 'easy-customer-invoices'), 'type' => 'select', 'options' => Util::get_payment_methods()), 'tax_amount' => array('title' => __('Tax Amount (in %)', 'easy-customer-invoices'), 'type' => 'number', 'step' => 1))), 'colors' => array('title' => __('Invoice PDF Colors', 'easy-customer-invoices'), 'description' => __('Specify the colors for the PDF invoices.', 'easy-customer-invoices'), 'fields' => array('text_color' => array('title' => __('Text Color', 'easy-customer-invoices'), 'type' => 'color', 'default' => '#000000'), 'fill_color' => array('title' => __('Fill Color', 'easy-customer-invoices'), 'type' => 'color', 'default' => '#dddddd')))))))))), 'easy-customer-invoices');
 }
コード例 #2
0
 public function get_currency($mode = 'slug')
 {
     $customer = $this->get_customer();
     if (!$customer) {
         $currency = Util::get_base_currency();
         if ('slug' === $mode) {
             return $currency;
         }
         $currencies = Util::get_currencies($mode);
         return $currencies[$currency];
     }
     return $customer->get_currency($mode);
 }
コード例 #3
0
 public function get_currency($mode = 'slug')
 {
     $currency = Util::get_base_currency();
     $country = $this->get_country();
     if ($country) {
         $currency = $country->get_meta('currency');
     }
     if ('slug' === $mode) {
         return $currency;
     }
     $currencies = Util::get_currencies($mode);
     return $currencies[$currency];
 }