diff --git a/app/code/community/Pimgento/Api/Model/Job/Abstract.php b/app/code/community/Pimgento/Api/Model/Job/Abstract.php index b9db2ac..ec27b69 100644 --- a/app/code/community/Pimgento/Api/Model/Job/Abstract.php +++ b/app/code/community/Pimgento/Api/Model/Job/Abstract.php @@ -211,4 +211,25 @@ public function cleanCache($task) $this->getHelper()->__('Cache cleaned: %s', $cacheTypeList) ); } + + /** + * Check if all locales labels exists + * + * @param string[] $entity + * @param string[] $lang + * @param string $response + * + * @return string + */ + public function checkLabelPerLocales(array $entity, array $lang, $response) + { + /** @var string[] $labels */ + $labels = $entity['labels']; + foreach ($lang as $locale => $stores) { + if (empty($labels[$locale])) { + $response .= $this->getHelper()->__("Label for '%1' in %2 is missing. ", $entity['code'], $locale); + } + } + return $response; + } } diff --git a/app/code/community/Pimgento/Api/Model/Job/Category.php b/app/code/community/Pimgento/Api/Model/Job/Category.php index 9433d12..983af93 100755 --- a/app/code/community/Pimgento/Api/Model/Job/Category.php +++ b/app/code/community/Pimgento/Api/Model/Job/Category.php @@ -106,12 +106,20 @@ public function insertData($task) $entitiesHelper = Mage::helper('pimgento_api/entities'); /** @var Pimgento_Api_Model_Resource_Entities $resourceEntities */ $resourceEntities = $this->getResourceEntities(); + /** @var string $warning */ + $warning = ''; + /** @var Pimgento_Api_Helper_Store $storeHelper */ + $storeHelper = Mage::helper('pimgento_api/store'); /** * @var int $index * @var mixed[] $category */ foreach ($categories as $index => $category) { + /** @var string[] $lang */ + $lang = $storeHelper->getStores('lang'); + /** @var string $checkLabels */ + $warning = $this->checkLabelPerLocales($category, $lang, $warning); /** @var string[] $columns */ $columns = $entitiesHelper->getColumnsFromResult($category); /** @var bool $result */ @@ -125,7 +133,7 @@ public function insertData($task) } $index++; - $task->setStepMessage($this->getHelper()->__('%d line(s) found', $index)); + $task->setStepMessage($this->getHelper()-> __('%d line(s) found. %s', $index, $warning)); } /** diff --git a/app/code/community/Pimgento/Api/Model/Job/Family.php b/app/code/community/Pimgento/Api/Model/Job/Family.php index 12fb2da..0adf6aa 100644 --- a/app/code/community/Pimgento/Api/Model/Job/Family.php +++ b/app/code/community/Pimgento/Api/Model/Job/Family.php @@ -79,11 +79,19 @@ public function insertData($task) $entitiesHelper = Mage::helper('pimgento_api/entities'); /** @var Pimgento_Api_Model_Resource_Entities $resourceEntities */ $resourceEntities = $this->getResourceEntities(); + /** @var string $warning */ + $warning = ''; + /** @var Pimgento_Api_Helper_Store $storeHelper */ + $storeHelper = Mage::helper('pimgento_api/store'); /** * @var int $index * @var mixed[] $family */ foreach ($familyItems as $index => $family) { + /** @var string[] $lang */ + $lang = $storeHelper->getStores('lang'); + /** @var string $checkLabels */ + $warning = $this->checkLabelPerLocales($family, $lang, $warning); /** @var string[] $columns */ $columns = $entitiesHelper->getColumnsFromResult($family); /** @var bool $result */ @@ -97,7 +105,7 @@ public function insertData($task) } $index++; - $task->setStepMessage($this->getHelper()->__('%d line(s) found', $index)); + $task->setStepMessage($this->getHelper()->__('%d line(s) found. %s', $index, $warning)); } /** diff --git a/app/locale/de_DE/Pimgento_Api.csv b/app/locale/de_DE/Pimgento_Api.csv index a2f0b0b..2f9bd6c 100755 --- a/app/locale/de_DE/Pimgento_Api.csv +++ b/app/locale/de_DE/Pimgento_Api.csv @@ -140,6 +140,7 @@ "Pimgento_Api::Include new categories in menu","Begriffen in Menü" "Pimgento_Api::Init default groups","Standardgruppen einrichten" "Pimgento_Api::Init stock","Init-Bestand" +"Pimgento_Api::Label for '%1' in %2 is missing. ","Beschriftung für '%1' in %2 fehlt. " "Pimgento_Api::Link configurable with children","Link mit Kindern konfigurierbar" "Pimgento_Api::Lower or equals than on all locales","Niedriger oder gleich als in allen Gebietsschemata" "Pimgento_Api::Lower or equals than","Niedriger oder gleich als" diff --git a/app/locale/en_US/Pimgento_Api.csv b/app/locale/en_US/Pimgento_Api.csv index 0631c78..5d21a5f 100755 --- a/app/locale/en_US/Pimgento_Api.csv +++ b/app/locale/en_US/Pimgento_Api.csv @@ -140,6 +140,7 @@ "Pimgento_Api::Include new categories in menu","Include new categories in menu" "Pimgento_Api::Init default groups","Init default groups" "Pimgento_Api::Init stock","Init stock" +"Pimgento_Api::Label for '%1' in %2 is missing. ","Label for '%1' in %2 is missing. " "Pimgento_Api::Link configurable with children","Link configurable with children" "Pimgento_Api::Lower or equals than on all locales","Lower or equals than on all locales" "Pimgento_Api::Lower or equals than","Lower or equals than" diff --git a/app/locale/fr_FR/Pimgento_Api.csv b/app/locale/fr_FR/Pimgento_Api.csv index c884936..c74926e 100755 --- a/app/locale/fr_FR/Pimgento_Api.csv +++ b/app/locale/fr_FR/Pimgento_Api.csv @@ -140,6 +140,7 @@ "Pimgento_Api::Include new categories in menu","Inclure les nouvelles catégories au menu" "Pimgento_Api::Init default groups","Initialisation des groupes par défaut" "Pimgento_Api::Init stock","Initialisation du stock" +"Pimgento_Api::Label for '%1' in %2 is missing. ","Le libellé pour '%1' sur la locale %2 est manquant. " "Pimgento_Api::Link configurable with children","Liaison des configuable aux enfants" "Pimgento_Api::Lower or equals than on all locales","Plus petit ou égal à sur toutes les locales" "Pimgento_Api::Lower or equals than","Plus petit ou égal à"