#6488: time dropdowns generate a NULL on insert when midnight is selected -------------------------------------------------------+-------------------- Reporter: calzone | Owner: mark_story Type: Bug | Status: assigned Priority: High | Milestone: 1.2.x.x Component: Helpers | Version: 1.2 Final Severity: Major | Resolution: Keywords: form helper time dropdowns null insert | Php_version: PHP 5 Cake_version: 1.2.3.8166 | -------------------------------------------------------+-------------------- Comment (by youheiogino):
Hello.[[BR]] [[BR]] I met this bug a few months ago, and found similar trouble in the following article in "google gruop archives".[[BR]] [[BR]] http://groups.google.com/group/cake- php/browse_thread/thread/749bf75af77f295a [[BR]] [[BR]] In this article, Brendon Kozlowski (aka BrendonCoz) said that a bug seems to be introduced from his patch. His patch can be found here.[[BR]] [[BR]] https://trac.cakephp.org/changeset/7782 [[BR]] [[BR]] I tried to comment out his 3 lines patch code at "model.php".[[BR]] But all TIME value of unselected dropdown menu became "00:00:00". So I changed other part at same file.[[BR]] [[BR]] Model.php[[BR]] {{{ foreach ($dateFields as $key => $val) { if (in_array($val, array('hour', 'min', 'sec'))) { if (!isset($data[$val]) || ($data[$val] == null)) { // if (!isset($data[$val]) || $data[$val] === '0' || empty($data[$val])) { // $data[$val] = '00'; } else { $data[$val] = sprintf('%02d', $data[$val]); } } if (in_array($type, array('datetime', 'timestamp', 'date')) && !isset($data[$val]) || isset($data[$val]) && (empty($data[$val]) || $data[$val][0] === '-')) { return null; } elseif (isset($data[$val]) && !empty($data[$val])) { $date[$key] = $data[$val]; } } $date = str_replace(array_keys($date), array_values($date), $format); // if ($type == 'time' && $date == '00:00:00') { // return null; // } }}} -- Ticket URL: <https://trac.cakephp.org/ticket/6488#comment:2> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to tickets-cakephp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---