[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15346] property: check for purchase rights
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15346] property: check for purchase rights |
Date: |
Tue, 28 Jun 2016 16:14:02 +0000 (UTC) |
Revision: 15346
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15346
Author: sigurdne
Date: 2016-06-28 16:14:01 +0000 (Tue, 28 Jun 2016)
Log Message:
-----------
property: check for purchase rights
Modified Paths:
--------------
trunk/property/inc/class.uitts.inc.php
trunk/property/js/portico/tts.view.js
trunk/property/templates/base/tts.xsl
Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php 2016-06-28 13:59:33 UTC (rev
15345)
+++ trunk/property/inc/class.uitts.inc.php 2016-06-28 16:14:01 UTC (rev
15346)
@@ -2862,15 +2862,18 @@
{
$config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'));
$check_external_register=
!!$config->config_data['external_register']['check_external_register'];
- $id = phpgw::get_var('ecodimb');
+ $id = phpgw::get_var('ecodimb');
+ // $id ='013000';
+ $amount =phpgw::get_var('amount', 'int');
+
if($check_external_register && $id)
{
$url =
$config->config_data['external_register']['url'];
$username =
$config->config_data['external_register']['username'];
$password =
$config->config_data['external_register']['password'];
- $sub_check = 'objekt';
- $fullmakt =
$this->check_external_register(array(
+ $sub_check = 'fullmakter';
+ $fullmakter =
$this->check_external_register(array(
'url' => $url,
'username' => $username,
'password' => $password,
@@ -2882,8 +2885,42 @@
/**
* some magic...to decide $supervisor_lid
*/
+ if(isset($fullmakter[0]))
+ {
+ if($amount > 5000 && $amount <= 100000)
+ {
+ $supervisor_lid =
strtolower($fullmakter[0]['inntil100k']);
+ }
+ else if ($amount > 100000 && $amount <=
1000000)
+ {
+ $supervisor_lid =
strtolower($fullmakter[0]['fra100kTil1m']);
+ }
+ else if ($amount > 1000000 && $amount
<= 5000000)
+ {
+ $supervisor_lid =
strtolower($fullmakter[0]['fra1mTil5m']);
+ }
+ else if ($amount > 5000000)
+ {
+ $supervisor_lid =
strtolower($fullmakter[0]['ubegrenset']);
+ }
+ else
+ {
+ $supervisor_lid = ''; // maybe
add a required configurable failsafe as backup...
+ }
+ }
+ // $supervisor_lid = 'hc483';
- $supervisor_lid = 'hc483';
+ /*
+ [inntil100k] => (string) DV645
+ [fra100kTil1m] => (string) DV645
+ [fra1mTil5m] => (string) YN450
+ [ubegrenset] => (string) JG406
+ [periodeFra] => (string) 200300
+ [periodeTil] => (string) 209912
+ [status] => (string) N
+ [aktiv] => (bool) true
+ */
+
$supervisor_id =
$GLOBALS['phpgw']->accounts->name2id($supervisor_lid);
}
else
@@ -2896,7 +2933,7 @@
public function check_external_register($param)
{
- $id = 5501;//$param['id'];
+ $id = $param['id'];
// $url =
"http://tjenester.usrv.ubergenkom.no/api/tilskudd/{$sub_check}";
$url = "{$param['url']}/{$param['sub_check']}";
$extravars = array
@@ -2933,7 +2970,7 @@
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
- return json_decode($result);
+ return json_decode($result, true);
}
protected function get_supervisor_email($supervisor_id)
@@ -2948,6 +2985,7 @@
$supervisor_email[] = array(
'id' => $supervisor_id,
'address' => $prefs['email'],
+ 'required' => true
);
}
@@ -2960,6 +2998,7 @@
$supervisor_email[] = array(
'id' =>
$prefs['approval_from'],
'address' =>
$prefs2['email'],
+ 'required' => false
);
$supervisor_email =
array_reverse($supervisor_email);
}
Modified: trunk/property/js/portico/tts.view.js
===================================================================
--- trunk/property/js/portico/tts.view.js 2016-06-28 13:59:33 UTC (rev
15345)
+++ trunk/property/js/portico/tts.view.js 2016-06-28 16:14:01 UTC (rev
15346)
@@ -1,5 +1,6 @@
var d;
var vendor_id = 0;
+var amount = 0;
this.local_DrawCallback4 = function ()
{
@@ -26,6 +27,7 @@
}) : 0;
$(api.column(col).footer()).html("<div align=\"right\">" +
$.number(pageTotal, 2, ',', '.') + "</div>");
+ amount = pageTotal;
});
};
@@ -342,10 +344,9 @@
$(window).load(function ()
{
ecodimb = $('#ecodimb').val();
- var selection = [];
if (ecodimb)
{
- populateTableChkApproval(ecodimb, selection);
+ populateTableChkApproval();
// populateTableChkRegulations(building_id,
initialDocumentSelection, resources);
ecodimb_selection = ecodimb;
}
@@ -354,27 +355,28 @@
var ecodimb = ui.item.value;
if (ecodimb != ecodimb_selection)
{
- populateTableChkApproval(ecodimb, selection);
+ populateTableChkApproval(ecodimb);
}
});
+
+ $("#budget").change(function ()
+ {
+ populateTableChkApproval();
+ });
+
});
-function populateTableChkApproval(ecodimb, selection)
+function populateTableChkApproval(ecodimb)
{
-// oArgs = {menuaction: 'bookingfrontend.uiresource.index_json', sort:
'name', filter_building_id: 1, sub_activity_id: $("#field_activity").val()};
-// var url = phpGWLink('bookingfrontend/', oArgs, true);
-// var container = 'approval_container';
-// var colDefs = [
-// {label: '', object: [{type: 'input', attrs: [
-// {name: 'type', value:
'checkbox'}, {name: 'name', value: 'values[approval][]'}, {name: 'class',
value: 'chkRegulations'}
-// ]}
-// ], value: 'id', checked: selection},
-// {key: 'name', label: lang['Name']},
-// {key: 'type', label: lang['Address']}
-// ];
-// createTable(container, url, colDefs, 'results');
+ ecodimb = ecodimb || $('#ecodimb').val();
- var oArgs = {menuaction: 'property.uitts.check_purchase_right',
ecodimb: ecodimb};
+ if(!ecodimb)
+ {
+ return;
+ }
+
+ var total_amount = Number(amount) + Number($('#budget').val());
+ var oArgs = {menuaction: 'property.uitts.check_purchase_right',
ecodimb: ecodimb, amount: total_amount};
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = "";
@@ -388,11 +390,20 @@
{
htmlString = "<table>";
var obj = data;
+ var required = '';
$.each(obj, function (i)
{
+ required = '';
+
htmlString += "<tr><td>"
- htmlString += "<input type=\"checkbox\"
name=\"values[approval][" + obj[i].id + "]\" value=\"" + obj[i].address
+"\"></input>";
+
+ if (obj[i].required == true)
+ {
+ htmlString += "<input
type=\"hidden\" name=\"values[approval][" + obj[i].id + "]\" value=\"" +
obj[i].address +"\"></input>";
+ required = 'checked="checked"
disabled="disabled"';
+ }
+ htmlString += "<input type=\"checkbox\"
name=\"values[approval][" + obj[i].id + "]\" value=\"" + obj[i].address +"\"" +
required +"></input>";
htmlString += "</td><td
valign=\"top\">";
htmlString += obj[i].address;
htmlString += "</td></tr>";
Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl 2016-06-28 13:59:33 UTC (rev
15345)
+++ trunk/property/templates/base/tts.xsl 2016-06-28 16:14:01 UTC (rev
15346)
@@ -860,7 +860,7 @@
<label>
<xsl:value-of select="php:function('lang', 'cost estimate')"/>
</label>
-
<input type="text" name="values[budget]">
+
<input id="budget" type="text" name="values[budget]">
<xsl:attribute name="title">
<xsl:value-of select="php:function('lang', 'Enter the
budget')"/>
</xsl:attribute>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15346] property: check for purchase rights,
sigurdne <=