/**
  * Execute resubmit to snap
  * @return bool
  */
 public function execute()
 {
     $run_count = 0;
     $this->out("=> Running resubmit to snap for shipments run count {$run_count}", 1, Shell::VERBOSE);
     $snap = new Snap();
     if (empty($this->shipment_ids)) {
         $this->out('=> Failed, no shipment ids found.');
         return false;
     }
     for ($i = 0; $i <= $run_count; $i++) {
         $shipment_id = $this->shipment_ids[$i];
         $this->out("Run: {$i}");
         if (!empty($shipment_id)) {
             $results = $snap->reSubmitExistingShipment($shipment_id);
             if ($results['success']) {
                 $this->out("=> Success: re-submitted {$shipment_id} to snap");
             } else {
                 $this->out("=> Failed: to resubmit {$shipment_id}");
             }
         } else {
             return false;
         }
     }
     return true;
 }
Beispiel #2
0
<?php

session_start();
require_once "class.bean.Tools.php";
require_once "config_visible.php";
if ($_GET["action"] == "snap") {
    #echo "<span style='display:none'>";
    $url = $_POST["u"];
    if (strpos($url, "#") > 0) {
        $url = substr($url, 0, strlen($url) - 1);
    }
    if (strpos($url, "&") > 0) {
        $url = explode("&", $url);
        $url = $url[0];
    }
    $img_path = SNAP_DIR_PATH . $_SESSION["email"] . ".jpg";
    //echo $url;
    Snap::takeSnap($url, $img_path);
    #echo "</span>";
    echo "<img src='{$img_path}' alt='' style='width:95%;'>";
}
 /**
  * update_data 
  * 更新数据
  * @param mixed $data 
  * @access public
  * @return void
  */
 public function update_data($data)
 {
     require_once dirname(__FILE__) . '/rss/rss_parser.php';
     require_once dirname(__FILE__) . '/rss/snap.php';
     if (1 < count($data)) {
         //如果大于1,则是更新多个源的数据
         foreach ($data as $value) {
             $options = array("service" => $value['service'], 'username' => $value['username']);
             $snap = new Snap($options);
             $result[] = $this->_update($snap->update(), $value['id']);
         }
     } else {
         //如果小于1,则是更新单个的源数据
         $options = array("service" => $data[0]['service'], 'username' => $data[0]['username']);
         $snap = new Snap($options);
         $result = $this->_update($snap->update(), $data[0]['id']);
     }
     return $result;
 }
 public function testRatelinxBackorder()
 {
     $this->OrderShipmentMethod = ClassRegistry::init('OrderShipmentMethod');
     $this->OrderShipmentMethod->useDbConfig = 'test';
     $this->test_order = new TestOrder(['database' => 'test', 'presenter_id' => 1, 'user_id' => 1, 'country_id' => 1, 'warehouse' => 1, 'items' => [['qty' => 3, 'sku' => 'US-11101-02']], 'address' => $this->addresses['US']]);
     $order_id = $this->test_order->create_test_order();
     $this->Order->id = $order_id;
     $order = $this->Order->loadDisplayDetails();
     $shipment_id = $order['OrderShipment'][0]['id'];
     $this->OrderShipmentMethod->setOrderShipmentMethod($order_id);
     $result = $this->OrderShipment->processBackorderCartonization($shipment_id);
     $this->assertTrue($result);
     $snap = new Snap();
     $snap->createShipment($shipment_id);
     $this->assertEquals('Y - 9 x 6 x 3', $snap->snap_box['AttachmentText']);
     $this->assertEquals('O11', $snap->snap_ship_via['AttachmentText']);
 }
 public function test_accessors()
 {
     /** === Test Data === */
     $CUSTOMER_ID = 'cust id';
     $DATE = 'date';
     $DEPTH = 'depth';
     $PARENT_ID = 'parent id';
     $PATH = 'path';
     /** === Call and asserts  === */
     $this->obj->setCustomerId($CUSTOMER_ID);
     $this->obj->setDate($DATE);
     $this->obj->setDepth($DEPTH);
     $this->obj->setParentId($PARENT_ID);
     $this->obj->setPath($PATH);
     $this->assertEquals($CUSTOMER_ID, $this->obj->getCustomerId());
     $this->assertEquals($DATE, $this->obj->getDate());
     $this->assertEquals($DEPTH, $this->obj->getDepth());
     $this->assertEquals($PARENT_ID, $this->obj->getParentId());
     $this->assertEquals($PATH, $this->obj->getPath());
 }
Beispiel #6
0
<?php

echo "<span style='display:none'>";
require "class.bean.Tools.php";
try {
    $snap = new Snap();
} catch (Exception $e) {
    echo "" . $e->getMessage();
}
$url = $_GET["u"] . "?snap=sidebar-collapsed";
$img_name = $_GET["img_name"];
$snap->data = array("url" => $url, "img_name" => $img_name);
$snap->snap_go();
echo "</span>";
echo "<div id='snap_img'><img src='images/snap/{$img_name}.jpg' alt='' style='width:95%;'></div>";