[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15659]
From: |
saul . huanay |
Subject: |
[Fmsystem-commits] [15659] |
Date: |
Tue, 13 Sep 2016 17:29:37 +0000 (UTC) |
Revision: 15659
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15659
Author: psaul
Date: 2016-09-13 17:29:37 +0000 (Tue, 13 Sep 2016)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind-2/rental/inc/class.soapplication.inc.php
branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php
branches/dev-syncromind-2/rental/js/rental/application.edit.js
branches/dev-syncromind-2/rental/js/rental/schedule.js
Modified: branches/dev-syncromind-2/rental/inc/class.soapplication.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.soapplication.inc.php
2016-09-13 09:38:16 UTC (rev 15658)
+++ branches/dev-syncromind-2/rental/inc/class.soapplication.inc.php
2016-09-13 17:29:37 UTC (rev 15659)
@@ -118,5 +118,16 @@
}
+
+ public function add_composite($application_id, $composite_id)
+ {
+ $q = "INSERT INTO rental_application_composite
(application_id, composite_id) VALUES ($application_id, $composite_id)";
+ $result = $this->db->query($q);
+ if ($result)
+ {
+ return true;
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php
2016-09-13 09:38:16 UTC (rev 15658)
+++ branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php
2016-09-13 17:29:37 UTC (rev 15659)
@@ -42,6 +42,7 @@
'view' => true,
'edit' => true,
'save' => true,
+ 'add_composite' => true
);
protected
@@ -474,7 +475,15 @@
$toolbar[] = array (
'name' => 'reserve',
'text' => 'Reserve',
- 'callFunction' => 'reserveComposite',
+ 'callFunction' => array(
+ 'name' => 'reserveComposite',
+ 'args' => json_encode(array(
+ 'url' => self::link(array(
+ 'menuaction' =>
'rental.uiapplication.add_composite',
+ 'phpgw_return_as' =>
'json'
+ ))
+ ))
+ ),
'attributes' => array(
'class' => 'need-free'
),
@@ -575,4 +584,22 @@
return $this->jquery_results($applications);
}
+
+ public function add_composite()
+ {
+ $application_id = (int)phpgw::get_var('application_id');
+ $composite_id = (int)phpgw::get_var('composite_id');
+
+ $so_application = rental_soapplication::get_instance();
+ $result =
$so_application->add_composite($application_id, $composite_id);
+ if ($result)
+ {
+ $message = 'Composite ' . $composite_id . ' ' .
lang('has been added');
+ }
+ else
+ {
+ $message = 'Composite ' . $composite_id . ' ' .
lang('not added');
+ }
+ return $message;
+ }
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/rental/js/rental/application.edit.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/application.edit.js
2016-09-13 09:38:16 UTC (rev 15658)
+++ branches/dev-syncromind-2/rental/js/rental/application.edit.js
2016-09-13 17:29:37 UTC (rev 15659)
@@ -30,8 +30,20 @@
$("#active_tab").val(tab);
}
-function reserveComposite ()
+function reserveComposite (data, button)
{
- var text = "Composite " + schedule.rental['data']['id'] + ",
application_id " + $('#application_id').val();
- $('#tempMessage').append("<li>" + text + "</li>");
+ button.disabled = true;
+ data = jQuery.parseJSON(data);
+
+ var url = data['url'];
+ var application_id = $('#application_id').val();
+ var composite_id = schedule.rental['data']['id'];
+
+ var params = {application_id: application_id, composite_id:
composite_id};
+
+ $.post(url, params, function(m)
+ {
+ button.disabled = false;
+ $('#tempMessage').append("<li>" + m + "</li>");
+ });
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/rental/js/rental/schedule.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/schedule.js 2016-09-13
09:38:16 UTC (rev 15658)
+++ branches/dev-syncromind-2/rental/js/rental/schedule.js 2016-09-13
17:29:37 UTC (rev 15659)
@@ -299,7 +299,7 @@
{
button.addEventListener('click', function(event){
event.preventDefault()
- self[callFunction]();
+
self[callFunction['name']](callFunction['args'], this);
});
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15659],
saul . huanay <=