Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task 229 #818

Merged
merged 5 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 5 additions & 8 deletions Core/Controller/EditSubcuenta.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ public function getPageData()
*
* @param string $viewName
*/
protected function createAccountingView($viewName = 'ListAsiento')
protected function createDepartureView($viewName = 'ListPartida')
{
$this->addListView($viewName, 'Asiento', 'accounting-entries', 'fas fa-balance-scale');
$this->views[$viewName]->addOrderBy(['numero'], 'number', 2);
$this->views[$viewName]->addOrderBy(['importe'], 'amount');
$this->addListView($viewName, 'Partida', 'accounting-entries', 'fas fa-balance-scale');
$this->views[$viewName]->searchFields[] = 'concepto';

/// disable columns
Expand All @@ -81,7 +79,7 @@ protected function createViews()
parent::createViews();
$this->setTabsPosition('bottom');

$this->createAccountingView();
$this->createDepartureView();
}

/**
Expand All @@ -93,13 +91,12 @@ protected function createViews()
protected function loadData($viewName, $view)
{
switch ($viewName) {
case 'ListAsiento':
case 'ListPartida':
/// needed dependency
new Partida();

$idsubcuenta = $this->getViewModelValue($this->getMainViewName(), 'idsubcuenta');
$inSQL = 'SELECT idasiento FROM partidas WHERE idsubcuenta = ' . $this->dataBase->var2str($idsubcuenta);
$where = [new DataBaseWhere('idasiento', $inSQL, 'IN')];
$where = [new DataBaseWhere('idsubcuenta', $idsubcuenta)];
$view->loadData('', $where);
break;

Expand Down
12 changes: 12 additions & 0 deletions Core/Model/Partida.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,16 @@ private function testErrorInData(): bool

return empty($this->idsubcuenta);
}

/**
*
* @param string $type
* @param string $list
*
* @return string
*/
public function url(string $type = 'auto', string $edit = 'EditAsiento')
{
return $this->getAsiento()->url();
}
}