/class.xmodcartwd.inc
PHP | 163 lines | 151 code | 11 blank | 1 comment | 3 complexity | b35fab688dc7d99ae9d79a3132082002 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, GPL-3.0, Apache-2.0, BSD-3-Clause
- <?php
- /// Wizard de creation d'un module de gestion de caddie
- class XModCartWd extends XModTableWd {
- function __construct($ar=NULL) {
- parent::__construct($ar);
- }
- function istep1() {
- $this->_module->backofficeemail="you@email.com";
- $this->_module->sendername="Your full name";
- $this->_module->createstructure=false;
- XModuleWd::istep1();
- $this->_options->setOpt(XLabels::getSysLabel("general.createstructure"), "createstructure", "boolean");
- $this->_options->setOpt(XLabels::getSysLabel("general.sendername"), "sendername", "text");
- $this->_options->setOpt(XLabels::getSysLabel("xmodcart.backofficeemail"), "backofficeemail", "text");
- }
- private function createStructure() {
- $this->_module->createstructure = false;
- $newtable=XDSTable::newTableNumber();
- $cmdtable=$newtable;
- $lg = TZR_DEFAULT_LANG;
- $ar1=array();
- $ar1["translatable"]="0";
- $ar1["publish"]="0";
- $ar1["auto_translate"]="0";
- $ar1["btab"]=$newtable;
- $ar1["bname"][$lg]="Gestion de boutique - Table des commandes";
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
- $x->createField('F0001', // ord obl que bro tra mul pub tar
- XLabels::getSysLabel('xmodcart.ref'),'XShortTextDef', '100','1','1','1','1','0','0','1');
- $x->createField('F0002', // ord obl que bro tra mul pub tar
- XLabels::getSysLabel('xmodcart.date'),'XDateTimeDef', '','2','1','1','1','0','0','0');
- $x->createField('F0003', // ord obl que bro tra mul pub tar
- XLabels::getSysLabel('xmodcart.orderstatus'),'XStringSetDef', '','3','1','1','1','0','0','0');
- $x->createField('F0004', // ord obl que bro tra mul pub tar
- 'Montant total commande','XRealDef', '15','4','1','1','1','0','0','1');
- $x->createField('F0005', // ord obl que bro tra mul pub tar
- 'Montant livraison','XRealDef', '15','5','1','1','1','0','0','0');
- $x->createField('F0006', // ord obl que bro tra mul pub tar
- 'Client','XLinkDef', '','6','1','1','1','0','0','1','USERS');
- $x->createField('totalht', // ord obl que bro tra mul pub tar
- 'Montant total produits','XRealDef', '15','7','1','1','0','0','0','0');
- $x->createField('tva', // ord obl que bro tra mul pub tar
- 'Montant TVA','XRealDef', '15','8','1','1','1','0','0','0');
- $x->createField('rem', // ord obl que bro tra mul pub tar
- 'Observations','XTextDef', '60','9','1','1','1','0','0','0');
- $x->createField('paid', // ord obl que bro tra mul pub tar
- 'Mode de paiement','XShortTextDef', '20','10','1','1','1','0','0','0');
- $x->createField('disc', // ord obl que bro tra mul pub tar
- 'Total remise','XRealDef', '15','11','1','1','1','0','0','0');
- $x->createField('coupon', // ord obl que bro tra mul pub tar
- 'Coupon','XShortTextDef', '20','12','1','1','1','0','0','0');
- $this->_module->table=$newtable;
- $newtable=XDSTable::newTableNumber();
- $orderlinestable=$newtable;
- $lg = TZR_DEFAULT_LANG;
- $ar1=array();
- $ar1["translatable"]="0";
- $ar1["publish"]="0";
- $ar1["auto_translate"]="0";
- $ar1["btab"]=$newtable;
- $ar1["bname"][$lg]="Gestion de boutique - Lignes des commandes";
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
-
- $x->createField('F0001', //ord obl que bro tra mul pub tar
- 'Commande','XLinkDef', '','1','1','1','1','0','0','1',$cmdtable);
- $x->createField('ref', //ord obl que bro tra mul pub tar
- 'Reference','XShortTextDef', '20','2','1','1','1','0','0','1');
- $x->createField('label', //ord obl que bro tra mul pub tar
- 'Libelle','XShortTextDef', '100','3','1','1','1','0','0','1');
- $x->createField('price', //ord obl que bro tra mul pub tar
- 'Prix HT','XRealDef', '15','4','1','1','1','0','0','1');
- $x->createField('tva', //ord obl que bro tra mul pub tar
- 'TVA','XRealDef', '15','5','1','1','1','0','0','0');
- $x->createField('totalp', //ord obl que bro tra mul pub tar
- 'TVA','XRealDef', '15','6','1','1','1','0','0','0');
- $x->createField('nb', //ord obl que bro tra mul pub tar
- 'Nombre','XRealDef', '15','7','1','1','1','0','0','0');
- $x->createField('rem', //ord obl que bro tra mul pub tar
- 'Remarque','XShortTextDef', '100','8','1','1','1','0','0','0');
- $tvatable=XDSTable::newTableNumber();
- $lg = TZR_DEFAULT_LANG;
- $ar1=array();
- $ar1["translatable"]="0";
- $ar1["publish"]="0";
- $ar1["auto_translate"]="0";
- $ar1["btab"]=$tvatable;;
- $ar1["bname"][$lg]="Gestion de boutique - Code TVA";
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$tvatable);
-
- $x->createField('tva', //ord obl que bro tra mul pub tar
- 'Code TVA','XShortText', '20','1','1','1','1','0','0','1');
- $x->createField('pourc', //ord obl que bro tra mul pub tar
- 'Pourcentage TVA','XRealDef', '15','2','1','1','1','0','0','0');
- $x->createField('label', //ord obl que bro tra mul pub tar
- 'Libelle TVA','XShortText', '20','3','1','1','1','0','0','0');
-
- $newtable=XDSTable::newTableNumber();
- $lg = TZR_DEFAULT_LANG;
- $ar1=array();
- $ar1["translatable"]="0";
- $ar1["publish"]="0";
- $ar1["auto_translate"]="0";
- $ar1["btab"]=$newtable;
- $ar1["bname"][$lg]="Gestion de boutique - Pays";
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
-
- $x->createField('state', //ord obl que bro tra mul pub tar
- 'Pays','XShortTextDef', '20','1','1','1','1','0','0','1');
- $x->createField('tzone', //ord obl que bro tra mul pub tar
- 'TVA Applicable','XBoolDef', '','2','1','1','1','0','0','0');
- $x->createField('deliv', //ord obl que bro tra mul pub tar
- 'Zone de livraison','XLinkDef', '','3','1','1','1','0','0','0','DELIV');
-
- if(!XSystem::tableExists('DELIV')) {
- $newtable="DELIV";
- $lg = TZR_DEFAULT_LANG;
- $ar1=array();
- $ar1["translatable"]="0";
- $ar1["publish"]="0";
- $ar1["auto_translate"]="0";
- $ar1["btab"]=$newtable;
- $ar1["bname"][$lg]="Gestion de boutique - Frais de livraison";
- XDSTable::procNewSource($ar1);
- $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
-
- $x->createField('name', //ord obl que bro tra mul pub tar
- 'Nom','XShortTextDef', '30','1','1','1','1','0','0','1');
- $x->createField('wtab', //ord obl que bro tra mul pub tar
- 'Table par poids','XTableDef', '20','2','1','1','1','0','0','0');
- $x->createField('utab', //ord obl que bro tra mul pub tar
- 'Table par unite','XTableDef', '20','3','1','1','1','0','0','0');
- $x->createField('tva', //ord obl que bro tra mul pub tar
- 'Code TVA','XLinkDef', '','4','1','1','1','0','0','0', $tvatable);
- $x->createField('code', //ord obl que bro tra mul pub tar
- 'Code Interne','XShortTextDef', '20','5','1','1','1','0','0','0');
- }
- $this->_module->orderlinestable=$orderlinestable;
- $this->_module->deliverytable='DELIV';
- }
- function istep2() {
- if($this->_module->createstructure) {
- $this->createStructure();
- } else {
- $this->_options->setOpt(XLabels::getSysLabel("general.table"), "table", "table");
- }
- }
- function istep3() {
- $this->_options->setOpt("Table des produits", "productstable", "table");
- }
- function iend($ar=NULL) {
- return parent::iend();
- }
- }
- ?>