Skip to content

Commit

Permalink
Update career extra fields BT#16231
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Oct 10, 2019
1 parent 2832159 commit baef229
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions main/admin/careers.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@
$career->update_all_promotion_status_by_career_id($values['id'], $values['status']);
$old_status = $career->get_status($values['id']);
$res = $career->update($values);

$values['item_id'] = $values['id'];
$sessionFieldValue = new ExtraFieldValue('career');
$sessionFieldValue->saveFieldValues($values);

if ($res) {
Display::addFlash(
Display::return_message(get_lang('CareerUpdated'), 'confirmation')
Expand Down
14 changes: 9 additions & 5 deletions main/inc/lib/career.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function return_form($url, $action)
$header = get_lang('Modify');
}

$id = isset($_GET['id']) ? intval($_GET['id']) : '';
$id = isset($_GET['id']) ? (int) $_GET['id'] : '';
$form->addHeader($header);
$form->addHidden('id', $id);
$form->addElement('text', 'name', get_lang('Name'), ['size' => '70']);
Expand All @@ -145,14 +145,16 @@ public function return_form($url, $action)
);
$status_list = $this->get_status_list();
$form->addElement('select', 'status', get_lang('Status'), $status_list);

if ($action == 'edit') {
$extraField = new ExtraField('career');
$extraField->addElements($form, $id);

$form->addElement('text', 'created_at', get_lang('CreatedAt'));
$form->freeze('created_at');
}
if ($action == 'edit') {
$form->addButtonSave(get_lang('Modify'), 'submit');
$form->addButtonSave(get_lang('Modify'));
} else {
$form->addButtonCreate(get_lang('Add'), 'submit');
$form->addButtonCreate(get_lang('Add'));
}

// Setting the defaults
Expand All @@ -167,6 +169,8 @@ public function return_form($url, $action)

$form->setDefaults($defaults);



// Setting the rules
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');

Expand Down

0 comments on commit baef229

Please sign in to comment.