[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15193] rental: override adjustment start, tweak bill
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15193] rental: override adjustment start, tweak billing |
Date: |
Tue, 24 May 2016 12:25:05 +0000 (UTC) |
Revision: 15193
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15193
Author: sigurdne
Date: 2016-05-24 12:25:05 +0000 (Tue, 24 May 2016)
Log Message:
-----------
rental: override adjustment start, tweak billing
Modified Paths:
--------------
trunk/rental/inc/class.socontract.inc.php
trunk/rental/inc/class.soinvoice_price_item.inc.php
trunk/rental/inc/class.uibilling.inc.php
trunk/rental/inc/class.uicontract.inc.php
trunk/rental/inc/model/class.agresso_lg04.inc.php
trunk/rental/inc/model/class.contract.inc.php
trunk/rental/inc/model/class.invoice.inc.php
trunk/rental/inc/model/class.invoice_price_item.inc.php
trunk/rental/setup/phpgw_no.lang
trunk/rental/setup/setup.inc.php
trunk/rental/setup/tables_current.inc.php
trunk/rental/setup/tables_update.inc.php
trunk/rental/templates/base/contract.xsl
Modified: trunk/rental/inc/class.socontract.inc.php
===================================================================
--- trunk/rental/inc/class.socontract.inc.php 2016-05-24 11:34:33 UTC (rev
15192)
+++ trunk/rental/inc/class.socontract.inc.php 2016-05-24 12:25:05 UTC (rev
15193)
@@ -356,7 +356,7 @@
{
// columns to retrieve
$columns[] = 'contract.id AS contract_id';
- $columns[] = 'contract.date_start,
contract.date_end, contract.old_contract_id, contract.executive_officer,
contract.last_updated, contract.location_id, contract.billing_start,
contract.billing_end, contract.service_id, contract.responsibility_id,
contract.reference, contract.invoice_header, contract.project_id,
billing.deleted, contract.account_in, contract.account_out, contract.term_id,
contract.security_type, contract.security_amount, contract.comment,
contract.due_date,
contract.contract_type_id,contract.rented_area,contract.adjustable,contract.adjustment_interval,contract.adjustment_share,contract.adjustment_year,contract.publish_comment';
+ $columns[] = 'contract.date_start,
contract.date_end, contract.old_contract_id, contract.executive_officer,
contract.last_updated, contract.location_id, contract.billing_start,
contract.billing_end, contract.service_id, contract.responsibility_id,
contract.reference, contract.invoice_header, contract.project_id,
billing.deleted, contract.account_in, contract.account_out, contract.term_id,
contract.security_type, contract.security_amount, contract.comment,
contract.due_date,
contract.contract_type_id,contract.rented_area,contract.adjustable,contract.adjustment_interval,contract.adjustment_share,contract.adjustment_year,override_adjustment_start,contract.publish_comment';
$columns[] = 'party.id AS party_id';
$columns[] = 'party.first_name,
party.last_name, party.company_name, party.department, party.org_enhet_id';
$columns[] = 'c_t.is_payer';
@@ -441,6 +441,7 @@
$contract->set_adjustment_interval($this->unmarshal($this->db->f('adjustment_interval'),
'int'));
$contract->set_adjustment_share($this->unmarshal($this->db->f('adjustment_share'),
'int'));
$contract->set_adjustment_year($this->unmarshal($this->db->f('adjustment_year'),
'int'));
+
$contract->set_override_adjustment_start($this->unmarshal($this->db->f('override_adjustment_start'),
'int'));
$contract->set_publish_comment($this->unmarshal($this->db->f('publish_comment'),
'bool'));
$contract->set_notify_before($this->unmarshal($this->db->f('notify_before'),
'int'));
$contract->set_notify_before_due_date($this->unmarshal($this->db->f('notify_before_due_date'),
'int'));
@@ -629,6 +630,7 @@
$values[] = "adjustment_interval = " .
$this->marshal($contract->get_adjustment_interval(), 'int');
$values[] = "adjustment_share = " .
$this->marshal($contract->get_adjustment_share(), 'int');
$values[] = "publish_comment = " .
($contract->get_publish_comment() ? "true" : "false");
+ $values[] = "override_adjustment_start = " .
$this->marshal($contract->get_override_adjustment_start(), 'int');
// FORM COLUMN 3
$values[] = "comment = " .
$this->marshal($contract->get_comment(), 'string');
@@ -828,6 +830,9 @@
$cols[] = 'adjustment_year';
$values[] =
$this->marshal($contract->get_adjustment_year(), 'int');
+ $cols[] = 'override_adjustment_start';
+ $values[] =
$this->marshal($contract->get_override_adjustment_start(), 'int');
+
$cols[] = 'publish_comment';
$values[] = ($contract->get_publish_comment() ? "true"
: "false");
Modified: trunk/rental/inc/class.soinvoice_price_item.inc.php
===================================================================
--- trunk/rental/inc/class.soinvoice_price_item.inc.php 2016-05-24 11:34:33 UTC
(rev 15192)
+++ trunk/rental/inc/class.soinvoice_price_item.inc.php 2016-05-24 12:25:05 UTC
(rev 15193)
@@ -54,7 +54,7 @@
}
else
{
- $cols = 'rental_invoice_price_item.id,
invoice_id, title, area, count, agresso_id, is_area, price, total_price,
date_start, date_end';
+ $cols = 'rental_invoice_price_item.id,
invoice_id, title, area, count, agresso_id, is_area, is_one_time, price,
total_price, date_start, date_end';
}
$dir = $ascending ? 'ASC' : 'DESC';
$order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir " : ($return_count ? '' : 'ORDER BY
rental_invoice_price_item.id ASC');
@@ -65,8 +65,22 @@
{
if ($price_item == null)
{
- $price_item = new rental_invoice_price_item(0,
$this->db->f('id', true), $this->db->f('invoice_id', true),
$this->db->f('title', true), $this->db->f('agresso_id', true),
$this->db->f('is_area', true), $this->db->f('price', true),
$this->db->f('area', true), $this->db->f('count', true),
strtotime($this->db->f('date_start', true)), strtotime($this->db->f('date_end',
true)));
+ $price_item = new rental_invoice_price_item(
+ 0,
+ $this->db->f('id', true),
+ $this->db->f('invoice_id', true),
+ $this->db->f('title', true),
+ $this->db->f('agresso_id', true),
+ $this->db->f('is_area', true),
+ $this->db->f('price', true),
+ $this->db->f('area', true),
+ $this->db->f('count', true),
+ strtotime($this->db->f('date_start',
true)),
+ strtotime($this->db->f('date_end',
true))
+ );
+
$price_item->set_total_price($this->db->f('total_price', true));
+
$price_item->set_is_one_time((bool)$this->db->f('is_one_time'));
}
return $price_item;
}
@@ -84,9 +98,10 @@
$this->marshal($invoice_price_item->get_count(), 'int'),
$this->marshal($invoice_price_item->get_total_price(), 'float'),
$this->marshal(date('Y-m-d',
$invoice_price_item->get_timestamp_start()), 'date'),
- $this->marshal(date('Y-m-d',
$invoice_price_item->get_timestamp_end()), 'date')
+ $this->marshal(date('Y-m-d',
$invoice_price_item->get_timestamp_end()), 'date'),
+ $invoice_price_item->is_one_time() ? 'true' :
'false',
);
- $query = "INSERT INTO rental_invoice_price_item
(invoice_id, title, agresso_id, is_area, price, area, count, total_price,
date_start, date_end) VALUES (" . join(',', $values) . ")";
+ $query = "INSERT INTO rental_invoice_price_item
(invoice_id, title, agresso_id, is_area, price, area, count, total_price,
date_start, date_end,is_one_time) VALUES (" . join(',', $values) . ")";
$receipt = null;
if ($this->db->query($query))
{
Modified: trunk/rental/inc/class.uibilling.inc.php
===================================================================
--- trunk/rental/inc/class.uibilling.inc.php 2016-05-24 11:34:33 UTC (rev
15192)
+++ trunk/rental/inc/class.uibilling.inc.php 2016-05-24 12:25:05 UTC (rev
15193)
@@ -537,8 +537,8 @@
}
$contracts_with_one_time = array();
- //Check to see if the period har been billed
before
- if
(rental_sobilling::get_instance()->has_been_billed($contract_type,
$billing_term, $year, $month)) // Checks if period has been billed before
+ //Check to see if the period har been billed
before, not including credits
+ if ($billing_term != 5 &&
rental_sobilling::get_instance()->has_been_billed($contract_type,
$billing_term, $year, $month)) // Checks if period has been billed before
{
// We only give a warning and let the
user go to step 2
$warningMsgs[] = lang('the period has
been billed before.');
Modified: trunk/rental/inc/class.uicontract.inc.php
===================================================================
--- trunk/rental/inc/class.uicontract.inc.php 2016-05-24 11:34:33 UTC (rev
15192)
+++ trunk/rental/inc/class.uicontract.inc.php 2016-05-24 12:25:05 UTC (rev
15193)
@@ -1405,6 +1405,7 @@
$contract->set_project_id(phpgw::get_var('project_id'));
$contract->set_due_date(phpgwapi_datetime::date_to_timestamp(phpgw::get_var('due_date')));
+
$contract->set_override_adjustment_start(phpgw::get_var('override_adjustment_start',
'int'));
$contract->set_contract_type_id(phpgw::get_var('contract_type'));
$old_rented_area = $contract->get_rented_area();
$new_rented_area =
phpgw::get_var('rented_area');
@@ -1716,6 +1717,7 @@
'rented_area_simbol' => $this->area_suffix,
'is_adjustable' => $contract->is_adjustable(),
'value_adjustment_year' =>
$contract->get_adjustment_year(),
+ 'value_override_adjustment_start' =>
$contract->get_override_adjustment_start(),
'value_comment' => $contract->get_comment(),
'value_publish_comment' =>
$contract->get_publish_comment(),
'location_id' => $contract->get_location_id(),
@@ -2168,6 +2170,7 @@
var area_suffix = '$this->area_suffix';
JS;
$GLOBALS['phpgw']->js->add_code('', $code);
+ $override_adjustment_start =
$contract->get_override_adjustment_start();
$data = array
(
@@ -2207,6 +2210,7 @@
'list_adjustment_interval' => array('options'
=> $adjustment_interval_options),
'list_adjustment_share' => array('options' =>
$adjustment_share_options),
'value_adjustment_year' =>
$contract->get_adjustment_year(),
+ 'value_override_adjustment_start' =>
$override_adjustment_start ? $override_adjustment_start : '',
'value_comment' => $contract->get_comment(),
'value_publish_comment' =>
$contract->get_publish_comment(),
'location_id' => $contract->get_location_id(),
@@ -2240,6 +2244,7 @@
//$appname = $this->location_info['name'];
//$GLOBALS['phpgw_info']['flags']['app_header'] =
$GLOBALS['phpgw']->translation->translate($this->location_info['acl_app'],
array(), false, $this->location_info['acl_app']) .
"::{$appname}::{$function_msg}";
+ phpgwapi_jquery::formvalidator_generate(array('date'));
self::add_javascript('rental', 'rental',
'contract.edit.js');
phpgwapi_jquery::load_widget('numberformat');
self::render_template_xsl(array('contract',
'datatable_inline'), array('edit' => $data));
Modified: trunk/rental/inc/model/class.agresso_lg04.inc.php
===================================================================
--- trunk/rental/inc/model/class.agresso_lg04.inc.php 2016-05-24 11:34:33 UTC
(rev 15192)
+++ trunk/rental/inc/model/class.agresso_lg04.inc.php 2016-05-24 12:25:05 UTC
(rev 15193)
@@ -151,7 +151,7 @@
$description = $price_item->get_title();
$start =
$price_item->get_timestamp_start();
$stop =
$price_item->get_timestamp_end();
- if (isset($start) && isset($stop))
+ if (!$price_item->get_is_one_time() &&
isset($start) && isset($stop))
{
$description .= ' ' .
date('j/n', $start) . '-' . date('j/n', $stop);
}
Modified: trunk/rental/inc/model/class.contract.inc.php
===================================================================
--- trunk/rental/inc/model/class.contract.inc.php 2016-05-24 11:34:33 UTC
(rev 15192)
+++ trunk/rental/inc/model/class.contract.inc.php 2016-05-24 12:25:05 UTC
(rev 15193)
@@ -74,6 +74,7 @@
protected $adjustment_interval;
protected $adjustment_share;
protected $adjustment_year;
+ protected $override_adjustment_start;
protected $adjustable;
protected $bill_only_one_time;
protected $publish_comment;
@@ -952,6 +953,7 @@
'adjustment_interval' =>
$this->get_adjustment_interval(),
'adjustment_share' =>
$this->get_adjustment_share(),
'adjustment_year' =>
$this->get_adjustment_year(),
+ 'override_adjustment_start' =>
$this->get_override_adjustment_start(),
'comment' => $this->get_comment(),
'publish_comment' =>
$this->get_publish_comment(),
'term_label' => $this->get_term_id_title(),
@@ -1028,7 +1030,16 @@
{
return $this->adjustment_year;
}
+ public function set_override_adjustment_start(
$override_adjustment_start )
+ {
+ $this->override_adjustment_start =
$override_adjustment_start;
+ }
+ public function get_override_adjustment_start()
+ {
+ return $this->override_adjustment_start;
+ }
+
public function set_adjustable( $adjustable )
{
$this->adjustable = (bool)$adjustable;
Modified: trunk/rental/inc/model/class.invoice.inc.php
===================================================================
--- trunk/rental/inc/model/class.invoice.inc.php 2016-05-24 11:34:33 UTC
(rev 15192)
+++ trunk/rental/inc/model/class.invoice.inc.php 2016-05-24 12:25:05 UTC
(rev 15193)
@@ -521,6 +521,7 @@
// If the contract price item is of type
one-time and it's dates are within the invoice period ...
if ($contract_price_item->is_one_time())
{
+
$invoice_price_item->set_is_one_time(true);
if ($billing_term == 5 ||
($contract_price_item_start >= $timestamp_invoice_start &&
$contract_price_item_start <= $timestamp_invoice_end))
{
// ... set the total price of
the invoice price item to the total price of the contract price item
Modified: trunk/rental/inc/model/class.invoice_price_item.inc.php
===================================================================
--- trunk/rental/inc/model/class.invoice_price_item.inc.php 2016-05-24
11:34:33 UTC (rev 15192)
+++ trunk/rental/inc/model/class.invoice_price_item.inc.php 2016-05-24
12:25:05 UTC (rev 15193)
@@ -13,6 +13,7 @@
protected $decimals;
protected $invoice_id;
protected $is_area;
+ protected $is_one_time;
protected $price_per_year;
protected $area;
protected $count;
@@ -224,6 +225,21 @@
return $this->timestamp_end;
}
+ public function set_is_one_time( $is_one_time )
+ {
+ $this->is_one_time = (bool)$is_one_time;
+ }
+
+ public function is_one_time()
+ {
+ return $this->is_one_time;
+ }
+
+ public function get_is_one_time()
+ {
+ return $this->is_one_time;
+ }
+
public function serialize()
{
$date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -232,6 +248,7 @@
'title' => $this->get_title(),
'agresso_id' => $this->get_agresso_id(),
'is_area' => $this->get_type_text(),
+ 'is_one_time' => $this->get_is_one_time(),
'price' => $this->get_price(),
'area' => $this->get_area(),
'count' => $this->get_count(),
Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang 2016-05-24 11:34:33 UTC (rev 15192)
+++ trunk/rental/setup/phpgw_no.lang 2016-05-24 12:25:05 UTC (rev 15193)
@@ -618,4 +618,5 @@
serial_number rental no Serienummer
Name or company is required rental no Navn på person ELLER navn på
foretak er obligatorisk
simulation rental no Simulering
-credits rental no Kreditering
\ No newline at end of file
+credits rental no Kreditering
+override adjustment start rental no Overstyr sist regulert
\ No newline at end of file
Modified: trunk/rental/setup/setup.inc.php
===================================================================
--- trunk/rental/setup/setup.inc.php 2016-05-24 11:34:33 UTC (rev 15192)
+++ trunk/rental/setup/setup.inc.php 2016-05-24 12:25:05 UTC (rev 15193)
@@ -1,6 +1,6 @@
<?php
$setup_info['rental']['name'] = 'rental'; // Module identifier
- $setup_info['rental']['version'] = '0.1.0.22'; // Current module version
+ $setup_info['rental']['version'] = '0.1.0.23'; // Current module version
$setup_info['rental']['app_order'] = 51; // (?)
$setup_info['rental']['tables'] = array(
'rental_party', // All contract participants, tenants etc.
Modified: trunk/rental/setup/tables_current.inc.php
===================================================================
--- trunk/rental/setup/tables_current.inc.php 2016-05-24 11:34:33 UTC (rev
15192)
+++ trunk/rental/setup/tables_current.inc.php 2016-05-24 12:25:05 UTC (rev
15193)
@@ -137,6 +137,7 @@
'default' => 100), //Reguleringsandel
'adjustment_year' => array('type' => 'int',
'precision' => '4', 'nullable' => true), //Sist regulert
'adjustable' => array('type' => 'bool',
'nullable' => true, 'default' => 'false'), //Regulerbar
+ 'override_adjustment_start' => array('type' =>
'int','precision' => 4,'nullable' => true),
'publish_comment' => array('type' => 'bool',
'nullable' => true, 'default' => 'false') //skal kommentar vises i frontend
),
'pk' => array('id'),
@@ -393,6 +394,7 @@
'count' => array('type' => 'int', 'precision'
=> '4', 'nullable' => true),
'agresso_id' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'is_area' => array('type' => 'bool', 'nullable'
=> false, 'default' => 'true'),
+ 'is_one_time' => array('type' => 'bool',
'nullable' => true, 'default' => 'false'),
'price' => array('type' => 'decimal',
'precision' => '20', 'scale' => '2', 'nullable' => true),
'total_price' => array('type' => 'decimal',
'precision' => '20', 'scale' => '2',
'nullable' => true),
Modified: trunk/rental/setup/tables_update.inc.php
===================================================================
--- trunk/rental/setup/tables_update.inc.php 2016-05-24 11:34:33 UTC (rev
15192)
+++ trunk/rental/setup/tables_update.inc.php 2016-05-24 12:25:05 UTC (rev
15193)
@@ -389,3 +389,24 @@
$GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.22';
return $GLOBALS['setup_info']['rental']['currentver'];
}
+
+ $test[] = '0.1.0.22';
+ function rental_upgrade0_1_0_22()
+ {
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('rental_contract',
'override_adjustment_start', array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => true
+ ));
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('rental_invoice_price_item',
'is_one_time', array(
+ 'type' => 'bool',
+ 'nullable' => true,
+ 'default' => 'false'
+ ));
+
+ $GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.23';
+ return $GLOBALS['setup_info']['rental']['currentver'];
+ }
+
+
Modified: trunk/rental/templates/base/contract.xsl
===================================================================
--- trunk/rental/templates/base/contract.xsl 2016-05-24 11:34:33 UTC (rev
15192)
+++ trunk/rental/templates/base/contract.xsl 2016-05-24 12:25:05 UTC (rev
15193)
@@ -260,6 +260,16 @@
</label>
<xsl:value-of
select="value_adjustment_year"/>
</div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'override adjustment start')"/>
+ </label>
+ <input type="text"
id="override_adjustment_start" name="override_adjustment_start" size="10"
value="{value_override_adjustment_start}" data-validation-optional="true"
data-validation="date" data-validation-format="yyyy">
+ <xsl:attribute
name="data-validation-error-msg">
+
<xsl:value-of select="php:function('lang', 'year')"/>
+ </xsl:attribute>
+ </input>
+ </div>
</div>
<div class="pure-u-1 pure-u-lg-1-2">
<div class="pure-control-group">
@@ -820,6 +830,12 @@
</label>
<xsl:value-of select="value_adjustment_year"/>
</div>
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'override adjustment start')"/>
+ </label>
+
<xsl:value-of select="value_override_adjustment_start"/>
+ </div>
</xsl:when>
<xsl:otherwise>
<div
class="pure-control-group">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15193] rental: override adjustment start, tweak billing,
sigurdne <=