mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-12 06:56:24 +00:00
updating controller fixes #3191
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5702 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
66bfa5631a
commit
bf651a279e
2 changed files with 12 additions and 1 deletions
|
@ -966,6 +966,8 @@ class Controller extends Object {
|
||||||
if (isset($this->data[$modelClass][$field . $var])) {
|
if (isset($this->data[$modelClass][$field . $var])) {
|
||||||
if (!empty($this->data[$modelClass][$field . $var])) {
|
if (!empty($this->data[$modelClass][$field . $var])) {
|
||||||
$time[$var] = $this->data[$modelClass][$field . $var];
|
$time[$var] = $this->data[$modelClass][$field . $var];
|
||||||
|
} elseif ($this->data[$modelClass][$field . $var] === '0') {
|
||||||
|
$time[$var] = '00';
|
||||||
}
|
}
|
||||||
$useNewDate = true;
|
$useNewDate = true;
|
||||||
unset($this->data[$modelClass][$field . $var]);
|
unset($this->data[$modelClass][$field . $var]);
|
||||||
|
@ -1107,7 +1109,7 @@ class Controller extends Object {
|
||||||
} else {
|
} else {
|
||||||
$count = $object->findCount($conditions, $recursive);
|
$count = $object->findCount($conditions, $recursive);
|
||||||
}
|
}
|
||||||
$pageCount = ceil($count / $limit);
|
$pageCount = intval(ceil($count / $limit));
|
||||||
|
|
||||||
if ($page == 'last') {
|
if ($page == 'last') {
|
||||||
$options['page'] = $page = $pageCount;
|
$options['page'] = $page = $pageCount;
|
||||||
|
|
|
@ -119,6 +119,15 @@ class ControllerTest extends CakeTestCase {
|
||||||
$expected = array('ControllerPost'=> array('created'=> '13:00', 'updated'=> '14:40'));
|
$expected = array('ControllerPost'=> array('created'=> '13:00', 'updated'=> '14:40'));
|
||||||
$this->assertEqual($Controller->data, $expected);
|
$this->assertEqual($Controller->data, $expected);
|
||||||
|
|
||||||
|
$Controller->data['ControllerPost']['created_hour'] = '13';
|
||||||
|
$Controller->data['ControllerPost']['created_min'] = '0';
|
||||||
|
$Controller->data['ControllerPost']['updated_hour'] = '14';
|
||||||
|
$Controller->data['ControllerPost']['updated_min'] = '40';
|
||||||
|
|
||||||
|
$Controller->cleanUpFields();
|
||||||
|
$expected = array('ControllerPost'=> array('created'=> '13:00', 'updated'=> '14:40'));
|
||||||
|
$this->assertEqual($Controller->data, $expected);
|
||||||
|
|
||||||
|
|
||||||
unset($Controller);
|
unset($Controller);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue