Konto: Phrases

This commit is contained in:
cgfhtw
2024-04-25 11:36:37 +02:00
parent 1b19a0821f
commit f47f8d5da4
6 changed files with 817 additions and 163 deletions
@@ -49,7 +49,7 @@ class Konto extends FHCAPI_Controller
// Load language phrases
$this->loadPhrases([
'ui'
'konto'
]);
}
@@ -175,22 +175,21 @@ class Konto extends FHCAPI_Controller
return $row->nachname . ' ' . $row->vorname;
}, $result);
// TODO(chris): Phrases
$result = $this->p->t('konto', 'buchung_vorhanden') . "\n";
$result = $this->p->t('konto', 'confirm_overwrite') . "\n";
if (count($persons) > 10) {
$result .= "-" . implode("\n-", array_slice($persons, 0, 10)) . "\n";
if (count($persons) == 11) {
$result .= "\n" . $this->p->t('konto', 'and_1_additional_person');
$result .= "\n" . $this->p->t('konto', 'confirm_overwrite_1_add_pers');
} else {
$result .= "\n" . $this->p->t('konto', 'and_x_additional_person', [
$result .= "\n" . $this->p->t('konto', 'confirm_overwrite_x_add_pers', [
'x' => count($persons) - 10
]);
}
} else {
$result .= "-" . implode("\n-", $persons) . "\n";
}
$result .= $this->p->t('konto', 'proceed');
$result .= $this->p->t('konto', 'confirm_overwrite_proceed');
$this->addError($result, 'confirm');
@@ -327,8 +326,8 @@ class Konto extends FHCAPI_Controller
'label' => 'Buchung # ' . $buchungsnr,
'rules' => 'regex_match[/^$/]',
'errors' => [
'regex_match' => 'Gegenbuchungen koennen nur auf die obersten Buchungen getaetigt werden'
] // TODO(chris): phrase
'regex_match' => $this->p->t('konto', 'error_counter_level')
]
];
}
}
@@ -355,9 +354,9 @@ class Konto extends FHCAPI_Controller
if ($betrag === null) {
$this->addError($this->p->t(
'konto',
'Buchung #{buchungsnr} does not exist',
'error_missing',
$buchung
), self::ERROR_TYPE_GENERAL); // TODO(chris): phrase
), self::ERROR_TYPE_GENERAL);
continue;
}
@@ -482,7 +481,9 @@ class Konto extends FHCAPI_Controller
$result = $result->retval;
if (!$result)
$this->terminateWithError('buchung not found', self::ERROR_TYPE_GENERAL); // TODO(chris): phrase
$this->terminateWithError($this->p->t('konto', 'error_missing', [
'buchungsnr' => $buchungsnr
]), self::ERROR_TYPE_GENERAL);
$_POST['studiengang_kz'] = current($result)->studiengang_kz;
@@ -500,7 +501,7 @@ class Konto extends FHCAPI_Controller
if (isError($result)) {
if (getCode($result) != 42)
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); // TODO(chris): phrase
$this->terminateWithError($this->p->t('konto', 'error_delete_level'), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess();
+117 -17
View File
@@ -15,49 +15,57 @@ class Config extends FHC_Controller
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
$this->loadPhrases([
'global',
'person',
'lehre',
'stv',
'konto'
]);
}
public function student()
{
// TODO(chris): phrases
$result = [];
$result['details'] = [
'title' => 'Details',
'title' => $this->p->t('stv', 'tab_details'),
'component' => './Stv/Studentenverwaltung/Details/Details.js'
];
$result['notizen'] = [
'title' => 'Notizen',
$result['notes'] = [
'title' => $this->p->t('stv', 'notes'),
'component' => './Stv/Studentenverwaltung/Details/Notizen.js'
];
$result['kontakt'] = [
'title' => 'Kontakt',
$result['contact'] = [
'title' => $this->p->t('stv', 'contact'),
'component' => './Stv/Studentenverwaltung/Details/Kontakt.js'
];
$result['prestudent'] = [
'title' => 'PreStudentIn',
'title' => $this->p->t('stv', 'prestudent'),
'component' => './Stv/Studentenverwaltung/Details/Prestudent.js'
];
$result['status'] = [
'title' => 'Status',
'title' => $this->p->t('stv', 'status'),
'component' => './Stv/Studentenverwaltung/Details/Status.js'
];
$result['konto'] = [
'title' => 'Konto',
$result['banking'] = [
'title' => $this->p->t('stv', 'banking'),
'component' => './Stv/Studentenverwaltung/Details/Konto.js',
'config' => [
'showZahlungsbestaetigung' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN),
'showBuchungsnr' => $this->permissionlib->isBerechtigt('admin'),
'showMahnspanne' => (!defined('FAS_KONTO_SHOW_MAHNSPANNE') || FAS_KONTO_SHOW_MAHNSPANNE===true),
'showCreditpoints' => (defined('FAS_KONTO_SHOW_CREDIT_POINTS') && FAS_KONTO_SHOW_CREDIT_POINTS == 'true'),
'columns' => $this->kontoColumns(),
'additionalCols' => []
]
];
$result['betriebsmittel'] = [
'title' => 'Betriebsmittel',
$result['resources'] = [
'title' => $this->p->t('stv', 'resources'),
'component' => './Stv/Studentenverwaltung/Details/Betriebsmittel.js'
];
$result['noten'] = [
'title' => 'Noten',
$result['grades'] = [
'title' => $this->p->t('stv', 'grades'),
'component' => './Stv/Studentenverwaltung/Details/Noten.js'
];
@@ -70,16 +78,16 @@ class Config extends FHC_Controller
public function students()
{
// TODO(chris): phrases
$result = [];
$result['konto'] = [
'title' => 'Konto',
$result['banking'] = [
'title' => $this->p->t('stv', 'banking'),
'component' => './Stv/Studentenverwaltung/Details/Konto.js',
'config' => [
'showZahlungsbestaetigung' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN),
'showBuchungsnr' => $this->permissionlib->isBerechtigt('admin'),
'showMahnspanne' => (!defined('FAS_KONTO_SHOW_MAHNSPANNE') || FAS_KONTO_SHOW_MAHNSPANNE===true),
'showCreditpoints' => (defined('FAS_KONTO_SHOW_CREDIT_POINTS') && FAS_KONTO_SHOW_CREDIT_POINTS == 'true'),
'columns' => $this->kontoColumnsMultiPerson(),
'additionalCols' => []
]
];
@@ -90,4 +98,96 @@ class Config extends FHC_Controller
$this->outputJsonSuccess($result);
}
protected function kontoColumns()
{
return [
'buchungsdatum' => [
'field' => "buchungsdatum",
'title' => $this->p->t('konto', 'buchungsdatum')
],
'buchungstext' => [
'field' => "buchungstext",
'title' => $this->p->t('konto', 'buchungstext')
],
'betrag' => [
'field' => "betrag",
'title' => $this->p->t('konto', 'betrag')
],
'studiensemester_kurzbz' => [
'field' => "studiensemester_kurzbz",
'title' => $this->p->t('lehre', 'studiensemester')
],
'buchungstyp_kurzbz' => [
'field' => "buchungstyp_kurzbz",
'title' => $this->p->t('konto', 'buchungstyp'),
'visible' => false
],
'buchungsnr' => [
'field' => "buchungsnr",
'title' => $this->p->t('konto', 'buchungsnr'),
'visible' => false
],
'insertvon' => [
'field' => "insertvon",
'title' => $this->p->t('global', 'insertvon'),
'visible' => false
],
'insertamum' => [
'field' => "insertamum",
'title' => $this->p->t('global', 'insertamum'),
'visible' => false
],
'kuerzel' => [
'field' => "kuerzel",
'title' => $this->p->t('lehre', 'studiengang'),
'visible' => false
],
'anmerkung' => [
'field' => "anmerkung",
'title' => $this->p->t('global', 'anmerkung')
],
'actions' => [
'title' => $this->p->t('global', 'actions'),
'frozen' => true
]
];
}
protected function kontoColumnsMultiPerson()
{
return [
'person_id' => [
'field' => "person_id",
'title' => $this->p->t('person', 'person_id')
],
'anrede' => [
'field' => "anrede",
'title' => $this->p->t('person', 'anrede'),
'visible' => false
],
'titelpost' => [
'field' => "titelpost",
'title' => $this->p->t('person', 'titelpost'),
'visible' => false
],
'titelpre' => [
'field' => "titelpre",
'title' => $this->p->t('person', 'titelpre'),
'visible' => false
],
'vorname' => [
'field' => "vorname",
'title' => $this->p->t('person', 'vorname')
],
'vornamen' => [
'field' => "vornamen",
'title' => $this->p->t('person', 'vornamen'),
'visible' => false
],
'nachname' => [
'field' => "nachname",
'title' => $this->p->t('person', 'nachname')
]
] + $this->kontoColumns();
}
}
+2 -2
View File
@@ -84,8 +84,8 @@ class Konto_model extends DB_Model
{
$this->db->where('buchungsnr_verweis', $id);
if ($this->db->count_all_results($this->dbTable))
return error('Bitte zuerst die zugeordneten Buchungen loeschen');
return parent::delete($id, 42);
return error('Bitte zuerst die zugeordneten Buchungen loeschen', 42);
return parent::delete($id);
}
/**