for(int i=0;i<prc.size();i++)mdl.setData(mdl.index(i,0),cent2str(prc[i]));
dlg.setLayout(gl=new QGridLayout);
gl->addWidget(new QLabel(tr("Select voucher price and value:")),0,0,1,2);
- gl->addWidget(new QLabel(tr("Price:")),1,0);
- gl->addWidget(cp=new QComboBox,1,1);
- cp->setModel(&mdl);
- cp->setEnabled(req->hasRole("_anypricevoucher"));
- cp->setEditable(true);
- cp->setValidator(®v);
+ if(req->hasRole("_anypricevoucher")){
+ gl->addWidget(new QLabel(tr("Price:")),1,0);
+ gl->addWidget(cp=new QComboBox,1,1);
+ cp->setModel(&mdl);
+ cp->setEditable(true);
+ cp->setValidator(®v);
+ }else cp=0;
gl->addWidget(new QLabel(tr("Value:")),2,0);
gl->addWidget(cv=new QComboBox,2,1);
cv->setModel(&mdl);
//get selection
int price,value;
value=str2cent(cv->currentText());
- if(req->hasRole("_anypricevoucher"))
+ if(req->hasRole("_anypricevoucher") && cp)
price=str2cent(cp->currentText());
else
price=value;
$vx->setAttribute("value",$vc["value"]);
$vx->setAttribute("id",$ftid++);
//check for valid value
- if(!$cananyvval && !in_array($vvals)){
+ if(!$cananyvval && !in_array($vc["value"],$vvals)){
$vx->setAttribute("status",tr("invalidvalue","voucher state"));
$ostat="fail";
$ret=false;