Changeset 2414415
- Timestamp:
- 11/07/2020 10:43:39 AM (5 years ago)
- Location:
- apollo/trunk
- Files:
-
- 5 edited
-
apollo.php (modified) (2 diffs)
-
includes/admin/invoice.php (modified) (7 diffs)
-
includes/admin/settings/general.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
-
vendor/spaceinvoices/vendor/space-invoices/space-invoices-php/lib/Organizations.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
apollo/trunk/apollo.php
r2402661 r2414415 4 4 * Plugin URI: https://wordpress.org/plugins/apollo 5 5 * Description: Manually or automatically generate invoices and send PDFs as attachments for WooCommerce orders. 6 * Version: 1.1.1 16 * Version: 1.1.12 7 7 * Author: Studio404 8 8 * Text Domain: apollo 9 9 * Domain Path: /languages 10 * WC tested up to: 4. 1.110 * WC tested up to: 4.6.2 11 11 * WC requires at least: 3.0 12 12 */ … … 14 14 defined( 'ABSPATH' ) or exit; 15 15 16 define( 'APOLLO_VERSION', '1.1.1 1' );16 define( 'APOLLO_VERSION', '1.1.12' ); 17 17 18 18 function apollo_load_plugin() { -
apollo/trunk/includes/admin/invoice.php
r2397152 r2414415 38 38 $premise = $output['apollo_premise-id']; 39 39 $device = $output['apollo_device-id']; 40 41 $unitID = $output['apollo_unit-id'] ?? ''; 40 42 41 43 if (!$order || !$output || !$token || !$organization_id) { … … 94 96 95 97 $sku = $productData->get_sku(); 96 // error_log( print_r($sku, TRUE) );97 98 98 99 // add SKU code if item has one … … 108 109 // if numbers don't match, we assume item was discounted (since there is no way of telling otherwise... atleast for now?) 109 110 if (floatval($product['total']) < floatval($product['subtotal'])) { 110 $product_data['discount'] = round((1 - (floatval($product['total']) / floatval($product['subtotal']))) * 100);111 $product_data['discount'] = (1 - (floatval($product['total']) / floatval($product['subtotal']))) * 100; 111 112 $product_data['price'] = floatval($product['subtotal']) / $product['quantity']; 112 113 } … … 131 132 132 133 if($tax_amount > 0) { 133 $taxes = $item_ data->get_taxes();134 $taxes = $item_shipping->get_taxes(); 134 135 $tax_rate_id = key($taxes['subtotal']) ?? false; 135 136 $tax_rate_percentage = $tax_items_rates[$tax_rate_id] ?? false; … … 157 158 $tax_amount = floatval($fee['total_tax']); 158 159 159 $tax_percent = ($tax_amount / $without_tax) * 100; 160 $tax_percent = 0; 161 162 if($tax_amount > 0) { 163 $taxes = $item_fee->get_taxes(); 164 $tax_rate_id = key($taxes['subtotal']) ?? false; 165 $tax_rate_percentage = $tax_items_rates[$tax_rate_id] ?? false; 166 167 $tax_percent = $tax_rate_percentage ?? ($tax_amount / $without_tax) * 100; 168 } 160 169 161 170 $unit = 'fee'; … … 197 206 "expectedTotalWithTax" => $order->get_total() 198 207 ); 208 209 if($unitID != '') { 210 $order_data['unitId'] = $unitID; 211 } 212 199 213 // if fiscalization is enabled and we making invoice, add the fiscalization data 200 214 if ($fiscalization && $type === 'invoice') { … … 405 419 return Spaceinvoices\Organizations::GetById($organization_id); 406 420 } 421 422 public static function getUnits() { 423 $output = get_option('apollo_general_settings'); 424 $token = $output['apollo_token']; 425 $organization_id = $output['apollo_organization-id']; 426 427 Spaceinvoices\Spaceinvoices::setAccessToken($token); 428 429 $units = ["" => "Brez"]; 430 431 $apolloUnits = Spaceinvoices\Organizations::getUnits($organization_id); 432 433 foreach($apolloUnits as $apolloUnit) { 434 $units[$apolloUnit->id] = $apolloUnit->name; 435 } 436 437 return $units; 438 } 407 439 } 408 440 } -
apollo/trunk/includes/admin/settings/general.php
r2357549 r2414415 58 58 $premises_data['premises'] = array(); 59 59 $premises_data['devices'] = array(); 60 $units = Apollo_invoice::getUnits(); 60 61 61 62 $output = get_option('apollo_general_settings'); 62 $token = $output['apollo_token'];63 $token = $output['apollo_token']; 63 64 $organization_id = $output['apollo_organization-id']; 64 65 … … 98 99 // these are inputis inside sections 99 100 $settings = array( 100 array(101 'id' => 'apollo-token', // filed id102 'name' => $this->prefix . 'token', // name attribute103 'title' => __( 'Apollo token', 'apollo-invoices' ), // text that shows left from input104 'callback' => array( $this, 'input_callback' ), // callback to main-settings.php, input type depends on callback105 'page' => $this->settings_key,106 'section' => 'token', // one of the sections we defined on top107 'type' => 'text', // input type108 'desc' => '', // text that shows below the input109 'default' => '', // default value110 ),111 array(101 array( 102 'id' => 'apollo-token', // filed id 103 'name' => $this->prefix . 'token', // name attribute 104 'title' => __( 'Apollo token', 'apollo-invoices' ), // text that shows left from input 105 'callback' => array( $this, 'input_callback' ), // callback to main-settings.php, input type depends on callback 106 'page' => $this->settings_key, 107 'section' => 'token', // one of the sections we defined on top 108 'type' => 'text', // input type 109 'desc' => '', // text that shows below the input 110 'default' => '', // default value 111 ), 112 array( 112 113 'id' => 'apollo-organization-id', 113 114 'name' => $this->prefix . 'organization-id', … … 119 120 'desc' => '', 120 121 'default' => '', 122 ), 123 array( 124 'id' => 'apollo-unit-id', 125 'name' => $this->prefix . 'unit-id', 126 'title' => __( 'Unit', 'apollo-invoices' ), 127 'callback' => array( $this, 'select_callback' ), 128 'page' => $this->settings_key, 129 'section' => 'token', 130 'type' => 'select', 131 'desc' => '<div class="apollo-notes">' . __( 'Edit your units on the Apollo webpage.', 'apollo-invoices' ) . '</div>', 132 'options' => !empty($units) ? $units : array(), 133 'default' => '', 134 'class' => !$valid_org ? 'hidden' : '', 121 135 ), 122 136 array( -
apollo/trunk/readme.txt
r2397152 r2414415 85 85 86 86 == Changelog == 87 = 1.1.12 - November 7, 2020 = 88 89 - Fixed: Cupon price calculating 90 - Added: Organization units setting 91 87 92 = 1.1.11 - October 10, 2020 = 88 93 -
apollo/trunk/vendor/spaceinvoices/vendor/space-invoices/space-invoices-php/lib/Organizations.php
r2073222 r2414415 36 36 } 37 37 38 /** 39 * @param string $organizationId ID of Organization 40 * 41 * @return object Returns list of units 42 */ 43 public static function getUnits($organizationId) { 44 return parent::_GET("/".static::path."/".$organizationId."/units")->body; 45 } 46 38 47 } 39 48 ?>
Note: See TracChangeset
for help on using the changeset viewer.