m->addAction(tr("&Close"),this,SLOT(close()));
m=mb->addMenu(tr("&Payment"));
- //FIXME: m->setEnabled(o.isStored());
m->addAction(tr("Receive &Payment..."),this,SLOT(payment()))
- ->setEnabled(req->hasRole("orderpay"));
+ ->setEnabled(req->hasRight(req->ROrderPay));
m->addAction(tr("&Refund..."),this,SLOT(refund()))
- ->setEnabled(req->hasRole("orderrefund"));
+ ->setEnabled(req->hasRight(req->ROrderRefund));
m->addAction(tr("Pay with &Voucher..."),this,SLOT(payvoucher()))
- ->setEnabled(req->hasRole("usevoucher"));
+ ->setEnabled(req->hasRight(req->RUseVoucher));
m=mb->addMenu(tr("P&rinting"));
- //FIXME: m->setEnabled(o.isStored());
m->addAction(tr("Print &Bill..."),this,SLOT(printBill()));
m->addAction(tr("Save Bill &as file..."),this,SLOT(saveBill()));
m->addSeparator();
</Map>
</Mapping>
</Class>
- <Class name="CustomerInfo" abstract="yes">
- <!-- abstract is needed on C++ side -->
+ <Class name="CustomerInfo">
+ <Abstract lang="qt"/><!-- abstract is needed on C++ side -->
<Doc>This class encapsulates the most basic information about a customer.</Doc>
<Doc>For more complex tasks the Customer class is used.</Doc>
<Property name="customerid" type="int"/>
<Transaction name="CreateReservation"/>
<Transaction name="ReservationToOrder"/>
<Transaction name="CancelOrder"/>
+ <Transaction name="OrderPay"/>
+ <Transaction name="OrderRefund"/>
+ <Transaction name="UseVoucher"/>
<Transaction name="GetAllShipping">
<Input/>
QString hcd;
//class declaration
hcd+="<h1>";
- if(cls.isAbstract())hcd+="Abstract ";
+ if(cls.isAbstract(""))hcd+="Abstract ";
hcd+="Class "+cn+"</h1>\n";
+
+ //conditional abstract
+ QStringList ab=cls.abstractLangs();
+ if(ab.size()>0){
+ hcd+="<p>The class is conditionally abstract in: ";
+ for(int i=0;i<ab.size();i++){
+ if(i)hcd+=", ";
+ hcd+=ab[i];
+ }
+ hcd+="</p>\n";
+ }
+
+ //docu
QStringList doc=cls.docStrings();
for(int i=0;i<doc.size();i++)
hcd+="<p>"+doc[i]+"</p>\n";
/**helper: return the PHP-class-name of a WocClass*/
QString className(const WocClass&c){return "WO"+c.name();}
/**helper: return the PHP-class-name of a WocClass plus Abstract if it is abstract*/
- QString abstractClassName(const WocClass&c){return "WO"+c.name()+QString(c.isAbstract()?"Abstract":"");}
+ QString abstractClassName(const WocClass&c){return "WO"+c.name()+QString(c.isAbstract("php")?"Abstract":"");}
/**helper: returns the PHP-class-name for a WocTransaction*/
QString trnClassName(const WocTransaction&t){return "WTr"+t.name();}
if(s!="")m_docstrings<<s;
}
//check abstraction
- if(!m_abstract && isAbstract()){
+ if(!m_abstract && isAbstract("")){
qDebug("Warning: class %s should be declared abstract.",m_name.toAscii().data());
}
+ //conditional abstraction (must be after check or we'll get false positives)
+ nl=cls.elementsByTagName("Abstract");
+ for(int i=0;i<nl.size();i++){
+ QString s=nl.at(i).toElement().attribute("lang").trimmed();
+ if(s!="")m_cabstract<<s;
+ }
}
bool WocClass::hasProperty(QString p)const
return false;
}
-bool WocClass::isAbstract()const
+bool WocClass::isAbstract(QString l)const
{
+ if(m_cabstract.contains(l))return true;
for(int i=0;i<m_props.size();i++)
if(m_props[i].isabstract)return true;
return m_abstract;
/**returns whether the property type is blob*/
bool propertyIsBlob(QString p)const{QString pt=propertyPlainType(p);return pt=="blob";}
- /**returns whether the class is abstract (needs to be customized); it is automatically abstract if any property is abstract*/
- bool isAbstract()const;
+ /**returns whether the class is abstract in the requested language (needs to be customized); it is automatically abstract if any property is abstract*/
+ bool isAbstract(QString)const;
+ /**returns the languages in which the class is conditionally abstract*/
+ QStringList abstractLangs()const{return m_cabstract;}
/**returns the names of all enum types of this class*/
QStringList enumTypes()const{return m_enumvals.keys();}
private:
//valid: parsing the WOLF succeeded
//abstract: the class is declared abstract (isAbstract may return true even if this is false)
+ //cabstract: conditional abstract - just for one or two languages; abstract overrides cabstract!
bool m_valid,m_abstract;
+ QStringList m_cabstract;
//name: class name
//base: name of parent class (s=server, c=client)
QString m_name,m_sbase,m_cbase;
{
QString cn=m_prefix+"O"+cls.name();
QString cna=cn;
- if(cls.isAbstract())cna+="Abstract";
+ if(cls.isAbstract("qt"))cna+="Abstract";
addFile(cna);
QFile hdr(m_basedir+"/"+m_subdir+"/"+cna+".h");
QFile src(m_basedir+"/"+m_subdir+"/"+cna+".cpp");
$AUTOCLASS["WORole"]="inc/wext/role.php";
$AUTOCLASS["WOOrderInfo"]="inc/wext/order.php";
$AUTOCLASS["WOOrder"]="inc/wext/order.php";
-$AUTOCLASS["WOCustomerInfo"]="inc/wext/customer.php";
$AUTOCLASS["WOTicket"]="inc/wext/ticket.php";
?>
\ No newline at end of file
+++ /dev/null
-<?
-//
-// PHP Implementation: customer
-//
-// Description:
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2009
-//
-// Copyright: See README/COPYING files that come with this distribution
-//
-//
-
-class WOCustomerInfo extends WOCustomerInfoAbstract {};
-?>
\ No newline at end of file