/**
  * @param \Bjr\BjrLend\Domain\Model\Article $article
  * @param $period
  * @return array|null|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  *
  */
 public function checkPeriodForArticle(\Bjr\BjrLend\Domain\Model\Article $article, $period)
 {
     $querySettings = $this->createQuery()->getQuerySettings();
     $querySettings->setStoragePageIds(array($article->getPid()));
     $this->setDefaultQuerySettings($querySettings);
     $query = $this->createQuery();
     $constraints = array();
     foreach ($period as $date) {
         $tempConstraints = array();
         $tempConstraints[] = $query->equals('article', $article->getUid());
         $tempConstraints[] = $query->lessThanOrEqual('issueStart', $date);
         $tempConstraints[] = $query->greaterThanOrEqual('issueEnd', $date);
         $constraints[] = $query->logicalAnd($tempConstraints);
     }
     if (count($constraints) > 0) {
         $query->matching($query->logicalOr($constraints));
         $result = $query->execute();
     } else {
         $result = NULL;
     }
     return $result;
 }
 /**
  * @param \Bjr\BjrLend\Domain\Model\Article $item
  * Initialisiert Position mit Artikeldaten
  */
 public function initializeFrom(\Bjr\BjrLend\Domain\Model\Article $item)
 {
     $this->setArticleTitle($item->getTitle());
     $this->setArticleFee($item->getFee());
     $this->setLendConditions($item->getLendConditions());
     $this->setOrganizationName($item->getOrganization()->getName());
     if (is_object($item->getOrganization()->getAddress())) {
         $this->setOrganizationStreet($item->getOrganization()->getAddress()->getStreet());
         $this->setOrganizationZip($item->getOrganization()->getAddress()->getZip());
         $this->setOrganizationCity($item->getOrganization()->getAddress()->getCity());
         $this->setOrganizationPhone($item->getOrganization()->getAddress()->getPhone());
         $this->setOrganizationEmail($item->getOrganization()->getAddress()->getEmail());
     }
     $this->setArticle($item);
 }
 /**
  * @test
  */
 public function setImageForStringSetsImage()
 {
     $this->fixture->setImage('Conceived at T3CON10');
     $this->assertSame('Conceived at T3CON10', $this->fixture->getImage());
 }
 /**
  * Save an image with FAL
  * @param \TYPO3\CMS\Core\Resource\File $fileObject
  * @param \Bjr\BjrLend\Domain\Model\Article $article
  * @param $pid
  * @return int last insert id
  *
  */
 public function saveImage(\TYPO3\CMS\Core\Resource\File $fileObject, \Bjr\BjrLend\Domain\Model\Article $article)
 {
     //$dateiname = $filename; // Dateinamen auslesen
     $tabellenName = 'tx_bjrlend_domain_model_article';
     $feldName = 'image';
     $data = array('uid_local' => $fileObject->getUid(), 'uid_foreign' => $article->getUid(), 'tablenames' => $tabellenName, 'fieldname' => $feldName, 'pid' => $article->getPid(), 'table_local' => 'sys_file', 'tstamp' => time(), 'crdate' => time(), 'cruser_id' => 100);
     $where = 'deleted ="0" AND hidden ="0" AND tablenames ="' . $tabellenName . '" AND uid_foreign=' . (int) $article->getUid() . ' AND table_local="sys_file"' . ' AND fieldname ="' . $feldName . '"';
     $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file_reference', $where);
     if (empty($row)) {
         $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $data, FALSE);
         $res = $GLOBALS['TYPO3_DB']->sql_insert_id();
     } else {
         $data = array('uid_local' => $fileObject->getUid(), 'tstamp' => time(), 'cruser_id' => 100);
         $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_file_reference', $where, $data, FALSE);
     }
     return $res;
 }
Example #5
0
 /**
  * @param Article $article
  */
 public function removeArticle(\Bjr\BjrLend\Domain\Model\Article $article)
 {
     foreach ($this->items as $item) {
         /* @var $item BasketItem */
         if ($item->getArticleUid() == $article->getUid()) {
             $this->removeItem($item);
         }
     }
 }
 /**
  * @param Article $article
  * Initialisiert Item mit Artikeldaten
  */
 protected function initializeFrom(\Bjr\BjrLend\Domain\Model\Article $article)
 {
     $this->setArticleUid($article->getUid());
     $this->setTitle($article->getTitle());
     $this->setDescription($article->getDescription());
     $this->setShortDescription($article->getShortDescription());
     $this->setFee($article->getFee());
     $this->setOrganization($article->getOrganization());
     $this->setCategory($article->getCategory());
     //$this->setImage($article->getImage());
     $this->setImage($article->getUrlForImage());
     $this->setEmail($article->getEmail());
     $this->setPhone($article->getPhone());
     $this->setLendConditions($article->getLendConditions());
 }
 /**
  * @param \Bjr\BjrLend\Domain\Model\Article $article
  * @return \Bjr\BjrLend\Domain\Model\Organization
  */
 public function findByArticle(\Bjr\BjrLend\Domain\Model\Article $article)
 {
     $query = $this->createQuery();
     $organization = $query->matching($query->equals('articleFolderPid', $article->getPid()))->execute()->getFirst();
     return $organization;
 }