log voucher ID when paying with voucher;
authorKonrad Rosenbaum <konrad@silmor.de>
Thu, 21 Nov 2013 17:12:21 +0000 (18:12 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Thu, 21 Nov 2013 17:12:21 +0000 (18:12 +0100)
show human readable payment type

src/dialogs/payedit.cpp
wob/db/order.wolf
www/inc/wext/order.php

index 7627efe..57ff39b 100644 (file)
@@ -338,7 +338,7 @@ MPaymentDialog::MPaymentDialog(QWidget* parent, Qt::WindowFlags f): QDialog(pare
        int idx=0;
        foreach(MOPaymentType p,pt){
                if(req->checkFlags(p.flags())){
-                       m_ptype->addItem(p.name(),QVariant::fromValue<MOPaymentType>(p));
+                       m_ptype->addItem(p.description(),QVariant::fromValue<MOPaymentType>(p));
                        if(p.name()==dp)idx=m_ptype->count()-1;
                }
        }
index 7f1edd6..2ebddba 100644 (file)
@@ -23,7 +23,8 @@
                <Column name="flags" type="string">filter: who can log payments with this method</Column>
                
                <Preset><V col="paytype" val="cash"/><V col="description" val="default paytype: cash"/></Preset>
-               <Preset><V col="paytype" val="credit card"/><V col="description" val="credit card payment"/><V col="dataname" val="card data"/><V col="datapreset" val="date: %Y-%M-%D, card: ..."/></Preset>
+                <Preset><V col="paytype" val="credit card"/><V col="description" val="credit card payment"/><V col="dataname" val="card data"/><V col="datapreset" val="date: %Y-%M-%D, card: ..."/></Preset>
+                <Preset><V col="paytype" val="voucher"/><V col="description" val="payment with voucher"/><V col="dataname" val="voucher ID"/><V col="flags" val="+_admin"/></Preset>
        </Table>
        <Table name="order" backup="yes" audit="yes">
                <Doc>This table contains all orders and sales.</Doc>
index cff8511..e1165b9 100644 (file)
@@ -405,6 +405,13 @@ class WOOrder extends WOOrderAbstract
                }
                //make corrections
                $ord->amountpaid+=$pay;
+               //set payment type for audit
+               if(WTpaymenttype::getFromDB("voucher")!==false){
+                        $ord->paytype="voucher";//see db/order.wolf for this default paytype
+                        $ord->paydata=$vou->voucherid;
+               }else{
+                        $ord->paydata=tr("Voucher: ").$vou->voucherid;
+               }
                $ord->update();
                $vou->value-=$pay;
                $vou->isused=true;