Skip to content
Code-Schnipsel Gruppen Projekte
Commit 2f86c4a1 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: extend QUI\ERP\Accounting\Article with getImage method for order#14

Übergeordneter aba52da0
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -203,6 +203,51 @@ public function getTitle()
return '';
}
/**
* Return the article image
*
* @return null|QUI\Projects\Media\Image
*/
public function getImage()
{
if (isset($this->attributes['image'])) {
try {
return QUI\Projects\Media\Utils::getImageByUrl(
$this->attributes['image']
);
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
}
}
$Product = null;
try {
$Product = QUI\ERP\Products\Handler\Products::getProductByProductNo(
$this->getArticleNo()
);
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
}
if (!empty($Product)) {
try {
return $Product->getImage();
} catch (QUI\Exception $Exception) {
}
}
try {
$Project = QUI::getRewrite()->getProject();
return $Project->getMedia()->getPlaceholderImage();
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
}
return null;
}
/**
* Returns the article description
*
......
......@@ -15,7 +15,7 @@
*
* @package QUI\ERP\Accounting
*/
class ArticleListUnique
class ArticleListUnique implements \IteratorAggregate
{
/**
* @var array
......@@ -296,4 +296,18 @@ public function getPriceFactors()
}
//endregion
//region iterator
/**
* Iterator helper
*
* @return \ArrayIterator|\Traversable
*/
public function getIterator()
{
return new \ArrayIterator($this->articles);
}
//endregion
}
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren