Index: web/config/config_inc.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/config/config_inc.php (revision 4274d7b6f52e69e06bdc1d7d63a90d5ef92c1bee)
+++ web/config/config_inc.php (date 1536582345000)
@@ -8,3 +8,5 @@
$g_default_timezone = 'UTC';
$g_crypto_master_salt = 'kXLDYlS97Fm1MopUNscp7qK1wdhs5Ma9zWrus/lLiEU=';
+
+$g_custom_field_type_enum_string = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea,11:datetime';
Index: web/core/date_api.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/core/date_api.php (revision 4274d7b6f52e69e06bdc1d7d63a90d5ef92c1bee)
+++ web/core/date_api.php (date 1536585826000)
@@ -221,6 +221,38 @@
}
}
+/**
+ * Print html option tags for Hour of day in a select list
+ * @param integer $p_hour Integer representing hour of the day.
+ * @return void
+ * @access public
+ */
+function print_hour_option_list( $p_hour = 0 ) {
+ for ($i=0; $i<=23; $i++) {
+ if ( $i+1 == $p_hour ) {
+ PRINT "";
+ } else {
+ PRINT "";
+ }
+ }
+}
+
+/**
+ * Print html option tags for Minute of day in a select list
+ * @param integer $p_minute Integer representing minute of the day.
+ * @return void
+ * @access public
+ */
+function print_minute_option_list( $p_minute = 0 ) {
+ for ($i=0; $i<=59; $i++) {
+ if ( $i+1 == $p_minute ) {
+ PRINT "";
+ } else {
+ PRINT "";
+ }
+ }
+}
+
/**
* Print ' . "\n";
}
+
+ // Personnalisation pour les champs DateTime : ajout d'inputs pour heure et minutes
+ if (strcasecmp( $t_char, "H") == 0) {
+ echo "\n" ;
+ }
+ if (strcasecmp( $t_char, "i") == 0) {
+ echo "\n" ;
+ }
}
+ echo "($p_format)";
}
Index: web/core/cfdefs/cfdef_standard.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/core/cfdefs/cfdef_standard.php (revision 4274d7b6f52e69e06bdc1d7d63a90d5ef92c1bee)
+++ web/core/cfdefs/cfdef_standard.php (date 1536593986000)
@@ -188,6 +188,22 @@
'#function_string_value_for_email' => 'cfdef_prepare_date_value_for_email',
);
+$g_custom_field_type_definition[CUSTOM_FIELD_TYPE_DATETIME] = array (
+ '#display_possible_values' => false,
+ '#display_valid_regexp' => false,
+ '#display_length_min' => false,
+ '#display_length_max' => false,
+ '#display_default_value' => false,
+ '#function_return_distinct_values' => null,
+ '#function_value_to_database' => null,
+ '#function_database_to_value' => null,
+ '#function_default_to_value' => null,
+ '#function_print_input' => 'cfdef_input_datetime',
+ '#function_print_value' => 'cfdef_print_datetime',
+ '#function_string_value' => 'cfdef_prepare_datetime_value',
+ '#function_string_value_for_email' => 'cfdef_prepare_datetime_value_for_email',
+);
+
/**
* Prepare List Value for database storage
* @param string $p_value Value.
@@ -289,6 +305,15 @@
return cfdef_prepare_date_value( $p_value );
}
+ /**
+ * format datetime value for email
+ * @param integer $p_value Value.
+ * @return string
+ */
+ function cfdef_prepare_datetime_value_for_email( $p_value ) {
+ return cfdef_prepare_datetime_value( $p_value );
+ }
+
/**
* Translates the default date value entered by the creator of the custom
* field into a date value. For example, translate '=tomorrow' to tomorrow's
@@ -351,6 +376,21 @@
}
return '';
+}
+
+/**
+ * Prepare datetime value
+ * @param integer $p_value DateTime timestamp.
+ * @return string
+ */
+function cfdef_prepare_datetime_value( $p_value ) {
+ if( $p_value != null ) {
+ if( is_numeric( $p_value ) ) {
+ return date( config_get( 'normal_date_format' ), $p_value );
+ }
+ }
+
+ return '';
}
/**
@@ -481,6 +521,29 @@
print_date_selection_set( 'custom_field_' . $p_field_def['id'], config_get( 'short_date_format' ), $p_custom_field_value, false, true, 0, 0, 'input-sm', $p_required );
}
+/**
+ * Prints the controls for the datetime selector.
+ *
+ * @param string $p_field_def The custom field definition.
+ * @param string $p_custom_field_value The custom field value to print.
+ * @param string $p_required The "required" attribute to add to the field
+ * @return void
+ */
+function cfdef_input_datetime( $p_field_def, $p_custom_field_value, $p_required = '' ) {
+ print_date_selection_set( 'custom_field_' . $p_field_def['id'], config_get( 'normal_date_format' ), $p_custom_field_value, false, true, 0, 0, 'input-sm', $p_required );
+}
+
+/**
+ * Print value of datetime custom field
+ * @param string $p_value The custom field value.
+ */
+function cfdef_print_datetime( $p_value ) {
+ error_log($p_value);
+ if ($p_value != null) {
+ echo date(config_get('normal_date_format'), $p_value);
+ }
+}
+
/**
* value to database
* @param string $p_value Value.
Index: web/core.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/core.php (revision 4274d7b6f52e69e06bdc1d7d63a90d5ef92c1bee)
+++ web/core.php (date 1536585151000)
@@ -95,7 +95,7 @@
# Load user-defined constants (if required)
if( file_exists( $g_config_path . 'custom_constants_inc.php' ) ) {
- require_once( $g_config_path . 'custom_constants_inc.php' );
+ require_once($g_config_path . 'custom_constants_inc.php');
}
# config_inc may not be present if this is a new install
Index: web/core/gpc_api.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/core/gpc_api.php (revision 4274d7b6f52e69e06bdc1d7d63a90d5ef92c1bee)
+++ web/core/gpc_api.php (date 1536584035000)
@@ -217,20 +217,23 @@
return '';
}
break;
- case CUSTOM_FIELD_TYPE_DATE:
- $t_day = gpc_get_int( $p_var_name . '_day', 0 );
- $t_month = gpc_get_int( $p_var_name . '_month', 0 );
- $t_year = gpc_get_int( $p_var_name . '_year', 0 );
- if( ( $t_year == 0 ) || ( $t_month == 0 ) || ( $t_day == 0 ) ) {
- if( $p_default == null ) {
- return '';
- } else {
- return $p_default;
- }
- } else {
- return strtotime( $t_year . '-' . $t_month . '-' . $t_day );
- }
- break;
+ case CUSTOM_FIELD_TYPE_DATE:
+ case CUSTOM_FIELD_TYPE_DATETIME:
+ $t_minute = gpc_get_int($p_var_name . "_minute", 0);
+ $t_hour = gpc_get_int($p_var_name . "_hour", 0);
+ $t_day = gpc_get_int($p_var_name . "_day", 0);
+ $t_month = gpc_get_int($p_var_name . "_month", 0);
+ $t_year = gpc_get_int($p_var_name . "_year", 0);
+ if (($t_year == 0) || ($t_month == 0) || ($t_day == 0)) {
+ if ($p_default == null) {
+ return '';
+ } else {
+ return $p_default;
+ }
+ } else {
+ return strtotime($t_year . "-" . $t_month . "-" . $t_day . " " . $t_hour . ":" . $t_minute);
+ }
+ break;
default:
return gpc_get_string( $p_var_name, $p_default );
}
Index: web/core/custom_field_api.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/core/custom_field_api.php (revision 4274d7b6f52e69e06bdc1d7d63a90d5ef92c1bee)
+++ web/core/custom_field_api.php (date 1536584155000)
@@ -62,6 +62,7 @@
$g_custom_field_types[CUSTOM_FIELD_TYPE_LIST] = 'standard';
$g_custom_field_types[CUSTOM_FIELD_TYPE_MULTILIST] = 'standard';
$g_custom_field_types[CUSTOM_FIELD_TYPE_DATE] = 'standard';
+$g_custom_field_types[CUSTOM_FIELD_TYPE_DATETIME] = 'standard';
foreach( $g_custom_field_types as $t_type ) {
require_once( config_get_global( 'core_path' ) . 'cfdefs/cfdef_' . $t_type . '.php' );
@@ -1143,6 +1144,11 @@
$t_valid &= email_is_valid( $p_value );
}
break;
+ case CUSTOM_FIELD_TYPE_DATETIME:
+ # gpc_get_cf for date returns the value from strtotime
+ # For 32 bit systems, supported range will be 13 Dec 1901 20:45:54 UTC to 19 Jan 2038 03:14:07 UTC
+ $t_valid &= $p_value !== false;
+ break;
default:
break;
}
@@ -1221,6 +1227,7 @@
$t_select_expr = db_is_mysql() ? 'cfst.value+0.0' : 'CAST(NULLIF(cfst.value,\'\') AS FLOAT)';
break;
case CUSTOM_FIELD_TYPE_DATE:
+ case CUSTOM_FIELD_TYPE_DATETIME:
case CUSTOM_FIELD_TYPE_NUMERIC:
$t_select_expr = 'CAST(NULLIF(cfst.value,\'\') AS DECIMAL)';
break;
@@ -1525,4 +1532,4 @@
$t_count = db_result( $t_result );
return $t_count > 0;
-}
\ No newline at end of file
+}
Index: web/lang/strings_french.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/lang/strings_french.txt (revision 4274d7b6f52e69e06bdc1d7d63a90d5ef92c1bee)
+++ web/lang/strings_french.txt (date 1536582431000)
@@ -1033,7 +1033,7 @@
$s_linked_projects_label = 'Projets liés';
$s_custom_field_sequence = 'Suite';
$s_custom_field_sequence_label = 'Séquence';
-$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio, 10:Zone de texte';
+$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio, 10:Zone de texte, 11:Date et heure';
$s_confirm_used_custom_field_deletion = 'Ce champ est actuellement lié à au moins un projet. Si vous continuez, toutes les valeurs de ce champ seront supprimées. Cette action ne peut être annulée. Si vous ne voulez pas supprimer ce champ, cliquer sur le bouton Retour de votre navigateur. Sinon pour supprimer ce champ, cliquer sur le bouton ci dessous';
$s_confirm_custom_field_deletion = 'Êtes-vous sûr de vouloir supprimer ce champ personnalisé et toutes les valeurs associées ?';
$s_field_delete_button = 'Supprimer le champ';