PageRenderTime 44ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/class.xmodcartwd.inc

https://github.com/jcplat/console-seolan
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
  1. <?php
  2. /// Wizard de creation d'un module de gestion de caddie
  3. class XModCartWd extends XModTableWd {
  4. function __construct($ar=NULL) {
  5. parent::__construct($ar);
  6. }
  7. function istep1() {
  8. $this->_module->backofficeemail="you@email.com";
  9. $this->_module->sendername="Your full name";
  10. $this->_module->createstructure=false;
  11. XModuleWd::istep1();
  12. $this->_options->setOpt(XLabels::getSysLabel("general.createstructure"), "createstructure", "boolean");
  13. $this->_options->setOpt(XLabels::getSysLabel("general.sendername"), "sendername", "text");
  14. $this->_options->setOpt(XLabels::getSysLabel("xmodcart.backofficeemail"), "backofficeemail", "text");
  15. }
  16. private function createStructure() {
  17. $this->_module->createstructure = false;
  18. $newtable=XDSTable::newTableNumber();
  19. $cmdtable=$newtable;
  20. $lg = TZR_DEFAULT_LANG;
  21. $ar1=array();
  22. $ar1["translatable"]="0";
  23. $ar1["publish"]="0";
  24. $ar1["auto_translate"]="0";
  25. $ar1["btab"]=$newtable;
  26. $ar1["bname"][$lg]="Gestion de boutique - Table des commandes";
  27. XDSTable::procNewSource($ar1);
  28. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  29. $x->createField('F0001', // ord obl que bro tra mul pub tar
  30. XLabels::getSysLabel('xmodcart.ref'),'XShortTextDef', '100','1','1','1','1','0','0','1');
  31. $x->createField('F0002', // ord obl que bro tra mul pub tar
  32. XLabels::getSysLabel('xmodcart.date'),'XDateTimeDef', '','2','1','1','1','0','0','0');
  33. $x->createField('F0003', // ord obl que bro tra mul pub tar
  34. XLabels::getSysLabel('xmodcart.orderstatus'),'XStringSetDef', '','3','1','1','1','0','0','0');
  35. $x->createField('F0004', // ord obl que bro tra mul pub tar
  36. 'Montant total commande','XRealDef', '15','4','1','1','1','0','0','1');
  37. $x->createField('F0005', // ord obl que bro tra mul pub tar
  38. 'Montant livraison','XRealDef', '15','5','1','1','1','0','0','0');
  39. $x->createField('F0006', // ord obl que bro tra mul pub tar
  40. 'Client','XLinkDef', '','6','1','1','1','0','0','1','USERS');
  41. $x->createField('totalht', // ord obl que bro tra mul pub tar
  42. 'Montant total produits','XRealDef', '15','7','1','1','0','0','0','0');
  43. $x->createField('tva', // ord obl que bro tra mul pub tar
  44. 'Montant TVA','XRealDef', '15','8','1','1','1','0','0','0');
  45. $x->createField('rem', // ord obl que bro tra mul pub tar
  46. 'Observations','XTextDef', '60','9','1','1','1','0','0','0');
  47. $x->createField('paid', // ord obl que bro tra mul pub tar
  48. 'Mode de paiement','XShortTextDef', '20','10','1','1','1','0','0','0');
  49. $x->createField('disc', // ord obl que bro tra mul pub tar
  50. 'Total remise','XRealDef', '15','11','1','1','1','0','0','0');
  51. $x->createField('coupon', // ord obl que bro tra mul pub tar
  52. 'Coupon','XShortTextDef', '20','12','1','1','1','0','0','0');
  53. $this->_module->table=$newtable;
  54. $newtable=XDSTable::newTableNumber();
  55. $orderlinestable=$newtable;
  56. $lg = TZR_DEFAULT_LANG;
  57. $ar1=array();
  58. $ar1["translatable"]="0";
  59. $ar1["publish"]="0";
  60. $ar1["auto_translate"]="0";
  61. $ar1["btab"]=$newtable;
  62. $ar1["bname"][$lg]="Gestion de boutique - Lignes des commandes";
  63. XDSTable::procNewSource($ar1);
  64. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  65. $x->createField('F0001', //ord obl que bro tra mul pub tar
  66. 'Commande','XLinkDef', '','1','1','1','1','0','0','1',$cmdtable);
  67. $x->createField('ref', //ord obl que bro tra mul pub tar
  68. 'Reference','XShortTextDef', '20','2','1','1','1','0','0','1');
  69. $x->createField('label', //ord obl que bro tra mul pub tar
  70. 'Libelle','XShortTextDef', '100','3','1','1','1','0','0','1');
  71. $x->createField('price', //ord obl que bro tra mul pub tar
  72. 'Prix HT','XRealDef', '15','4','1','1','1','0','0','1');
  73. $x->createField('tva', //ord obl que bro tra mul pub tar
  74. 'TVA','XRealDef', '15','5','1','1','1','0','0','0');
  75. $x->createField('totalp', //ord obl que bro tra mul pub tar
  76. 'TVA','XRealDef', '15','6','1','1','1','0','0','0');
  77. $x->createField('nb', //ord obl que bro tra mul pub tar
  78. 'Nombre','XRealDef', '15','7','1','1','1','0','0','0');
  79. $x->createField('rem', //ord obl que bro tra mul pub tar
  80. 'Remarque','XShortTextDef', '100','8','1','1','1','0','0','0');
  81. $tvatable=XDSTable::newTableNumber();
  82. $lg = TZR_DEFAULT_LANG;
  83. $ar1=array();
  84. $ar1["translatable"]="0";
  85. $ar1["publish"]="0";
  86. $ar1["auto_translate"]="0";
  87. $ar1["btab"]=$tvatable;;
  88. $ar1["bname"][$lg]="Gestion de boutique - Code TVA";
  89. XDSTable::procNewSource($ar1);
  90. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$tvatable);
  91. $x->createField('tva', //ord obl que bro tra mul pub tar
  92. 'Code TVA','XShortText', '20','1','1','1','1','0','0','1');
  93. $x->createField('pourc', //ord obl que bro tra mul pub tar
  94. 'Pourcentage TVA','XRealDef', '15','2','1','1','1','0','0','0');
  95. $x->createField('label', //ord obl que bro tra mul pub tar
  96. 'Libelle TVA','XShortText', '20','3','1','1','1','0','0','0');
  97. $newtable=XDSTable::newTableNumber();
  98. $lg = TZR_DEFAULT_LANG;
  99. $ar1=array();
  100. $ar1["translatable"]="0";
  101. $ar1["publish"]="0";
  102. $ar1["auto_translate"]="0";
  103. $ar1["btab"]=$newtable;
  104. $ar1["bname"][$lg]="Gestion de boutique - Pays";
  105. XDSTable::procNewSource($ar1);
  106. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  107. $x->createField('state', //ord obl que bro tra mul pub tar
  108. 'Pays','XShortTextDef', '20','1','1','1','1','0','0','1');
  109. $x->createField('tzone', //ord obl que bro tra mul pub tar
  110. 'TVA Applicable','XBoolDef', '','2','1','1','1','0','0','0');
  111. $x->createField('deliv', //ord obl que bro tra mul pub tar
  112. 'Zone de livraison','XLinkDef', '','3','1','1','1','0','0','0','DELIV');
  113. if(!XSystem::tableExists('DELIV')) {
  114. $newtable="DELIV";
  115. $lg = TZR_DEFAULT_LANG;
  116. $ar1=array();
  117. $ar1["translatable"]="0";
  118. $ar1["publish"]="0";
  119. $ar1["auto_translate"]="0";
  120. $ar1["btab"]=$newtable;
  121. $ar1["bname"][$lg]="Gestion de boutique - Frais de livraison";
  122. XDSTable::procNewSource($ar1);
  123. $x=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$newtable);
  124. $x->createField('name', //ord obl que bro tra mul pub tar
  125. 'Nom','XShortTextDef', '30','1','1','1','1','0','0','1');
  126. $x->createField('wtab', //ord obl que bro tra mul pub tar
  127. 'Table par poids','XTableDef', '20','2','1','1','1','0','0','0');
  128. $x->createField('utab', //ord obl que bro tra mul pub tar
  129. 'Table par unite','XTableDef', '20','3','1','1','1','0','0','0');
  130. $x->createField('tva', //ord obl que bro tra mul pub tar
  131. 'Code TVA','XLinkDef', '','4','1','1','1','0','0','0', $tvatable);
  132. $x->createField('code', //ord obl que bro tra mul pub tar
  133. 'Code Interne','XShortTextDef', '20','5','1','1','1','0','0','0');
  134. }
  135. $this->_module->orderlinestable=$orderlinestable;
  136. $this->_module->deliverytable='DELIV';
  137. }
  138. function istep2() {
  139. if($this->_module->createstructure) {
  140. $this->createStructure();
  141. } else {
  142. $this->_options->setOpt(XLabels::getSysLabel("general.table"), "table", "table");
  143. }
  144. }
  145. function istep3() {
  146. $this->_options->setOpt("Table des produits", "productstable", "table");
  147. }
  148. function iend($ar=NULL) {
  149. return parent::iend();
  150. }
  151. }
  152. ?>