示例#1
0
 protected function getDatas($offset, $nb_results)
 {
     $logs = EbayOrderLog::get($offset, $nb_results);
     foreach ($logs as &$log) {
         $log['data'] = nl2br(TotFormat::prettyPrint($log['data']));
     }
     return $logs;
 }
示例#2
0
 public function __construct($id = null, $id_lang = null, $id_shop = null)
 {
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         self::$definition = array('table' => 'ebay_order_log', 'primary' => 'id_ebay_order_log', 'fields' => array('id_ebay_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'id_ebay_order' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'id_orders' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'type' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'success' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'data' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_update' => array('type' => self::TYPE_DATE, 'validate' => 'isDate')));
     } else {
         $tables = array('ebay_order_log');
         $fieldsRequired = array('id_ebay_profile', 'type', 'success', 'data_add');
         $fieldsValidate = array();
     }
     $this->date_add = date('Y-m-d H:i:s');
     return parent::__construct($id, $id_lang, $id_shop);
 }
示例#3
0
 function getContent()
 {
     // Load prestashop ebay's configuration
     $configs = Configuration::getMultiple(array('EBAY_SECURITY_TOKEN'));
     return $this->display('order_logs.tpl', array('nb_logs' => EbayOrderLog::count(), 'configs' => $configs, 'api_not_configured' => !Configuration::get('EBAY_API_LOGS')));
 }
示例#4
0
 private function _cleanLogs()
 {
     $config = Configuration::getMultiple(array('EBAY_LOGS_LAST_CLEANUP', 'EBAY_LOGS_DAYS', 'EBAY_API_LOGS', 'EBAY_ACTIVATE_LOGS'));
     if (isset($config['EBAY_LOGS_LAST_CLEANUP']) && $config['EBAY_LOGS_LAST_CLEANUP'] >= date('Y-m-d\\TH:i:s', strtotime('-1 day')) . '.000Z') {
         return;
     }
     $has_cleaned_logs = false;
     if (isset($config['EBAY_API_LOGS']) && $config['EBAY_API_LOGS']) {
         EbayApiLog::cleanOlderThan($config['EBAY_LOGS_DAYS']);
         $has_cleaned_logs = true;
     }
     if (isset($config['EBAY_ACTIVATE_LOGS']) && $config['EBAY_ACTIVATE_LOGS']) {
         EbayOrderLog::cleanOlderThan($config['EBAY_LOGS_DAYS']);
         $has_cleaned_logs = true;
     }
     if ($has_cleaned_logs) {
         Configuration::updateValue('EBAY_LOGS_LAST_CLEANUP', true, false, 0, 0);
     }
 }
示例#5
0
 private function _writeLog($id_ebay_profile, $type, $success, $response = null, $is_update = false)
 {
     if (!$this->write_logs) {
         return;
     }
     $log = new EbayOrderLog();
     $log->id_ebay_profile = (int) $id_ebay_profile;
     $log->id_ebay_order = (int) $this->id_ebay_order;
     $log->id_orders = implode(';', $this->id_orders);
     $log->type = (string) $type;
     $log->success = (bool) $success;
     if ($response) {
         $log->response = $response;
     }
     if ($is_update) {
         $log->date_update = date('Y-m-d H:i:s');
     }
     $log->save();
 }