fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [14207] changes in dates get/post


From: Saul
Subject: [Fmsystem-commits] [14207] changes in dates get/post
Date: Tue, 20 Oct 2015 00:13:16 +0000

Revision: 14207
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14207
Author:   psaul
Date:     2015-10-20 00:13:15 +0000 (Tue, 20 Oct 2015)
Log Message:
-----------
changes in dates get/post

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
    branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
    branches/dev-syncromind/booking/inc/class.uibooking.inc.php
    branches/dev-syncromind/booking/inc/class.uievent.inc.php
    branches/dev-syncromind/booking/templates/base/application.xsl
    branches/dev-syncromind/booking/templates/base/application_new.xsl
    branches/dev-syncromind/booking/templates/base/event_new.xsl

Modified: branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiallocation.inc.php      
2015-10-20 00:04:17 UTC (rev 14206)
+++ branches/dev-syncromind/booking/inc/class.uiallocation.inc.php      
2015-10-20 00:13:15 UTC (rev 14207)
@@ -298,7 +298,7 @@
                                                $allocation['to_'] = 
strftime("%Y-%m-%d %H:%M", strtotime($_POST['weekday']." 
".$_POST['to_'])-60*60*24*7);
                                        }
                                } 
-                               $_POST['from_'] = $allocation['from_'];
+                                $_POST['from_'] = $allocation['from_'];
                                $_POST['to_'] = $allocation['to_'];
 
                                $errors = $this->bo->validate($allocation);
@@ -577,7 +577,9 @@
                                                 $fromdate = date('Y-m-d H:i', 
strtotime($_POST['from_']) + ($interval*$i));
                                                 $todate = date('Y-m-d H:i', 
strtotime($_POST['to_']) + ($interval*$i));
                                                 $allocation['from_'] = 
$fromdate;
-                                                $allocation['to_'] = $todate;
+                                                $allocation['to_'] = $todate;  
                                              
+                                                $fromdate = 
pretty_timestamp($fromdate);
+                                                $todate = 
pretty_timestamp($todate);
 
                                                 $id = 
$this->bo->so->get_allocation_id($allocation);
                                                 if ($id)
@@ -591,13 +593,13 @@
 
                                                 if ($err) 
                                                 {
-                                                        
$invalid_dates[$i]['from_'] = pretty_timestamp($fromdate);
-                                                        
$invalid_dates[$i]['to_'] = pretty_timestamp($todate);
+                                                        
$invalid_dates[$i]['from_'] = $fromdate;
+                                                        
$invalid_dates[$i]['to_'] = $todate;
                                                 } 
                                                 else 
                                                 {
-                                                        
$valid_dates[$i]['from_'] = pretty_timestamp($fromdate);
-                                                        
$valid_dates[$i]['to_'] = pretty_timestamp($todate);
+                                                        
$valid_dates[$i]['from_'] = $fromdate;
+                                                        
$valid_dates[$i]['to_'] = $todate;
                                                         if ($step == 3)
                                                         {
                                                             $stat = 
$this->bo->so->delete_allocation($id);
@@ -645,7 +647,7 @@
                                        'recurring' => $_POST['recurring'],
                                        'outseason' => $_POST['outseason'],
                                        'interval' => $_POST['field_interval'],
-                                       'repeat_until' => 
$_POST['repeat_until'],
+                                       'repeat_until' => 
pretty_timestamp($active_tab),
                                        'from_date' => 
pretty_timestamp($from_date),
                                        'to_date' => pretty_timestamp($to_date),
                                        'valid_dates' => $valid_dates,

Modified: branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiapplication.inc.php     
2015-10-20 00:04:17 UTC (rev 14206)
+++ branches/dev-syncromind/booking/inc/class.uiapplication.inc.php     
2015-10-20 00:13:15 UTC (rev 14207)
@@ -783,6 +783,11 @@
                                 $application['contact_phone'] = 
$organization['contacts'][1]['phone'];
                             }
                         }
+                        
+                        foreach ($application['dates'] as &$date) {
+                            $date['from_'] = pretty_timestamp($date['from_']);
+                            $date['to_'] = pretty_timestamp($date['to_']);
+                        }
                        
                        $GLOBALS['phpgw']->jqcal->add_listener('start_date', 
'datetime');
                        $GLOBALS['phpgw']->jqcal->add_listener('end_date', 
'datetime');
@@ -849,28 +854,11 @@
                                }
                        }
                         
-//                        foreach ($application['dates'] as &$date) {
-//                            $date['from_'] = date($this->dateFormat." H:i", 
strtotime($date['from_']));
-//                            $date['to_'] = date($this->dateFormat." H:i", 
strtotime($date['to_']));
-//                        }
-                        
-//                        foreach ($application['dates'] as &$date) {
-//                            $date['from_'] = date("d/m/Y H:i", 
phpgwapi_datetime::date_to_timestamp($date['from_']));
-//                            $date['to_'] = date($this->dateFormat. " H:i", 
phpgwapi_datetime::date_to_timestamp($date['to_']));
-//                        }
-                        
                         foreach ($application['dates'] as &$date) {
                             $date['from_'] = pretty_timestamp($date['from_']);
                             $date['to_'] = pretty_timestamp($date['to_']);
                         }
                         
-//                        foreach ($application['dates']['to_'] as &$to) {
-//                            $to = date($this->dateFormat." H:i", 
strtotime($to));
-//                        }
-                        
-//                        $application['from_'] = date($this->dateFormat." 
H:i", strtotime($application['from_']));
-//                        $application['to_'] = date($this->dateFormat." H:i", 
strtotime($application['to_']));
-                        
                        $this->flash_form_errors($errors);
                         $this->set_case_officer($application);
                        self::add_javascript('booking', 'booking', 
'application.js');

Modified: branches/dev-syncromind/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2015-10-20 
00:04:17 UTC (rev 14206)
+++ branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2015-10-20 
00:13:15 UTC (rev 14207)
@@ -360,7 +360,7 @@
                        {
                                $_POST['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['from_']));
                                $_POST['to_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['to_']));
-                               $_POST['repeat_until'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
+                               $_POST['repeat_until'] = date("Y-m-d", 
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
                             
                                $today = getdate();
                                $booking = extract_values($_POST, 
$this->fields);
@@ -465,18 +465,20 @@
                                                $todate = date('Y-m-d H:i', 
strtotime($_POST['to_']) + ($interval*$i));
                                                $booking['from_'] = $fromdate;
                                                $booking['to_'] = $todate;
+                                                $fromdate = 
pretty_timestamp($fromdate);
+                                                $todate = 
pretty_timestamp($todate);
 
                                                $err = 
$this->bo->validate($booking);
 
                                                if ($err) 
                                                {
-                                                       
$invalid_dates[$i]['from_'] = pretty_timestamp($fromdate);
-                                                       
$invalid_dates[$i]['to_'] = pretty_timestamp($todate);
+                                                       
$invalid_dates[$i]['from_'] = $fromdate;
+                                                       
$invalid_dates[$i]['to_'] = $todate;
                                                } 
                                                else 
                                                {
-                                                       
$valid_dates[$i]['from_'] = pretty_timestamp($fromdate);
-                                                       $valid_dates[$i]['to_'] 
= pretty_timestamp($todate);
+                                                       
$valid_dates[$i]['from_'] = $fromdate;
+                                                       $valid_dates[$i]['to_'] 
= $todate;
                                                        if ($step == 3)
                                                        {
                                                                 if( 
$noallocation ) {
@@ -707,6 +709,10 @@
 
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
+                            $_POST['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['from_']));
+                            $_POST['to_'] = date("Y-m-d H:i:s" ,  
phpgwapi_datetime::date_to_timestamp($_POST['to_']));
+                            $_POST['repeat_until'] = date("Y-m-d", 
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
+
                                $from_date = $_POST['from_'];
                                $to_date = $_POST['to_'];
 
@@ -756,6 +762,8 @@
                                                 $todate = date('Y-m-d H:i', 
strtotime($_POST['to_']) + ($interval*$i));
                                                 $booking['from_'] = $fromdate;
                                                 $booking['to_'] = $todate;
+                                                $fromdate = 
pretty_timestamp($fromdate);
+                                                $todate = 
pretty_timestamp($todate);
 
                                                 $id = 
$this->bo->so->get_booking_id($booking);                
                                                 if($id) {
@@ -801,6 +809,10 @@
                        $this->flash_form_errors($errors);
                         phpgwapi_jquery::load_widget('autocomplete');
                        self::add_javascript('booking', 'booking', 
'booking.js');
+                        
+                        $booking['from_'] = 
pretty_timestamp($booking['from_']);
+                        $booking['to_'] = pretty_timestamp($booking['to_']);
+                        
                        $booking['resources_json'] = 
json_encode(array_map('intval', $booking['resources']));
                        $booking['cancel_link'] = self::link(array('menuaction' 
=> 'booking.uibooking.show', 'id' => $booking['id']));
                        $booking['booking_link'] = 
self::link(array('menuaction' => 'booking.uibooking.show', 'id' => 
$booking['id']));
@@ -829,9 +841,9 @@
                                         'recurring' => $_POST['recurring'],
                                         'outseason' => $_POST['outseason'],
                                         'interval' => $_POST['field_interval'],
-                                        'repeat_until' => 
$_POST['repeat_until'],
-                                        'from_date' => $from_date,
-                                        'to_date' => $to_date,
+                                        'repeat_until' => 
pretty_timestamp($_POST['repeat_until']),
+                                        'from_date' => 
pretty_timestamp($from_date),
+                                        'to_date' => 
pretty_timestamp($to_date),
                                         'delete_allocation' => 
$_POST['delete_allocation'],
                                         'allocation_keep' => $allocation_keep,
                                         'allocation_delete' => 
$allocation_delete,

Modified: branches/dev-syncromind/booking/inc/class.uievent.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uievent.inc.php   2015-10-20 
00:04:17 UTC (rev 14206)
+++ branches/dev-syncromind/booking/inc/class.uievent.inc.php   2015-10-20 
00:13:15 UTC (rev 14207)
@@ -363,6 +363,14 @@
 
                        array_set_default($_POST, 'from_', array());
                        array_set_default($_POST, 'to_', array());
+                        
+                        foreach ($_POST['from_'] as &$from) {
+                            $from = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($from));
+                        }
+                        foreach ($_POST['to_'] as &$to) {
+                            $to = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($to));
+                        }
+                        
                        $event['dates'] = array_map(array(self, 
'_combine_dates'), $_POST['from_'], $_POST['to_']);
 
                        array_set_default($_POST, 'resources', array());
@@ -521,6 +529,11 @@
                $audience = $audience['results'];
 
                $this->install_customer_identifier_ui($event);
+                
+                foreach ($event['dates'] as &$date) {
+                    $date['from_'] = pretty_timestamp($date['from_']);
+                    $date['to_'] = pretty_timestamp($date['to_']);
+                }
         
                 $GLOBALS['phpgw']->jqcal->add_listener('start_date', 
'datetime');
                 $GLOBALS['phpgw']->jqcal->add_listener('end_date', 'datetime');
@@ -599,7 +612,12 @@
                        $customer['customer_organization_number'] = 
$organization['organization_number'];
                        $customer['customer_internal'] = 
$organization['customer_internal'];
                }
-
+                
+                if($_SERVER['REQUEST_METHOD'] == 'POST') {
+                    $_POST['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['from_']));
+                    $_POST['to_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['to_']));
+                }
+                
                list($event, $errors) = $this->extract_and_validate($event);
 
                if ($event['customer_organization_number']) {
@@ -615,6 +633,11 @@
                                $event['customer_organization_id'] = Null;
                        }
                        array_set_default($_POST, 'resources', array());
+                        
+                        
+                        
+//                        $event['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($event['from_']));
+//                        $event['to_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($event['to_']));
 
                        if ($_POST['organization_name']) {
                                $event['customer_organization_name'] = 
$_POST['organization_name'];
@@ -855,6 +878,9 @@
                        $event['customer_organization_number'] = 
$customer['customer_organization_number'];
                        $event['customer_internal'] = 
$customer['customer_internal'];
                }
+                
+                $event['from_'] = pretty_timestamp($event['from_']);
+                $event['to_'] = pretty_timestamp($event['to_']);
 
                 $GLOBALS['phpgw']->jqcal->add_listener('from_', 'datetime');
                         $GLOBALS['phpgw']->jqcal->add_listener('to_', 
'datetime');

Modified: branches/dev-syncromind/booking/templates/base/application.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application.xsl      
2015-10-20 00:04:17 UTC (rev 14206)
+++ branches/dev-syncromind/booking/templates/base/application.xsl      
2015-10-20 00:13:15 UTC (rev 14207)
@@ -20,7 +20,7 @@
     </style>
 
     <xsl:call-template name="msgbox"/>
-    <form class= "pure-form pure-form-aligned" action="" method="post" 
id="form" name="form">
+    <div class= "pure-form pure-form-aligned" id="form" name="form">
         <input type="hidden" name="tab" value=""/>
         <div id="tab-content">
             <xsl:value-of disable-output-escaping="yes" 
select="application/tabs"/>
@@ -402,7 +402,7 @@
             </xsl:if>
             <a class="pure-button pure-button-primary" 
href="{application/dashboard_link}"><xsl:value-of select="php:function('lang', 
'Back to Dashboard')" /></a>
         </div>
-    </form>
+    </div>
     <script type="text/javascript">
         var resourceIds = '<xsl:value-of select="application/resource_ids"/>';
         var currentuser = '<xsl:value-of select="application/currentuser"/>';

Modified: branches/dev-syncromind/booking/templates/base/application_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application_new.xsl  
2015-10-20 00:04:17 UTC (rev 14206)
+++ branches/dev-syncromind/booking/templates/base/application_new.xsl  
2015-10-20 00:13:15 UTC (rev 14207)
@@ -131,14 +131,6 @@
                                                         <xsl:attribute 
name="value">
                                                             <xsl:value-of 
select="from_" />
                                                         </xsl:attribute>
-                                                        <!--xsl:if 
test="activity/start_date != ''">
-                                                            <xsl:attribute 
name="value">
-                                                                <xsl:value-of 
select="php:function('date', $datetime_format, number(activity/start_date))"/>
-                                                            </xsl:attribute>
-                                                        </xsl:if>
-                                                        <xsl:attribute 
name="data-validation">
-                                                            
<xsl:text>required</xsl:text>
-                                                        </xsl:attribute-->
                                                     </input>
                                                 </div>
                                                 <div 
class="pure-control-group">
@@ -155,16 +147,8 @@
                                                         <xsl:attribute 
name="value">
                                                             <xsl:value-of 
select="to_"/>
                                                         </xsl:attribute>
-                                                        <!--xsl:if 
test="activity/end_date != ''">
-                                                            <xsl:attribute 
name="value">
-                                                                <xsl:value-of 
select="php:function('date', $datetime_format, number(activity/end_date))"/>
-                                                            </xsl:attribute>
-                                                        </xsl:if-->
                                                     </input>
                                                 </div>
-                                                <!--div class="help_text">
-                                                    <xsl:value-of 
select="php:function('lang','Give end date to activity')" />
-                                                </div-->
                                             </div>
                                         </xsl:when>
                                         <xsl:otherwise>
@@ -176,14 +160,6 @@
                                                         <xsl:attribute 
name="value">
                                                             <xsl:value-of 
select="from_"/>
                                                         </xsl:attribute>
-                                                        <!--xsl:if 
test="activity/start_date != ''">
-                                                            <xsl:attribute 
name="value">
-                                                                <xsl:value-of 
select="php:function('date', $datetime_format, number(activity/start_date))"/>
-                                                            </xsl:attribute>
-                                                        </xsl:if>
-                                                        <xsl:attribute 
name="data-validation">
-                                                            
<xsl:text>required</xsl:text>
-                                                        </xsl:attribute-->
                                                     </input>
                                                 </div>
                                                 <div 
class="pure-control-group">
@@ -202,16 +178,8 @@
                                                         <xsl:attribute 
name="value">
                                                             <xsl:value-of 
select="to_"/>
                                                         </xsl:attribute>
-                                                        <!--xsl:if 
test="activity/end_date != ''">
-                                                            <xsl:attribute 
name="value">
-                                                                <xsl:value-of 
select="php:function('date', $datetime_format, number(activity/end_date))"/>
-                                                            </xsl:attribute>
-                                                        </xsl:if-->
                                                     </input>
                                                 </div>
-                                                <!--div class="help_text">
-                                                    <xsl:value-of 
select="php:function('lang','Give end date to activity')" />
-                                                </div-->
                                             </div>
                                         </xsl:otherwise>
                                     </xsl:choose>

Modified: branches/dev-syncromind/booking/templates/base/event_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/event_new.xsl        
2015-10-20 00:04:17 UTC (rev 14206)
+++ branches/dev-syncromind/booking/templates/base/event_new.xsl        
2015-10-20 00:13:15 UTC (rev 14207)
@@ -79,25 +79,51 @@
                             </div>
                             <div id="dates-container"  
class="pure-control-group">
                                 <xsl:for-each select="event/dates">
-                                    <div class="date-container">
-                                        <a href="javascript:void(0);" 
class="close-btn btnclose">-</a>
-                                        <div class="pure-control-group">
-                                            <label for="start_date">
-                                                <xsl:value-of 
select="php:function('lang', 'From')" />
-                                            </label>
-                                            <input class="datetime 
pure-input-2-3" id="start_date" name="from_[]" type="text">
-                                                <xsl:attribute 
name="value"><xsl:value-of select="from_"/></xsl:attribute>
-                                            </input>
-                                        </div>
-                                        <div class="pure-control-group">
-                                            <label for="end_date">
-                                                <xsl:value-of 
select="php:function('lang', 'To')" />
-                                            </label>
-                                            <input class="datetime 
pure-input-2-3" id="end_date" name="to_[]" type="text">
-                                                <xsl:attribute 
name="value"><xsl:value-of select="to_"/></xsl:attribute>
-                                            </input>
-                                        </div>
-                                    </div>
+                                    <xsl:variable name="index" 
select="position()-2"/>
+                                    <xsl:choose>
+                                        <xsl:when test="position() > 1">
+                                            <div class="date-container">
+                                                <a href="javascript:void(0);" 
class="close-btn btnclose">-</a>
+                                                <div 
class="pure-control-group">
+                                                    <label 
for="start_date_{$index}">
+                                                        <xsl:value-of 
select="php:function('lang', 'From')" />
+                                                    </label>
+                                                    <input 
class="newaddedpicker datetime pure-input-2-3" id="start_date_{$index}" 
name="from_[]" type="text">
+                                                        <xsl:attribute 
name="value"><xsl:value-of select="from_"/></xsl:attribute>
+                                                    </input>
+                                                </div>
+                                                <div 
class="pure-control-group">
+                                                    <label 
for="end_date_{$index}">
+                                                        <xsl:value-of 
select="php:function('lang', 'To')" />
+                                                    </label>
+                                                    <input 
class="newaddedpicker datetime pure-input-2-3" id="end_date_{$index}" 
name="to_[]" type="text">
+                                                        <xsl:attribute 
name="value"><xsl:value-of select="to_"/></xsl:attribute>
+                                                    </input>
+                                                </div>
+                                            </div>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            <div class="date-container">
+                                                <a href="javascript:void(0);" 
class="close-btn btnclose">-</a>
+                                                <div 
class="pure-control-group">
+                                                    <label for="start_date">
+                                                        <xsl:value-of 
select="php:function('lang', 'From')" />
+                                                    </label>
+                                                    <input class="datetime 
pure-input-2-3" id="start_date" name="from_[]" type="text">
+                                                        <xsl:attribute 
name="value"><xsl:value-of select="from_"/></xsl:attribute>
+                                                    </input>
+                                                </div>
+                                                <div 
class="pure-control-group">
+                                                    <label for="end_date">
+                                                        <xsl:value-of 
select="php:function('lang', 'To')" />
+                                                    </label>
+                                                    <input class="datetime 
pure-input-2-3" id="end_date" name="to_[]" type="text">
+                                                        <xsl:attribute 
name="value"><xsl:value-of select="to_"/></xsl:attribute>
+                                                    </input>
+                                                </div>
+                                            </div>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
                                 </xsl:for-each>
                             </div>
                             <div class="pure-control-group">




reply via email to

[Prev in Thread] Current Thread [Next in Thread]