1 <?php
2
3 class Orders1CExchange_OrdersDecorator extends DataObjectDecorator {
4 function () {
5 return array(
6 'db' => array(
7 'IsExported' => 'Boolean',
8 'Update1C' => 'Boolean',
9 )
10 );
11 }
12
13 function updateCMSFields(& $fields) {
14 $fields->addFieldToTab('Root.Main', new CheckboxField('IsExported', $this->owner->fieldLabel('IsExported')));
15 $fields->removeByName('Update1C');
16 }
17
18 function onBeforeWrite() {
19
20 if ($this->owner->Update1C) {
21 $this->owner->Update1C = 0;
22 } else {
23
24 $changed = $this->owner->getChangedFields(true, 2);
25 if (is_array($changed) && count($changed)) {
26 $this->owner->IsExported = 0;
27 }
28 }
29
30 }
31 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-