[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12033] property: custom functions
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12033] property: custom functions |
Date: |
Mon, 30 Jun 2014 07:36:25 +0000 |
Revision: 12033
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12033
Author: sigurdne
Date: 2014-06-30 07:36:23 +0000 (Mon, 30 Jun 2014)
Log Message:
-----------
property: custom functions
Modified Paths:
--------------
trunk/property/inc/class.botts.inc.php
trunk/property/inc/custom/default/catch_ticket_export.php
trunk/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
trunk/property/inc/custom/default/ticket_NLSH_validate.js
trunk/property/templates/base/attributes_form.xsl
Added Paths:
-----------
trunk/property/inc/custom/default/ticket_NLSH_pre_commit_validate.php
Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php 2014-06-29 15:06:35 UTC (rev
12032)
+++ trunk/property/inc/class.botts.inc.php 2014-06-30 07:36:23 UTC (rev
12033)
@@ -996,39 +996,27 @@
return (int)$result['id'];
}
- function add($ticket, $values_attribute = array())
+ function add($data, $values_attribute = array())
{
- if((!isset($ticket['location_code']) || !
$ticket['location_code']) && isset($ticket['location']) &&
is_array($ticket['location']))
+ if((!isset($data['location_code']) || !
$data['location_code']) && isset($data['location']) &&
is_array($data['location']))
{
- while (is_array($ticket['location']) &&
list(,$value) = each($ticket['location']))
+ while (is_array($data['location']) &&
list(,$value) = each($data['location']))
{
if($value)
{
$location[] = $value;
}
}
- $ticket['location_code']=implode("-",
$location);
+ $data['location_code']=implode("-", $location);
}
- $ticket['finnish_date'] =
$this->bocommon->date_to_timestamp($ticket['finnish_date']);
+ $data['finnish_date'] =
$this->bocommon->date_to_timestamp($data['finnish_date']);
if($values_attribute && is_array($values_attribute))
{
$values_attribute =
$this->custom->convert_attribute_save($values_attribute);
}
- $receipt = $this->so->add($ticket, $values_attribute);
-
- $this->config->read();
-
- if ( (isset($ticket['send_mail']) &&
$ticket['send_mail'])
- ||
(isset($this->config->config_data['mailnotification'])
- &&
$this->config->config_data['mailnotification'])
- )
- {
- $receipt_mail =
$this->mail_ticket($receipt['id'],false,$receipt,$ticket['location_code'],
false, isset($ticket['send_mail']) && $ticket['send_mail'] ? true : false);
- }
-
$criteria = array
(
'appname' => 'property',
@@ -1047,8 +1035,36 @@
}
$file = PHPGW_SERVER_ROOT .
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
- if ( $entry['active'] && is_file($file) )
+ if ( $entry['active'] && is_file($file) &&
!$entry['client_side'] && $entry['pre_commit'])
{
+ require $file;
+ }
+ }
+
+ $receipt = $this->so->add($data, $values_attribute);
+
+ $this->config->read();
+
+ if ( (isset($data['send_mail']) && $data['send_mail'])
+ ||
(isset($this->config->config_data['mailnotification'])
+ &&
$this->config->config_data['mailnotification'])
+ )
+ {
+ $receipt_mail =
$this->mail_ticket($receipt['id'],false,$receipt,$data['location_code'], false,
isset($data['send_mail']) && $data['send_mail'] ? true : false);
+ }
+
+ reset($custom_functions);
+ foreach ( $custom_functions as $entry )
+ {
+ // prevent path traversal
+ if ( preg_match('/\.\./', $entry['file_name']) )
+ {
+ continue;
+ }
+
+ $file = PHPGW_SERVER_ROOT .
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+ if ( $entry['active'] && is_file($file) &&
!$entry['client_side'] && !$entry['pre_commit'])
+ {
require_once $file;
}
}
@@ -1407,16 +1423,13 @@
return $receipt;
}
- public function update_ticket($data, $id,$receipt =
array(),$values_attribute = array())
+ public function update_ticket(&$data, $id,$receipt =
array(),$values_attribute = array())
{
if($values_attribute && is_array($values_attribute))
{
$values_attribute =
$this->custom->convert_attribute_save($values_attribute);
}
- $receipt = $this->so->update_ticket($data, $id,
$receipt, $values_attribute, $this->simple);
- $this->fields_updated = $this->so->fields_updated;
-
$criteria = array
(
'appname' => 'property',
@@ -1435,12 +1448,33 @@
}
$file = PHPGW_SERVER_ROOT .
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
- if ( $entry['active'] && is_file($file) &&
!$entry['client_side'])
+ if ( $entry['active'] && is_file($file) &&
!$entry['client_side'] && $entry['pre_commit'])
{
require $file;
}
}
+ $receipt = $this->so->update_ticket($data, $id,
$receipt, $values_attribute, $this->simple);
+ $this->fields_updated = $this->so->fields_updated;
+
+
+ reset($custom_functions);
+
+ foreach ( $custom_functions as $entry )
+ {
+ // prevent path traversal
+ if ( preg_match('/\.\./', $entry['file_name']) )
+ {
+ continue;
+ }
+
+ $file = PHPGW_SERVER_ROOT .
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+ if ( $entry['active'] && is_file($file) &&
!$entry['client_side'] && !$entry['pre_commit'])
+ {
+ require $file;
+ }
+ }
+
return $receipt;
}
Modified: trunk/property/inc/custom/default/catch_ticket_export.php
===================================================================
--- trunk/property/inc/custom/default/catch_ticket_export.php 2014-06-29
15:06:35 UTC (rev 12032)
+++ trunk/property/inc/custom/default/catch_ticket_export.php 2014-06-30
07:36:23 UTC (rev 12033)
@@ -282,5 +282,5 @@
}
$export = new catch_ticket_export();
- $export->export_ticket($ticket);
+ $export->export_ticket($data);
Modified:
trunk/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
===================================================================
---
trunk/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
2014-06-29 15:06:35 UTC (rev 12032)
+++
trunk/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
2014-06-30 07:36:23 UTC (rev 12033)
@@ -1,5 +1,5 @@
<?php
- if($ticket['cat_id'] == 4)
+ if($data['cat_id'] == 4)
{
$db = $this->bocommon->new_db();
Added: trunk/property/inc/custom/default/ticket_NLSH_pre_commit_validate.php
===================================================================
--- trunk/property/inc/custom/default/ticket_NLSH_pre_commit_validate.php
(rev 0)
+++ trunk/property/inc/custom/default/ticket_NLSH_pre_commit_validate.php
2014-06-30 07:36:23 UTC (rev 12033)
@@ -0,0 +1,36 @@
+<?php
+ /*
+ * This file will only work for the implementation of NLSH
+ */
+
+ /**
+ * Intended for custom validation of tickets prior to commit.
+ *
+ * @author Sigurd Nes <address@hidden>
+ */
+ class ticket_NLSH_pre_commit_validate extends property_botts
+ {
+ function __construct()
+ {
+ parent::__construct();
+ }
+
+ /**
+ * Do your magic
+ * @param integer $id
+ * @param array $data
+ * @param array $values_attribute
+ */
+ function validate($id = 0, &$data, $values_attribute = array())
+ {
+ // _debug_array($data);
+ // $data['assignedto'] = 11;
+ // return 'Validate';
+ }
+ }
+
+ $ticket_NLSH_pre_commit_validate = new
ticket_NLSH_pre_commit_validate();
+ if($_error = $ticket_NLSH_pre_commit_validate->validate($id, $data,
$values_attribute))
+ {
+ return $receipt['error'][]=array('msg'=>$_error);
+ }
Modified: trunk/property/inc/custom/default/ticket_NLSH_validate.js
===================================================================
--- trunk/property/inc/custom/default/ticket_NLSH_validate.js 2014-06-29
15:06:35 UTC (rev 12032)
+++ trunk/property/inc/custom/default/ticket_NLSH_validate.js 2014-06-30
07:36:23 UTC (rev 12033)
@@ -1,13 +1,29 @@
$(document).ready(function()
{
- if (!$("#global_category_id").val() === 20)
+ show_feilkoder();
+
+ $("#global_category_id").change(function()
{
+ show_feilkoder();
+ });
+
+});
+
+function show_feilkoder()
+{
+ if ($("#global_category_id").val() == 20)
+ {
+ document.getElementById('label_feilkoder').style.display =
'block';
+ document.getElementById('id_feilkoder').style.display = 'block';
+ }
+ else
+ {
document.getElementById('label_feilkoder').style.display =
'none';
document.getElementById('id_feilkoder').style.display = 'none';
}
-});
+}
function validate_submit()
{
var error = false;
Modified: trunk/property/templates/base/attributes_form.xsl
===================================================================
--- trunk/property/templates/base/attributes_form.xsl 2014-06-29 15:06:35 UTC
(rev 12032)
+++ trunk/property/templates/base/attributes_form.xsl 2014-06-30 07:36:23 UTC
(rev 12033)
@@ -39,6 +39,7 @@
<xsl:choose>
<xsl:when test="not(hide_row)">
<td class="first"
title="{$statustext}">
+ <div id="label_{name}">
<label>
<xsl:choose>
<xsl:when
test="helpmsg=1">
@@ -71,6 +72,7 @@
</xsl:when>
</xsl:choose>
</label>
+ </div>
</td>
</xsl:when>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12033] property: custom functions,
Sigurd Nes <=