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

refactor: code style

Übergeordneter ebd0733c
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -22,20 +22,22 @@ class Factory extends QUI\Utils\Singleton
* @param string|integer $id - processing ID
* @param string $color - color of the status
* @param array $title - title
*
* @throws Exception
* @throws QUI\Exception
* @todo permissions
*/
public function createProcessingStatus($id, $color, array $title)
{
$list = Handler::getInstance()->getList();
$id = (int)$id;
$data = array();
$data = [];
if (isset($list[$id])) {
throw new Exception(array(
throw new Exception([
'quiqqer/order',
'exception.processStatus.exists'
));
]);
}
// config
......@@ -62,7 +64,7 @@ public function createProcessingStatus($id, $color, array $title)
QUI\Translator::addUserVar(
'quiqqer/order',
'processing.status.' . $id,
'processing.status.'.$id,
$data
);
......
......@@ -34,12 +34,19 @@ public function getList()
return $this->list;
}
$Package = QUI::getPackage('quiqqer/order');
$Config = $Package->getConfig();
$result = $Config->getSection('processing_status');
try {
$Package = QUI::getPackage('quiqqer/order');
$Config = $Package->getConfig();
$result = $Config->getSection('processing_status');
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeException($Exception);
return [];
}
if (!$result || !is_array($result)) {
$this->list = array();
$this->list = [];
return $this->list;
}
......@@ -56,7 +63,7 @@ public function getList()
public function getProcessingStatusList()
{
$list = $this->getList();
$result = array();
$result = [];
foreach ($list as $entry => $color) {
try {
......@@ -73,6 +80,8 @@ public function getProcessingStatusList()
*
* @param $id
* @return Status
*
* @throws Exception
*/
public function getProcessingStatus($id)
{
......@@ -84,6 +93,9 @@ public function getProcessingStatus($id)
*
* @param string|int $id
*
* @throws Exception
* @throws QUI\Exception
*
* @todo permissions
*/
public function deleteProcessingStatus($id)
......@@ -93,7 +105,7 @@ public function deleteProcessingStatus($id)
// remove translation
QUI\Translator::delete(
'quiqqer/order',
'processing.status.' . $Status->getId()
'processing.status.'.$Status->getId()
);
QUI\Translator::publish('quiqqer/order');
......@@ -113,6 +125,8 @@ public function deleteProcessingStatus($id)
* @param int|string $color
* @param array $title
*
* @throws QUI\Exception
*
* @todo permissions
*/
public function updateProcessingStatus($id, $color, array $title)
......@@ -122,22 +136,22 @@ public function updateProcessingStatus($id, $color, array $title)
// update translation
$languages = QUI::availableLanguages();
$data = array(
$data = [
'package' => 'quiqqer/order',
'datatype' => 'php,js',
'html' => 1
);
];
foreach ($languages as $language) {
if (isset($title[$language])) {
$data[$language] = $title[$language];
$data[$language . '_edit'] = $title[$language];
$data[$language] = $title[$language];
$data[$language.'_edit'] = $title[$language];
}
}
QUI\Translator::edit(
'quiqqer/order',
'processing.status.' . $Status->getId(),
'processing.status.'.$Status->getId(),
'quiqqer/order',
$data
);
......
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