Exemplo n.º 1
0
 /**
  * Get items
  *
  * @return array
  */
 protected function getItems()
 {
     if (!isset($this->importer)) {
         $this->importer = new \XLite\Logic\Import\Importer(isset($this->record['options']) ? $this->record['options'] : array());
     }
     return $this->importer->getStep();
 }
Exemplo n.º 2
0
 /**
  * Return current translation code
  *
  * @return string
  */
 protected function getTranslationCode()
 {
     $code = 'en';
     if (\XLite\Logic\Import\Importer::getLanguageCode()) {
         $code = \XLite\Logic\Import\Importer::getLanguageCode();
     } elseif (!\XLite::isCacheBuilding() && \XLite\Core\Session::getInstance()->getLanguage()) {
         $code = \XLite\Core\Session::getInstance()->getLanguage()->getCode();
     }
     return $code;
 }
Exemplo n.º 3
0
 /**
  * Return current translation code
  *
  * @param string $code Language code OPTIONAL
  *
  * @return string
  */
 protected function getTranslationCode($code = null)
 {
     if (!isset($code)) {
         if ($this->editLanguage) {
             $code = $this->editLanguage;
         } elseif (\XLite\Logic\Export\Generator::getLanguageCode()) {
             $code = \XLite\Logic\Export\Generator::getLanguageCode();
         } elseif (\XLite\Logic\Import\Importer::getLanguageCode()) {
             $code = \XLite\Logic\Import\Importer::getLanguageCode();
         } elseif (\XLite\Core\Translation::getTmpMailTranslationCode()) {
             $code = \XLite\Core\Translation::getTmpMailTranslationCode();
         } else {
             $code = $this->getSessionLanguageCode();
         }
     }
     return $code;
 }
Exemplo n.º 4
0
 /**
  * Get identifiers list for specified query builder object
  *
  * @param \Doctrine\ORM\QueryBuilder $qb    Query builder
  * @param string                     $name  Name
  * @param mixed                      $value Value
  *
  * @return void
  */
 protected function addImportCondition(\Doctrine\ORM\QueryBuilder $qb, $name, $value)
 {
     $alias = $qb->getMainAlias();
     if (property_exists($this->getClassMetadata()->name, $name)) {
         $qb->andWhere($alias . '.' . $name . ' = :' . $name);
     } elseif (property_exists($this->getClassMetadata()->name, 'translations')) {
         $qb->andWhere('translations.' . $name . ' = :' . $name);
         if (is_array($value)) {
             $value = $value[\XLite\Logic\Import\Importer::getLanguageCode()];
         }
     }
     $qb->setParameter($name, $value);
 }
Exemplo n.º 5
0
 /**
  * Get value for default language
  *
  * @param mixed $value Value
  *
  * @return mixed
  */
 protected function getDefLangValue($value)
 {
     $code = $this->importer->getLanguageCode();
     return is_array($value) ? isset($value[$code]) ? $value[$code] : null : trim($value);
 }
Exemplo n.º 6
0
 /**
  * Get import event name
  *
  * @return string
  */
 protected function getEventName()
 {
     return \XLite\Logic\Import\Importer::getEventName();
 }
Exemplo n.º 7
0
 /**
  * Get messages
  *
  * @return array
  */
 public function getMessages()
 {
     $list = parent::getMessages();
     $data = $this->getOptions()->columnsMetaData;
     if ($data) {
         foreach (\XLite\Logic\Import\Importer::getProcessorList() as $processor) {
             if (isset($data[$processor])) {
                 $message = $processor::getResultMessage($data[$processor]);
                 if ($message) {
                     $list[] = $message;
                 }
             }
         }
     }
     return $list;
 }
Exemplo n.º 8
0
 protected function processCommodityEligibility($files, $sftp)
 {
     $importer = new \XLite\Logic\Import\Importer(\XLite\Logic\Import\Importer::assembleImportOptions() + array('warningsAccepted' => true));
     $importer->deleteAllFiles();
     \XLite\Logic\Import\Importer::run(\XLite\Logic\Import\Importer::assembleImportOptions() + array('warningsAccepted' => true));
     $importDir = \XLite\Logic\Import\Importer::getImportDir();
     $filesToImport = array();
     foreach ($files as $filename => $info) {
         $downloaded = $sftp->get($filename, $importDir . LC_DS . $filename);
         if ($downloaded) {
             $sftp->delete($filename);
         }
     }
     \XLite\Logic\Import\Importer::runHeadless();
     \XLite\Logger::logCustom("PitneyBowes", 'Commodity-eligibility files were processed', false);
 }
Exemplo n.º 9
0
 /**
  * Get import user break flag name
  *
  * @return string
  */
 protected function getImportUserBreakFlagVarName()
 {
     return \XLite\Logic\Import\Importer::getImportUserBreakFlagVarName();
 }
Exemplo n.º 10
0
 /**
  * Get processor list
  *
  * @return array
  */
 public static function getProcessorList()
 {
     return array_merge(parent::getProcessorList(), array('XLite\\Module\\XC\\Reviews\\Logic\\Import\\Processor\\Reviews'));
 }
Exemplo n.º 11
0
 /**
  * Get processor list
  *
  * @return array
  */
 public static function getProcessorList()
 {
     return array_merge(parent::getProcessorList(), array('XLite\\Module\\XC\\PitneyBowes\\Logic\\Import\\Processor\\ProductRestrictions'));
 }
Exemplo n.º 12
0
 /**
  * Check - import process has warnings or not
  *
  * @return boolean
  */
 public function hasWarnings()
 {
     return $this->importer->hasWarnings();
 }
Exemplo n.º 13
0
 /**
  * Return error texts
  *
  * @return array 
  */
 protected function getErrorTexts()
 {
     $result = array();
     foreach (\XLite\Logic\Import\Importer::getProcessorList() as $processor) {
         $result = array_merge($result, $processor::getErrorTexts());
     }
     return $result;
 }