[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16151] more on rental
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16151] more on rental |
Date: |
Wed, 11 Jan 2017 13:57:21 -0500 (EST) |
Revision: 16151
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16151
Author: sigurdne
Date: 2017-01-11 13:57:21 -0500 (Wed, 11 Jan 2017)
Log Message:
-----------
more on rental
Modified Paths:
--------------
trunk/rental/inc/class.boemail_out.inc.php
trunk/rental/inc/class.soemail_out.inc.php
trunk/rental/inc/class.uiemail_out.inc.php
trunk/rental/templates/base/email_out.xsl
Modified: trunk/rental/inc/class.boemail_out.inc.php
===================================================================
--- trunk/rental/inc/class.boemail_out.inc.php 2017-01-11 15:29:32 UTC (rev
16150)
+++ trunk/rental/inc/class.boemail_out.inc.php 2017-01-11 18:57:21 UTC (rev
16151)
@@ -106,4 +106,15 @@
{
return
rental_soemail_out::get_instance()->get_composite_candidates($composite_id);
}
+
+ function set_candidates($id, $ids)
+ {
+ return
rental_soemail_out::get_instance()->set_candidates($id, $ids);
+ }
+
+ public function get_recipients( $email_out_id )
+ {
+ return
rental_soemail_out::get_instance()->get_recipients($email_out_id);
+ }
+
}
\ No newline at end of file
Modified: trunk/rental/inc/class.soemail_out.inc.php
===================================================================
--- trunk/rental/inc/class.soemail_out.inc.php 2017-01-11 15:29:32 UTC (rev
16150)
+++ trunk/rental/inc/class.soemail_out.inc.php 2017-01-11 18:57:21 UTC (rev
16151)
@@ -157,4 +157,84 @@
return $values;
}
+ public function get_recipients( $email_out_id )
+ {
+ $email_out_id = (int) $email_out_id;
+ $values = array();
+
+ $sql = "SELECT email, first_name, last_name,
company_name, rental_party.id, status"
+ . " FROM rental_email_out_party"
+ . " {$this->join} rental_party ON
rental_email_out_party.party_id = rental_party.id"
+ . " WHERE rental_email_out_party.email_out_id =
{$email_out_id}";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $first_name = $this->db->f('first_name',true);
+ $last_name = $this->db->f('last_name',true);
+ $company_name =
$this->db->f('company_name',true);
+
+ $name = '';
+ if($last_name)
+ {
+ $name .= "$last_name, $first_name";
+ }
+ if($last_name && $company_name)
+ {
+ $name .= " ({$company_name})";
+ }
+ else if($company_name)
+ {
+ $name = $company_name;
+ }
+
+ $values[] = array(
+ 'id' => $this->db->f('id'),
+ 'name' => $name,
+ 'email' => $this->db->f('email',true),
+ 'status' =>
$this->db->f('status')
+ );
+ }
+ return $values;
+ }
+
+ function set_candidates($id, $ids)
+ {
+ $recipients = $this->get_recipients($id);
+
+ $check_duplicates = array();
+ foreach ($recipients as $entry)
+ {
+ $check_duplicates[] = $entry['id'];
+ }
+
+
+ $sql = 'INSERT INTO rental_email_out_party
(email_out_id, party_id)'
+ . ' VALUES(?, ?)';
+ foreach ($ids as $party_id)
+ {
+ if(in_array($party_id, $check_duplicates))
+ {
+ continue;
+ }
+
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' => (int)$id,
+ 'type' => PDO::PARAM_INT
+ ),
+ 2 => array
+ (
+ 'value' => $party_id,
+ 'type' => PDO::PARAM_INT
+ )
+ );
+ }
+ if($valueset)
+ {
+ return $GLOBALS['phpgw']->db->insert($sql,
$valueset, __LINE__, __FILE__);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/rental/inc/class.uiemail_out.inc.php
===================================================================
--- trunk/rental/inc/class.uiemail_out.inc.php 2017-01-11 15:29:32 UTC (rev
16150)
+++ trunk/rental/inc/class.uiemail_out.inc.php 2017-01-11 18:57:21 UTC (rev
16151)
@@ -42,7 +42,9 @@
'edit' => true,
'save' => true,
'get' => true,
- 'get_candidates' => true
+ 'get_candidates' => true,
+ 'set_candidates' => true,
+ 'get_recipients'=> true
);
protected
@@ -192,8 +194,8 @@
)
);
- $candidates_def = array(
- array('key' => 'id', 'label' => '#', 'sortable'
=> true, 'resizeable' => true),
+ $parties_def = array(
+ array('key' => 'id', 'label' => 'ID',
'sortable' => true, 'resizeable' => true,'formatter' =>
'JqueryPortico.formatLink'),
array('key' => 'name', 'label' => lang('name'),
'sortable' => true, 'resizeable' => true),
array('key' => 'email', 'label' =>
lang('email'), 'sortable' => true, 'resizeable' => true),
);
@@ -204,7 +206,8 @@
array('my_name' => 'select_none')
);
- $tabletools[] = array
+ $tabletools_candidate = array();
+ $tabletools_candidate[] = array
(
'my_name' => 'add',
'text' => lang('add'),
@@ -236,9 +239,9 @@
// 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'property.notify.update_data',
// 'location_id' => $location_id,
'location_item_id' => $id, 'action' => 'refresh_notify_contact',
// 'phpgw_return_as' => 'json'))),
- 'ColumnDefs' => $candidates_def,
+ 'ColumnDefs' => $parties_def,
'data' => json_encode(array()),
- 'tabletools' => $tabletools,
+ 'tabletools' =>
array_merge($tabletools,$tabletools_candidate),
'config' => array(
array('disableFilter' => true),
array('disablePagination' => true)
@@ -245,6 +248,51 @@
)
);
+
+ $tabletools_recipient = array();
+ $tabletools_recipient[] = array
+ (
+ 'my_name' => 'delete',
+ 'text' => lang('delete'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var api = oTable2.api();
+ var selected = api.rows( {
selected: true } ).data();
+
+ var numSelected =
selected.length;
+
+ if (numSelected ==0){
+ alert('None selected');
+ return false;
+ }
+ var ids = [];
+ for ( var n = 0; n <
selected.length; ++n )
+ {
+ var aData = selected[n];
+ ids.push(aData['id']);
+ }
+
onActionsClick_recipient('delete', ids);
+ "
+ );
+
+
+ $parties_def[] = array('key' => 'status', 'label' =>
lang('status'), 'sortable' => true, 'resizeable' => true);
+
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_2',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'rental.uiemail_out.get_recipients',
+ 'id' => $id,'phpgw_return_as'
=> 'json'))),
+ 'ColumnDefs' => $parties_def,
+ 'data' => json_encode(array()),
+ 'tabletools' =>
array_merge($tabletools,$tabletools_recipient),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true)
+ )
+ );
+
$data = array(
'datatable_def' => $datatable_def,
'form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uiemail_out.save')),
@@ -298,6 +346,8 @@
{
case 'composite':
$values =
$this->bo->get_composite_candidates($id);
+ array_walk($values, array($this,
"_add_links"), "rental.uiparty.edit");
+
break;
default:
@@ -307,4 +357,20 @@
return $this->jquery_results(array('results' =>
$values));
}
+
+ public function set_candidates()
+ {
+ $id = phpgw::get_var('id', 'int');
+ $ids = (array) phpgw::get_var('ids', 'int');
+ $ret = $this->bo->set_candidates($id, $ids);
+ }
+
+ public function get_recipients()
+ {
+ $id = phpgw::get_var('id', 'int');
+ $values = $this->bo->get_recipients($id);
+ array_walk($values, array($this, "_add_links"),
"rental.uiparty.edit");
+ return $this->jquery_results(array('results' =>
$values));
+
+ }
}
\ No newline at end of file
Modified: trunk/rental/templates/base/email_out.xsl
===================================================================
--- trunk/rental/templates/base/email_out.xsl 2017-01-11 15:29:32 UTC (rev
16150)
+++ trunk/rental/templates/base/email_out.xsl 2017-01-11 18:57:21 UTC (rev
16151)
@@ -39,7 +39,7 @@
<label>
<xsl:value-of select="php:function('lang', 'id')"/>
</label>
- <input
type="hidden" name="id" value="{email_out/id}"/>
+ <input
type="hidden" id="id" name="id" value="{email_out/id}"/>
<xsl:value-of
select="email_out/id"/>
</div>
</xsl:if>
@@ -130,24 +130,42 @@
</input>
<div
id="composite_container"/>
</div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'candidates')"/>
- </label>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'candidates')"/>
+ </label>
- <xsl:for-each
select="datatable_def">
- <xsl:if test="container
= 'datatable-container_1'">
-
<xsl:call-template name="table_setup">
-
<xsl:with-param name="container" select ='container'/>
-
<xsl:with-param name="requestUrl" select ='requestUrl'/>
-
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
-
<xsl:with-param name="data" select ='data'/>
-
<xsl:with-param name="tabletools" select ='tabletools'/>
-
<xsl:with-param name="config" select ='config'/>
-
</xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- </div>
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_1'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="tabletools" select ='tabletools'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'recipients')"/>
+ </label>
+
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_2'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="tabletools" select ='tabletools'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </div>
</fieldset>
</div>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16151] more on rental,
sigurdne <=