Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1247

Přidáno uživatelem Ondřej Fibich před asi 13 roky(ů)

Upravy:

- foltry u pracovnich vykazu
- rozdeleni pracovnich vykazu podle typu platby (hotove/kreditem)
- prazdna hodnota tabulky u Form_filteru

Opravy:

- oprava vzhledu jQuery UI prvku
- oprava chyby v Bank_tranfer_Model::get_transaction_code_duplicities (bez kontroly na prazdne pole v argumentu)

Zobrazit rozdíly:

freenetis/branches/testing/media/css/style.css
background: none ! important;
}
.ui-widget-content {
#tabs {
border-width: 0px ! important;
}
freenetis/branches/testing/application/i18n/cs_CZ/texts.php
'pay from account' => 'Platit z účtu',
'payed to' => 'Zaplaceno do',
'payment' => 'Platba',
'payment type' => 'Způsob platby',
'payment by cash' => 'Platba hotově',
'payment by freenetis credit' => 'Platba kreditem do FreeNetISu',
'payment has been successfully assigned' => 'Platba byla úspěšně přiřazena.',
'payment information' => 'Informace o platbě',
'payment notice' => 'Upozornění na placení',
freenetis/branches/testing/application/vendors/unit_tester/unit_testing_config.xml
</input>
</values>
</method>
<method name="xls_export" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</controller>
<controller name="fees">
<method name="index" autogenerate="on">
......
<input></input>
</values>
</method>
<method name="show_all" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="show" autogenerate="off">
<attributes>
<attribute name="phone_invoice_id" default_value="-1"/>
......
<param value="$'$'"/>
</input>
</values>
</method></model>
</method>
<method name="get_transaction_code_duplicities" autogenerate="on">
<attributes>
<attribute name="transaction_codes" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
</model>
<model name="cloud">
<method name="get_all_clouds" autogenerate="on">
<attributes></attributes>
......
</method>
</model>
<model name="job_report">
<method name="get_payment_types" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="get_name_of_payment_type" autogenerate="on">
<attributes>
<attribute name="type" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="get_state" autogenerate="on">
<attributes></attributes>
<values>
......
</values>
</method>
<method name="count_all_pending_work_reports" autogenerate="on">
<attributes></attributes>
<attributes>
<attribute name="filter_sql" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="count_all_approved_work_reports" autogenerate="on">
<attributes></attributes>
<attributes>
<attribute name="filter_sql" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="count_all_rejected_work_reports" autogenerate="on">
<attributes></attributes>
<attributes>
<attribute name="filter_sql" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="get_concepts_work_reports_of_user" autogenerate="on">
......
</values>
</method>
<method name="get_all_members_to_export" autogenerate="on">
<attributes></attributes>
<attributes>
<attribute name="filter_sql" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="get_members_of_subnet" autogenerate="off">
......
<input></input>
</values>
</method>
<method name="count_all_phone_invoices" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="get_all_phone_invoices" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</model>
<model name="phone_invoice_user">
<method name="has_phone_invoices" autogenerate="on">
......
<values>
</values>
</method>
<method name="work_report_payment_type" autogenerate="on">
<attributes>
<attribute name="item" default_value="" />
<attribute name="name" default_value="" />
</attributes>
<values>
<input>
<param value="" />
<param value="" />
</input>
</values>
</method>
<method name="limited_text" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
......
</attributes>
<values>
</values>
</method></helper>
</method>
</helper>
<helper name="condition">
<method name="is_own" autogenerate="off">
<attributes>
freenetis/branches/testing/application/helpers/callback.php
}
/**
* Callback for work report payment type
*
* @author Ondrej Fibich
* @param object $item
* @param string $name
*/
public static function work_report_payment_type($item, $name)
{
$value = $item->$name;
if ($value == Job_report_Model::PAYMENT_BY_CASH)
{
echo '<span class="red">';
}
echo Job_report_Model::get_name_of_payment_type($value);
if ($value == Job_report_Model::PAYMENT_BY_CASH)
{
echo '</span>';
}
}
/**
* Callback for limited text, text over 50 character is stripped and added to title.
*
* @author Ondrej Fibich
freenetis/branches/testing/application/models/bank_transfer.php
* Checks duplicities by comparing given transaction codes and
* searching them in the database. Successful search means duplicity.
* Used in Fio importer.
*
* @author Jiri Svitak
* @param <type> $transaction_codes
* @param array $transaction_codes
* @return array
*/
public function get_transaction_code_duplicities($transaction_codes)
{
if (!count($transaction_codes))
{
return array();
}
$duplicities = $this->db->query("
SELECT *
FROM bank_transfers
WHERE transaction_code IN (" . implode(",", $transaction_codes) . ")
");
SELECT *
FROM bank_transfers
WHERE transaction_code IN (" . implode(",", $transaction_codes) . ")
");
$duplicate_transaction_codes = array();
foreach ($duplicities as $duplicity)
{
$duplicate_transaction_codes[] = $duplicity->transaction_code;
}
return $duplicate_transaction_codes;
}
freenetis/branches/testing/application/models/job_report.php
* @property ORM $jobs
* @property integer $transfer_id
* @property Transfer_Model $transfer
* @property integer $payment_type
*/
class Job_report_Model extends ORM
{
protected $belongs_to = array
(
'user', 'approval_template', 'transfer',
......
);
protected $has_many = array('jobs');
/** Constant of credit payment for column payment_type */
const PAYMENT_BY_CREDIT = 0;
/** Constant of cash payment for column payment_type */
const PAYMENT_BY_CASH = 1;
/**
* Payments types
*
* @var array
*/
protected static $PAYMENT_TYPES = array
(
self::PAYMENT_BY_CREDIT => 'Payment by FreeNetIS credit',
self::PAYMENT_BY_CASH => 'Payment by cash'
);
/**
* Gets translated payments types
*
* @return array
*/
public static function get_payment_types()
{
return array_map('__', self::$PAYMENT_TYPES);
}
/**
* Gets name of payment type
*
* @param integer $type
* @return string
*/
public function get_name_of_payment_type($type = NULL)
{
if ($type === NULL && $this->id)
{
$type = $this->payment_type;
}
if (array_key_exists($type, self::$PAYMENT_TYPES))
{
return __(self::$PAYMENT_TYPES[$type]);
}
return __('Unknown type');
}
/**
* Gets state of work reports from it's works
*
* @author Ondřej Fibich
......
SELECT
r.id, r.user_id, r.approval_template_id, r.description,
r.price_per_hour, r.price_per_km, r.type, r.concept,
r.added_by_id, j.transfer_id, u.member_id,
r.added_by_id, j.transfer_id, u.member_id, r.payment_type,
CONCAT(u.name, ' ', u.surname) as uname,
SUM(j.suggest_amount) AS suggest_amount, MIN(j.date) AS date_from,
MAX(j.date) AS date_to, SUM(j.hours) AS hours, SUM(j.km) AS km,
IF(MIN(j.state) <= 1, MIN(j.state), MAX(j.state)) AS state
MAX(j.date) AS date_to, IFNULL(SUM(j.hours), 0) AS hours,
SUM(j.km) AS km,
IF(MIN(j.state) <= 1, MIN(j.state), MAX(j.state)) AS state
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN jobs j ON r.id = j.job_report_id
......
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @param string $filter_sql
* @param boolean $lower Should be operant to state < (= otherwise)
* @return ORM iterator
*/
private function _get_all_work_reports_with_state(
$state, $limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array(), $lower = FALSE)
$order_by_direction = 'ASC', $filter_sql = '', $lower = FALSE)
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
{
$order_by_direction = 'asc';
}
// where
if (!empty($filter_sql))
{
$filter_sql = 'WHERE ' . $filter_sql;
}
// query
return $this->db->query('
SELECT r.id, r.user_id, CONCAT(u.name, \' \', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to, r.type,
SUM(j.hours) AS hours, SUM(j.km) AS km,
IF(MIN(state) <= 1, MIN(state), MAX(state)) AS state
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN jobs j ON r.id = j.job_report_id
WHERE r.concept = 0
GROUP BY r.id
HAVING state ' . ($lower ? '<' : '=') . ' ?
ORDER BY ' . $this->db->escape_column($order_by) . ' ' . $order_by_direction . '
LIMIT ' . intval($limit_from) . ', ' . intval($limit_results) . '
', $state);
return $this->db->query("
SELECT * FROM
(
SELECT r.id, r.user_id, CONCAT(u.name, ' ', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to, r.type,
SUM(j.hours) AS hours, SUM(j.km) AS km, r.payment_type,
IF(MIN(state) <= 1, MIN(state), MAX(state)) AS state
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN jobs j ON r.id = j.job_report_id
WHERE r.concept = 0
GROUP BY r.id
HAVING state " . ($lower ? '<' : '=') . " ?
ORDER BY " . $this->db->escape_column($order_by) . " " . $order_by_direction . "
LIMIT " . intval($limit_from) . ", " . intval($limit_results) . "
) wr $filter_sql
", $state);
}
/**
* Gets all concepts of work reports of user
* Gets all work reports of user by state
*
* @param integer $user_id
* @param integer $state
* @param boolean $lower Should be operant to state < (= otherwise)
* @return ORM iterator
*/
private function _get_report_concepts_of_user_by_state($user_id, $state, $lower = FALSE)
private function _get_work_reports_of_user_by_state($user_id, $state, $lower = FALSE)
{
return $this->db->query('
SELECT r.id, r.user_id, CONCAT(u.name, \' \', u.surname) as uname,
......
* Counts all work reports with given state
*
* @param integer $state
* @param boolean $lower Should be operant to state < (= otherwise)
* @param boolean $lower Should be operant to state < (= otherwise)
* @param string $filter_sql
* @return integer
*/
private function _count_all_work_reports_with_state($state, $lower = FALSE)
private function _count_all_work_reports_with_state(
$state, $lower = FALSE, $filter_sql = '')
{
return count($this->db->query('
SELECT IF(MIN(state) <= 1, MIN(state), MAX(state)) AS state
FROM job_reports r
LEFT JOIN jobs j ON r.id = j.job_report_id
WHERE r.concept = 0
GROUP BY r.id
HAVING state ' . ($lower ? '<' : '=') . ' ?
', $state));
// where
if (!empty($filter_sql))
{
$filter_sql = 'WHERE ' . $filter_sql;
}
// query
return count($this->db->query("
SELECT * FROM
(
SELECT r.id, r.user_id, CONCAT(u.name, ' ', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to, r.type,
SUM(j.hours) AS hours, SUM(j.km) AS km, r.payment_type,
IF(MIN(state) <= 1, MIN(state), MAX(state)) AS state
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN transfers t ON t.id = r.transfer_id
LEFT JOIN jobs j ON r.id = j.job_report_id
WHERE r.concept = 0
GROUP BY r.id
HAVING state " . ($lower ? '<' : '=') . " ?
) wr $filter_sql
", $state));
}
/**
......
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @param string $filter_sql Search filter
* @return ORM iterator
*/
public function get_all_pending_work_reports(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array())
$order_by_direction = 'ASC', $filter_sql = '')
{
return $this->_get_all_work_reports_with_state(
2, $limit_from, $limit_results, $order_by,
$order_by_direction, $filter_values, TRUE
$order_by_direction, $filter_sql, TRUE
);
}
......
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @param string $filter_sql Search filter
* @return ORM iterator
*/
public function get_all_approved_work_reports(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array())
$order_by_direction = 'ASC', $filter_sql = '')
{
return $this->_get_all_work_reports_with_state(
3, $limit_from, $limit_results, $order_by,
$order_by_direction, $filter_values
$order_by_direction, $filter_sql
);
}
......
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @param string $filter_sql Search filter
* @return ORM iterator
*/
public function get_all_rejected_work_reports(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array())
$order_by_direction = 'ASC', $filter_sql = '')
{
return $this->_get_all_work_reports_with_state(
2, $limit_from, $limit_results, $order_by,
$order_by_direction, $filter_values
$order_by_direction, $filter_sql
);
}
/**
* Counts all pending work reports
*
* @param string $filter_sql Search filter
* @return integer
*/
public function count_all_pending_work_reports()
public function count_all_pending_work_reports($filter_sql = '')
{
return $this->_count_all_work_reports_with_state(2, TRUE);
}
......
/**
* Counts all approved work reports
*
* @param string $filter_sql Search filter
* @return integer
*/
public function count_all_approved_work_reports()
public function count_all_approved_work_reports($filter_sql = '')
{
return $this->_count_all_work_reports_with_state(3);
return $this->_count_all_work_reports_with_state(3, FALSE, $filter_sql);
}
/**
* Counts all rejected work reports
*
* @param string $filter_sql Search filter
* @return integer
*/
public function count_all_rejected_work_reports()
public function count_all_rejected_work_reports($filter_sql = '')
{
return $this->_count_all_work_reports_with_state(2);
return $this->_count_all_work_reports_with_state(2, FALSE, $filter_sql);
}
/**
......
*/
public function get_approved_work_reports_of_user($user_id)
{
return $this->_get_report_concepts_of_user_by_state($user_id, 3);
return $this->_get_work_reports_of_user_by_state($user_id, 3);
}
/**
......
*/
public function get_rejected_work_reports_of_user($user_id)
{
return $this->_get_report_concepts_of_user_by_state($user_id, 2);
return $this->_get_work_reports_of_user_by_state($user_id, 2);
}
/**
......
*/
public function get_pending_work_reports_of_user($user_id)
{
return $this->_get_report_concepts_of_user_by_state($user_id, 2, TRUE);
return $this->_get_work_reports_of_user_by_state($user_id, 2, TRUE);
}
}
freenetis/branches/testing/application/controllers/work_reports.php
*
* Each work report has to be approved by other pre-defined users by their votes.
*
* @author Michal Kliment
* @author Michal Kliment, Ondřej Fibich
* @package Controller
*/
class Work_reports_Controller extends Controller
......
{
$limit_results = (int) $this->input->get('record_per_page');
}
$filter_form = new Filter_form('wr');
$filter_form->add('description');
$filter_form->add('uname')
->label('Worker')
->callback('json/user_fullname');
$filter_form->add('suggest_amount')
->type('number')
->label('Suggest amount');
$filter_form->add('hours')
->type('number');
$filter_form->add('km')
->type('number');
$filter_form->add('date_from')
->type('date');
$filter_form->add('date_to')
->type('date');
$filter_form->add('payment_type')
->type('select')
->values(Job_report_Model::get_payment_types());
$work_report_model = new Job_report_Model();
$total_work_reports = $work_report_model->count_all_pending_work_reports();
$total_work_reports = $work_report_model->count_all_pending_work_reports(
$filter_form->as_sql()
);
if (($sql_offset = ($page - 1) * $limit_results) > $total_work_reports)
$sql_offset = 0;
$work_reports = $work_report_model->get_all_pending_work_reports(
$sql_offset, (int)$limit_results, $order_by, $order_by_direction
$sql_offset, (int)$limit_results, $order_by, $order_by_direction,
$filter_form->as_sql()
);
// create grid
......
'total_items' => $total_work_reports,
'items_per_page' => $limit_results,
'style' => 'classic',
'filter' => $filter_form,
'order_by' => $order_by,
'order_by_direction' => $order_by_direction,
'limit_results' => $limit_results
......
// gets new selector
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
$filter_form = new Filter_form('wr');
$filter_form->add('description');
$filter_form->add('uname')
->label('Worker')
->callback('json/user_fullname');
$filter_form->add('suggest_amount')
->type('number')
->label('Suggest amount');
$filter_form->add('hours')
->type('number');
$filter_form->add('km')
->type('number');
$filter_form->add('date_from')
->type('date');
$filter_form->add('date_to')
->type('date');
$filter_form->add('payment_type')
->type('select')
->values(Job_report_Model::get_payment_types());
$work_report_model = new Job_report_Model();
$total_work_reports = $work_report_model->count_all_approved_work_reports();
$total_work_reports = $work_report_model->count_all_approved_work_reports(
$filter_form->as_sql()
);
if (($sql_offset = ($page - 1) * $limit_results) > $total_work_reports)
$sql_offset = 0;
$work_reports = $work_report_model->get_all_approved_work_reports(
$sql_offset, (int)$limit_results, $order_by, $order_by_direction
$sql_offset, (int)$limit_results, $order_by, $order_by_direction,
$filter_form->as_sql()
);
// create grid
......
'total_items' => $total_work_reports,
'items_per_page' => $limit_results,
'style' => 'classic',
'filter' => $filter_form,
'order_by' => $order_by,
'order_by_direction' => $order_by_direction,
'limit_results' => $limit_results
......
->label(__('Km'));
$grid->order_callback_field('suggest_amount')
->label(__('Suggest amount'))
->label(__('Rating'))
->callback('Works_Controller::suggest_amount');
$grid->order_callback_field('payment_type')
->callback('callback::work_report_payment_type');
// access control
if ($this->acl_check_view('Users_Controller','work'))
......
// gets new selector
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
$filter_form = new Filter_form('wr');
$filter_form->add('description');
$filter_form->add('uname')
->label('Worker')
->callback('json/user_fullname');
$filter_form->add('suggest_amount')
->type('number')
->label('Suggest amount');
$filter_form->add('hours')
->type('number');
$filter_form->add('km')
->type('number');
$filter_form->add('date_from')
->type('date');
$filter_form->add('date_to')
->type('date');
$filter_form->add('payment_type')
->type('select')
->values(Job_report_Model::get_payment_types());
$work_report_model = new Job_report_Model();
$total_work_reports = $work_report_model->count_all_rejected_work_reports();
$total_work_reports = $work_report_model->count_all_rejected_work_reports(
$filter_form->as_sql()
);
if (($sql_offset = ($page - 1) * $limit_results) > $total_work_reports)
$sql_offset = 0;
$work_reports = $work_report_model->get_all_rejected_work_reports(
$sql_offset, (int)$limit_results, $order_by, $order_by_direction
$sql_offset, (int)$limit_results, $order_by, $order_by_direction,
$filter_form->as_sql()
);
// create grid
......
'total_items' => $total_work_reports,
'items_per_page' => $limit_results,
'style' => 'classic',
'filter' => $filter_form,
'order_by' => $order_by,
'order_by_direction' => $order_by_direction,
'limit_results' => $limit_results
......
}
}
if (!count($pending_works_ids))
if (!count($pending_works_ids) &&
count($approved_works_ids) &&
$work_report_model->payment_type == Job_report_Model::PAYMENT_BY_CREDIT)
{
if (count($approved_works_ids))
{
// creates new transfer
$account_model = new Account_Model();
// creates new transfer
$account_model = new Account_Model();
$operating_id = $account_model->where(
'account_attribute_id', Account_attribute_Model::$operating
)->find()->id;
$operating_id = $account_model->where(
'account_attribute_id', Account_attribute_Model::$operating
)->find()->id;
$credit_id = $account_model->where('member_id', $work->user->member_id)
->where('account_attribute_id', Account_attribute_Model::$credit)
->find()
->id;
$credit_id = $account_model->where('member_id', $work->user->member_id)
->where('account_attribute_id', Account_attribute_Model::$credit)
->find()
->id;
$transfer_id = Transfer_Model::insert_transfer(
$operating_id, $credit_id, null, null,
$this->session->get('user_id'), null, date('Y-m-d'),
date('Y-m-d H:i:s'), __('Work report approval'),
$amount
);
$transfer_id = Transfer_Model::insert_transfer(
$operating_id, $credit_id, null, null,
$this->session->get('user_id'), null, date('Y-m-d'),
date('Y-m-d H:i:s'), __('Work report approval'),
$amount
);
$work_report_model->transfer_id = $transfer_id;
$work_report_model->save();
$work_report_model->transfer_id = $transfer_id;
$work_report_model->save();
foreach ($approved_works_ids as $approved_work_id)
{
$approved_work = new Job_Model($approved_work_id);
$approved_work->transfer_id = $transfer_id;
$approved_work->save();
}
foreach ($approved_works_ids as $approved_work_id)
{
$approved_work = new Job_Model($approved_work_id);
$approved_work->transfer_id = $transfer_id;
$approved_work->save();
}
}
url::redirect(url::base(TRUE).url::current(TRUE));
......
if (!isset($form_data['user_id']) ||
!isset($form_data['description']) ||
!isset($form_data['payment_type']) ||
!isset($form_data['price_per_hour']) ||
!isset($form_data['price_per_km']))
{
......
$work_report->description = $form_data['description'];
$work_report->price_per_hour = $form_data['price_per_hour'];
$work_report->concept = TRUE;
$work_report->payment_type = intval($form_data['payment_type']);
if (isset($form_data['type']) &&
preg_match('/^[0-9]{4}-[0-9]{1,2}$/', $form_data['type']))
......
if (!isset($form_data['price_per_hour']) ||
!isset($form_data['price_per_km']) ||
!isset($form_data['payment_type']) ||
!isset($form_data['description']))
{
throw new Exception('Invalid post');
......
$work_report->description = $form_data['description'];
$work_report->price_per_hour = $price_per_hour;
$work_report->price_per_km = $price_per_km;
$work_report->payment_type = intval($form_data['payment_type']);
$work_report->save_throwable();
//// delete works
freenetis/branches/testing/application/controllers/export.php
$filename = __(utf8::ucfirst($content)) . '.csv';
$content = inflector::singular($content);
if (!Kohana::auto_load($content . '_Model'))
{
Controller::warning(PARAMETER, __('Bad parameter for export'));
}
try
{
$model = ORM::factory(inflector::singular($content));
$all = $model->find_all();
$all = ORM::factory($content)->find_all();
$items = array();
foreach ($all as $one)
{
$items[] = $one->as_array();
}
unset($all);
}
catch (Exception $e)
{
freenetis/branches/testing/application/upgrade_sql/upgrade_sql.php
/**
* Added transaction_code column to distinguish unique bank transfers from statements.
* Column for payment type of work report
*
* @author Jiri Svitak
* @author Ondřej Fibich
*/
$upgrade_sql[get_SVN_rev()] = array
(
"ALTER TABLE `bank_transfers` ADD `transaction_code` BIGINT NULL AFTER `bank_statement_id` ",
"ALTER TABLE `bank_transfers` CHANGE `number` `number` INT( 11 ) NULL COMMENT 'Line number or number of the bank listing item'"
"ALTER TABLE `job_reports` ADD `payment_type` TINYINT NOT NULL DEFAULT '0'
COMMENT 'Specified payment, 0 is credit payment, 1 is cash payment, see model for more details'"
);
freenetis/branches/testing/application/upgrade_sql/upgrade_sql_1239.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is released 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/
*
*/
/**
* Added transaction_code column to distinguish unique bank transfers from statements.
*
* @author Jiri Svitak
*/
$upgrade_sql[1239] = array
(
"ALTER TABLE `bank_transfers` ADD `transaction_code` BIGINT NULL AFTER `bank_statement_id` ",
"ALTER TABLE `bank_transfers` CHANGE `number` `number` INT( 11 ) NULL COMMENT 'Line number or number of the bank listing item'"
);
freenetis/branches/testing/application/libraries/Filter_form.php
$sql = str_replace('{'.$key.'}', mysql_real_escape_string($value), $sql);
}
}
$table_pom = mb_strlen($filter->table) ? $filter->table . '.' : '';
if (isset($this->opers[$this->operations[$i]]['function']))
{
$queries[] = $this->opers[$this->operations[$i]]['function']
. "($filter->table.$filter->name) "
. "(" . $table_pom . $filter->name . ") "
. str_replace("{VALUE}", mysql_real_escape_string($value), $sql);
}
else
{
$queries[] = "$filter->table.$filter->name "
. str_replace("{VALUE}", mysql_real_escape_string($value), $sql);
$queries[] = $table_pom . $filter->name . " "
. str_replace("{VALUE}", mysql_real_escape_string($value), $sql);
}
}
freenetis/branches/testing/application/views/work_reports/show.php
<td><?php echo $work_report->description ?></td>
</tr>
<tr>
<th><?php echo __('Payment type') ?></th>
<td><?php echo $work_report_model->get_name_of_payment_type() ?></td>
</tr>
<tr>
<th><?php echo __('Date from') ?></th>
<td><?php echo date('j.n. Y', strtotime($work_report->date_from)) ?></td>
</tr>
......
<th><?php echo __('State') ?></th>
<td><b><?php echo $state_text ?></b></td>
</tr>
<?php if ($work_report->state == 3): ?>
<?php if ($work_report->state == 3 && $work_report->payment_type == Job_report_Model::PAYMENT_BY_CREDIT): ?>
<tr>
<th><?php echo __('Confirmed time') ?></th>
<td><?php echo $transfer->creation_datetime ?></td>
freenetis/branches/testing/application/views/work_reports/edit.php
<table cellspacing="0" class="form">
<tr>
<th colspan="2" class="group" style="text-align: left"><?php echo __('Work report details') ?></th>
<th colspan="3" class="group" style="text-align: left"><?php echo __('Work report details') ?></th>
</tr>
<tr>
<th colspan="2"><label><?php echo __('Description of work report') ?></label></th>
<th colspan="3"><label><?php echo __('Description of work report') ?></label></th>
</tr>
<tr>
<td colspan="2">
<td colspan="3">
<?php echo form::textarea(array('name' => 'description', 'value' => $work_report->description, 'style' => 'margin: 10px; width: 700px')) ?>
</td>
</tr>
<tr>
<th><label><?php echo __('Approval template') ?></label></th>
<th><label><?php echo __('Worker') ?></label></th>
<th><label><?php echo __('Payment type') ?></label></th>
</tr>
<tr>
<td style="padding: 5px;">
<td style="padding: 5px; width: 310px;">
<?php echo $work_report->approval_template->name ?>
</td>
<td style="padding: 5px; width: 500px">
<?php echo $work_report->user->get_full_name() . ' - ' . $work_report->user->login ?>
</td>
<td>
<?php echo form::dropdown(array('name' => 'payment_type', 'style' => 'width: 200px'), Job_report_Model::get_payment_types(), $work_report->payment_type) ?>
</td>
</tr>
</table>
freenetis/branches/testing/application/views/work_reports/add.php
var $description_edit = $('#description_edit');
var $user_id_edit = $('#user_id_edit');
var $works_count = $('#works_count');
var $payment_type_edit = $('#payment_type_edit');
// form validation
......
$('#description').attr('value', $description_edit.val());
$('#user_id').attr('value', $user_id_edit.val());
$('#payment_type').attr('value', $payment_type_edit.val());
if ($('#report_type1').is(':checked'))
{
......
$(this).hide();
$description_edit.attr('readonly', true);
$user_id_edit.attr('disabled', true);
$payment_type_edit.attr('disabled', true);
$('#type_table input').attr('readonly', true);
$('#report_type1').attr('disabled', true);
$('#report_type2').attr('disabled', true);
......
<table cellspacing="0" class="form">
<tr>
<th colspan="2" class="group" style="text-align: left"><?php echo __('Work report details') ?></th>
<th colspan="3" class="group" style="text-align: left"><?php echo __('Work report details') ?></th>
</tr>
<tr>
<th colspan="2"><label><?php echo __('Description of work report') ?></label></th>
<th colspan="3"><label><?php echo __('Description of work report') ?></label></th>
</tr>
<tr>
<td colspan="2">
<td colspan="3">
<?php echo form::textarea(array('name' => 'description_edit', 'style' => 'margin: 10px; width: 700px')) ?>
<?php echo form::hidden('description'); ?>
</td>
......
<tr>
<th><label><?php echo __('Approval template') ?></label></th>
<th><label><?php echo __('Worker') ?></label></th>
<th><label><?php echo __('Payment type') ?></label></th>
</tr>
<tr>
<td>
......
<?php echo form::dropdown(array('name' => 'user_id_edit', 'style' => 'width: 200px'), $arr_users, $selected_user) ?>
<?php echo form::hidden('user_id'); ?>
</td>
<td>
<?php echo form::dropdown(array('name' => 'payment_type_edit', 'style' => 'width: 200px'), Job_report_Model::get_payment_types()) ?>
<?php echo form::hidden('payment_type'); ?>
</td>
</tr>
</table>
freenetis/branches/testing/system/core/Kohana.php
// The current user agent
public static $user_agent = '';
public static $display_errors = True;
public static $display_errors = True;
public static $extension_prefix = 'MY_';
public static $extension_prefix = 'MY_';
/**
* Sets up the PHP environment. Adds error/exception handling, output
......
$type = 'libraries/drivers';
$file = str_replace('_', '/', substr($class, 0, -7));
break;
case 'Exception'://die($class);
$type = 'libraries/exceptions';
$file = $class;
break;
default:
// Forge library elements
if (strncmp($class, 'Form_', 5) == 0)

Také k dispozici: Unified diff