add discount input on customer form

This commit is contained in:
Manuel Raynaud
2014-04-28 10:51:24 +02:00
parent 7b826796f1
commit c4320f0ada
4 changed files with 25 additions and 2 deletions

View File

@@ -90,6 +90,7 @@ class CustomerController extends AbstractCrudController
'lastname' => $object->getLastname(),
'email' => $object->getEmail(),
'title' => $object->getTitleId(),
'discount' => $object->getDiscount(),
);
if ($address !== null) {

View File

@@ -158,6 +158,12 @@ class CustomerUpdateForm extends BaseForm
"for" => "title"
)
))
->add('discount', 'text', array(
'label' => Translator::getInstance()->trans('permanent discount'),
'label_attr' => array(
'for' => 'discount'
)
))
;
}

View File

@@ -143,6 +143,15 @@ class Customer extends BaseCustomer implements UserInterface
->findOne();
}
public function setRef($v)
{
if (null !== $v) {
parent::setRef($v);
}
return $this;
}
/**
* create hash for plain password and set it in Customer object
*

View File

@@ -22,7 +22,7 @@
<div class="row">
<div class="col-md-12 title title-without-tabs">
{intl l="Edit customer %firstname %lastname" firstname={$FIRSTNAME} lastname={$LASTNAME}}
{intl l="Edit customer %firstname %lastname (Ref : %ref)" firstname={$FIRSTNAME} lastname={$LASTNAME} ref={$REF}}
</div>
<div class="form-container">
@@ -80,7 +80,14 @@
{form_field form=$form field='email'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Lastname'}">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Email'}">
</div>
{/form_field}
{form_field form=$form field='discount'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='permanent discount'}">
</div>
{/form_field}