Revize 1944
Přidáno uživatelem Jan Dubina před více než 11 roky(ů)
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'delete all records' => 'Smazat všechny záznamy',
|
||
'delete all unsended e-mails' => 'Smazat všechny neodeslané emaily',
|
||
'delete device' => 'Smazat zařízení',
|
||
'delete users devices' => 'Smazat zařízení uživatele',
|
||
'delete ip address' => 'Smazat IP adresu',
|
||
'delete membership transfer' => 'Smazat převod členství',
|
||
'delete own records' => 'Smazat vlastní záznamy',
|
||
... | ... | |
'redirection settings' => 'Nastavení přesměrování',
|
||
'redirection state' => 'Stav přesměrování',
|
||
'redirection type' => 'Typ přesměrování',
|
||
'importing bank transfers listing wont cancel redirections and payment notices!' => 'Při importu plateb nebude zrušeno přesměrování a upozornění na placení!',
|
||
'refresh interfaces of device' => 'Znovunačti rozhraní zařízení',
|
||
'reg' => 'Přih.',
|
||
'register' => 'Registrovat',
|
freenetis/branches/1.1/application/models/invoice.php | ||
---|---|---|
if ($filter_sql != '')
|
||
$where = "WHERE $filter_sql";
|
||
|
||
$join_phone = '';
|
||
$select_phone = '';
|
||
|
||
$join_email = '';
|
||
$select_email = '';
|
||
|
||
//HACK FOR IMPROVING PERFORMANCE
|
||
if (strpos($filter_sql, '`iv`.`phone` LIKE '))
|
||
{
|
||
$join_phone = "
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, phone
|
||
FROM users u
|
||
RIGHT JOIN
|
||
(
|
||
SELECT user_id, value AS phone
|
||
FROM users_contacts uc
|
||
LEFT JOIN contacts c ON uc.contact_id = c.id
|
||
WHERE c.type = ?
|
||
) c ON u.id = c.user_id
|
||
GROUP BY member_id
|
||
) cp ON iv.member_id = cp.member_id
|
||
";
|
||
$select_phone = ", IF(iv.member_id IS NULL,iv.phone_number, cp.phone) AS phone";
|
||
}
|
||
|
||
if (strpos($filter_sql, '`iv`.`email` LIKE '))
|
||
{
|
||
$join_email = "
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, email
|
||
FROM users u
|
||
RIGHT JOIN
|
||
(
|
||
SELECT user_id, value AS email
|
||
FROM users_contacts uc
|
||
LEFT JOIN contacts c ON uc.contact_id = c.id
|
||
WHERE c.type = ?
|
||
) c ON u.id = c.user_id
|
||
GROUP BY member_id
|
||
) cm ON iv.member_id = cm.member_id
|
||
";
|
||
$select_email = ",IF(iv.member_id IS NULL,iv.email, cm.email) AS email";
|
||
}
|
||
|
||
// query
|
||
return $this->db->query("
|
||
SELECT *
|
||
FROM
|
||
(
|
||
SELECT i.id,
|
||
IF(i.member_id IS NULL, partner_company, NULL) AS company,
|
||
IF(i.member_id IS NULL, partner_name, m.name) AS partner,
|
||
IF(i.member_id IS NULL, partner_street, m.street) AS street,
|
||
IF(i.member_id IS NULL, partner_street_number, m.street_number)
|
||
SELECT iv.id,
|
||
IF(iv.member_id IS NULL, partner_company, NULL) AS company,
|
||
IF(iv.member_id IS NULL, partner_name, m.name) AS partner,
|
||
IF(iv.member_id IS NULL, partner_street, m.street) AS street,
|
||
IF(iv.member_id IS NULL, partner_street_number, m.street_number)
|
||
AS street_number,
|
||
IF(i.member_id IS NULL, partner_town, m.town) AS town,
|
||
IF(i.member_id IS NULL, partner_zip_code, m.zip_code) AS zip_code,
|
||
IF(i.member_id IS NULL, partner_country, m.country_name) AS country,
|
||
IF(i.member_id IS NULL, i.organization_identifier, m.organization_identifier)
|
||
IF(iv.member_id IS NULL, partner_town, m.town) AS town,
|
||
IF(iv.member_id IS NULL, partner_zip_code, m.zip_code) AS zip_code,
|
||
IF(iv.member_id IS NULL, partner_country, m.country_name) AS country,
|
||
IF(iv.member_id IS NULL, iv.organization_identifier, m.organization_identifier)
|
||
AS organization_identifier,
|
||
IF(i.member_id IS NULL,i.account_nr, m.account_nr) AS account_nr,
|
||
IF(i.member_id IS NULL,i.email, cm.email) AS email,
|
||
IF(i.member_id IS NULL,i.phone_number, cp.phone) AS phone,
|
||
IF(iv.member_id IS NULL,iv.account_nr, m.account_nr) AS account_nr,
|
||
invoice_nr, invoice_type, var_sym, con_sym, date_inv, date_due,
|
||
date_vat, i.vat, order_nr, currency, note,
|
||
date_vat, iv.vat, order_nr, currency, note,
|
||
COUNT(it.id) AS comments_count,
|
||
GROUP_CONCAT(DISTINCT it.name ORDER BY it.name SEPARATOR '\n') AS comments,
|
||
SUM(it.price * it.quantity) AS price,
|
||
SUM(it.price * it.quantity * (1 + it.vat)) AS price_vat
|
||
FROM invoices i
|
||
$select_phone
|
||
$select_email
|
||
FROM invoices iv
|
||
LEFT JOIN
|
||
(
|
||
SELECT m.id, m.name, m.organization_identifier,
|
||
... | ... | |
LEFT JOIN
|
||
(
|
||
SELECT member_id,
|
||
CONCAT(account_nr,'/',bank_nr) as account_nr
|
||
IF(account_nr<>'' AND bank_nr<>'', CONCAT(account_nr,'/',bank_nr), '') as account_nr
|
||
FROM bank_accounts
|
||
GROUP BY member_id
|
||
) ba ON ba.member_id = m.id
|
||
... | ... | |
LEFT JOIN towns t ON ap.town_id = t.id
|
||
LEFT JOIN streets s ON ap.street_id = s.id
|
||
) ap ON m.address_point_id = ap.id
|
||
) m ON i.member_id = m.id
|
||
) m ON iv.member_id = m.id
|
||
LEFT JOIN invoice_items it ON iv.id = it.invoice_id
|
||
$join_phone
|
||
$join_email
|
||
GROUP BY iv.id
|
||
) iv $where
|
||
ORDER BY " . $this->db->escape_column($order_by) . " $order_by_direction
|
||
", array(
|
||
Contact_Model::TYPE_EMAIL,
|
||
Contact_Model::TYPE_PHONE
|
||
));
|
||
}
|
||
|
||
/**
|
||
* Returns ORM_Iterator of all invoices
|
||
*
|
||
* @author Michal Kliment
|
||
* @param $limit_from
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return Mysql_Result
|
||
*/
|
||
public function get_all_invoices_export(
|
||
$limit_from = 0, $limit_results = 50,
|
||
$order_by = 'id', $order_by_direction = 'ASC',
|
||
$filter_sql = '')
|
||
{
|
||
// order by direction check
|
||
if (strtolower($order_by_direction) != 'desc')
|
||
{
|
||
$order_by_direction = 'asc';
|
||
}
|
||
|
||
$where = '';
|
||
|
||
if ($filter_sql != '')
|
||
$where = "WHERE $filter_sql";
|
||
|
||
// query
|
||
return $this->db->query("
|
||
SELECT *
|
||
FROM
|
||
(
|
||
SELECT iv.id,
|
||
IF(iv.member_id IS NULL, partner_company, NULL) AS company,
|
||
IF(iv.member_id IS NULL, partner_name, m.name) AS partner,
|
||
IF(iv.member_id IS NULL, partner_street, m.street) AS street,
|
||
IF(iv.member_id IS NULL, partner_street_number, m.street_number)
|
||
AS street_number,
|
||
IF(iv.member_id IS NULL, partner_town, m.town) AS town,
|
||
IF(iv.member_id IS NULL, partner_zip_code, m.zip_code) AS zip_code,
|
||
IF(iv.member_id IS NULL, partner_country, m.country_name) AS country,
|
||
IF(iv.member_id IS NULL, iv.organization_identifier, m.organization_identifier)
|
||
AS organization_identifier,
|
||
IF(iv.member_id IS NULL,iv.account_nr, m.account_nr) AS account_nr,
|
||
IF(iv.member_id IS NULL,iv.email, cm.email) AS email,
|
||
IF(iv.member_id IS NULL,iv.phone_number, cp.phone) AS phone,
|
||
invoice_nr, invoice_type, var_sym, con_sym, date_inv, date_due,
|
||
date_vat, iv.vat, order_nr, currency, note,
|
||
COUNT(it.id) AS comments_count,
|
||
GROUP_CONCAT(DISTINCT it.name ORDER BY it.name SEPARATOR '\n') AS comments,
|
||
SUM(it.price * it.quantity) AS price,
|
||
SUM(it.price * it.quantity * (1 + it.vat)) AS price_vat
|
||
FROM invoices iv
|
||
LEFT JOIN
|
||
(
|
||
SELECT m.id, m.name, m.organization_identifier,
|
||
ap.street, ap.street_number, ap.town,
|
||
ap.zip_code, ap.country_name, account_nr
|
||
FROM members m
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id,
|
||
IF(account_nr<>'' AND bank_nr<>'', CONCAT(account_nr,'/',bank_nr), '') as account_nr
|
||
FROM bank_accounts
|
||
GROUP BY member_id
|
||
) ba ON ba.member_id = m.id
|
||
LEFT JOIN
|
||
(
|
||
SELECT ap.id, s.street, street_number,
|
||
t.town, t.zip_code, c.country_name
|
||
FROM address_points ap
|
||
LEFT JOIN countries c ON ap.country_id = c.id
|
||
LEFT JOIN towns t ON ap.town_id = t.id
|
||
LEFT JOIN streets s ON ap.street_id = s.id
|
||
) ap ON m.address_point_id = ap.id
|
||
) m ON iv.member_id = m.id
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, email
|
||
... | ... | |
WHERE c.type = ?
|
||
) c ON u.id = c.user_id
|
||
GROUP BY member_id
|
||
) cm ON i.member_id = cm.member_id
|
||
) cm ON iv.member_id = cm.member_id
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, phone
|
||
... | ... | |
WHERE c.type = ?
|
||
) c ON u.id = c.user_id
|
||
GROUP BY member_id
|
||
) cp ON i.member_id = cp.member_id
|
||
LEFT JOIN invoice_items it ON i.id = it.invoice_id
|
||
GROUP BY i.id
|
||
) i $where
|
||
) cp ON iv.member_id = cp.member_id
|
||
LEFT JOIN invoice_items it ON iv.id = it.invoice_id
|
||
GROUP BY iv.id
|
||
) iv $where
|
||
ORDER BY " . $this->db->escape_column($order_by) . " $order_by_direction
|
||
", array(
|
||
Contact_Model::TYPE_EMAIL,
|
||
... | ... | |
return $this->count_all();
|
||
}
|
||
|
||
$join_phone = '';
|
||
$select_phone = '';
|
||
|
||
$join_email = '';
|
||
$select_email = '';
|
||
|
||
//HACK FOR IMPROVING PERFORMANCE
|
||
if (strpos($filter_sql, '`iv`.`phone` LIKE '))
|
||
{
|
||
$join_phone = "
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, phone
|
||
FROM users u
|
||
RIGHT JOIN
|
||
(
|
||
SELECT user_id, value AS phone
|
||
FROM users_contacts uc
|
||
LEFT JOIN contacts c ON uc.contact_id = c.id
|
||
WHERE c.type = ?
|
||
) c ON u.id = c.user_id
|
||
GROUP BY member_id
|
||
) cp ON iv.member_id = cp.member_id
|
||
";
|
||
$select_phone = ", IF(iv.member_id IS NULL,iv.phone_number, cp.phone) AS phone";
|
||
}
|
||
|
||
if (strpos($filter_sql, '`iv`.`email` LIKE '))
|
||
{
|
||
$join_email = "
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, email
|
||
FROM users u
|
||
RIGHT JOIN
|
||
(
|
||
SELECT user_id, value AS email
|
||
FROM users_contacts uc
|
||
LEFT JOIN contacts c ON uc.contact_id = c.id
|
||
WHERE c.type = ?
|
||
) c ON u.id = c.user_id
|
||
GROUP BY member_id
|
||
) cm ON iv.member_id = cm.member_id
|
||
";
|
||
$select_email = ",IF(iv.member_id IS NULL,iv.email, cm.email) AS email";
|
||
}
|
||
|
||
// query
|
||
return $this->db->query("
|
||
SELECT COUNT(*) AS total
|
||
FROM
|
||
(
|
||
SELECT i.id,
|
||
IF(i.member_id IS NULL, partner_company, NULL) AS company,
|
||
IF(i.member_id IS NULL, partner_name, m.name) AS partner,
|
||
IF(i.member_id IS NULL, partner_street, m.street) AS street,
|
||
IF(i.member_id IS NULL, partner_street_number, m.street_number)
|
||
SELECT iv.id,
|
||
IF(iv.member_id IS NULL, partner_company, NULL) AS company,
|
||
IF(iv.member_id IS NULL, partner_name, m.name) AS partner,
|
||
IF(iv.member_id IS NULL, partner_street, m.street) AS street,
|
||
IF(iv.member_id IS NULL, partner_street_number, m.street_number)
|
||
AS street_number,
|
||
IF(i.member_id IS NULL, partner_town, m.town) AS town,
|
||
IF(i.member_id IS NULL, partner_zip_code, m.zip_code) AS zip_code,
|
||
IF(i.member_id IS NULL, partner_country, m.country_name) AS country,
|
||
IF(i.member_id IS NULL, i.organization_identifier, m.organization_identifier)
|
||
IF(iv.member_id IS NULL, partner_town, m.town) AS town,
|
||
IF(iv.member_id IS NULL, partner_zip_code, m.zip_code) AS zip_code,
|
||
IF(iv.member_id IS NULL, partner_country, m.country_name) AS country,
|
||
IF(iv.member_id IS NULL, iv.organization_identifier, m.organization_identifier)
|
||
AS organization_identifier,
|
||
IF(i.member_id IS NULL,i.account_nr, m.account_nr) AS account_nr,
|
||
IF(i.member_id IS NULL,i.email, cm.email) AS email,
|
||
IF(i.member_id IS NULL,i.phone_number, cp.phone) AS phone,
|
||
IF(iv.member_id IS NULL,iv.account_nr, m.account_nr) AS account_nr,
|
||
invoice_nr, invoice_type, var_sym, con_sym, date_inv, date_due,
|
||
date_vat, i.vat, order_nr, currency, note,
|
||
COUNT(it.id) AS comments_count,
|
||
GROUP_CONCAT(DISTINCT it.name ORDER BY it.name SEPARATOR '\n') AS comments,
|
||
date_vat, iv.vat, order_nr, currency, note,
|
||
SUM(it.price * it.quantity) AS price,
|
||
SUM(it.price * it.quantity * (1 + it.vat)) AS price_vat
|
||
FROM invoices i
|
||
$select_phone
|
||
$select_email
|
||
FROM invoices iv
|
||
LEFT JOIN
|
||
(
|
||
SELECT m.id, m.name, m.organization_identifier,
|
||
... | ... | |
LEFT JOIN
|
||
(
|
||
SELECT member_id,
|
||
CONCAT(account_nr,'/',bank_nr) as account_nr
|
||
IF(account_nr<>'' AND bank_nr<>'', CONCAT(account_nr,'/',bank_nr), '') as account_nr
|
||
FROM bank_accounts
|
||
GROUP BY member_id
|
||
) ba ON ba.member_id = m.id
|
||
... | ... | |
LEFT JOIN towns t ON ap.town_id = t.id
|
||
LEFT JOIN streets s ON ap.street_id = s.id
|
||
) ap ON m.address_point_id = ap.id
|
||
) m ON i.member_id = m.id
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, c.type, c.value AS email
|
||
FROM users u
|
||
LEFT JOIN
|
||
(
|
||
SELECT user_id, value, type
|
||
FROM users_contacts uc
|
||
LEFT JOIN contacts c ON uc.contact_id = c.id
|
||
) c ON u.id = c.user_id
|
||
WHERE c.type = ?
|
||
GROUP BY member_id
|
||
LIMIT 0,1
|
||
) cm ON i.member_id = cm.member_id
|
||
LEFT JOIN
|
||
(
|
||
SELECT member_id, c.type, c.value AS phone
|
||
FROM users u
|
||
LEFT JOIN
|
||
(
|
||
SELECT user_id, value, type
|
||
FROM users_contacts uc
|
||
LEFT JOIN contacts c ON uc.contact_id = c.id
|
||
) c ON u.id = c.user_id
|
||
WHERE c.type = ?
|
||
GROUP BY member_id
|
||
LIMIT 0,1
|
||
) cp ON i.member_id = cp.member_id
|
||
LEFT JOIN invoice_items it ON i.id = it.invoice_id
|
||
GROUP BY i.id
|
||
) i $where
|
||
) m ON iv.member_id = m.id
|
||
LEFT JOIN invoice_items it ON iv.id = it.invoice_id
|
||
$join_phone
|
||
$join_email
|
||
GROUP BY iv.id
|
||
) iv $where
|
||
", array(
|
||
Contact_Model::TYPE_EMAIL,
|
||
Contact_Model::TYPE_PHONE
|
freenetis/branches/1.1/application/controllers/members.php | ||
---|---|---|
$form->date('leaving_date')
|
||
->label('Leaving date');
|
||
|
||
$form->radio('delete_users_devices')
|
||
->options(arr::bool())
|
||
->default(1);
|
||
|
||
$form->submit('End membership');
|
||
|
||
// validation
|
||
if ($form->validate())
|
||
{
|
||
{
|
||
$form_data = $form->as_array();
|
||
$member->leaving_date = date('Y-m-d', $form_data['leaving_date']);
|
||
$enum_type_model = new Enum_type_Model();
|
||
$member->type = $enum_type_model->get_type_id('Former member');
|
||
|
||
if ($member->save())
|
||
try
|
||
{
|
||
$member->transaction_start();
|
||
|
||
$member->type = Member_Model::TYPE_FORMER;
|
||
$member->leaving_date = date('Y-m-d', $form_data['leaving_date']);
|
||
|
||
$member->save_throwable();
|
||
|
||
if ($form_data['delete_users_devices'])
|
||
{
|
||
$device_model = new Device_Model();
|
||
$devices = $device_model->get_all_devices_by_member($member_id);
|
||
|
||
foreach ($devices as $device)
|
||
{
|
||
Devices_Controller::delete_device($device->id);
|
||
}
|
||
}
|
||
|
||
$member->transaction_commit();
|
||
|
||
status::success('Membership of the member has been ended.');
|
||
}
|
||
else
|
||
catch (Exception $e)
|
||
{
|
||
$member->transaction_rollback();
|
||
Log::add('error', $e->getTraceAsString());
|
||
status::error('Error - cant end membership.');
|
||
}
|
||
|
||
|
||
$this->redirect('members/show/', $member_id);
|
||
}
|
||
|
freenetis/branches/1.1/application/controllers/settings.php | ||
---|---|---|
->rules('required')
|
||
->selected(Settings::get('security_password_level'));
|
||
|
||
$this->form->group('Membership interrupt');
|
||
|
||
$this->form->input('membership_interrupt_minimum')
|
||
->label('Minimum membership interrupt period (months)')
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('membership_interrupt_minimum'));
|
||
if (Settings::get('membership_interrupt_enabled'))
|
||
{
|
||
$this->form->group('Membership interrupt');
|
||
|
||
$this->form->input('membership_interrupt_minimum')
|
||
->label('Minimum membership interrupt period (months)')
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('membership_interrupt_minimum'));
|
||
|
||
$this->form->input('membership_interrupt_maximum')
|
||
->label('Maximum membership interrupt period (months)')
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('membership_interrupt_maximum'));
|
||
}
|
||
|
||
$this->form->input('membership_interrupt_maximum')
|
||
->label('Maximum membership interrupt period (months)')
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('membership_interrupt_maximum'));
|
||
|
||
$this->form->submit('Save');
|
||
|
||
// form validate
|
freenetis/branches/1.1/application/controllers/js.php | ||
---|---|---|
$this->address_point_gps();
|
||
}
|
||
|
||
private function _js_settings_system()
|
||
{
|
||
$this->settings_form();
|
||
}
|
||
|
||
private function _js_transfers_payment_calculator($account_id = NULL)
|
||
{
|
||
$member_id = NULL;
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Adds javascript for membership interrupts settings.
|
||
*
|
||
* @author Jan Dubina
|
||
*/
|
||
private function settings_form()
|
||
{
|
||
$this->views['__pieces_settings'] =
|
||
View::factory('js/__pieces/settings')->render();
|
||
}
|
||
|
||
/**
|
||
* Calculator for VoIP calls
|
||
*
|
||
* @param integer $user_id
|
freenetis/branches/1.1/application/controllers/import.php | ||
---|---|---|
if ($bank_acc_model->id == 0)
|
||
Controller::error(RECORD);
|
||
|
||
$note = '<span style="color:red">' .
|
||
__('importing bank transfers listing wont cancel redirections and payment notices!') .
|
||
'</span>';
|
||
|
||
// form
|
||
$form = new Forge('import/upload_bank_file/' . $id);
|
||
|
||
... | ... | |
$view->title = $title;
|
||
$view->breadcrumbs = $breadcrumbs;
|
||
$view->content = new View('form');
|
||
$view->content->aditional_info = $note;
|
||
$view->content->form = $form->html();
|
||
$view->content->headline = $title;
|
||
$view->render(TRUE);
|
freenetis/branches/1.1/application/controllers/invoices.php | ||
---|---|---|
if (!$invoice_id)
|
||
url::redirect('invoices');
|
||
|
||
if ($invoice_template_id)
|
||
$invoice_template_model = new Invoice_template_Model();
|
||
$invoice_templates = $invoice_template_model->get_all_invoice_templates();
|
||
|
||
$types = array();
|
||
|
||
foreach ($invoice_templates as $invoice_template)
|
||
if ($invoice_template->type != Invoice_template_Model::TYPE_ED_INV)
|
||
$types[$invoice_template->id] = $invoice_template->name;
|
||
|
||
$form = new Forge();
|
||
|
||
$form->group('Select type');
|
||
|
||
$form->dropdown('type')
|
||
->options($types)->rules('required');
|
||
|
||
$form->submit('Do export');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$invoice_template = new Invoice_template_Model($invoice_template_id);
|
||
|
||
$form_data = $form->as_array();
|
||
|
||
$invoice_template = new Invoice_template_Model($form_data['type']);
|
||
|
||
if (!$invoice_template)
|
||
{
|
||
status::error('Error - bad template');
|
||
... | ... | |
|
||
switch ($invoice_template->type) {
|
||
case Invoice_template_Model::TYPE_EFORM:
|
||
url::redirect('export/eform_invoices/' . $invoice_id . '/'. $invoice_template_id);
|
||
url::redirect('export/eform_invoices/' . $invoice_id . '/'. $form_data['type']);
|
||
break;
|
||
case Invoice_template_Model::TYPE_ISDOC:
|
||
url::redirect('export/isdoc_invoices/' . $invoice_id . '/'. $invoice_template_id);
|
||
url::redirect('export/isdoc_invoices/' . $invoice_id . '/'. $form_data['type']);
|
||
break;
|
||
case Invoice_template_Model::TYPE_XML:
|
||
url::redirect('export/xml_invoices/' . $invoice_template_id . '/'. $invoice_id);
|
||
url::redirect('export/xml_invoices/' . $form_data['type'] . '/'. $invoice_id);
|
||
break;
|
||
case Invoice_template_Model::TYPE_DBASE:
|
||
url::redirect('export/dbf_invoices/' . $invoice_template_id . '/'. $invoice_id);
|
||
url::redirect('export/dbf_invoices/' . $form_data['type'] . '/'. $invoice_id);
|
||
break;
|
||
default:
|
||
status::error('Error - bad template');
|
||
... | ... | |
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$invoice_template_model = new Invoice_template_Model();
|
||
$invoice_templates = $invoice_template_model->get_all_invoice_templates();
|
||
|
||
$types = array();
|
||
|
||
foreach ($invoice_templates as $invoice_template)
|
||
if ($invoice_template->type != Invoice_template_Model::TYPE_ED_INV)
|
||
$types[$invoice_template->id] = $invoice_template->name;
|
||
|
||
$form = new Forge();
|
||
|
||
$form->group('Select type');
|
||
|
||
$form->dropdown('type')
|
||
->options($types)->rules('required');
|
||
|
||
$form->submit('Do export');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
url::redirect('invoices/export_single/' . $invoice_id . '/' . $form_data['type']);
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Export invoice');
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('form');
|
||
$view->content->headline = __('Export invoice');
|
||
$view->content->link_back = '';
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
$view = new View('main');
|
||
$view->title = __('Export invoice');
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('form');
|
||
$view->content->headline = __('Export invoice');
|
||
$view->content->link_back = '';
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
... | ... | |
->link('invoices/show_all', 'Invoices',
|
||
$this->acl_check_view('Accounts_Controller', 'invoices'))
|
||
->text('Export invoice');
|
||
|
||
if ($invoice_template_id)
|
||
|
||
$invoice_template_model = new Invoice_template_Model();
|
||
$invoice_templates = $invoice_template_model->get_all_invoice_templates();
|
||
|
||
$types = array();
|
||
|
||
foreach ($invoice_templates as $invoice_template)
|
||
if ($invoice_template->type != Invoice_template_Model::TYPE_ED_INV &&
|
||
$invoice_template->type != Invoice_template_Model::TYPE_ISDOC &&
|
||
$invoice_template->type != Invoice_template_Model::TYPE_EFORM)
|
||
$types[$invoice_template->id] = $invoice_template->name;
|
||
|
||
$form = new Forge(url::base().url::current(TRUE));
|
||
|
||
$form->group('Select type');
|
||
|
||
$form->dropdown('type')
|
||
->options($types)->rules('required');
|
||
|
||
$form->submit('Do export');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$invoice_template = new Invoice_template_Model($invoice_template_id);
|
||
|
||
$form_data = $form->as_array();
|
||
|
||
$invoice_template = new Invoice_template_Model($form_data['type']);
|
||
|
||
if (!$invoice_template)
|
||
{
|
||
status::error('Error - bad template');
|
||
url::redirect('invoices/show_all/');
|
||
}
|
||
|
||
|
||
switch ($invoice_template->type) {
|
||
case Invoice_template_Model::TYPE_XML:
|
||
url::redirect('export/xml_invoices/' . $invoice_template_id);
|
||
url::redirect(url_lang::base().'export/xml_invoices/'.$form_data['type'].'//'.server::query_string());
|
||
break;
|
||
case Invoice_template_Model::TYPE_DBASE:
|
||
url::redirect('export/dbf_invoices/' . $invoice_template_id);
|
||
url::redirect(url_lang::base().'export/dbf_invoices/'.$form_data['type'].'//'.server::query_string());
|
||
break;
|
||
default:
|
||
status::error('Error - bad template');
|
||
... | ... | |
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$invoice_template_model = new Invoice_template_Model();
|
||
$invoice_templates = $invoice_template_model->get_all_invoice_templates();
|
||
|
||
$types = array();
|
||
|
||
foreach ($invoice_templates as $invoice_template)
|
||
if ($invoice_template->type != Invoice_template_Model::TYPE_ED_INV &&
|
||
$invoice_template->type != Invoice_template_Model::TYPE_ISDOC &&
|
||
$invoice_template->type != Invoice_template_Model::TYPE_EFORM)
|
||
$types[$invoice_template->id] = $invoice_template->name;
|
||
|
||
$form = new Forge();
|
||
|
||
$form->group('Select type');
|
||
|
||
$form->dropdown('type')
|
||
->options($types)->rules('required');
|
||
|
||
$form->submit('Do export');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
url::redirect('invoices/export_filter/' . $form_data['type']);
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Export invoices');
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('form');
|
||
$view->content->headline = __('Export invoices');
|
||
$view->content->link_back = '';
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
$view = new View('main');
|
||
$view->title = __('Export invoices');
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('form');
|
||
$view->content->headline = __('Export invoices');
|
||
$view->content->link_back = '';
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
... | ... | |
public static function create_filter_form()
|
||
{
|
||
// filter form
|
||
$filter_form = new Filter_form('i');
|
||
$filter_form = new Filter_form('iv');
|
||
|
||
$filter_form->add('invoice_nr')
|
||
->label('Invoice number')
|
freenetis/branches/1.1/application/controllers/export.php | ||
---|---|---|
|
||
//export one invoice or filtered selection
|
||
if(!empty($invoice_id))
|
||
$filter = 'i.id = ' . $invoice_id;
|
||
$filter = 'iv.id = ' . $invoice_id;
|
||
else
|
||
{
|
||
$filter_form = new Filter_form('i');
|
||
$filter_form = new Filter_form('iv');
|
||
$filter_form->autoload();
|
||
$filter = $filter_form->as_sql();
|
||
}
|
||
... | ... | |
|
||
try
|
||
{
|
||
$invoices = $invoice_model->get_all_invoices(0, 0, 'id', 'asc', $filter);
|
||
$invoices = $invoice_model->get_all_invoices_export(0, 0, 'id', 'asc', $filter);
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
... | ... | |
url::redirect ('invoices/show_all/');
|
||
|
||
if (!empty($invoice_id))
|
||
$filter = 'i.id = ' . $invoice_id;
|
||
$filter = 'iv.id = ' . $invoice_id;
|
||
else
|
||
{
|
||
$filter_form = new Filter_form('i');
|
||
$filter_form = new Filter_form('iv');
|
||
$filter_form->autoload();
|
||
$filter = $filter_form->as_sql();
|
||
}
|
||
... | ... | |
|
||
try
|
||
{
|
||
$invoices = $invoice_model->get_all_invoices(0, 0, 'id', 'asc', $filter);
|
||
$invoices = $invoice_model->get_all_invoices_export(0, 0, 'id', 'asc', $filter);
|
||
}
|
||
catch (Exception $e)
|
||
{
|
freenetis/branches/1.1/application/controllers/devices.php | ||
---|---|---|
*/
|
||
public function delete($device_id = null)
|
||
{
|
||
|
||
if (!isset($device_id))
|
||
{
|
||
Controller::warning(PARAMETER);
|
||
... | ... | |
|
||
$mid = $device->user->member_id;
|
||
|
||
if (!$this->acl_check_delete('Devices_Controller', 'devices', $mid))
|
||
{
|
||
Controller::error(ACCESS);
|
||
}
|
||
|
||
self::delete_device($device_id);
|
||
}
|
||
|
||
/**
|
||
* Deletes device including all its interfaces and ip adresses, etc. (using FK)
|
||
*
|
||
* @author Ondrej Fibich, Jan Dubina
|
||
* @param integer $device_id
|
||
*/
|
||
public static function delete_device($device_id)
|
||
{
|
||
$device = new Device_Model($device_id);
|
||
|
||
if ($device->id == 0)
|
||
{
|
||
throw new Exception('Error - cant delete device');
|
||
}
|
||
|
||
$mid = $device->user->member_id;
|
||
|
||
$subnet_model = new Subnet_Model();
|
||
|
||
$all_subnets = $subnet_model->get_all_unique_subnets_by_device($device->id);
|
||
... | ... | |
|
||
$subnets = array_unique($subnets);
|
||
|
||
if (!$this->acl_check_delete('Devices_Controller', 'devices', $mid))
|
||
if (!Controller::instance()->acl_check_delete('Devices_Controller', 'devices', $mid))
|
||
{
|
||
Controller::error(ACCESS);
|
||
throw new Exception('Error - cant delete device');
|
||
}
|
||
|
||
$linkback = Path::instance()->previous();
|
||
|
||
if (url::slice(url_lang::uri($linkback), 1, 1) == 'show')
|
||
{
|
||
$linkback = 'devices/show_all';
|
||
}
|
||
|
||
|
||
// gets number of maximum of acceptable repeating of operation
|
||
// after reaching of deadlock and time of waiting between
|
||
// other attempt to make transaction (#254)
|
||
$transaction_attempt_counter = 0;
|
||
$max_attempts = max(1, abs(Settings::get('db_trans_deadlock_repeats_count')));
|
||
$timeout = abs(Settings::get('db_trans_deadlock_repeats_timeout'));
|
||
|
||
|
||
/**
|
||
* @TODO repair
|
||
*/
|
||
// try to delete
|
||
while (TRUE)
|
||
{
|
||
/*while (TRUE)
|
||
{*/
|
||
try // try to make DB transction
|
||
{
|
||
$device->transaction_start();
|
||
... | ... | |
|
||
$device->delete_throwable();
|
||
|
||
$device->transaction_commit();
|
||
|
||
try
|
||
{
|
||
Allowed_subnets_Controller::update_enabled($mid, NULL, NULL, $subnets, TRUE);
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
status::warning('Error - cannot update allowed subnets of member.');
|
||
throw new Exception('Error - cannot update allowed subnets of member.');
|
||
}
|
||
|
||
// redirect
|
||
status::success('Device has been successfully deleted.');
|
||
$this->redirect($linkback);
|
||
$device->transaction_commit();
|
||
}
|
||
catch (Exception $e) // failed => rollback and wait 100ms before next attempt
|
||
{
|
||
$device->transaction_rollback();
|
||
|
||
if (++$transaction_attempt_counter >= $max_attempts) // this was last attempt?
|
||
{
|
||
Log::add_exception($e);
|
||
status::error('Error - cant delete device.');
|
||
$this->redirect($linkback);
|
||
throw $e;
|
||
}
|
||
|
||
usleep($timeout);
|
||
//usleep($timeout);
|
||
}
|
||
}
|
||
/*}*/
|
||
}
|
||
|
||
/**
|
freenetis/branches/1.1/application/libraries/Filter_form.php | ||
---|---|---|
|
||
$this->keys = Input::instance()->get('keys');
|
||
$this->vals = Input::instance()->get('vals');
|
||
|
||
|
||
// query is empty, use default from database
|
||
if (!$on && !$types && !$operations && !$values && !$tables && $this->default_query_id)
|
||
{
|
freenetis/branches/1.1/application/views/js/__pieces/settings.php | ||
---|---|---|
<?php
|
||
/**
|
||
* Invoice contact information javascript view.
|
||
* Hides/Shows contact information in invoice form.
|
||
*
|
||
* @author Jan Dubina
|
||
*/
|
||
|
||
// IDE complementation
|
||
if (FALSE): ?><script type="text/javascript"><?php endif
|
||
|
||
?>
|
||
$('input[name=membership_interrupt_enabled]').change(function (){
|
||
var val = $('input[name=membership_interrupt_enabled]:checked').val();
|
||
|
||
if (val != 0) {
|
||
$('th.membership_interrupt_minimum').parent().prev().show();
|
||
$('th.membership_interrupt_minimum').parent().show();
|
||
$('th.membership_interrupt_maximum').parent().show();
|
||
} else {
|
||
$('th.membership_interrupt_minimum').parent().prev().hide();
|
||
$('th.membership_interrupt_minimum').parent().hide();
|
||
$('th.membership_interrupt_maximum').parent().hide();
|
||
}
|
||
}).change();
|
Také k dispozici: Unified diff
Upravy:
fixes #570: Moznost povoleni/zakazani preruseni clenstvi
fixes #572: Zobrazeni vsech faktur - pomaly SQL dotaz
fixes #577: Informace o nezruseni presmerovani po importu plateb
fixes #582: Ukonceni clenstvi - volitelne mazani zarizeni