Revize 74a7dbca
Přidáno uživatelem Michal Kliment před více než 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') . ' ---'
|
||
);
|
||
|
||
$templates += ORM::factory('device_template')
|
||
// find templates for given device type
|
||
$device_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
Merge from SVN branch 1.2.