Skip to content

Commit

Permalink
Merge pull request #1190 from ezsystems/ezp-24630_checkbox_conflicts
Browse files Browse the repository at this point in the history
Fix EZP-24630: Checkbox value lost when conflicts
  • Loading branch information
yannickroger committed Aug 4, 2015
2 parents e098515 + 0cb1dd3 commit 4ef50cc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions design/admin/templates/content/edit_conflict.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@
<input class="button" type="submit" name="ShowPublishedData" value="{'Show the published data'|i18n( 'design/admin/content/edit_draft' )}" title="{'Create a new draft. The contents of the new draft will be copied from the published version.'|i18n( 'design/admin/content/edit_draft' )}" />
<input type="hidden" name="PublishAfterConflict" value="1" />

{*
EZP-24630: ezboolean work around.
Since unchecked textboxes are not present in POST, storing their value in a hidden field.
*}
{foreach $object.contentobject_attributes as $attribute}
{if eq( $attribute.data_type_string, 'ezboolean' )}
<input
id="ezcoa-{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}"
class="ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}"
type="hidden"
name="ContentObjectAttribute_data_boolean_{$attribute.id}"
value="{$attribute.data_int|wash}"
/>
{/if}
{/foreach}

</div>
{* DESIGN: Control bar END *}</div></div>

Expand Down
5 changes: 5 additions & 0 deletions kernel/classes/datatypes/ezboolean/ezbooleantype.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
}
else
{
/*
* Note: in other DataTypes, false is returned if the variable is not present.
* Since HTTP checkboxes are not present in the POST when they are not checked,
* eZBooleanType might behave a bit differently. See EZP-24630 for a concrete use case.
*/
$data = 0;
}
$contentObjectAttribute->setAttribute( "data_int", $data );
Expand Down

0 comments on commit 4ef50cc

Please sign in to comment.