fix voucher sale
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 24 Jan 2009 15:40:31 +0000 (15:40 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 24 Jan 2009 15:40:31 +0000 (15:40 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@250 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/overview.cpp
www/inc/classes/order.php

index 386405f..2d0b24a 100644 (file)
@@ -883,12 +883,13 @@ void MOverview::cartAddVoucher()
        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(&regv);
+       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(&regv);
+       }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;
index d893924..51e04de 100644 (file)
@@ -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;