Revize c478920d
Přidáno uživatelem Ondřej Fibich před asi 9 roky(ů)
application/controllers/connection_requests.php | ||
---|---|---|
$gateway = $ip_address_model->get_gateway_of_subnet($subnet_id);
|
||
|
||
if ($gateway && $gateway->id)
|
||
{
|
||
{
|
||
$mac_address = '';
|
||
|
||
// first try CGI scripts
|
||
... | ... | |
status::mwarning($e->getMessage());
|
||
}
|
||
}
|
||
|
||
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
}
|
||
... | ... | |
NULL => '--- ' . __('Select template') . ' ---'
|
||
);
|
||
|
||
// find templates for given device type
|
||
$device_templates = ORM::factory('device_template')
|
||
$templates += ORM::factory('device_template')
|
||
->where('enum_type_id', $cr_model->device_type_id)
|
||
->select_list();
|
||
|
||
// if only one teplate in this type -> set it and redirect (#813)
|
||
if (count($device_templates) == 1)
|
||
{
|
||
try
|
||
{
|
||
$cr_model->transaction_start();
|
||
|
||
$cr_model->device_template_id = key($device_templates);
|
||
$cr_model->save_throwable();
|
||
|
||
$cr_model->transaction_commit();
|
||
|
||
// hard redirect, no $this->redirect here!
|
||
url::redirect('devices/add_from_connection_request/' . $cr_model->id);
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$cr_model->transaction_rollback();
|
||
Log::add_exception($e);
|
||
status::error('Cannot edit connection request.', $e);
|
||
}
|
||
}
|
||
|
||
// add templates
|
||
$templates += $device_templates;
|
||
|
||
// form
|
||
$form = new Forge();
|
||
|
||
... | ... | |
|
||
$cr_model->transaction_commit();
|
||
|
||
status::info('Add device for acception of connection request.');
|
||
// hard redirect, no $this->redirect here!
|
||
url::redirect('devices/add_from_connection_request/' . $cr_model->id);
|
||
}
|
Také k dispozici: Unified diff
Undo my stupid mistake (I have pushed issue-957 to master instead of develop). Do I have copied files from GitHub master and push them back..