From 7cd92de439778a89120fb11b138c70244989222e Mon Sep 17 00:00:00 2001
From: Dany De Bontridder
Date: Thu, 5 Nov 2015 11:14:45 +0100
Subject: [PATCH] =?UTF-8?q?Task=20#1198=20-=20Ajout=20heure=20pour=20nouve?=
=?UTF-8?q?l=20=C3=A9v=C3=A9nement=20#1198=20:=20add=20hour=20for=20event?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
html/js/gestion.js | 13 +++++++++-
include/ajax/ajax_gestion.php | 2 ++
include/class/class_follow_up.php | 7 +++---
include/template/action_display_short.php | 29 ++++++++++++++++-------
4 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/html/js/gestion.js b/html/js/gestion.js
index 2d43ef6d7..5fba5b951 100644
--- a/html/js/gestion.js
+++ b/html/js/gestion.js
@@ -363,6 +363,7 @@ function action_save_short()
$('action_add_frm')['date_event_action_short'].parentNode.className="";
$('action_add_frm')['title_event'].parentNode.className="";
$('action_add_frm')['type_event'].parentNode.className="";
+ $('action_add_frm')['hour_event'].parentNode.className="";
if ( $('action_add_frm')['date_event_action_short'].value.trim() == '') {
$('action_add_frm')['date_event_action_short'].parentNode.className="notice";
@@ -373,7 +374,17 @@ function action_save_short()
$('action_add_frm')['title_event'].parentNode.className="notice";
return false;
}
-
+ var str_hour=new String($('action_add_frm')['hour_event'].value);
+ str_hour=str_hour.trim();
+
+ if ( str_hour.search(/^[0-9]{2}:[0-9]{2}$/) == -1 &&
+ str_hour.search(/^[0-9]{2}.[0-9]{2}$/) == -1)
+ {
+ $('action_add_frm')['hour_event'].parentNode.className="notice";
+ alert_box('HH:MM or HH.MM');
+ return false;
+ }
+
if ( $('action_add_frm')['type_event'].options[$('action_add_frm')['type_event'].selectedIndex].value == -1 )
{
$('action_add_frm')['type_event'].parentNode.className="notice";
diff --git a/include/ajax/ajax_gestion.php b/include/ajax/ajax_gestion.php
index f9de14c03..f9a9a3254 100644
--- a/include/ajax/ajax_gestion.php
+++ b/include/ajax/ajax_gestion.php
@@ -58,6 +58,7 @@ if ($op=='action_save')
$title=HtmlInput::default_value_get("title_event", NULL);
$summary=HtmlInput::default_value_get("summary", "");
$type_event=HtmlInput::default_value_get('type_event', -1);
+ $hour_event=HtmlInput::default_value_get('hour_event', null);
/*
* Check if data are valid
*/
@@ -107,6 +108,7 @@ if ($op=='action_save')
$gestion->ag_comment=h($summary);
$gestion->ag_timestamp=$date_event;
$gestion->ag_remind_date=$date_event;
+ $gestion->ag_hour=$hour_event;
$content=_('Sauvé');
$status='OK';
try {
diff --git a/include/class/class_follow_up.php b/include/class/class_follow_up.php
index 68fa5f5db..d81ecda7b 100644
--- a/include/class/class_follow_up.php
+++ b/include/class/class_follow_up.php
@@ -1811,11 +1811,11 @@ class Follow_Up
$sql="insert into action_gestion".
"(ag_id,ag_timestamp,ag_type,ag_title,f_id_dest,ag_ref, "
. "ag_dest, ".
- " ag_priority,ag_owner,ag_state,ag_remind_date) ".
+ " ag_priority,ag_owner,ag_state,ag_remind_date,ag_hour) ".
" values "
. "($1,to_date($2,'DD.MM.YYYY'),$3,$4,$5,$6,"
. "$7,"
- . "$8,$9,$10,to_date($11,'DD.MM.YYYY'))";
+ . "$8,$9,$10,to_date($11,'DD.MM.YYYY'),$12)";
$this->db->exec_sql($sql, array(
$this->ag_id, /* 1 */
@@ -1828,7 +1828,8 @@ class Follow_Up
$this->ag_priority, /* 8 */
$_SESSION['g_user'], /* 9 */
$this->ag_state, /* 10 */
- $this->ag_remind_date /* 11 */
+ $this->ag_remind_date, /* 11 */
+ $this->ag_hour /* 12 */
)
);
diff --git a/include/template/action_display_short.php b/include/template/action_display_short.php
index c99cf6ff8..080f8f75e 100644
--- a/include/template/action_display_short.php
+++ b/include/template/action_display_short.php
@@ -75,31 +75,44 @@ $dest->set_dblclick("fill_ipopcard(this);");
$dest->set_attribute('ipopup', 'ipopcard');
$dest->style=' style="vertical-align:0%"';
+// Hours
+$hour=new IText('hour_event');
+$hour->size=5;
+
echo HtmlInput::title_box(_('Nouvel événement'), 'action_add_div');
?>
-Destinataire input();?>
+
+
input()?>
-
+
input()?>