Plugin Directory

Changeset 2054619


Ignore:
Timestamp:
03/21/2019 02:28:17 PM (7 years ago)
Author:
jank404
Message:

Upgrade to 1.0.2

Location:
apollo
Files:
104 added
5 edited

Legend:

Unmodified
Added
Removed
  • apollo/trunk/apollo.php

    r2020670 r2054619  
    44 * Plugin URI:        https://wordpress.org/plugins/apollo
    55 * Description:       Manually or automatically generate invoices and send PDFs as attachments for WooCommerce orders.
    6  * Version:           1.0.1
     6 * Version:           1.0.2
    77 * Author:            Studio404
    88 * Text Domain:       apollo
     
    1212defined( 'ABSPATH' ) or exit;
    1313
    14 define( 'APOLLO_VERSION', '1.0.1' );
     14define( 'APOLLO_VERSION', '1.0.2' );
    1515
    1616function apollo_load_plugin() {
  • apollo/trunk/includes/admin/invoice.php

    r2020650 r2054619  
    1111
    1212      if ($type === 'invoice' && $invoice_exsists) {
     13          $invoice_exsists['exsists'] = true;
    1314          return $invoice_exsists;
    1415      } else if ($type === 'estimate' && $estimate_exsists) {
     16          $estimate_exsists['exsists'] = true;
    1517          return $estimate_exsists;
    1618      }
     
    118120
    119121      $create = Spaceinvoices\Documents::create($organization_id, $order_data);
     122      if(isset($create->error)) {
     123        return array("error" => "Apollo error (".$create->error->statusCode."): ".$create->error->text);
     124      }
    120125      $document_id = $create->id;
    121126      $document_number = $create->number;
  • apollo/trunk/includes/admin/settings/main-settings.php

    r2013244 r2054619  
    7070                ?>
    7171            </h2>
    72             <form method="post" action="options.php" enctype="multipart/form-data" <?php echo $width; ?>>
     72            <form method="post" action="options.php" enctype="multipart/form-data">
    7373                <?php
    7474                settings_fields( $current_tab );
  • apollo/trunk/includes/apollo.php

    r2013244 r2054619  
    1717
    1818    private function __construct() {
     19            $this->errorMsg = "Apollo error";
     20            $this->successMsg = "Apollo success";
    1921
    2022            // check if user admin
     
    2729            add_filter( 'plugin_action_links_' . plugin_basename( APOLLO_FILE ), array($this,'add_action_links') );
    2830
     31            Apollo_Main_Settings::init_hooks();
     32
     33            add_action( 'add_meta_boxes', array( $this, 'add_apollo_boxes' ) );
     34            add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
     35            add_action( 'admin_init', array( $this, 'admin_pdf_callback' ) );
     36            add_action( 'admin_enqueue_scripts', array( $this, 'my_admin_scripts' ) );
     37
     38        }
     39
     40        public function my_admin_scripts() {
    2941            //css
    3042            wp_register_style( 'apollo_settings_css', APOLLO_URL . '/admin/css/custom.css');
     
    3446            wp_register_script( 'apollo_settings_js', APOLLO_URL . '/admin/js/custom.js' );
    3547            wp_enqueue_script( 'apollo_settings_js' );
    36 
    37             Apollo_Main_Settings::init_hooks();
    38 
    39             add_action( 'add_meta_boxes', array( $this, 'add_apollo_boxes' ) );
    40             add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
    41             add_action( 'admin_init', array( $this, 'admin_pdf_callback' ) );
    42 
    43         }
     48        }
     49
    4450
    4551        public function admin_pdf_callback() {
     
    5561                    wp_die( 'Invalid request.' );
    5662                }
    57                 Apollo_invoice::create($order_id, $type);
     63                $callback = Apollo_invoice::create($order_id, $type);
     64                if (isset($callback['error'])) {
     65                    $this->errorMsg = $callback['error'];
     66                    add_action( 'admin_notices', array( $this, 'apollo_error_notice' ));
     67                } else if (!isset($callback['exsists'])) {
     68                    $this->successMsg = "Successfully created Apollo $type.";
     69                    add_action( 'admin_notices', array( $this, 'apollo_success_notice' ));
     70                }
    5871
    5972            } else if ($action === 'pdf' && $apollo_document_id) {
     
    6780        }
    6881
     82        function apollo_error_notice() {
     83            ?>
     84            <div class="notice notice-error is-dismissible">
     85                    <p><?= $this->errorMsg ?></p>
     86            </div>
     87            <?php
     88        }
     89
     90        function apollo_success_notice() {
     91            ?>
     92            <div class="notice notice-success is-dismissible">
     93                    <p><?= $this->successMsg ?></p>
     94            </div>
     95            <?php
     96        }
     97
    6998        function add_apollo_boxes() {
    70             add_meta_box( 'apollo_invoice', __( 'Apollo - invoice', 'apollo-invoices' ), array( $this, 'display_apollo_invoice_box' ), 'shop_order', 'normal', 'high' );
    7199            add_meta_box( 'apollo_estimate', __( 'Apollo - estimate', 'apollo-invoices' ), array( $this, 'display_apollo_estimate_box' ), 'shop_order', 'side', 'high' );
     100            add_meta_box( 'apollo_invoice', __( 'Apollo - invoice', 'apollo-invoices' ), array( $this, 'display_apollo_invoice_box' ), 'shop_order', 'side', 'high' );
    72101    }
    73102
  • apollo/trunk/readme.txt

    r2020670 r2054619  
    44Requires at least: 4.9
    55Stable tag: trunk
    6 Tested up to: 5.0.3
     6Tested up to: 5.1.1
    77
    88== Description ==
     
    4141### How To Use
    4242For the extension to work, you will need to provide the Apollo token and the Apollo organization ID. You can find those on our [Apollo page](https://getapollo.io), under extensions tab.
     43
     44### Errors
     45- If you get Apollo error 401 when creating documents, it is most likely that Apollo token or Organization ID are set incorrectly in Apollo settings.
    4346
    4447Apollo is proudly powered by the [Space invoices API](https://spaceinvoices.com/). For further information on extension implementation, please feel free to check out our Space invoices API PHP documentation](https://docs.spaceinvoices.com/?php) for developers.
     
    8083== Changelog ==
    8184
     85= 1.0.2 - March 21, 2019 =
     86
     87- Fixed: JS and CSS script adding error
     88- Added: Extra error handling
     89- Show some extra details when error occurs
     90- Minor bug fixes
     91
    8292= 1.0.1 - January 28, 2019 =
    8393
Note: See TracChangeset for help on using the changeset viewer.