[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15790] rental: custom prizing
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15790] rental: custom prizing |
Date: |
Mon, 3 Oct 2016 18:15:44 +0000 (UTC) |
Revision: 15790
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15790
Author: sigurdne
Date: 2016-10-03 18:15:44 +0000 (Mon, 03 Oct 2016)
Log Message:
-----------
rental: custom prizing
Modified Paths:
--------------
trunk/rental/inc/class.socomposite.inc.php
trunk/rental/inc/class.uicomposite.inc.php
trunk/rental/inc/model/class.composite.inc.php
trunk/rental/setup/setup.inc.php
trunk/rental/setup/tables_current.inc.php
trunk/rental/setup/tables_update.inc.php
trunk/rental/templates/base/composite.xsl
Modified: trunk/rental/inc/class.socomposite.inc.php
===================================================================
--- trunk/rental/inc/class.socomposite.inc.php 2016-10-03 15:22:21 UTC (rev
15789)
+++ trunk/rental/inc/class.socomposite.inc.php 2016-10-03 18:15:44 UTC (rev
15790)
@@ -237,7 +237,7 @@
rental_composite.address_2,
rental_composite.postcode, rental_composite.place,
rental_composite.is_active,
rental_composite.area, rental_composite.description,
rental_composite.furnish_type_id,
rental_composite.standard_id,rental_composite.composite_type_id,
- rental_composite.part_of_town_id,
rental_composite.custom_prize_factor,";
+ rental_composite.part_of_town_id,
rental_composite.custom_prize_factor, rental_composite.custom_prize,
rental_composite.prize_type_id,";
$cols .= "rental_contract.id AS contract_id,
rental_contract.date_start, rental_contract.date_end,
rental_contract.old_contract_id, ";
$cols .= "rental_application.id AS
application_id, rental_application.date_start AS application_date_start,
rental_application.date_end AS application_date_end, ";
$cols .= "
@@ -316,6 +316,8 @@
$composite->set_composite_type_id($this->unmarshal($this->db->f('composite_type_id'),
'int'));
$composite->set_part_of_town_id($this->unmarshal($this->db->f('part_of_town_id'),
'int'));
$composite->set_custom_prize_factor($this->unmarshal($this->db->f('custom_prize_factor',
true), 'float'));
+
$composite->set_prize_type_id($this->unmarshal($this->db->f('prize_type_id'),
'int'));
+
$composite->set_custom_prize($this->unmarshal($this->db->f('custom_prize'),
'float'));
}
// Location code
$location_code =
$this->unmarshal($this->db->f('location_code', true), 'string');
@@ -460,7 +462,9 @@
'standard_id = ' .
$composite->get_standard_id(),
'composite_type_id = ' .
$composite->get_composite_type_id(),
'part_of_town_id = ' .
$composite->get_part_of_town_id(),
- 'custom_prize_factor = \'' .
$composite->get_custom_prize_factor() . '\''
+ 'custom_prize_factor = \'' .
$composite->get_custom_prize_factor() . '\'',
+ 'prize_type_id = ' .
$composite->get_prize_type_id(),
+ 'custom_prize = \'' .
$composite->get_custom_prize() . '\''
);
$result = $this->db->query('UPDATE rental_composite SET
' . join(',', $values) . " WHERE id=$id", __LINE__, __FILE__);
@@ -480,7 +484,7 @@
// Build a db-friendly array of the composite object
$cols = array('name', 'description',
'has_custom_address', 'address_1', 'address_2',
'house_number', 'postcode', 'place',
'object_type_id', 'area', 'furnish_type_id',
- 'standard_id','composite_type_id',
'part_of_town_id', 'custom_prize_factor');
+ 'standard_id','composite_type_id',
'part_of_town_id', 'custom_prize_factor','prize_type_id', 'custom_prize');
$values = array(
"'" . $composite->get_name() . "'",
"'" . $composite->get_description() . "'",
@@ -496,7 +500,9 @@
$composite->get_standard_id(),
$composite->get_composite_type_id(),
$composite->get_part_of_town_id(),
- $composite->get_custom_prize_factor()
+ "'" . $composite->get_custom_prize_factor() .
"'",
+ $composite->get_prize_type_id(),
+ "'" . $composite->get_custom_prize() . "'"
);
$query = "INSERT INTO rental_composite (" . join(',',
$cols) . ") VALUES (" . join(',', $values) . ")";
Modified: trunk/rental/inc/class.uicomposite.inc.php
===================================================================
--- trunk/rental/inc/class.uicomposite.inc.php 2016-10-03 15:22:21 UTC (rev
15789)
+++ trunk/rental/inc/class.uicomposite.inc.php 2016-10-03 18:15:44 UTC (rev
15790)
@@ -7,6 +7,7 @@
include_class('rental', 'composite', 'inc/model/');
include_class('rental', 'application', 'inc/model/');
include_class('rental', 'property_location', 'inc/model/');
+ include_class('rental', 'price_item', 'inc/model/');
class rental_uicomposite extends rental_uicommon
{
@@ -1010,6 +1011,16 @@
JS;
$GLOBALS['phpgw']->js->add_code('', $code);
+ $current_prize_type_id =
$composite->get_prize_type_id();
+ $prize_type_options = array();
+ $price_item = new rental_price_item();
+ foreach ($price_item->get_price_types() as
$prize_type_id => $prize_type_title)
+ {
+ $selected = ($current_prize_type_id ==
$prize_type_id) ? 1 : 0;
+ $prize_type_options[] = array('id' =>
$prize_type_id, 'name' => lang($prize_type_title),
+ 'selected' => $selected);
+ }
+
$data = array
(
'datatable_def' => $datatable_def,
@@ -1021,6 +1032,8 @@
'value_name' => $composite->get_name(),
'value_composite_standard_name' =>
$composite_standard_name,
'list_composite_standard' => array('options' =>
$composite_standard_options),
+ 'value_custom_prize' =>
$composite->get_custom_prize(),
+ 'list_prize_type' => array('options' =>
$prize_type_options),
'value_composite_type_name' =>
$composite_type_name,
'list_composite_type' => array('options' =>
$composite_type_options),
'value_furnish_type_name' => $furnish_type_name,
@@ -1094,6 +1107,8 @@
$composite->set_composite_type_id(phpgw::get_var('composite_type_id', 'int'));
$composite->set_part_of_town_id(phpgw::get_var('part_of_town_id', 'int'));
$composite->set_custom_prize_factor(phpgw::get_var('custom_prize_factor',
'float'));
+
$composite->set_custom_prize(phpgw::get_var('custom_prize', 'float'));
+
$composite->set_prize_type_id(phpgw::get_var('prize_type_id', 'int'));
if
(rental_socomposite::get_instance()->store($composite))
{
Modified: trunk/rental/inc/model/class.composite.inc.php
===================================================================
--- trunk/rental/inc/model/class.composite.inc.php 2016-10-03 15:22:21 UTC
(rev 15789)
+++ trunk/rental/inc/model/class.composite.inc.php 2016-10-03 18:15:44 UTC
(rev 15790)
@@ -30,6 +30,8 @@
protected $contracts;
protected $part_of_town_id;
protected $custom_prize_factor = '1.00';
+ protected $custom_prize;
+ protected $prize_type_id;
protected static $furnish_types_arr;
/**
@@ -372,6 +374,26 @@
return (int)$this->composite_type_id;
}
+ public function set_custom_prize( $custom_prize )
+ {
+ $this->custom_prize = (float)$custom_prize;
+ }
+
+ public function get_custom_prize()
+ {
+ return (float)$this->custom_prize;
+ }
+
+ public function set_prize_type_id( $prize_type_id )
+ {
+ $this->prize_type_id = (int)$prize_type_id;
+ }
+
+ public function get_prize_type_id()
+ {
+ return (int)$this->prize_type_id;
+ }
+
/**
* Fetch composite standards on the form array(array('id' => 1,
'name' => 'some text', 'selected' => 1|0))
* @return array
@@ -510,6 +532,8 @@
'composite_type_id' =>
$this->get_composite_type_id(),
'part_of_town_id' =>
$this->get_part_of_town_id(),
'custom_prize_factor' =>
$this->get_custom_prize_factor(),
+ 'custom_prize' => $this->get_custom_prize(),
+ 'prize_type_id' => $this->get_prize_type_id(),
);
}
}
\ No newline at end of file
Modified: trunk/rental/setup/setup.inc.php
===================================================================
--- trunk/rental/setup/setup.inc.php 2016-10-03 15:22:21 UTC (rev 15789)
+++ trunk/rental/setup/setup.inc.php 2016-10-03 18:15:44 UTC (rev 15790)
@@ -1,6 +1,6 @@
<?php
$setup_info['rental']['name'] = 'rental'; // Module identifier
- $setup_info['rental']['version'] = '0.1.0.29'; // Current module version
+ $setup_info['rental']['version'] = '0.1.0.30'; // 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-10-03 15:22:21 UTC (rev
15789)
+++ trunk/rental/setup/tables_current.inc.php 2016-10-03 18:15:44 UTC (rev
15790)
@@ -32,6 +32,8 @@
'standard_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
'part_of_town_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
'custom_prize_factor' => array('type' =>
'decimal', 'precision' => '20', 'scale' => '2', 'nullable' => true, 'default'
=> '1.00'),
+ 'custom_prize' => array('type' => 'decimal',
'precision' => '20', 'scale' => '2', 'nullable' => true, 'default' => '1.00'),
+ 'prize_type_id' => array('type' => 'int',
'precision' => 2, 'nullable' => true,'default' => 1),
),
'pk' => array('id'),
'fk' => array(),
Modified: trunk/rental/setup/tables_update.inc.php
===================================================================
--- trunk/rental/setup/tables_update.inc.php 2016-10-03 15:22:21 UTC (rev
15789)
+++ trunk/rental/setup/tables_update.inc.php 2016-10-03 18:15:44 UTC (rev
15790)
@@ -695,3 +695,29 @@
}
}
+ $test[] = '0.1.0.29';
+ function rental_upgrade0_1_0_29()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('rental_composite',
'prize_type_id', array(
+ 'type' => 'int',
+ 'precision' => '2',
+ 'nullable' => true,
+ 'default' => 2
+ ));
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('rental_composite',
'custom_prize',array(
+ 'type' => 'decimal',
+ 'precision' => '20',
+ 'scale' => '2',
+ 'nullable' => true,
+ 'default' => '0.00'
+ ));
+
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['rental']['currentver'] =
'0.1.0.30';
+ return $GLOBALS['setup_info']['rental']['currentver'];
+ }
+ }
Modified: trunk/rental/templates/base/composite.xsl
===================================================================
--- trunk/rental/templates/base/composite.xsl 2016-10-03 15:22:21 UTC (rev
15789)
+++ trunk/rental/templates/base/composite.xsl 2016-10-03 18:15:44 UTC (rev
15790)
@@ -78,6 +78,22 @@
</select>
</div>
<xsl:if
test="contract_furnished_status = 1">
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'custom prize')"/>
+ </label>
+ <input
type="text" name="custom_prize" id="custom_prize" value="{value_custom_prize}"/>
+ </div>
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'prize type')"/>
+ </label>
+ <xsl:if
test="count(//list_prize_type/options) > 0">
+ <select
id="prize_type_id" name="prize_type_id">
+
<xsl:apply-templates select="list_prize_type/options"/>
+
</select>
+ </xsl:if>
+ </div>
<div
class="pure-control-group">
<label>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15790] rental: custom prizing,
sigurdne <=