function autoProcessNewReport() { global $wpdb; $table = $wpdb->prefix . self::TABLENAME; if (!$this->id) { return; } // skip empty reports if ($this->ReportProcessingStatus == '_DONE_NO_DATA_') { $wpdb->update($table, array('success' => 'empty'), array('id' => $this->id)); return; } if ($this->ReportProcessingStatus == '_CANCELLED_') { $wpdb->update($table, array('success' => 'empty'), array('id' => $this->id)); return; } // _GET_AFN_INVENTORY_DATA_ if ($this->ReportType == '_GET_AFN_INVENTORY_DATA_') { $rows = $this->get_data_rows(); WPLA_ImportHelper::processFBAReportPage($this, $rows, null, null); $wpdb->update($table, array('success' => 'yes'), array('id' => $this->id)); return; } // inventory report - only process if daily report option is enabled // _GET_MERCHANT_LISTINGS_DATA_ if ($this->ReportType == '_GET_MERCHANT_LISTINGS_DATA_') { if (get_option('wpla_autofetch_inventory_report') != 1) { return; } $rows = $this->get_data_rows(); WPLA_ImportHelper::processInventoryReportPage($this, $rows, null, null); $wpdb->update($table, array('success' => 'yes'), array('id' => $this->id)); return; } // FBA shipping report - only process if multichannel fulfillment is enabled // _GET_AMAZON_FULFILLED_SHIPMENTS_DATA_ if ($this->ReportType == '_GET_AMAZON_FULFILLED_SHIPMENTS_DATA_') { if (get_option('wpla_fba_autosubmit_orders') != 1) { return; } $rows = $this->get_data_rows(); WPLA_ReportProcessor::processAmazonShipmentsReportPage($this, $rows, null, null); $wpdb->update($table, array('success' => 'yes'), array('id' => $this->id)); return; } // _GET_MERCHANT_LISTINGS_DEFECT_DATA_ if ($this->ReportType == '_GET_MERCHANT_LISTINGS_DEFECT_DATA_') { $rows = $this->get_data_rows(); WPLA_ImportHelper::processQualityReportPage($this, $rows, null, null); $wpdb->update($table, array('success' => 'yes'), array('id' => $this->id)); return; } }
public function processFbaShipmentReportData($id) { $report = new WPLA_AmazonReport($id); $rows = $report->get_data_rows(); $result = WPLA_ReportProcessor::processAmazonShipmentsReportPage($report, $rows, null, null); $this->showMessage(sprintf(__('Report was processed - %s orders were updated.', 'wpla'), $result->count)); }