Indefero

Indefero Commit Details


Date:2012-04-19 15:20:51 (13 years 13 days ago)
Author:Simon Holywell
Branch:develop
Commit:6996e1185fec6ff4735beab7ccd2267bf1dccac2
Parents: 11b3811e17c8c8041742e8c21f455ac9210fcfdd
Message:Issue #13: Due time handling (local time / UTC)

- Move time strip into the formInit method and out of the model
- Improve the validation of the issue due date on the preSave method of the model
Changes:

File differences

src/IDF/Form/IssueUpdate.php
103103
104104
105105
106
106107
107108
108109
109
110
110111
111112
112113
                                                       'size' => 15,
                                                                    ),
                                            ));
            $due_dtime = substr($this->issue->due_dtime, 0, 10);
            $this->fields['due_dtime'] = new IDF_Form_Field_Date(
                                array('required' => false,
                                    'label' => __('Due date'),
                                    'initial' => $this->issue->due_dtime,
                                    'initial' => $due_dtime,
                                    'widget_attrs' => array('size' => 15,),
                                    ));
src/IDF/Issue.php
156156
157157
158158
159
160
161
162
163159
164160
165161
166162
167163
168
169
164
165
166
167
168
170169
171170
172171
        IDF_Search::remove($this);
    }
    function restore() {
        $this->due_dtime = substr($this->due_dtime, 0, 10);
    }
    function preSave($create=false)
    {
        if ($this->id == '') {
            $this->creation_dtime = gmdate('Y-m-d H:i:s');
        }
        if($this->due_dtime) {
            $this->due_dtime .= ' 23:59:59';
        if($this->due_dtime and !empty($this->due_dtime)) {
            $datetime = $this->due_dtime . ' 23:59:59';
            if(date('Y-m-d', strtotime($datetime)) === $this->due_dtime) {
                $this->due_dtime = $datetime;
            }
        }
        $this->modif_dtime = gmdate('Y-m-d H:i:s');
    }

Archive Download the corresponding diff file

Page rendered in 0.14661s using 14 queries.