Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1064

Přidáno uživatelem Ondřej Fibich před více než 13 roky(ů)

Telefonni faktury:
- Pridani informace o vyplneni uzivatelem pro prehlednejsi spravu faktur

Zobrazit rozdíly:

freenetis/branches/testing/media/css/forms.css
padding:0px;
}
.button_big {
padding: 5px;
font-weight: bold;
cursor: pointer;
border: 1px solid #AAA;
}
.form .submit {
width:100px;
margin-top:10px;
freenetis/branches/testing/application/i18n/cs_CZ/texts.php
'allow' => 'Povolit',
'allowed subnets' => 'Povolené podsítě',
'allowed subnets of member' => 'Povolené podsítě člena',
'already filled in' => 'Vyplněno',
'amount' => 'Částka',
'and' => 'a',
'and now, click login' => 'A nyní klikněte na "Přihlásit".',
......
'lock' => 'Zámek',
'lock for others' => 'Uzamknout pro ostatní',
'locked' => 'Uzamčen',
'locked by admin' => 'Uzamčeno administrátorem',
'lock invoice' => 'Zamčít fakturu',
'log in to freenetis system' => 'Přihlásit do systému Freenetis',
'logged user' => 'Přihlášený uživatel',
......
'map' => 'Mapa',
'march' => 'Březen',
'mark all' => 'Označit vše',
'mark this invoice as filled in' => 'Označ tuto fakturu jako vyplněnou',
'maximum count of allowed subnets' => 'Maximální počet povolených podsítí',
'may' => 'Květen',
'medium' => 'Médium',
......
'normal' => 'normální',
'not assigned' => 'Nepřiřazeno',
'not registered' => 'Neregistrovaný',
'not filled in' => 'Nevyplněno',
'not found' => 'Nenalezeno',
'note' => 'Poznámka',
'november' => 'Listopad',
......
'unknown device text' => 'Text pro neznámé zařízení',
'unlimited' => 'neomezený',
'unlogged user' => 'Nepřihlášený uživatel',
'umark this invoice' => 'Odznačit fakturu',
'unread' => 'Nepřečtená',
'unsent' => 'Neodeslaná',
'until' => 'do',
freenetis/branches/testing/application/i18n/cs_CZ/help.php
'other_subaccounts' => 'Ostatní podúčty jsou vlastně již všechny ostatní používané účty ve Freenetisu, které se vnitřně nijak nedělí. Jde například o účet přijatých členských příspěvků nebo pokladny a tak dále. Freenetis pochopitelně nevyužívá celou účetní osnovu ČR, vzhledem k charakteru občanského sdružení.',
'password' => 'Uživatelské heslo musí obsahovat alespoň 8 znaků a musí obsahovat alespoň jedno písmeno nebo číslici.',
'payed_to' => 'Datum, do kdy máte zaplaceny členské příspěvky. Včas před tímto datem byste měli zaplatit členské příspěvky. V případě, že jste s kreditem v mínusu, tak zaplaťte co nejdříve, jinak budete zablokováni.',
'phone_invoice_user_lock' => 'Označí fakturu jako vyplněnou, čímž Vám zabrání další editaci a usnadní přehled o tom které faktury jste již vyplnil(a).',
'phone_invoice_user_unlock' => 'Odznačí fakturu jako vyplněnou, čímž Vám umožní její editaci.',
'price_tax' => 'Cena s DPH',
'project_subaccounts' => 'Projektový účet 221103 pro účetního představuje jeden účet. Zde jsou ovšem rozepsány všechny projektové podúčty z pohledu Freenetisu. Každý člen má právo vytvořit svůj projekt, který je v souladu se stanovami sdružení, může jít například o nějakou akci nebo školení. Cílem takovéhoto projektového podúčtu je, aby ostatní členové měli možnost zakladateli projektu přispět peníze ze svého kreditního účtu na realizaci projektu.',
'recalculate_account_balances' => 'Primárním zdrojem o stavu financí v systému jsou převody. Zůstatky na účtech byly dříve pokaždé počítány na požádání z převodů. Nyní si každý účet ukládá svůj zůstatek kvůli vyšší rychlosti. Tuto funkci použijete v případě přechodu na verzi systému, která tuto optimalizaci obsahuje.',
freenetis/branches/testing/application/helpers/callback.php
echo '<span style="color: red">' . url_lang::lang('texts.no') . '</span>';
}
}
/**
* Callback for showing state of invoice
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
*/
public static function phone_invoice_user_state($item, $name)
{
if ($item->locked == 1)
{
$title = url_lang::lang('texts.Locked by admin');
echo Html::image(array('src' => 'media/images/states/readonly_16x16.png', 'title' => $title));
}
else if ($item->filled == 1)
{
$title = url_lang::lang('texts.Already filled in');
echo Html::image(array('src' => 'media/images/states/good_16x16.png', 'title' => $title));
}
else
{
$title = url_lang::lang('texts.Not filled in');
echo Html::image(array('src' => 'media/images/icons/publish_x.png', 'title' => $title));
}
}
/**
* Callback for phone period field
......
*/
public static function phone_invoice_user_edit_field($item, $name)
{
if ($item->locked == 0)
if ($item->locked == 0 && $item->filled == 0)
{
echo html::anchor(
url_lang::base() . 'phone_invoices/show_details/' .
freenetis/branches/testing/application/models/phone_invoice_user.php
public function get_phone_invoices_of_user($user_id)
{
return $this->db->query("
SELECT p.id, phone_invoices.locked,
phone_invoices.billing_period_from,
phone_invoices.billing_period_to, p.user_id,
SELECT p.id, pi.locked, p.locked AS filled,
pi.billing_period_from,
pi.billing_period_to, p.user_id,
p.phone_number AS number,
((
SELECT IFNULL(SUM(price), 0)
......
)) AS price_private
FROM phone_invoice_users p
LEFT JOIN phone_invoices ON p.phone_invoice_id = phone_invoices.id
LEFT JOIN phone_invoices pi ON p.phone_invoice_id = pi.id
WHERE p.user_id = ?
", $user_id);
}
freenetis/branches/testing/application/controllers/phone_invoices.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is release under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Phone_invoices_Controller managing phone invoices.
*
* @author Ondřej Fibich
* @package Controller
*/
class Phone_invoices_Controller extends Controller
{
/**
* Fuction checks access rights
* Return true if user with $login may view own $axo_section
* in this controller else return false
* @see Phone_invoices_Controller::user_field
*
* @param $axo_value object to view
* @param string $login
* @staticvar gacl $gacl_class
* @return boolean returns true if member has enough access rights
*/
private static function _acl_check_view($axo_value, $login)
{
static $gacl_class = NULL;
if ($gacl_class == NULL)
/**
* Fuction checks access rights
* Return true if user with $login may view own $axo_section
* in this controller else return false
* @see Phone_invoices_Controller::user_field
*
* @param string $axo_value object to view
* @param string $login
* @staticvar gacl $gacl_class
* @return boolean returns true if member has enough access rights
*/
private static function _acl_check_view($axo_value, $login)
{
require_once(APPPATH.'vendors/phpgacl/gacl.class.php');
$gacl_class = new gacl();
}
static $gacl_class = NULL;
return !empty($login) && $gacl_class->acl_check(
'freenetis', 'view_own', 'all',
$login, 'Phone_invoices_Controller', $axo_value
);
}
if ($gacl_class == NULL)
{
require_once(APPPATH . 'vendors/phpgacl/gacl.class.php');
$gacl_class = new gacl();
}
/**
* Index of controller
* Redirects to show_all
*/
public function index()
{
url::redirect(url_lang::base() . 'phone_invoices/show_all');
}
return !empty($login) && $gacl_class->acl_check(
'freenetis', 'view_own', 'all', $login, 'Phone_invoices_Controller', $axo_value
);
}
/**
* Imports invoice and save it to the database.
* Tries to figured out which services was private and which was not.
*/
public function import()
{
if (! $this->acl_check_new('Phone_invoices_Controller', 'invoices'))
/**
* Index of controller
* Redirects to show_all
*/
public function index()
{
Controller::error(ACCESS);
url::redirect(url_lang::base() . 'phone_invoices/show_all');
}
$form = new Forge(url::base(TRUE).url::current(true), '', 'POST', array('id' => 'phone_invoices_form'));
$form->textarea('parse')->label(url_lang::lang('texts.Text to parse') . ':')->rules('required');
$form->checkbox('test_number_count_enabled')->checked(TRUE)->value('1')
->label(url_lang::lang('texts.Enable integrity test (all numbers in invoice has to be in extended statement)'));
$form->submit(url_lang::lang('texts.Parse'))->id('phone_invoices_sumit');
/**
* Imports invoice and save it to the database.
* Tries to figured out which services was private and which was not.
*/
public function import()
{
if (!$this->acl_check_new('Phone_invoices_Controller', 'invoices'))
{
Controller::error(ACCESS);
}
if ($form->validate())
{
try
{
$integrity_test = ($form->test_number_count_enabled->value == '1');
$data = Parser_Vodafone_Invoice::parse($form->parse->value, $integrity_test);
$form = new Forge(url::base(TRUE) . url::current(true), '', 'POST', array('id' => 'phone_invoices_form'));
$form->textarea('parse')->label(url_lang::lang('texts.Text to parse') . ':')->rules('required');
$form->checkbox('test_number_count_enabled')->checked(TRUE)->value('1')
->label(url_lang::lang('texts.Enable integrity test (all numbers in invoice has to be in extended statement)'));
$form->submit(url_lang::lang('texts.Parse'))->id('phone_invoices_sumit');
$phone_invoice = new Phone_invoice_Model();
$phone_invoice->set_logger(FALSE);
$phone_invoice->date_of_issuance = $data->date_of_issuance->format('Y-m-d');
$phone_invoice->billing_period_from = $data->billing_period_from->format('Y-m-d');
$phone_invoice->billing_period_to = $data->billing_period_to->format('Y-m-d');
$phone_invoice->variable_symbol = $data->variable_symbol;
$phone_invoice->specific_symbol = $data->specific_symbol;
$phone_invoice->total_price = $data->total_price;
$phone_invoice->tax = $data->dph;
$phone_invoice->tax_rate = $data->dph_rate;
if ($form->validate())
{
try
{
$integrity_test = ($form->test_number_count_enabled->value == '1');
$data = Parser_Vodafone_Invoice::parse($form->parse->value, $integrity_test);
// search if invoice is already in database
$phone_invoice->is_unique();
if (!$phone_invoice->is_unique())
{
throw new Exception(url_lang::lang('texts.Invoice is already in database'));
}
$phone_invoice = new Phone_invoice_Model();
$phone_invoice->set_logger(FALSE);
$phone_invoice->date_of_issuance = $data->date_of_issuance->format('Y-m-d');
$phone_invoice->billing_period_from = $data->billing_period_from->format('Y-m-d');
$phone_invoice->billing_period_to = $data->billing_period_to->format('Y-m-d');
$phone_invoice->variable_symbol = $data->variable_symbol;
$phone_invoice->specific_symbol = $data->specific_symbol;
$phone_invoice->total_price = $data->total_price;
$phone_invoice->tax = $data->dph;
$phone_invoice->tax_rate = $data->dph_rate;
self::_set_invoice_data($data, $phone_invoice);
// search if invoice is already in database
$phone_invoice->is_unique();
if (!$phone_invoice->is_unique())
{
throw new Exception(url_lang::lang('texts.Invoice is already in database'));
}
// redirect to edit
url::redirect(url_lang::base() . '/phone_invoices/show/' . $phone_invoice->id . '/');
}
catch (Exception $e)
{
$form->parse->add_error('requied', nl2br($e->getMessage()));
}
}
self::_set_invoice_data($data, $phone_invoice);
$view = new View('main');
$view->title = url_lang::lang('texts.Import invoice');
$view->content = new View('phone_invoices/main');
$view->content->content = new View('phone_invoices/import');
$view->content->content->form = $form->html();
$view->render(TRUE);
}
// redirect to edit
url::redirect(url_lang::base() . '/phone_invoices/show/' . $phone_invoice->id . '/');
}
catch (Exception $e)
{
$form->parse->add_error('requied', nl2br($e->getMessage()));
}
}
/**
* Shows all invoices.
* Enable delete invoice.
*/
public function show_all()
{
if (! $this->acl_check_view('Phone_invoices_Controller', 'invoices'))
{
Controller::error(ACCESS);
$view = new View('main');
$view->title = url_lang::lang('texts.Import invoice');
$view->content = new View('phone_invoices/main');
$view->content->content = new View('phone_invoices/import');
$view->content->content->form = $form->html();
$view->render(TRUE);
}
$phone_invoice_model = new Phone_invoice_Model();
$query = $phone_invoice_model->get_all_phone_invoices();
$grid = new Grid(url::base(TRUE).url::current(true), null, array(
'use_paginator' => false,
'use_selector' => false
));
/**
* Shows all invoices.
* Enable delete invoice.
*/
public function show_all()
{
if (!$this->acl_check_view('Phone_invoices_Controller', 'invoices'))
{
Controller::error(ACCESS);
}
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('date_of_issuance')->label(url_lang::lang('texts.Date of issue'));
$grid->field('billing_period_from')->label(url_lang::lang('texts.Billing period from'));
$grid->field('billing_period_to')->label(url_lang::lang('texts.Billing period to'));
$grid->field('variable_symbol')->label(url_lang::lang('texts.Variable symbol'));
$grid->field('specific_symbol')->label(url_lang::lang('texts.Specific symbol'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price vat'))
->callback('callback::phone_price_field');
$phone_invoice_model = new Phone_invoice_Model();
$grid->callback_field('edit')->label(url_lang::lang('texts.Edit'))
->callback('callback::phone_invoice_edit_field');
$query = $phone_invoice_model->get_all_phone_invoices();
$grid->callback_field('delete')->label(url_lang::lang('texts.Delete'))
->callback('callback::phone_invoice_delete_field');
$grid = new Grid(url::base(TRUE) . url::current(true), null, array(
'use_paginator' => false,
'use_selector' => false
));
$grid->datasource($query);
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('date_of_issuance')->label(url_lang::lang('texts.Date of issue'));
$grid->field('billing_period_from')->label(url_lang::lang('texts.Billing period from'));
$grid->field('billing_period_to')->label(url_lang::lang('texts.Billing period to'));
$grid->field('variable_symbol')->label(url_lang::lang('texts.Variable symbol'));
$grid->field('specific_symbol')->label(url_lang::lang('texts.Specific symbol'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price vat'))
->callback('callback::phone_price_field');
$view = new View('main');
$view->title = url_lang::lang('texts.Show all invoices');
$view->content = new View('phone_invoices/main');
$view->content->content = new View('phone_invoices/show_all');
$view->content->content->grid = $grid;
$view->render(TRUE);
}
$grid->callback_field('edit')->label(url_lang::lang('texts.Edit'))
->callback('callback::phone_invoice_edit_field');
/**
* Displays detail of invoice and list of phone numbers on invoice
* Enable assign user to each detail
* @param integer $phone_invoice_id
* @param integer $phone_invoice_user_id
*/
public function show($phone_invoice_id = -1, $phone_invoice_user_id = -1)
{
if (! $this->acl_check_view('Phone_invoices_Controller', 'details'))
{
Controller::error(ACCESS);
$grid->callback_field('delete')->label(url_lang::lang('texts.Delete'))
->callback('callback::phone_invoice_delete_field');
$grid->datasource($query);
$view = new View('main');
$view->title = url_lang::lang('texts.Show all invoices');
$view->content = new View('phone_invoices/main');
$view->content->content = new View('phone_invoices/show_all');
$view->content->content->grid = $grid;
$view->render(TRUE);
}
$phone_invoice = new Phone_invoice_Model($phone_invoice_id);
if (!$phone_invoice_id || !$phone_invoice->id)
{
url::redirect(url_lang::base().'phone_invoices');
}
$form = NULL;
if ($this->acl_check_edit('Phone_invoices_Controller', 'details'))
/**
* Displays detail of invoice and list of phone numbers on invoice
* Enable assign user to each detail
* @param integer $phone_invoice_id
* @param integer $phone_invoice_user_id
*/
public function show($phone_invoice_id = -1, $phone_invoice_user_id = -1)
{
if (intval($phone_invoice_user_id) >= 0)
{
$phone_inv_user_model = new Phone_invoice_user_Model($phone_invoice_user_id);
$user = new User_Model();
$users = $user->get_all_user_names();
$users_data = array();
if (!$phone_inv_user_model->id)
if (!$this->acl_check_view('Phone_invoices_Controller', 'details'))
{
Controller::error(RECORD);
Controller::error(ACCESS);
}
foreach ($users as $u)
$phone_invoice = new Phone_invoice_Model($phone_invoice_id);
if (!$phone_invoice_id || !$phone_invoice->id)
{
$users_data[$u->id] = $u->username;
url::redirect(url_lang::base() . 'phone_invoices');
}
$form = new Forge(url::base(TRUE).url::current(true), '', 'POST', array('id' => 'phone_invoices_form'));
$form->dropdown('user_id')->label(url_lang::lang('texts.Phone') .' '. $phone_inv_user_model->phone_number)
->options($users_data)->selected($phone_inv_user_model->user_id)->rules('required');
if ($form->validate())
$form = NULL;
if ($this->acl_check_edit('Phone_invoices_Controller', 'details'))
{
$phone_inv_user_model->user_id = $form->user_id->value;
$phone_inv_user_model->save();
if (intval($phone_invoice_user_id) >= 0)
{
$phone_inv_user_model = new Phone_invoice_user_Model($phone_invoice_user_id);
$user = new User_Model();
$users = $user->get_all_user_names();
$users_data = array();
$this->session->set_flash('message', 'User has been assigned');
url::redirect(url_lang::base().'phone_invoices/show/'.$phone_invoice_id);
}
if (!$phone_inv_user_model->id)
{
Controller::error(RECORD);
}
$form->submit(url_lang::lang('texts.Save'));
}
}
foreach ($users as $u)
{
$users_data[$u->id] = $u->username;
}
$grid = new Grid(url_lang::base().'phone_invoices/show', NULL, array(
'use_paginator' => false,
'use_selector' => false
));
$form = new Forge(url::base(TRUE) . url::current(true), '', 'POST', array('id' => 'phone_invoices_form'));
$form->dropdown('user_id')->label(url_lang::lang('texts.Phone') . ' ' . $phone_inv_user_model->phone_number)
->options($users_data)->selected($phone_inv_user_model->user_id)->rules('required');
$phone_inv_user_model = new Phone_invoice_user_Model();
$query = $phone_inv_user_model->get_all_invoice_users($phone_invoice->id);
if ($form->validate())
{
$phone_inv_user_model->user_id = $form->user_id->value;
$phone_inv_user_model->save();
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('phone_number')->label(url_lang::lang('texts.Phone number'));
$grid->callback_field('user')->label(url_lang::lang('texts.User'))
->callback('Phone_invoices_Controller::user_field');
$grid->callback_field('price_private')->label(url_lang::lang('texts.Private').'&nbsp;'.help::hint('price_tax'))
->callback('callback::phone_price_field');
$grid->callback_field('price_company')->label(url_lang::lang('texts.Company').'&nbsp;'.help::hint('price_tax'))
->callback('callback::phone_price_field');
$grid->action_field('id')->label(url_lang::lang('texts.Show details'))
->url(url_lang::base().'phone_invoices/show_details')
->action(url_lang::lang('texts.Show'));
$this->session->set_flash('message', 'User has been assigned');
url::redirect(url_lang::base() . 'phone_invoices/show/' . $phone_invoice_id);
}
if ($this->acl_check_edit('Phone_invoices_Controller', 'details') &&
$phone_invoice->locked == 0)
{
$grid->action_field('id')->label(url_lang::lang('texts.Assign user'))
->url(url_lang::base().'phone_invoices/show/'.$phone_invoice->id)
->action(url_lang::lang('texts.Assign'));
}
$form->submit(url_lang::lang('texts.Save'));
}
}
if ($this->acl_check_delete('Phone_invoices_Controller', 'details') &&
$phone_invoice->locked == 0)
{
$grid->action_field('id')->label(url_lang::lang('texts.Delete'))
->url(url_lang::base().'phone_invoices/delete_user_invoice')
->action(url_lang::lang('texts.Delete'))->class('a_delete');
}
$grid = new Grid(url_lang::base() . 'phone_invoices/show', NULL, array(
'use_paginator' => false,
'use_selector' => false
));
$grid->datasource($query);
$phone_inv_user_model = new Phone_invoice_user_Model();
$query = $phone_inv_user_model->get_all_invoice_users($phone_invoice->id);
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('phone_number')->label(url_lang::lang('texts.Phone number'));
$grid->callback_field('user')->label(url_lang::lang('texts.User'))
->callback('Phone_invoices_Controller::user_field');
$grid->callback_field('price_private')->label(url_lang::lang('texts.Private') . '&nbsp;' . help::hint('price_tax'))
->callback('callback::phone_price_field');
$grid->callback_field('price_company')->label(url_lang::lang('texts.Company') . '&nbsp;' . help::hint('price_tax'))
->callback('callback::phone_price_field');
$grid->action_field('id')->label(url_lang::lang('texts.Show details'))
->url(url_lang::base() . 'phone_invoices/show_details')
->action(url_lang::lang('texts.Show'));
$view = new View('main');
$view->title = url_lang::lang('texts.Detail of invoice');
$view->content = new View('phone_invoices/main');
$view->content->content = new View('phone_invoices/show');
$view->content->content->phone_invoice = $phone_invoice;
$view->content->content->total_price = $phone_invoice->total_price + $phone_invoice->tax;
$view->content->content->grid = $grid;
if ($this->acl_check_edit('Phone_invoices_Controller', 'details') &&
$phone_invoice->locked == 0)
{
$grid->action_field('id')->label(url_lang::lang('texts.Assign user'))
->url(url_lang::base() . 'phone_invoices/show/' . $phone_invoice->id)
->action(url_lang::lang('texts.Assign'));
}
if ($form != NULL)
{
$view->content->content->form = $form->html();
}
$view->render(TRUE);
}
if ($this->acl_check_delete('Phone_invoices_Controller', 'details') &&
$phone_invoice->locked == 0)
{
$grid->action_field('id')->label(url_lang::lang('texts.Delete'))
->url(url_lang::base() . 'phone_invoices/delete_user_invoice')
->action(url_lang::lang('texts.Delete'))->class('a_delete');
}
/**
* Deletes invoice
* @param integer $phone_invoice_id
*/
public function delete($phone_invoice_id = 0)
{
if (! $this->acl_check_delete('Phone_invoices_Controller', 'invoices'))
{
Controller::error(ACCESS);
}
$grid->datasource($query);
if (intval($phone_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
$phone_invoice = new Phone_invoice_Model($phone_invoice_id);
if (!$phone_invoice->id)
{
Controller::error(RECORD);
}
$view = new View('main');
$view->title = url_lang::lang('texts.Detail of invoice');
$view->content = new View('phone_invoices/main');
$view->content->content = new View('phone_invoices/show');
$view->content->content->phone_invoice = $phone_invoice;
$view->content->content->total_price = $phone_invoice->total_price + $phone_invoice->tax;
$view->content->content->grid = $grid;
$phone_invoice->delete();
$this->session->set_flash('message', url_lang::lang('texts.Phone invoice has been deleted'));
url::redirect(url_lang::base().'phone_invoices');
}
if ($form != NULL)
{
$view->content->content->form = $form->html();
}
/**
* Deletes user phone invoice
* @param integer $phone_invoice_id
* @param integer $phone_user_invoice_id
*/
public function delete_user_invoice($phone_user_invoice_id)
{
if (! $this->acl_check_delete('Phone_invoices_Controller', 'details'))
{
Controller::error(ACCESS);
$view->render(TRUE);
}
if (intval($phone_user_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
/**
* Deletes invoice
* @param integer $phone_invoice_id
*/
public function delete($phone_invoice_id = 0)
{
if (!$this->acl_check_delete('Phone_invoices_Controller', 'invoices'))
{
Controller::error(ACCESS);
}
$phone_user_invoice = new Phone_invoice_user_Model($phone_user_invoice_id);
if (intval($phone_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
if (!$phone_user_invoice->id)
{
Controller::error(RECORD);
$phone_invoice = new Phone_invoice_Model($phone_invoice_id);
if (!$phone_invoice->id)
{
Controller::error(RECORD);
}
$phone_invoice->delete();
$this->session->set_flash('message', url_lang::lang('texts.Phone invoice has been deleted'));
url::redirect(url_lang::base() . 'phone_invoices');
}
$phone_invoice_id = $phone_user_invoice->phone_invoice_id;
$phone_user_invoice->delete();
$this->session->set_flash('message', url_lang::lang('texts.Users phone invoice has been deleted'));
url::redirect(url_lang::base().'phone_invoices/show/'.$phone_invoice_id);
}
/**
* (Un)Lock invoice for editing
* @param integer $phone_invoice_id
*/
public function lock_set($phone_invoice_id = 0)
{
if (! $this->acl_check_new('Phone_invoices_Controller', 'lock'))
/**
* Deletes user phone invoice
* @param integer $phone_invoice_id
* @param integer $phone_user_invoice_id
*/
public function delete_user_invoice($phone_user_invoice_id)
{
Controller::error(ACCESS);
}
if (!$this->acl_check_delete('Phone_invoices_Controller', 'details'))
{
Controller::error(ACCESS);
}
if (intval($phone_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
if (intval($phone_user_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
$phone_invoice = new Phone_invoice_Model($phone_invoice_id);
$phone_user_invoice = new Phone_invoice_user_Model($phone_user_invoice_id);
if (!$phone_invoice->id)
{
Controller::error(RECORD);
if (!$phone_user_invoice->id)
{
Controller::error(RECORD);
}
$phone_invoice_id = $phone_user_invoice->phone_invoice_id;
$phone_user_invoice->delete();
$this->session->set_flash('message', url_lang::lang('texts.Users phone invoice has been deleted'));
url::redirect(url_lang::base() . 'phone_invoices/show/' . $phone_invoice_id);
}
$phone_invoice->locked = ! $phone_invoice->locked;
$phone_invoice->save();
$this->session->set_flash('message', url_lang::lang('texts.Phone invoice has been') . ' ' .
url_lang::lang('texts.'. (! $phone_invoice->locked ? 'un' : '') . 'locked'));
url::redirect(url_lang::base().'phone_invoices/show/'.$phone_invoice_id);
}
/**
* Sends warning to users which numbers are on invoice.
* @see Mail_messages_Model
* @param integer $phone_invoice_id
*/
public function post_mail_warning($phone_invoice_id)
{
if (! $this->acl_check_new('Phone_invoices_Controller', 'mail_warning'))
/**
* (Un)Lock invoice for editing
* @param integer $phone_invoice_id
*/
public function lock_set($phone_invoice_id = 0)
{
Controller::error(ACCESS);
}
if (!$this->acl_check_new('Phone_invoices_Controller', 'lock'))
{
Controller::error(ACCESS);
}
if (intval($phone_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
if (intval($phone_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
$phone_invoice_model = new Phone_invoice_Model($phone_invoice_id);
$phone_invoice = new Phone_invoice_Model($phone_invoice_id);
if (!$phone_invoice_model->id)
{
Controller::error(RECORD);
if (!$phone_invoice->id)
{
Controller::error(RECORD);
}
$phone_invoice->locked = !$phone_invoice->locked;
$phone_invoice->save();
$this->session->set_flash('message', url_lang::lang('texts.Phone invoice has been') . ' ' .
url_lang::lang('texts.' . (!$phone_invoice->locked ? 'un' : '') . 'locked'));
url::redirect(url_lang::base() . 'phone_invoices/show/' . $phone_invoice_id);
}
$phone_invoice_user_model = new Phone_invoice_user_Model();
$phone_invoice_users = $phone_invoice_user_model->get_all_invoice_users($phone_invoice_model->id);
$mail_messsage_model = new Mail_message_Model();
foreach ($phone_invoice_users as $phone_invoice_user)
/**
* Sends warning to users which numbers are on invoice.
* @see Mail_messages_Model
* @param integer $phone_invoice_id
*/
public function post_mail_warning($phone_invoice_id)
{
if ($phone_invoice_user->user_id == 0)
{
continue;
}
if (!$this->acl_check_new('Phone_invoices_Controller', 'mail_warning'))
{
Controller::error(ACCESS);
}
$mail_messsage_model->from_id = $this->session->get('user_id');
$mail_messsage_model->to_id = $phone_invoice_user->user_id;
$mail_messsage_model->time = date('Y-m-d H:i:s');
$mail_messsage_model->from_deleted = 1;// user to can delete it
$mail_messsage_model->subject = mail_message::format(
'phone_invoice_warning_subject', array(
$phone_invoice_user->phone_number,
$phone_invoice_model->billing_period_from,
$phone_invoice_model->billing_period_to
));
$mail_messsage_model->body = mail_message::format(
'phone_invoice_warning', array(
$phone_invoice_user->phone_number,
url_lang::base() . 'phone_invoices/show_by_user/' . $phone_invoice_user->user_id
));
$mail_messsage_model->save();
$mail_messsage_model->clear();
}
if (intval($phone_invoice_id) <= 0)
{
Controller::warning(PARAMETER);
}
$this->session->set_flash('message', url_lang::lang('texts.Users has been warned about invoice.'));
url::redirect(url_lang::base().'phone_invoices/show/'.$phone_invoice_id);
}
$phone_invoice_model = new Phone_invoice_Model($phone_invoice_id);
/**
* Displays users phone invoices
* @param integer $user_id
*/
public function show_by_user($user_id = 0)
{
if (!is_numeric($user_id) || $user_id <= 0)
{
Controller::warning(PARAMETER);
}
if (!$phone_invoice_model->id)
{
Controller::error(RECORD);
}
$user = new User_Model($user_id);
$phone_invoice_user_model = new Phone_invoice_user_Model();
$phone_invoice_users = $phone_invoice_user_model->get_all_invoice_users($phone_invoice_model->id);
if (!$user->id)
{
Controller::error(RECORD);
}
$mail_messsage_model = new Mail_message_Model();
if (! $this->acl_check_view('Phone_invoices_Controller', 'user_invoices', $user->member_id))
{
Controller::error(ACCESS);
}
foreach ($phone_invoice_users as $phone_invoice_user)
{
if ($phone_invoice_user->user_id == 0)
{
continue;
}
$phone_inv_user_model = new Phone_invoice_user_Model();
$users_inv = $phone_inv_user_model->get_phone_invoices_of_user($user_id);
$mail_messsage_model->from_id = $this->session->get('user_id');
$mail_messsage_model->to_id = $phone_invoice_user->user_id;
$mail_messsage_model->time = date('Y-m-d H:i:s');
$mail_messsage_model->from_deleted = 1; // user to can delete it
$mail_messsage_model->subject = mail_message::format(
'phone_invoice_warning_subject', array(
$phone_invoice_user->phone_number,
$phone_invoice_model->billing_period_from,
$phone_invoice_model->billing_period_to
));
$mail_messsage_model->body = mail_message::format(
'phone_invoice_warning', array(
$phone_invoice_user->phone_number,
url_lang::base() . 'phone_invoices/show_by_user/' . $phone_invoice_user->user_id
));
$mail_messsage_model->save();
$mail_messsage_model->clear();
}
$grid = new Grid(url::base(TRUE).url::current(true), null, array(
'use_paginator' => false,
'use_selector' => false
));
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('number')->label(url_lang::lang('texts.Number'));
$grid->field('billing_period_from')->label(url_lang::lang('texts.Billing period from'));
$grid->field('billing_period_to')->label(url_lang::lang('texts.Billing period to'));
$grid->callback_field('price_company')->label(url_lang::lang('texts.Company'))
->callback('callback::phone_price_field');
$grid->callback_field('price_private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_price_field');
if ($this->acl_check_view('Phone_invoices_Controller', 'dumps', $user->member_id))
{
$grid->action_field('id')->label(url_lang::lang('texts.Show'))
->url(url_lang::base().'phone_invoices/show_details')->action(url_lang::lang('texts.Show'));
$this->session->set_flash('message', url_lang::lang('texts.Users has been warned about invoice.'));
url::redirect(url_lang::base() . 'phone_invoices/show/' . $phone_invoice_id);
}
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id))
/**
* Displays users phone invoices
* @param integer $user_id
*/
public function show_by_user($user_id = 0)
{
$grid->callback_field('edit')->label(url_lang::lang('texts.Edit'))
->callback('callback::phone_invoice_user_edit_field');
}
if (!is_numeric($user_id) || $user_id <= 0)
{
Controller::warning(PARAMETER);
}
$grid->datasource($users_inv);
$user = new User_Model($user_id);
$view = new View('main');
$view->title = url_lang::lang('texts.Phone invoices of user');
$view->content = new View('phone_invoices/show_by_user');
$view->content->grid = $grid;
$view->content->total_prices = $phone_inv_user_model->get_total_prices($user_id);
$view->render(TRUE);
}
if (!$user->id)
{
Controller::error(RECORD);
}
/**
* Show details of phone number on invoice.
* Show sum of price of each service.
* Show payment which has to be done by user.
* Show detail extract of services, enable to set or unset private services
* @param integer $phone_invoice_user_id
* @param string $detail_of
*/
public function show_details($phone_invoice_user_id = 0, $detail_of = 'calls')
{
$detail_of_arrgs = array(
'calls', 'fixed_calls', 'pays', 'connections', 'pays', 'vpn_calls',
'sms_messages', 'roaming_sms_messages'
);
if (!$this->acl_check_view('Phone_invoices_Controller', 'user_invoices', $user->member_id))
{
Controller::error(ACCESS);
}
$detail_of_arrgs_intelligent_search = array(
'calls', 'fixed_calls', 'sms_messages', 'roaming_sms_messages'
);
$phone_inv_user_model = new Phone_invoice_user_Model();
$users_inv = $phone_inv_user_model->get_phone_invoices_of_user($user_id);
if (!$phone_invoice_user_id || !is_numeric($phone_invoice_user_id))
{
Controller::warning(PARAMETER);
}
$grid = new Grid(url::base(TRUE) . url::current(true), null, array(
'use_paginator' => false,
'use_selector' => false
));
if (array_search($detail_of, $detail_of_arrgs) === false)
{
url::redirect(url_lang::base().'phone_invoices/show_details/'.$phone_invoice_user_id.'/calls');
}
$phone_inv_user_model = new Phone_invoice_user_Model($phone_invoice_user_id);
$grid->callback_field('state')->label('')->callback('callback::phone_invoice_user_state');
$grid->field('number')->label(url_lang::lang('texts.Number'));
$grid->field('billing_period_from')->label(url_lang::lang('texts.Billing period from'));
$grid->field('billing_period_to')->label(url_lang::lang('texts.Billing period to'));
$grid->callback_field('price_company')->label(url_lang::lang('texts.Company'))
->callback('callback::phone_price_field');
$grid->callback_field('price_private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_price_field');
if (!$phone_inv_user_model->id)
{
Controller::error(RECORD);
}
if ($this->acl_check_view('Phone_invoices_Controller', 'dumps', $user->member_id))
{
$grid->action_field('id')->label(url_lang::lang('texts.Show'))
->url(url_lang::base() . 'phone_invoices/show_details')
->action(url_lang::lang('texts.Show'));
}
$user = new User_Model($phone_inv_user_model->user_id);
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id))
{
$grid->callback_field('edit')->label(url_lang::lang('texts.Edit'))
->callback('callback::phone_invoice_user_edit_field');
}
if (! $this->acl_check_view('Phone_invoices_Controller', 'dumps') &&
! $this->acl_check_view('Phone_invoices_Controller', 'dumps', $user->member_id))
{
Controller::error(ACCESS);
$grid->datasource($users_inv);
$view = new View('main');
$view->title = url_lang::lang('texts.Phone invoices of user');
$view->content = new View('phone_invoices/show_by_user');
$view->content->grid = $grid;
$view->content->total_prices = $phone_inv_user_model->get_total_prices($user_id);
$view->render(TRUE);
}
$phone_inv_model = new Phone_invoice_Model($phone_inv_user_model->phone_invoice_id);
/**
* Show details of phone number on invoice.
* Show sum of price of each service.
* Show payment which has to be done by user.
* Show detail extract of services, enable to set or unset private services
* @param integer $phone_invoice_user_id
* @param string $detail_of
*/
public function show_details($phone_invoice_user_id = 0, $detail_of = 'calls')
{
$detail_of_arrgs = array(
'calls', 'fixed_calls', 'pays', 'connections', 'pays', 'vpn_calls',
'sms_messages', 'roaming_sms_messages'
);
$grid = new Grid(url_lang::base().'phone_invoices/show_details', NULL, array(
'use_paginator' => false,
'use_selector' => false
));
$detail_of_arrgs_intelligent_search = array(
'calls', 'fixed_calls', 'sms_messages', 'roaming_sms_messages'
);
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('datetime')->label(url_lang::lang('texts.Date'));
if (!$phone_invoice_user_id || !is_numeric($phone_invoice_user_id))
{
Controller::warning(PARAMETER);
}
$heading = null;
if (array_search($detail_of, $detail_of_arrgs) === false)
{
url::redirect(url_lang::base() . 'phone_invoices/show_details/' . $phone_invoice_user_id . '/calls');
}
switch ($detail_of)
{
case 'calls':
$call = new Phone_call_Model();
$phone_inv_user_model = new Phone_invoice_user_Model($phone_invoice_user_id);
$grid->callback_field('number')->label(url_lang::lang('texts.Called number'))
->callback('callback::phone_number_field');
if (!$phone_inv_user_model->id)
{
Controller::error(RECORD);
}
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
$user = new User_Model($phone_inv_user_model->user_id);
if (!$this->acl_check_view('Phone_invoices_Controller', 'dumps') &&
!$this->acl_check_view('Phone_invoices_Controller', 'dumps', $user->member_id))
{
if ($_POST && count($_POST))
{
$call->set_calls_private($phone_inv_user_model->id, @$_POST['private']);
}
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
Controller::error(ACCESS);
}
else
// save locking by user
if ($_POST && array_key_exists('phone_user_invoice_lock', $_POST))
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
$phone_inv_user_model->locked = ($_POST['phone_user_invoice_lock'] == 'lock') ? 1 : 0;
$phone_inv_user_model->save();
unset($_POST['phone_user_invoice_lock']);
}
$grid->field('length')->label(url_lang::lang('texts.Length'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->datasource($call->get_calls_from($phone_inv_user_model->id));
$phone_inv_model = new Phone_invoice_Model($phone_inv_user_model->phone_invoice_id);
$heading = url_lang::lang('texts.Calls');
break;
case 'fixed_calls':
$call = new Phone_fixed_call_Model();
$grid = new Grid(url_lang::base() . 'phone_invoices/show_details', NULL, array(
'use_paginator' => false,
'use_selector' => false
));
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('datetime')->label(url_lang::lang('texts.Date'));
$grid->callback_field('number')->label(url_lang::lang('texts.Called number'))
->callback('callback::phone_number_field');
$heading = null;
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
switch ($detail_of)
{
if ($_POST && count($_POST))
{
$call->set_fixed_calls_private($phone_inv_user_model->id, @$_POST['private']);
}
case 'calls':
$call = new Phone_call_Model();
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->callback_field('number')->label(url_lang::lang('texts.Called number'))
->callback('callback::phone_number_field');
$grid->field('length')->label(url_lang::lang('texts.Length'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->field('destiny')->label(url_lang::lang('texts.Destination'));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$phone_inv_user_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$call->set_calls_private($phone_inv_user_model->id, @$_POST['private']);
}
$grid->datasource($call->get_fixed_calls_from($phone_inv_user_model->id));
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$heading = url_lang::lang('texts.Fixed calls');
break;
case 'vpn_calls':
$call = new Phone_vpn_call_Model();
$grid->field('length')->label(url_lang::lang('texts.Length'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->callback_field('number')->label(url_lang::lang('texts.Called number'))
->callback('callback::phone_number_field');
$grid->datasource($call->get_calls_from($phone_inv_user_model->id));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$call->set_vpn_calls_private($phone_inv_user_model->id, @$_POST['private']);
}
$heading = url_lang::lang('texts.Calls');
break;
case 'fixed_calls':
$call = new Phone_fixed_call_Model();
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->field('length')->label(url_lang::lang('texts.Length'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->field('group')->label(url_lang::lang('texts.Group'));
$grid->callback_field('number')->label(url_lang::lang('texts.Called number'))
->callback('callback::phone_number_field');
$grid->datasource($call->get_vpn_calls_from($phone_inv_user_model->id));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$phone_inv_user_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$call->set_fixed_calls_private($phone_inv_user_model->id, @$_POST['private']);
}
$heading = url_lang::lang('texts.VPN calls');
break;
case 'sms_messages':
$sms = new Phone_sms_message_Model();
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->callback_field('number')->label(url_lang::lang('texts.Number'))
->callback('callback::phone_number_field');
$grid->field('length')->label(url_lang::lang('texts.Length'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->field('destiny')->label(url_lang::lang('texts.Destination'));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$sms->set_sms_mesages_private($phone_inv_user_model->id, @$_POST['private']);
}
$grid->datasource($call->get_fixed_calls_from($phone_inv_user_model->id));
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$heading = url_lang::lang('texts.Fixed calls');
break;
case 'vpn_calls':
$call = new Phone_vpn_call_Model();
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->field('description')->label(url_lang::lang('texts.Description'));
$grid->callback_field('number')->label(url_lang::lang('texts.Called number'))
->callback('callback::phone_number_field');
$grid->datasource($sms->get_sms_mesages_from($phone_inv_user_model->id));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$phone_inv_user_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$call->set_vpn_calls_private($phone_inv_user_model->id, @$_POST['private']);
}
$heading = url_lang::lang('texts.SMS messages');
break;
case 'roaming_sms_messages':
$sms = new Phone_roaming_sms_message_Model();
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->field('roaming_zone')->label(url_lang::lang('texts.Roaming zone'));
$grid->field('length')->label(url_lang::lang('texts.Length'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->field('group')->label(url_lang::lang('texts.Group'));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$sms->set_roaming_sms_messages_private($phone_inv_user_model->id, @$_POST['private']);
}
$grid->datasource($call->get_vpn_calls_from($phone_inv_user_model->id));
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false);
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->datasource($sms->get_roaming_sms_messages_from($phone_inv_user_model->id));
$heading = url_lang::lang('texts.VPN calls');
break;
case 'sms_messages':
$sms = new Phone_sms_message_Model();
$heading = url_lang::lang('texts.SMS messages');
break;
case 'pays':
$pay = new Phone_pay_Model();
$grid->callback_field('number')->label(url_lang::lang('texts.Number'))
->callback('callback::phone_number_field');
$grid->callback_field('number')->label(url_lang::lang('texts.Number'))
->callback('callback::phone_number_field');
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->field('description')->label(url_lang::lang('texts.Description'));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$phone_inv_user_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$sms->set_sms_mesages_private($phone_inv_user_model->id, @$_POST['private']);
}
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$pay->set_pays_private($phone_inv_user_model->id, @$_POST['private']);
}
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false)->callback('callback::phone_private_checkbox');
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->field('description')->label(url_lang::lang('texts.Description'));
$grid->datasource($pay->get_pays_from($phone_inv_user_model->id));
$grid->datasource($sms->get_sms_mesages_from($phone_inv_user_model->id));
$heading = url_lang::lang('texts.Pays');
break;
case 'connections':
$conn = new Phone_connection_Model();
$heading = url_lang::lang('texts.SMS messages');
break;
case 'roaming_sms_messages':
$sms = new Phone_roaming_sms_message_Model();
$grid->field('transfered')->label(url_lang::lang('texts.Transfered'));
$grid->callback_field('period')->label(url_lang::lang('texts.Period'))
->callback('callback::phone_period_field');
$grid->field('apn')->label(url_lang::lang('texts.APN'));
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->field('roaming_zone')->label(url_lang::lang('texts.Roaming zone'));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$conn->set_connections_private($phone_inv_user_model->id, @$_POST['private']);
}
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$phone_inv_user_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
{
$sms->set_roaming_sms_messages_private($phone_inv_user_model->id, @$_POST['private']);
}
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false);
$grid->form_field('private')->label(url_lang::lang('texts.Private'))
->type('checkbox')->order(false);
}
else
{
$grid->callback_field('private')->label(url_lang::lang('texts.Private'))
->callback('callback::phone_invoice_private_field_locked');
}
$grid->datasource($sms->get_roaming_sms_messages_from($phone_inv_user_model->id));
$heading = url_lang::lang('texts.SMS messages');
break;
case 'pays':
$pay = new Phone_pay_Model();
$grid->callback_field('number')->label(url_lang::lang('texts.Number'))
->callback('callback::phone_number_field');
$grid->callback_field('price')->label(url_lang::lang('texts.Price'))
->callback('callback::phone_price_field');
$grid->field('description')->label(url_lang::lang('texts.Description'));
if ($this->acl_check_edit('Phone_invoices_Controller', 'dumps') ||
($phone_inv_model->locked == 0 &&
$phone_inv_user_model->locked == 0 &&
$this->acl_check_edit('Phone_invoices_Controller', 'dumps', $user->member_id)))
{
if ($_POST && count($_POST))
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff