function action_feedback() { $id = $_REQUEST['xebayuser_id']; if (empty($id)) { return; } $user = BeanFactory::getBean('xeBayUsers', $id); if (!empty($user)) { require_once 'eBayApi/GetFeedback.php'; $bean = BeanFactory::getBean('xeBayAccounts'); $accounts = $bean->get_accounts('All'); $api = new GetFeedback(); $res = $api->dumpUserFeedback(array('UserID' => $user->name, 'AuthToken' => current($accounts))); } sugar_cleanup(true); }
function process() { $api = new GetFeedback(); foreach ($this->accounts as $id => $authToken) { $result = $api->retrieveFeedback(array('AuthToken' => $authToken)); } $bean = BeanFactory::getBean('xeBayOrders'); $shippedTime30Days = date('Y-m-d H:i:s', strtotime($GLOBALS['timedate']->nowDb() . ' -30 days')); $where = "handled_status='handled' AND shipped_time>'{$shippedTime30Days}' AND feedback_received='0'"; $beans = $bean->get_full_list("", $where); if ($beans !== null) { foreach ($beans as &$bean) { $shipped_time = strtotime($bean->shipped_time); $current_time = strtotime($GLOBALS['timedate']->nowDb()); $diff_time = intval(($current_time - $shipped_time) / 3600 / 24); if ($diff_time > 22) { if ($bean->buyer_comfort_status != '25th Day') { $this->send_comfort_message($bean, '25th Day', $diff_time); $this->lessThan30Days[] = $bean->sales_record_number; } } else { if ($diff_time > 15) { if ($bean->buyer_comfort_status != '15th Day') { $this->send_comfort_message($bean, '15th Day', $diff_time); $this->lessThan25Days[] = $bean->sales_record_number; } } else { if ($diff_time > 7) { if ($bean->buyer_comfort_status != '7th Day') { $this->send_comfort_message($bean, '7th Day', $diff_time); $this->lessThan15Days[] = $bean->sales_record_number; } } else { $this->lessThan7Days[] = $bean->sales_record_number; } } } } } parent::process(); }