Skip to content

Commit

Permalink
Simplify header building; fix warnings (Bug #13290).
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Jun 30, 2014
1 parent c9cbc06 commit 8ad44b3
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions sesha/lib/View/List.php
Expand Up @@ -25,16 +25,11 @@ class Sesha_View_List extends Sesha_View_Base
public function __construct(array $config)
{
if (!empty($config['what']) && !empty($config['loc'])) {
$this->title = _("Search Results");
$this->header = _("Search Results");
$this->title = $this->header = _("Search Results");
$url = new Horde_Url('list.php');
$this->backToList = $url->link() . _('Back to stock list') . '</a>';
} else {
$this->header = $category_id
? sprintf(_("Available Inventory in %s"),
$selectedCategory->category)
: _("Available Inventory");
$this->title = _("Inventory List");
$this->title = $this->header = _("Available Inventory");
}
$this->selectedCategories = is_array($config['selectedCategories'])
? $config['selectedCategories']
Expand All @@ -52,26 +47,28 @@ public function __construct(array $config)
'value' => $this->selectedCategories,
'exact' => $config['exact']);
}
if (in_array(Sesha::SEARCH_ID, $config['loc'])) {
$filters[] = array('type' => 'stock_id',
'exact' => $config['exact'],
'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_NAME, $config['loc'])) {
$filters[] = array('type' => 'stock_name',
'exact' => $config['exact'],
'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_NOTE, $config['loc'])) {
$filters[] = array('type' => 'note',
'exact' => $config['exact'],
'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_PROPERTY, $config['loc'])) {
$filters[] = array(
'type' => 'values',
'exact' => $config['exact'],
'value' => array(array('values' => array($config['what']))));
if (!empty($config['loc'])) {
if (in_array(Sesha::SEARCH_ID, $config['loc'])) {
$filters[] = array('type' => 'stock_id',
'exact' => $config['exact'],
'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_NAME, $config['loc'])) {
$filters[] = array('type' => 'stock_name',
'exact' => $config['exact'],
'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_NOTE, $config['loc'])) {
$filters[] = array('type' => 'note',
'exact' => $config['exact'],
'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_PROPERTY, $config['loc'])) {
$filters[] = array(
'type' => 'values',
'exact' => $config['exact'],
'value' => array(array('values' => array($config['what']))));
}
}
$this->shownStock = $this->stock($filters);
parent::__construct($config);
Expand Down

0 comments on commit 8ad44b3

Please sign in to comment.