From: konrad Date: Sat, 24 Jan 2009 15:40:31 +0000 (+0000) Subject: fix voucher sale X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=c9e6a8f7d6ffa913e162143ae5b4879b0658ad3f;p=web%2Fkonrad%2Fsmoke.git fix voucher sale git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@250 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/overview.cpp b/src/overview.cpp index 386405f..2d0b24a 100644 --- a/src/overview.cpp +++ b/src/overview.cpp @@ -883,12 +883,13 @@ void MOverview::cartAddVoucher() for(int i=0;iaddWidget(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); @@ -910,7 +911,7 @@ void MOverview::cartAddVoucher() //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; diff --git a/www/inc/classes/order.php b/www/inc/classes/order.php index d893924..51e04de 100644 --- a/www/inc/classes/order.php +++ b/www/inc/classes/order.php @@ -403,7 +403,7 @@ class Order $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;