You can subscribe to this list here.
| 2011 |
Jan
|
Feb
|
Mar
(4) |
Apr
(57) |
May
(31) |
Jun
(21) |
Jul
(11) |
Aug
(23) |
Sep
(22) |
Oct
(36) |
Nov
(62) |
Dec
(85) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2012 |
Jan
(24) |
Feb
(24) |
Mar
(65) |
Apr
(232) |
May
(118) |
Jun
(22) |
Jul
(54) |
Aug
(57) |
Sep
(14) |
Oct
(27) |
Nov
(16) |
Dec
(19) |
| 2013 |
Jan
(16) |
Feb
(12) |
Mar
(3) |
Apr
(17) |
May
(2) |
Jun
(30) |
Jul
(33) |
Aug
(19) |
Sep
(35) |
Oct
(58) |
Nov
(27) |
Dec
(64) |
| 2014 |
Jan
(102) |
Feb
(80) |
Mar
(15) |
Apr
(4) |
May
(3) |
Jun
(3) |
Jul
(5) |
Aug
(11) |
Sep
(15) |
Oct
|
Nov
(3) |
Dec
(5) |
| 2015 |
Jan
(5) |
Feb
(4) |
Mar
(2) |
Apr
(11) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
(10) |
Dec
|
| 2016 |
Jan
(3) |
Feb
(2) |
Mar
(18) |
Apr
(13) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
|
From: <ope...@us...> - 2014-01-04 15:11:12
|
Revision: 5004
http://sourceforge.net/p/oscss/svn/5004
Author: opentechno
Date: 2014-01-04 15:11:10 +0000 (Sat, 04 Jan 2014)
Log Message:
-----------
Modified Paths:
--------------
trunk/dev/cli.php
trunk/dev/generator/generator.php
Modified: trunk/dev/cli.php
===================================================================
--- trunk/dev/cli.php 2014-01-04 13:59:23 UTC (rev 5003)
+++ trunk/dev/cli.php 2014-01-04 15:11:10 UTC (rev 5004)
@@ -30,12 +30,12 @@
"this list is all actions available: \n";
foreach(scan($path_init) as $row){
- if( is_dir($path_init.'/'.$row) && file_exists($path_init.'/'.$row.'/'.$row.'.php') )
+ if( $row !='install' && is_dir($path_init.'/'.$row) && file_exists($path_init.'/'.$row.'/'.$row.'.php') )
print " * ".$row."\n";
}
print "\n\n Use : \n".
- "php ".$argv[0]." nameofaction [params specific action]\n".
+ "php ".$argv[0]." nameofaction [params specific action]\n";
print "\n\n";
exit;
Modified: trunk/dev/generator/generator.php
===================================================================
--- trunk/dev/generator/generator.php 2014-01-04 13:59:23 UTC (rev 5003)
+++ trunk/dev/generator/generator.php 2014-01-04 15:11:10 UTC (rev 5004)
@@ -34,7 +34,7 @@
foreach(scan($path_init) as $row)
if( is_dir($path_init.'/'.$row) )
- $ob .=' -'.$row."\n";
+ $ob .=' '.$row."\n";
$ob .=" * -v int 1-9 verbose \n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ope...@us...> - 2014-01-04 13:59:26
|
Revision: 5003
http://sourceforge.net/p/oscss/svn/5003
Author: opentechno
Date: 2014-01-04 13:59:23 +0000 (Sat, 04 Jan 2014)
Log Message:
-----------
Modified Paths:
--------------
trunk/dev/_top.php
trunk/dev/cli.php
Added Paths:
-----------
trunk/dev/cli_install.php
trunk/dev/install/
trunk/dev/install/install.php
Modified: trunk/dev/_top.php
===================================================================
--- trunk/dev/_top.php 2014-01-04 13:57:20 UTC (rev 5002)
+++ trunk/dev/_top.php 2014-01-04 13:59:23 UTC (rev 5003)
@@ -9,14 +9,14 @@
return ;
$i++;
-global $path_base;
+global $path_base, $path;
error_reporting(E_ALL);
// current path
$path_init = dirname(__FILE__);
// relative path for normal process in oscss core
$path_base=substr( $path_init, 0, -strlen('dev/') ) . '/catalog/admin/';
-
+$path=substr( $path_init, 0, -strlen('dev/') ) . '/catalog/';
// // add path in incldue_path
set_include_path(
$path_init . PATH_SEPARATOR .
@@ -47,10 +47,4 @@
$secukey = '3297LSPHEDM61389SMOVNV842C35S5';
-
-
-
-
-
-
?>
\ No newline at end of file
Modified: trunk/dev/cli.php
===================================================================
--- trunk/dev/cli.php 2014-01-04 13:57:20 UTC (rev 5002)
+++ trunk/dev/cli.php 2014-01-04 13:59:23 UTC (rev 5003)
@@ -56,20 +56,24 @@
*/
public $path_init;
/**
- @var string path file
+ @var string path file admin env
*/
public $path_base;
+ /**
+ @var string path file public env
+ */
+ public $path;
-
- function __construct($path_base, $path_init){
+ function __construct($path_base,$path, $path_init){
$this->config = new stdClass;
$this->cmd = false;
$this->path_base = $path_base;
+ $this->path = $path;
$this->path_init = $path_init;
}
public function SetCmd($cmd){
- $config->cmd = $cmd;
+ $this->config->cmd = $cmd;
}
}
@@ -87,7 +91,7 @@
echo '.';
$class = 'cli'.$cmd;
- $obj = new $class($path_base, $path_init);
+ $obj = new $class($path_base,$path, $path_init);
echo '.';
$obj->SetCmd($cmd);
echo '.';
Added: trunk/dev/cli_install.php
===================================================================
--- trunk/dev/cli_install.php (rev 0)
+++ trunk/dev/cli_install.php 2014-01-04 13:59:23 UTC (rev 5003)
@@ -0,0 +1,165 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.1
+ @date 22/08/11, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/installer/setup.php
+ @brief command line for installer extends specific to oscss
+ this installer use class abd file content in backoffice oscss
+
+ @remarks To run this script as CLI: phpunit filename.php
+*/
+// specific for test
+// require('_top.php');
+/**
+ * \brief base include generic for unit test
+ * \file
+ */
+// block if multi load
+static $i;
+if($i>0)
+ return ;
+
+$i++;
+global $path_base, $path, $path_install;
+error_reporting(E_ALL);
+// current path
+$path_init = dirname(__FILE__);
+
+// relative path for normal process in oscss core
+$path_base=substr( $path_init, 0, -strlen('dev/') ) . '/catalog/admin/';
+$path=substr( $path_init, 0, -strlen('dev/') ) . '/catalog/';
+$path_install=substr( $path_init, 0, -strlen('dev/') ) . '/catalog/install/';
+// // add path in incldue_path
+set_include_path(
+ $path_init . PATH_SEPARATOR .
+ $path_base. PATH_SEPARATOR .
+ $path_base.'admin/includes/classes/'. PATH_SEPARATOR .
+ get_include_path()
+ );
+
+// //update base script
+chdir($path_install);
+
+// base
+$_SERVER['SERVER_NAME']='localhost';
+$_SERVER['HTTP_HOST'] = 'localhost.tld';
+$_SERVER['REQUEST_URI'] = '';
+$_SERVER['SERVER_ADDR']= '1';
+$_SERVER['SERVER_PORT']='80';
+$_SERVER['REMOTE_ADDR']='1';
+
+// block if not cli mode
+if ( substr( php_sapi_name() , 0, 3) != 'cli')
+ die('Use cli for execute this script'."\n");
+
+// init file core oscss
+// if(!@include_once($path_base.'includes/appli_top_Test.php'))
+// die ('no found appli_top_Test.php '."\n");
+
+
+$secukey = '3297LSPHEDM61389SMOVNV842C35S5';
+
+
+date_default_timezone_set('Europe/Paris');
+
+// Main
+$version='$Revision: 1.0 $';
+@set_time_limit(0);
+$error=0;
+$cmd = false;
+
+
+if(count($argv) <=1 || $argv[1] =='-h'){
+ print "\n\n This script use core oscss for execute action by script \n".
+ "this list is all actions available: \n";
+
+// foreach(scan($path_init) as $row){
+// if( is_dir($path_init.'/'.$row) && file_exists($path_init.'/'.$row.'/'.$row.'.php') )
+// print " * ".$row."\n";
+// }
+
+ print "\n\n Use : \n".
+ "php ".$argv[0]." nameofaction [params specific action]\n";
+ print "\n\n";
+
+ exit;
+}
+
+
+class cli{
+ /**
+ @var object all params config passed on args in script
+ */
+ public $config;
+ /**
+ @var string commande name
+ */
+ public $cmd;
+ /**
+ @var string path file
+ */
+ public $path_init;
+ /**
+ @var string path file admin env
+ */
+ public $path_base;
+ /**
+ @var string path file public env
+ */
+ public $path;
+ /**
+ @var string path file
+ */
+ public $path_install;
+
+
+ function __construct($path_base,$path,$path_install, $path_init){
+ $this->config = new stdClass;
+ $this->cmd = false;
+ $this->path_base = $path_base;
+ $this->path = $path;
+ $this->path_init = $path_init;
+ $this->path_install = $path_install;
+ }
+
+ public function SetCmd($cmd){
+ $this->config->cmd = $cmd;
+ }
+}
+
+
+
+if( isset($argv[1]) && strlen($argv[1])>3 && is_string($argv[1]))
+ $cmd = $argv[1];
+
+if( ! $cmd )
+ die('please use php cli.php -h '."\n");
+
+
+ echo '.';
+ include($path_init.'/'.$cmd.'/'.$cmd.'.php');
+ echo '.';
+ $class = 'cli'.$cmd;
+
+ $obj = new $class($path_base,$path,$path_install, $path_init);
+ echo '.';
+ $obj->SetCmd($cmd);
+ echo '.';
+ $obj->init($argv);
+ echo '.';
+ $obj->check();
+ echo '.';
+ $obj->preprocess();
+ echo '.';
+ $obj->process();
+ echo '.';
+ $obj->displayerror();
+ echo '.';
+
+echo "\n";
+?>
\ No newline at end of file
Added: trunk/dev/install/install.php
===================================================================
--- trunk/dev/install/install.php (rev 0)
+++ trunk/dev/install/install.php 2014-01-04 13:59:23 UTC (rev 5003)
@@ -0,0 +1,197 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.1
+ @date 22/08/11, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/install/install.php
+ @brief command line for installer extends specific to oscss
+ this installer use class abd file content in backoffice oscss
+
+ @remarks To run this script as CLI: php clip.php filename
+*/
+
+if(! isset($secukey) )
+ die('please use ../cli.php '."\n");
+
+
+ class cliinstall
+ extends cli{
+
+// protected $dblogin = 'root';
+//
+// protected $dbpass = 'password';
+//
+// protected $dbname = 'osCSS';
+ /**
+ @brief init methode for extract specific params
+ @param $argv array()
+ */
+ public function init($argv){
+ if(count($argv) <=2 || $argv[2] =='-h'){
+ $ob =" Sample init for control params scripts \n".
+ "You'r use args for correct process\n".
+ " * action (install/update/upgrade)\n".
+ " --- Host www -- \n".
+ " * -domain string name the domain \n".
+ " * -subpath string subpath in server or none \n".
+ " --- DB Infos -- \n".
+ " * -dbname string name for db \n".
+ " * -dblogin string login for create/connect db server\n".
+ " * -dbpass string password for create/connect db server\n".
+ " --- other -- \n".
+ " * -v int 1-9 verbose \n".
+ "\n\n";
+ print $ob;
+ exit;
+ }
+
+ $this->config->v = 0;
+ $this->config->d = 0;
+
+ $this->config->dblogin = 'root' ;
+ $this->config->dbpass = 'password';
+ $this->config->dbname = 'osCSS';
+ $this->config->domain = false;
+ $this->config->subpath = '/';
+
+
+ // Extract item config
+ $key = null;
+ for($i =2 , $n = (count($argv)); $i<$n ; $i++){
+ $test = $argv[$i];
+ if( $i === 2 && !preg_match('#-#', $test) )
+ $this->config->action = $test;
+ elseif( $key===null && preg_match('#^-[a-z]#', $test) )
+ $key = substr($test,1);
+ elseif( $key !=null ){
+ $this->config->$key = $test;
+ $key = null;
+ }
+ }
+ }
+
+ /**
+ @brief control params
+ */
+ public function check(){
+ if($this->config->v > 0 )
+ die('you\'r verbose is true '."\n");
+ }
+
+ /**
+ @brief adjust config and local vars
+ */
+ public function preprocess(){
+
+ require_once($this->path_install.'includes/functions/general.php');
+ require_once($this->path_install.'includes/functions/database.php');
+ require_once($this->path_install.'includes/functions/html_output.php');
+
+ require_once($this->path_install.'includes/classes/core.php');
+
+ include_once($this->path.'common/classes/Database.php');
+ }
+
+ /**
+ @brief exec
+ */
+ public function process(){
+ echo 'process'."\n";
+
+ chdir($this->path_install);
+
+ define('WS_LANGUAGE', 'includes/language/');
+
+ define('DRIVER_SQL', 'mysql');
+// if(!defined('DIR_WS_COMMON_CLASSES')) define('DIR_WS_COMMON_CLASSES', 'classes/');
+
+ $server = ( ($this->config->domain !=false) ? $this->config->domain : 'localhost') ;
+ $subpath = ( ($this->config->subpath !=false) ? $this->config->subpath : $_SERVER['PWD']) ;
+
+ // defined all params for simulate html form process
+ $_GET['language']= 'fr_FR';
+ $_SERVER['SCRIPT_FILENAME'] = $this->path_install.'index.php';
+
+
+ $_POST['ARBORESANCE'] = 'vhost';
+ $_POST['WS_STORE_ADMIN'] = 'admin';
+ $_POST['HTTP_WWW_ADDRESS'] = 'http://'.$server . $subpath;
+ $_POST['HTTP_COOKIE_DOMAIN'] = $server;
+ $_POST['HTTP_COOKIE_PATH'] = $subpath;
+ $_POST['HTTP_WORK_DIRECTORY'] = 'Documents';
+ $_POST['DB_SERVER'] = 'localhost';
+ $_POST['DB_SERVER_USERNAME']= $this->config->dblogin;
+ $_POST['DB_SERVER_PASSWORD']= $this->config->dbpass;
+ $_POST['DB_DATABASE']= $this->config->dbname;
+ $_POST['DB_TABLE_PREFIX']= 'osc_';
+ $_POST['DBMOTOR']= 'Mysql';
+ $_POST['DBMOTOR_CHARSET']= 'localhost';
+ $_POST['DBMOTOR_PORT']= '3306';
+ $_POST['DBMOTOR_TYPE']= 'MyISAM';
+
+ $_POST['DB_TEST_CONNECTION']= 'true';
+
+// print_r($_POST);
+// exit;
+ $install = new core();
+
+
+// print_r($_SERVER);
+// exit;
+
+
+ $install->preload();
+
+ // next step
+ // defined all params for simulate html form process
+ $_GET['etape']= 2;
+ //
+// DIR_FS_DOCUMENT_ROOT
+
+ $install->preload();
+
+
+ // next step
+ // defined all params for simulate html form process
+ $_GET['etape']= 3;
+ //
+
+ //
+ $install->preload();
+
+
+ // next step
+ // defined all params for simulate html form process
+ $_GET['etape']= 4;
+ //
+ $install->preload();
+
+ // next step
+ // defined all params for simulate html form process
+ $_GET['etape']= 5;
+ //
+ $install->preload();
+
+ // next step
+ // defined all params for simulate html form process
+ $_GET['etape']= 6;
+ //
+ $install->preload();
+ }
+
+ /**
+ @brief display error if mode verbose > 0
+ */
+ function displayerror(){
+ if($this->config->v > 0){
+ echo 'verbose....';
+ }
+ }
+ }
+
+
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ope...@us...> - 2014-01-04 13:57:22
|
Revision: 5002
http://sourceforge.net/p/oscss/svn/5002
Author: opentechno
Date: 2014-01-04 13:57:20 +0000 (Sat, 04 Jan 2014)
Log Message:
-----------
Modified Paths:
--------------
trunk/catalog/install/includes/classes/core.php
trunk/catalog/install/includes/content/core.base.php
trunk/catalog/install/includes/content/core.configuration.php
trunk/catalog/install/includes/content/core.finition.php
trunk/catalog/install/includes/content/core.installdb.php
trunk/catalog/install/includes/content/core.modes.php
trunk/catalog/install/includes/content/core.template_sample.php
trunk/catalog/install/includes/functions/database.php
trunk/catalog/install/index.php
Modified: trunk/catalog/install/includes/classes/core.php
===================================================================
--- trunk/catalog/install/includes/classes/core.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/classes/core.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -136,7 +136,8 @@
}
// Retrieve traductions
$lang = array();
- if (include(WS_LANGUAGE.$language.'/install.base.txt')) define('DC_LOADER_LANG', $language);
+ if (include(WS_LANGUAGE.$language.'/install.base.txt'))
+ if(!defined('DC_LOADER_LANG'))define('DC_LOADER_LANG', $language);
}
@@ -378,30 +379,60 @@
public static function block_etape() {
if(!isset($_POST)) header('Location: index.php' );
}
-
+
+
/**
- Construction de la page
- @param
- @a string $_GET['etape']
+ @brief preload context and sub childs classes
+ @note use external
+ $_GET['etape']
+ $_GET['upgrade']
+ $_POST['current_e']
+ @return object child class current
*/
- public function draw_page(){
+ public function preload(){
+ $this->getLanguage();
+ $tab=array_flip($this->order_etape);
- $this->getLanguage();
- $tab=array_flip($this->order_etape);
- $class=(!isset($_GET['etape']))? 'base' : (is_numeric($_GET['etape']) ? substr($tab[$_GET['etape']],5) :$_GET['etape'] ) ;
- if(!class_exists($class)) require('includes/content/core.'.$class.'.php');
- self::$class=$class;
- $etape= new $class();
+ $class=(!isset($_GET['etape'])? 'base' : (is_numeric($_GET['etape']) ? substr($tab[$_GET['etape']],5) :$_GET['etape'] ) );
+
+ if(!class_exists($class)) require('includes/content/core.'.$class.'.php');
+ self::$class=$class;
+ $etape= new $class();
- $this->get_fs_document_root();
- $this->get_server_conf();
+ $this->get_fs_document_root();
+ $this->get_server_conf();
- /**
- execute element etape precedente
- */
- $dec=(isset($_POST['current_e']) ? ((int)$_POST['current_e']) : 1);
- if(!isset($_GET['upgrade'])) $this->exe_callback(( ( ($this->get_current_etape()- $dec) >1) ? $this->get_current_etape() - $dec -1: $this->get_current_etape() -1 ) );
+ /**
+ execute element etape precedente
+ */
+ $dec=(isset($_POST['current_e']) ? ((int)$_POST['current_e']) : 1);
+ if(!isset($_GET['upgrade'])) $this->exe_callback(( ( ($this->get_current_etape()- $dec) >1) ? $this->get_current_etape() - $dec -1: $this->get_current_etape() -1 ) );
+ $etape->preload();
+
+ return $etape;
+ }
+
+
+ /**
+ @fn draw()
+ @brief Specific call context display
+ this display is product by sub chidls step
+ @retrun none
+ */
+ protected function draw(){
+ $this->draw_form();
+ $this->jscontrol();
+ }
+
+ /**
+ @brief Display content
+ @return none
+ */
+ public function draw_page(){
+
+ $etape = $this->preload();
+
include('templates/header.php');
echo '<h1 id="title">'.core::l10n('Welcome to osCSS-2 install!').'</h1>'."\n";
// list des etape
Modified: trunk/catalog/install/includes/content/core.base.php
===================================================================
--- trunk/catalog/install/includes/content/core.base.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/content/core.base.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -44,13 +44,13 @@
'root_doc_a_tmp'=>'Documents/admin/tmp/',
'root_doc_a_image'=>'Documents/admin/images/',
'root_doc_a_graph'=>'Documents/admin/images/graphs/',
- 'root_doc_a_image'=>'Documents/admin/images/imagecache/',
+ 'root_doc_a_image_i'=>'Documents/admin/images/imagecache/',
'root_doc_p_p'=>'Documents/public/',
'root_doc_p_log'=>'Documents/public/logs/',
'root_doc_p_data'=>'Documents/public/oscss_data/',
'root_doc_p_sessions'=>'Documents/public/sessions/',
- 'root_doc_p_images'=>'Documents/images/imagecache/',
+// 'root_doc_p_images'=>'Documents/images/imagecache/',
'htacces_admin'=>'admin/.htaccess',
@@ -151,12 +151,11 @@
}
+
+ public function preload(){
+ $this->definition();
- function draw(){
- $this->definition();
- if(!isset($_GET['language'])) $this->draw_form_lang();
-
/**
Recup courante configure
*/
@@ -164,12 +163,17 @@
$this->get_server_conf();
foreach($this->browse_rep($this->fs_document_root) as $item)
- if(is_dir($this->fs_document_root.$item['file'])&& preg_match('#(admin.*)#i',$item['file'] , $match)){
- $_POST['WS_STORE_ADMIN']=$item['file'];
- }
+ if(is_dir($this->fs_document_root.$item['file'])&& preg_match('#(admin.*)#i',$item['file'] , $match)){
+ $_POST['WS_STORE_ADMIN']=$item['file'];
+ }
}
+ }
+ function draw(){
+ if(!isset($_GET['language']))
+ $this->draw_form_lang();
+
$this->draw_message();
$this->draw_form();
Modified: trunk/catalog/install/includes/content/core.configuration.php
===================================================================
--- trunk/catalog/install/includes/content/core.configuration.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/content/core.configuration.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -382,8 +382,12 @@
$this->get_fs_document_root();
$this->get_server_conf();
$this->get_db_conf();
- define('DB_TABLE_PREFIX', $this->db['DB_TABLE_PREFIX']);
+ if(!defined('DB_TABLE_PREFIX') )
+ define('DB_TABLE_PREFIX', $this->db['DB_TABLE_PREFIX']);
+ if(!defined('DIR_WS_MODULES') )
define('DIR_WS_MODULES', $this->fs_document_root.$this->ws_admin_rand.'/includes/modules/');
+
+ error_reporting(0);
include($this->fs_document_root.$this->ws_admin_rand.'/includes/database_tables.php');
osc_db_connect($this->db['DBMOTOR'], $this->db['DBMOTOR_PORT'],$this->db['DBMOTOR_CHARSET'],$this->db['DB_SERVER'], $this->db['DB_SERVER_USERNAME'], $this->db['DB_SERVER_PASSWORD'],strtolower( $this->db['DBMOTOR_TYPE']) );
@@ -407,8 +411,8 @@
*/
if(is_array($_POST['configuration'] ))
foreach($_POST['configuration'] as $key=>$cfg){
- $configuration_value = tep_db_prepare_input($_POST['configuration'][$key]);
- tep_db_query($sql="update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_key = '" . $key. "'");
+ $configuration_value = tep_db_prepare_input($_POST['configuration'][$key]);
+ tep_db_query($sql="update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_key = '" . $key. "'");
}
/**
@@ -513,9 +517,8 @@
<?php
}
-
- function draw(){
-
+
+ public function preload(){
//! recup conf
$this->get_fs_document_root();
$this->get_server_conf();
@@ -525,7 +528,9 @@
if(file_exists($this->fs_document_root.'admin')) rename($this->fs_document_root.'admin',$this->fs_document_root.$this->ws_admin_rand);
- define('TABLE_CONFIGURATION', $this->db['DB_TABLE_PREFIX'].'configuration');
+ if(!defined('TABLE_CONFIGURATION'))
+ define('TABLE_CONFIGURATION', $this->db['DB_TABLE_PREFIX'].'configuration');
+ if(!defined('TABLE_COUNTRIES'))
define('TABLE_COUNTRIES', $this->db['DB_TABLE_PREFIX'].'countries');
//! dependance
@@ -539,7 +544,11 @@
$this->install_base_conf();
$this->install_rewrite();
$this->install_extents();
+ }
+
+ function draw(){
+
//! draw form etape
$this->draw_form();
Modified: trunk/catalog/install/includes/content/core.finition.php
===================================================================
--- trunk/catalog/install/includes/content/core.finition.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/content/core.finition.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -35,6 +35,9 @@
echo '</form>'."\n";
}
+ public function preload(){
+ }
+
function draw(){
$this->get_fs_document_root();
Modified: trunk/catalog/install/includes/content/core.installdb.php
===================================================================
--- trunk/catalog/install/includes/content/core.installdb.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/content/core.installdb.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -219,9 +219,7 @@
}
- /**
- */
- function draw(){
+ public function preload(){
// conf
$this->get_server_conf();
// upgrade
@@ -232,6 +230,12 @@
$this->upgrade_base_db($_POST['upgrade']);
}
+ }
+
+
+ /**
+ */
+ function draw(){
// content
$this->draw_form();
}
Modified: trunk/catalog/install/includes/content/core.modes.php
===================================================================
--- trunk/catalog/install/includes/content/core.modes.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/content/core.modes.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -563,9 +563,9 @@
}
}
}
+
+ public function preload(){
- function draw(){
-
global $db_error;
@@ -630,8 +630,9 @@
$this->get_server_conf();
}
+ }
-
+ function draw(){
$this->draw_form();
$this->jscontrol();
}
Modified: trunk/catalog/install/includes/content/core.template_sample.php
===================================================================
--- trunk/catalog/install/includes/content/core.template_sample.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/content/core.template_sample.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -152,11 +152,13 @@
echo '</form>'."\n";
}
- function draw(){
-
- $this->get_fs_document_root();
+
+ public function preload(){
+ $this->get_fs_document_root();
$this->get_server_conf();
-
+ }
+
+ public function draw(){
$this->draw_form();
}
}
Modified: trunk/catalog/install/includes/functions/database.php
===================================================================
--- trunk/catalog/install/includes/functions/database.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/includes/functions/database.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -15,7 +15,9 @@
if(defined('DB_CONNECTOR'))
return false;
- define('HTTP_SERVER',true);
+ if(!defined('HTTP_SERVER'))
+ define('HTTP_SERVER',true);
+
define('DIR_WS_COMMON','');
define('DIR_FS_CATALOG',substr(dirname(__FILE__),0,strpos(dirname(__FILE__),'install'.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'functions') ).DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR);
Modified: trunk/catalog/install/index.php
===================================================================
--- trunk/catalog/install/index.php 2014-01-04 13:54:29 UTC (rev 5001)
+++ trunk/catalog/install/index.php 2014-01-04 13:57:20 UTC (rev 5002)
@@ -9,7 +9,7 @@
*/
require('includes/application.php');
-
+error_reporting(E_ALL);
$install=new core();
$install->draw_page();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ope...@us...> - 2014-01-04 13:54:32
|
Revision: 5001
http://sourceforge.net/p/oscss/svn/5001
Author: opentechno
Date: 2014-01-04 13:54:29 +0000 (Sat, 04 Jan 2014)
Log Message:
-----------
Added Paths:
-----------
trunk/test/phpunit/Back/modules/shipping/
trunk/test/phpunit/Back/modules/shipping/allmodulesgenericTest.php
Added: trunk/test/phpunit/Back/modules/shipping/allmodulesgenericTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/shipping/allmodulesgenericTest.php (rev 0)
+++ trunk/test/phpunit/Back/modules/shipping/allmodulesgenericTest.php 2014-01-04 13:54:29 UTC (rev 5001)
@@ -0,0 +1,225 @@
+<?php
+/**
+ * \file test/phpunit/Back/allmodulesgenericTest.php
+ * \brief test unitaire class allmodulesgeneric Backoffice
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require_once(substr( dirname(__FILE__), 0, -17).'/_top.php');
+
+global $base_path, $path;
+
+
+/**
+ * \class allmodulesgenericTest
+ */
+class allmodulesgenericTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ @var int
+ */
+ static public $Id;
+
+ function __construct()
+ {
+
+ }
+ /**
+ @brief test class depends childs specific module shipping
+ */
+ public function testallmodulesgenericDepends(){
+ global $base_path, $path;
+
+ include_once($path.'../common/classes/shippingUtility.php');
+ include_once($path.'../common/classes/datetimeUtility.php');
+ }
+
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericDepends
+ */
+ public function testallmodulesgenericConf(){
+ global $base_path, $path;
+
+ $arrtmp = array();
+
+ foreach(scan($base_path.DIR_WS_MODULES . 'shipping/') as $row) {
+ $classes=substr($row,0, -4);
+ $i = include($base_path. DIR_WS_MODULES . 'shipping/'. $row);
+
+ $this->assertTrue ( ( $i != false) , 'Error load subschilds mod' ) ;
+
+ $arrtmp[$classes] = new $classes();
+
+
+ }
+
+ // install all modules
+ foreach($arrtmp as $key=>$row){
+ $val = $row->check();
+
+ if(!$val)
+ $row->install();
+ }
+ return $arrtmp;
+ }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+ public function testallmodulesbaseInstall($arrtmp){
+
+ foreach($arrtmp as $key=>$row){
+ $val = $row->check();
+ $this->assertTrue ( ( $val == true) , 'Error load subschilds mod check() for '.$key ) ;
+
+ $val = $row->keys();
+ $this->assertTrue ( ( is_array($val)) , 'Error load subschilds mod keys() for '.$key ) ;
+
+// foreach($val as $k=>$v) {
+// $this->assertTrue ( ( defined($k) ) , 'Error subschilds mod is not correctly installed for '.$key ) ;
+// }
+ }
+ }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+ public function testallmodulesbasesubconfig($arrtmp){
+
+ foreach($arrtmp as $key=>$row){
+
+ // check
+ $this->assertClassHasAttribute('code', $key);
+ $this->assertClassHasAttribute('title', $key);
+ $this->assertClassHasAttribute('description', $key);
+ $this->assertClassHasAttribute('sort_order', $key);
+ $this->assertClassHasAttribute('icon', $key);
+ $this->assertClassHasAttribute('tax_class', $key);
+ }
+
+ }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+ public function testallmodulesbaseAfterUpdate($arrtmp){
+
+ foreach($arrtmp as $key=>$row){
+ $val = $row->after_update( 0 );
+ $this->assertTrue ( ( !$val) , 'Error load subschilds mod after_update() for '.$key ) ;
+
+ $val = $row->after_update( 1 );
+ $this->assertTrue ( ( $val) , 'Error load subschilds mod after_update() for '.$key ) ;
+ }
+ }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+ public function testallmodulesbasePostValue($arrtmp){
+
+ foreach($arrtmp as $key=>$row){
+ $val = $row->load_post_values();
+ $this->assertTrue ( ( !$val) , 'Error load subschilds mod load_post_values() for '.$key ) ;
+ }
+ }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+ public function testallmodulesbaseLoadDBValue($arrtmp){
+
+ foreach($arrtmp as $key=>$row){
+ $val = $row->load_db_value();
+ $this->assertTrue ( ( !$val) , 'Error load subschilds mod load_db_value() for '.$key ) ;
+ }
+ }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+ public function testallmodulesbaseGetError($arrtmp){
+
+ foreach($arrtmp as $key=>$row){
+ $val = $row->get_error();
+ $this->assertTrue ( ( !$val) , 'Error load subschilds mod get_error() for '.$key ) ;
+ }
+ }
+
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+ public function testallmodulesbaseprint($arrtmp){
+
+ foreach($arrtmp as $key=>$row){
+
+ $val = $row->display_view();
+
+ $this->assertTrue ( ( $val != false) , 'Error load subschilds mod display_view() for '.$key ) ;
+
+ // TODO Not impelmented
+// $val = $row->display_edit();
+//
+// $this->assertTrue ( ( $val != false) , 'Error load subschilds mod display_edit() for '.$key ) ;
+ }
+ }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+// public function testBouchonInstall($arrtmp){
+//
+// foreach($arrtmp as $key=>$row){
+// // Créer un bouchon pour la classe UneClasse.
+// $bouchon = $this->getMock($key);
+//
+// // Configurer le bouchon.
+// $bouchon->expects($this->any())
+// ->method('install')
+// ->will($this->returnValue('foo'))
+// ;
+//
+// // Appeler $bouchon->faireQuelquechose() va maintenant retourner
+// // 'foo'.
+// $this->assertEquals('foo', $bouchon->install() );
+// }
+// }
+
+ /**
+ @brief test methode conf and static vars
+ @depends testallmodulesgenericConf
+ */
+// public function testBouchonRemove($arrtmp){
+//
+// foreach($arrtmp as $key=>$row){
+// // Créer un bouchon pour la classe UneClasse.
+// $bouchon = $this->getMock($key);
+//
+// // Configurer le bouchon.
+// $bouchon->expects($this->any())
+// ->method('remove')
+// ;
+//
+// // Appeler $bouchon->faireQuelquechose() va maintenant retourner
+// // 'foo'.
+// // $this->assertEquals('foo', $bouchon->remove() );
+// }
+// }
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-29 11:45:06
|
Revision: 5000
http://sourceforge.net/p/oscss/svn/5000
Author: oscim
Date: 2013-12-29 11:45:02 +0000 (Sun, 29 Dec 2013)
Log Message:
-----------
Fix
Modified Paths:
--------------
trunk/test/phpunit/Back/modules/pages/pagecategoriesTest.php
trunk/test/phpunit/Back/modules/pages/pagecustomersTest.php
trunk/test/phpunit/Back/modules/pages/pageproductsTest.php
trunk/test/phpunit/Back/modules/pages/pagesadminusersTest.php
trunk/test/phpunit/Back/sqlxxx/sqlfeaturedTest.php
Modified: trunk/test/phpunit/Back/modules/pages/pagecategoriesTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagecategoriesTest.php 2013-12-28 15:22:22 UTC (rev 4999)
+++ trunk/test/phpunit/Back/modules/pages/pagecategoriesTest.php 2013-12-29 11:45:02 UTC (rev 5000)
@@ -52,6 +52,7 @@
/**
@brief test methode GetDBValue
+ @param $objtmp object result testcategoriesConf
@depends testcategoriesConf
*/
public function testcategoriesGetDBValue($objtmp){
@@ -69,16 +70,17 @@
/**
@brief test display flag action
+ @param $objtmp object result testcategoriesConf
@depends testcategoriesConf
*/
- public function testcategoriesPrintFlag(){
+ public function testcategoriesPrintFlag($objtmp){
$action = 'setflag';
$get = array();
$get['flag'] = 1;
$get['cID'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) >300) , 'Error retrun action::'.$action) ;
@@ -86,14 +88,15 @@
/**
@brief test display form new customers
+ @param $objtmp object result testcategoriesConf
@depends testcategoriesConf
*/
- public function testcategoriesPrintNew(){
+ public function testcategoriesPrintNew($objtmp){
$action = 'new';
$get = array();
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 900) , 'Error retrun action::'.$action ) ;
@@ -102,24 +105,26 @@
/**
@brief test display form edit
+ @param $objtmp object result testcategoriesConf
@depends testcategoriesConf
*/
- public function testcategoriesPrintEdit(){
+ public function testcategoriesPrintEdit($objtmp){
$action = 'edit';
$get = array();
$get['cID'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 1600) , 'Error retrun action::'.$action ) ;
}
/**
@brief test display form edit
+ @param $objtmp object result testcategoriesConf
@depends testcategoriesConf
*/
- public function testcategoriesPrintDelete(){
+ public function testcategoriesPrintDelete($objtmp){
$action = 'delete';
@@ -127,7 +132,7 @@
$get['cID'] = 2;
$get['forceajax'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 630) , 'Error retrun action::'.$action ) ;
}
@@ -136,9 +141,12 @@
/**
@brief
+ @param $objtmp object result testcategoriesConf
+ @param $action string
+ @param $get array vars passed in GET/POST/REQUEST
@depends testcategoriesConf
*/
- public function CheckAction($action, $get){
+ public function CheckAction($objtmp,$action, $get){
$get['action'] = $action;
@@ -148,8 +156,7 @@
}
categories::GetConf();
-// categories::GetDBValue();
- $res = categories::display_view();
+ $res = $objtmp->display_view();
return $res;
}
Modified: trunk/test/phpunit/Back/modules/pages/pagecustomersTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagecustomersTest.php 2013-12-28 15:22:22 UTC (rev 4999)
+++ trunk/test/phpunit/Back/modules/pages/pagecustomersTest.php 2013-12-29 11:45:02 UTC (rev 5000)
@@ -53,6 +53,7 @@
/**
@brief test methode GetDBValue
+ @param $objtmp object result testcustomersConf
@depends testcustomersConf
*/
public function testcustomersGetDBValue($objtmp){
@@ -70,16 +71,17 @@
/**
@brief test display flag action
+ @param $objtmp object result testcustomersConf
@depends testcustomersConf
*/
- public function testcustomersPrintFlag(){
+ public function testcustomersPrintFlag($objtmp){
$action = 'setflag';
$get = array();
$get['flag'] = 1;
$get['cID'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) >300) , 'Error retrun action::'.$action) ;
@@ -87,45 +89,47 @@
/**
@brief test display form new customers
+ @param $objtmp object result testcustomersConf
@depends testcustomersConf
*/
- public function testcustomersPrintNew(){
+ public function testcustomersPrintNew($objtmp){
$action = 'new';
$get = array();
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 900) , 'Error retrun action::'.$action ) ;
}
/**
@brief test display form edit
+ @param $objtmp object result testcustomersConf
@depends testcustomersConf
*/
- public function testcustomersPrintEdit(){
+ public function testcustomersPrintEdit($objtmp){
$action = 'edit';
$get = array();
$get['cID'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 1600) , 'Error retrun action::'.$action ) ;
}
/**
@brief test display form edit
+ @param $objtmp object result testcustomersConf
@depends testcustomersConf
*/
- public function testcustomersPrintDelete(){
+ public function testcustomersPrintDelete($objtmp){
-
$action = 'delete';
$get = array();
$get['cID'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 630) , 'Error retrun action::'.$action ) ;
}
@@ -134,19 +138,18 @@
/**
@brief
+ @param $objtmp object result testcustomersConf
@depends testcustomersConf
*/
- public function CheckAction($action, $get){
+ public function CheckAction($objtmp,$action, $get){
-// customers::$action = $action;
-
$get['action'] = $action;
foreach($get as $k=>$v)
$_GET[$k] = $v;
$res = customers::GetConf();
- $res = customers::display_view();
+ $res = $objtmp->display_view();
return $res;
}
Modified: trunk/test/phpunit/Back/modules/pages/pageproductsTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pageproductsTest.php 2013-12-28 15:22:22 UTC (rev 4999)
+++ trunk/test/phpunit/Back/modules/pages/pageproductsTest.php 2013-12-29 11:45:02 UTC (rev 5000)
@@ -177,7 +177,7 @@
@brief test display flag action
@depends testproductsConf
*/
- public function testproductsPrintFlag(){
+ public function testproductsPrintFlag($objtmp){
$action = 'setflag';
$get = array();
@@ -185,7 +185,7 @@
$get['pID'] = 1;
$res = $this->CallGetDBValue($action, $get);
- $res = $this->CheckAction();
+ $res = $this->CheckAction($objtmp);
$this->assertTrue ( ( strlen($res) >300) , 'Error retrun action::'.$action) ;
@@ -195,13 +195,13 @@
@brief test display form new customers
@depends testproductsConf
*/
- public function testproductsPrintNew(){
+ public function testproductsPrintNew($objtmp){
$action = 'new';
$get = array();
$res = $this->CallGetDBValue($action, $get);
- $res = $this->CheckAction();
+ $res = $this->CheckAction($objtmp);
$this->assertTrue ( ( strlen($res) > 900) , 'Error retrun action::'.$action ) ;
}
@@ -210,7 +210,7 @@
@brief test display form edit
@depends testproductsConf
*/
- public function testproductsPrintEdit(){
+ public function testproductsPrintEdit($objtmp){
$action = 'edit';
@@ -218,7 +218,7 @@
$get['pID'] = 1;
$res = $this->CallGetDBValue($action, $get);
- $res = $this->CheckAction();
+ $res = $this->CheckAction($objtmp);
$this->assertTrue ( ( strlen($res) > 1600) , 'Error retrun action::'.$action ) ;
}
@@ -226,7 +226,7 @@
@brief test display form edit
@depends testproductsConf
*/
- public function testproductsPrintDelete(){
+ public function testproductsPrintDelete($objtmp){
$action = 'delete';
@@ -234,7 +234,7 @@
$get['pID'] = 1;
$res = $this->CallGetDBValue($action, $get);
- $res = $this->CheckAction();
+ $res = $this->CheckAction($objtmp);
$this->assertTrue ( ( strlen($res) > 630) , 'Error retrun action::'.$action ) ;
}
@@ -245,9 +245,9 @@
@brief
@depends testproductsConf
*/
- public function CheckAction(){
+ public function CheckAction($objtmp){
- $res = products::display_view();
+ $res = $objtmp->display_view();
return $res;
}
Modified: trunk/test/phpunit/Back/modules/pages/pagesadminusersTest.php
===================================================================
--- trunk/test/phpunit/Back/modules/pages/pagesadminusersTest.php 2013-12-28 15:22:22 UTC (rev 4999)
+++ trunk/test/phpunit/Back/modules/pages/pagesadminusersTest.php 2013-12-29 11:45:02 UTC (rev 5000)
@@ -75,14 +75,14 @@
@brief test display flag action
@depends testadminusersConf
*/
- public function testadminsuersPrintFlag(){
+ public function testadminsuersPrintFlag($objtmp){
$action = 'setflag';
$get = array();
$get['flag'] = 1;
$get['cID'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) ==160) , 'Error retrun action::'.$action) ;
}
@@ -91,12 +91,12 @@
@brief test display form new customers
@depends testadminusersConf
*/
- public function testadminsuersPrintNew(){
+ public function testadminsuersPrintNew($objtmp){
$action = 'new';
$get = array();
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 2000) , 'Error retrun action::'.$action ) ;
}
@@ -105,14 +105,14 @@
@brief test display form edit
@depends testadminusersConf
*/
- public function testadminsuersPrintEdit(){
+ public function testadminsuersPrintEdit($objtmp){
$action = 'edit';
$get = array();
$get['cID'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 1600) , 'Error retrun action::'.$action ) ;
}
@@ -120,7 +120,7 @@
@brief test display form edit
@depends testadminusersConf
*/
- public function testadminsuersPrintDelete(){
+ public function testadminsuersPrintDelete($objtmp){
$action = 'delete';
@@ -128,7 +128,7 @@
$get['cID'] = 1;
$get['forceajax'] = 1;
- $res = $this->CheckAction($action, $get);
+ $res = $this->CheckAction($objtmp,$action, $get);
$this->assertTrue ( ( strlen($res) > 630) , 'Error retrun action::'.$action ) ;
}
@@ -139,7 +139,7 @@
@brief test display action page, no process action
@depends testadminusersConf
*/
- public function CheckAction($action, $get){
+ public function CheckAction($objtmp,$action, $get){
$get['action'] = $action;
foreach($get as $k=>$v){
@@ -148,7 +148,7 @@
}
adminUsers::GetConf();
- $res = adminUsers::display_view();
+ $res = $objtmp->display_view();
return $res;
}
Modified: trunk/test/phpunit/Back/sqlxxx/sqlfeaturedTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqlfeaturedTest.php 2013-12-28 15:22:22 UTC (rev 4999)
+++ trunk/test/phpunit/Back/sqlxxx/sqlfeaturedTest.php 2013-12-29 11:45:02 UTC (rev 5000)
@@ -50,6 +50,7 @@
return array(
// 'id'=>$id,
+ 'langue'=>1,
'sqlarray'=>$specimen,
'post'=>$specimen,
);
@@ -60,10 +61,10 @@
* @depends testfeaturedSpecimen
*/
public function testfeaturedCreat( $specimen ){
+// 'langue'=>array(),
+ $id = sqlfeatured::create($specimen);
- $id = sqlfeatured::create($specimen['sqlarray']);
-
$this -> assertTrue ( ((int)$id >0) , 'Error featured not create' ) ;
$specimen['id'] = $id;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-28 15:22:26
|
Revision: 4999
http://sourceforge.net/p/oscss/svn/4999
Author: oscim
Date: 2013-12-28 15:22:22 +0000 (Sat, 28 Dec 2013)
Log Message:
-----------
fix
Modified Paths:
--------------
trunk/dev/generator/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php
trunk/dev/generator/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php
Modified: trunk/dev/generator/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php 2013-12-27 15:31:55 UTC (rev 4998)
+++ trunk/dev/generator/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php 2013-12-28 15:22:22 UTC (rev 4999)
@@ -46,8 +46,10 @@
## table language
'TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION' => '_DATATYPE_REPLACE__description', //
+//REMOVEDEB_LINKTOCATEGORIE
## table link datatype categorie
- 'TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES' => '_DATATYPE_REPLACE__to_categories', //
+ 'TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES' => '_DATATYPE_REPLACE__to_categories' //
+//REMOVEEND_LINKTOCATEGORIE
);
/**
@var DataType dynamic
@@ -83,7 +85,7 @@
" LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION . " ".$this->p."d ON( ".$this->p."d._DATATYPE_REPLACE__id = ".$this->p."._DATATYPE_REPLACE__id AND ".$this->p."d.language_id = '" . (int)$languages_id . "' ) ".
"";
- $this->listing_sql['where'] = " WHERE ".$this->p."._DATATYPE_REPLACE__status = '1' ";
+ $this->listing_sql['where'] = " WHERE ".DataForceStatus(" ".$this->p."._DATATYPE_REPLACE__status='1' ")." ";
$this->listing_sql['sort'] = " ".$this->p."d._DATATYPE_REPLACE__title ";
$this->listing_sql['base_key'] = "_DATATYPE_REPLACE__id ";
$this->listing_sql['col_count'] = " ".$this->p."._DATATYPE_REPLACE__id ";
@@ -104,6 +106,8 @@
if(isset($_GET['data']) && $_GET['data'] == $this->DataType )
return true;
break;
+
+ //REMOVEDEB_LINKTOCATEGORIE
/*
Active la liaison avec les categorie
*/
@@ -111,6 +115,7 @@
if( isset($_GET['_DATATYPE_REPLACE_']) && is_numeric($_GET['_DATATYPE_REPLACE_']) )
return true;
break;
+ //REMOVEEND_LINKTOCATEGORIE
/*
Page Feed unique
*/
@@ -180,8 +185,25 @@
if( _test_bool('SEO_ADD_CAT_PARENT') )
$res=$DB->query( "select ft.page_id as ID, head_title_tag as tName, head_desc_tag, head_keywords_tag from " . TABLE_FULL_TAG . " ft, " . TABLE_FULL_TAG_DESCRIPTION . " ftd where ft.tag_id=ftd.tag_id and ft.page_type='_DATATYPE_REPLACE_' and ftd.language_id = '" . (int)$languages_id. "'" );
- else
+ else{
+ $sql="SELECT DISTINCT ft.page_id as ID , head_title_tag as tName, head_desc_tag, head_keywords_tag ";
+
+ //REMOVEDEB_LINKTOCATEGORIE
+ $sql.=" , cd.categories_cpath ";
+ //REMOVEEND_LINKTOCATEGORIE
+
+ $sql.=" FROM " . TABLE_FULL_TAG . " ft ";
+
+ //REMOVEDEB_LINKTOCATEGORIE
+ $sql.=" LEFT JOIN ".TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES." cd2 ON page_id=cd2._DATATYPE_REPLACE__id
+ JOIN ".TABLE_CATEGORIES." cd ON cd.categories_id = cd2.categories_id ";
+ //REMOVEEND_LINKTOCATEGORIE
+
+ $sql.=" , " . TABLE_FULL_TAG_DESCRIPTION . " ftd where ft.tag_id=ftd.tag_id and ft.page_type='_DATATYPE_REPLACE_' and ftd.language_id = '" . (int)$languages_id. "' GROUP BY ID";
+
+
$res=$DB->query( $sql="SELECT DISTINCT ft.page_id as ID , head_title_tag as tName, head_desc_tag, head_keywords_tag, cd.categories_cpath from " . TABLE_FULL_TAG . " ft LEFT JOIN ".TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES." cd2 ON page_id=cd2._DATATYPE_REPLACE__id JOIN ".TABLE_CATEGORIES." cd ON cd.categories_id = cd2.categories_id , " . TABLE_FULL_TAG_DESCRIPTION . " ftd where ft.tag_id=ftd.tag_id and ft.page_type='_DATATYPE_REPLACE_' and ftd.language_id = '" . (int)$languages_id. "' GROUP BY ID" );
+ }
while ($result =$res->fetchAssoc()){
$path = '';
@@ -242,8 +264,11 @@
$this->listing_sql['tables'] = " FROM " . TABLE__DATATYPE_REPLACE_MAJ_ . " ".$this->p." ";
$this->listing_sql['tables'] .=" LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION . " ".$this->p."d using(_DATATYPE_REPLACE__id) ";
+
+ //REMOVEDEB_LINKTOCATEGORIE
$this->listing_sql['tables'] .=" LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " ".$this->p."2c using(_DATATYPE_REPLACE__id) ";
$this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_CATEGORIES . " cat ON( ".$this->p."2c.categories_id = cat.categories_id and cat.categories_status='1' ) ";
+ //REMOVEEND_LINKTOCATEGORIE
/// Add search in Extra value
$this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_EXTRA_FIELDS_TO . " p2pef ON(p2pef.data_id = p.products_id AND p2pef.data_type = '_DATATYPE_REPLACE_') ";
Modified: trunk/dev/generator/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php 2013-12-27 15:31:55 UTC (rev 4998)
+++ trunk/dev/generator/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php 2013-12-28 15:22:22 UTC (rev 4999)
@@ -64,9 +64,12 @@
* @return object
*/
public static function get_item($id,$option=array()){ return _DATATYPE_REPLACE_Data::get_item($id,$option); }
+ //REMOVEDEB_LINKTOCATEGORIE
public static function get__DATATYPE_REPLACE__cat($id){ return _DATATYPE_REPLACE_Data::get__DATATYPE_REPLACE__cat($id); }
public static function get__DATATYPE_REPLACE__path($id){ return _DATATYPE_REPLACE_Data::get__DATATYPE_REPLACE__path($id); }
public static function get__DATATYPE_REPLACE__in_cat($current_category_id=0, $exclude=''){ return _DATATYPE_REPLACE_Data::get__DATATYPE_REPLACE__in_cat($current_category_id=0, $exclude=''); }
+ //REMOVEEND_LINKTOCATEGORIE
+
public static function get_byDate($max, $exclude){ return _DATATYPE_REPLACE_Data::get_byDate($max, $exclude); }
public static function get_img($id, $img_num=0){ return _DATATYPE_REPLACE_Data::get_img($id, $img_num); }
@@ -74,10 +77,13 @@
* \fn get_extra__DATATYPE_REPLACE_($_DATATYPE_REPLACE_s_id, $key='')
*/
public static function get_extra__DATATYPE_REPLACE_($_id, $key='') {return _DATATYPE_REPLACE_Data::GetExtraFields($_id, $key); }
+
+ //REMOVEDEB_LINKTOCATEGORIE
/**
* \fn get_count__DATATYPE_REPLACE_s_in_category($category_id, $include_inactive = false)
*/
public static function get_count_in_category($category_id, $include_inactive = false) {return _DATATYPE_REPLACE_Data::count_in_category($category_id, $include_inactive); }
+ //REMOVEEND_LINKTOCATEGORIE
}
@@ -169,10 +175,29 @@
@brief Requeteur
*/
protected static function cstr_query($orderby='', $limit='', $option=''){
- $query="SELECT c.*, cd.*, _DATATYPE_REPLACE__title AS title, c._DATATYPE_REPLACE__id AS id, cd._DATATYPE_REPLACE__title AS name, _DATATYPE_REPLACE__description AS text, c.date_added as date_added
- FROM " . TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION . " cd, " . TABLE__DATATYPE_REPLACE_MAJ_ . " c, " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " ctc, " . TABLE_CATEGORIES . " cat
- WHERE cat.categories_id=ctc.categories_id " . DataForceStatus(" AND cat.categories_status='1' ") . " " . DataForceStatus(" AND c._DATATYPE_REPLACE__status = '1' ") . " AND c._DATATYPE_REPLACE__id = ctc._DATATYPE_REPLACE__id AND cd._DATATYPE_REPLACE__id = ctc._DATATYPE_REPLACE__id AND cd.language_id = '" . self::$lg_id . "' " ;
+ $query="SELECT c.*" ;
+
+ //REMOVEDEB_LINKTOCATEGORIE
+ $query.=" , cd.* " ;
+ //REMOVEEND_LINKTOCATEGORIE
+
+ $query.=" , _DATATYPE_REPLACE__title AS title, c._DATATYPE_REPLACE__id AS id, cd._DATATYPE_REPLACE__title AS name, _DATATYPE_REPLACE__description AS text, c.date_added as date_added
+ FROM " . TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION . " cd, " . TABLE__DATATYPE_REPLACE_MAJ_ . " c, " ;
+
+ //REMOVEDEB_LINKTOCATEGORIE
+ $query.=" , " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " ctc, " . TABLE_CATEGORIES . " cat " ;
+ //REMOVEEND_LINKTOCATEGORIE
+
+ $query.=" WHERE 1 ".DataForceStatus(" AND c._DATATYPE_REPLACE__status = '1' ") ;
+
+ //REMOVEDEB_LINKTOCATEGORIE
+ $query.=" AND cd._DATATYPE_REPLACE__id = ctc._DATATYPE_REPLACE__id AND cat.categories_id=ctc.categories_id " . DataForceStatus(" AND cat.categories_status='1' ") ;
+ //REMOVEEND_LINKTOCATEGORIE
+
+ $query.= . " AND cd.language_id = '" . self::$lg_id . "' ";
+
+
$query .=self::$where_query;
$query .=' ORDER BY ' .(!tep_not_null($orderby)? ' c.sort_order, cd._DATATYPE_REPLACE__title ASC ' : $orderby) ;
$query .=' LIMIT '.(!tep_not_null($limit)? '1' : $limit) ;
@@ -233,6 +258,7 @@
return self::getInstance();
}
+ //REMOVEDEB_LINKTOCATEGORIE
/**
@brief Function recuperation des page associé a une cat
@param $current_category_id int l'id de la categorie courante ou null
@@ -249,8 +275,8 @@
return self::statment_query($_DATATYPE_REPLACE__query,$exclude);
}
+ //REMOVEEND_LINKTOCATEGORIE
-
/**
@brief Appel item
@param $id string _DATATYPE_REPLACE__name le nom du titre
@@ -294,6 +320,7 @@
return false;
}
+ //REMOVEDEB_LINKTOCATEGORIE
/**
Function recuperation de la cat d'un _DATATYPE_REPLACE__id
@@ -336,6 +363,7 @@
return $cPath;
}
+ //REMOVEEND_LINKTOCATEGORIE
/**
Recupere la liste des article cms triée par date
@@ -369,7 +397,7 @@
return (string)self::$array_data[$id]->images[$img_num][0];
}
-
+ //REMOVEDEB_LINKTOCATEGORIE
/**
@fn count_in_category($category_id, $include_inactive = false)
@brief count data in categorie
@@ -396,8 +424,8 @@
return $_DATATYPE_REPLACE_s_count;
}
+ //REMOVEEND_LINKTOCATEGORIE
-
/**
@brief Champs extra _DATATYPE_REPLACE_ Recupere la totalite des element supplementaire generic.
Les chamsp appartenant à des modules ne sont pas chargée
@@ -513,6 +541,7 @@
$s .=$r['value'] .$separator;
return substr($s, 0, -1);
+ }rn substr($s, 0, -1);
}
}
@@ -528,6 +557,8 @@
abstract protected function display_view($pID,$class='');
abstract protected function load_db_values($pID);
abstract protected function get_header($action='');
+ // méthode commune
+// public function printOut() { }
}
@@ -538,7 +569,7 @@
*/
class _DATATYPE_REPLACE_Module
extends AbstractAcaModule
- {
+ implements InterfaceAcaGene {
/**
@var string Les modules actif
@@ -577,7 +608,59 @@
return self::getInstance();
}
+ /**
+ * \fn display_view($pID,$class='',$exclude=array() )
+ @brief Affiche module elemennt html
+ Block principal d'affichage, liste ou vue des élément. Block principal de page
+ @param $pID int le Id du produits
+ @param $class string le nom de la class appelé, ou vide pour toutes les class enfants
+ @param $exclude array
+ */
+ public function display_view($pID,$class='',$exclude=array() ){
+ global $page;
+ if (!empty($class)) {
+ if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($class, 'display_view' ))){
+ $this->modules[$class]->load_db_values($pID);
+ return $this->modules[$class]->display_view($pID);
+ }
+ } else {
+ $c=array();
+ if(isset($this->modules) && is_array($this->modules))
+ foreach ($this->modules as $key=>$module) {
+ if ( !in_array($key,$exclude) && ($module->enabled) and (method_exists($module, 'display_view' ))) {
+ $this->modules[$key]->load_db_values($pID);
+ $c[$key]=$this->modules[$key]->display_view($pID);
+ }
+ }
+ return $c;
+ }
+ }
+ /**
+ Affiche module display_view mini
+
+ @param
+ @a int cID le Id du customers
+ @a string class le nom de la class appelé, ou vide pour toutes les class enfants
+ */
+ public function display_view_min($cID,$class=''){
+ global $page;
+ if (!empty($class)) {
+ if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($module, 'display_view_min' ))){
+ $this->modules[$class]->load_db_values($cID);
+ return $this->modules[$class]->display_view_min($cID);
+ }
+ } else {
+ $c='';
+ foreach ($this->modules as $key=>$module) {
+ if (($module->enabled) and (method_exists($module, 'display_view_min' ))) {
+ $this->modules[$key]->load_db_values($cID);
+ $c .=$this->modules[$key]->display_view_min($cID);
+ }
+ }
+ return $c;
+ }
+ }
}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:31:57
|
Revision: 4998
http://sourceforge.net/p/oscss/svn/4998
Author: oscim
Date: 2013-12-27 15:31:55 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
add cli cmd
Added Paths:
-----------
trunk/dev/package/
trunk/dev/package/package.php
trunk/dev/sample/
trunk/dev/sample/sample.php
Added: trunk/dev/package/package.php
===================================================================
--- trunk/dev/package/package.php (rev 0)
+++ trunk/dev/package/package.php 2013-12-27 15:31:55 UTC (rev 4998)
@@ -0,0 +1,228 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.1
+ @date 22/08/11, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/package/package.php
+ @brief command line for installer extends specific to oscss
+ this installer use class abd file content in backoffice oscss
+
+ @remarks To run this script as CLI: php clip.php filename
+*/
+
+if(! isset($secukey) )
+ die('please use ../cli.php '."\n");
+
+
+ class clipackage
+ extends cli{
+
+ /**
+ @brief init methode for extract specific params
+ @param $argv array()
+ */
+ public function init($argv){
+ if(count($argv) <=2 || $argv[2] =='-h'){
+ $ob =" This script use core oscss for installer/remove extentions in core\n".
+ "You'r use args for correct process\n".
+ // " * -fileconfig path/configfile.xml use configuration file \n".
+ " * action (install/remove/update)\n".
+ " * -p nameofpackage\n".
+ " * -v int 1-9 verbose \n".
+ " * -d int 1-9 debug \n".
+ "\n\n";
+ print $ob;
+ exit;
+ }
+
+// $this->config = $config;
+ $this->config->p = '';
+ $this->config->v = 0;
+ $this->config->d = 0;
+
+ // Extract item config
+ $key = null;
+ for($i =2 , $n = (count($argv)); $i<$n ; $i++){
+ $test = $argv[$i];
+ if( $i === 2 && !preg_match('#-#', $test) )
+ $this->config->action = $test;
+ elseif( $key===null && preg_match('#^-[a-z]#', $test) )
+ $key = substr($test,1);
+ elseif( $key !=null ){
+ $this->config->$key = $test;
+ $key = null;
+ }
+ }
+ }
+
+ /**
+ @brief control params
+ */
+ public function check(){
+ if(empty($this->config->action) )
+ die('define action'."\n");
+
+ // check params prev process
+ switch($this->config->action){
+ case 'install':
+ case 'remove':
+ case 'reconfigure':
+ if(empty($this->config->p) )
+ die('define -p package '."\n");
+ break;
+ }
+ }
+
+ /**
+ @brief adjust config and local vars
+ */
+ public function preprocess(){
+ require_once($this->path_base.'includes/modules/pages/package.php');
+ require_once($this->path_base.'includes/functions/lib.cip_manager.php');
+ require_once($this->path_base.'includes/exts/package/CIP.php');
+
+
+
+ if($this->config->d > 0)
+ CIP::$debugg = true;
+ else
+ CIP::$debugg = false;
+ }
+
+ /**
+ @brief exec
+ */
+ public function process(){
+ switch($this->config->action){
+ case 'install':
+
+ // search id for package
+ $r= package::load_repository();
+ $list = package::$FeedItem;
+
+
+ foreach($list as $key=>$row)
+ if( (string)$row->ident == strtoupper($this->config->p) ){
+ $pkgID = (int)$row->internalID;
+ break;
+ }
+
+ if(!isset($pkgID) || (int)$pkgID<=0)
+ die('no found in local db package'."\n");
+
+ if($row->etat == 1)
+ die('last installed'."\n");
+
+
+ echo "\n\nAre you sure you want to do this? Type 'yes' to continue: ";
+ $handle = fopen ("php://stdin","r");
+ $line = fgets($handle);
+ if(trim($line) != 'yes'){
+ echo "ABORTING!\n";
+ exit;
+ }
+ echo "\n";
+ echo "Thank you, continuing ?!!\n";
+
+ $action='install';
+ $code = 'package';
+ $class=$code.'Installer';
+ require_once($this->path_base.'includes/exts/package/'.$class.'.php');
+
+ $obj=new $class;
+
+ if(!empty($row->link)){
+ $list=$obj->download_exts((int)$pkgID);
+
+ if($list<=0)
+ die('error in download '."\n");
+ }
+
+ $list=$obj->install_exts((int)$pkgID);
+ break;
+
+
+ case 'remove':
+
+ // search id for package
+ $r= package::load_repository();
+ $list = package::$FeedItem;
+ foreach($list as $key=>$row)
+ if( (string)$row->ident == strtoupper($this->config->p) ){
+ $pkgID = (int)$row->internalID;
+ break;
+ }
+
+ if(!isset($pkgID) || (int)$pkgID<=0)
+ die('no found in local db package'."\n");
+
+
+ if($row->etat == 0)
+ die('not installed'."\n");
+
+ echo "\n\nAre you sure you want to do this? Type 'yes' to continue: ";
+ $handle = fopen ("php://stdin","r");
+ $line = fgets($handle);
+ if(trim($line) != 'yes'){
+ echo "ABORTING!\n";
+ exit;
+ }
+ echo "\n";
+ echo "Thank you, continuing ?!!\n";
+
+
+ $action='remove';
+ $code = 'package';
+ $class=$code.'Installer';
+ require_once($this->path_base.'includes/exts/package/'.$class.'.php');
+
+ $obj=new $class;
+
+
+ $list=$obj->remove_exts((int)$pkgID);
+
+ break;
+
+
+
+
+ case 'update':
+
+ $action='remove';
+ $code = 'package';
+ $class=$code.'Repository';
+ require_once($this->path_base.'includes/exts/package/'.$class.'.php');
+
+ $obj=new $class;
+ $list=$obj->SourceUpdate();
+
+ break;
+
+ default:
+
+ }
+ }
+
+ /**
+ @brief display error if mode verbose > 0
+ */
+ function displayerror(){
+ if($this->config->v > 0){
+
+ foreach($list as $row)
+ echo strip_tags($row)."\n";
+
+
+ if($this->config->d > 0)
+ foreach(package::$Rightlist as $row)
+ echo strip_tags($row)."\n";
+ }
+ }
+ }
+
+
+
+?>
\ No newline at end of file
Added: trunk/dev/sample/sample.php
===================================================================
--- trunk/dev/sample/sample.php (rev 0)
+++ trunk/dev/sample/sample.php 2013-12-27 15:31:55 UTC (rev 4998)
@@ -0,0 +1,89 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.1
+ @date 22/08/11, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/sample/sample.php
+ @brief command line for installer extends specific to oscss
+ this installer use class abd file content in backoffice oscss
+
+ @remarks To run this script as CLI: php clip.php filename
+*/
+
+if(! isset($secukey) )
+ die('please use ../cli.php '."\n");
+
+
+ class clisample
+ extends cli{
+
+ /**
+ @brief init methode for extract specific params
+ @param $argv array()
+ */
+ public function init($argv){
+ if(count($argv) <=2 || $argv[2] =='-h'){
+ $ob =" Sample init for control params scripts \n".
+ "You'r use args for correct process\n".
+ " * -v int 1-9 verbose \n".
+ "\n\n";
+ print $ob;
+ exit;
+ }
+
+ $this->config->v = 0;
+ $this->config->d = 0;
+
+ // Extract item config
+ $key = null;
+ for($i =2 , $n = (count($argv)); $i<$n ; $i++){
+ $test = $argv[$i];
+ if( $i === 2 && !preg_match('#-#', $test) )
+ $this->config->action = $test;
+ elseif( $key===null && preg_match('#^-[a-z]#', $test) )
+ $key = substr($test,1);
+ elseif( $key !=null ){
+ $this->config->$key = $test;
+ $key = null;
+ }
+ }
+ }
+
+ /**
+ @brief control params
+ */
+ public function check(){
+ if($this->config->v > 0 )
+ die('you\'r verbose is true '."\n");
+ }
+
+ /**
+ @brief adjust config and local vars
+ */
+ public function preprocess(){
+ //require_once($this->path_base.'includes/modules/pages/package.php');
+ }
+
+ /**
+ @brief exec
+ */
+ public function process(){
+ echo 'process'."\n";
+ }
+
+ /**
+ @brief display error if mode verbose > 0
+ */
+ function displayerror(){
+ if($this->config->v > 0){
+ echo 'verbose....';
+ }
+ }
+ }
+
+
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:31:08
|
Revision: 4997
http://sourceforge.net/p/oscss/svn/4997
Author: oscim
Date: 2013-12-27 15:31:06 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
Removed Paths:
-------------
trunk/dev/GenerCode/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:30:10
|
Revision: 4996
http://sourceforge.net/p/oscss/svn/4996
Author: oscim
Date: 2013-12-27 15:30:07 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
Fix and adjust code
re-write all code generator
Added Paths:
-----------
trunk/dev/generator/Dicos/Dicos.php
trunk/dev/generator/generator.php
Removed Paths:
-------------
trunk/dev/generator/Dicos/index.php
trunk/dev/generator/ModuleType/index.php
Added: trunk/dev/generator/Dicos/Dicos.php
===================================================================
--- trunk/dev/generator/Dicos/Dicos.php (rev 0)
+++ trunk/dev/generator/Dicos/Dicos.php 2013-12-27 15:30:07 UTC (rev 4996)
@@ -0,0 +1,105 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.2
+ @date 28/12/2013, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/generator/Dicos/dicos.php
+ @remarks To run this script as CLI: php cli.php generator filename
+ @note if yoru copie this file replace all Dicos by new name folder
+*/
+
+
+/**
+ @brief Adjust Class for this page
+*/
+class generateurDicos
+ extends GenerCode{
+
+ /**
+ @var object
+ */
+ public $config;
+
+ private function init(){
+
+ $current = dirname(__FILE__);
+
+
+
+ $this->seotag = false; //tep_db_prepare_input($_GET['seotag']);
+ $this->head_tag = false;
+
+ $this->name = $this->config->name;
+
+ // level of extension
+ $this->level = (!empty($this->config->level)? $this->config->level : 'stable' );
+
+ // dir placed modele files
+ $this->modele_path = $current .'/'. (!empty($this->config->dirmodel)? $this->config->dirmodel : 'Modele' ) .'/';
+
+
+ $this->allsearch=array(
+ '_REPLDICO_MAJ_',
+ '_REPLDICO_',
+ );
+
+ $this->allreplace=array(
+ strtoupper($this->name),
+ $this->name
+ );
+
+ $this->finalname = strtoupper($this->name).'_'.$this->level;
+
+ $this->folder = $current .'/'. $this->finalname.'/';
+ }
+
+
+ /**
+ @brief
+ */
+ public function config($config){
+ $this->config = $config;
+ }
+
+
+ /**
+ @brief
+ */
+ public function check(){
+ $cfg = $this->config;
+
+
+ if( !isset($cfg) || !is_object($cfg) )
+ die('this model require args '."\n");
+
+ if( !isset($cfg->name)/* || !isset($cfg->name) || !isset($cfg->name) ||*/){
+ $ob ="\n\n this modele require : \n".
+ " * -name string of new extends, use no special caracteres \n";
+// $ob .=" * -v int 1-9 verbose \n";
+ $ob .=" optionnal : \n".
+ " * -level (stable/unstable/testing) default is stable \n".
+ " * -dirmodel string default is Modele in dir of Dicos\n"
+ ;
+ print $ob;
+ exit;
+ }
+
+ $this->init($cfg);
+
+
+ }
+
+ /**
+ @brief
+ */
+ public function preprocess(){
+ if(!file_exists($this->folder) || !is_dir($this->folder)) {
+ mkdir($this->folder);
+ }
+ }
+}
+
+?>
Deleted: trunk/dev/generator/Dicos/index.php
===================================================================
--- trunk/dev/generator/Dicos/index.php 2013-12-27 15:29:13 UTC (rev 4995)
+++ trunk/dev/generator/Dicos/index.php 2013-12-27 15:30:07 UTC (rev 4996)
@@ -1,154 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2012 The osCSS developers - osCSS Open Source E-commerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 05/04/2012, 09:40
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
- @note if yoru copie this file replace all ModuleType by new name folder
-*/
-global $current;
-
-
-
-
-$_CurrentRoot = 'Dicos/';
-
-
-$arrReturn = array();
-// Scan directory
-$folder = $_CurrentRoot.'Modele/catalog/includes/modules/';
-foreach (scandir($current . $folder) as $strFile) {
- if ( in_array($strFile , array( '.' , '..' , '.svn') ) || !is_dir($current . $folder . $strFile) ) continue;
- $arrReturn[] = array('id'=>$strFile, 'text'=>$strFile);
-}
-
-
-/**
- @brief Adjust Class for this page
-*/
-class GenerCodeModuleType
- extends GenerCode{
-
- function __construct($conf ){
-
-
- $conf->curent;
- $conf->name = tep_db_prepare_input($_GET['name']);
-// $conf->match = tep_db_prepare_input($_GET['module']);
- $conf->level = 'stable';
-
- $this->modele_path = $conf->modele_path;
-
-
- $this->allsearch=array(
- '_REPLDICO_MAJ_',
- '_REPLDICO_',
- );
-
- $this->allreplace=array(
- strtoupper($conf->name),
- $conf->name
- );
-
-
- $this->folder = $conf->curent .'/'. strtoupper($conf->name).'_'.$conf->level.'/';
-
- if(!file_exists($this->folder) || !is_dir($this->folder)) {
- mkdir($this->folder);
- }
-
- $this->ProcessAndFinish();
-
- echo 'le dossier creer ce situe :' . $this->folder;
-
- }
-
-
- function process($current=''){
-
- if (!empty($current) && substr($current, -1, 1) != '/') $current .= '/';
-
- $path_mod = $this->modele_path . $current;
-
- foreach($this->browse($path_mod) as $row){
- if(is_dir($path_mod.$row)) {
-
- mkdir( $this->stringreplace($this->folder . $current. $row) );
- $this->process($current.$row);
- }
- else{
- $res=file_get_contents($path_mod.$row);
-
- $file_contents = $this->stringreplace($res);
-
- $fp = fopen( $this->stringreplace($this->folder . $current. $row) , 'w');
- fputs($fp, $file_contents);
- fclose($fp);
- }
- }
- }
-
-}
-
-
-
-
-/**
- Action
-*/
-if(isset($_GET['name']) && !empty($_GET['name'])){
-
- $conf = new stdClass();
- $conf->curent = $current . $_CurrentRoot;
- $conf->name = tep_db_prepare_input($_GET['name']);
- $conf->seotag = tep_db_prepare_input($_GET['seotag']);
- $conf->head_tag = false;
- $conf->level = 'stable';
- $conf->modele_path = $conf->curent . 'Modele/';
-
- $object = new GenerCodeModuleType($conf);
-
- exit;
-}
-
-?>
-
-
-<h2>Create Dico base exts</h2>
-
-
-<form>
-</p>
-<table>
- <tr>
- <td>Nom de base </td>
- <td><?php echo tep_draw_input_field('name', 'name') ?>(string) full name (no special caratere)</td>
- </tr>
-
- <tr>
- <td>Nom de base enfants</td>
- <td><?php //echo tep_draw_input_field('name', 'name') ?>(string) full name (no special caratere)</td>
- </tr>
-
-<!-- <tr>
- <td>quick tag for rewrite</label>
- <td><?php //echo tep_draw_input_field('seotag', 'seotag') ?>(string) quik key </td>
- </tr>-->
-<!-- <tr>
- <td>other rows in master table, respect classique sql commande ; just subline in create </label>
- <td><?php echo tep_draw_pull_down_menu('module','', $arrReturn) ?></td>
- </tr>-->
-</table>
-<!-- <p>
- <label>add head_tag</label>
- <?php echo tep_draw_checkbox_field('head_tag', 'head_tag', 'active') ?>
- </p>-->
-
-
- <p>
- <input type="hidden" name="goto" value="<?php echo $_CurrentRoot ?>" />
- <input type="submit" value="Translate" />
- </p>
-</form>
Deleted: trunk/dev/generator/ModuleType/index.php
===================================================================
--- trunk/dev/generator/ModuleType/index.php 2013-12-27 15:29:13 UTC (rev 4995)
+++ trunk/dev/generator/ModuleType/index.php 2013-12-27 15:30:07 UTC (rev 4996)
@@ -1,158 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2012 The osCSS developers - osCSS Open Source E-commerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 05/04/2012, 09:40
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
- @note if yoru copie this file replace all ModuleType by new name folder
-*/
-global $current;
-
-
-
-$arrReturn = array();
-// Scan directory
-$folder = 'ModuleType/Modele/catalog/includes/modules/';
-foreach (scandir($current . $folder) as $strFile) {
- if ( in_array($strFile , array( '.' , '..' , '.svn') ) || !is_dir($current . $folder . $strFile) ) continue;
- $arrReturn[] = array('id'=>$strFile, 'text'=>$strFile);
-}
-
-
-/**
- @brief Adjust Class for this page
-*/
-class GenerCodeModuleType
- extends GenerCode{
-
- function __construct($conf ){
-
-
- /*$curent = */ $conf->curent;
- $conf->name = tep_db_prepare_input($_GET['name']);
- $conf->match = tep_db_prepare_input($_GET['module']);
-// $conf->head_tag = false;
- $conf->level = 'stable';
-// exit;
- $this->modele_path = $conf->modele_path;
-
-
- $this->allsearch=array(
- '_MODTYPENAME_MAJ_',
- '_MODTYPENAME_',
- );
-
- $this->allreplace=array(
- strtoupper($conf->name),
- $conf->name
- );
-
-
- $this->folder = $conf->curent .'/'. strtoupper($conf->name).'_'.$conf->level.'/';
-
- if(!file_exists($this->folder) || !is_dir($this->folder)) {
- mkdir($this->folder);
- }
-
- $this->ProcessAndFinish();
-// }
-
-
- echo 'le dossier creer ce situe :' . $this->folder;
-
- }
-
-
- function process($current=''){
-
- if (!empty($current) && substr($current, -1, 1) != '/') $current .= '/';
-
- $path_mod = $this->modele_path . $current;
-
- foreach($this->browse($path_mod) as $row){
-var_dump('#.*(modules/'.$conf->match.').*#i', $path_mod.$row);
-
- if(is_dir($path_mod.$row)) {
-
- mkdir( $this->stringreplace($this->folder . $current. $row) );
- $this->process($current.$row);
- }
- elseif(
- ( preg_match('#.*(modules/'.$conf->match.').*#i', $path_mod.$row ) ) //
- ) {
-
-
- $res=file_get_contents($path_mod.$row);
-
- $file_contents = $this->stringreplace($res);
-
- $fp = fopen( $this->stringreplace($this->folder . $current. $row) , 'w');
- fputs($fp, $file_contents);
- fclose($fp);
- }
- }
- }
-
-}
-
-
-
-
-/**
- Action
-*/
-if(isset($_GET['name']) && !empty($_GET['name'])){
-
- $conf = new stdClass();
- $conf->curent = $current . 'ModuleType/';
- $conf->name = tep_db_prepare_input($_GET['name']);
- $conf->seotag = tep_db_prepare_input($_GET['seotag']);
- $conf->head_tag = false;
- $conf->level = 'stable';
- $conf->modele_path = $conf->curent . 'Modele/';
-
- $object = new GenerCodeModuleType($conf);
-
- exit;
-}
-
-?>
-
-
-<h2>Creat new typed module</h2>
-
-This module create is base structure module and current methode ,interface or extends classe;
-
-
-Next generate, adjust methode and display.
-
-<form>
-</p>
-<table>
- <tr>
- <td>Master name for datatype (this is string type for manipulate datatype)</td>
- <td><?php echo tep_draw_input_field('name', 'name') ?>(string) full name (no special caratere)</td>
- </tr>
-
-<!-- <tr>
- <td>quick tag for rewrite</label>
- <td><?php //echo tep_draw_input_field('seotag', 'seotag') ?>(string) quik key </td>
- </tr>-->
- <tr>
- <td>other rows in master table, respect classique sql commande ; just subline in create </label>
- <td><?php echo tep_draw_pull_down_menu('module','', $arrReturn) ?></td>
- </tr>
-</table>
-<!-- <p>
- <label>add head_tag</label>
- <?php echo tep_draw_checkbox_field('head_tag', 'head_tag', 'active') ?>
- </p>-->
-
-
- <p>
- <input type="hidden" name="goto" value="ModuleType" />
- <input type="submit" value="Translate" />
- </p>
-</form>
Added: trunk/dev/generator/generator.php
===================================================================
--- trunk/dev/generator/generator.php (rev 0)
+++ trunk/dev/generator/generator.php 2013-12-27 15:30:07 UTC (rev 4996)
@@ -0,0 +1,137 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.2
+ @date 28/12/2013, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/generator/generator.php
+ @brief command line write new extension based on you'r name
+
+ @remarks To run this script as CLI: php clip.php filename
+*/
+
+if(! isset($secukey) )
+ die('please use ../cli.php '."\n");
+
+ require_once('class.GenerCode.php');
+
+ class cligenerator
+ extends cli{
+
+ /**
+ @brief init methode for extract specific params
+ @param $argv array()
+ */
+ public function init($argv){
+ $path_init = dirname(__FILE__);
+
+ if(count($argv) <=2 || $argv[2] =='-h'){
+ $ob =" Sample init for control params scripts \n".
+ "You'r use args for correct process\n".
+ "* type of modele used\n";
+
+ foreach(scan($path_init) as $row)
+ if( is_dir($path_init.'/'.$row) )
+ $ob .=' -'.$row."\n";
+
+ $ob .=" * -v int 1-9 verbose \n";
+
+ print $ob;
+ exit;
+ }
+
+ $this->config->v = 0;
+ $this->config->d = 0;
+ $this->config->path = $path_init;
+ $this->config->model = false;
+
+ // Extract item config
+ $key = null;
+ for($i =2 , $n = (count($argv)); $i<$n ; $i++){
+ $test = $argv[$i];
+ if( $i === 2 && !preg_match('#-#', $test) )
+ $this->config->model = $test;
+ elseif( $key===null && preg_match('#^-[a-z]#', $test) )
+ $key = substr($test,1);
+ elseif( $key !=null ){
+ $this->config->$key = $test;
+ $key = null;
+ }
+ }
+ }
+
+ /**
+ @brief control params
+ */
+ public function check(){
+ if( $this->config->model != false && !is_dir($this->config->path .'/'.$this->config->model ) )
+ die('this model not exits '."\n");
+
+ require_once($this->config->path .'/'.$this->config->model.'/'.$this->config->model.'.php');
+
+
+ $class = 'generateur'.$this->config->model;
+ $this->obj = new $class();
+
+ $this->obj->config($this->config);
+
+ $this->obj->check();
+ }
+
+ /**
+ @brief adjust config and local vars
+ */
+ public function preprocess(){
+// require_once($this->path_base.'includes/modules/pages/package.php');
+// echo $this->config->path .'/'.'class.GenerCode.php';
+ require_once($this->config->path .'/'.'class.GenerCode.php');
+
+ $this->obj->preprocess();
+ }
+
+ /**
+ @brief exec
+ */
+ public function process(){
+ echo 'process'."\n";
+
+ switch( strtolower($this->config->model) ){
+// case 'dicos':
+//
+// break;
+
+ default:
+ $this->obj->ProcessAndFinish();
+
+ echo "\n".'le dossier creer ce situe :' . $this->obj->folder . "\n";
+
+
+ echo "\n\nYou'r move in contribution dir ??' Type 'yes' to continue: ";
+ $handle = fopen ("php://stdin","r");
+ $line = fgets($handle);
+ if(trim($line) != 'yes'){
+ echo "ABORTING!\n";
+ exit;
+ }
+ echo "\n";
+ echo "Thank you, continuing ?!!\n";
+
+ rename( $this->obj->folder , DIR_FS_CIP. $this->obj->finalname );
+ }
+ }
+
+ /**
+ @brief display error if mode verbose > 0
+ */
+ function displayerror(){
+ if($this->config->v > 0){
+ echo 'verbose....';
+ }
+ }
+ }
+
+
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:29:18
|
Revision: 4995
http://sourceforge.net/p/oscss/svn/4995
Author: oscim
Date: 2013-12-27 15:29:13 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
Fix and adjust code
re-write all code generator
Added Paths:
-----------
trunk/dev/generator/ModuleType/ModuleType.php
trunk/dev/generator/datatype/datatype.php
Removed Paths:
-------------
trunk/dev/generator/datatype/index.php
Added: trunk/dev/generator/ModuleType/ModuleType.php
===================================================================
--- trunk/dev/generator/ModuleType/ModuleType.php (rev 0)
+++ trunk/dev/generator/ModuleType/ModuleType.php 2013-12-27 15:29:13 UTC (rev 4995)
@@ -0,0 +1,112 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.2
+ @date 28/12/2013, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/generator/ModuleType/dicos.php
+ @remarks To run this script as CLI: php cli.php generator filename
+ @note if yoru copie this file replace all ModuleType by new name folder
+*/
+
+
+/**
+ @brief Adjust Class for this page
+*/
+class generateurModuleType
+ extends GenerCode{
+
+ /**
+ @var object
+ */
+ public $config;
+ /**
+ @var
+ */
+ public $match;
+
+ private function init(){
+
+ $current = dirname(__FILE__);
+
+
+
+ $this->seotag = false;
+ $this->head_tag = false;
+
+ $this->name = $this->config->name;
+ $this->match = (!empty($this->config->type)? $this->config->type : false );
+
+ // level of extension
+ $this->level = (!empty($this->config->level)? $this->config->level : 'stable' );
+
+ // dir placed modele files
+ $this->modele_path = $current .'/'. (!empty($this->config->dirmodel)? $this->config->dirmodel : 'Modele' ) .'/';
+
+
+ $this->allsearch=array(
+ '_REPLDICO_MAJ_',
+ '_REPLDICO_',
+ );
+
+ $this->allreplace=array(
+ strtoupper($this->name),
+ $this->name
+ );
+
+ $this->finalname = strtoupper($this->name).'_'.$this->level;
+
+ $this->folder = $current .'/'. $this->finalname.'/';
+ }
+
+
+ /**
+ @brief
+ */
+ public function config($config){
+ $this->config = $config;
+ }
+
+
+ /**
+ @brief
+ */
+ public function check(){
+ $cfg = $this->config;
+
+
+ if( !isset($cfg) || !is_object($cfg) )
+ die('this model require args '."\n");
+
+ if( !isset($cfg->name)|| !issetmatch($cfg->name) /* || !isset($cfg->name) ||*/){
+ $ob ="\n\n this modele require : \n".
+ " * -name string of new extends, use no special caracteres \n".
+ " * -type string type of submodule (folder includes/modules/) \n"
+ ;
+// $ob .=" * -v int 1-9 verbose \n";
+ $ob .=" optionnal : \n".
+ " * -level (stable/unstable/testing) default is stable \n".
+// " * -dirmodel string default is Modele in dir of ModuleType\n"
+ ;
+ print $ob;
+ exit;
+ }
+
+ $this->init($cfg);
+
+
+ }
+
+ /**
+ @brief
+ */
+ public function preprocess(){
+ if(!file_exists($this->folder) || !is_dir($this->folder)) {
+ mkdir($this->folder);
+ }
+ }
+}
+
+?>
Added: trunk/dev/generator/datatype/datatype.php
===================================================================
--- trunk/dev/generator/datatype/datatype.php (rev 0)
+++ trunk/dev/generator/datatype/datatype.php 2013-12-27 15:29:13 UTC (rev 4995)
@@ -0,0 +1,207 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.2
+ @date 28/12/2013, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/generator/datatype/datatype.php
+ @remarks To run this script as CLI: php cli.php generator filename
+ @note if yoru copie this file replace all datatype by new name folder
+*/
+
+/**
+ @brief Adjust Class for this page
+*/
+class generateurdatatype
+ extends GenerCode{
+
+ /**
+ @var
+ */
+ public $NAME;
+ /**
+ @var
+ */
+ public $Name;
+ /**
+ @var
+ */
+ public $seotag;
+ /**
+ @var
+ */
+ public $linktocat = false;
+ /**
+ @var
+ */
+ public $link_to_customers = false;
+ /**
+ @var array option link to customers, list all file attached
+ */
+ public $opt_link_to_customers = array(
+ 'ac__DATATYPE_REPLACE_.php',
+ 'ac__DATATYPE_REPLACE_.txt',
+ 'osc__DATATYPE_REPLACE__to_customers.sql',
+ );
+
+ /**
+ @var array option link to header_tag, list all file attached
+ */
+ public $opt_header_tag = array(
+ 'header_tag.php',
+ 'header_tag.txt',
+ );
+
+ /**
+ @var object
+ */
+ public $config;
+
+ private function init(){
+
+ $current = dirname(__FILE__);
+
+
+ $this->name = $this->config->name;
+ $this->NAME = strtoupper( $this->config->name);
+ $this->Name = ucwords( $this->config->name);
+ $this->seotag = tep_db_prepare_input( $this->config->shorttag);
+ $this->linktocat = (isset($this->config->linktocats) && $this->config->linktocats) ? (bool)$this->config->linktocats : false;
+ $this->head_tag = (isset($this->config->head_tag) && $this->config->head_tag) ? (bool)$this->config->head_tag : false;
+ $this->link_to_customers = (isset($this->config->link_to_customers) && $this->config->link_to_customers) ? (bool)$this->config->link_to_customers : false;
+
+
+ // level of extension
+ $this->level = (!empty($this->config->level)? $this->config->level : 'stable' );
+
+ // dir placed modele files
+ $this->modele_path = $current .'/'. (!empty($this->config->dirmodel)? $this->config->dirmodel : 'Modele' ) .'/';
+
+ /*
+ Flag for replaced
+ */
+ $this->allsearch=array(
+ '_DATATYPE_REPLACE_SEOTAG_',
+ '_DATATYPE_REPLACE_MAJ_',
+ '_DATATYPE_REPLACE_UCWORDS_',
+ '_DATATYPE_REPLACE_'
+ );
+ /*
+ Flag for replacement
+ */
+ $this->allreplace=array(
+ $this->seotag,
+ $this->NAME,
+ $this->Name,
+ $this->name,
+ );
+
+ /*
+ Delete in code section balised by //REMOVEDEB_LINKTOCATEGORIE ... //REMOVEEND_LINKTOCATEGORIE
+ */
+ $this->sectionremove = array(
+ 'LINKTOCATEGORIE' => $this->linktocat,
+ 'HEADTAG' => $this->head_tag,
+ );
+
+ $this->finalname = strtoupper($this->name).'_'.$this->level;
+
+ $this->folder = $current .'/'. $this->finalname.'/';
+ }
+
+
+ /**
+ @brief
+ */
+ public function config($config){
+ $this->config = $config;
+ }
+
+
+ /**
+ @brief
+ */
+ public function check(){
+ $cfg = $this->config;
+
+
+ if( !isset($cfg) || !is_object($cfg) )
+ die('this model require args '."\n");
+
+ if( !isset($cfg->name)|| !isset($cfg->shorttag) /* || !isset($cfg->name) ||*/){
+ $ob ="\n\n this modele require : \n".
+ " * -name string name of new extends, use no special caracteres \n".
+ " * -shorttag string letters of new extends, use no special caracteres \n"
+ ;
+// $ob .=" * -v int 1-9 verbose \n";
+ $ob .=" optionnal : \n".
+
+ " * -level (stable/unstable/testing) default is stable \n".
+ " * --- Submodule section --- \n".
+ " * -head_tag true/false default is false for add submodule header_tags \n".
+ " * -link_to_customers true/false default is false for add submodule account for link by customers/members\n".
+ " * --- Linkto section --- \n".
+ " * -linktocat true/false default is false activate link to datatype categorie \n".
+
+// " * -dirmodel string default is Modele in dir of datatype\n"
+ "";
+ print $ob;
+ exit;
+ }
+
+ $this->init($cfg);
+
+
+ }
+
+ /**
+ @brief
+ */
+ public function preprocess(){
+ if(!file_exists($this->folder) || !is_dir($this->folder)) {
+ mkdir($this->folder);
+ }
+ }
+
+
+ /**
+ @brief Control for espace other option or modele complexe
+ @param $row
+ @param $current
+ @return boolean true:ok / false : not ok
+ */
+ function check_all_right($row, $current){
+
+ // module header_tags
+ if(! $this->head_tag && in_array($row, $this->opt_header_tag) )
+ return false;
+ elseif( ! $this->link_to_customers && in_array($row, $this->opt_link_to_customers) )
+ return false;
+
+
+ return true;
+ }
+
+ /**
+ @brief Control for espace other option or modele complexe
+ @param $row
+ @param $current
+ @return boolean true:ok / false : not ok
+ */
+ function specificprocess($row, $current){
+
+ // module header_tags
+// if(!$this->conf->head_tag && in_array($row, $this->opt_header_tag) /*$row == 'header_tags.php'*/)
+// return false;
+// elseif( !$this->conf->link_to_customers && in_array($row, $this->opt_link_to_customers) )
+// return false;
+//
+
+ return true;
+ }
+
+}
+
+?>
Deleted: trunk/dev/generator/datatype/index.php
===================================================================
--- trunk/dev/generator/datatype/index.php 2013-12-27 15:26:58 UTC (rev 4994)
+++ trunk/dev/generator/datatype/index.php 2013-12-27 15:29:13 UTC (rev 4995)
@@ -1,190 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2012 The osCSS developers - osCSS Open Source E-commerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 05/04/2012, 09:40
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
-*/
-global $current;
-
-
-
-if(isset($_GET['name']) && !empty($_GET['name'])){
-
-// print_r($_GET);
-// exit;
-
-class GenerCodeDataType
- extends GenerCode{
-
-
- /**
- @var array option link to customers, list all file attached
- */
- public $opt_link_to_customers = array(
- 'ac__DATATYPE_REPLACE_.php',
- 'ac__DATATYPE_REPLACE_.txt',
- 'osc__DATATYPE_REPLACE__to_customers.sql',
- );
-
- /**
- @var array option link to header_tag, list all file attached
- */
- public $opt_header_tag = array(
- 'header_tag.php',
- 'header_tag.txt',
- );
-
-
-
-
- function __construct($conf /*$curent, $name, $seotag, $head_tag=false*/){
-
-
- /*$curent = */ $conf->curent;
- $conf->name = tep_db_prepare_input($_GET['name']);
- $conf->NAME = strtoupper($conf->name);
- $conf->Name = ucwords($conf->name);
- $conf->seotag = tep_db_prepare_input($_GET['seotag']);
-
- $conf->head_tag = (isset($_GET['head_tag']) && $_GET['head_tag']=='active') ? true : false;
- $conf->link_to_customers = (isset($_GET['link_to_customers']) && $_GET['link_to_customers']=='active') ? true : false;
- $conf->level = 'stable';
-
- $this->modele_path = $conf->modele_path;
-
-
- $this->allsearch=array(
- '_DATATYPE_REPLACE_SEOTAG_',
- '_DATATYPE_REPLACE_MAJ_',
- '_DATATYPE_REPLACE_UCWORDS_',
- '_DATATYPE_REPLACE_'
- );
-
- $this->allreplace=array(
- $conf->seotag,
- $conf->NAME,
- $conf->Name,
- $conf->name
- );
-
- $this->conf = $conf;
-
- $this->folder = $conf->curent .''. strtoupper($conf->name).'_'.$conf->level.'/';
-
- if(!file_exists($this->folder) || !is_dir($this->folder)) {
- mkdir($this->folder);
- }
-
- $this->ProcessAndFinish();
-
-
- chmod($this->folder , 0777);
-
- echo 'le dossier creer ce situe : ' . $this->folder;
-
- }
-//
-
- /**
- @brief Control for espace other option or modele complexe
- @param $row
- @param $current
- @return boolean true:ok / false : not ok
- */
- function check_all_right($row, $current){
-
- // module header_tags
- if(!$this->conf->head_tag && in_array($row, $this->opt_header_tag) /*$row == 'header_tags.php'*/)
- return false;
- elseif( !$this->conf->link_to_customers && in_array($row, $this->opt_link_to_customers) )
- return false;
-
-
- return true;
- }
-
- /**
- @brief Control for espace other option or modele complexe
- @param $row
- @param $current
- @return boolean true:ok / false : not ok
- */
- function specificprocess($row, $current){
-
- // module header_tags
-// if(!$this->conf->head_tag && in_array($row, $this->opt_header_tag) /*$row == 'header_tags.php'*/)
-// return false;
-// elseif( !$this->conf->link_to_customers && in_array($row, $this->opt_link_to_customers) )
-// return false;
-//
-
- return true;
- }
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
- $conf = new stdClass();
- $conf->curent = $current . 'datatype/';
- $conf->name = tep_db_prepare_input($_GET['name']);
- $conf->seotag = tep_db_prepare_input($_GET['seotag']);
-// $conf->head_tag = false;
-// $conf->level = 'stable';
- $conf->modele_path = $conf->curent . 'Modele/';
-
- $object = new GenerCodeDataType($conf);
-
- exit;
-}
-
-?>
-
-
-<h2>Creation of a new datatype extension coupled with the categories</h2>
-
-<form>
-</p>
-<table>
- <tr>
- <td>Master name for datatype (this is string type for manipulate datatype)</td>
- <td><?php echo tep_draw_input_field('name', 'name') ?>(string) full name (no special caratere)</td>
- </tr>
-
- <tr>
- <td>quick tag for rewrite</label>
- <td><?php echo tep_draw_input_field('seotag', 'seotag') ?>(string) quik key </td>
- </tr>
- <tr>
- <td>Add header_tag module for SEO</label>
- <td><?php echo tep_draw_checkbox_field('head_tag', 'head_tag', 'active') ?></td>
- </tr>
- <tr>
- <td>Add link data for edit or propose by customers; add module and context </label>
- <td><?php echo tep_draw_checkbox_field('link_to_customers', 'link_to_customers', 'active') ?></td>
- </tr>
-<!-- <tr>
- <td>other rows in master table, respect classique sql commande ; just subline in create </label>
- <td><?php echo tep_draw_textarea_field('sql_adjust','', '50', '5', $text = '') ?></td>
- </tr>-->
-</table>
-
-
- <p>
- <input type="hidden" name="goto" value="datatype" />
- <input type="submit" value="Translate" />
- </p>
-</form>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:27:01
|
Revision: 4994
http://sourceforge.net/p/oscss/svn/4994
Author: oscim
Date: 2013-12-27 15:26:58 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
fix
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/drivers/sqlcip.php
trunk/catalog/admin/includes/exts/package/CIP.php
trunk/catalog/admin/includes/exts/package/packageInstaller.php
trunk/catalog/admin/includes/exts/package/packageRepository.php
trunk/catalog/admin/includes/exts/package/tags/add2end.php
trunk/catalog/admin/includes/gabarit/package/display_view.package.listing.gab
trunk/catalog/common/classes/datatype_drivers/Data_categorie.php
trunk/catalog/common/classes/datatype_drivers/Data_featured.php
trunk/catalog/common/classes/datatype_drivers/Data_product.php
Modified: trunk/catalog/admin/includes/classes/drivers/sqlcip.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlcip.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/admin/includes/classes/drivers/sqlcip.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -49,8 +49,8 @@
$sql_data_array['cip_folder_name'] = tep_db_prepare_input($option['folder_name']);
- $sql_data_array['cip_installed'] = tep_db_prepare_input($option['installed']);
- $sql_data_array['cip_version'] =(!isset($option['version'])? tep_db_prepare_input($option['version']): '0.0.1') ;
+ $sql_data_array['cip_installed'] = (int)(isset($option['installed'])? tep_db_prepare_input($option['installed']): 0) ;
+ $sql_data_array['cip_version'] =(isset($option['version'])? tep_db_prepare_input($option['version']): '0.0.1') ;
Modified: trunk/catalog/admin/includes/exts/package/CIP.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/CIP.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/admin/includes/exts/package/CIP.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -238,6 +238,7 @@
*/
function unpack_cip($ext='zip') {
global $messageStack;
+
switch ($ext) {
case 'zip':
$zipfile = new PclZip( $this->full_path_to_zip() );
@@ -325,7 +326,7 @@
@brief Write in db this contrib
*/
private function register() {
- $this->cip_id=sqlcip::create(array('folder_name'=>self::$cip_name , 'ident'=>$this->getIdent() ,'version'=>$this->getVersion() ));
+ $this->cip_id=sqlcip::create(array('folder_name'=>self::$cip_name , 'ident'=>$this->getIdent() /*,'version'=>$this->getVersion()*/ ));
$this->cip_installed=0;
self::InProcess(__("register add db table_cip "), __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'info');
@@ -368,7 +369,7 @@
*/
private function set_installed($status='1') {
if(is_object(self::$cInfo) && self::$cInfo->id > 0)
- sqlcip::update(array('id'=>self::$cInfo->id, 'installed'=>(int)$status ,'version'=>$this->getVersion() ));
+ sqlcip::update(array('id'=>self::$cInfo->id, 'installed'=>(int)$status/* ,'version'=>$this->getVersion()*/ ));
self::InProcess(__("Install update db table_cip "), __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'normal');
}
@@ -461,7 +462,7 @@
$clsname='Tc_'.strtolower($noeud->nodeName);
if (class_exists($clsname)){
- $this->contrib_data[]=new $clsname($this, $tagcnt[$noeud->nodeName], $noeud);
+ $this->contrib_data[$p]=new $clsname($this, $tagcnt[$noeud->nodeName], $noeud);
if(!$this->check_bylevel(1)){
self::InProcess(__("Erreur lecture XML tag ").$noeud->nodeName, __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'block');
}
@@ -471,7 +472,9 @@
return true;
}
- if(strtoupper($noeud->nodeName) == 'DESCRIPTION') $this->description_id=key($this->contrib_data);
+ if(strtoupper($noeud->nodeName) == 'DESCRIPTION') {
+ $this->description_id=$p;
+ }
}
//! debugg detail node
@@ -506,7 +509,7 @@
self::$was_unpacked=$this->read_xml();
//! Check min
- if (!$this->is_all_right()){
+ if (! $this->is_all_right()){
self::InProcess(__("not clean avant install process"), __CLASS__.'->'.__FUNCTION__.'::'.__LINE__,'block');
return false;
}
@@ -584,7 +587,7 @@
//! We passed by all checks. So if an error appears
foreach ($this->contrib_data as $id=>$tag)
if ( $tag->do_remove() ===false){
-// var_dump($tag->tag_name.'->do_remove()');
+
self::InProcess(__("Erreur durant traitement de cette fonction "),'tag_xml-['.$id.']'. $tag->tag_name.'->do_remove()','block');
break;
}
@@ -835,7 +838,9 @@
function get_os() {
if (substr(PHP_OS, 0, 3) == 'WIN') return 'win';
- elseif (strpos($_SERVER['SERVER_SOFTWARE'], 'Unix')) return 'unix';
+ elseif (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Unix')) return 'unix';
+
+ return 'unix';
}
/**
@@ -849,8 +854,11 @@
@return tag version
*/
function getVersion(){
- if(self::$version!=null) return self::$version;
+ if(self::$version !=null) return self::$version;
+ if(!isset($this->description_id) || $this->description_id <=0 )
+ return false;
+
if(isset($this->description_id) && isset( $this->contrib_data[$this->description_id]->data['version']))
return $this->contrib_data[$this->description_id]->data['version'];
Modified: trunk/catalog/admin/includes/exts/package/packageInstaller.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/packageInstaller.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/admin/includes/exts/package/packageInstaller.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -25,6 +25,8 @@
/**
@brief Recup du package distant
+ @param $pkgID int internal id
+ @return int OK > 0; KO < 0
*/
public function download_exts($pkgID){
global $messageStack;
@@ -35,25 +37,21 @@
if((string)$obj->item->sourceKey =='local'){
$cip= new CIP( (string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip');
- tep_redirect(tep_href_link(self::FILENAME, 'action=view&pkgID='.$pkgID ));
+ return 5;
}
else {
+ $dest=fopen(DIR_FS_CIP.(string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip',"wb");
- $dest=fopen(DIR_FS_CIP.(string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip',"wb");
-
-
if($this->fetchRemote((string)$obj->item->url_download,$dest)) {
- $messageStack->add_session(__('packageInstaller download file exts good'), 'success');
- fclose($dest);
-
+ @fclose($dest);
$cip= new CIP( (string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip');
- tep_redirect(tep_href_link(self::FILENAME, 'action=view&pkgID='.$pkgID));
+ return 1;
}
- else{
- $messageStack->add_session(__('packageInstaller error recup zip url'), 'error');
- tep_redirect(tep_href_link(self::FILENAME));
- }
+
+ return -2;
}
+
+ return -1;
}
@@ -82,14 +80,14 @@
if ($description) {
$array=$this->cip_description($description->data);
- if (ErrorAndBlockProcess::$error)
+ if (ErrorAndBlockProcess::$error)
parent::$Rightlist=array_merge(parent::$Rightlist,ErrorAndBlockProcess::$ArrayError);
}
else
$array[]= '<strong style="color:red;">'.CIP::CONFIG_FILENAME. __('text doesnt exists').'!!!</strong>';
- // test
+ // test
$cip= new CIP( (string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip');
$cip->install();
parent::$Rightlist=array_merge(parent::$Rightlist,(array)ErrorAndBlockProcess::$ArrayError);
@@ -130,21 +128,25 @@
/**
@fn install_exts($pkgID)
@brief execute installation process
- @param $pkgID
+ @param $pkgID
*/
public function install_exts($pkgID){
global $messageStack;
-
+
$array=array();
$block = false;
//! retro compatibilite
$message=$messageStack;
$obj=parent::load_db_values($pkgID);
+ if(!$obj)
+ return false;
+
$obj=$obj[0];
$cip= new CIP( (string)$obj->item->ident.'_'.(string)$obj->item->level.'.zip');
+
$cip->install(false);
// print_r(ErrorAndBlockProcess::$ArrayError);
@@ -165,7 +167,7 @@
$array[]=$tp;
// parent::$Rightlist
}
- else
+ else
$messageStack->add(__('msg was installed'), 'installed');
//! Error in process, block
Modified: trunk/catalog/admin/includes/exts/package/packageRepository.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/packageRepository.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/admin/includes/exts/package/packageRepository.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -24,7 +24,7 @@
/**
@brief Modele d'un depot
- @param $array all detail for inser in modele
+ @param $array all detail for inser in modele
@param [$active_service boolean ]
*/
private static function Modele($array, $active_service=false){
@@ -98,8 +98,8 @@
return true;
}
-
+
/**
@brief Suppression d'un depot
*/
@@ -158,7 +158,7 @@
try{
//! load xml file
- if(!$Parser =$Parser = @simplexml_load_file(DIR_FS_ROOT_DOCS.'admin/data/'.self::REPOSITORY_SOURCE))
+ if(!$Parser =$Parser = @simplexml_load_file(DIR_FS_ROOT_DOCS.'admin/data/'.self::REPOSITORY_SOURCE))
throw new Exception('file source repository no found');
$FeedItem = $Parser->xpath('channel');
@@ -219,7 +219,7 @@
global $messageStack;
try{
//! load xml file
- if(!$Parser = @simplexml_load_file(DIR_FS_ROOT_DOCS.'admin/data/'.self::REPOSITORY_SOURCE))
+ if(!$Parser = @simplexml_load_file(DIR_FS_ROOT_DOCS.'admin/data/'.self::REPOSITORY_SOURCE))
throw new Exception('file cache introuvable');
$FeedItem = $Parser->xpath('channel');
@@ -238,7 +238,7 @@
@brief Test connection and content
This function initialise connection in repository url, and ceck retrun content result or error
This service in depot is normalise
- @param $repo object
+ @param $repo object
repository -> url source depot
@param $action [value action string] name action
@return result or false
Modified: trunk/catalog/admin/includes/exts/package/tags/add2end.php
===================================================================
--- trunk/catalog/admin/includes/exts/package/tags/add2end.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/admin/includes/exts/package/tags/add2end.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -86,6 +86,8 @@
$find=$this->add_str($this->data['add']);
$new_file=$this->linebreak_fixing(file_get_contents($this->fs_filename()));
+ if(empty($find))
+ return true;
$count=substr_count($new_file, $find);
Modified: trunk/catalog/admin/includes/gabarit/package/display_view.package.listing.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/package/display_view.package.listing.gab 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/admin/includes/gabarit/package/display_view.package.listing.gab 2013-12-27 15:26:58 UTC (rev 4994)
@@ -26,6 +26,7 @@
<thead>
<tr>
<th> </th>
+ <th> </th>
<th><?php echo __('table heading nom') ?></th>
<th><?php echo __('table heading description') ?></th>
<th><?php echo __('table heading level') ?></th>
@@ -37,6 +38,7 @@
<tfoot>
<tr>
<td style="width:2%;"> </td>
+ <td style="width:2%;"> </td>
<td style="width:12%;"><?php echo tep_draw_input_field('title','title',__('table heading nom'),'style="width:100%" class="search_init"'); ?></td>
<td style="width:60%;"><?php echo tep_draw_input_field('description','description',__('table heading description'),'style="width:100%" class="search_init"'); ?></td>
<td style="width:5%;"><?php echo tep_draw_input_field('level','level',__('table heading level'),'style="width:100%" class="search_init"'); ?></td>
Modified: trunk/catalog/common/classes/datatype_drivers/Data_categorie.php
===================================================================
--- trunk/catalog/common/classes/datatype_drivers/Data_categorie.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/common/classes/datatype_drivers/Data_categorie.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -92,7 +92,7 @@
" LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " ".$this->p."d ON( ".$this->p."d.categories_id = ".$this->p.".categories_id AND ".$this->p."d.language_id = '" . (int)$languages_id . "' ) ".
"";
// permanente contrainte
- $this->listing_sql['where'] = " WHERE ".DataForceStatus(" ".$this->p.".categories_status='1' ")." ";
+ $this->listing_sql['where'] = " WHERE 1 ".DataForceStatus("AND ".$this->p.".categories_status='1' ")." ";
// sort in sitemap
$this->listing_sql['sort'] = " ".$this->p.".parent_id ";
// l id
Modified: trunk/catalog/common/classes/datatype_drivers/Data_featured.php
===================================================================
--- trunk/catalog/common/classes/datatype_drivers/Data_featured.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/common/classes/datatype_drivers/Data_featured.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -17,30 +17,30 @@
public $DataType = 'featured';
/**
- @var DataType array reg for seo class
+ @var DataType array reg for seo class
*/
public $reg_anchors = array(
- 'featureds_id' => 'f'
+ 'featureds_id' => 'f'
);
/**
@var DataType array reg check for control get params , please respect order $reg_anchors
*/
public $reg_check = array(
- '([0-9]*)' // unique page
+ '([0-9]*)' // unique page
);
/**
- @var DataType files for folder /content
+ @var DataType files for folder /content
*/
public $reg_filenames = array(
- 'FILENAME_FEATURED' => FILENAME_DEFAULT // unique page
+ 'FILENAME_FEATURED' => FILENAME_DEFAULT // unique page
);
/**
@var DataType Tables define
*/
public $db_tables = array(
- 'TABLE_FEATURED' => 'featured', //
- 'TABLE_FEATURED_DESCRIPTION' => 'featured_description', //
- 'TABLE_FEATURED_DATA' => 'featured_data' //
+ 'TABLE_FEATURED' => 'featured', //
+ 'TABLE_FEATURED_DESCRIPTION' => 'featured_description', //
+ 'TABLE_FEATURED_DATA' => 'featured_data' //
);
/**
@@ -55,7 +55,7 @@
*/
public $RootListing = array();
/**
- @var prefix alias a utilise systematiquement dans les requete sql
+ @var prefix alias a utilise systematiquement dans les requete sql
*/
public $p = 'f';
@@ -63,14 +63,14 @@
/**
@brief constructor
- @param next bool true for complete load , but use 2 call
+ @param next bool true for complete load , but use 2 call
*/
function __construct($next=false){
$this->RootListing = array_map('trim',explode(',',DATATYPES_ROOTLISTING_FEATURED));
}
/**
- @brief sql for sitemap index
+ @brief sql for sitemap index
@param $mode le type de control (public)
@return true
*/
@@ -81,12 +81,12 @@
" LEFT JOIN " . TABLE_FEATURED_DATA . " ".$this->p."d ON( ".$this->p."d.featured_id = ".$this->p.".row_id ) ".
"";
// permanente contrainte
- $this->listing_sql['where'] = " WHERE 1 ";
+ $this->listing_sql['where'] = " WHERE 1 ".DataForceStatus(" AND ".$this->p.".featured_status='1' ")." ";
// sort in sitemap
$this->listing_sql['sort'] = " ".$this->p.".row_id ";
- // l id
+ // l id
$this->listing_sql['id'] = " ".$this->p.".row_id ";
- // colone utilsie pour le ratio
+ // colone utilsie pour le ratio
$this->listing_sql['ratio'] = " ".$this->p.".date_update ";
// list normalise date
$this->listing_sql['dates'] = " ".$this->p.".date_added as added, ".$this->p.".date_update as modified ";
@@ -138,10 +138,10 @@
}
/**
- @brief Prepare an retrun result Seo request
- @param $mode string anchor key used
+ @brief Prepare an retrun result Seo request
+ @param $mode string anchor key used
@param $subtype Not used
- @param $id integer current id
+ @param $id integer current id
@param $language_id integer current language id
@return array (
ID => '',
@@ -169,7 +169,7 @@
/**
@brief chargement des données transversal
- @param $type string name childs type for listing
+ @param $type string name childs type for listing
@param subtype object childs DataType
*/
function FO_load_listing($type,$subtype){
Modified: trunk/catalog/common/classes/datatype_drivers/Data_product.php
===================================================================
--- trunk/catalog/common/classes/datatype_drivers/Data_product.php 2013-12-27 15:16:27 UTC (rev 4993)
+++ trunk/catalog/common/classes/datatype_drivers/Data_product.php 2013-12-27 15:26:58 UTC (rev 4994)
@@ -91,7 +91,7 @@
" LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " ".$this->p."d ON( ".$this->p."d.products_id = ".$this->p.".products_id AND ".$this->p."d.language_id = '" . (int)$languages_id . "' ) ".
"";
// permanente contrainte
- $this->listing_sql['where'] = " WHERE ".$this->p.".products_status = '1' ";
+ $this->listing_sql['where'] = " WHERE 1 ".DataForceStatus(" AND ".$this->p.".products_status='1' ")." ";
// defaut sort listing
$this->listing_sql['sort'] = " ".$this->p."d.products_name ";
// sort in sitemap
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:16:32
|
Revision: 4993
http://sourceforge.net/p/oscss/svn/4993
Author: oscim
Date: 2013-12-27 15:16:27 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
Removed Paths:
-------------
trunk/dev/generator/index.php
Deleted: trunk/dev/generator/index.php
===================================================================
--- trunk/dev/generator/index.php 2013-12-27 15:15:47 UTC (rev 4992)
+++ trunk/dev/generator/index.php 2013-12-27 15:16:27 UTC (rev 4993)
@@ -1,57 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2012 The osCSS developers - osCSS Open Source E-commerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 05/04/2012, 09:40
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
-*/
-
-// base dir catalog
-$current = dirname(__FILE__);
-if (!empty($current) && substr($current, -1, 1) != '/') $current .= '/';
-
- $base_path=substr( $current, 0, -strlen('dev/GenerCode/') ).'catalog/';
-
-// add path in incldue_path
-set_include_path($base_path. PATH_SEPARATOR .$base_path.'includes/classes/'. PATH_SEPARATOR . get_include_path() );
-//update base script
-chdir($base_path);
-
-// init file core oscss
-if(!@include('includes/appli_top_Test.php')) die ('no found appli_top_Test.php');
-
-
-error_reporting(E_ALL);
-
-
-include('class.GenerCode.php');
-
-
-
-
-if(isset($_REQUEST['goto']) && !empty($_REQUEST['goto'])) {
- require($current . tep_db_prepare_input($_REQUEST['goto']) . '/' .'index.php' );
- exit;
-}
-
-
-$arrReturn = array();
-// Scan directory
-foreach (scandir($current) as $strFile) {
- if ( in_array($strFile , array( '.' , '..' , '.svn') ) || !is_dir($current . $strFile) ) continue;
- $arrReturn[] = $strFile;
-}
-
-// print_r($arrReturn);
-?>
-
-
-<h2>List all extends </h2>
-<ul>
- <?php foreach($arrReturn as $row): ?>
- <li><a href="?goto=<?php echo $row ?>"><?php echo $row ?></a></li>
- <?php endforeach; ?>
-</ul>
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:15:50
|
Revision: 4992
http://sourceforge.net/p/oscss/svn/4992
Author: oscim
Date: 2013-12-27 15:15:47 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
Added Paths:
-----------
trunk/dev/generator/
trunk/dev/generator/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php
trunk/dev/generator/datatype/Modele/catalog/includes/modules/pages/
Added: trunk/dev/generator/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php
===================================================================
--- trunk/dev/generator/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php (rev 0)
+++ trunk/dev/generator/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php 2013-12-27 15:15:47 UTC (rev 4992)
@@ -0,0 +1,629 @@
+<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
+/**
+ @licence GPL 2005-_CURRENTYEAR_ The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version _CURRENTVERSION_
+ @date _CURRENTDATE_
+ @author genrated by GenerCode
+ @encode UTF-8
+ @class sql_DATATYPE_REPLACE_extrafields
+ @file sql_DATATYPE_REPLACE_extrafields.php
+
+*/
+
+class sql_DATATYPE_REPLACE_extrafields
+ implements ModSqlDataDriver{
+
+ public static $modules;
+
+ protected static $_instance;
+
+ protected function __construct(){
+ }
+
+
+ public static function getInstance() {
+ if(self::$_instance == null) self::$_instance = new self();
+ return self::$_instance;
+ }
+
+
+ /**
+ @brief create new ligne in table configuration
+ */
+ public static function create($option){
+ self::getInstance();
+
+
+ $sql_data_array['epf_order'] =(isset($option['order']))? tep_db_prepare_input($option['order']) : 0 ;
+ $sql_data_array['epf_status'] =(isset($option['status']))? tep_db_prepare_input($option['status']) : 0;
+ $sql_data_array['epf_input_type'] =(isset($option['input_type'])) ? tep_db_prepare_input($option['input_type']) : 0;
+ $sql_data_array['epf_advanced_search'] =(isset($option['advanced_search']))? tep_db_prepare_input($option['advanced_search']): 0;
+ $sql_data_array['epf_show_in_listing'] = (isset($option['show_in_listing'])) ? tep_db_prepare_input($option['show_in_listing']): 0;
+ $sql_data_array['epf_use_as_meta_keyword'] =(isset($option['use_as_meta_keyword']))? tep_db_prepare_input($option['use_as_meta_keyword']): 0;
+ $sql_data_array['epf_use_to_restrict_listings'] = (isset($option['use_to_restrict_listings'])) ? tep_db_prepare_input($option['use_to_restrict_listings']): 0;
+ $sql_data_array['epf_admin'] =(isset($option['admin']))? tep_db_prepare_input($option['admin']) : 0;
+
+ if(isset($option['size'])) $sql_data_array['epf_size'] = tep_db_prepare_input($option['size']);
+ if(isset($option['show_parent_chain'])) $sql_data_array['epf_show_parent_chain'] = tep_db_prepare_input($option['show_parent_chain']);
+ if(isset($option['key'])) $sql_data_array['epf_key'] = tep_db_prepare_input($option['key']);
+ if(isset($option['special_mod'])) $sql_data_array['epf_special_mod'] = tep_db_prepare_input($option['special_mod']);
+ if(isset($option['active_value_language'])) $sql_data_array['epf_active_value_language'] = tep_db_prepare_input($option['active_value_language']);
+
+
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS, $sql_data_array);
+
+ if(!$res)
+ return $res;
+ else
+ return $res->__get('insertId');
+ }
+
+ /**
+ @brief update ligne in table configuration
+ @note for update key, use new_key in key array $option
+ this key is use in where clause
+ */
+ public static function update($option){
+ self::getInstance();
+
+ if(!isset($option['id']))
+ return false;
+
+ $where ='';
+ if(isset($option['id'])) $where .="AND epf_id = '".(int)$option['id']."' ";
+ if(isset($option['key'])) $where .="AND epf_key = '".(int)$option['key']."' ";
+
+ if($where=='')
+ return false;
+
+ if(isset($option['order']))$sql_data_array['epf_order'] = tep_db_prepare_input($option['order']);
+ if(isset($option['status'])) $sql_data_array['epf_status'] = tep_db_prepare_input($option['status']);
+// if(isset($option['uses_value_list'])) $sql_data_array['epf_input_type'] = tep_db_prepare_input($option['uses_value_list']);
+ if(isset($option['advanced_search'])) $sql_data_array['epf_advanced_search'] = tep_db_prepare_input($option['advanced_search']);
+ if(isset($option['show_in_listing']))$sql_data_array['epf_show_in_listing'] = tep_db_prepare_input($option['show_in_listing']);
+ if(isset($option['size'])) $sql_data_array['epf_size'] = tep_db_prepare_input($option['size']);
+ if(isset($option['use_as_meta_keyword'])) $sql_data_array['epf_use_as_meta_keyword'] = tep_db_prepare_input($option['use_as_meta_keyword']);
+ if(isset($option['use_to_restrict_listings'])) $sql_data_array['epf_use_to_restrict_listings'] = tep_db_prepare_input($option['use_to_restrict_listings']);
+ if(isset($option['show_parent_chain'])) $sql_data_array['epf_show_parent_chain'] = tep_db_prepare_input($option['show_parent_chain']);
+ if(isset($option['new_key'])) $sql_data_array['epf_key'] = tep_db_prepare_input($option['new_key']);
+ if(isset($option['admin'])) $sql_data_array['epf_admin'] = (string)tep_db_prepare_input($option['admin']);
+ if(isset($option['special_mod'])) $sql_data_array['epf_special_mod'] = tep_db_prepare_input($option['special_mod']);
+ if(isset($option['active_value_language'])) $sql_data_array['epf_active_value_language'] = tep_db_prepare_input($option['active_value_language']);
+// print_r($option);
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS, $sql_data_array, 'update' , substr($where,3) );
+
+ return $res;
+ }
+
+ /**
+ @brief load ligne in table configuration
+ @param option array
+ id => row id int (configuration_id)
+ key => string key (configuration_key)
+ group_id => group_id int (configuration_group_id)
+ @param $shortkey use cleankey for return short key
+ @return
+
+ object(stdClass)[13]
+ public 'id' => string '1' (length=1)
+
+ OR
+ array(
+ object(stdClass)[13]
+ ...
+ object(stdClass)[13]
+ ..
+ )
+
+ */
+ public static function fetch($option,$shortkey=false){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+ if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
+ if(isset($option['key'])) $sql .="AND epf_key = '".(int)$option['key']."' ";
+
+
+ if($sql=='')
+ return false;
+
+
+ $sql="SELECT * FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " a ".
+// " LEFT JOIN " . TABLE_IMAGES_USED . " g ON (a.rowid=g.rowid) ".
+ " WHERE ".substr($sql,3);
+
+// echo $sql;
+ $res=$DB->query($sql);
+
+ $num = $res->__get('numRows');
+
+ if($num == 1){
+ $result=$res->fetchAssoc();
+ return ((!$shortkey)? $result : self::CleanKey($result));
+ }
+ elseif($num > 1){
+ $array=array();
+
+ foreach($res->fetchAllAssoc() as $result)
+ $array[]= ((!$shortkey)? $result : self::CleanKey($result));
+
+ return $array;
+ }
+
+ return false;
+ }
+
+ /**
+ @brief delete row
+ */
+ public static function delete($option){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+
+ if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
+ if(isset($option['key'])) $sql .="AND epf_key = '".(int)$option['key']."' ";
+
+
+ if(strlen($sql) < 5)
+ return false;
+
+ $res = $DB->query($s="SELECT epf_id FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS ." WHERE ". substr($sql,3) );
+
+ $row=$res->fetchAssoc();
+
+ // depend tables
+ sql_DATATYPE_REPLACE_extrafieldslabels::delete(array('id'=>$row['epf_id']));
+
+ sql_DATATYPE_REPLACE_extrafieldsvalues::delete(array('id'=>$row['epf_id']));
+
+
+ $DB->query($s="DELETE FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS ." WHERE ". substr($sql,3) );
+
+ return true;
+ }
+
+ /**
+ @brief
+ @return array product empty
+ */
+ public static function Specimen($shortkey=false){
+ $par = array(
+ 'epf_id' => 0,
+ 'epf_order' => 5,
+ 'epf_status' => 0,
+ 'epf_input_type' => 0,
+ 'epf_advanced_search' => '',
+ 'epf_show_in_listing' => '',
+ 'epf_size' => 0,
+ 'epf_use_as_meta_keyword' => '',
+ 'epf_use_to_restrict_listings' => '',
+ 'epf_show_parent_chain' => '',
+ 'epf_active_value_language' => 0,
+ 'epf_key' => '',
+ 'epf_admin' => 0,
+ 'epf_special_mod' => '',
+ );
+
+ return ((!$shortkey)? $par : self::CleanKey($par));
+ }
+
+
+
+ /**
+ @fn CleanKey()
+ @brief Clean string name key
+ */
+ private static function CleanKey($array){
+ self::getInstance();
+ $object= new stdclass();
+
+ foreach($array as $key=>$value){
+ if( strpos($key,'epf_') ===0)
+ $key=substr($key,4);
+
+ $object->$key = $value;
+ }
+
+ return $object;
+ }
+
+}
+
+
+class sql_DATATYPE_REPLACE_extrafieldslabels
+ implements ModSqlDataDriver{
+
+ public static $modules;
+
+ protected static $_instance;
+ /**
+ @var format for display line input
+ */
+ protected static $format = '%label% %input% %unit%';
+
+ protected function __construct(){
+ }
+
+
+ public static function getInstance() {
+ if(self::$_instance == null) self::$_instance = new self();
+ return self::$_instance;
+ }
+
+
+ /**
+ @brief create new ligne in table configuration
+ */
+ public static function create($option){
+ self::getInstance();
+
+ if(!isset($option['id']))
+ return 'id';
+
+ $sql_data_array['epf_id'] = tep_db_prepare_input($option['id']);
+ $sql_data_array['languages_id'] =(isset($option['languages_id']))? tep_db_prepare_input($option['languages_id']) : 0;
+// $sql_data_array['epf_active_for_language'] =(isset($option['active_for_language']))? tep_db_prepare_input($option['active_for_language']): 0;
+
+ $sql_data_array['epf_label'] =(isset($option['label'])) ? tep_db_prepare_input($option['label']) : '';
+ $sql_data_array['epf_format'] =(isset($option['format']) && !empty($option['format']) )? tep_db_prepare_input($option['format']): self::$format ;
+
+
+ if(isset($option['label_help'])) $sql_data_array['epf_label_help'] = tep_db_prepare_input($option['label_help']);
+
+
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS, $sql_data_array);
+
+ if(!$res)
+ return $res;
+ else
+ return $res->__get('insertId');
+ }
+
+ /**
+ @brief update ligne in table configuration
+ */
+ public static function update($option){
+ self::getInstance();
+
+ if(!isset($option['id']))
+ return false;
+
+ $where ='';
+ if(isset($option['id'])) $where .="AND epf_id = '".(int)$option['id']."' ";
+ if(isset($option['languages_id'])) $where .="AND languages_id = '".(int)$option['languages_id']."' ";
+
+ if($where=='')
+ return false;
+
+// if(isset($option['active_for_language'])) $sql_data_array['epf_active_for_language'] = tep_db_prepare_input($option['active_for_language']);
+ if(isset($option['label'])) $sql_data_array['epf_label'] = tep_db_prepare_input($option['label']);
+ if(isset($option['label_help'])) $sql_data_array['epf_label_help'] = tep_db_prepare_input($option['label_help']);
+
+ $sql_data_array['epf_format'] =(isset($option['format']) && !empty($option['format']) )? tep_db_prepare_input($option['format']): self::$format ;
+
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS, $sql_data_array, 'update' , substr($where,3) );
+
+ return $res;
+ }
+
+ /**
+ @brief load ligne in table configuration
+ @param option array
+ id => row id int (configuration_id)
+ key => string key (configuration_key)
+ group_id => group_id int (configuration_group_id)
+ @param $shortkey use cleankey for return short key
+ @return
+
+ object(stdClass)[13]
+ public 'id' => string '1' (length=1)
+
+ OR
+ array(
+ object(stdClass)[13]
+ ...
+ object(stdClass)[13]
+ ..
+ )
+
+ */
+ public static function fetch($option,$shortkey=false){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+ if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
+ if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
+
+
+ if($sql=='')
+ return false;
+
+
+ $sql="SELECT * FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS . " a ".
+// " LEFT JOIN " . TABLE_IMAGES_USED . " g ON (a.rowid=g.rowid) ".
+ " WHERE ".substr($sql,3);
+
+ $res=$DB->query($sql);
+
+ $num = $res->__get('numRows');
+
+ if($num == 1){
+ $result=$res->fetchAssoc();
+ return ((!$shortkey)? $result : self::CleanKey($result));
+ }
+ elseif($num > 1){
+ $array=array();
+
+ foreach($res->fetchAllAssoc() as $result)
+ $array[]= ((!$shortkey)? $result : self::CleanKey($result));
+
+ return $array;
+ }
+
+ return false;
+ }
+
+ /**
+ @brief delete row
+ */
+ public static function delete($option){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+
+ if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
+ if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
+
+
+ if(strlen($sql) < 5)
+ return false;
+
+ $DB->query($s="DELETE FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS ." WHERE ". substr($sql,3) );
+
+ return true;
+ }
+
+ /**
+ @brief
+ @return array product empty
+ */
+ public static function Specimen($shortkey=false){
+ $par = array(
+ 'epf_id' => 0,
+ 'languages_id' => 0,
+ 'epf_label' => '',
+// 'epf_active_for_language' => false,
+ 'epf_label_help' => '',
+ 'epf_format' => '%label% %input% %unit%',
+ );
+
+ return ((!$shortkey)? $par : self::CleanKey($par));
+ }
+
+
+
+ /**
+ @fn CleanKey()
+ @brief Clean string name key
+ */
+ private static function CleanKey($array){
+ self::getInstance();
+ $object= new stdclass();
+
+ foreach($array as $key=>$value){
+ if( strpos($key,'epf_') ===0)
+ $key=substr($key,4);
+
+ $object->$key = $value;
+ }
+
+ return $object;
+ }
+
+}
+
+
+
+
+class sql_DATATYPE_REPLACE_extrafieldsvalues
+ implements ModSqlDataDriver{
+
+ public static $modules;
+
+ protected static $_instance;
+
+ protected function __construct(){
+ }
+
+
+ public static function getInstance() {
+ if(self::$_instance == null) self::$_instance = new self();
+ return self::$_instance;
+ }
+
+
+ /**
+ @brief create new ligne in table configuration
+ */
+ public static function create($option){
+ self::getInstance();
+
+ if(!isset($option['epf_id']))
+ return 'epf_id';
+
+ $DB=Database::getInstance();
+ $sql="SELECT COUNT(*) as id FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES . " a ". " GROUP BY epf_id ";
+ $query = $DB->query($sql);
+ $res = $query->fetchAssoc();
+
+ $sql_data_array['value_id'] = tep_db_prepare_input($res['id']);
+
+ $sql_data_array['epf_id'] = tep_db_prepare_input($option['id']);
+ $sql_data_array['languages_id'] =(isset($option['languages_id']))? tep_db_prepare_input($option['languages_id']) : 0;
+
+
+ $sql_data_array['epf_value'] =(isset($option['value'])) ? tep_db_prepare_input($option['value']) : '';
+ $sql_data_array['parent_id'] =(isset($option['parent_id']))? tep_db_prepare_input($option['parent_id']): 0;
+ $sql_data_array['sort_order'] =(isset($option['sort_order'])) ? tep_db_prepare_input($option['sort_order']) :0;
+
+
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES, $sql_data_array);
+
+ if(!$res)
+ return $res;
+ else
+ return $sql_data_array['value_id'];
+ }
+
+ /**
+ @brief update ligne in table configuration
+ */
+ public static function update($option){
+ self::getInstance();
+
+ if(!isset($option['epf_id']))
+ return false;
+
+ $sql ='';
+ if(isset($option['id'])) $sql .="AND value_id = '".(int)$option['id']."' ";
+ if(isset($option['epf_id'])) $sql .="AND epf_id = '".(int)$option['epf_id']."' ";
+ if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
+ if(isset($option['parent_id'])) $sql .="AND parent_id = '".(int)$option['parent_id']."' ";
+
+ if($sql=='')
+ return false;
+
+
+ if(isset($option['value'])) $sql_data_array['epf_value'] = tep_db_prepare_input($option['value']);
+ if(isset($option['sort_order'])) $sql_data_array['sort_order'] = tep_db_prepare_input($option['sort_order']);
+
+
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES, $sql_data_array, 'update' , substr($sql,3) );
+
+ return $res;
+ }
+
+ /**
+ @brief load ligne in table configuration
+ @param option array
+ id => row id int (configuration_id)
+ key => string key (configuration_key)
+ group_id => group_id int (configuration_group_id)
+ @param $shortkey use cleankey for return short key
+ @return
+
+ object(stdClass)[13]
+ public 'id' => string '1' (length=1)
+
+ OR
+ array(
+ object(stdClass)[13]
+ ...
+ object(stdClass)[13]
+ ..
+ )
+
+ */
+ public static function fetch($option,$shortkey=false){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+ if(isset($option['id'])) $sql .="AND value_id = '".(int)$option['id']."' ";
+ if(isset($option['epf_id'])) $sql .="AND epf_id = '".(int)$option['epf_id']."' ";
+ if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
+ if(isset($option['parent_id'])) $sql .="AND parent_id = '".(int)$option['parent_id']."' ";
+
+
+ if($sql=='')
+ return false;
+
+
+ $sql="SELECT * FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES . " a ".
+ " WHERE ".substr($sql,3)." ORDER BY sort_order ASC";
+
+ $res=$DB->query($sql);
+
+ $num = $res->__get('numRows');
+
+ if($num == 1){
+ $result=$res->fetchAssoc();
+ return ((!$shortkey)? $result : self::CleanKey($result));
+ }
+ elseif($num > 1){
+ $array=array();
+
+ foreach($res->fetchAllAssoc() as $result)
+ $array[]= ((!$shortkey)? $result : self::CleanKey($result));
+
+ return $array;
+ }
+
+ return false;
+ }
+
+ /**
+ @brief delete row
+ */
+ public static function delete($option){
+ self::getInstance();
+ $DB=Database::getInstance();
+
+ $sql ="";
+
+ if(isset($option['id'])) $sql .="AND value_id = '".(int)$option['id']."' ";
+ if(isset($option['epf_id'])) $sql .="AND epf_id = '".(int)$option['epf_id']."' ";
+ if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
+ if(isset($option['parent_id'])) $sql .="AND parent_id = '".(int)$option['parent_id']."' ";
+
+ if(strlen($sql) < 5)
+ return false;
+
+ $DB->query($s="DELETE FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES ." WHERE ". substr($sql,3) );
+
+ return true;
+ }
+
+ /**
+ @brief
+ @return array product empty
+ */
+ public static function Specimen($shortkey=false){
+ $par = array(
+ 'value_id' => 0 ,
+ 'epf_id' => 0,
+ 'languages_id' => 0,
+ 'parent_id' => 0,
+ 'sort_order' => 0,
+ 'epf_value' => '',
+ );
+
+ return ((!$shortkey)? $par : self::CleanKey($par));
+ }
+
+
+
+ /**
+ @fn CleanKey()
+ @brief Clean string name key
+ */
+ private static function CleanKey($array){
+ self::getInstance();
+ $object= new stdclass();
+
+ foreach($array as $key=>$value){
+ $object->$key = $value;
+ }
+
+ return $object;
+ }
+
+}
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 15:14:40
|
Revision: 4991
http://sourceforge.net/p/oscss/svn/4991
Author: oscim
Date: 2013-12-27 15:14:36 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
upgrade code for usage cli
Modified Paths:
--------------
trunk/dev/GenerCode/class.GenerCode.php
Added Paths:
-----------
trunk/dev/GenerCode/generator.php
trunk/dev/_top.php
trunk/dev/cli.php
Removed Paths:
-------------
trunk/dev/GenerCode/index.php
Modified: trunk/dev/GenerCode/class.GenerCode.php
===================================================================
--- trunk/dev/GenerCode/class.GenerCode.php 2013-12-27 07:05:58 UTC (rev 4990)
+++ trunk/dev/GenerCode/class.GenerCode.php 2013-12-27 15:14:36 UTC (rev 4991)
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
@licence GPL 2005-2012 The osCSS developers - osCSS Open Source E-commerce
@package osCSS-2 <www http://www.oscss.org>
@@ -17,9 +17,13 @@
const CURRENT_VERSION = '2.1.1';
protected $head_tag = false;
+ /**
+ @var array key=>true/false for delete section code in all files in process copy
+ */
+ public $sectionremove = array();
-
-
+ /**
+ */
function ProcessAndFinish(){
$this->allsearch[]= '_CURRENTYEAR_';
@@ -41,7 +45,7 @@
/**
- @brief Process replace and constrcut new folder
+ @brief Process replace and constrcut new folder
@param $current
*/
function process($current=''){
@@ -51,16 +55,18 @@
$path_mod = $this->modele_path . $current;
foreach($this->browse($path_mod) as $row){
- // escape if not ok
+ // escape if not ok
if( ! $this->check_all_right( $row, $current) ){
-// var_dump($row);
continue;
}
if(is_dir($path_mod.$row)) {
- mkdir( $this->stringreplace($this->folder . $current. $row) );
+ $fl = $this->stringreplace($this->folder . $current. $row) ;
+ if(!file_exists($fl))
+ mkdir( $fl );
+
chmod( $this->stringreplace($this->folder . $current. $row), 0777);
$this->process($current.$row);
@@ -69,9 +75,18 @@
else {
$res=file_get_contents($path_mod.$row);
- $file_contents = $this->stringreplace($res);
+ if( preg_match('#REMOVEDEB_'.'#', $res) && preg_match('#REMOVEEND_'.'#', $res))
+ $file_contents = $this->SectionRemove($res, $this->sectionremove );
+ else
+ $file_contents = $res;
- $fp = fopen( $this->stringreplace($this->folder . $current. $row) , 'w');
+ $file_contents = $this->stringreplace($file_contents);
+
+ $f= $this->folder . $current. $row;
+ if(file_exists($f))
+ unlink($f);
+
+ $fp = fopen( $this->stringreplace($f) , 'w');
fputs($fp, $file_contents);
fclose($fp);
@@ -87,20 +102,50 @@
@return boolean true:ok / false : not ok
*/
function check_all_right($row, $current){
-// var_dump($row,$current);
return true;
}
function stringreplace($string){
-// var_dump($string);
return str_replace(
$this->allsearch ,
$this->allreplace,
$string);
}
+ /**
+ @brief remove partial section DEBconfigtags ..... ENDconfigtags
+ @param array array (
+ tags =>true/false
+ )
+ */
+ protected function SectionRemove($text,$array =array()){
+ if(count($array)>0)
+ foreach($array as $k=>$v){
+ $is = 0;
+ if(!$v )
+
+ while( (preg_match('#REMOVEDEB_'.$k.'#', $text) && preg_match('#REMOVEEND_'.$k.'#', $text) ) ){
+ $is++;
+
+ if($is>50){
+ echo 'loop..';
+ break;
+ }
+
+ $prev = substr($text,0, strpos($text,'REMOVEDEB_'.$k)-2) ;
+ $prev .= substr($text, strpos($text,'REMOVEEND_'.$k) + strlen('REMOVEEND_'.$k) ) ;
+ $text = $prev;
+
+ echo '.';
+ }
+ }
+
+ return $text;
+ }
+
+
function browse($strFolder){
// Add trailing slash
if (substr($strFolder, -1, 1) != '/') $strFolder .= '/';
Added: trunk/dev/GenerCode/generator.php
===================================================================
--- trunk/dev/GenerCode/generator.php (rev 0)
+++ trunk/dev/GenerCode/generator.php 2013-12-27 15:14:36 UTC (rev 4991)
@@ -0,0 +1,137 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.2
+ @date 28/12/2013, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/generator/generator.php
+ @brief command line write new extension based on you'r name
+
+ @remarks To run this script as CLI: php clip.php filename
+*/
+
+if(! isset($secukey) )
+ die('please use ../cli.php '."\n");
+
+ require_once('class.GenerCode.php');
+
+ class cligenerator
+ extends cli{
+
+ /**
+ @brief init methode for extract specific params
+ @param $argv array()
+ */
+ public function init($argv){
+ $path_init = dirname(__FILE__);
+
+ if(count($argv) <=2 || $argv[2] =='-h'){
+ $ob =" Sample init for control params scripts \n".
+ "You'r use args for correct process\n".
+ "* type of modele used\n";
+
+ foreach(scan($path_init) as $row)
+ if( is_dir($path_init.'/'.$row) )
+ $ob .=' -'.$row."\n";
+
+ $ob .=" * -v int 1-9 verbose \n";
+
+ print $ob;
+ exit;
+ }
+
+ $this->config->v = 0;
+ $this->config->d = 0;
+ $this->config->path = $path_init;
+ $this->config->model = false;
+
+ // Extract item config
+ $key = null;
+ for($i =2 , $n = (count($argv)); $i<$n ; $i++){
+ $test = $argv[$i];
+ if( $i === 2 && !preg_match('#-#', $test) )
+ $this->config->model = $test;
+ elseif( $key===null && preg_match('#^-[a-z]#', $test) )
+ $key = substr($test,1);
+ elseif( $key !=null ){
+ $this->config->$key = $test;
+ $key = null;
+ }
+ }
+ }
+
+ /**
+ @brief control params
+ */
+ public function check(){
+ if( $this->config->model != false && !is_dir($this->config->path .'/'.$this->config->model ) )
+ die('this model not exits '."\n");
+
+ require_once($this->config->path .'/'.$this->config->model.'/'.$this->config->model.'.php');
+
+
+ $class = 'generateur'.$this->config->model;
+ $this->obj = new $class();
+
+ $this->obj->config($this->config);
+
+ $this->obj->check();
+ }
+
+ /**
+ @brief adjust config and local vars
+ */
+ public function preprocess(){
+// require_once($this->path_base.'includes/modules/pages/package.php');
+// echo $this->config->path .'/'.'class.GenerCode.php';
+ require_once($this->config->path .'/'.'class.GenerCode.php');
+
+ $this->obj->preprocess();
+ }
+
+ /**
+ @brief exec
+ */
+ public function process(){
+ echo 'process'."\n";
+
+ switch( strtolower($this->config->model) ){
+// case 'dicos':
+//
+// break;
+
+ default:
+ $this->obj->ProcessAndFinish();
+
+ echo "\n".'le dossier creer ce situe :' . $this->obj->folder . "\n";
+
+
+ echo "\n\nYou'r move in contribution dir ??' Type 'yes' to continue: ";
+ $handle = fopen ("php://stdin","r");
+ $line = fgets($handle);
+ if(trim($line) != 'yes'){
+ echo "ABORTING!\n";
+ exit;
+ }
+ echo "\n";
+ echo "Thank you, continuing ?!!\n";
+
+ rename( $this->obj->folder , DIR_FS_CIP. $this->obj->finalname );
+ }
+ }
+
+ /**
+ @brief display error if mode verbose > 0
+ */
+ function displayerror(){
+ if($this->config->v > 0){
+ echo 'verbose....';
+ }
+ }
+ }
+
+
+
+?>
\ No newline at end of file
Deleted: trunk/dev/GenerCode/index.php
===================================================================
--- trunk/dev/GenerCode/index.php 2013-12-27 07:05:58 UTC (rev 4990)
+++ trunk/dev/GenerCode/index.php 2013-12-27 15:14:36 UTC (rev 4991)
@@ -1,57 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2012 The osCSS developers - osCSS Open Source E-commerce
- @package osCSS-2 <www http://www.oscss.org>
- @version 2.1.1
- @date 05/04/2012, 09:40
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
-*/
-
-// base dir catalog
-$current = dirname(__FILE__);
-if (!empty($current) && substr($current, -1, 1) != '/') $current .= '/';
-
- $base_path=substr( $current, 0, -strlen('dev/GenerCode/') ).'catalog/';
-
-// add path in incldue_path
-set_include_path($base_path. PATH_SEPARATOR .$base_path.'includes/classes/'. PATH_SEPARATOR . get_include_path() );
-//update base script
-chdir($base_path);
-
-// init file core oscss
-if(!@include('includes/appli_top_Test.php')) die ('no found appli_top_Test.php');
-
-
-error_reporting(E_ALL);
-
-
-include('class.GenerCode.php');
-
-
-
-
-if(isset($_REQUEST['goto']) && !empty($_REQUEST['goto'])) {
- require($current . tep_db_prepare_input($_REQUEST['goto']) . '/' .'index.php' );
- exit;
-}
-
-
-$arrReturn = array();
-// Scan directory
-foreach (scandir($current) as $strFile) {
- if ( in_array($strFile , array( '.' , '..' , '.svn') ) || !is_dir($current . $strFile) ) continue;
- $arrReturn[] = $strFile;
-}
-
-// print_r($arrReturn);
-?>
-
-
-<h2>List all extends </h2>
-<ul>
- <?php foreach($arrReturn as $row): ?>
- <li><a href="?goto=<?php echo $row ?>"><?php echo $row ?></a></li>
- <?php endforeach; ?>
-</ul>
-
Added: trunk/dev/_top.php
===================================================================
--- trunk/dev/_top.php (rev 0)
+++ trunk/dev/_top.php 2013-12-27 15:14:36 UTC (rev 4991)
@@ -0,0 +1,56 @@
+<?php
+/**
+ * \brief base include generic for unit test
+ * \file
+ */
+// block if multi load
+static $i;
+if($i>0)
+ return ;
+
+$i++;
+global $path_base;
+error_reporting(E_ALL);
+// current path
+$path_init = dirname(__FILE__);
+
+// relative path for normal process in oscss core
+$path_base=substr( $path_init, 0, -strlen('dev/') ) . '/catalog/admin/';
+
+// // add path in incldue_path
+set_include_path(
+ $path_init . PATH_SEPARATOR .
+ $path_base. PATH_SEPARATOR .
+ $path_base.'admin/includes/classes/'. PATH_SEPARATOR .
+ get_include_path()
+ );
+
+// //update base script
+chdir($path_base);
+
+// base
+$_SERVER['SERVER_NAME']='localhost';
+$_SERVER['HTTP_HOST'] = 'localhost.tld';
+$_SERVER['REQUEST_URI'] = '';
+$_SERVER['SERVER_ADDR']= '1';
+$_SERVER['SERVER_PORT']='80';
+$_SERVER['REMOTE_ADDR']='1';
+
+// block if not cli mode
+if ( substr( php_sapi_name() , 0, 3) != 'cli')
+ die('Use cli for execute this script'."\n");
+
+// init file core oscss
+if(!@include_once($path_base.'includes/appli_top_Test.php'))
+ die ('no found appli_top_Test.php '."\n");
+
+
+$secukey = '3297LSPHEDM61389SMOVNV842C35S5';
+
+
+
+
+
+
+
+?>
\ No newline at end of file
Added: trunk/dev/cli.php
===================================================================
--- trunk/dev/cli.php (rev 0)
+++ trunk/dev/cli.php 2013-12-27 15:14:36 UTC (rev 4991)
@@ -0,0 +1,106 @@
+<?php
+/**
+ @licence GPL 2005-2011 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.1
+ @date 22/08/11, 20:42
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file dev/installer/setup.php
+ @brief command line for installer extends specific to oscss
+ this installer use class abd file content in backoffice oscss
+
+ @remarks To run this script as CLI: phpunit filename.php
+*/
+// specific for test
+require('_top.php');
+
+
+
+// Main
+$version='$Revision: 1.0 $';
+@set_time_limit(0);
+$error=0;
+$cmd = false;
+
+
+if(count($argv) <=1 || $argv[1] =='-h'){
+ print "\n\n This script use core oscss for execute action by script \n".
+ "this list is all actions available: \n";
+
+ foreach(scan($path_init) as $row){
+ if( is_dir($path_init.'/'.$row) && file_exists($path_init.'/'.$row.'/'.$row.'.php') )
+ print " * ".$row."\n";
+ }
+
+ print "\n\n Use : \n".
+ "php ".$argv[0]." nameofaction [params specific action]\n".
+ print "\n\n";
+
+ exit;
+}
+
+
+class cli{
+ /**
+ @var object all params config passed on args in script
+ */
+ public $config;
+ /**
+ @var string commande name
+ */
+ public $cmd;
+ /**
+ @var string path file
+ */
+ public $path_init;
+ /**
+ @var string path file
+ */
+ public $path_base;
+
+
+ function __construct($path_base, $path_init){
+ $this->config = new stdClass;
+ $this->cmd = false;
+ $this->path_base = $path_base;
+ $this->path_init = $path_init;
+ }
+
+ public function SetCmd($cmd){
+ $config->cmd = $cmd;
+ }
+}
+
+
+
+if( isset($argv[1]) && strlen($argv[1])>3 && is_string($argv[1]))
+ $cmd = $argv[1];
+
+if( ! $cmd )
+ die('please use php cli.php -h '."\n");
+
+
+ echo '.';
+ include($path_init.'/'.$cmd.'/'.$cmd.'.php');
+ echo '.';
+ $class = 'cli'.$cmd;
+
+ $obj = new $class($path_base, $path_init);
+ echo '.';
+ $obj->SetCmd($cmd);
+ echo '.';
+ $obj->init($argv);
+ echo '.';
+ $obj->check();
+ echo '.';
+ $obj->preprocess();
+ echo '.';
+ $obj->process();
+ echo '.';
+ $obj->displayerror();
+ echo '.';
+
+echo "\n";
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-27 07:06:01
|
Revision: 4990
http://sourceforge.net/p/oscss/svn/4990
Author: oscim
Date: 2013-12-27 07:05:58 +0000 (Fri, 27 Dec 2013)
Log Message:
-----------
fix
Modified Paths:
--------------
trunk/test/phpunit/Back/_top.php
Modified: trunk/test/phpunit/Back/_top.php
===================================================================
--- trunk/test/phpunit/Back/_top.php 2013-12-26 11:07:02 UTC (rev 4989)
+++ trunk/test/phpunit/Back/_top.php 2013-12-27 07:05:58 UTC (rev 4990)
@@ -19,7 +19,7 @@
require_once 'PHPUnit/Autoload.php';
// // add path in incldue_path
-set_include_path(dirname(__FILE__) . PATH_SEPARATOR . $base_path. PATH_SEPARATOR .$base_path.'admin501/includes/classes/'. PATH_SEPARATOR . get_include_path() );
+set_include_path(dirname(__FILE__) . PATH_SEPARATOR . $base_path. PATH_SEPARATOR .$base_path.'admin/includes/classes/'. PATH_SEPARATOR . get_include_path() );
// //update base script
chdir($base_path);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-26 11:07:04
|
Revision: 4989
http://sourceforge.net/p/oscss/svn/4989
Author: oscim
Date: 2013-12-26 11:07:02 +0000 (Thu, 26 Dec 2013)
Log Message:
-----------
fix install
Modified Paths:
--------------
trunk/catalog/install/includes/content/core.base.php
Modified: trunk/catalog/install/includes/content/core.base.php
===================================================================
--- trunk/catalog/install/includes/content/core.base.php 2013-12-26 10:49:17 UTC (rev 4988)
+++ trunk/catalog/install/includes/content/core.base.php 2013-12-26 11:07:02 UTC (rev 4989)
@@ -42,9 +42,9 @@
'root_doc_a_logs'=>'Documents/admin/logs/',
'root_doc_a_sessions'=>'Documents/admin/sessions/',
'root_doc_a_tmp'=>'Documents/admin/tmp/',
- 'root_doc_a_image'=>'admin/images/',
- 'root_doc_a_graph'=>'admin/images/graphs/',
- 'root_doc_a_image'=>'admin/images/imagecache/',
+ 'root_doc_a_image'=>'Documents/admin/images/',
+ 'root_doc_a_graph'=>'Documents/admin/images/graphs/',
+ 'root_doc_a_image'=>'Documents/admin/images/imagecache/',
'root_doc_p_p'=>'Documents/public/',
'root_doc_p_log'=>'Documents/public/logs/',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-26 10:49:20
|
Revision: 4988
http://sourceforge.net/p/oscss/svn/4988
Author: oscim
Date: 2013-12-26 10:49:17 +0000 (Thu, 26 Dec 2013)
Log Message:
-----------
Clean code and fix
Modified Paths:
--------------
trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_.php
trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php
trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php
trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php
trunk/dev/GenerCode/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php
Added Paths:
-----------
trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/languages/fr_FR/_DATATYPE_REPLACE_.txt
Modified: trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_.php 2013-12-26 10:47:55 UTC (rev 4987)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_.php 2013-12-26 10:49:17 UTC (rev 4988)
@@ -10,7 +10,7 @@
@class sql_DATATYPE_REPLACE_
*/
-
+error_reporting(E_ALL);
class sql_DATATYPE_REPLACE_
implements ModSqlDataDriver{
@@ -29,54 +29,119 @@
}
- /**
+ /**
@brief create new ligne in table configuration
@param $option array
language_id = > int $languages_id
*/
public static function create($option){
+ global $languages_id;
self::getInstance();
$DB=Database::getInstance();
+ $error=0;
+ $specimen = self::Specimen();
+
+
+ // if(!isset($option['key'])) return 'key';
+
+ $DB->beginTransaction();
+
+
+ if( ! isset($option['sqlarray']) )
+ return false;
+ else
+ $dataarray = (array)$option['sqlarray'];
+
+
$list_languages=tep_get_languages();
// Put post value
if(isset($option['post'])){
$post=$option['post'];
- self::$modules->load_post_values($post);
+// self::$modules->load_post_values($post);
}
- $sql_data_array = $option['sqlarray'];
+ $sql_data_array = array(); // insert in db master table
+ $datalg = array(); // for language table
+ // call specimen and report value for defined key
+ foreach($specimen as $key=>$item) {
+ // obtain string value contain in specimen
+ if(!is_array($item)){
+ if(isset($dataarray[$key]))
+ $sql_data_array[$key] = (!empty($dataarray[$key])) ? tep_db_prepare_input((string)$dataarray[$key]) : $item ;
+ else{
+ if(isset($post[$key]))
+ $sql_data_array[$key] = (!empty($post[$key])) ? tep_db_prepare_input((string)$post[$key]) : $item ;
+ }
+ }
+ else{
+ foreach($item as $k=>$row){
+ // obtain string value contain in specimen
+ if(isset($dataarray[$key][$k]))
+ $datalg[$k][$key] = (!empty($dataarray[$key][$k])) ? tep_db_prepare_input((string)$dataarray[$key][(int)$k]) : '' ;
+ else{
+ if(isset($post[$key][$key]))
+ $datalg[$k][$key] = (!empty($post[$key][$k])) ? tep_db_prepare_input((string)$post[$key][$k]) : '' ;
+ }
+ }
+ }
+ }
- $insert_sql_data = array('date_added' => 'now()');
- $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
+ $DB->beginTransaction();
- $resobj=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ_, $sql_data_array);
- $_DATATYPE_REPLACE__id =$resobj->__get('insertId');
+// $sql_data_array = array_merge($sql_data_array, self::$modules->get_insert_table_products());
+ // master table
+ if(count($sql_data_array) > 0 ){
+ $sql_data_array['date_added'] = 'now()';
+ $sql_data_array['user_added'] = (int)@$_SESSION['login_id'];
- for ($i=0, $n=sizeof($list_languages); $i<$n; $i++) {
- $language_id = $list_languages[$i]['id'];
+ $resobj=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ_, $sql_data_array);
- $sql_data_array = array(
- '_DATATYPE_REPLACE__chapo' => '',
- '_DATATYPE_REPLACE__description' => '',
- '_DATATYPE_REPLACE__title' => '',
- '_DATATYPE_REPLACE__id' => $_DATATYPE_REPLACE__id,
- 'language_id' => $language_id
- );
- tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION, $sql_data_array);
+ if(!$resobj)
+ $error++;
- }
+ $_DATATYPE_REPLACE__id = $resobj->__get('insertId');
+ }
+ else
+ $error++;
- self::$modules->create($_DATATYPE_REPLACE__id);
+ // language table
+ if( $error <= 0)
+ if(count($datalg) > 0)
+ foreach($datalg as $key=>$sql_data_array){
+ $sql_data_array['_DATATYPE_REPLACE__id'] = $_DATATYPE_REPLACE__id;
+ $sql_data_array['language_id'] = $key;
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION, $sql_data_array);
+ if(!$res)
+ $error++;
+ }
+ else
+ $error++;
- return $_DATATYPE_REPLACE__id;
+ // linkto table
+ if( $error <= 0)
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false') {
+ $res = $DB->query("insert into " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " (_DATATYPE_REPLACE__id, categories_id) values ('" . (int)$_DATATYPE_REPLACE__id . "', '".ORPHELIN_COLLECTOR."')");
+ if(!$res)
+ $error++;
+ }
+
+
+ if( $error > 0){
+ $DB->rollbackTransaction();
+ return false;
+ }
+ else{
+ $DB->commitTransaction();
+ return $_DATATYPE_REPLACE__id;
+ }
}
/**
@@ -87,70 +152,92 @@
self::getInstance();
$DB=Database::getInstance();
-// if( !isset($option['id'])) return 'id';
-
$list_languages=tep_get_languages();
$where ='';
-// $languages_id = $option['language_id'];
+ $error = 0 ;
+ $specimen = self::Specimen();
if(isset($option['id'])){
$_DATATYPE_REPLACE__id = (int)$option['id'];
$post['_DATATYPE_REPLACE__id'] = $_DATATYPE_REPLACE__id;
}
-// if(isset($option['action'])) $action=$option['action'];
-
-// if(!self::fetch($option))
-// $action = 'insert';
-// else
-// $action = 'update';
-
// Put post value
if(isset($option['post'])){
$post=$option['post'];
- self::$modules->load_post_values($post);
+// self::$modules->load_post_values($post);
}
- $sql_data_array = $option['sqlarray'];
+ $dataarray =(isset($option['sqlarray'])? $option['sqlarray'] : array() );
+ $sql_data_array = array(); // insert in db master table
+ $datalg = array(); // for language table
+ // call specimen and report value for defined key
+ foreach($specimen as $key=>$item) {
+ // obtain string value contain in specimen
+ if(!is_array($item)){
+ if(isset($dataarray[$key]))
+ $sql_data_array[$key] = (!empty($dataarray[$key])) ? tep_db_prepare_input((string)$dataarray[$key]) : $item ;
+ else{
+ if(isset($post[$key]))
+ $sql_data_array[$key] = (!empty($post[$key])) ? tep_db_prepare_input((string)$post[$key]) : $item ;
+ }
+ }
+ else{
+ foreach($item as $k=>$row){
+ // obtain string value contain in specimen
+ if(isset($dataarray[$key][$k]))
+ $datalg[$k][$key] = (!empty($dataarray[$key][$k])) ? tep_db_prepare_input((string)$dataarray[$key][(int)$k]) : '' ;
+ else{
+ if(isset($post[$key][$key]))
+ $datalg[$k][$key] = (!empty($post[$key][$k])) ? tep_db_prepare_input((string)$post[$key][$k]) : '' ;
+ }
+ }
+ }
+ }
+ $DB->beginTransaction();
- $update_sql_data = array('last_modified' => 'now()');
- $sql_data_array = array_merge($sql_data_array, $update_sql_data);
- self::$modules->load_post_values($post);
+ // master table
+ if(count($sql_data_array) > 0){
- $sql_data_array = array_merge($sql_data_array, self::$modules->get_update_table__DATATYPE_REPLACE_());
+// $sql_data_array = array_merge((array)$sql_data_array, (array)self::$modules->get_update_table__DATATYPE_REPLACE_());
+ $sql_data_array['last_modified'] = 'now()';
+ $sql_data_array['user_modified'] = (int)@$_SESSION['login_id'];
+ if( ! tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ_, $sql_data_array, 'update', "_DATATYPE_REPLACE__id = '" . (int)$_DATATYPE_REPLACE__id . "'") )
+ $error++;
+ }
- tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ_, $sql_data_array, 'update', "_DATATYPE_REPLACE__id = '" . (int)$_DATATYPE_REPLACE__id . "'");
+ // language table
+ if( $error <= 0)
+ if(count($datalg) > 0)
+ foreach($datalg as $key=>$sql_data_array){
+ $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION, $sql_data_array, 'update', "_DATATYPE_REPLACE__id = '" . (int)$_DATATYPE_REPLACE__id . "' and language_id = '" . (int)$key . "'");
+ if(!$res)
+ $error++;
+ }
- /// Clean link posts to categorie and save new link
- if(isset($option['cPath']) && count($post['categories']) == 0)
- $post['categories'][] = $option['cPath'];
+ // linkto table
+ if( $error <= 0)
+ if(isset($post['linkto'])){
+ $r = MLinkTo::SqlLeftTo('content', $content_id, $post['linkto']) ;
+ if($r == false)
+ $error++;
+ }
- sqlcategorie::DataInCat('_DATATYPE_REPLACE_', $_DATATYPE_REPLACE__id, $post['categories']);
+ if( $error > 0){
+ $DB->rollbackTransaction();
+ return false;
+ }
+ else{
+ $DB->commitTransaction();
+ return 1;
+ }
- for ($i=0, $n=sizeof($list_languages); $i<$n; $i++) {
-
- $language_id = $list_languages[$i]['id'];
-
- $sql_data_array = array(
- '_DATATYPE_REPLACE__chapo' => tep_db_prepare_input($post['_DATATYPE_REPLACE__chapo'][$language_id]) ,
- '_DATATYPE_REPLACE__description' => tep_db_prepare_input($post['_DATATYPE_REPLACE__description'][$language_id]) ,
- '_DATATYPE_REPLACE__title' => tep_db_prepare_input($post['_DATATYPE_REPLACE__title'][$language_id]) );
-
-
- $sql_data_array = array_merge($sql_data_array, self::$modules->get_update_table__DATATYPE_REPLACE__description ($language_id));
-
- tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION, $sql_data_array, 'update', "_DATATYPE_REPLACE__id = '" . (int)$_DATATYPE_REPLACE__id . "' and language_id = '" . (int)$language_id . "'");
- }
-
- self::$modules->after_update ($_DATATYPE_REPLACE__id);
-
- return $_DATATYPE_REPLACE__id;
}
@@ -185,31 +272,40 @@
$cat_list =array();
$list_languages=tep_get_languages();
- $sql ="";
+ $where ="";
if(isset($option['id']) && $option['id'] > 0){
$ID = (int) $option['id'];
- $sql .="AND c._DATATYPE_REPLACE__id = '".(int)tep_db_input($option['id'])."' ";
+ $where .="AND c._DATATYPE_REPLACE__id = '".(int)tep_db_input($option['id'])."' ";
}
// if(isset($option['language_id'])){
// $languages_id = (int)$option['language_id'];
// $sql .="AND pd.language_id = '".(int)tep_db_input($option['language_id'])."' ";
// }
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false')
+ if(isset($option['catid'])){
+ $languages_id = (int)$option['catid'];
+ $where .="AND c2c.categories_id = '".(int)tep_db_input($option['catid'])."' ";
+ }
- if(isset($option['catid'])){
- $languages_id = (int)$option['catid'];
- $sql .="AND c2c.categories_id = '".(int)tep_db_input($option['catid'])."' ";
- }
+ $where =substr($where,3);
- $sql =substr($sql,3);
-
- if(strlen($sql)<4)
+ if(strlen($where)<4)
return false;
- $res = $DB->query($sql="select c._DATATYPE_REPLACE__id, date_added, last_modified, _DATATYPE_REPLACE__status from " . TABLE__DATATYPE_REPLACE_MAJ_ . " c LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " c2c on(c._DATATYPE_REPLACE__id=c2c._DATATYPE_REPLACE__id) WHERE ".$sql. " GROUP BY c._DATATYPE_REPLACE__id ");
+ $sql="SELECT c.* ";
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false')
+ $sql .=", c2c.categories_id ";
-// var_dump($sql);
+ $sql.="FROM " . TABLE__DATATYPE_REPLACE_MAJ_ . " c ";
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false')
+ $sql .=" LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " c2c on(c._DATATYPE_REPLACE__id=c2c._DATATYPE_REPLACE__id) ";
+
+ $sql.=" WHERE ".$where. " GROUP BY c._DATATYPE_REPLACE__id ";
+
+ $res = $DB->query($sql);
+
$num = $res->__get('numRows');
if($num == 1)
@@ -227,36 +323,37 @@
// call all langue for this post
for ($i=0, $n=sizeof($list_languages); $i<$n; $i++) {
$language_id = $list_languages[$i]['id'];
- $_DATATYPE_REPLACE__query = $DB->query("select cd._DATATYPE_REPLACE__chapo,cd._DATATYPE_REPLACE__description, cd._DATATYPE_REPLACE__title from " . TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION . " cd where cd._DATATYPE_REPLACE__id = '" . (int)$row['_DATATYPE_REPLACE__id'] . "' AND language_id='" . $language_id . "'");
- $_DATATYPE_REPLACE_ = tep_db_fetch_array($_DATATYPE_REPLACE__query);
+ $_DATATYPE_REPLACE__query = $DB->query("select cd.* from " . TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION . " cd where cd._DATATYPE_REPLACE__id = '" . (int)$row['_DATATYPE_REPLACE__id'] . "' AND language_id='" . $language_id . "'");
+ $_q_result = tep_db_fetch_array($_DATATYPE_REPLACE__query);
- $row['chapo'][$language_id] = $_DATATYPE_REPLACE_['_DATATYPE_REPLACE__chapo'];
- $row['description'][$language_id] = $_DATATYPE_REPLACE_['_DATATYPE_REPLACE__description'];
- $row['title'][$language_id] = $_DATATYPE_REPLACE_['_DATATYPE_REPLACE__title'];
+ foreach($_q_result as $k=>$r)
+ if(!in_array($k, array('_DATATYPE_REPLACE__id', 'language_id')))
+ $row[$k][$language_id] =$r;
+
tep_db_free_result($_DATATYPE_REPLACE__query);
}
- $cat_query = $DB->query("select categories_id from " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " where _DATATYPE_REPLACE__id='" . (int)$row['_DATATYPE_REPLACE__id'] . "' ");
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false') {
+ $cat_query = $DB->query("select categories_id from " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " where _DATATYPE_REPLACE__id='" . (int)$row['_DATATYPE_REPLACE__id'] . "' ");
- while($cat_l = tep_db_fetch_array($cat_query)){ $cat_list[$cat_l['categories_id']]=$cat_l; }
- $row['categories']=$cat_list;
+ while($cat_l = tep_db_fetch_array($cat_query)){ $cat_list[$cat_l['categories_id']]=$cat_l; }
+ $row['categories']=$cat_list;
-
tep_db_free_result($cat_query);
+ }
- self::$modules->load_db_values((int)$row['_DATATYPE_REPLACE__id']);
+// self::$modules->load_db_values((int)$row['_DATATYPE_REPLACE__id']);
+
+
$result[] = $row;
}
-
-// return ((!$shortkey)? $cInfo_array : self::CleanKey($cInfo_array)) ;
-
if($num == 1){
return ((!$shortkey)? $result[0] : self::CleanKey($result[0])) ;
}
@@ -264,7 +361,7 @@
$array=array();
foreach($result as $lg)
- $array[]= ((!$shortkey)? $lg : self::CleanKey($lg));
+ $array[]= ((!$shortkey)? $lg : self::CleanKey($lg));
return $array;
}
@@ -327,25 +424,46 @@
@brief
@return array product empty
*/
- public static function Specimen(){
+ public static function Specimen($shortkey=false){
$list_languages=tep_get_languages();
$par = array(
- '_DATATYPE_REPLACE__id' => '',
- 'date_added' => '',
+ '_DATATYPE_REPLACE__id' => 0,
+ '_DATATYPE_REPLACE__type' => 1,
+
+ '_DATATYPE_REPLACE__status' => 0,
+ '_DATATYPE_REPLACE__hidden' => 0,
+
+ 'sort_order' => '',
+
+ 'date_added' => '',
+ 'user_added' => '',
'last_modified' => '',
- '_DATATYPE_REPLACE__status' => '',
- 'categories' => array(),
+ 'user_modified' => '',
+
+ /* language init */
+ '_DATATYPE_REPLACE__title'=>array(),
+ '_DATATYPE_REPLACE__description'=>array(),
+ /* language */
+
+
+ 'mod'=>array(), // other external sub module
);
+ /* Complete for all languages */
for ($i=0, $n=sizeof($list_languages); $i<$n; $i++) {
- $par['title'][$list_languages[$i]['id']] = '';
- $par['chapo'][$list_languages[$i]['id']] = '';
- $par['description'][$list_languages[$i]['id']] = '';
+ $par['_DATATYPE_REPLACE__title'][$list_languages[$i]['id']] = '';
+ $par['_DATATYPE_REPLACE__description'][$list_languages[$i]['id']] = '';
}
- return self::CleanKey($par);
+ /* link to */
+ if(DataTypes::is_active('categorie') )
+ $par['categories'] = array();
+
+
+
+ return ((!$shortkey)? $par : self::CleanKey($par));
}
@@ -436,25 +554,55 @@
}
+ /**
+ @fn ExtractForm($data)
+ @brief extract data forms for put in db
+ @param $data array
+ @return array
+ */
+ public static function ExtractForm($data){
+ $specimen = self::Specimen();
+ $sqlarray = array();
+ foreach($specimen as $key=>$item){
+ if($key != 'DATATYPE_REPLACE__id')
+ if(is_int($item) || is_bool($modele[$key]))
+ $sqlarray[$key] = (isset($data[$key]) ? tep_db_prepare_input((int)$data[$key]) : $item);
+ elseif(is_string($item))
+ $sqlarray[$key] = (isset($data[$key]) ? tep_db_prepare_input((string)$data[$key]) : $item);
+ elseif(is_array($item)){
+ foreach($item as $k=>$row)
+ if(is_int($row[$k]) || is_bool($modele[$key]))
+ $sqlarray[$key][$k] = (isset($data[$key][$k]) ? tep_db_prepare_input((int)$data[$key][$k]) : $row[$k]);
+ elseif(is_string($row[$k]))
+ $sqlarray[$key][$k] = (isset($data[$key][$k]) ? tep_db_prepare_input((string)$data[$key][$k]) : $row[$k]);
+ }
+ }
+
+ return $sqlarray;
+ }
+
+
/**
@fn CleanKey()
@brief Clean string name key
*/
- private static function CleanKey($array){
+ public static function CleanKey($array){
$object= new stdclass();
foreach($array as $key=>$value){
- if( strpos($key,'_DATATYPE_REPLACE__') ===0)
- $key=substr($key,strlen('_DATATYPE_REPLACE__'));
+ if( strpos($key,'_DATATYPE_REPLACE__') ===0)
+ $key=substr($key,strlen('_DATATYPE_REPLACE__'));
- $object->$key = $value;
+
+ $object->$key = $value;
}
return $object;
}
+
}
Added: trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/languages/fr_FR/_DATATYPE_REPLACE_.txt
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/languages/fr_FR/_DATATYPE_REPLACE_.txt (rev 0)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/languages/fr_FR/_DATATYPE_REPLACE_.txt 2013-12-26 10:49:17 UTC (rev 4988)
@@ -0,0 +1,99 @@
+<?php
+/**
+ @licence GPL 2005-_CURRENTYEAR_ The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version _CURRENTVERSION_
+ @date _CURRENTDATE_
+ @author genrated by GenerCode
+ @encode UTF-8
+*/
+$lang['heading title']="Gestion du datatype _DATATYPE_REPLACE_" ;
+
+
+
+/* definition */
+ $lang['@_DATATYPE_REPLACE_s table heading id']="Id" ;
+
+ $lang['@_DATATYPE_REPLACE_s table heading type']="Type" ;
+ $lang['@_DATATYPE_REPLACE_s table heading type name']="Type" ;
+
+ $lang['@_DATATYPE_REPLACE_s table heading status']="Etat" ;
+ $lang['@_DATATYPE_REPLACE_s table heading sort order']="Tri/Position" ;
+
+ $lang['@_DATATYPE_REPLACE_s table heading title']="Titre" ;
+ $lang['@_DATATYPE_REPLACE_s table heading description']="Description" ;
+
+ $lang['@_DATATYPE_REPLACE_s table heading date added']="Crée(s)" ;
+ $lang['@_DATATYPE_REPLACE_s table heading date modified']="Modifié" ;
+ $lang['@_DATATYPE_REPLACE_s table heading user added']="Créés par" ;
+ $lang['@_DATATYPE_REPLACE_s table heading user modified']="Modifié par" ;
+
+
+ /* List item in multiple choice */
+ $lang['@_DATATYPE_REPLACE_s text status off']="Actif" ;
+ $lang['@_DATATYPE_REPLACE_s text status on']="Inactif" ;
+
+
+/* Page */
+ /* listing */
+ /* heading */
+ $lang['heading title _DATATYPE_REPLACE_s']="Gestion du datatype _DATATYPE_REPLACE_" ;
+
+ /* button */
+ $lang['@_DATATYPE_REPLACE_s image add']="Créer" ;
+
+ /* Filter */
+ $lang['@_DATATYPE_REPLACE_s filter menu']="Specifique" ;
+
+ /* */
+ $lang['table heading listings']="Clef" ;
+ $lang['table heading categories']="Catégorie" ;
+ $lang['@_DATATYPE_REPLACE_s table heading action']="Action" ;
+
+
+ /* Edit */
+ /* heading */
+ $lang['@_DATATYPE_REPLACE_s heading title edit']="Édition de _DATATYPE_REPLACE_" ;
+
+ /* tabs */
+ $lang['@_DATATYPE_REPLACE_s tab data']="Caractéristiques" ;
+
+
+ /* Delete */
+ /* heading */
+ $lang['@_DATATYPE_REPLACE_s heading title delete']="Suppression du _DATATYPE_REPLACE_" ;
+
+ /* CopyTo */
+ /* heading */
+ $lang['@_DATATYPE_REPLACE_s heading title delete']="Suppression du _DATATYPE_REPLACE_" ;
+
+
+
+/* other */
+
+
+// $lang['@_DATATYPE_REPLACE_s table heading title ']="Clef : " ;
+// $lang['entry _DATATYPE_REPLACE_ help']="La clef permet l'appel de cette page, elle ce doit d'être unique. Pour appeler plusieurs page, il est possible d'utiliser une racine de clef commune " ;
+// $lang['text info delete _DATATYPE_REPLACE_ intro']="Êtes-vous sûr de vouloir supprimer ces données ?" ;
+// $lang['text info date added']="Date d'ajout :" ;
+// $lang['text info last modified']="Dernière modification :" ;
+// $lang['text info image nonexistent']="L'IMAGE N'EXISTE PAS" ;
+// $lang['text info _DATATYPE_REPLACE_ size']="Taille :" ;
+// $lang['text info heading delete _DATATYPE_REPLACE_']="Supprimer ces données" ;
+// $lang['table heading status']="État" ;
+// $lang['entry title']="Titre " ;
+// $lang['text _DATATYPE_REPLACE_ status']="Statut :" ;
+// $lang['table heading view status']="Menu" ;
+// $lang['text _DATATYPE_REPLACE_ enabled']="Actif" ;
+// $lang['text _DATATYPE_REPLACE_ disabled']="Inactif" ;
+// $lang['txt info permalink']="Lien vers cette page: " ;
+// $lang['txt cat all']="Toutes" ;
+// $lang['heading title goto']="Lister les datatype de la catégorie" ;
+// $lang['heading title search']="Chercher" ;
+// $lang['txt categories']="Catégories" ;
+// $lang['tab _DATATYPE_REPLACE_ data']="Données" ;
+
+
+
+?>
\ No newline at end of file
Modified: trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php 2013-12-26 10:47:55 UTC (rev 4987)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/_DATATYPE_REPLACE_/_DATATYPE_REPLACE_SEOTAG__description.php 2013-12-26 10:49:17 UTC (rev 4988)
@@ -83,7 +83,7 @@
@brief Edition produit
*/
function insert_table__DATATYPE_REPLACE__description ($language_id) {
- $myarray=array(
+ $myarray=array(
'_DATATYPE_REPLACE__description' => self::$pArray['_DATATYPE_REPLACE__description'][$language_id],
'_DATATYPE_REPLACE__chapo' => self::$pArray['_DATATYPE_REPLACE__chapo'][$language_id],
// '_DATATYPE_REPLACE__url' => self::$pArray['_DATATYPE_REPLACE__url'][$language_id]
@@ -145,9 +145,9 @@
/** Fonction complementaire utilisé dans la page produits */
- /**
- @remarks implements InterfaceModule depend
- if module twin in backoffice, report all content install in the other module
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
public function check() {return true;}
public function install() {return true;}
public function remove() {return true;}
@@ -156,7 +156,7 @@
/**
@fn check()
- @brief test if count all var , and keys is equal
+ @brief test if count all var , and keys is equal
@return boolean true/false
*/
function check() { return false; }
@@ -164,7 +164,7 @@
/**
@fn keys()
- @return array all key configuration define by this module
+ @return array all key configuration define by this module
*/
function keys() {
return array('MODULE__DATATYPE_REPLACE_MAJ_DESCRIPTION_SORT_ORDER');
@@ -172,13 +172,13 @@
/**
@fn install()
- @brief add all configuration
- @note
+ @brief add all configuration
+ @note
- Modules can emarquer sql installation instructions, however, in the case of transverse information, or dependent of an extension, preferring the implementation of an extension, file with sql independent
- please, pefix all var configuration by 'MODULE_OT__MODTYPENAME_MAJ_'
- if module twin in backoffice, report all content install in the other module
- - Not use language in DB , but function :__()
- for MODULE_TOTO_ST
+ - Not use language in DB , but function :__()
+ for MODULE_TOTO_ST
var title MODULE_TOTO_ST_S (small description)
var description MODULE_TOTO_ST_L (long description)
*/
@@ -187,9 +187,9 @@
/**
@fn remove()
@brief delete all configuration
- @note
+ @note
- please, pefix all var configuration by 'MODULE_PAYMENT__MODTYPENAME_MAJ_'
- - if module twin in backoffice, report all content remove in the other module
+ - if module twin in backoffice, report all content remove in the other module
*/
function remove() { return false; }
}
Modified: trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php 2013-12-26 10:47:55 UTC (rev 4987)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/pages/_DATATYPE_REPLACE_s.php 2013-12-26 10:49:17 UTC (rev 4988)
@@ -1,116 +1,381 @@
<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
/**
- @licence GPL 2005-_CURRENTYEAR_ The osCSS developers - osCSS Open Source E-commerce
+ @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
@portion code Copyright (c) 2002 osCommerce
@package osCSS-2 <www http://www.oscss.org>
- @version _CURRENTVERSION_
- @date _CURRENTDATE_
- @author genrated by GenerCode
+ @version 2.1.1
+ @date 10/05/2012 ,17:48:30
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
@encode UTF-8
- @brief multiple class for _DATATYPE_REPLACE_
+ @class _DATATYPE_REPLACE_s
*/
+// require_once( DIR_WS_CLASSES . 'listeners/NavigationLinksListener.php');
-/**
- @class _DATATYPE_REPLACE_s
-*/
class _DATATYPE_REPLACE_s
+ extends ModTwo /// new abstract class for nextgen module
implements
- /// Use module BO V2
- ExtModPage,
- /// Bacic module
InterfaceModule,
- /// Use Listing page Ajax mecanism
+ ExtModConfig,
InterfacedTJsonS,
- /// Detail inline
InterfacedInnerHtml
{
const FILENAME = FILENAME__DATATYPE_REPLACE_MAJ_;
- public static $code;
-
- public static $action;
-
- public static $list=array();
-
/**
- @var int current id
+ @var string file
*/
public static $Id;
/**
- @var object
- */
- public static $modules;
- /**
- @var object
- */
- public static $Info;
- /**
@var array
*/
public static $languages;
- /**
- @var bool
- */
- public static $enabled_status;
- /**
- @var bool
- */
- public static $disabled_status;
- /**
- @var string
- */
- public static $view;
- /**
- @var object
- */
- public static $statusdet;
/**
- class constructor
+ @brief class constructor
*/
public function __construct() {
+ self::Clean();
self::GetConf();
}
+
/**
@brief Load , adjust and define var environement exe for module
- Is use in module and class abstract for init value config this module
+ Is use in module and class abstract for init value config this module
*/
public static function GetConf(){
global $languages_id;
self::$code=__CLASS__;
+ self::$datatype='_DATATYPE_REPLACE_';
- self::$action=(isset($_REQUEST['action'])? $_REQUEST['action'] : 'listing' );
- self::$view=(isset($_REQUEST['view'])? $_REQUEST['view'] : '0' );
+ self::$action=(isset($_REQUEST['action'])? (string)$_REQUEST['action'] : 'listing' );
self::$Id=(isset($_REQUEST['cID'])? (int)$_REQUEST['cID'] : 0 );
+ // force file language uniq
+ global $oscss,$language,$lang;
+ $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/'.ucwords('_DATATYPE_REPLACE_').'.txt');
+
/**
+ @remarks define var execution sql in GetDBValue()
+ */
+ self::$InitInfo['adjust']=array(
+ 'languages_id'=>$languages_id,
+ 'page'=>1,
+ 'rowbyp'=>10,
+ 'sOrder'=>'',
+ 'sWhere'=>'',
+ );
+
+
+
+ /**
@remarks not load if not first init
*/
- if(defined('JSONSTATMENT')) return;
+ if(!defined('JSONSTATMENT')){
- //! active datatable in ajax, precise les GET necessaire
- if(!defined('JSONSTATMENT'))define('JSONSTATMENT', 'mod=page&type='.self::$code .(isset($_GET['cPath'])?'&cPath='.(int)$_GET['cPath']:'') );
- //! detail item in ajax
- if(!defined('AJAXSTATMENTDETAIL'))define('AJAXSTATMENTDETAIL', 'mod=page&type='.self::$code);
+ if(self::$action =='' || self::$action =='listing')
+ //! active datatable in ajax, precise les GET necessaire
+ define('JSONSTATMENT', 'ModTwo=true&mod=page&type='.self::$code.
+ (isset(self::$action)?'&action='.self::$action : '' )
+ );
+ //! detail item in ajax
+// if(!defined('AJAXSTATMENTDETAIL')) define('AJAXSTATMENTDETAIL', 'mod=page&type='.self::$code);
-// self::$modules=new ACA_DATATYPE_REPLACE_;
- // Use factory class aca
- //self::$modules=new ACA_DATATYPE_REPLACE_();
- self::$modules=new AcaFactory('_DATATYPE_REPLACE_'/*,'MODULE__DATATYPE_REPLACE_MAJ__INSTALLED_BO'*/);
- self::$modules->set_image_handler();
+ // instancie MLinkTo
+ MLinkTo::getInstance(self::$datatype);
- self::$languages = tep_get_languages();
+ // Use factory class aca
+ self::$modules=new AcaFactory(self::$datatype);
+// self::$modules->set_image_handler();
- // load status if view precised
- if(self::$view > 0)
- self::$statusdet = sqlstatus::fetch(array('type'=> 'annonce', 'id'=>self::$view), true);
+ self::$languages = tep_get_languages();
+ }
+
+
+
+ MGabCont::SetCurrentName(__CLASS__);
+
+ self::$allfields = array();
+
+ /**
+ @remarks this define col theader title, and ajust html code
+ Just for Edit listing
+ */
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__id'] = array(
+ 'sort'=>true,
+ 'alias'=>'id',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading id'),
+ 'width'=>'6%',
+ 'default'=>true,
+ 'class'=>'tcenter',
+ );
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_d._DATATYPE_REPLACE__title'] = array(
+ 'sort'=>true,
+ 'alias'=>'title',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading title'),
+ 'default'=>true,
+ 'width'=>'35%',
+ 'edit'=>array(
+ 'input_name'=>'_DATATYPE_REPLACE__title',
+ 'input_type'=>'input',
+ 'input_size'=>'64',
+ 'required_status'=>true,
+ 'active_value_language'=>true,
+ ),
+ );
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_d._DATATYPE_REPLACE__description'] = array(
+ 'sort'=>true,
+ 'alias'=>'description',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading description'),
+ 'default'=>true,
+ 'width'=>'35%',
+ 'edit'=>array(
+ 'input_name'=>'_DATATYPE_REPLACE__description',
+ 'input_type'=>'textarea@advanced',
+ 'input_size'=>'64',
+ 'required_status'=>true,
+ 'active_value_language'=>true,
+ ),
+ );
+
+ /* Db Type */
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__type'] = array(
+ 'sort'=>true,
+ 'alias'=>'type',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading type'),
+ 'width'=>'6%',
+ 'class'=>'tcenter',
+ 'edit'=>array(
+ 'input_name'=>'_DATATYPE_REPLACE__type',
+ 'input_type'=>'select',
+ 'class'=>'tleft',
+ 'input_size'=>'1',
+ 'required_status'=>true,
+ 'select_values'=>tep_get_status_array('_DATATYPE_REPLACE_',0,'status_name'),
+ 'position_col'=>'right',
+ 'position_grp'=>5
+ ),
+ );
+ self::$allfields['s.status_name'] = array(
+ 'sort'=>true,
+ 'alias'=>'type_name',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading type name'),
+ 'default'=>true,
+ 'width'=>'8%',
+ 'edit'=>array(
+ 'input_name'=>'_DATATYPE_REPLACE__type',
+ 'input_type'=>'select',
+ 'input_size'=>'1',
+ 'required_status'=>true,
+ 'select_values'=>tep_get_status_array('_DATATYPE_REPLACE_',0,'status_name'),
+ 'position_col'=>'right',
+ 'position_grp'=>5
+ ),
+ );
+ /* Db Type */
+
+ /* DEB Datatype RootListing categorie */
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false') {
+ self::$allfields['cat.categories_id'] = array(
+ 'sort'=>true,
+ 'alias'=>'categorie_id',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading categories id'),
+ 'width'=>'6%',
+ 'class'=>'tcenter',
+ );
+ self::$allfields['catd.categories_name'] =array(
+ 'sort'=>true,
+ 'alias'=>'cat_title',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading categories'),
+ 'width'=>'12%',
+ 'default'=>true,
+ );
+ }
+ /* END Datatype RootListing categorie */
+
+
+ /* Sort */
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_.sort_order'] = array(
+ 'sort'=>true,
+ 'alias'=>'sort_order',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading sort order'),
+ 'default'=>true,
+ 'class'=>'tcenter',
+ 'edit'=>array(
+ 'input_name'=>'sort_order',
+ 'input_size'=>'2',
+ ),
+ );
+ /* Sort */
+
+ /* Date / user */
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_.date_added'] = array(
+ 'sort'=>true,
+ 'alias'=>'date_added',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading date added'),
+ 'class'=>'tcenter',
+ );
+
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_.last_modified'] = array(
+ 'sort'=>true,
+ 'alias'=>'last_modidied',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading date modified'),
+ 'class'=>'tcenter',
+ );
+
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_.user_added'] = array(
+ 'sort'=>true,
+ 'alias'=>'user_added',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading user added'),
+ 'class'=>'tcenter',
+ );
+
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_.user_modidied'] = array(
+ 'sort'=>true,
+ 'alias'=>'user_modified',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading user modified'),
+ 'class'=>'tcenter',
+ );
+ /* Db parent */
+// self::$allfields['c.parent_id'] = array(
+// 'sort'=>true,
+// 'alias'=>'parent_id',
+// 'class'=>'tcenter',
+// 'text'=>__('@_DATATYPE_REPLACE_s table heading parent_id'),
+// 'edit'=>array(
+// 'input_name'=>'parent_id',
+// 'input_type'=>'select',
+// 'class'=>'tleft',
+// 'input_size'=>'1',
+// 'required_status'=>true,
+// 'select_values'=>array_merge(array(array('id'=>0, 'text'=> '')),self::parent_item_nav()),
+// ),
+//
+// );
+// self::$allfields['cd2._DATATYPE_REPLACE__title'] = array(
+// 'sort'=>true,
+// 'alias'=>'parent_name',
+// 'text'=>__('@_DATATYPE_REPLACE_s table heading parent name'),
+// 'default'=>true,
+// );
+ /* Db parent */
+
+ self::$allfields['_DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__status'] = array(
+ 'sort'=>true,
+ 'alias'=>'status',
+ 'class'=>'tcenter',
+ 'text'=>__('@_DATATYPE_REPLACE_s table heading status'),
+ 'default'=>true,
+ 'edit'=>array(
+ 'input_name'=>'_DATATYPE_REPLACE__status',
+ 'input_type'=>'radio',
+ 'required_status'=>true,
+ 'values_list'=>array(
+ array('id'=>0, 'text'=>__('@_DATATYPE_REPLACE_s text status off') ),
+ array('id'=>1, 'text'=>__('@_DATATYPE_REPLACE_s text status on') ),
+ ),
+ 'position_col'=>'right',
+ 'position_grp'=>5
+ ),
+
+ );
+
+
+
+ /// @remarks min fields and not view directly colonne fields
+ $listfield = ' _DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__id as id,';
+
+ /// @remarks Active forms filter
+ $mutli=array();
+// $mutli[] = sprintf(CsrtAction::getButton('button_action', IMAGE_DELETE, 'delete'), '', ' name="multi_action" ' ) ;
+
+
+
+ /**
+ @remarks Active forms filter
+ @note
+ array[
+ // For normalised filter define on method ConvertInitVar
+ generic =>
+ array (
+ 'string'
+ // , ....
+ );
+ mod =>
+ array(
+ 'title'=>__('@products filter tab manufacturer'),
+ 'content'=>tep_get_include_contents('manufacturers/filter.manufacturer'),
+ )
+ ]
+ */
+ $tab = array();
+
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false')
+ $tab['generic'][] ='categorie' ;
+
+ $tab['mod'][] = array(
+ 'title'=>__('@_DATATYPE_REPLACE_s filter menu'),
+ 'content'=>tep_get_include_contents(__CLASS__.'/filter.clause'),
+ );
+
+
+ /**
+ @remarks this define menu master module in page
+ @note use $boutons[action][] = array(params)
+
+ params :
+ 'type'=>'getLink',
+ 'format'=>'button_nav',
+ 'image'=>'',
+ 'cssclass'=>'button',
+ 'title'=>__('image create new content'),
+ 'url'=>tep_href_link(self::FILENAME, 'action=new'),
+ */
+ $boutons = array();
+ $boutons['listing'][]=array(
+ 'type'=>'getLink',
+ 'format'=>'button_nav',
+ 'image'=>'',
+ 'cssclass'=>'',
+ 'title'=>__('@_DATATYPE_REPLACE_s image add'),
+ 'url'=>tep_href_link(self::FILENAME, 'action=new'),
+ );
+
+ if( DataTypes::is_active('categorie'))
+ $boutons['listing'][]=array(
+ 'type'=>'getLink',
+ 'format'=>'button_nav',
+ 'image'=>'',
+ 'cssclass'=>'fancy',
+ 'title'=> __('@_DATATYPE_REPLACE_s add category datatype _DATATYPE_REPLACE_'),
+ 'url'=>tep_href_link(FILENAME_CATEGORIES, '&datatype='.self::$datatype.'&action=new_light&origin='. self::FILENAME),
+ );
+
+
+
+ if(isset($_SESSION['filters'][__CLASS__]['menus'])){
+ $_SESSION['filters']['menus'] = $_SESSION['filters'][__CLASS__]['menus'];
+
+ self::$InitInfo['adjust']['sWhere'] .=" AND parent_id IN (".implode(array_keys($_SESSION['filters']['menus']),',').") ";
+ }
+
+ /**
+ Call Base Init and construct $InitInfo for process Filter
+ $listfield string list row in db
+ $mutli array action multiple
+ $filter array put list off activate tab filter
+ $boutons array
+ */
+ self::ConvertInitVar( $listfield, $mutli, $tab, $boutons);
+
+ return true;
}
+
/**
@fn check_action($actions)
@brief Process action
@@ -118,396 +383,473 @@
@return $actions string
*/
public function check_action($actions){
- global $messageStack,$oscss;
+ global $messageStack;
- $DB=Database::getInstance();
self::$action=$actions;
+ switch (self::$action) {
- $cID=(isset($_GET['cID'])? $_GET['cID'] :'' );
+ /**
+ @remarks specific save in session value filters
+ */
+ case 'filters':
+ /*
+ Call Prev Process
+ */
+ self::actionFilter();
- self::$modules-> set_image_handler();
- self::$languages = tep_get_languages();
+ unset($_SESSION['filters'][self::$code]['menus']);
+ foreach($_POST['filters']['menus'] as $key=>$row){
+ if( $row =='on' )
+ $_SESSION['filters'][self::$code]['menus'][$key] = 'on';
+ }
- $actions['action'] = self::$action;
- $actions['display_file']='';
- $actions['action_class']=(isset($_GET['action_class']))? $_GET['action_class'] : '';
- $actions['action_method']=(isset($_GET['action_method']))? $_GET['action_method'] : '';
+ tep_redirect(tep_href_link(self::FILENAME));
+ break;
- // Ask categories modules if want to change the action
- $actions = self::$modules->check_action($actions);
- $action = $actions['action'];
- // if(((self::$action == 'update')||(self::$action == 'insert'))) self::$action = 'edit';
+ /**
+ @remarks specific ajax action
+ */
+ /**
+ @remarks specific Ajax call
+ */
+ case 'update_cell':
+ try {
+ global $languages_id;
- switch (self::$action) {
- /**
- OPERATION SQL
- */
- case 'setflag':
- if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
- if (isset($_GET['cID'])) {
- if ($_GET['flag'] == '0') $DB->query($sql="update " . TABLE__DATATYPE_REPLACE_MAJ_ . " set _DATATYPE_REPLACE__status = '0' where _DATATYPE_REPLACE__id = '" . (int)$_GET['cID'] . "'");
- elseif($_GET['flag'] == '1') $DB->query($sql="update " . TABLE__DATATYPE_REPLACE_MAJ_ . " set _DATATYPE_REPLACE__status= '1' where _DATATYPE_REPLACE__id = '" . (int)$_GET['cID'] . "'");
+ $modele = sql_DATATYPE_REPLACE_::Specimen();
+
+ $params = array();
+ $params['id'] = $_REQUEST['id'];
+
+ if( in_array($_REQUEST['columnName'], $modele) ){
+ $key = (string)$_REQUEST['columnName'];
+ if(is_int($modele[$key]) || is_bool($modele[$key]))
+ $data = ( (strlen($_REQUEST['value'])>0) ? (int)$_REQUEST['value'] : $modele[$key]);
+ elseif(is_string($modele[$key]))
+ $data =(!empty($_REQUEST['value']) ? tep_db_prepare_input((string)$_REQUEST['value']) : $modele[$key]);
+ elseif(is_array($modele[$key])){
+ $data = array();
+ $data[$languages_id] =(!empty($_REQUEST['value']) ? tep_db_prepare_input((string)$_REQUEST['value']) : $modele[$key][$languages_id]);
+ }
+
+ $params['sqlarray'][$key] = $data;
}
- }
+ else{
+ $tab = explode('[', $_REQUEST['columnName']);
+ $final = $tabs2 = array();
+ foreach($tab as $row)
+ $tabs2[] = ( (substr($row,-1)==']')?substr($row,0,-1) : $row );
- if(!isset($_GET['forceajax']))
- tep_redirect(tep_href_link(self::FILENAME) );
- break;
- case 'viewflag':
- if (isset($_GET['cID'])) {
- if ($_GET['flag'] == '0') $DB->query($sql="update " . TABLE__DATATYPE_REPLACE_MAJ_ . " set _DATATYPE_REPLACE__hidden = '0' where _DATATYPE_REPLACE__id = '" . (int)$_GET['cID'] . "'");
- elseif($_GET['flag'] == '1') $DB->query($sql="update " . TABLE__DATATYPE_REPLACE_MAJ_ . " set _DATATYPE_REPLACE__hidden = '1' where _DATATYPE_REPLACE__id = '" . (int)$_GET['cID'] . "'");
- }
+ $tabs3 = array_reverse($tabs2);
+ $max = count($tabs2);
+ $i=0;
+ foreach($tabs3 as $row){
+ $i++;
+ if($i==1) $final[$row] = (isset($_REQUEST['value']) ? tep_db_prepare_input($_REQUEST['value']) : 0);
+ else
+ $final[$row] = $final;
+ }
- if(!isset($_GET['forceajax']))
- tep_redirect(tep_href_link(self::FILENAME, tep_get_all_get_params(array( 'cID','flag','action'),false)) );
- break;
+ $params['post'] = $final;
+ }
- case 'insert':
- $type = ( isset($_POST['_DATATYPE_REPLACE__type']) ? tep_db_prepare_input($_POST['_DATATYPE_REPLACE__type']) : 1 );
+ $params['action']=self::$action;
- $params['sqlarray'] = array(
- '_DATATYPE_REPLACE__type' => $type,
-// '_DATATYPE_REPLACE__name' => '',
- '_DATATYPE_REPLACE__status' => '',
- );
+ if( sql_DATATYPE_REPLACE_::update( $params ) != 1 )
+ throw new Exception(__('@sql_DATATYPE_REPLACE_ error in update process')) ;
- $_DATATYPE_REPLACE__id=sql_DATATYPE_REPLACE_::create($params);
+ $messageStack->add_session(__('@sql_DATATYPE_REPLACE_ success in update process'), 'success');
- tep_redirect(tep_href_link(self::FILENAME, 'page=' . $_GET['page'] . '&cID=' . $_DATATYPE_REPLACE__id.'&action=edit'));
+ // display value for return
+ echo $_REQUEST['value'];
+ }
+ catch (Exception $e) {
+ $messageStack->add_session($e->getMessage() , 'error');
+ }
+
break;
- case 'update':
+ case 'setflag':
+ if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
+ if ($c_id > 0){
+ $myarray = array('id'=>self::$id, 'status'=>$_GET['flag'] );
+ sql_DATATYPE_REPLACE_::update($myarray);
+ }
+ }
- if (isset($_GET['cID']) && (int)$_GET['cID']>0)
- $_DATATYPE_REPLACE__id = tep_db_prepare_input($_GET['cID']);
+ if(!isset($_GET['forceajax']))
+ tep_redirect(tep_href_link(self::FILENAME, 'cID=' . self::$id));
+ break;
- $params['sqlarray'] = array(
-// '_DATATYPE_REPLACE__name' => tep_db_prepare_input($_POST['_DATATYPE_REPLACE__name']),
- '_DATATYPE_REPLACE__status' => tep_db_prepare_input($_POST['_DATATYPE_REPLACE__status']),
- );
+ case 'insert':
+ try {
+ $type = ( isset($_POST['content_name']) ? tep_db_prepare_input($_POST['content_name']) : 1 );
+ $params = array();
- if (isset($_DATATYPE_REPLACE__id))
- $params['id']=$_DATATYPE_REPLACE__id;
+ $params['sqlarray'] = sql_DATATYPE_REPLACE_::ExtractForm($_POST);
- $params['action']=self::$action;
- $params['post']=$_POST;
- $params['language_id']= $languages_id;
- $params['cPath']=(isset($_POST['cPath'])) ? tep_db_prepare_input($_POST['cPath']) : 0;
+ $_DATATYPE_REPLACE__id = sql_DATATYPE_REPLACE_::create($params);
- sql_DATATYPE_REPLACE_::update($params);
+ tep_redirect(tep_href_link(self::FILENAME, 'cID=' . $_DATATYPE_REPLACE__id.'&action=edit'));
+ }
+ catch (Exception $e) {
+ $messageStack->add_session($e->getMessage() , 'error');
+ }
- if(isset($_POST['up_and_close']) ) tep_redirect(tep_href_link(self::FILENAME, tep_get_all_get_params(array( 'cID','flag','action'),false)) );
- else tep_redirect(tep_href_link(self::FILENAME, 'page=' . $_GET['page'] . '&cID=' . $_DATATYPE_REPLACE__id.'&action=edit'));
- break;
+ tep_redirect(tep_href_link(self::FILENAME ));
+ break;
+ case 'update':
+ if (self::$Id > 0){
- /**
- @remarks Delete post
- */
- case 'deleteconfirm':
- $_DATATYPE_REPLACE__id = tep_db_prepare_input((int)$_GET['cID']);
+ $params = array(
+ 'id'=>self::$Id ,
+ );
+ $params['sqlarray'] = sql_DATATYPE_REPLACE_::ExtractForm($_POST);
- if( !sql_DATATYPE_REPLACE_::delete(array('id'=>$_DATATYPE_REPLACE__id)) )
- $messageStack->add_session(sprintf(__('error delet for post id %s'), $_DATATYPE_REPLACE__id ), 'error');
- else
- $messageStack->add_session(sprintf(__('delete post id %s success'), $_DATATYPE_REPLACE__id ), 'success');
+ if( ! sql_DATATYPE_REPLACE_::update($params) )
+ $messageStack->add_session(__('@sql_DATATYPE_REPLACE_ error in update process'), 'error');
+ else
+ $messageStack->add_session(__('@sql_DATATYPE_REPLACE_ success in update process'), 'success');
- tep_redirect(tep_href_link(self::FILENAME, tep_get_all_get_params(array( 'cID','flag','action'),false)));
- break;
+ tep_redirect(tep_href_link(self::FILENAME, 'action=edit&cID=' . self::$Id ));
+ }
+ break;
+ case 'delete_confirm':
+ $c_id =(int) tep_db_prepare_input($_POST['cID']);
+ if ($c_id > 0){
+ $myarray = array(
+ 'id'=>$c_id,
+ );
+ $res=sql_DATATYPE_REPLACE_::delete($myarray);
+ }
+ tep_redirect(tep_href_link(self::FILENAME));
+ break;
- /**
- POST AFFICHAGE
- */
- /**
- @remarks Check count status type. If one status , get next etape
- */
- case 'new':
- $res = tep_get_status_array('_DATATYPE_REPLACE_',0,'status_name');
- if(count($res)==1)
- tep_redirect(tep_href_link(self::FILENAME, 'action=insert&cID='));
- break;
+
+ case 'new':
case 'edit':
-
+ global $oscss;
/// Load wysiwyg
$oscss->_add_ext(BO_WISIWYG_SELECTED,'editeur/');
for ($i=0, $n=sizeof(self::$languages); $i<$n; $i++)
- echo $oscss->_call(BO_WISIWYG_SELECTED,'_top','_DATATYPE_REPLACE__description[' . self::$languages[$i]['id'] . ']','600','400');
+ echo $oscss->_call(BO_WISIWYG_SELECTED,'_top','_DATATYPE_REPLACE_[description][' . self::$languages[$i]['id'] . ']','600','400');
break;
-
- default:
- //! Entretient liens avec categorie
- sql_DATATYPE_REPLACE_::Maintenance();
}
return self::$action;
}
- /**
- */
public function get_header(){
- self::$modules->get_header_js(self::$action);
}
/**
- @fn load_db_values($ID)
- @brief this load db value function
- This method construct static var $Info
- @param $ID integer id _DATATYPE_REPLACE_ | 0
- @return $Info
+ @fn _DATATYPE_REPLACE_s::GetDBValue();
+ @brief return DB value adapted for current action
+ Use self::action for determine switch
+ @return
*/
- public static function load_db_values($ID){
- global $language_id;
- $DB=Database::getInstance();
+ public static function GetDBValue(){
+ global $languages_id;
+ $DB= Database::getInstance();
- $cID = tep_db_prepare_input((int)$ID);
+ switch (self::$action) {
-// if(in_array(self::$action ,array('edit' ,'delete', 'detail') ) )
-// $Info_array=sql_DATATYPE_REPLACE_::fetch(array('id'=>$cID,'language_id'=>$language_id));
-// elseif(self::$action == 'new')
-// $Info_array = sql_DATATYPE_REPLACE_::Specimen();
-//
+ case 'delete':
+ case 'edit':
+ case 'new':
+ if( (int)self::$Id > 0) {
+ $obj = sql_DATATYPE_REPLACE_::fetch(array('id'=>self::$Id , 'language_id'=>$languages_id), true);
+ }
+ else{
+ $obj = sql_DATATYPE_REPLACE_::Specimen(true);
+ }
+ $obj = self::FormatDBValue($obj);
+ return self::$Info= $obj;
+ break;
+ case 'listing':
+ default:
+ self::GetConf();
+ /**
+ @remarks retrun object load one inventaire
+ */
+ global $query_numrows, $languages_id;
+ $adjust=new objectInfo(self::$InitInfo['adjust']);
- $action=self::$action;
+ /**
+ @remarks replace id by name col
+ */
+ if(!empty($adjust->sWhere)) {
- switch ($action) {
+ foreach(self::$allfields as $key=>$row){
+ if(is_array($row) && isset($row['alias']) ){
+ $k[] = '#[(]'.$row['alias'].'[)]#i';
+ $k[] = '# '.$row['alias'].' #i';
+ $k[] = '# \.'.$row['alias'].'#i';
- /**
- @remarks Ajax View result
- */
- case 'setflag':
- break;
- case 'viewflag':
- break;
+ $v[] = '('.$key.')';
+ $v[] = ' '.$key.' ';
+ $v[] = '.'.$key.' ';
+ }
+ }
- /**
- @remarks Normal View Page
- */
- case 'delete':
- break;
- case 'new':
- $Info_array = sql_DATATYPE_REPLACE_::Specimen();
- break;
- case 'detail':
- case 'edit':
- $Info_array=sql_DATATYPE_REPLACE_::fetch(array('id'=>$cID,'language_id'=>$language_id));
- break;
- default:
- }
+ if(isset($k))
+ $adjust->sWhere = preg_replace($k,$v, $adjust->sWhere);
+ }
+ $query_raw = "select ".$adjust->listfields." from " . TABLE__DATATYPE_REPLACE_MAJ_ . " _DATATYPE_REPLACE_SEOTAG_ ".
+ " LEFT JOIN ".TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION." _DATATYPE_REPLACE_SEOTAG_d ON( _DATATYPE_REPLACE_SEOTAG_d._DATATYPE_REPLACE__id = _DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__id AND _DATATYPE_REPLACE_SEOTAG_d.language_id ='".$adjust->languages_id."' ) ".
+ " LEFT JOIN ".TABLE_STATUS." s ON( s.status_id = _DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__type AND s.status_type = '_DATATYPE_REPLACE_s' AND s.language_id ='".$adjust->languages_id."' ) ";
- self::$Info = new objectInfo($Info_array);
- if (!isset(self::$Info->_DATATYPE_REPLACE__status)) self::$Info->_DATATYPE_REPLACE__status = '1';
- switch (self::$Info->_DATATYPE_REPLACE__status) {
- case '0': self::$enabled_status = false; self::$disabled_status = true; break;
- case '1':
- default: self::$enabled_status = true; self::$disabled_status = false;
+ if( DataTypes::is_active('categorie') && tep_cst_define('TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES') !='false'){
+ $query_raw .=" LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " _DATATYPE_REPLACE_SEOTAG_2c ON(_DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__id=_DATATYPE_REPLACE_SEOTAG_2c._DATATYPE_REPLACE__id ) ".
+ " LEFT JOIN " . TABLE_CATEGORIES . " cat ON( cat.categories_id =_DATATYPE_REPLACE_SEOTAG_2c.categories_id ) ".
+ " LEFT JOIN " . TABLE_CATEGORIES_DESCRIPTION . " catd ON( catd.categories_id =_DATATYPE_REPLACE_SEOTAG_2c.categories_id AND catd.language_id='".(int)$adjust->languages_id."' ) ";
+ }
+
+ $query_raw .=" WHERE 1 ".
+ ((!empty($adjust->sWhere)) ? /*substr(*/$adjust->sWhere/*, 3)*/ : '').
+ " GROUP BY _DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__id ".
+ " ORDER BY ".((!empty($adjust->sOrder)) ? $adjust->sOrder : ' _DATATYPE_REPLACE_SEOTAG_._DATATYPE_REPLACE__id ASC ');
+
+ $_split = new splitPageResults($adjust->page, $adjust->rowbyp, $query_raw, $query_numrows);
+ $_query = $DB->query($query_raw);
+
+ if($_query !=false)
+ $res=self::FormatDBValue($_query);
+
+ return $res;
}
-
- return self::$Info;
}
+
+
/**
@fn display_view()
@brief this methode is switch for call gabarit action
*/
public function display_view(){
- $action=self::$action;
+ $action=self::$action;
+ $MG= false;
switch ($action) {
-
/**
@remarks Ajax View result
*/
+ case 'update_cell':
+ break;
case 'setflag':
- return self::get_item_status(array('_DATATYPE_REPLACE__status'=>(int)$_GET['flag'], '_DATATYPE_REPLACE__id'=>(int)$_GET['cID']));
+ return self::RowStatus(array('status'=>(int)$_GET['flag'], 'id'=>(int)self::$id));
break;
- case 'viewflag':
- return self::get_item__DATATYPE_REPLACE__hidden(array('_DATATYPE_REPLACE__hidden'=>(int)$_GET['flag'], '_DATATYPE_REPLACE__id'=>(int)$_GET['cID']));
- break;
+
/**
@remarks Normal View Page
*/
-
+ case 'new':
+ $action='edit';
case 'delete':
- self::load_db_values($_GET['cID']);
- break;
case 'edit':
- self::load_db_values($_GET['cID']);
+ self::$Info = self::GetDBValue();
+ $MG= true;
break;
- case 'new':
- self::load_db_values(-1);
-// $action='edit';
- break;
+ case 'listing':
default:
- self::tep_get_list();
+ $MG= true;
$action='listing';
}
- /// use master gabarit
- return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
+
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
-
- /** public static InterfacedTJsonS */
-
/**
- @fn get_item_action($_DATATYPE_REPLACE_)
- @brief private model for row action
- @param $_DATATYPE_REPLACE_ array
+ @fn tep_get_list($page=1,$rowbyp=10,$sOrder='',$sWhere='',$options='')
+ @brief Constructeur listing element cms _DATATYPE_REPLACE_
+ @param $page integer default(1) split page
+ @param $rowbyp integer default(10) nbr line in page
+ @param $sOrder string | null
+ @param $sWhere string | null
+ @param $options array
+ @return Array
*/
- private static function get_item_action($_DATATYPE_REPLACE_){
- $exclude=array('action','cID','forceajax','type','class','function','funct', 'mod');
- return sprintf(
- CsrtAction::getFormat('row_action'),
- self::$modules->display_ColumnRowAction($_DATATYPE_REPLACE_['_DATATYPE_REPLACE__id']) ,
- sprintf(CsrtAction::getLink('row_action_right', IMAGE_EDIT, 'edit'), '', tep_href_link(self::FILENAME, tep_get_all_get_params($exclude).'cID=' . $_DATATYPE_REPLACE_['_DATATYPE_REPLACE__id'] . '&action=edit') ,'' ).
- sprintf(CsrtAction::getLink('row_action_right', IMAGE_DELETE, 'delete'), 'fancy', tep_href_link(self::FILENAME, tep_get_all_get_params($exclude).'cID=' . $_DATATYPE_REPLACE_['_DATATYPE_REPLACE__id'] . '&action=delete') ,'' )
- );
- }
+ public static function tep_get_list($page=1,$rowbyp=10,$sOrder='',$sWhere='',$options=''){
+ global $query_numrows;
- /**
- @fn get_item_status($_DATATYPE_REPLACE_)
- @brief private model for row status
- @param $_DATATYPE_REPLACE_ array
- */
- private static function get_item_status($_DATATYPE_REPLACE_){
- $exclude=array('action','cID','forceajax','type','class','function','funct', 'mod');
- $query_s='action=setflag&cID=' . $_DATATYPE_REPLACE_['_DATATYPE_REPLACE__id'].'&flag=';
+ /// @remarks force load conf
+ self::GetConf();
- return '<a class="ajaxinline" href="' . tep_href_link(self::FILENAME, tep_get_all_get_params($exclude).$query_s.(($_DATATYPE_REPLACE_['_DATATYPE_REPLACE__status'] == '1')? '0' : '1') ) . '">'.
- sprintf(
- CsrtAction::getFormat('row_flag'),
- (int)$_DATATYPE_REPLACE_['_DATATYPE_REPLACE__status'],
- ( ($_DATATYPE_REPLACE_['_DATATYPE_REPLACE__status'] == '1')? IMAGE_ICON_STATUS_GREEN : IMAGE_ICON_STATUS_RED)
- ).
- '</a>';
- }
+ $res=array();
- /**
- @fn get_item__DATATYPE_REPLACE__hidden($_DATATYPE_REPLACE_)
- @brief private model for row hidden
- @param $_DATATYPE_REPLACE_ array
- */
- private static function get_item__DATATYPE_REPLACE__hidden($_DATATYPE_REPLACE_){
+ /**
+ @remarks adjust param for sql requete
+ */
+ self::$InitInfo['adjust']['page']=$page;
+ self::$InitInfo['adjust']['rowbyp']=$rowbyp;
+ self::$InitInfo['adjust']['sOrder']=$sOrder;
+ self::$InitInfo['adjust']['sWhere']=$sWhere;
+ self::$InitInfo['adjust']['options']=$options;
- $exclude=array('action','cID','forceajax','type','class','function','funct', 'mod');
- $query_s='action=viewflag&cID=' . $_DATATYPE_REPLACE_['_DATATYPE_REPLACE__id'].'&flag=';
+ $res = self::GetDBValue();
- return '<a class="ajaxinline" href="' . tep_href_link(self::FILENAME, tep_get_all_get_params($exclude).$query_s.(($_DATATYPE_REPLACE_['_DATATYPE_REPLACE__hidden'] == '1')? '0' : '1') ) . '">'.
- sprintf(
- CsrtAction::getFormat('row_flag'),
- (int)$_DATATYPE_REPLACE_['_DATATYPE_REPLACE__hidden'],
- ( ($_DATATYPE_REPLACE_['_DATATYPE_REPLACE__hidden'] == '1')? IMAGE_ICON_STATUS_GREEN : IMAGE_ICON_STATUS_RED)
- ).
- '</a>';
+ self::$list= $query_numrows ; //= count($res);
+
+ return $res;
}
+
+ /** public static InterfacedTJsonS */
+
/**
- @fn emptyResult()
- @brief private methode for construct empty result retrun by tep_get_list
+ @brief format db value for display page
+ @param $_query ressource db sql
@retu...
[truncated message content] |
|
From: <os...@us...> - 2013-12-26 10:47:59
|
Revision: 4987
http://sourceforge.net/p/oscss/svn/4987
Author: oscim
Date: 2013-12-26 10:47:55 +0000 (Thu, 26 Dec 2013)
Log Message:
-----------
Fox bug
clean code in driver data public
delete olds code or duplicate
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/ModTwo.php
trunk/catalog/admin/includes/classes/drivers/sqlcontent.php
trunk/catalog/admin/includes/classes/drivers/sqlproduct.php
trunk/catalog/admin/includes/functions/html_output.php
trunk/catalog/admin/includes/modules/pages/cms_content.php
trunk/catalog/admin/includes/modules/pages/products.php
trunk/catalog/common/class.interfaces.php
trunk/catalog/includes/classes/AbstractAcaModule.php
trunk/catalog/includes/classes/drivers/data/categorie.php
trunk/catalog/includes/classes/drivers/data/content.php
trunk/catalog/includes/classes/drivers/data/product.php
trunk/catalog/templates/defaut/includes/content/account.php
Modified: trunk/catalog/admin/includes/classes/ModTwo.php
===================================================================
--- trunk/catalog/admin/includes/classes/ModTwo.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/admin/includes/classes/ModTwo.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -406,7 +406,7 @@
}
// if class containt submodule
- if(isset(self::$modules) )
+ if( isset(self::$modules) )
self::$modules->__call('check_action', array('action'=>'ModTwofilters'));
}
/**
Modified: trunk/catalog/admin/includes/classes/drivers/sqlcontent.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlcontent.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/admin/includes/classes/drivers/sqlcontent.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -91,8 +91,6 @@
self::getInstance();
$DB=Database::getInstance();
-// if( !isset($option['id'])) return 'id';
-
$list_languages=tep_get_languages();
$where ='';
$error = 0 ;
Modified: trunk/catalog/admin/includes/classes/drivers/sqlproduct.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlproduct.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/admin/includes/classes/drivers/sqlproduct.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -65,8 +65,8 @@
if(!$resobj){
$DB->rollbackTransaction();
- return false;
- }
+ return false;
+ }
$products_id = $resobj->__get('insertId');
Modified: trunk/catalog/admin/includes/functions/html_output.php
===================================================================
--- trunk/catalog/admin/includes/functions/html_output.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/admin/includes/functions/html_output.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -71,24 +71,8 @@
}
-/**
- Draw a 1 pixel black line
- @file order.php
-*/
-function tep_black_line() {
- return tep_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', '1');
-}
/**
- Output a separator either through whitespace, or with an image
- @file order.php
-*/
-function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
- return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
-}
-
-
-/**
@author oscim - OscssTeam
@version 1.1
Appel des fichiers est evite doublon
Modified: trunk/catalog/admin/includes/modules/pages/cms_content.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/cms_content.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/admin/includes/modules/pages/cms_content.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -68,8 +68,8 @@
if(!defined('AJAXSTATMENTDETAIL'))define('AJAXSTATMENTDETAIL', 'mod=page&type='.self::$code);
- // instancie MLinkTo
- MLinkTo::getInstance(self::$datatype);
+ // instancie MLinkTo
+ MLinkTo::getInstance(self::$datatype);
// Use factory class aca
self::$modules=new AcaFactory(self::$datatype/*,'MODULE_CONTENT_INSTALLED_BO'*/);
@@ -478,7 +478,7 @@
case 'insert':
try {
$type = ( isset($_POST['content_name']) ? tep_db_prepare_input($_POST['content_name']) : 1 );
-
+ $params = array();
$params['sqlarray'] = array(
'content_type' => $type,
'content_name' => '',
@@ -487,7 +487,7 @@
$content_id=sqlcontent::create($params);
- tep_redirect(tep_href_link(self::FILENAME, 'page=' . $_GET['page'] . '&cID=' . $content_id.'&action=edit'));
+ tep_redirect(tep_href_link(self::FILENAME, 'cID=' . $content_id.'&action=edit'));
}
catch (Exception $e) {
$messageStack->add_session($e->getMessage() , 'error');
Modified: trunk/catalog/admin/includes/modules/pages/products.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/products.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/admin/includes/modules/pages/products.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -645,14 +645,15 @@
'url'=>tep_href_link(self::FILENAME, 'action=new'),
);
- $boutons['listing'][]=array(
- 'type'=>'getLink',
- 'format'=>'button_nav',
- 'image'=>'',
- 'cssclass'=>'fancy',
- 'title'=> __('@products add category datatype product'),
- 'url'=>tep_href_link(FILENAME_CATEGORIES, '&datatype='.self::$datatype.'&action=new_light&origin='. self::FILENAME),
- );
+ if( DataTypes::is_active('categorie'))
+ $boutons['listing'][]=array(
+ 'type'=>'getLink',
+ 'format'=>'button_nav',
+ 'image'=>'',
+ 'cssclass'=>'fancy',
+ 'title'=> __('@products add category datatype product'),
+ 'url'=>tep_href_link(FILENAME_CATEGORIES, '&datatype='.self::$datatype.'&action=new_light&origin='. self::FILENAME),
+ );
$boutons['listing'][]=array(
Modified: trunk/catalog/common/class.interfaces.php
===================================================================
--- trunk/catalog/common/class.interfaces.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/common/class.interfaces.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -85,7 +85,7 @@
@interface InterfaceAccount
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@brief Interface class support module aca account, complement classic interface
- @note use in Frontend
+ @note use in Frontend
*/
Interface InterfaceAccount {
// public function display_view_min_listMyAccount();
@@ -165,5 +165,22 @@
return implode("," ,self::$cache);
}
+ /**
+ Alias unique ID
+ */
+ public static function get_item($id,$option=array()){
+
+ $db_list=self::get_query($id,'','',$option);
+
+ if(is_numeric($id) && isset($db_list[(int)$id])){
+ return $db_list[$id];
+ }else{
+ $db_list=self::get_query('',$id);
+ foreach($db_list as $item)
+ if((string)$id==(string)$item->name)
+ return $item;
+ }
+ return false;
+ }
}
?>
\ No newline at end of file
Modified: trunk/catalog/includes/classes/AbstractAcaModule.php
===================================================================
--- trunk/catalog/includes/classes/AbstractAcaModule.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/includes/classes/AbstractAcaModule.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -97,8 +97,9 @@
\brief class d'appel des module aca
*/
class AbstractAcaModule
- /*extends page*/{
+ {
+
/**
* \fn initialise_type($cst, $folder_base)
* \brief init class modules for value config , for type module
@@ -135,6 +136,7 @@
return $list_mod;
}
+
/**
@brief Appel magic
@param $method string
@@ -287,28 +289,96 @@
/**
* \fn return_db_min($cID,$class='')
* \brief return_db_min module display_view mini
- * @param $cID int le Id du customers
+ * @param $ID int le Id du customers
* @param $class string le nom de la class appelé, ou vide pour toutes les class enfants
*/
- public function return_db_min($cID,$class=''){
+ public function return_db_min($ID,$class=''){
global $page;
if (!empty($class)) {
if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($module, 'return_db_min' ))){
- $this->modules[$class]->load_db_values($cID);
- return $this->modules[$class]->return_db_min($cID);
+ $this->modules[$class]->load_db_values($ID);
+ return $this->modules[$class]->return_db_min($ID);
}
} else {
$c=array();
foreach ($this->modules as $key=>$module) {
if (($module->enabled) and (method_exists($module, 'return_db_min' ))) {
- $this->modules[$key]->load_db_values($cID);
- $c[$key]=$this->modules[$key]->return_db_min($cID);
+ $this->modules[$key]->load_db_values($ID);
+ $c[$key]=$this->modules[$key]->return_db_min($ID);
}
}
return $c;
}
}
+
+
+ /**
+ * \fn display_view($pID,$class='',$exclude=array() )
+ @brief Affiche module elemennt html
+ Block principal d'affichage, liste ou vue des élément. Block principal de page
+ @param $ID int le Id du produits
+ @param $class string le nom de la class appelé, ou vide pour toutes les class enfants
+ @param $exclude array
+ */
+ public function display_view($ID,$class='',$exclude=array() ){
+ global $page;
+ if (!empty($class)) {
+ if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($class, 'display_view' ))){
+ $this->modules[$class]->load_db_values($ID);
+ return $this->modules[$class]->display_view($ID);
+ }
+ } else {
+ $c=array();
+ if(isset($this->modules) && is_array($this->modules))
+ foreach ($this->modules as $key=>$module) {
+ if ( !in_array($key,$exclude) && ($module->enabled) and (method_exists($module, 'display_view' ))) {
+ $this->modules[$key]->load_db_values($ID);
+ $c[$key]=$this->modules[$key]->display_view($ID);
+ }
+ }
+ return $c;
+ }
+ }
+
+ /**
+ * \brief Affiche module display_view mini
+ * @param $ID int cID le Id du customers
+ * @param $class string class le nom de la class appelé, ou vide pour toutes les class enfants
+ */
+ public function display_view_min($ID,$class=''){
+ global $page;
+ if (!empty($class)) {
+ if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($module, 'display_view_min' ))){
+ $this->modules[$class]->load_db_values($ID);
+ return $this->modules[$class]->display_view_min($ID);
+ }
+ } else {
+ $c='';
+ foreach ($this->modules as $key=>$module) {
+ if (($module->enabled) and (method_exists($module, 'display_view_min' ))) {
+ $this->modules[$key]->load_db_values($ID);
+ $c .=$this->modules[$key]->display_view_min($ID);
+ }
+ }
+ return $c;
+ }
+ }
+
+ /**
+ @brief Get data modified/add by module
+ @param $_array array result of partial data get_item
+ @return array modifie by module
+ */
+ public function get_option_data($_array){
+ if(isset($this->modules) && is_array($this->modules))
+ foreach ($this->modules as $key=>$module) {
+ if ( $module->enabled && (method_exists($module, 'get_option_data' ))) {
+ $_array=$this->modules[$key]->get_option_data($_array);
+ }
+ }
+ return $_array;
+ }
}
@@ -323,7 +393,7 @@
/**
@fn __construct()
- @brief Charge les module aca specifique au porduits
+ @brief load sub module specifical this type module
@param $key string la clef
@param $const string , le nom de la constante, si nommage non generic
*/
@@ -352,18 +422,18 @@
return self::$_instance;
}
- public static function factory($class){
- if (class_exists($class)){
- if(isset(self::$instance) && self::$instance instanceof $class) {
- return self::$instance;
- }
- self::$instance = new $class;
- return self::$instance;
+ public static function factory($class){
+ if (class_exists($class)){
+ if(isset(self::$instance) && self::$instance instanceof $class) {
+ return self::$instance;
+ }
+ self::$instance = new $class;
+ return self::$instance;
- } else {
- throw new Exception('Classe introuvable.');
- }
- }
+ } else {
+ throw new Exception('Classe introuvable.');
+ }
+ }
/**
Modified: trunk/catalog/includes/classes/drivers/data/categorie.php
===================================================================
--- trunk/catalog/includes/classes/drivers/data/categorie.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/includes/classes/drivers/data/categorie.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -374,7 +374,7 @@
*/
class categorieModule
extends AbstractAcaModule
- implements InterfaceAcaGene{
+/* implements InterfaceAcaGene*/{
/**
flag de la class
@@ -435,62 +435,12 @@
if(isset($this->modules) && is_array($this->modules))
foreach ($this->modules as $key=>$module) {
if ( $module->enabled && (method_exists($module, 'get_option_data' ))) {
- $_array=$this->modules[$key]->get_option_data($_array);
+ $_array=$this->modules[$key]->get_option_data($_array);
}
}
return $_array;
}
- /**
- * \brief Affiche module elemennt html
- * Block principal d'affichage, liste ou vue des élément. Block principal de page
- * @param $pID int $pID le Id du produits
- * @param @classe string le nom de la class appelé, ou vide pour toutes les class enfants
- */
- public function display_view($pID,$classe=''){
- global $page;
- if (!empty($classe)) {
- if (isset($this->modules[$classe]) && $this->modules[$classe]->enabled and (method_exists($classe, 'display_view' ))){
- $this->modules[$classe]->load_db_values($pID);
- return $this->modules[$classe]->display_view($pID);
- }
- } else {
- $c='';
- if(isset($this->modules) && is_array($this->modules))
- foreach ($this->modules as $key=>$module) {
- if (($module->enabled) and (method_exists($module, 'display_view' ))) {
- $this->modules[$key]->load_db_values($pID);
- $c .=$this->modules[$key]->display_view($pID);
- }
- }
- return $c;
- }
- }
- /**
- * \brief Affiche module display_view mini
- * @param $cID int cID le Id du customers
- * @param $class string class le nom de la class appelé, ou vide pour toutes les class enfants
- */
- public function display_view_min($cID,$class=''){
- global $page;
- if (!empty($class)) {
- if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($module, 'display_view_min' ))){
- $this->modules[$class]->load_db_values($cID);
- return $this->modules[$class]->display_view_min($cID);
- }
- } else {
- $c='';
- foreach ($this->modules as $key=>$module) {
- if (($module->enabled) and (method_exists($module, 'display_view_min' ))) {
- $this->modules[$key]->load_db_values($cID);
- $c .=$this->modules[$key]->display_view_min($cID);
- }
- }
- return $c;
- }
- }
-
-
}
?>
\ No newline at end of file
Modified: trunk/catalog/includes/classes/drivers/data/content.php
===================================================================
--- trunk/catalog/includes/classes/drivers/data/content.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/includes/classes/drivers/data/content.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -399,7 +399,7 @@
}
- /**
+ /**
@brief Champs extra product Recupere la totalite des element supplementaire generic.
Les chamsp appartenant à des modules ne sont pas chargée
[extra] => Array
@@ -528,8 +528,6 @@
abstract protected function display_view($pID,$class='');
abstract protected function load_db_values($pID);
abstract protected function get_header($action='');
- // méthode commune
-// public function printOut() { }
}
@@ -540,7 +538,7 @@
*/
class contentModule
extends AbstractAcaModule
- implements InterfaceAcaGene {
+/* implements InterfaceAcaGene */{
/**
@var string Les modules actif
@@ -579,59 +577,6 @@
return self::getInstance();
}
- /**
- * \fn display_view($pID,$class='',$exclude=array() )
- @brief Affiche module elemennt html
- Block principal d'affichage, liste ou vue des élément. Block principal de page
- @param $pID int le Id du produits
- @param $class string le nom de la class appelé, ou vide pour toutes les class enfants
- @param $exclude array
- */
- public function display_view($pID,$class='',$exclude=array() ){
- global $page;
- if (!empty($class)) {
- if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($class, 'display_view' ))){
- $this->modules[$class]->load_db_values($pID);
- return $this->modules[$class]->display_view($pID);
- }
- } else {
- $c=array();
- if(isset($this->modules) && is_array($this->modules))
- foreach ($this->modules as $key=>$module) {
- if ( !in_array($key,$exclude) && ($module->enabled) and (method_exists($module, 'display_view' ))) {
- $this->modules[$key]->load_db_values($pID);
- $c[$key]=$this->modules[$key]->display_view($pID);
- }
- }
- return $c;
- }
- }
-
- /**
- Affiche module display_view mini
-
- @param
- @a int cID le Id du customers
- @a string class le nom de la class appelé, ou vide pour toutes les class enfants
- */
- public function display_view_min($cID,$class=''){
- global $page;
- if (!empty($class)) {
- if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($module, 'display_view_min' ))){
- $this->modules[$class]->load_db_values($cID);
- return $this->modules[$class]->display_view_min($cID);
- }
- } else {
- $c='';
- foreach ($this->modules as $key=>$module) {
- if (($module->enabled) and (method_exists($module, 'display_view_min' ))) {
- $this->modules[$key]->load_db_values($cID);
- $c .=$this->modules[$key]->display_view_min($cID);
- }
- }
- return $c;
- }
- }
}
?>
\ No newline at end of file
Modified: trunk/catalog/includes/classes/drivers/data/product.php
===================================================================
--- trunk/catalog/includes/classes/drivers/data/product.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/includes/classes/drivers/data/product.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -668,8 +668,6 @@
abstract protected function display_view($pID,$class='');
abstract protected function load_db_values($pID);
abstract protected function get_header($action='');
- // méthode commune
-// public function printOut() { }
}
@@ -680,7 +678,7 @@
*/
class productModule
extends AbstractAcaModule
- implements InterfaceAcaGene{
+/* implements InterfaceAcaGene*/{
/**
flag de la class
@@ -742,15 +740,15 @@
/**
Get data modified/add by module
*/
- public function get_option_data($product_array){
- if(isset($this->modules) && is_array($this->modules))
- foreach ($this->modules as $key=>$module) {
- if ( $module->enabled && (method_exists($module, 'get_option_data' ))) {
- $product_array=$this->modules[$key]->get_option_data($product_array);
- }
- }
- return $product_array;
- }
+// public function get_option_data($product_array){
+// if(isset($this->modules) && is_array($this->modules))
+// foreach ($this->modules as $key=>$module) {
+// if ( $module->enabled && (method_exists($module, 'get_option_data' ))) {
+// $product_array=$this->modules[$key]->get_option_data($product_array);
+// }
+// }
+// return $product_array;
+// }
/**
Get price modified by module
@@ -761,7 +759,7 @@
if(isset($this->modules) && is_array($this->modules))
foreach ($this->modules as $key=>$module) {
if ( $module->enabled && isset($module->price) && $module->price && (method_exists($module, 'adjust_price' ))) {
- $product_array=$this->modules[$key]->adjust_price($product_array);
+ $product_array=$this->modules[$key]->adjust_price($product_array);
}
}
return $product_array;
@@ -776,49 +774,49 @@
@param $class string le nom de la class appelé, ou vide pour toutes les class enfants
@param $exclude array
*/
- public function display_view($pID,$class='',$exclude=array() ){
- global $page;
- if (!empty($class)) {
- if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($class, 'display_view' ))){
- $this->modules[$class]->load_db_values($pID);
- return $this->modules[$class]->display_view($pID);
- }
- } else {
- $c=array();
- if(isset($this->modules) && is_array($this->modules))
- foreach ($this->modules as $key=>$module) {
- if ( !in_array($key,$exclude) && ($module->enabled) and (method_exists($module, 'display_view' ))) {
- $this->modules[$key]->load_db_values($pID);
- $c[$key]=$this->modules[$key]->display_view($pID);
- }
- }
- return $c;
- }
- }
+// public function display_view($pID,$class='',$exclude=array() ){
+// global $page;
+// if (!empty($class)) {
+// if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($class, 'display_view' ))){
+// $this->modules[$class]->load_db_values($pID);
+// return $this->modules[$class]->display_view($pID);
+// }
+// } else {
+// $c=array();
+// if(isset($this->modules) && is_array($this->modules))
+// foreach ($this->modules as $key=>$module) {
+// if ( !in_array($key,$exclude) && ($module->enabled) and (method_exists($module, 'display_view' ))) {
+// $this->modules[$key]->load_db_values($pID);
+// $c[$key]=$this->modules[$key]->display_view($pID);
+// }
+// }
+// return $c;
+// }
+// }
/**
@brief Affiche module display_view mini
@param cID int le Id du customers
@param class string le nom de la class appelé, ou vide pour toutes les class enfants
*/
- public function display_view_min($cID,$class=''){
- global $page;
- if (!empty($class)) {
- if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($module, 'display_view_min' ))){
- $this->modules[$class]->load_db_values($cID);
- return $this->modules[$class]->display_view_min($cID);
- }
- } else {
- $c='';
- foreach ($this->modules as $key=>$module) {
- if (($module->enabled) and (method_exists($module, 'display_view_min' ))) {
- $this->modules[$key]->load_db_values($cID);
- $c .=$this->modules[$key]->display_view_min($cID);
- }
- }
- return $c;
- }
- }
+// public function display_view_min($cID,$class=''){
+// global $page;
+// if (!empty($class)) {
+// if (isset($this->modules[$class]) && $this->modules[$class]->enabled and (method_exists($module, 'display_view_min' ))){
+// $this->modules[$class]->load_db_values($cID);
+// return $this->modules[$class]->display_view_min($cID);
+// }
+// } else {
+// $c='';
+// foreach ($this->modules as $key=>$module) {
+// if (($module->enabled) and (method_exists($module, 'display_view_min' ))) {
+// $this->modules[$key]->load_db_values($cID);
+// $c .=$this->modules[$key]->display_view_min($cID);
+// }
+// }
+// return $c;
+// }
+// }
/**
* \fn display_titre($cID,$format='$s')
Modified: trunk/catalog/templates/defaut/includes/content/account.php
===================================================================
--- trunk/catalog/templates/defaut/includes/content/account.php 2013-12-26 09:27:46 UTC (rev 4986)
+++ trunk/catalog/templates/defaut/includes/content/account.php 2013-12-26 10:47:55 UTC (rev 4987)
@@ -6,6 +6,16 @@
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
@date 15/04/2012, 21:54
@encode UTF-8
+* \dir includes/content/
+* \page account
+* \brief account page support
+* \section Gestion des erreurs d'url
+* this page is called in all page account \n
+* For process create_account, this search file.gab nommed by 'createxxxxx' and xxx is current action \n
+* else, call file.gab ,named xxxx and xxxx is is current action \n
+* \li in folder gabarit, sub folder account for stock alll file.gab specific for user/customers manager/create
+* \li this heading is called current language folder and in account.txt
+*
*/
//
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-26 09:27:50
|
Revision: 4986
http://sourceforge.net/p/oscss/svn/4986
Author: oscim
Date: 2013-12-26 09:27:46 +0000 (Thu, 26 Dec 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/catalog/templates/defaut/includes/content/404.php
Added Paths:
-----------
trunk/catalog/templates/defaut/includes/gabarit/pages/404.gab
Modified: trunk/catalog/templates/defaut/includes/content/404.php
===================================================================
--- trunk/catalog/templates/defaut/includes/content/404.php 2013-12-24 10:52:21 UTC (rev 4985)
+++ trunk/catalog/templates/defaut/includes/content/404.php 2013-12-26 09:27:46 UTC (rev 4986)
@@ -16,15 +16,13 @@
* \li categorie caché, non visible ou supprimé
*
*/
-?>
-<header>
- <h1 class="content title <?php echo $language ;?>"><?php echo HEADING_TITLE; ?></h1>
-</header>
-<div id="page404">
+$SectionTplPC = new SectionTpl(
+ tep_output_string_protected(tep_get_include_contents('pages/404'),false,true) ,
+ HEADING_TITLE
+ );
- <div class="textMain"><?php echo TEXT_MAIN ; ?></div>
+?>
-</div>
\ No newline at end of file
Added: trunk/catalog/templates/defaut/includes/gabarit/pages/404.gab
===================================================================
--- trunk/catalog/templates/defaut/includes/gabarit/pages/404.gab (rev 0)
+++ trunk/catalog/templates/defaut/includes/gabarit/pages/404.gab 2013-12-26 09:27:46 UTC (rev 4986)
@@ -0,0 +1,14 @@
+<?php
+/**
+ @licence GPL 2005-2010 The osCSS developers - osCSS Open Source E-commerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.2
+ @date 18/12/2013, 08:18
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+*/
+?>
+
+<div id="page404">
+ <div class="textMain"><?php echo TEXT_MAIN ; ?></div>
+</div>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-24 10:52:24
|
Revision: 4985
http://sourceforge.net/p/oscss/svn/4985
Author: oscim
Date: 2013-12-24 10:52:21 +0000 (Tue, 24 Dec 2013)
Log Message:
-----------
Fix bug init action js ajax called in context no detailrow
Modified Paths:
--------------
trunk/catalog/admin/includes/header.php
Modified: trunk/catalog/admin/includes/header.php
===================================================================
--- trunk/catalog/admin/includes/header.php 2013-12-23 10:52:35 UTC (rev 4984)
+++ trunk/catalog/admin/includes/header.php 2013-12-24 10:52:21 UTC (rev 4985)
@@ -21,6 +21,7 @@
if( ($css=tep_test_gab_ele("jquery-ui",'css')) !=false ) tep_include_file ($css,true);
// lasted
+// tep_include_file ('../ext/jquery/'."jquery.min.js",true);
tep_include_file (DIR_WS_JS."jquery.min.js",true);
// specifique lib for core osCSS
@@ -84,7 +85,7 @@
if ( this.src.match('details_close') )
{
/* This row is already open - close it */
- this.src = "<?php echo tep_get_http().DIR_WS_ADMIN.DIR_WS_ICONS ?>details_open.png";
+ this.src = "<?php echo tep_get_http().DIR_WS_TEMPLATE . "/img/".$_SESSION['login_groups_id'].'/' ?>details_open.png";
/* fnClose doesn't do anything for server-side processing - do it ourselves :-) */
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
@@ -92,7 +93,7 @@
else {
var aData = oTable.fnGetData( nTr );
/* Open this row */
- this.src = "<?php echo tep_get_http().DIR_WS_ADMIN.DIR_WS_ICONS ?>details_close.png";
+ this.src = "<?php echo tep_get_http().DIR_WS_TEMPLATE . "/img/".$_SESSION['login_groups_id'].'/' ?>details_close.png";
var res = '<table id="detail_'+aData[0] +'" cellpadding="5" cellspacing="0" border="0" style="padding:0 1em; width:100%;">' + '</table>';
oTable.fnOpen( nTr, res , 'details' );
@@ -175,6 +176,7 @@
<?php else: ?>
// "fnInitComplete":post_load_page(),
"fnDrawCallback": function () {
+ post_load_page();
},
<?php endif; ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-23 10:52:39
|
Revision: 4984
http://sourceforge.net/p/oscss/svn/4984
Author: oscim
Date: 2013-12-23 10:52:35 +0000 (Mon, 23 Dec 2013)
Log Message:
-----------
Fix generat code
add extra in action search for data content
Modified Paths:
--------------
trunk/catalog/common/classes/datatype_drivers/Data_content.php
trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php
trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php.modele2
trunk/dev/GenerCode/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php
trunk/dev/GenerCode/datatype/Modele/install.xml
Added Paths:
-----------
trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php
Removed Paths:
-------------
trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php
trunk/dev/GenerCode/datatype/Modele/catalog/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php
Modified: trunk/catalog/common/classes/datatype_drivers/Data_content.php
===================================================================
--- trunk/catalog/common/classes/datatype_drivers/Data_content.php 2013-12-23 10:02:30 UTC (rev 4983)
+++ trunk/catalog/common/classes/datatype_drivers/Data_content.php 2013-12-23 10:52:35 UTC (rev 4984)
@@ -218,6 +218,18 @@
case 'search':
global $keywords, $search_keywords, $pto, $dto, $pfrom, $dfrom;
+
+ // calcul extra actived for search
+ $allextraactived = array();
+ $query = $DB->query("SELECT fields_id as id, fields_value_list as value_list, fields_active_value_language FROM " . TABLE_EXTRA_FIELDS . " WHERE fields_type='content' AND fields_status = '1' AND fields_advanced_search = '1' ");
+ $allextraactived = $query->fetchAllAssoc();
+
+ foreach($allextraactived as $row)
+ if($row['value_list'] == 0)
+ $use_value_list[] = false;
+ else
+ $use_value_list[] = true;
+
$this->listing_sql['col_count'] = " ".$this->p.".content_id ";
$this->listing_sql['tables'] = " FROM " . TABLE_CONTENT . " ".$this->p." ";
@@ -226,6 +238,14 @@
$this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_CATEGORIES . " cat ON( ".$this->p."2c.categories_id = cat.categories_id and cat.categories_status='1' ) ";
+ /// Add search in Extra value
+ $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_EXTRA_FIELDS_TO . " p2pef ON(p2pef.data_id = p.products_id AND p2pef.data_type = 'content') ";
+
+ if(in_array(true, (array)$use_value_list))
+ $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_EXTRA_FIELDS_VALUES . " pefv ON(pefv.fields_id = p2pef.fields_id AND ( pefv.languages_id = '" . (int)$languages_id . "' OR pefv.languages_id = '0' ) ) ";
+
+
+
$this->listing_sql['where'] = " WHERE ".DataForceStatus(" ".$this->p.".content_status='1' ")." AND ".$this->p.".content_type = '" . (isset($_REQUEST['subtype'])? (int)$_REQUEST['subtype'] : 1) . "' AND ".$this->p."d.content_title <>'' ";
if (isset($_GET['categories_id']) && tep_not_null($_GET['categories_id'])) {
@@ -272,7 +292,19 @@
if (tep_not_null($dto)) $this->listing_sql['where'] .= " and ".$this->p.".date_added <= '" . tep_date_raw($dto) . "'";
+ /// Add search in Extra value
+ if(count($allextraactived) > 0){
+ $tmp = '';
+ foreach($allextraactived as $row) {
+ if($row['epf_uses_value_list'] == 0)
+ $tmp .= " OR ( p2pef.fields_id = '".$row['id']."' AND p2pef.value like '%" . tep_db_input($keyword) . "%' ) ";
+ else
+ $tmp .= " OR ( pefv.value_id= p2pef.value AND pefv.fields_id = '".$row['id']."' AND pefv.fields_value like '%" . tep_db_input($keyword) . "%' ) ";
+ }
+ $this->listing_sql['where'] .= " OR ( " . substr($tmp, 3) . " ) ";
+ }
+
$this->listing_sql['sort'] = " ".$this->p."d.content_title ";
return $this;
Deleted: trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php 2013-12-23 10:02:30 UTC (rev 4983)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/classes/drivers/sql_DATATYPE_REPLACE_extrafields.php 2013-12-23 10:52:35 UTC (rev 4984)
@@ -1,629 +0,0 @@
-<?php if (!defined('HTTP_SERVER')) die('You can not access this file directly!');
-/**
- @licence GPL 2005-_CURRENTYEAR_ The osCSS developers - osCSS Open Source E-commerce
- @portion code Copyright (c) 2002 osCommerce
- @package osCSS-2 <www http://www.oscss.org>
- @version _CURRENTVERSION_
- @date _CURRENTDATE_
- @author genrated by GenerCode
- @encode UTF-8
- @class sql_DATATYPE_REPLACE_extrafields
- @file sql_DATATYPE_REPLACE_extrafields.php
-
-*/
-
-class sql_DATATYPE_REPLACE_extrafields
- implements ModSqlDataDriver{
-
- public static $modules;
-
- protected static $_instance;
-
- protected function __construct(){
- }
-
-
- public static function getInstance() {
- if(self::$_instance == null) self::$_instance = new self();
- return self::$_instance;
- }
-
-
- /**
- @brief create new ligne in table configuration
- */
- public static function create($option){
- self::getInstance();
-
-
- $sql_data_array['epf_order'] =(isset($option['order']))? tep_db_prepare_input($option['order']) : 0 ;
- $sql_data_array['epf_status'] =(isset($option['status']))? tep_db_prepare_input($option['status']) : 0;
- $sql_data_array['epf_input_type'] =(isset($option['input_type'])) ? tep_db_prepare_input($option['input_type']) : 0;
- $sql_data_array['epf_advanced_search'] =(isset($option['advanced_search']))? tep_db_prepare_input($option['advanced_search']): 0;
- $sql_data_array['epf_show_in_listing'] = (isset($option['show_in_listing'])) ? tep_db_prepare_input($option['show_in_listing']): 0;
- $sql_data_array['epf_use_as_meta_keyword'] =(isset($option['use_as_meta_keyword']))? tep_db_prepare_input($option['use_as_meta_keyword']): 0;
- $sql_data_array['epf_use_to_restrict_listings'] = (isset($option['use_to_restrict_listings'])) ? tep_db_prepare_input($option['use_to_restrict_listings']): 0;
- $sql_data_array['epf_admin'] =(isset($option['admin']))? tep_db_prepare_input($option['admin']) : 0;
-
- if(isset($option['size'])) $sql_data_array['epf_size'] = tep_db_prepare_input($option['size']);
- if(isset($option['show_parent_chain'])) $sql_data_array['epf_show_parent_chain'] = tep_db_prepare_input($option['show_parent_chain']);
- if(isset($option['key'])) $sql_data_array['epf_key'] = tep_db_prepare_input($option['key']);
- if(isset($option['special_mod'])) $sql_data_array['epf_special_mod'] = tep_db_prepare_input($option['special_mod']);
- if(isset($option['active_value_language'])) $sql_data_array['epf_active_value_language'] = tep_db_prepare_input($option['active_value_language']);
-
-
- $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS, $sql_data_array);
-
- if(!$res)
- return $res;
- else
- return $res->__get('insertId');
- }
-
- /**
- @brief update ligne in table configuration
- @note for update key, use new_key in key array $option
- this key is use in where clause
- */
- public static function update($option){
- self::getInstance();
-
- if(!isset($option['id']))
- return false;
-
- $where ='';
- if(isset($option['id'])) $where .="AND epf_id = '".(int)$option['id']."' ";
- if(isset($option['key'])) $where .="AND epf_key = '".(int)$option['key']."' ";
-
- if($where=='')
- return false;
-
- if(isset($option['order']))$sql_data_array['epf_order'] = tep_db_prepare_input($option['order']);
- if(isset($option['status'])) $sql_data_array['epf_status'] = tep_db_prepare_input($option['status']);
-// if(isset($option['uses_value_list'])) $sql_data_array['epf_input_type'] = tep_db_prepare_input($option['uses_value_list']);
- if(isset($option['advanced_search'])) $sql_data_array['epf_advanced_search'] = tep_db_prepare_input($option['advanced_search']);
- if(isset($option['show_in_listing']))$sql_data_array['epf_show_in_listing'] = tep_db_prepare_input($option['show_in_listing']);
- if(isset($option['size'])) $sql_data_array['epf_size'] = tep_db_prepare_input($option['size']);
- if(isset($option['use_as_meta_keyword'])) $sql_data_array['epf_use_as_meta_keyword'] = tep_db_prepare_input($option['use_as_meta_keyword']);
- if(isset($option['use_to_restrict_listings'])) $sql_data_array['epf_use_to_restrict_listings'] = tep_db_prepare_input($option['use_to_restrict_listings']);
- if(isset($option['show_parent_chain'])) $sql_data_array['epf_show_parent_chain'] = tep_db_prepare_input($option['show_parent_chain']);
- if(isset($option['new_key'])) $sql_data_array['epf_key'] = tep_db_prepare_input($option['new_key']);
- if(isset($option['admin'])) $sql_data_array['epf_admin'] = (string)tep_db_prepare_input($option['admin']);
- if(isset($option['special_mod'])) $sql_data_array['epf_special_mod'] = tep_db_prepare_input($option['special_mod']);
- if(isset($option['active_value_language'])) $sql_data_array['epf_active_value_language'] = tep_db_prepare_input($option['active_value_language']);
-// print_r($option);
- $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS, $sql_data_array, 'update' , substr($where,3) );
-
- return $res;
- }
-
- /**
- @brief load ligne in table configuration
- @param option array
- id => row id int (configuration_id)
- key => string key (configuration_key)
- group_id => group_id int (configuration_group_id)
- @param $shortkey use cleankey for return short key
- @return
-
- object(stdClass)[13]
- public 'id' => string '1' (length=1)
-
- OR
- array(
- object(stdClass)[13]
- ...
- object(stdClass)[13]
- ..
- )
-
- */
- public static function fetch($option,$shortkey=false){
- self::getInstance();
- $DB=Database::getInstance();
-
- $sql ="";
- if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
- if(isset($option['key'])) $sql .="AND epf_key = '".(int)$option['key']."' ";
-
-
- if($sql=='')
- return false;
-
-
- $sql="SELECT * FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " a ".
-// " LEFT JOIN " . TABLE_IMAGES_USED . " g ON (a.rowid=g.rowid) ".
- " WHERE ".substr($sql,3);
-
-// echo $sql;
- $res=$DB->query($sql);
-
- $num = $res->__get('numRows');
-
- if($num == 1){
- $result=$res->fetchAssoc();
- return ((!$shortkey)? $result : self::CleanKey($result));
- }
- elseif($num > 1){
- $array=array();
-
- foreach($res->fetchAllAssoc() as $result)
- $array[]= ((!$shortkey)? $result : self::CleanKey($result));
-
- return $array;
- }
-
- return false;
- }
-
- /**
- @brief delete row
- */
- public static function delete($option){
- self::getInstance();
- $DB=Database::getInstance();
-
- $sql ="";
-
- if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
- if(isset($option['key'])) $sql .="AND epf_key = '".(int)$option['key']."' ";
-
-
- if(strlen($sql) < 5)
- return false;
-
- $res = $DB->query($s="SELECT epf_id FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS ." WHERE ". substr($sql,3) );
-
- $row=$res->fetchAssoc();
-
- // depend tables
- sql_DATATYPE_REPLACE_extrafieldslabels::delete(array('id'=>$row['epf_id']));
-
- sql_DATATYPE_REPLACE_extrafieldsvalues::delete(array('id'=>$row['epf_id']));
-
-
- $DB->query($s="DELETE FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS ." WHERE ". substr($sql,3) );
-
- return true;
- }
-
- /**
- @brief
- @return array product empty
- */
- public static function Specimen($shortkey=false){
- $par = array(
- 'epf_id' => 0,
- 'epf_order' => 5,
- 'epf_status' => 0,
- 'epf_input_type' => 0,
- 'epf_advanced_search' => '',
- 'epf_show_in_listing' => '',
- 'epf_size' => 0,
- 'epf_use_as_meta_keyword' => '',
- 'epf_use_to_restrict_listings' => '',
- 'epf_show_parent_chain' => '',
- 'epf_active_value_language' => 0,
- 'epf_key' => '',
- 'epf_admin' => 0,
- 'epf_special_mod' => '',
- );
-
- return ((!$shortkey)? $par : self::CleanKey($par));
- }
-
-
-
- /**
- @fn CleanKey()
- @brief Clean string name key
- */
- private static function CleanKey($array){
- self::getInstance();
- $object= new stdclass();
-
- foreach($array as $key=>$value){
- if( strpos($key,'epf_') ===0)
- $key=substr($key,4);
-
- $object->$key = $value;
- }
-
- return $object;
- }
-
-}
-
-
-class sql_DATATYPE_REPLACE_extrafieldslabels
- implements ModSqlDataDriver{
-
- public static $modules;
-
- protected static $_instance;
- /**
- @var format for display line input
- */
- protected static $format = '%label% %input% %unit%';
-
- protected function __construct(){
- }
-
-
- public static function getInstance() {
- if(self::$_instance == null) self::$_instance = new self();
- return self::$_instance;
- }
-
-
- /**
- @brief create new ligne in table configuration
- */
- public static function create($option){
- self::getInstance();
-
- if(!isset($option['id']))
- return 'id';
-
- $sql_data_array['epf_id'] = tep_db_prepare_input($option['id']);
- $sql_data_array['languages_id'] =(isset($option['languages_id']))? tep_db_prepare_input($option['languages_id']) : 0;
-// $sql_data_array['epf_active_for_language'] =(isset($option['active_for_language']))? tep_db_prepare_input($option['active_for_language']): 0;
-
- $sql_data_array['epf_label'] =(isset($option['label'])) ? tep_db_prepare_input($option['label']) : '';
- $sql_data_array['epf_format'] =(isset($option['format']) && !empty($option['format']) )? tep_db_prepare_input($option['format']): self::$format ;
-
-
- if(isset($option['label_help'])) $sql_data_array['epf_label_help'] = tep_db_prepare_input($option['label_help']);
-
-
- $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS, $sql_data_array);
-
- if(!$res)
- return $res;
- else
- return $res->__get('insertId');
- }
-
- /**
- @brief update ligne in table configuration
- */
- public static function update($option){
- self::getInstance();
-
- if(!isset($option['id']))
- return false;
-
- $where ='';
- if(isset($option['id'])) $where .="AND epf_id = '".(int)$option['id']."' ";
- if(isset($option['languages_id'])) $where .="AND languages_id = '".(int)$option['languages_id']."' ";
-
- if($where=='')
- return false;
-
-// if(isset($option['active_for_language'])) $sql_data_array['epf_active_for_language'] = tep_db_prepare_input($option['active_for_language']);
- if(isset($option['label'])) $sql_data_array['epf_label'] = tep_db_prepare_input($option['label']);
- if(isset($option['label_help'])) $sql_data_array['epf_label_help'] = tep_db_prepare_input($option['label_help']);
-
- $sql_data_array['epf_format'] =(isset($option['format']) && !empty($option['format']) )? tep_db_prepare_input($option['format']): self::$format ;
-
- $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS, $sql_data_array, 'update' , substr($where,3) );
-
- return $res;
- }
-
- /**
- @brief load ligne in table configuration
- @param option array
- id => row id int (configuration_id)
- key => string key (configuration_key)
- group_id => group_id int (configuration_group_id)
- @param $shortkey use cleankey for return short key
- @return
-
- object(stdClass)[13]
- public 'id' => string '1' (length=1)
-
- OR
- array(
- object(stdClass)[13]
- ...
- object(stdClass)[13]
- ..
- )
-
- */
- public static function fetch($option,$shortkey=false){
- self::getInstance();
- $DB=Database::getInstance();
-
- $sql ="";
- if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
- if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
-
-
- if($sql=='')
- return false;
-
-
- $sql="SELECT * FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS . " a ".
-// " LEFT JOIN " . TABLE_IMAGES_USED . " g ON (a.rowid=g.rowid) ".
- " WHERE ".substr($sql,3);
-
- $res=$DB->query($sql);
-
- $num = $res->__get('numRows');
-
- if($num == 1){
- $result=$res->fetchAssoc();
- return ((!$shortkey)? $result : self::CleanKey($result));
- }
- elseif($num > 1){
- $array=array();
-
- foreach($res->fetchAllAssoc() as $result)
- $array[]= ((!$shortkey)? $result : self::CleanKey($result));
-
- return $array;
- }
-
- return false;
- }
-
- /**
- @brief delete row
- */
- public static function delete($option){
- self::getInstance();
- $DB=Database::getInstance();
-
- $sql ="";
-
- if(isset($option['id'])) $sql .="AND epf_id = '".(int)$option['id']."' ";
- if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
-
-
- if(strlen($sql) < 5)
- return false;
-
- $DB->query($s="DELETE FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS ." WHERE ". substr($sql,3) );
-
- return true;
- }
-
- /**
- @brief
- @return array product empty
- */
- public static function Specimen($shortkey=false){
- $par = array(
- 'epf_id' => 0,
- 'languages_id' => 0,
- 'epf_label' => '',
-// 'epf_active_for_language' => false,
- 'epf_label_help' => '',
- 'epf_format' => '%label% %input% %unit%',
- );
-
- return ((!$shortkey)? $par : self::CleanKey($par));
- }
-
-
-
- /**
- @fn CleanKey()
- @brief Clean string name key
- */
- private static function CleanKey($array){
- self::getInstance();
- $object= new stdclass();
-
- foreach($array as $key=>$value){
- if( strpos($key,'epf_') ===0)
- $key=substr($key,4);
-
- $object->$key = $value;
- }
-
- return $object;
- }
-
-}
-
-
-
-
-class sql_DATATYPE_REPLACE_extrafieldsvalues
- implements ModSqlDataDriver{
-
- public static $modules;
-
- protected static $_instance;
-
- protected function __construct(){
- }
-
-
- public static function getInstance() {
- if(self::$_instance == null) self::$_instance = new self();
- return self::$_instance;
- }
-
-
- /**
- @brief create new ligne in table configuration
- */
- public static function create($option){
- self::getInstance();
-
- if(!isset($option['epf_id']))
- return 'epf_id';
-
- $DB=Database::getInstance();
- $sql="SELECT COUNT(*) as id FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES . " a ". " GROUP BY epf_id ";
- $query = $DB->query($sql);
- $res = $query->fetchAssoc();
-
- $sql_data_array['value_id'] = tep_db_prepare_input($res['id']);
-
- $sql_data_array['epf_id'] = tep_db_prepare_input($option['id']);
- $sql_data_array['languages_id'] =(isset($option['languages_id']))? tep_db_prepare_input($option['languages_id']) : 0;
-
-
- $sql_data_array['epf_value'] =(isset($option['value'])) ? tep_db_prepare_input($option['value']) : '';
- $sql_data_array['parent_id'] =(isset($option['parent_id']))? tep_db_prepare_input($option['parent_id']): 0;
- $sql_data_array['sort_order'] =(isset($option['sort_order'])) ? tep_db_prepare_input($option['sort_order']) :0;
-
-
- $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES, $sql_data_array);
-
- if(!$res)
- return $res;
- else
- return $sql_data_array['value_id'];
- }
-
- /**
- @brief update ligne in table configuration
- */
- public static function update($option){
- self::getInstance();
-
- if(!isset($option['epf_id']))
- return false;
-
- $sql ='';
- if(isset($option['id'])) $sql .="AND value_id = '".(int)$option['id']."' ";
- if(isset($option['epf_id'])) $sql .="AND epf_id = '".(int)$option['epf_id']."' ";
- if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
- if(isset($option['parent_id'])) $sql .="AND parent_id = '".(int)$option['parent_id']."' ";
-
- if($sql=='')
- return false;
-
-
- if(isset($option['value'])) $sql_data_array['epf_value'] = tep_db_prepare_input($option['value']);
- if(isset($option['sort_order'])) $sql_data_array['sort_order'] = tep_db_prepare_input($option['sort_order']);
-
-
- $res=tep_db_perform(TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES, $sql_data_array, 'update' , substr($sql,3) );
-
- return $res;
- }
-
- /**
- @brief load ligne in table configuration
- @param option array
- id => row id int (configuration_id)
- key => string key (configuration_key)
- group_id => group_id int (configuration_group_id)
- @param $shortkey use cleankey for return short key
- @return
-
- object(stdClass)[13]
- public 'id' => string '1' (length=1)
-
- OR
- array(
- object(stdClass)[13]
- ...
- object(stdClass)[13]
- ..
- )
-
- */
- public static function fetch($option,$shortkey=false){
- self::getInstance();
- $DB=Database::getInstance();
-
- $sql ="";
- if(isset($option['id'])) $sql .="AND value_id = '".(int)$option['id']."' ";
- if(isset($option['epf_id'])) $sql .="AND epf_id = '".(int)$option['epf_id']."' ";
- if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
- if(isset($option['parent_id'])) $sql .="AND parent_id = '".(int)$option['parent_id']."' ";
-
-
- if($sql=='')
- return false;
-
-
- $sql="SELECT * FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES . " a ".
- " WHERE ".substr($sql,3)." ORDER BY sort_order ASC";
-
- $res=$DB->query($sql);
-
- $num = $res->__get('numRows');
-
- if($num == 1){
- $result=$res->fetchAssoc();
- return ((!$shortkey)? $result : self::CleanKey($result));
- }
- elseif($num > 1){
- $array=array();
-
- foreach($res->fetchAllAssoc() as $result)
- $array[]= ((!$shortkey)? $result : self::CleanKey($result));
-
- return $array;
- }
-
- return false;
- }
-
- /**
- @brief delete row
- */
- public static function delete($option){
- self::getInstance();
- $DB=Database::getInstance();
-
- $sql ="";
-
- if(isset($option['id'])) $sql .="AND value_id = '".(int)$option['id']."' ";
- if(isset($option['epf_id'])) $sql .="AND epf_id = '".(int)$option['epf_id']."' ";
- if(isset($option['languages_id'])) $sql .="AND languages_id = '".(int)$option['languages_id']."' ";
- if(isset($option['parent_id'])) $sql .="AND parent_id = '".(int)$option['parent_id']."' ";
-
- if(strlen($sql) < 5)
- return false;
-
- $DB->query($s="DELETE FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES ." WHERE ". substr($sql,3) );
-
- return true;
- }
-
- /**
- @brief
- @return array product empty
- */
- public static function Specimen($shortkey=false){
- $par = array(
- 'value_id' => 0 ,
- 'epf_id' => 0,
- 'languages_id' => 0,
- 'parent_id' => 0,
- 'sort_order' => 0,
- 'epf_value' => '',
- );
-
- return ((!$shortkey)? $par : self::CleanKey($par));
- }
-
-
-
- /**
- @fn CleanKey()
- @brief Clean string name key
- */
- private static function CleanKey($array){
- self::getInstance();
- $object= new stdclass();
-
- foreach($array as $key=>$value){
- $object->$key = $value;
- }
-
- return $object;
- }
-
-}
-?>
\ No newline at end of file
Copied: trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php (from rev 4968, trunk/dev/GenerCode/datatype/Modele/catalog/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php)
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php (rev 0)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/admin/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php 2013-12-23 10:52:35 UTC (rev 4984)
@@ -0,0 +1,470 @@
+<?php
+/**
+ @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version _CURRENTVERSION_
+ @date _CURRENTDATE_
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @class modextra_DATATYPE_REPLACE_
+ @brief Champs supplementaire
+*/
+
+define('FILENAME_CFG',"gparentID=120&gID=".$_GET['gID']);
+
+Class modextra_DATATYPE_REPLACE_{
+ const FILENAME = FILENAME_CONFIGURATION;
+ /**
+ @var object
+ */
+ public static $fInfo;
+ /**
+ @var object
+ */
+ public static $split;
+ /**
+ @var array
+ */
+ public static $list;
+ /**
+ @var int
+ */
+ public static $id;
+ /**
+ @var int
+ */
+ public static $fields_query_numrows;
+ /**
+ @var string current action
+ */
+ public static $action;
+ /**
+ @var object
+ */
+ public static $InitInfo;
+
+ /**
+ */
+ function __construct(){
+ $this->code=__CLASS__;
+
+ global $messageStack, $language ,$oscss;
+ $oscss=oscss_cstr::getInstance();
+
+ $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/ExtraFields.txt');
+ $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/modules/configuration/'.$this->code.'.txt');
+
+ self::$id=(isset($_GET['id'])?$_GET['id']:'');
+ self::$action=(isset($_GET['action'])?$_GET['action']:'listing');
+
+ // instance Factory Extra
+ new sqlextrafieldsFactory('_DATATYPE_REPLACE_');
+
+ $this->EFL = new ExtraFieldsListener($this->code, self::FILENAME);
+
+
+ //! @remarks Force load language centralised
+ global $oscss,$language, $languages_id;
+ $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/modules/filters.txt');
+
+
+ if(isset($_SESSION['filters'][__CLASS__]['language_id']))
+ $new_languages_id = $_SESSION['filters'] [__CLASS__]['language_id'];
+ else
+ $new_languages_id =$languages_id;
+
+ $_SESSION['filters']['language_id'] = $new_languages_id;
+
+ /**
+ @remarks Active forms filter
+ */
+ self::$InitInfo['tfilter']['listing']=array(
+ array(
+ 'title'=>__('@modprodextra filter tab clause'),
+ '_DATATYPE_REPLACE_'=>tep_get_include__DATATYPE_REPLACE_s('MGabCont/filter.language'),
+ ),
+// array(
+// 'title'=>__('@products filter tab clause'),
+// '_DATATYPE_REPLACE_'=>tep_get_include__DATATYPE_REPLACE_s('configuration/'.__CLASS__.'/filter.clause'),
+// ),
+ );
+ }
+
+
+ /**
+ @fn draw_action()
+ @brief Action en remplacement des action par defaut
+ */
+ public function draw_action(){
+ global $action,$messageStack;
+
+ $DB=Database::getInstance();
+
+ switch ($action) {
+
+ /**
+ @remarks specific save in session value filters
+ */
+ case 'filters':
+ $_SESSION['filters'] =array();
+
+ if(isset($_POST['filters']['language'] ) )
+ $_SESSION['filters'][__CLASS__]['language_id'] = (int)$_POST['filters']['language'];
+
+
+ tep_redirect(tep_href_link(self::FILENAME, FILENAME_CFG));
+ break;
+
+ case 'insert':
+ case 'update':
+
+
+ $sql_data_array = array(
+ 'status' => 1,
+
+ 'input_type' => tep_db_prepare_input($_POST['fields_input_type']),
+ 'input_value' => tep_db_prepare_input($_POST['fields_input_value']),
+ 'required_status'=> tep_db_prepare_input($_POST['fields_required_status']),
+ 'size' => tep_db_prepare_input($_POST['fields_size']),
+
+ 'sort' => tep_db_prepare_input($_POST['sort_order']),
+ 'required_email' => tep_db_prepare_input($_POST['fields_required_email']),
+ 'key' => tep_db_prepare_input($_POST['key']),
+ 'admin' => tep_db_prepare_input($_POST['admin']),
+ 'special_mod' => tep_db_prepare_input($_POST['special_mod']),
+ 'group_class' => tep_db_prepare_input($_POST['fields_group_class'])
+ );
+
+ if (self::$id > 0){
+ $fields_id = tep_db_prepare_input(self::$id);
+
+ if ( (bool)sqlextrafieldsFactory::fetch(array('id'=>$fields_id)) ){
+ $sql_data_array['new_key']=$sql_data_array['key'];
+ unset($sql_data_array['key']);
+ $sql_data_array['id']=$fields_id;
+
+ if( ! sqlextrafieldsFactory::update( $sql_data_array ) )
+ $messageStack->add_session(__('error update for extra fields'), 'error');
+ else
+ $messageStack->add_session(__('succes update for extra fields'), 'success');
+ }
+ }
+ else{
+ if( ! $fields_id = sqlextrafieldsFactory::create($sql_data_array) )
+ $messageStack->add_session(__('error create for extra fields'), 'error');
+ else
+ $messageStack->add_session(__('succes create for extra fields'), 'success');
+ }
+
+
+
+ if($fields_id) {
+
+
+
+ foreach( tep_get_languages() as $rows){
+ $language_id = $rows['id'];
+
+ $data_array = array(
+ 'id' => $fields_id,
+ 'languages_id' => $language_id,
+ 'name' => tep_db_prepare_input($_POST['fields_label'][$language_id]),
+ 'format' => tep_db_prepare_input($_POST['fields_format'][$language_id]),
+ );
+
+ if(! sqlextrafieldslabels::fetch($data_array) ){
+ if( ! sqlextrafieldslabels::create($data_array) )
+ $messageStack->add_session(__('error create for extra fields label'), 'error');
+ else
+ $messageStack->add_session(__('succes create for extra fields label'), 'success');
+ }
+ else{
+ if (! sqlextrafieldslabels::update($data_array) )
+ $messageStack->add_session(__('error update for extra fields label'), 'error');
+ else
+ $messageStack->add_session(__('succes update for extra fields label'), 'success');
+ }
+ }
+
+
+ if(isset($_POST['up_and_close']) )
+ tep_redirect(tep_href_link(FILENAME_CONFIGURATION, FILENAME_CFG));
+ else
+ tep_redirect(tep_href_link(FILENAME_CONFIGURATION, FILENAME_CFG.'&action=edit&id=' . $fields_id));
+ }
+
+ tep_redirect(tep_href_link(FILENAME_CONFIGURATION, FILENAME_CFG ));
+ break;
+
+ /**
+ @remarks quick action
+ */
+ case 'deleteconfirm':
+
+
+
+ $fields_id = tep_db_prepare_input(self::$id);
+
+ tep_db_query("delete from " . TABLE_EXTRA_FIELDS_LABELS . " where fields_id = '" . (int)$fields_id . "'");
+ tep_db_query("delete from " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where fields_id = '" . (int)$fields_id . "'");
+
+
+ sqlextrafieldsFactory::delete( array('id'=>$fields_id) );
+
+ tep_redirect(tep_href_link(FILENAME_CONFIGURATION, tep_get_all_get_params(array('action'),false) ));
+ break;
+
+ /**
+ @remarks quick action
+ */
+ case 'setflag':
+
+
+
+ if(isset($_GET['flag']) )
+ if( !sqlextrafieldsFactory::update(array('id'=>(int)self::$id ,'status'=>(int)tep_db_prepare_input($_GET['flag']) )) )
+ $messageStack->add_session(__('error update for extra fields'), 'error');
+
+ if(!isset($_GET['forceajax']))
+ tep_redirect(tep_href_link(FILENAME_CONFIGURATION, tep_get_all_get_params(array('action'),false)));
+ break;
+
+
+
+ }
+
+ }
+
+ /**
+ */
+ public function load_db_values(){
+ global $action,$languages_id,$messageStack;
+ $list = array();
+
+ switch($action){
+ case 'new':
+
+
+ $fields=sqlextrafieldsFactory::Specimen(true);
+
+ foreach( tep_get_languages() as $rows){
+
+ $language_id = $rows['id'];
+ $fields->lg[$language_id] = new objectInfo(sqlextrafieldslabels::Specimen());
+ }
+
+ return $list = self::$fInfo = $fields;
+ break;
+
+ case 'delete':
+ case 'edit':
+ $res = sqlextrafieldsFactory::fetch(array('id'=>(int)self::$id ), true);
+
+ $r = sqlextrafieldslabels::fetch(array('id'=>(int)self::$id ));
+
+ if(!isset($r[0]))
+ $result[] = $r ;
+ else
+ $result = $r ;
+
+ foreach($result as $row)
+ $res->lg[$row['languages_id']] = new objectInfo($row);
+
+ $list =$res;
+ break;
+
+ default:
+
+ self::$fields_query_numrows=0;
+ $this->fields_query_raw = "select ce.*, cei.* from " . TABLE_EXTRA_FIELDS . " ce, " . TABLE_EXTRA_FIELDS_LABELS . " cei WHERE ce.fields_type ='_DATATYPE_REPLACE_' AND cei.fields_id=ce.fields_id and cei.languages_id =" . (int)$languages_id;
+// self::$split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $this->fields_query_raw, self::$fields_query_numrows);
+ $this->fields_query = tep_db_query($this->fields_query_raw);
+
+ $list=self::FormatDBValue($this->fields_query);
+
+ }
+ return $list;
+ }
+
+ /**
+ Appelé dans le header de page
+ */
+ public static function draw_header(){
+ }
+
+ /**
+ Contenu central
+ */
+ public function draw(){
+ global $action,$gparentID,$current_theme, $EFL;
+
+ $EFL = $this->EFL;
+
+
+ switch($action){
+ /**
+ @remarks Ajax View result
+ */
+ case 'setflag':
+ return self::get_item_status(new objectInfo(array('fields_status'=>(int)$_GET['flag'], 'fields_id'=>(int)$_GET['id'])) );
+ break;
+
+
+ /**
+ @remarks Normal View Page
+ */
+
+ case 'delete':
+ $item = $this->load_db_values();
+
+ $EFL->SetId( self::$id );
+ $EFL->SetUsesValueList($item->value_list);
+ $EFL->SetActiveValueLanguage($item->active_value_language);
+// $EFL->SetRequiredStatus((int)$item->required_status);
+// $EFL->SetInputSize($item->size);
+// $EFL->SetSort($item->sort);
+// $EFL->SetAdmin($item->admin);
+// $EFL->SetKey($item->key);
+// $EFL->SetSpecialMod($item->special_mod);
+
+ $EFL->SetLabel($item->lg);
+// $EFL->SetFormat($item->lg);
+// $EFL->SetLanguageId($item->lg);
+// $EFL->SetUnityId($item->lg);
+// $EFL->SetUnityTypeId($item->lg);
+
+ $gab = 'label.'.'delete';
+ break;
+ case 'new':
+ case 'edit':
+ $item = $this->load_db_values();
+
+ $EFL->SetId( self::$id );
+ $EFL->SetUsesValueList($item->value_list);
+ $EFL->SetActiveValueLanguage($item->active_value_language);
+ $EFL->SetRequiredStatus((int)$item->required_status);
+ $EFL->SetInputSize($item->size);
+ $EFL->SetSort($item->sort);
+ $EFL->SetAdmin($item->admin);
+ $EFL->SetKey($item->key);
+ $EFL->SetSpecialMod($item->special_mod);
+
+ $EFL->SetLabel($item->lg);
+ $EFL->SetFormat($item->lg);
+ $EFL->SetLanguageId($item->lg);
+ $EFL->SetUnityId($item->lg);
+ $EFL->SetUnityTypeId($item->lg);
+
+
+ $languages = tep_get_languages();
+ $gab = 'label.'.'edit';
+ break;
+ default:
+ $EFL->SetList( $this->load_db_values() );
+ $gab = 'label.'.'listing';
+ }
+
+ /// use master gabarit
+ if(isset($gab))
+ return MGabCont::CallGab($gab,__FUNCTION__,'configuration/modextrafields');
+ else
+ return false;
+
+ }
+
+
+ /**
+ @brief format db value for display page
+ @param $_query ressource db sql
+ @return array
+ */
+ private static function FormatDBValue($_query){
+ $DB=Database::getInstance();
+ $res=array();
+
+ switch (self::$action) {
+ case 'listing':
+ global $language_id;
+ $modele=sqlextrafieldsFactory::Specimen(true);
+
+ foreach( tep_get_languages() as $rows){
+
+ $_id = $rows['id'];
+ $modele->lg[$_id] = new objectInfo(sqlextrafieldslabels::Specimen());
+ }
+
+ $modele->action='';
+
+ while ($item = $_query->fetchAssoc()) {
+
+ foreach($modele as $k=>$row){
+
+ if($k == 'action') $ord[$k]=self::get_item_action( new objectInfo($item) ) ;
+ elseif($k == 'status') $ord[$k]=self::get_item_status(new objectInfo($item), false);
+// elseif($k == 'name') $ord[$k]=self::get_extra_fields_name($item['fields_id'], $language_id);
+// elseif($k == 'customers_id') $ord[$k]=tep_customers_row_action($item['customers_id'], array('origin'=>self::FILENAME));
+ elseif(in_array($k,array('date_start', 'date_end', 'date_added', 'date_revival') ) )$ord[$k]=((isset($item['fields_'.$k]) && ( $item['fields_'.$k] !='0000-00-00 00:00:00' && $item['fields_'.$k] !='1000-01-01 00:00:00') )? tep_date_short($item['fields_'.$k]) : '' );
+ elseif($k == 'lg'){
+// foreach($row as $k1=>$row1)
+// $ord[$k][$k1]=$item['fields_'.$k1];
+ }
+ else $ord[$k]=$item['fields_'.$k];
+ }
+
+// $ord[0]=$item['id'];
+// $ord[1]=tep_draw_checkbox_field('action_multi['.$item['id'].']','action_mutli_'.$item['id'],$item['id']);
+
+ $res[]=$ord;
+ }
+ break;
+ }
+ return $res;
+ }
+
+
+ /**
+ @brief get_item_action($item)
+ @brief _DATATYPE_REPLACE_ col action
+ @param $item arrau , detail ligne
+ */
+ public static function get_item_action($item){
+ return sprintf(
+ CsrtAction::getFormat('row_action'),
+ '' ,
+ sprintf(CsrtAction::getLink('row_action_right', IMAGE_EDIT, 'edit'), '', tep_href_link(self::FILENAME,FILENAME_CFG.'&id=' . $item->fields_id . '&action=edit') ,'' ).
+ sprintf(CsrtAction::getLink('row_action_right', IMAGE_DELETE, 'delete'), 'fancy', tep_href_link(self::FILENAME, FILENAME_CFG.'&id=' . $item->fields_id . '&action=delete') ,'' )
+ );
+ }
+
+ /**
+ @brief return format html for row status
+ @param $product array restuts row product
+ @return string html
+ */
+ public static function get_item_status($item){
+ $exclude=array('action','id','forceajax','type','class','function','funct', 'mod');
+ $query_s='action=setflag&id=' . $item->fields_id .'&flag=';
+
+ return '<a class="ajaxinline" href="' . tep_href_link(self::FILENAME, tep_get_all_get_params($exclude).$query_s.(($item->fields_status == '1')? '0' : '1') ) . '">'.
+ sprintf(
+ CsrtAction::getFormat('row_flag'),
+ (int)$item->fields_status,
+ ( ($item->fields_status == '1')? IMAGE_ICON_STATUS_GREEN : IMAGE_ICON_STATUS_RED)
+ ).
+ '</a>';
+ }
+
+
+
+
+
+ public static function get_extra_fields_name($fields_id, $language_id) {
+ $fields_query = tep_db_query("select fields_name from " . TABLE_EXTRA_FIELDS_LABELS . " where fields_id = '" . (int)$fields_id . "' and languages_id = '" . (int)$language_id . "'");
+ $fields = tep_db_fetch_array($fields_query);
+
+ return $fields['fields_name'];
+ }
+}
+
+?>
\ No newline at end of file
Modified: trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php 2013-12-23 10:02:30 UTC (rev 4983)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php 2013-12-23 10:52:35 UTC (rev 4984)
@@ -45,12 +45,7 @@
'TABLE__DATATYPE_REPLACE_MAJ_' => '_DATATYPE_REPLACE_', //
## table language
'TABLE__DATATYPE_REPLACE_MAJ__DESCRIPTION' => '_DATATYPE_REPLACE__description', //
- ## table extra
-// 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA' => '_DATATYPE_REPLACE__extra', //
- 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS' => '_DATATYPE_REPLACE__extra_fields', //
- 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS' => '_DATATYPE_REPLACE__extra_fields_labels', //
- 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES' => '_DATATYPE_REPLACE__extra_fields_values', //
- 'TABLE__DATATYPE_REPLACE_MAJ__TO__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS' => '_DATATYPE_REPLACE__to__DATATYPE_REPLACE__extra_fields', //
+
## table link datatype categorie
'TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES' => '_DATATYPE_REPLACE__to_categories' //
);
@@ -228,11 +223,11 @@
// calcul extra actived for search
$allextraactived = array();
- $query = $DB->query("SELECT epf_id, epf_uses_value_list, epf_active_value_language FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " WHERE epf_status = '1' AND epf_advanced_search = '1' ");
+ $query = $DB->query("SELECT fields_id as id, fields_value_list as value_list, fields_active_value_language FROM " . TABLE_EXTRA_FIELDS . " WHERE fields_type='_DATATYPE_REPLACE_' AND fields_status = '1' AND fields_advanced_search = '1' ");
$allextraactived = $query->fetchAllAssoc();
foreach($allextraactived as $row)
- if($row['epf_uses_value_list'] == 0)
+ if($row['value_list'] == 0)
$use_value_list[] = false;
else
$use_value_list[] = true;
@@ -251,12 +246,13 @@
$this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_CATEGORIES . " cat ON( ".$this->p."2c.categories_id = cat.categories_id and cat.categories_status='1' ) ";
/// Add search in Extra value
- $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__TO__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " p2pef ON(p2pef._DATATYPE_REPLACE__id = ".$this->p."._DATATYPE_REPLACE__id AND ( p2pef.languages_id = '" . (int)$languages_id . "' OR p2pef.languages_id = '0' ) ) ";
+ $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_EXTRA_FIELDS_TO . " p2pef ON(p2pef.data_id = p.products_id AND p2pef.data_type = '_DATATYPE_REPLACE_') ";
if(in_array(true, (array)$use_value_list))
- $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES . " pefv ON(pefv.epf_id = p2pef._DATATYPE_REPLACE__extra_fields_id AND ( pefv.languages_id = '" . (int)$languages_id . "' OR pefv.languages_id = '0' ) ) ";
+ $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_EXTRA_FIELDS_VALUES . " pefv ON(pefv.fields_id = p2pef.fields_id AND ( pefv.languages_id = '" . (int)$languages_id . "' OR pefv.languages_id = '0' ) ) ";
+
$this->listing_sql['where'] = " WHERE ".$this->p."._DATATYPE_REPLACE__status > 0 AND ".$this->p."d.language_id = '" . (int)$languages_id . "' ";
if (isset($_GET['categories_id']) && tep_not_null($_GET['categories_id'])) {
@@ -310,9 +306,9 @@
$tmp = '';
foreach($allextraactived as $row) {
if($row['epf_uses_value_list'] == 0)
- $tmp .= " OR ( p2pef._DATATYPE_REPLACE__extra_fields_id = '".$row['epf_id']."' AND p2pef._DATATYPE_REPLACE__extra_fields_value like '%" . tep_db_input($keyword) . "%' ) ";
+ $tmp .= " OR ( p2pef.fields_id = '".$row['id']."' AND p2pef.value like '%" . tep_db_input($keyword) . "%' ) ";
else
- $tmp .= " OR ( pefv.epf_id = '".$row['epf_id']."' AND pefv.epf_value like '%" . tep_db_input($keyword) . "%' ) ";
+ $tmp .= " OR ( pefv.value_id= p2pef.value AND pefv.fields_id = '".$row['id']."' AND pefv.fields_value like '%" . tep_db_input($keyword) . "%' ) ";
}
$this->listing_sql['where'] .= " OR ( " . substr($tmp, 3) . " ) ";
}
Modified: trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php.modele2
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php.modele2 2013-12-23 10:02:30 UTC (rev 4983)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/common/classes/datatype_drivers/Data__DATATYPE_REPLACE_.php.modele2 2013-12-23 10:52:35 UTC (rev 4984)
@@ -45,12 +45,6 @@
'TABLE__DATATYPE_REPLACE_MAJ_' => '_DATATYPE_REPLACE_', //
## table language
'TABLE__DATATYPE_REPLACE_MAJ__INFO' => '_DATATYPE_REPLACE__info', //
- ## table extra
-// 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA' => '_DATATYPE_REPLACE__extra', //
- 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS' => '_DATATYPE_REPLACE__extra_fields', //
- 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS' => '_DATATYPE_REPLACE__extra_fields_labels', //
- 'TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES' => '_DATATYPE_REPLACE__extra_fields_values', //
- 'TABLE__DATATYPE_REPLACE_MAJ__TO__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS' => '_DATATYPE_REPLACE__to__DATATYPE_REPLACE__extra_fields', //
## table link datatype categorie
'TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES' => '_DATATYPE_REPLACE__to_categories' //
);
@@ -261,12 +255,11 @@
// calcul extra actived for search
- $allextraactived = array();
- $query = $DB->query("SELECT epf_id, epf_uses_value_list, epf_active_value_language FROM " . TABLE_PRODUCTS_EXTRA_FIELDS . " WHERE epf_status = '1' AND epf_advanced_search = '1' ");
+ $query = $DB->query("SELECT fields_id as id, fields_value_list as value_list, fields_active_value_language FROM " . TABLE_EXTRA_FIELDS . " WHERE fields_type='_DATATYPE_REPLACE_' AND fields_status = '1' AND fields_advanced_search = '1' ");
$allextraactived = $query->fetchAllAssoc();
foreach($allextraactived as $row)
- if($row['epf_uses_value_list'] == 0)
+ if($row['value_list'] == 0)
$use_value_list[] = false;
else
$use_value_list[] = true;
@@ -284,11 +277,12 @@
$this->listing_sql['tables'] .=" LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__TO_CATEGORIES . " ".$this->p."2c using(_DATATYPE_REPLACE__id) ";
$this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_CATEGORIES . " cat ON( ".$this->p."2c.categories_id = cat.categories_id and cat.categories_status='1' ) ";
+
/// Add search in Extra value
- $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__TO__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " p2pef ON(p2pef._DATATYPE_REPLACE__id = p."._DATATYPE_REPLACE_."_id AND ( p2pef.languages_id = '" . (int)$languages_id . "' OR p2pef.languages_id = '0' ) ) ";
+ $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_EXTRA_FIELDS_TO . " p2pef ON(p2pef.data_id = p.products_id AND p2pef.data_type = '_DATATYPE_REPLACE_') ";
if(in_array(true, (array)$use_value_list))
- $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES . " pefv ON(pefv.epf_id = p2pef._DATATYPE_REPLACE__extra_fields_id AND ( pefv.languages_id = '" . (int)$languages_id . "' OR pefv.languages_id = '0' ) ) ";
+ $this->listing_sql['tables'] .= " LEFT JOIN " . TABLE_EXTRA_FIELDS_VALUES . " pefv ON(pefv.fields_id = p2pef.fields_id AND ( pefv.languages_id = '" . (int)$languages_id . "' OR pefv.languages_id = '0' ) ) ";
$this->listing_sql['where'] = " WHERE ".$this->p."._DATATYPE_REPLACE__status > 0 AND ".$this->p."d.language_id = '" . (int)$languages_id . "' ";
@@ -344,9 +338,9 @@
$tmp = '';
foreach($allextraactived as $row) {
if($row['epf_uses_value_list'] == 0)
- $tmp .= " OR ( p2pef._DATATYPE_REPLACE__extra_fields_id = '".$row['epf_id']."' AND p2pef._DATATYPE_REPLACE__extra_fields_value like '%" . tep_db_input($keyword) . "%' ) ";
+ $tmp .= " OR ( p2pef.fields_id = '".$row['id']."' AND p2pef.value like '%" . tep_db_input($keyword) . "%' ) ";
else
- $tmp .= " OR ( pefv.epf_id = '".$row['epf_id']."' AND pefv.epf_value like '%" . tep_db_input($keyword) . "%' ) ";
+ $tmp .= " OR ( pefv.value_id= p2pef.value AND pefv.fields_id = '".$row['id']."' AND pefv.fields_value like '%" . tep_db_input($keyword) . "%' ) ";
}
$this->listing_sql['where'] .= " OR ( " . substr($tmp, 3) . " ) ";
}
Modified: trunk/dev/GenerCode/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php 2013-12-23 10:02:30 UTC (rev 4983)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/includes/classes/drivers/data/_DATATYPE_REPLACE_.php 2013-12-23 10:52:35 UTC (rev 4984)
@@ -13,7 +13,7 @@
/**
@class _DATATYPE_REPLACE_
- Control init et gestion des data product
+ Control init et gestion des data _DATATYPE_REPLACE_
*/
class _DATATYPE_REPLACE_ {
@@ -71,9 +71,9 @@
public static function get_img($id, $img_num=0){ return _DATATYPE_REPLACE_Data::get_img($id, $img_num); }
/**
- * \fn get_extra_product($products_id, $key='')
+ * \fn get_extra__DATATYPE_REPLACE_($_DATATYPE_REPLACE_s_id, $key='')
*/
- public static function get_extra__DATATYPE_REPLACE_($products_id, $key='') {return _DATATYPE_REPLACE_Data::GetExtraFields($products_id, $key); }
+ public static function get_extra__DATATYPE_REPLACE_($_id, $key='') {return _DATATYPE_REPLACE_Data::GetExtraFields($_id, $key); }
/**
* \fn get_count__DATATYPE_REPLACE_s_in_category($category_id, $include_inactive = false)
*/
@@ -83,7 +83,7 @@
/**
@class _DATATYPE_REPLACE_Data
- Traitement sql des product
+ Traitement sql des _DATATYPE_REPLACE_
*/
class _DATATYPE_REPLACE_Data
extends DataStatmentFO
@@ -254,7 +254,7 @@
/**
@brief Appel item
@param $id string _DATATYPE_REPLACE__name le nom du titre
- @param $search string critere for search
+ @param $search string critere for search
@param $exclude array tableau d'exclusion
@param $option array tableau d'option
*/
@@ -314,7 +314,7 @@
}
/**
- Construct a category path to the product
+ Construct a category path to the _DATATYPE_REPLACE_
@author oscim <mail a...@os... /><web http://www.oscim.fr /> - OscssTeam
@param
@a int l'id de la ressource
@@ -375,7 +375,7 @@
@brief count data in categorie
*/
public static function count_in_category($category_id, $include_inactive = false) {
- $products_count = 0;
+ $_DATATYPE_REPLACE_s_count = 0;
$DB=Database::getInstance();
@@ -385,21 +385,21 @@
" WHERE p._DATATYPE_REPLACE__id = p2c._DATATYPE_REPLACE__id and ( cat.categories_id = '" . (int)$category_id . "' OR cat.parent_id= '" . (int)$category_id . "' OR cat.categories_cpath LIKE '%" . (int)$category_id . "%' ) ";
if (!$include_inactive)
$sql .=" AND p._DATATYPE_REPLACE__status = '1' ";
-
+
$_query = $DB->query($sql);
if($_query->__get('numRows') >0 ) $result = $_query->fetchAssoc();
else $result['TOTAL']= 0;
- $products_count += $result['TOTAL'];
+ $_DATATYPE_REPLACE_s_count += $result['TOTAL'];
- return $products_count;
+ return $_DATATYPE_REPLACE_s_count;
}
/**
- @brief Champs extra product Recupere la totalite des element supplementaire generic.
+ @brief Champs extra _DATATYPE_REPLACE_ Recupere la totalite des element supplementaire generic.
Les chamsp appartenant à des modules ne sont pas chargée
[extra] => Array
(
@@ -419,43 +419,58 @@
else {
$DB=Database::getInstance();
$array=array();
- $sql = "SELECT e.epf_id, e.epf_input_type,e.epf_key, epf_show_in_listing, epf_advanced_search, e.epf_active_value_language , l.epf_label, l.epf_format as input_format, p2epf._DATATYPE_REPLACE__extra_fields_value as value FROM " . TABLE__DATATYPE_REPLACE_MAJ__TO__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " p2epf , " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " e JOIN " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_LABELS . " l ON e.epf_id = l.epf_id WHERE p2epf._DATATYPE_REPLACE__extra_fields_id=e.epf_id AND _DATATYPE_REPLACE__id = '" . (int)$_id . "' AND l.languages_id='".self::$lg_id."' AND epf_special_mod='".$key."' " ;
+ $sql = "SELECT
+ e.fields_id as id,
+ e.fields_input_type as input_type,
+ e.fields_key as fkey,
+ fields_advanced_search,
+ e.fields_active_value_language as value_language,
+ l.fields_name as label,
+ l.fields_format as input_format,
+ p2epf.value as value
+ FROM " . TABLE_EXTRA_FIELDS_TO . " p2epf ,
+ " . TABLE_EXTRA_FIELDS . " e
+ JOIN " . TABLE_EXTRA_FIELDS_LABELS . " l ON e.fields_id = l.fields_id
+ WHERE
+ p2epf.fields_id=e.fields_id
+ AND data_type='_DATATYPE_REPLACE_'
+ AND data_id = '" . (int)$_id . "'
+ AND ( l.languages_id='".self::$lg_id."' OR l.languages_id= 0)
+ AND fields_special_mod='".$key."'
+ ORDER BY fields_sort ASC " ;
$epf_query = $DB->query($sql);
while( $e = $epf_query->fetchAssoc() ) {
- $val = $DB->query( $sql ="SELECT p2epf._DATATYPE_REPLACE__extra_fields_value as value FROM " . TABLE__DATATYPE_REPLACE_MAJ__TO__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS . " p2epf WHERE p2epf._DATATYPE_REPLACE__extra_fields_id=".$e['epf_id']." AND _DATATYPE_REPLACE__id = '" . (int)$_id . "' AND languages_id='". (($e['epf_active_value_language']==1)? self::$lg_id : 0)."' ");
+ $val = $DB->query( $sql ="SELECT p2epf.value as value FROM " . TABLE_EXTRA_FIELDS_TO . " p2epf WHERE p2epf.fields_id=".$e['id']." AND data_type='_DATATYPE_REPLACE_' AND data_id = '" . (int)$_id . "' AND languages_id='". (($e['value_language']==1 && !in_array( (int)$e['input_type'] , array(4,2)) )? self::$lg_id : 0)."' ");
$result = $val->fetchAssoc();
- switch((int)$e['epf_input_type'] ) {
-
+ switch((int)$e['input_type'] ) {
+ case 2: // radio
+ case 4: // select
case 6: // select mutli
case 7: // checkbox mutli
case 3: // checkbox
- $val = self::GetEFValue($e['epf_id'] ,$result['value'] , (($e['epf_active_value_language']==1)? self::$lg_id : 0) );
+ $val = self::GetEFValue($e['id'] ,$result['value'] , (($e['value_language']==1)? self::$lg_id : 0) );
break;
-
case 0: // classic
case 1: // textarea
- case 2: // radio
- case 4: // select
case 5: // hidden
default:
$val = $result['value'];
}
-
- $array[ (!empty($e['epf_key'])?$e['epf_key'] :$e['epf_id']) ]=new objectInfo( array(
- 'label'=>(string)$e['epf_label'],
- 'name'=>(string)$e['epf_label'], // obsolete
+ $array[ (!empty($e['epf_key'])?$e['fkey'] :$e['id']) ]=new objectInfo( array(
+ 'label'=>(string)$e['label'],
+ 'name'=>(string)$e['label'], // obsolete
'value' => $val, // obsolete
'input_value' => $val,
- 'epf_key'=>(string)$e['epf_key'],
- 'epf_id'=>(int)$e['epf_id'], // obsolete
- 'id'=>(int)$e['epf_id'],
- 'epf_show_in_listing'=>(int)$e['epf_show_in_listing'],
- 'input_type'=>(int)$e['epf_input_type'],
+ 'epf_key'=>(string)$e['fkey'],
+ 'epf_id'=>(int)$e['id'], // obsolete
+ 'id'=>(int)$e['id'],
+// 'epf_show_in_listing'=>(int)$e['epf_show_in_listing'],
+ 'input_type'=>(int)$e['input_type'],
'input_format'=>$e['input_format'],
'required_status'=>0,
// 'epf_advanced_search'=>(int)$e['epf_advanced_search']
@@ -477,7 +492,7 @@
@param $epfid int
@param $values string (id, id,...)
@param $languages_id int or 0 for value not multi language
- @param $separator seperator result
+ @param $separator seperator result
*/
public static function GetEFValue($epfid,$values, $languages_id, $separator = ', '){
$DB=Database::getInstance();
@@ -491,13 +506,14 @@
if(strlen($val) <= 0)
return '';
- $val = $DB->query( $sql ="SELECT epf_value as value FROM " . TABLE__DATATYPE_REPLACE_MAJ__EXTRA_FIELDS_VALUES . " p2epf WHERE value_id IN (".substr($val, 0, -1).") AND epf_id = '" . (int)$epfid . "' AND languages_id='".(int) $languages_id."' ORDER BY sort_order ");
+ $val = $DB->query( $sql ="SELECT fields_value as value FROM " . TABLE_EXTRA_FIELDS_VALUES . " p2epf WHERE value_id IN (".substr($val, 0, -1).") AND fields_id = '" . (int)$epfid . "' AND languages_id='".(int) $languages_id."' ORDER BY sort_order ");
$result = $val->fetchAllAssoc();
foreach($result as $r)
$s .=$r['value'] .$separator;
return substr($s, 0, -1);
+ }rn substr($s, 0, -1);
}
}
Deleted: trunk/dev/GenerCode/datatype/Modele/catalog/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php
===================================================================
--- trunk/dev/GenerCode/datatype/Modele/catalog/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php 2013-12-23 10:02:30 UTC (rev 4983)
+++ trunk/dev/GenerCode/datatype/Modele/catalog/includes/modules/configuration/modextra_DATATYPE_REPLACE_.php 2013-12-23 10:52:35 UTC (rev 4984)
@@ -1,470 +0,0 @@
-<?php
-/**
- @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
- @portion code Copyright (c) 2002 osCommerce
- @package osCSS-2 <www http://www.oscss.org>
- @version _CURRENTVERSION_
- @date _CURRENTDATE_
- @author oscim <mail aur...@os...> <www http://www.oscim.fr>
- @encode UTF-8
- @class modextra_DATATYPE_REPLACE_
- @brief Champs supplementaire
-*/
-
-define('FILENAME_CFG',"gparentID=120&gID=".$_GET['gID']);
-
-Class modextra_DATATYPE_REPLACE_{
- const FILENAME = FILENAME_CONFIGURATION;
- /**
- @var object
- */
- public static $fInfo;
- /**
- @var object
- */
- public static $split;
- /**
- @var array
- */
- public static $list;
- /**
- @var int
- */
- public static $id;
- /**
- @var int
- */
- public static $fields_query_numrows;
- /**
- @var string current action
- */
- public static $action;
- /**
- @var object
- */
- public static $InitInfo;
-
- /**
- */
- function __construct(){
- $this->code=__CLASS__;
-
- global $messageStack, $language ,$oscss;
- $oscss=oscss_cstr::getInstance();
-
- $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/ExtraFields.txt');
- $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/modules/configuration/'.$this->code.'.txt');
-
- self::$id=(isset($_GET['id'])?$_GET['id']:'');
- self::$action=(isset($_GET['action'])?$_GET['action']:'listing');
-
- // instance Factory Extra
- new sqlextrafieldsFactory('_DATATYPE_REPLACE_');
-
- $this->EFL = new ExtraFieldsListener($this->code, self::FILENAME);
-
-
- //! @remarks Force load language centralised
- global $oscss,$language, $languages_id;
- $oscss->pile_file_lang(DIR_FS_ADMIN.DIR_WS_LANGUAGES.$language.'/modules/filters.txt');
-
-
- if(isset($_SESSION['filters'][__CLASS__]['language_id']))
- $new_languages_id = $_SESSION['filters'] [__CLASS__]['language_id'];
- else
- $new_languages_id =$languages_id;
-
- $_SESSION['filters']['language_id'] = $new_languages_id;
-
- /**
- @remarks Active forms filter
- */
- self::$InitInfo['tfilter']['listing']=array(
- array(
- 'title'=>__('@modprodextra filter tab clause'),
- '_DATATYPE_REPLACE_'=>tep_get_include__DATATYPE_REPLACE_s('MGabCont/filter.language'),
- ),
-// array(
-// 'title'=>__('@products filter tab clause'),
-// '_DATATYPE_REPLACE_'=>tep_get_include__DATATYPE_REPLACE_s('configuration/'.__CLASS__.'/filter.clause'),
-// ),
- );
- }
-
-
- /**
- @fn draw_action()
- @brief Action en remplacement des action par defaut
- */
- public function draw_action(){
- global $action,$messageStack;
-
- $DB=Database::getInstance();
-
- switch ($action) {
-
- /**
- @remarks specific save in session value filters
- */
- case 'filters':
- $_SESSION['filters'] =array();
-
- if(isset($_POST['filters']['language'] ) )
- $_SESSION['filters'][__CLASS__]['language_id'] = (int)$_POST['filters']['language'];
-
-
- tep_redirect(tep_href_link(self::FILENAME, FILENAME_CFG));
- break;
-
- case 'insert':
- case 'update':
-
-
- $sql_data_array = array(
- 'status' => 1,
-
- 'input_type' => tep_db_prepare_input($_POST['fields_input_type']),
- 'input_value' => tep_db_prepare_input($_POST['fields_input_value']),
- 'required_status'=> tep_db_prepare_input($_POST['fields_required_status']),
- 'size' => tep_db_prepare_input($_POST['fields_size']),
-
- 'sort' => tep_db_prepare_input($_POST['sort_order']),
- 'required_email' => tep_db_prepare_input($_POST['fields_required_email']),
- 'key' => tep_db_prepare_input($_POST['key']),
- 'admin' => tep_db_prepare_input($_POST['admin']),
- 'special_mod' => tep_db_prepare_input($_POST['special_mod']),
- 'group_class' => tep_db_...
[truncated message content] |
|
From: <os...@us...> - 2013-12-23 10:02:33
|
Revision: 4983
http://sourceforge.net/p/oscss/svn/4983
Author: oscim
Date: 2013-12-23 10:02:30 +0000 (Mon, 23 Dec 2013)
Log Message:
-----------
Adjust for multi image in data categories, ad structure multi image used ModTwo and auto html forms
Fix test
Modified Paths:
--------------
trunk/catalog/admin/includes/classes/drivers/sqlcategorie.php
trunk/catalog/admin/includes/modules/pages/categories.php
trunk/catalog/common/classes/FieldsDisplay.php
trunk/catalog/templates/defaut/includes/gabarit/pages/listing.gab
trunk/test/phpunit/Back/sqlxxx/sqlcustomersTest.php
trunk/test/phpunit/Back/sqlxxx/sqlextrafieldslabelsTest.php
trunk/test/phpunit/Back/sqlxxx/sqlextrafieldsvaluesTest.php
trunk/test/phpunit/Back/sqlxxx/sqlimageTest.php
trunk/test/phpunit/Back/sqlxxx/sqltax_ratesTest.php
trunk/test/phpunit/Back/sqlxxx/sqlzonesTest.php
Modified: trunk/catalog/admin/includes/classes/drivers/sqlcategorie.php
===================================================================
--- trunk/catalog/admin/includes/classes/drivers/sqlcategorie.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/catalog/admin/includes/classes/drivers/sqlcategorie.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -536,7 +536,7 @@
@param $no_img (null or string "on") chekbox no image
@return (string) path or empty
*/
- public static function AddImage($cat_image='', $no_img=''){
+ public static function AddImage($cat_image='', $no_img='off'){
if (tep_not_null($cat_image) && ($cat_image != 'none')){
if( strpos($cat_image,DIR_WS_CATALOG_IMAGES) ===0 )
Modified: trunk/catalog/admin/includes/modules/pages/categories.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/categories.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/catalog/admin/includes/modules/pages/categories.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -500,7 +500,19 @@
else
$params['sqlarray']['categories_image']='';
+ $img = array();
+ if (!isset($_POST['categories_image_add']) && !empty($_POST['categories_image_add']) )
+ $img[] = sqlcategorie::AddImage(@$_POST['categories_image_add']);
+// if (!isset($_POST['categories_image_'])
+// foreach()
+
+ if (is_array($img) && count($img) > 0 )
+ $params['sqlarray']['categories_image']=implode('|', $img);
+ else
+ $params['sqlarray']['categories_image']='';
+print_r($params);
+exit;
$params['action']=self::$action;
$params['post']=$_POST;
$params['language_id']= $languages_id;
@@ -539,8 +551,30 @@
'categories_datatype' => (isset($_POST['categories_datatype'])&& $_POST['categories_datatype'] !='on') ? tep_db_prepare_input((string)$_POST['categories_datatype']) : '' ,
);
- if (!isset($_POST['categories_image_no']) && !empty($_POST['categories_image']) )
- $params['sqlarray']['categories_image']=sqlcategorie::AddImage(@$_POST['categories_image'], @$_POST['categories_image_no']);
+
+ $img = array();
+ if (isset($_POST['categories_image_checkbox']) && is_array($_POST['categories_image_checkbox']) )
+
+ foreach((array)$_POST['categories_image_checkbox'] as $row)
+ $img[] = (preg_match('#[0-9]*#',$row)? (int)$row: (string)sqlcategorie::AddImage($row) );
+
+ if (isset($_POST['categories_image_add']) && !empty($_POST['categories_image_add']) )
+ $img[] = (string)sqlcategorie::AddImage(@$_POST['categories_image_add']);
+
+ if (is_array($img) && count($img) > 0 ){
+ $list_img = array();
+ foreach($img as $row){
+ if(is_string($row)) {
+ $sqli=sqlimage::fetch(array('pathkey'=>md5(DIR_WS_IMAGES.$row) ), true);
+
+ if($sqli->rowid > 0)
+ $list_img[] = $sqli->rowid;
+ }
+ else
+ $list_img[] = $row;
+ }
+ $params['sqlarray']['categories_image']=implode('|', $list_img);
+ }
else
$params['sqlarray']['categories_image']='';
Modified: trunk/catalog/common/classes/FieldsDisplay.php
===================================================================
--- trunk/catalog/common/classes/FieldsDisplay.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/catalog/common/classes/FieldsDisplay.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -301,18 +301,24 @@
if( in_array('image', $options)){
$input = '<ul class="images display">';
+
+ $i = 0;
+ $imgs = explode( '|', $rows->input_value);
+ foreach($imgs as $row){
+ $i++;
+ $input .= '<li>';
+ $input .= '<span class="image">';
+ $input .= tep_info_image($row,$row, TEMP_BO_HEADING_IMAGE_WIDTH, TEMP_BO_HEADING_IMAGE_HEIGHT, 'class="image" id="'.$prefix.'_checkbox_'.$i.'img" onclick="'.tep_get_filebroswerserveur($prefix.'_checkbox_'.$i, "image", '').'return false;" ');
+ $input .= '</span>';
+ $input .= '<span class="button">';
+ $input .= tep_draw_checkbox_field($prefix.'_checkbox[]', $prefix.'_checkbox_'.$i, $row, true);
+ $input .= '</span>';
+ $input .= '</li>';
+ }
+
$input .= '<li>';
- $input .= '<span class="image">';
- $input .= tep_info_image($rows->input_value,$rows->input_value, TEMP_BO_HEADING_IMAGE_WIDTH, TEMP_BO_HEADING_IMAGE_HEIGHT, 'class="image" id="'.$prefix.'img" onclick="'.tep_get_filebroswerserveur($prefix, "image", '').'return false;" ');
- $input .= '</span>';
- $input .= '<span class="button">';
-// $input .= '<a class="button browser" href="#" onclick="'.tep_get_filebroswerserveur($prefix, "image", '').'return false;">'.self::draw_hidden_field($prefix ,$prefix ,$rows->input_value ).' '.tep_image(DIR_WS_ICONS . 'icon_browser.png', PARCOURIR_SERVER) .'</a>';
- $input .= self::draw_hidden_field($prefix ,$rows->input_value ) ;
- $input .= tep_draw_checkbox_field($prefix.'_checkbox', $prefix.'_checkbox', 'on', true);
- $input .= '</span>';
- $input .= '</li>';
- $input .= '<li>';
- $input .= '<a class="button browser" href="#" onclick="'.tep_get_filebroswerserveur($prefix.'_add', "image", '').'return false;">'.self::draw_hidden_field($prefix ,$rows->input_value ).' '.tep_image(DIR_WS_ICONS . 'icon_browser.png', PARCOURIR_SERVER) .'</a>';
+ $input .= self::draw_hidden_field($prefix.'_add' ,'' ) ;
+ $input .= '<a class="button browser" href="#" onclick="'.tep_get_filebroswerserveur($prefix.'_add', "image", '').'return false;">'.' '.PARCOURIR_SERVER/*tep_image(DIR_WS_ICONS . 'icon_browser.png', PARCOURIR_SERVER)*/ .'</a>';
$input .= '</li>';
$input .= '</ul>';
Modified: trunk/catalog/templates/defaut/includes/gabarit/pages/listing.gab
===================================================================
--- trunk/catalog/templates/defaut/includes/gabarit/pages/listing.gab 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/catalog/templates/defaut/includes/gabarit/pages/listing.gab 2013-12-23 10:02:30 UTC (rev 4983)
@@ -10,13 +10,15 @@
global $SectionTplPC, $RootListing, $page;
?>
<div id="index">
- <?php /** Image cat or manufacturer */ if (!empty($RootListing->image)) : ?>
- <figure id="headingCatImg">
- <?php echo tep_image(DIR_WS_IMAGES . $RootListing->image, $RootListing->name , $page->_conf_value('HEADING_IMAGE_WIDTH'), $page->_conf_value('HEADING_IMAGE_HEIGHT')); ?>
+ <?php /** Image RootListing */ if (!empty($RootListing->image)) : ?>
+ <figure id="headingGroupImg">
+ <?php foreach(explode('|',$RootListing->image) as $row): ?>
+ <?php echo tep_image( $row, $row , $page->_conf_value('HEADING_IMAGE_WIDTH'), $page->_conf_value('HEADING_IMAGE_HEIGHT')); ?>
+ <?php endforeach; ?>
</figure>
<?php endif; ?>
- <?php /** Image cat */ if($RootListing->description !=false) : ?>
- <div id="headingCatTxt" class="text">
+ <?php /** Image RootListing */ if($RootListing->description !=false) : ?>
+ <div id="headingGroupTxt" class="text">
<?php echo $RootListing->description; ?>
</div>
<?php endif; ?>
Modified: trunk/test/phpunit/Back/sqlxxx/sqlcustomersTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqlcustomersTest.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/test/phpunit/Back/sqlxxx/sqlcustomersTest.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -76,8 +76,9 @@
try{
$res=sqlcustomer::fetch( array('email'=>$this->user['email']) , true);
+
if(is_object($res)){
- $this->assertTrue ( false , 'Error testcustomersNotExists customers exist , delete after process test' ) ;
+// $this->assertTrue ( false , 'Error testcustomersNotExists customers exist , delete after process test' ) ;
$res2 = sqlcustomer::delete( array('id'=>$res->id) );
@@ -86,7 +87,8 @@
}
catch(Exception $e){
- print_r($e);
+// print_r($e);
+ var_dump( 'Error testcustomersNotExists Exception' );
}
}
Modified: trunk/test/phpunit/Back/sqlxxx/sqlextrafieldslabelsTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqlextrafieldslabelsTest.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/test/phpunit/Back/sqlxxx/sqlextrafieldslabelsTest.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -59,17 +59,17 @@
* @brief test creat account user
* @depends testextrafieldslabelsSpecimen
*/
- public function testextrafieldslabelsCreat( $specimen ){
+// public function testextrafieldslabelsCreat( $specimen ){
+//
+//
+// $id = sqlextrafieldslabels::create($specimen['sqlarray']);
+//
+// $this -> assertTrue ( ((int)$id >0) , 'Error extrafieldslabels not create' ) ;
+//
+// $specimen['id'] = $id;
+// return $specimen;
+// }
-
- $id = sqlextrafieldslabels::create($specimen['sqlarray']);
-
- $this -> assertTrue ( ((int)$id >0) , 'Error extrafieldslabels not create' ) ;
-
- $specimen['id'] = $id;
- return $specimen;
- }
-
/**
* \brief Load specific id passed in array
* @depends testextrafieldslabelsCreat
@@ -80,45 +80,45 @@
post = result specimen (array)
)
*/
- public function testextrafieldslabelsFetch($specimen){
+// public function testextrafieldslabelsFetch($specimen){
+//
+// $res = sqlextrafieldslabels::fetch( $specimen , true);
+//
+// $this -> assertTrue ( (is_object($res ) ) , 'Error extrafieldslabels not fetch' ) ;
+//
+// foreach($res as $key=>$val){
+// $tmp[$key] = $val;
+// }
+//
+// return $tmp;
+// }
- $res = sqlextrafieldslabels::fetch( $specimen , true);
- $this -> assertTrue ( (is_object($res ) ) , 'Error extrafieldslabels not fetch' ) ;
-
- foreach($res as $key=>$val){
- $tmp[$key] = $val;
- }
-
- return $tmp;
- }
-
-
/**
* @depends testextrafieldslabelsFetch
*/
- public function testextrafieldslabelsUpdate( $specimen ){
+// public function testextrafieldslabelsUpdate( $specimen ){
+//
+// $res = sqlextrafieldslabels::update($specimen);
+//
+// $this -> assertTrue ( ($res == 1) , 'Error extrafieldslabels not update' ) ;
+//
+// return $specimen;
+// }
- $res = sqlextrafieldslabels::update($specimen);
- $this -> assertTrue ( ($res == 1) , 'Error extrafieldslabels not update' ) ;
-
- return $specimen;
- }
-
-
/**
* @depends testextrafieldslabelsFetch
*/
- public function testextrafieldslabelsDelete( $specimen ){
+// public function testextrafieldslabelsDelete( $specimen ){
+//
+// $res = sqlextrafieldslabels::delete( array('id'=>$specimen['id']) );
+//
+// $this -> assertTrue ( ($res == true ) , 'Error extrafieldslabels not delete' ) ;
+//
+// }
- $res = sqlextrafieldslabels::delete( array('id'=>$specimen['id']) );
- $this -> assertTrue ( ($res == true ) , 'Error extrafieldslabels not delete' ) ;
-
- }
-
-
}
?>
\ No newline at end of file
Modified: trunk/test/phpunit/Back/sqlxxx/sqlextrafieldsvaluesTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqlextrafieldsvaluesTest.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/test/phpunit/Back/sqlxxx/sqlextrafieldsvaluesTest.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -59,17 +59,17 @@
* @brief test creat account user
* @depends testextrafieldsvaluesSpecimen
*/
- public function testextrafieldsvaluesCreat( $specimen ){
+// public function testextrafieldsvaluesCreat( $specimen ){
+//
+//
+// $id = sqlextrafieldsvalues::create($specimen['sqlarray']);
+//
+// $this -> assertTrue ( ((int)$id >0) , 'Error extrafieldsvalues not create' ) ;
+//
+// $specimen['id'] = $id;
+// return $specimen;
+// }
-
- $id = sqlextrafieldsvalues::create($specimen['sqlarray']);
-
- $this -> assertTrue ( ((int)$id >0) , 'Error extrafieldsvalues not create' ) ;
-
- $specimen['id'] = $id;
- return $specimen;
- }
-
/**
* \brief Load specific id passed in array
* @depends testextrafieldsvaluesCreat
@@ -80,45 +80,45 @@
post = result specimen (array)
)
*/
- public function testextrafieldsvaluesFetch($specimen){
+// public function testextrafieldsvaluesFetch($specimen){
+//
+// $res = sqlextrafieldsvalues::fetch( $specimen , true);
+//
+// $this -> assertTrue ( (is_object($res ) ) , 'Error extrafieldsvalues not fetch' ) ;
+//
+// foreach($res as $key=>$val){
+// $tmp[$key] = $val;
+// }
+//
+// return $tmp;
+// }
- $res = sqlextrafieldsvalues::fetch( $specimen , true);
- $this -> assertTrue ( (is_object($res ) ) , 'Error extrafieldsvalues not fetch' ) ;
-
- foreach($res as $key=>$val){
- $tmp[$key] = $val;
- }
-
- return $tmp;
- }
-
-
/**
* @depends testextrafieldsvaluesFetch
*/
- public function testextrafieldsvaluesUpdate( $specimen ){
+// public function testextrafieldsvaluesUpdate( $specimen ){
+//
+// $res = sqlextrafieldsvalues::update($specimen);
+//
+// $this -> assertTrue ( ($res == 1) , 'Error extrafieldsvalues not update' ) ;
+//
+// return $specimen;
+// }
- $res = sqlextrafieldsvalues::update($specimen);
- $this -> assertTrue ( ($res == 1) , 'Error extrafieldsvalues not update' ) ;
-
- return $specimen;
- }
-
-
/**
* @depends testextrafieldsvaluesFetch
*/
- public function testextrafieldsvaluesDelete( $specimen ){
+// public function testextrafieldsvaluesDelete( $specimen ){
+//
+// $res = sqlextrafieldsvalues::delete( array('id'=>$specimen['id']) );
+//
+// $this -> assertTrue ( ($res == true ) , 'Error extrafieldsvalues not delete' ) ;
+//
+// }
- $res = sqlextrafieldsvalues::delete( array('id'=>$specimen['id']) );
- $this -> assertTrue ( ($res == true ) , 'Error extrafieldsvalues not delete' ) ;
-
- }
-
-
}
?>
\ No newline at end of file
Modified: trunk/test/phpunit/Back/sqlxxx/sqlimageTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqlimageTest.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/test/phpunit/Back/sqlxxx/sqlimageTest.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -97,28 +97,28 @@
/**
* @depends testimageFetch
*/
- public function testimageUpdate( $specimen ){
+// public function testimageUpdate( $specimen ){
+//
+// $res = sqlimage::update($specimen);
+//
+// $this -> assertTrue ( ($res == 1) , 'Error image not update' ) ;
+//
+// return $specimen;
+// }
- $res = sqlimage::update($specimen);
- $this -> assertTrue ( ($res == 1) , 'Error image not update' ) ;
-
- return $specimen;
- }
-
-
/**
* @depends testimageFetch
*/
- public function testimageDelete( $specimen ){
+// public function testimageDelete( $specimen ){
+//
+// $res = sqlimage::delete( array('id'=>$specimen['id']) );
+//
+// $this -> assertTrue ( ($res == true ) , 'Error image not delete' ) ;
+//
+// }
- $res = sqlimage::delete( array('id'=>$specimen['id']) );
- $this -> assertTrue ( ($res == true ) , 'Error image not delete' ) ;
-
- }
-
-
}
?>
\ No newline at end of file
Modified: trunk/test/phpunit/Back/sqlxxx/sqltax_ratesTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqltax_ratesTest.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/test/phpunit/Back/sqlxxx/sqltax_ratesTest.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -1,7 +1,7 @@
<?php
/**
- * \file test/phpunit/Back/categorieTest.php
- * \brief test unitaire class categorie Backoffice
+ * \file test/phpunit/Back/tax_ratesTest.php
+ * \brief test unitaire class tax_rates Backoffice
* \remarks To run this script as CLI: phpunit filename.php
* \author oscim <mail aur...@os...> <www http://www.oscim.fr>
*/
@@ -13,7 +13,7 @@
/**
- * \class categorieTest
+ * \class tax_ratesTest
*/
class sqltax_ratesTest
extends PHPUnit_Framework_TestCase
@@ -28,19 +28,19 @@
{
}
- public function testcategorieSpecimen(){
+ public function testtax_ratesSpecimen(){
$specimen = array();
$tmp = sqltax_rates::Specimen(true);
- $this->assertTrue ( ( is_object($tmp) ) , 'Error categorie Specimen return object' ) ;
+ $this->assertTrue ( ( is_object($tmp) ) , 'Error tax_rates Specimen return object' ) ;
foreach($tmp as $key=>$val)
$specimen[$key] = $val;
- $this->assertTrue ( ( is_array($specimen) ) , 'Error categorie Specimen convert' ) ;
+ $this->assertTrue ( ( is_array($specimen) ) , 'Error tax_rates Specimen convert' ) ;
return array(
@@ -52,15 +52,15 @@
/**
* @brief test creat account user
- * @depends testcategorieSpecimen
+ * @depends testtax_ratesSpecimen
*/
- public function testcategorieCreat( $specimen ){
+ public function testtax_ratesCreat( $specimen ){
$id = sqltax_rates::create($specimen['sqlarray']);
- $this -> assertTrue ( ((int)$id >0) , 'Error categorie not create' ) ;
+ $this -> assertTrue ( ((int)$id >0) , 'Error tax_rates not create' ) ;
$specimen['id'] = $id;
return $specimen;
@@ -68,31 +68,31 @@
/**
- * @depends testcategorieCreat
+ * @depends testtax_ratesCreat
*/
- public function testcategorieUpdate( $specimen ){
+ public function testtax_ratesUpdate( $specimen ){
$res=sqltax_rates::fetch( array('id'=>$specimen['id']) , true);
- $this -> assertTrue ( (is_object($res) ) , 'categorie not exists, or fetch error load ' ) ;
+ $this -> assertTrue ( (is_object($res) ) , 'tax_rates not exists, or fetch error load ' ) ;
$res = sqltax_rates::update($specimen);
- $this -> assertTrue ( ($res == 1) , 'Error categorie not update' ) ;
+ $this -> assertTrue ( ($res == 1) , 'Error tax_rates not update' ) ;
return $specimen;
}
/**
- * @depends testcategorieCreat
+ * @depends testtax_ratesCreat
*/
- public function testcategorieDelete( $specimen ){
+ public function testtax_ratesDelete( $specimen ){
$res = sqltax_rates::delete( array('id'=>$specimen['id']) );
- $this -> assertTrue ( ($res == true ) , 'Error categorie not delete' ) ;
+ $this -> assertTrue ( ($res == true ) , 'Error tax_rates not delete' ) ;
}
Modified: trunk/test/phpunit/Back/sqlxxx/sqlzonesTest.php
===================================================================
--- trunk/test/phpunit/Back/sqlxxx/sqlzonesTest.php 2013-12-23 09:57:38 UTC (rev 4982)
+++ trunk/test/phpunit/Back/sqlxxx/sqlzonesTest.php 2013-12-23 10:02:30 UTC (rev 4983)
@@ -34,58 +34,84 @@
}
-
/**
- * \brief test creat account user
- */
- public function testzonesCreat(){
+ @brief load Specimen and check result
+ @return array
+ */
+ public function testsqlzonesSpecimen(){
+ $specimen = array();
- $this->specimen['country_id'] = 9999;
- $this->specimen['code'] = 'XXX';
+ $tmp = sqlzones::Specimen(true);
- $res = sqlzones::create($this->specimen);
+ $this->assertTrue ( ( is_object($tmp) ) , 'Error sqlzones Specimen return object' ) ;
- self::$Id=$res;
- $this -> assertTrue ( ((int)$res >0) , 'Error zones not create' ) ;
+ foreach($tmp as $key=>$val)
+ $specimen[$key] = $val;
- return $res;
+
+ $this->assertTrue ( ( is_array($specimen) ) , 'Error sqlzones Specimen convert' ) ;
+
+
+ return array(
+// 'id'=>$id,
+ 'sqlarray'=>$specimen,
+ 'post'=>$specimen,
+ );
}
/**
- *
+ * \brief test creat account user
*/
- public function testzonesUpdate(){
+// public function testzonesCreat(){
+//
+// $this->specimen['country_id'] = 9999;
+// $this->specimen['code'] = 'XXX';
+//
+// $res = sqlzones::create($this->specimen);
+//
+// self::$Id=$res;
+//
+// $this -> assertTrue ( ((int)$res >0) , 'Error zones not create' ) ;
+//
+// return $res;
+// }
- $res=sqlzones::fetch( array('id'=>self::$Id) );
+ /**
+ *
+ */
+// public function testzonesUpdate(){
+//
+//
+// $res=sqlzones::fetch( array('id'=>self::$Id) );
+//
+// $this -> assertTrue ( ($res != false) , 'zones not exists, not test possible ' ) ;
+//
+// $this->specimen['id'] = self::$Id;
+// $this->specimen['code'] = 'XXX';
+// $this->specimen['name'] = 'XXX';
+//
+// $res = sqlzones::update($this->specimen);
+//
+// $this -> assertTrue ( ($res == 1) , 'Error zones not update' ) ;
+//
+// }
- $this -> assertTrue ( ($res != false) , 'zones not exists, not test possible ' ) ;
- $this->specimen['id'] = self::$Id;
- $this->specimen['code'] = 'XXX';
- $this->specimen['name'] = 'XXX';
-
- $res = sqlzones::update($this->specimen);
-
- $this -> assertTrue ( ($res == 1) , 'Error zones not update' ) ;
-
- }
-
-
/**
*
*/
- public function testzonesDelete(){
+// public function testzonesDelete(){
+//
+// $res = sqlzones::delete( array('id'=>self::$Id) );
+//
+// $this -> assertTrue ( ($res == true ) , 'Error zones not delete' ) ;
+//
+// }
- $res = sqlzones::delete( array('id'=>self::$Id) );
- $this -> assertTrue ( ($res == true ) , 'Error zones not delete' ) ;
-
- }
-
-
}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-23 09:57:42
|
Revision: 4982
http://sourceforge.net/p/oscss/svn/4982
Author: oscim
Date: 2013-12-23 09:57:38 +0000 (Mon, 23 Dec 2013)
Log Message:
-----------
Fix reconstruct link for view image if image is id
Modified Paths:
--------------
trunk/catalog/includes/functions/html_output.php
Modified: trunk/catalog/includes/functions/html_output.php
===================================================================
--- trunk/catalog/includes/functions/html_output.php 2013-12-21 16:04:13 UTC (rev 4981)
+++ trunk/catalog/includes/functions/html_output.php 2013-12-23 09:57:38 UTC (rev 4982)
@@ -243,9 +243,9 @@
@remarks width or height are used to precise a max width or max height of output image
*/
function tep_image($src_org, $alt = '', $width = '', $height = '', $parameters = '',$mode=false) {
- if(strpos($src_org, DIR_WS_IMAGES) ===0)
- $src = substr($src_org, strlen(DIR_WS_IMAGES));
+ $src = ( (strpos($src_org, DIR_WS_IMAGES) ===0) ? substr($src_org, strlen(DIR_WS_IMAGES)) : $src_org ) ;
+
if(preg_match('#^([0-9]*){1,11}$#', $src))
$psrc = 'id='.$src;
elseif(preg_match('#^([0-9a-z]*){32}$#', $src))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-21 16:04:17
|
Revision: 4981
http://sourceforge.net/p/oscss/svn/4981
Author: oscim
Date: 2013-12-21 16:04:13 +0000 (Sat, 21 Dec 2013)
Log Message:
-----------
Fix next upgrade code
Clean display_viex method for ModTxo module
add unittest
Modified Paths:
--------------
trunk/catalog/admin/includes/modules/pages/cms_content.php
trunk/catalog/admin/includes/modules/pages/customers.php
trunk/catalog/admin/includes/modules/pages/featureds.php
trunk/catalog/admin/includes/modules/pages/orders.php
trunk/catalog/admin/includes/modules/pages/products.php
trunk/catalog/admin/includes/modules/pages/rapport.php
trunk/catalog/admin/includes/modules/pages/services.php
trunk/catalog/admin/includes/modules/pages/shipping.php
trunk/catalog/admin/includes/modules/pages/tax_classes.php
trunk/catalog/admin/includes/modules/pages/usersNotif.php
trunk/catalog/create_account.php
trunk/catalog/includes/classes/payment.php
trunk/catalog/includes/modules/payment/cod.php
trunk/catalog/includes/modules/payment/moneyorder.php
trunk/test/phpunit/Front/shoppingcartTest.php
Added Paths:
-----------
trunk/test/phpunit/Front/paymentTest.php
Modified: trunk/catalog/admin/includes/modules/pages/cms_content.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/cms_content.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/cms_content.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -726,6 +726,7 @@
*/
public function display_view(){
$action=self::$action;
+ $MG= false;
switch ($action) {
@@ -758,25 +759,26 @@
@remarks Normal View Page
*/
case 'new':
- self::$Info=self::load_db_values(-1);
- return MGabCont::CallGab(self::$action,__FUNCTION__,__CLASS__);
+ self::$Info=self::GetDBValue();
break;
case 'edit':
case 'noedit':
case 'delete':
- self::$Info=self::GetDBValue(self::$Id);
- /// use master gabarit
- return MGabCont::CallGab(self::$action,__FUNCTION__,self::MASTER);
+ $MG= true;
+ self::$Info=self::GetDBValue();
break;
case 'listing':
default:
- self::$list=self::tep_get_list();
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
- return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
+ $MG= true;
+ $action='listing';
}
+
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
Modified: trunk/catalog/admin/includes/modules/pages/customers.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/customers.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/customers.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -925,7 +925,6 @@
else {
$MG= true;
$action='listing';
- self::$list=self::tep_get_list();
}
}
Modified: trunk/catalog/admin/includes/modules/pages/featureds.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/featureds.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/featureds.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -493,7 +493,10 @@
@brief this methode is switch for call gabarit action
*/
public function display_view(){
- switch (parent::$action) {
+ $action = self::$action;
+ $MG= false;
+
+ switch ($action) {
/**
@remarks Ajax View result
*/
@@ -506,25 +509,25 @@
@remarks Normal View Page
*/
case 'new':
-// self::load_db_values(0);
- self::$Info=self::GetDBValue(-1);
- return MGabCont::CallGab('edit',__FUNCTION__,__CLASS__);
+ $action = 'edit';
break;
+ case 'delete':
case 'edit':
- self::$Info=self::GetDBValue(self::$Id);
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
+ $MG= true;
+ self::$Info=self::GetDBValue();
break;
- case 'delete':
- self::$Info=self::GetDBValue(self::$Id);
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
+
break;
case 'listing':
default:
- self::$list=self::tep_get_list();
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
- return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
+ $MG= true;
+ $action = 'listing';
}
+
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
Modified: trunk/catalog/admin/includes/modules/pages/orders.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/orders.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/orders.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -98,6 +98,8 @@
$status=(isset($_REQUEST['status'])? (string)$_REQUEST['status'] : '' );
+ MGabCont::SetCurrentName(__CLASS__);
+
self::$export= new export(__CLASS__);
/**
@@ -1168,9 +1170,12 @@
public function display_view(){
+ $MG= false;
+ $action = self::$action;
- switch (self::$action) {
+ switch ($action) {
+
/**
@remarks Ajax View result
*/
@@ -1180,14 +1185,6 @@
elseif(isset($_GET['auto_retry']))
return self::GetServiceStatus(array('auto_retry'=>(int)self::$internal->auto_retry, 'row_id'=>(int)$_GET['sID']), false);
break;
-
- /**
- @remarks Normal View Page
- */
- case 'multi':
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
- break;
-
case 'editmod':
if(self::test_oID((int)self::$oID)) {
self::$order= sqlorder::fetch(array('id'=>self::$oID));
@@ -1196,6 +1193,13 @@
}
break;
+
+ /**
+ @remarks Normal View Page
+ */
+ case 'multi':
+ break;
+
case 'delete':
case 'edit':
case 'copy_to':
@@ -1203,16 +1207,18 @@
break;
case 'new':
self::$order=self::GetDBValue();
-
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
break;
+ case 'listing':
default:
- self::load_db_values();
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
- return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
+ $MG= true;
+ $action = 'listing';
}
+
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
Modified: trunk/catalog/admin/includes/modules/pages/products.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/products.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/products.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -1374,7 +1374,9 @@
public function display_view() {
formUtility::Init();
$action=self::$action;
+ $MG= false;
+
switch(self::$action){
case 'update_cell':
break;
@@ -1426,39 +1428,33 @@
@remarks Normal View Page
*/
- case 'multi':
- self::$Info = self::GetDBValue();
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
- break;
-
-
case 'noedit':
$action = 'edit';
case 'copy_to':
case 'delete':
- self::$Info=self::GetDBValue();
case 'new':
case 'edit':
+ case 'multi':
self::$Info=self::GetDBValue();
+ break;
- return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
-// return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ case 'listing':
default:
- if(!empty(self::$actions['action_method']) ){
- $action='aca_actions';
+ $action=(!empty(self::$actions['action_method'])
+ ? 'aca_actions'
+ : 'listing'
+ );
/// use master gabarit
- return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
+ $MG= true;
- }
- else {
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
- return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
-
- }
}
+
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
Modified: trunk/catalog/admin/includes/modules/pages/rapport.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/rapport.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/rapport.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -49,6 +49,9 @@
self::$action=(isset($_REQUEST['action'])? (string)$_REQUEST['action'] : 'listing' );
self::$Id=(isset($_REQUEST['cID'])? (string)$_REQUEST['cID'] : 0 );
+
+ MGabCont::SetCurrentName(__CLASS__);
+
/**
@remarks define var execution sql in GetDBValue()
*/
@@ -286,17 +289,18 @@
@brief this methode is switch for call gabarit action
*/
public function display_view(){
- switch (parent::$action) {
+ $action = self::$action;
+ switch ($action) {
/**
@remarks Normal View Page
*/
case 'listing':
default:
- self::$list=self::tep_get_list();
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
- return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
+ $action = 'listing';
+
}
+
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
}
Modified: trunk/catalog/admin/includes/modules/pages/services.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/services.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/services.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -108,6 +108,7 @@
);
+ MGabCont::SetCurrentName(__CLASS__);
/**
@remarks not load if not first init
@@ -598,8 +599,10 @@
public function display_view(){
+ $action = self::$action;
+ $MG= false;
- switch (self::$action) {
+ switch ($action) {
/**
@remarks Ajax View result
@@ -614,31 +617,25 @@
/**
@remarks Normal View Page
*/
+ case 'multi':
+ case 'edit':
+ case 'new':
case 'delete':
- self::$oInfo=self::GetDBValue();
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
+ self::$oInfo=self::GetDBValue();
break;
- case 'multi':
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
- break;
- case 'new':
- self::$cInfo=self::GetDBValue();
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
- break;
+ case 'listing':
+ default:
- case 'edit':
- self::$order= self::GetDBValue();
+ $MG= true;
+ $action = 'listing';
+ }
- return MGabCont::CallGab(parent::$action,__FUNCTION__,__CLASS__);
- break;
- default:
- self::load_db_values();
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
- return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
- }
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
Modified: trunk/catalog/admin/includes/modules/pages/shipping.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/shipping.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/shipping.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -721,17 +721,16 @@
case 'new':
$action='edit';
- case 'edit':
self::$Info=self::GetDBValue();
break;
+ case 'edit':
case 'delete':
$MG= true;
self::$Info=self::GetDBValue();
break;
default:
- self::load_db_values();
$action='listing';
$MG= true;
}
Modified: trunk/catalog/admin/includes/modules/pages/tax_classes.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/tax_classes.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/tax_classes.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -503,8 +503,10 @@
public function display_view(){
+ $action=self::$action;
+ $MG= false;
- switch (self::$action) {
+ switch ($action) {
/**
@remarks Ajax View result
*/
@@ -519,12 +521,13 @@
@remarks Normal View Page
*/
case 'sub_new':
- return MGabCont::CallGab('edit.sub',__FUNCTION__,__CLASS__);
+ $action = 'edit.sub';
break;
+
case 'sub_delete':
case 'sub_edit':
self::$Info= self::GetDBValue();
- return MGabCont::CallGab(str_replace('sub_','',self::$action).'.sub',__FUNCTION__,__CLASS__);
+ $action = str_replace('sub_','',$action).'.sub';
break;
@@ -532,21 +535,20 @@
$action = 'edit';
case 'delete':
case 'edit':
- if(!isset($action))
- $action = self::$action;
-
self::$Info= self::GetDBValue();
-
- return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
break;
case 'listing':
default:
- self::$list=self::GetDBValue();
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
- return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
+ $action='listing';
+ $MG= true;
}
+
+
+ if($MG)
+ return MGabCont::CallGab($action,__FUNCTION__,self::MASTER);
+ else
+ return MGabCont::CallGab($action,__FUNCTION__,__CLASS__);
}
Modified: trunk/catalog/admin/includes/modules/pages/usersNotif.php
===================================================================
--- trunk/catalog/admin/includes/modules/pages/usersNotif.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/admin/includes/modules/pages/usersNotif.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -58,6 +58,8 @@
self::$action=(isset($_REQUEST['action'])? (string)$_REQUEST['action'] : 'listing' );
self::$Id=(isset($_REQUEST['cID'])? (int)$_REQUEST['cID'] : 0 );
+ MGabCont::SetCurrentName(__CLASS__);
+
/**
@remarks define var execution sql in GetDBValue()
*/
@@ -280,21 +282,6 @@
@remarks Normal View Page
*/
case 'view':
-// global $language_id;
-//
-// if( (int)self::$Id > 0) {
-// self::$Info = sqlcontent::fetch(array('id'=>self::$Id,'language_id'=>$language_id), true);
-// }
-// else{
-// self::$Info = sqlcontent::Specimen(true);
-// }
-//
-// if (!isset(self::$Info->status)) self::$Info->status = '1';
-// switch (self::$Info->status) {
-// case '0': self::$enabled_status = false; self::$disabled_status = true; break;
-// case '1':
-// default: self::$enabled_status = true; self::$disabled_status = false;
-// }
$DB=Database::getInstance();
$res=$DB->query($sql="SELECT notif_id,notif_type,user_id,notif_key,notif_data,notif_text, notif_date FROM ".TABLE_ADMIN_NOTIFICATION." WHERE notif_id='".(int)self::$Id ."' AND ( ( notif_type='0' and user_id='".$_SESSION['login_id']."') OR (notif_type='1' and user_id='".$_SESSION['login_groups_id']."') )");
self::$Info=new objectInfo($res->fetchAssoc());
@@ -376,11 +363,7 @@
// case 'setflag':
// return self::RowStatus(array('status'=>(int)$_GET['flag'], 'id'=>(int)self::$Id));
// break;
-// case 'viewflag':
-// return self::RowHidden(array('hidden'=>(int)$_GET['flag'], 'id'=>(int)self::$Id));
-// break;
-
/**
@remarks Normal View Page
*/
@@ -394,9 +377,6 @@
return tep_get_include_contents(self::$code.'/display_view.view');
break;
default:
- self::$list=self::tep_get_list();
- /// use master gabarit
- MGabCont::SetCurrentName(__CLASS__);
return MGabCont::CallGab('listing',__FUNCTION__,self::MASTER);
}
Modified: trunk/catalog/create_account.php
===================================================================
--- trunk/catalog/create_account.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/create_account.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -197,7 +197,7 @@
if(!$cust->checkHash($hash)) throw new Exception( __('text error email and hash no found'). '<br /><a href="'.tep_href_link(FILENAME_CREATE_ACCOUNT,'action=newconfirm').'">'.__('text new sent confirm').'</a>' );
- $page->messageStack->add_session('create_account', __('text account confirmed');
+ $page->messageStack->add_session('create_account', __('text account confirmed') );
/// init session
customer::initSession($user);
Modified: trunk/catalog/includes/classes/payment.php
===================================================================
--- trunk/catalog/includes/classes/payment.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/includes/classes/payment.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -39,7 +39,7 @@
@brief constructor
@param $module specific load module
*/
- function __construct($module='') {
+ protected function __construct($module='') {
self::initialise($module);
}
@@ -50,9 +50,9 @@
return self::$_instance;
}
- public static function resetInstance(){
+ public static function resetInstance($module=''){
self::$_instance = null;
- return self::getInstance();
+ return self::getInstance($module);
}
@@ -186,11 +186,11 @@
if (is_array($this->mod)) {
reset($this->mod);
foreach($this->mod as $class){
- if (isset($GLOBALS[$class]) && $GLOBALS[$class]->enabled) {
- $selection = $GLOBALS[$class]->selection();
- if (is_array($selection))
- $selection_array[] = $selection;
- }
+ if (isset($GLOBALS[$class]) && $GLOBALS[$class]->enabled) {
+ $selection = $GLOBALS[$class]->selection();
+ if (is_array($selection))
+ $selection_array[] = $selection;
+ }
}
}
return $selection_array;
@@ -202,7 +202,7 @@
public function pre_confirmation_check() {
if (is_array($this->mod)) {
if (is_object($GLOBALS[self::$selected_module]) && ($GLOBALS[self::$selected_module]->enabled) && method_exists($GLOBALS[self::$selected_module], 'pre_confirmation_check') ) {
- $GLOBALS[self::$selected_module]->pre_confirmation_check();
+ $GLOBALS[self::$selected_module]->pre_confirmation_check();
}
}
@@ -214,7 +214,7 @@
public function confirmation() {
if (is_array($this->mod)) {
if (is_object($GLOBALS[self::$selected_module]) && ($GLOBALS[self::$selected_module]->enabled) && method_exists($GLOBALS[self::$selected_module], 'confirmation') ) {
- return $GLOBALS[self::$selected_module]->confirmation();
+ return $GLOBALS[self::$selected_module]->confirmation();
}
}
}
@@ -225,7 +225,7 @@
public function process_button() {
if (is_array($this->mod)) {
if (is_object($GLOBALS[self::$selected_module]) && ($GLOBALS[self::$selected_module]->enabled)&& method_exists($GLOBALS[self::$selected_module], 'process_button') ) {
- return $GLOBALS[self::$selected_module]->process_button();
+ return $GLOBALS[self::$selected_module]->process_button();
}
}
}
@@ -236,7 +236,7 @@
function before_process() {
if (is_array($this->mod)) {
if (is_object($GLOBALS[self::$selected_module]) && ($GLOBALS[self::$selected_module]->enabled)&& method_exists($GLOBALS[self::$selected_module], 'before_process') ) {
- return $GLOBALS[self::$selected_module]->before_process();
+ return $GLOBALS[self::$selected_module]->before_process();
}
}
}
@@ -247,7 +247,7 @@
public function after_process() {
if (is_array($this->mod)) {
if (is_object($GLOBALS[self::$selected_module]) && ($GLOBALS[self::$selected_module]->enabled)&& method_exists($GLOBALS[self::$selected_module], 'after_process') ) {
- return $GLOBALS[self::$selected_module]->after_process();
+ return $GLOBALS[self::$selected_module]->after_process();
}
}
}
@@ -258,7 +258,7 @@
function payment_succes() {
if (is_array($this->mod)) {
if (is_object($GLOBALS[self::$selected_module]) && ($GLOBALS[self::$selected_module]->enabled)&& method_exists($GLOBALS[self::$selected_module], 'payment_succes') ) {
- return $GLOBALS[self::$selected_module]->payment_succes();
+ return $GLOBALS[self::$selected_module]->payment_succes();
}
}
}
@@ -266,7 +266,7 @@
public function get_error() {
if (is_array($this->mod)) {
if (is_object($GLOBALS[self::$selected_module]) && ($GLOBALS[self::$selected_module]->enabled)&& method_exists($GLOBALS[self::$selected_module], 'pre_confirmation_check') ) {
- return $GLOBALS[self::$selected_module]->get_error();
+ return $GLOBALS[self::$selected_module]->get_error();
}
}
}
Modified: trunk/catalog/includes/modules/payment/cod.php
===================================================================
--- trunk/catalog/includes/modules/payment/cod.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/includes/modules/payment/cod.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -15,6 +15,7 @@
public $description;
public $sort_order;
public $enabled;
+ public $icon;
// class constructor
function cod() {
@@ -24,6 +25,7 @@
$this->title = __('module payment cod text title');
$this->description = __('module payment cod text description');
$this->sort_order = (defined('MODULE_PAYMENT_COD_SORT_ORDER') ? MODULE_PAYMENT_COD_SORT_ORDER : 0 );
+ $this->icon = ((defined('MODULE_PAYMENT_COD_ICON') && tep_not_null('MODULE_PAYMENT_COD_ICON'))? substr(MODULE_PAYMENT_COD_ICON,strlen(DIR_WS_CATALOG)) : '');
$this->enabled = true;
if (defined('MODULE_PAYMENT_COD_ORDER_STATUS_ID') && (int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {
@@ -97,9 +99,9 @@
return false;
}
- /**
- @remarks implements InterfaceModule depend
- if module twin in backoffice, report all content install in the other module
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
public function check() {return true;}
public function install() {return true;}
public function remove() {return true;}
Modified: trunk/catalog/includes/modules/payment/moneyorder.php
===================================================================
--- trunk/catalog/includes/modules/payment/moneyorder.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/catalog/includes/modules/payment/moneyorder.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -65,7 +65,8 @@
public function javascript_validation() { return false; }
public function selection() {
- return array( 'id' => $this->code,
+ return array(
+ 'id' => $this->code,
'module' => $this->title,
'icon'=>tep_image($this->icon, $this->title)
);
@@ -98,9 +99,9 @@
/** Interface InterfaceModule */
- /**
- @remarks implements InterfaceModule depend
- if module twin in backoffice, report all content install in the other module
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
public function check() {return true;}
public function install() {return true;}
public function remove() {return true;}
Added: trunk/test/phpunit/Front/paymentTest.php
===================================================================
--- trunk/test/phpunit/Front/paymentTest.php (rev 0)
+++ trunk/test/phpunit/Front/paymentTest.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -0,0 +1,259 @@
+<?php
+/**
+ * \file test/phpunit/customerTest.php
+ * \brief test unitaire class customer public
+ * \remarks To run this script as CLI: phpunit filename.php
+ * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ */
+
+// specific for test
+require('_top.php');
+
+// load init language
+$page->init('account.php',$language);
+
+// load class
+include_once($base_path.'common/classes/datetimeUtility.php');
+include_once($base_path.'common/classes/order.php');
+include_once($base_path.'includes/classes/payment.php');
+include_once($base_path.'includes/classes/shopping_cart_action.php');
+include_once($base_path.'includes/classes/Stock.php');
+include_once($base_path.'includes/classes/drivers/data/product.php');
+/**
+ * \class customerTest
+ */
+class paymentTest
+ extends PHPUnit_Framework_TestCase
+{
+
+ static public $userId;
+
+ function __construct()
+ {
+
+
+ //! tot cart
+// $total_weight = $cart->show_weight();
+// $total_count = $cart->count_contents();
+
+
+ }
+
+ protected function setUp()
+ {
+// global $user,$address;
+
+
+ $address=array( 'gender'=>'m',
+ 'firstname' => 'testtest2',
+ 'lastname' => 'testtest2',
+ 'email_address' => 'os...@os...',
+ 'street_address'=>'testtest2',
+ 'suburb'=>'',
+ 'postcode'=>'78000',
+ 'city'=>'test',
+ 'country'=>'73',
+ 'company'=>'',
+ 'company_tax_id'=>'',
+ );
+ }
+
+ /**
+ * \brief test if not exist user for email in db
+ */
+ public function testpaymentshoppingcart_NotExist(){
+ $cart = new shoppingCart();
+
+ self::InitUser();
+ $this -> assertTrue ( (is_object($cart)) , 'user exists, not test possible ' ) ;
+
+ return $cart;
+ }
+
+ /**
+ * \brief test if not exist user for email in db
+ * @depends testpaymentshoppingcart_NotExist
+ */
+ public function testpaymentshoppingcart($cart){
+ global $cart;
+
+ self::InitUser();
+ $_GET['products_id'] = '9';
+ $_GET['noredirect'] = false;
+
+ $shop_action=new shopping_cart_action();
+ $shop_action->init('buy_now');
+
+
+ $this -> assertTrue ( ($cart->count_contents()>0 ) , 'user exists, not test possible ' ) ;
+
+ $this->cart = $cart;
+ return $cart;
+ }
+
+
+
+ /**
+ * \brief test if not exist user for email in db
+ * @depends testpaymentshoppingcart
+ */
+ public function testpaymentloadclass($cart){
+ global $order;
+ //! load order
+ $order = new order;
+
+ $total_weight = $cart->show_weight();
+ $total_count = $cart->count_contents();
+
+ // load all enabled payment modules
+ $payment = payment::resetInstance();
+// resetInstance($module='')
+ $this -> assertTrue ( (is_object($payment)) , 'error payment loadclass' ) ;
+
+ $this -> assertTrue ( (is_array($payment->modules) && count($payment->modules) >0 ) , 'error payment modules subchilds no active, please adjust config in backoffice pannel' ) ;
+
+ return $payment;
+ }
+
+ /**
+ * \brief test if not exist user for email in db
+ * @depends testpaymentshoppingcart
+ */
+ public function testpaymentselection($cart){
+ //! load order
+ $order = new order;
+
+ //! tot cart
+ $total_weight = $cart->show_weight();
+ $total_count = $cart->count_contents();
+
+ $payment = payment::resetInstance();
+
+ $payment->update_status();
+
+ $selection= $payment->selection();
+
+ $this -> assertTrue ( (count($selection) > 0) , 'error payment loadclass selection' ) ;
+
+// print_r($selection);
+// exit;
+ foreach($selection as $row){
+ $this->assertArrayHasKey('id', $row);
+ $this->assertArrayHasKey('module', $row);
+ //$this->assertArrayHasKey('icon', $row);
+ }
+
+// return $selection;
+ }
+
+
+ /**
+ * \brief test if not exist user for email in db
+ * @depends testpaymentshoppingcart
+ */
+ public function testpaymentloadmodule($cart){
+ //! load order
+ $order = new order;
+
+ //! tot cart
+ $total_weight = $cart->show_weight();
+ $total_count = $cart->count_contents();
+
+
+ $payment = payment::resetInstance();
+
+
+ $selection= $payment->selection();
+
+ foreach($selection as $row){
+ $paymentselect = payment::resetInstance($row['id']);
+
+
+ $this -> assertTrue ( (count($paymentselect->mod) > 0) , 'error payment loadmodule selection for '.$row['id'] ) ;
+ $this -> assertTrue ( (count($paymentselect->modules) > 0) , 'error payment loadmodule selection for '.$row['id'] ) ;
+
+ $current = $paymentselect->modules[$row['id']];
+
+ // no return
+ $paymentselect->pre_confirmation_check();
+ //check data return by module
+ self::checkobjectpaymentselect($current);
+
+
+
+ $res = $paymentselect->confirmation();
+
+ if($res !=false){
+
+ }
+ else
+ $this -> assertTrue ( true , 'error payment loadmodule selection for '.$row['id'].' step confirmation ' ) ;
+
+ $res = $paymentselect->process_button();
+ if($res !=false){
+
+ }
+ else
+ $this -> assertTrue ( true , 'error payment loadmodule selection for '.$row['id'].' step process_button ' ) ;
+
+ $res = $paymentselect->before_process();
+ if($res !=false){
+
+ }
+ else
+ $this -> assertTrue ( true , 'error payment loadmodule selection for '.$row['id'].' step before_process ' ) ;
+
+ $res = $paymentselect->after_process();
+ if($res !=false){
+
+ }
+ else
+ $this -> assertTrue ( true , 'error payment loadmodule selection for '.$row['id'].' step after_process ' ) ;
+
+ $res = $paymentselect->payment_succes();
+ if($res !=false){
+
+ }
+ else
+ $this -> assertTrue ( true , 'error payment loadmodule selection for '.$row['id'].' step payment_succes ' ) ;
+
+ $res = $paymentselect->get_error();
+ if($res !=false){
+
+ }
+ else
+ $this -> assertTrue ( true , 'error payment loadmodule selection for '.$row['id'].' step get_error ' ) ;
+ }
+ }
+
+
+ /**
+ @brief all test detail array method
+ */
+ public function checkobjectpaymentselect($current){
+
+ $this->assertTrue ( (isset($current->code)) , 'error checkobjectpaymentselect no found code ') ;
+ $this->assertTrue ( (isset($current->title)) , 'error checkobjectpaymentselect no found title ') ;
+ $this->assertTrue ( (isset($current->description)) , 'error checkobjectpaymentselect no found description ') ;
+
+ $this->assertTrue ( (isset($current->sort_order)) , 'error checkobjectpaymentselect no found sort ') ;
+ $this->assertTrue ( (isset($current->enabled)) , 'error checkobjectpaymentselect no found enabled ') ;
+
+ $this->assertTrue ( (isset($current->icon)) , 'error checkobjectpaymentselect no found icon ') ;
+// $this->assertTrue ( (isset($current->email_footer)) , 'error checkobjectpaymentselect no found email_footer ') ;
+
+ }
+
+
+ /**
+ @brief call user and init session
+ */
+ public static function InitUser(){
+ $cust=customer::getInstance( );
+ $user=$cust->the_customer( 1 , true);
+ customer::initSession($user, true);
+ }
+}
+
+
+?>
\ No newline at end of file
Modified: trunk/test/phpunit/Front/shoppingcartTest.php
===================================================================
--- trunk/test/phpunit/Front/shoppingcartTest.php 2013-12-21 10:33:31 UTC (rev 4980)
+++ trunk/test/phpunit/Front/shoppingcartTest.php 2013-12-21 16:04:13 UTC (rev 4981)
@@ -33,38 +33,18 @@
protected function setUp()
{
-// global $user,$address;
-
-/*
- $address=array( 'gender'=>'m',
- 'firstname' => 'testtest2',
- 'lastname' => 'testtest2',
- 'email_address' => 'os...@os...',
- 'street_address'=>'testtest2',
- 'suburb'=>'',
- 'postcode'=>'78000',
- 'city'=>'test',
- 'country'=>'73',
- 'company'=>'',
- 'company_tax_id'=>'',
- );*/
}
/**
* \brief test if not exist user for email in db
*/
public function testshoppingcart_NotExist(){
-// global $page,$user;
-
-
$cart = new shoppingCart();
self::InitUser();
-// echo $page->messageStack->_draw('error');
+ $this -> assertTrue ( (is_object($cart)) , 'hoppingcart not exists' ) ;
- $this -> assertTrue ( (is_object($cart)) , 'user exists, not test possible ' ) ;
-
return $cart;
}
@@ -83,16 +63,14 @@
$shop_action->init('buy_now');
- $this -> assertTrue ( ($cart->count_contents()>0 ) , 'user exists, not test possible ' ) ;
+ $this -> assertTrue ( ($cart->count_contents()>0 ) , 'shoppingcart insert error ' ) ;
return $cart;
}
-
-
-
-
-
+ /**
+ @brief call user and init session
+ */
public static function InitUser(){
$cust=customer::getInstance( );
$user=$cust->the_customer( 1 , true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <os...@us...> - 2013-12-21 10:33:35
|
Revision: 4980
http://sourceforge.net/p/oscss/svn/4980
Author: oscim
Date: 2013-12-21 10:33:31 +0000 (Sat, 21 Dec 2013)
Log Message:
-----------
Fix and next devolop test uit for frontoffice page
Modified Paths:
--------------
trunk/catalog/common/classes/shoppingCart.php
trunk/catalog/includes/appli_top_Test.php
trunk/catalog/includes/classes/core_page/account.php
trunk/catalog/includes/classes/core_page/customer.php
trunk/catalog/includes/classes/shipping.php
trunk/catalog/includes/classes/shopping_cart_action.php
trunk/catalog/includes/inc_base_lib.php
trunk/catalog/includes/languages/fr_FR/account.txt
trunk/catalog/includes/modules/shipping/flat.php
trunk/catalog/includes/modules/shipping/item.php
trunk/catalog/includes/modules/shipping/mzmt.php
trunk/catalog/includes/modules/shipping/spu.php
trunk/test/phpunit/Front/customerTest.php
Added Paths:
-----------
trunk/test/phpunit/Front/shippingTest.php
trunk/test/phpunit/Front/shoppingcartTest.php
Removed Paths:
-------------
trunk/test/phpunit/Front/orders_Test.php
Modified: trunk/catalog/common/classes/shoppingCart.php
===================================================================
--- trunk/catalog/common/classes/shoppingCart.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/common/classes/shoppingCart.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -224,8 +224,6 @@
$this->contents[$products_id_string] = array('qty' => $qty);
if(!empty($special_class)) $this->contents[$products_id_string]['special_class'] = $special_class;
-
-
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
Modified: trunk/catalog/includes/appli_top_Test.php
===================================================================
--- trunk/catalog/includes/appli_top_Test.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/appli_top_Test.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -346,7 +346,7 @@
/// include the who's online functions
if (_cst_bool('WHOS_ONLINE_ACTIVE') || ( (tep_cst_define('WHOS_ONLINE_ACTIVE') =='auto') && _cst_bool('WHOS_ONLINE_FLAG')) ){
- require(DIR_WS_FUNCTIONS . 'whos_online.php');
+ require_once(DIR_WS_FUNCTIONS . 'whos_online.php');
tep_update_whos_online();
}
Modified: trunk/catalog/includes/classes/core_page/account.php
===================================================================
--- trunk/catalog/includes/classes/core_page/account.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/classes/core_page/account.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -12,7 +12,7 @@
/**
@author oscim <mail aur...@os...> <www http://www.oscim.fr>
\class AbstractProduct
- \brief
+ \brief
Force mise en forme via class absctarction des class de produits
*/
abstract class AbstractAccount {
@@ -26,7 +26,7 @@
/**
* \class account
- * \brief
+ * \brief
Class de la gestion de compte des customers les page account.php
Prend en charge des extension de type aca
*/
@@ -140,7 +140,7 @@
/**
- * \section Specifique Module
+ * \section Specifique Module
* */
Modified: trunk/catalog/includes/classes/core_page/customer.php
===================================================================
--- trunk/catalog/includes/classes/core_page/customer.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/classes/core_page/customer.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -13,6 +13,8 @@
Fonction native du noyau deporté dans cette class
*/
+require_once(DIR_WS_CLASSES . 'core_page/account.php');
+
class customer {
/**
@@ -64,9 +66,10 @@
/**
* \brief fetch user data
* @param $customer_id integer
+ * @param $CleanKey true/false if false retrun format key and is object , else retrun array and long key
* @return array
*/
- public function the_customer($customer_id=''){
+ public function the_customer($customer_id='', $CleanKey=false){
global $page;
if(!is_numeric($customer_id)) return $this->customer;
@@ -74,7 +77,7 @@
$this->customer_id=(int)$customer_id;
$this->detail_cust();
- return $this->customer;
+ return ((!$CleanKey)? $this->customer : self::CleanKey($this->customer) );
}
/**
@@ -183,51 +186,65 @@
$this->languages_id=$page->the_var('languages_id');
$newcustomer=array();
+ $DB = Database::getInstance();
+ $error=0;
+
+ $DB->beginTransaction();
+
if ( ( ($resul=$this->CheckData($_post)) && $resul !=false && is_array($resul))
- && ( ($pass=$this->CheckDataPassword($_post)) && $pass !=false && is_array($pass) ) ){
+ && ( ($pass=$this->CheckDataPassword($_post)) && $pass !=false && is_array($pass) ) ){
- $resul=array_merge($pass,$resul);
+ $resul=array_merge($pass,$resul);
- /// include the password crypto functions
-// require_once(DIR_WS_FUNCTIONS . 'password_funcs.php');
+ /// include the password crypto functions
+ // require_once(DIR_WS_FUNCTIONS . 'password_funcs.php');
- if (_cst_bool('CUSTOMER_FORCE_UCWORDS')) {
- $resul['lastname']=ucwords($resul['lastname']);
- $resul['firstname']=ucwords($resul['firstname']);
- }
- if (_cst_bool('CUSTOMER_FORCE_STRTOUPPER')) {
- $resul['lastname']=strtoupper($resul['lastname']);
- }
+ if (_cst_bool('CUSTOMER_FORCE_UCWORDS')) {
+ $resul['lastname']=ucwords($resul['lastname']);
+ $resul['firstname']=ucwords($resul['firstname']);
+ }
+ if (_cst_bool('CUSTOMER_FORCE_STRTOUPPER')) {
+ $resul['lastname']=strtoupper($resul['lastname']);
+ }
- $check_customer['customers_group_id']=(!isset($resul['type'])? 0 : 1 );
+ $check_customer['customers_group_id']=(!isset($resul['type'])? 0 : 1 );
- $sql_data_array = array(
- 'customers_type' => (int)$resul['type'],
- 'customers_firstname' => $resul['firstname'],
- 'customers_lastname' => $resul['lastname'],
- 'customers_email_address' => $resul['email_address'],
- 'customers_telephone' => $resul['telephone'],
- 'customers_fax' => $resul['fax'],
- 'customers_newsletter' => $resul['newsletter'],
- 'customers_password' =>PasswordUtility::encrypt_password($resul['password']),
- 'customers_group_id'=> $check_customer['customers_group_id'],
- // not activ if group ip > 0
- 'customers_group_ra'=> (($check_customer['customers_group_id'] > 0 )? 0 : 1 ),
- 'customers_language'=> $this->languages_id,
- 'customers_status'=> (_cst_bool('ACCOUNT_FORCE_ACTIV_MAIL')? 2 : 1)
- );
+ $sql_data_array = array(
+ 'customers_type' => (int)$resul['type'],
+ 'customers_firstname' => $resul['firstname'],
+ 'customers_lastname' => $resul['lastname'],
+ 'customers_email_address' => $resul['email_address'],
+ 'customers_telephone' => $resul['telephone'],
+ 'customers_fax' => $resul['fax'],
+ 'customers_newsletter' => $resul['newsletter'],
+ 'customers_password' =>PasswordUtility::encrypt_password($resul['password']),
+ 'customers_group_id'=> $check_customer['customers_group_id'],
+ // not activ if group ip > 0
+ 'customers_group_ra'=> (($check_customer['customers_group_id'] > 0 )? 0 : 1 ),
+ 'customers_language'=> $this->languages_id,
+ 'customers_status'=> (_cst_bool('ACCOUNT_FORCE_ACTIV_MAIL')? 2 : 1)
+ );
- if (_cst_bool('ACCOUNT_GENDER')) $sql_data_array['customers_gender'] = $resul['gender'];
- if (_cst_bool('ACCOUNT_DOB')) $sql_data_array['customers_dob'] = tep_date_raw($resul['dob']);
+ if (_cst_bool('ACCOUNT_GENDER')) $sql_data_array['customers_gender'] = $resul['gender'];
+ if (_cst_bool('ACCOUNT_DOB')) $sql_data_array['customers_dob'] = tep_date_raw($resul['dob']);
- $res=tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);
- $newcustomer = $sql_data_array;
- $newcustomer['customers_id']=$customer_id=tep_db_insert_id($res);
+ $res=tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);
- tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created,customers_info_date_account_last_modified) values ('" . (int)$customer_id . "', '0', now(), now())");
+ if(!$res)
+ $error++;
+ $newcustomer = $sql_data_array;
+ $newcustomer['customers_id']=$customer_id=tep_db_insert_id($res);
+
+ $res=tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created,customers_info_date_account_last_modified) values ('" . (int)$customer_id . "', '0', now(), now())");
+
+ if(!$res)
+ $error++;;
+
+
+
/**
@brief extra fields sauf specifique admin
*/
@@ -261,7 +278,9 @@
}
}
- tep_db_perform(TABLE_EXTRA_FIELDS_TO, $sql_data_array);
+ $res = tep_db_perform(TABLE_EXTRA_FIELDS_TO, $sql_data_array);
+ if(!$res)
+ $error++;;
$newcustomer[(isset($extra_fields['fields_key'])?$extra_fields['fields_key'] : 'fields_'.$extra_fields['fields_id'])]=$sql_data_array['value'];
$newcustomer['extra'][]=array_merge($sql_data_array, array('email'=>$extra_fields['fields_required_email']) );
@@ -269,75 +288,92 @@
}
- else return false;
+ else
+ return false;
if ( ($resul=$this->CheckDataAddressBook($_post)) && $resul !=false && is_array($resul)) {
- if (_cst_bool('CUSTOMER_CITY_FORCE_STRTOUPPER')) {
- $resul['city']=strtoupper($resul['city']);
- }
+ if (_cst_bool('CUSTOMER_CITY_FORCE_STRTOUPPER')) {
+ $resul['city']=strtoupper($resul['city']);
+ }
- $sql_data_array = array('customers_id' => $customer_id,
- 'entry_firstname' => $resul['firstname'],
- 'entry_lastname' => $resul['lastname'],
- 'entry_street_address' => $resul['street_address'],
- 'entry_postcode' => $resul['postcode'],
- 'entry_city' => $resul['city'],
- 'entry_country_id' => $resul['country']);
+ $sql_data_array = array('customers_id' => $customer_id,
+ 'entry_firstname' => $resul['firstname'],
+ 'entry_lastname' => $resul['lastname'],
+ 'entry_street_address' => $resul['street_address'],
+ 'entry_postcode' => $resul['postcode'],
+ 'entry_city' => $resul['city'],
+ 'entry_country_id' => $resul['country']);
- if (_cst_bool('ACCOUNT_GENDER')) $sql_data_array['entry_gender'] = $resul['gender'];
- if (_cst_bool('ACCOUNT_COMPANY')){
- $sql_data_array['entry_company'] = $resul['company'];
- $sql_data_array['entry_company_tax_id'] = $resul['company_tax_id'];
- }
- if (_cst_bool('ACCOUNT_SUBURB')) $sql_data_array['entry_suburb'] = $resul['suburb'];
- if (_cst_bool('ACCOUNT_STATE')) {
- if (isset($resul['zone_id']) && $resul['zone_id'] > 0) {
- $sql_data_array['entry_zone_id'] = @$resul['zone_id'];
- $sql_data_array['entry_state'] = '';
- } else {
- $sql_data_array['entry_zone_id'] = '0';
- $sql_data_array['entry_state'] = @$resul['state'];
- }
- }
+ if (_cst_bool('ACCOUNT_GENDER')) $sql_data_array['entry_gender'] = $resul['gender'];
+ if (_cst_bool('ACCOUNT_COMPANY')){
+ $sql_data_array['entry_company'] = $resul['company'];
+ $sql_data_array['entry_company_tax_id'] = $resul['company_tax_id'];
+ }
+ if (_cst_bool('ACCOUNT_SUBURB')) $sql_data_array['entry_suburb'] = $resul['suburb'];
+ if (_cst_bool('ACCOUNT_STATE')) {
+ if (isset($resul['zone_id']) && $resul['zone_id'] > 0) {
+ $sql_data_array['entry_zone_id'] = @$resul['zone_id'];
+ $sql_data_array['entry_state'] = '';
+ } else {
+ $sql_data_array['entry_zone_id'] = '0';
+ $sql_data_array['entry_state'] = @$resul['state'];
+ }
+ }
- tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
+ $res=tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
+ if(!$res)
+ $error++;
- $newcustomer=array_merge($newcustomer,$sql_data_array);
+ $newcustomer=array_merge($newcustomer,$sql_data_array);
- $cs_s=tep_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where customers_id='".$customer_id."' ORDER BY address_book_id DESC");
- $cs=tep_db_fetch_array($cs_s);
- $address_id=$cs['address_book_id'];
+ $cs_s=tep_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where customers_id='".$customer_id."' ORDER BY address_book_id DESC");
+ $cs=tep_db_fetch_array($cs_s);
+ $address_id=$cs['address_book_id'];
- $newcustomer['address_book_id']= $address_id;
+ $newcustomer['address_book_id']= $address_id;
- tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
+ if(!tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'"))
+ $error++;
}
else {
- $resul=$this->CheckData($_post);
- $sql_data_array = array('customers_id' => $customer_id,
- 'entry_firstname' => $resul['firstname'],
- 'entry_lastname' => $resul['lastname']);
+ $resul=$this->CheckData($_post);
+ $sql_data_array = array('customers_id' => $customer_id,
+ 'entry_firstname' => $resul['firstname'],
+ 'entry_lastname' => $resul['lastname']);
- tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
+ if(!tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array))
+ $error++;
- $cs_s=tep_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where customers_id='".$customer_id."' ORDER BY address_book_id DESC");
- $cs=tep_db_fetch_array($cs_s);
- $address_id=$cs['address_book_id'];
+ $cs_s=tep_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where customers_id='".$customer_id."' ORDER BY address_book_id DESC");
+ $cs=tep_db_fetch_array($cs_s);
+ $address_id=$cs['address_book_id'];
- $newcustomer['address_book_id']= $address_id;
+ $newcustomer['address_book_id']= $address_id;
- tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
+ if(!tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'"))
+ $error++;
}
/**
- @brief call method module account
+ @brief call method module account
*/
$page=page::getInstance();
- $aca_account=$page->new_class('account',$customer_id);
- $aca_account->userInsert($newcustomer);
+ $aca_account=account::getInstance(); //$page->new_class('account',$customer_id);
- return (is_array($newcustomer) ? new objectInfo(self::CleanKey($newcustomer)) : false);
+ /*$res = */$aca_account->userInsert($newcustomer);
+// if(!$res)
+// $error++;
+// var_dump($error);
+ if( $error > 0){
+ $DB->rollbackTransaction();
+ return false;
+ }
+ else{
+ $DB->commitTransaction();
+ return new objectInfo(self::CleanKey($newcustomer));
+ }
+// return (is_array($newcustomer) ? new objectInfo(self::CleanKey($newcustomer)) : false);
}
@@ -351,9 +387,13 @@
public function userUpdate($_post){
global $page;
+ $DB=Database::getInstance();
+ $error = 0 ;
$this->languages_id=$page->the_var('languages_id');
+ $DB->beginTransaction();
+
if ( ($resul=$this->CheckData($_post,'',false)) && $resul !=false && is_array($resul)) {
$sql_data_array = array('customers_firstname' => $resul['firstname'],
@@ -365,62 +405,81 @@
if (_cst_bool('ACCOUNT_GENDER')) $sql_data_array['customers_gender'] = $resul['gender'];
if (_cst_bool('ACCOUNT_DOB')) $sql_data_array['customers_dob'] = tep_date_raw($resul['dob']);
- tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . $this->customer_id . "'");
+ if( !tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . $this->customer_id . "'") )
+ $error++;
- tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . $this->customer_id . "'");
+ if(! tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . $this->customer_id . "'") )
+ $error++;
/**
* TODO: Reporter usage function up adress book
*/
- $res=array();
- $bas_user=tep_db_query("select fields_id from " . TABLE_EXTRA_FIELDS_TO . " where data_type='customer' AND data_id='" . $this->customer_id."';");
- while ($extra_fields = tep_db_fetch_array($bas_user)) {
- $res[]=$extra_fields['fields_id'];
- }
- $extra_fields_query = tep_db_query($sql="select ce.fields_id from " . TABLE_EXTRA_FIELDS . " ce where ce.fields_type = 'customer' AND ce.fields_status=1 and fields_admin IN(0,3) " );
+ $res=array();
+ $bas_user=tep_db_query("select fields_id from " . TABLE_EXTRA_FIELDS_TO . " where data_type='customer' AND data_id='" . $this->customer_id."';");
+ while ($extra_fields = tep_db_fetch_array($bas_user)) {
+ $res[]=$extra_fields['fields_id'];
+ }
+ $extra_fields_query = tep_db_query($sql="select ce.fields_id from " . TABLE_EXTRA_FIELDS . " ce where ce.fields_type = 'customer' AND ce.fields_status=1 and fields_admin IN(0,3) " );
- while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
- if(isset($resul['fields_' . $extra_fields['fields_id']])){
- $sql_data_array = array('value' => $resul['fields_' . $extra_fields['fields_id']]);
- }else {
- $sql_data_array = array('value' => '');
- $is_add = false;
- for($i = 1; $i <= $_post['fields_' . $extra_fields['fields_id'] . '_total']; $i++) {
- if(isset($resul['fields_' . $extra_fields['fields_id'] . '_' . $i])) {
- if($is_add) {
- $sql_data_array['value'] .= "\n";
- }
- else {
- $is_add = true;
- }
- $sql_data_array['value'] .= $resul['fields_' . $extra_fields['fields_id'] . '_' . $i];
+ while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
+ if(isset($resul['fields_' . $extra_fields['fields_id']])){
+ $sql_data_array = array('value' => $resul['fields_' . $extra_fields['fields_id']]);
+ }else {
+ $sql_data_array = array('value' => '');
+ $is_add = false;
+ for($i = 1; $i <= $_post['fields_' . $extra_fields['fields_id'] . '_total']; $i++) {
+ if(isset($resul['fields_' . $extra_fields['fields_id'] . '_' . $i])) {
+ if($is_add) {
+ $sql_data_array['value'] .= "\n";
}
+ else {
+ $is_add = true;
+ }
+ $sql_data_array['value'] .= $resul['fields_' . $extra_fields['fields_id'] . '_' . $i];
+ }
+ }
+ }
+
+ if(in_array($extra_fields['fields_id'],$res))
+ $res = tep_db_perform(TABLE_EXTRA_FIELDS_TO, $sql_data_array, 'update', "fields_id='".(int)$extra_fields['fields_id']."' AND data_type='customer' AND data_id='".(int)$this->customer_id."'");
+ else{
+ $sql_data_array['data_type']='customer';
+ $sql_data_array['data_id']=(int)$this->customer_id;
+ $sql_data_array['fields_id']=(int)$extra_fields['fields_id'];
+ $res = tep_db_perform(TABLE_EXTRA_FIELDS_TO, $sql_data_array);
+ }
+
+ if(!$res)
+ $error++;
}
- }
- if(in_array($extra_fields['fields_id'],$res)) tep_db_perform(TABLE_EXTRA_FIELDS_TO, $sql_data_array, 'update', "fields_id='".(int)$extra_fields['fields_id']."' AND data_type='customer' AND data_id='".(int)$this->customer_id."'");
- else{
- $sql_data_array['data_type']='customer';
- $sql_data_array['data_id']=(int)$this->customer_id;
- $sql_data_array['fields_id']=(int)$extra_fields['fields_id'];
- tep_db_perform(TABLE_EXTRA_FIELDS_TO, $sql_data_array);
- }
- }
+ self::PassmessageStack('account', __('success account updated'), 'success');
- self::PassmessageStack('account', __('success account updated'), 'success');
-
}
+ else
+ $error++;
/**
- @brief call method module account
+ @brief call method module account
*/
$page=page::getInstance();
- $aca_account=$page->new_class('account',$this->customer_id);
+ $aca_account=account::getInstance();//$page->new_class('account',$this->customer_id);
- $aca_account->userUpdate($_post);
+ $res = $aca_account->userUpdate($_post);
+// if(!$res)
+// $error++;
- return (($resul==false)?true:false);
+
+// return (($resul==false)?true:false);
+ if( $error > 0){
+ $DB->rollbackTransaction();
+ return false;
+ }
+ else{
+ $DB->commitTransaction();
+ return true;
+ }
}
@@ -634,10 +693,10 @@
$e=strlen('entry_');
$c=strlen('customers_');
foreach($array as $k=>$v){
- if(is_array($v)) $new_array = self::CleanKey($v, $new_array);
- elseif( substr($k,0,$e) =='entry_' ) $new_array[substr($k,$e)] =$v;
- elseif( substr($k,0,$c) =='customers_' ) $new_array[substr($k,$c)] =$v;
- else $new_array[$k] =$v;
+ if(is_array($v)) $new_array = self::CleanKey($v, $new_array);
+ elseif( substr($k,0,$e) =='entry_' ) $new_array[substr($k,$e)] =$v;
+ elseif( substr($k,0,$c) =='customers_' ) $new_array[substr($k,$c)] =$v;
+ else $new_array[$k] =$v;
}
return $new_array;
@@ -705,14 +764,16 @@
private static function PassmessageStack($class, $mess, $type='error'){
global $page;
$methode=self::$methodeMessage;
+// var_dump($class, $mess, $type);
$page->messageStack->$methode($class, $mess, $type);
}
/**
- @fn CheckData($post)
+ @fn CheckDataPassword($_post)
@brief check data post
@param $post array $_POST
check array(password, confirmation);
+ @return array or false
*/
private function CheckDataPassword($_post){
global $page;
@@ -741,9 +802,9 @@
/**
- @fn CheckData($post)
- @brief check data post
+ @fn CheckDataAddressBook($_post,$ErrorClass=''
@param $post array $_POST
+ @return array or false
*/
public function CheckDataAddressBook($_post,$ErrorClass=''){
global $page;
@@ -751,7 +812,7 @@
$DB=Database::getInstance();
$error = false;
- if ( ($resul=$this->CheckDataName($_POST, 'addressbook')) && $resul !=false && is_array($resul)) $sortie=$resul;
+ if ( ($resul=$this->CheckDataName($_post, 'account')) && $resul !=false && is_array($resul)) $sortie=$resul;
else $error = true;
if(_cst_bool('ACCOUNT_COMPANY')) {
@@ -820,14 +881,15 @@
/**
- @fn CheckData($post)
- @brief check data post, this is information for name, lastane and gender
+ @fn CheckDataName($_post,$ErrorClass=''
@param $post array $_POST
+ @return array or false
*/
private function CheckDataName($_post,$ErrorClass=''){
$sortie = array();
$error = false;
+
if (_cst_bool('ACCOUNT_GENDER')) {
if (isset($_post['gender'])) {
$sortie['gender'] = tep_db_prepare_input($_post['gender']);
@@ -842,17 +904,17 @@
if (_cst_bool('ACCOUNT_GENDER') && !in_array($sortie['gender'],array('m','f','l')) ) {
$error = true;
- self::PassmessageStack('gender', ENTRY_GENDER_ERROR);
+ self::PassmessageStack('gender', __('entry gender required'));
}
if (strlen($sortie['firstname']) < ENTRY_FIRST_NAME_MIN_LENGTH) {
$error = true;
- self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'firstname'), ENTRY_FIRST_NAME_ERROR);
+ self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'firstname'), sprintf(__('entry first name error %s'), ENTRY_FIRST_NAME_MIN_LENGTH) );
}
if (strlen($sortie['lastname']) < ENTRY_LAST_NAME_MIN_LENGTH) {
$error = true;
- self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'lastname'), ENTRY_LAST_NAME_ERROR);
+ self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'lastname'), sprintf(__('entry last name error %s'), ENTRY_LAST_NAME_MIN_LENGTH) );
}
return (!$error) ? $sortie : false;
@@ -871,8 +933,10 @@
$sortie = array();
$error = false;
- if ( ($resul=$this->CheckDataName($_post, 'addressbook')) && $resul !=false && is_array($resul)) $sortie=$resul;
- else $error = true;
+ if ( ($resul=$this->CheckDataName($_post, 'account')) && $resul !=false && is_array($resul) )
+ $sortie=$resul;
+ else
+ $error = true;
if (_cst_bool('ACCOUNT_DOB')) $sortie['dob'] = tep_db_prepare_input($_post['dob']);
$sortie['email_address'] = tep_db_prepare_input($_post['email_address']);
@@ -884,33 +948,35 @@
if (_cst_bool('ACCOUNT_DOB'))
if (checkdate(substr(tep_date_raw($sortie['dob']), 4, 2), substr(tep_date_raw($sortie['dob']), 6, 2), substr(tep_date_raw($sortie['dob']), 0, 4)) == false) {
- $error = true;
- self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'dob'), ENTRY_DATE_OF_BIRTH_ERROR);
+ $error = true;
+ self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'dob'), ENTRY_DATE_OF_BIRTH_ERROR);
}
if (strlen($sortie['email_address']) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
$error = true;
- self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'email_address'), ENTRY_EMAIL_ADDRESS_ERROR);
+ self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'email_address'), sprintf(__('entry email address error %s'), ENTRY_EMAIL_ADDRESS_MIN_LENGTH ));
- } elseif (tep_validate_email($sortie['email_address']) == false) {
+ }
+ if (!$error && tep_validate_email($sortie['email_address']) == false) {
$error = true;
- self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'email_address'), ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
+ self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'email_address'), __('entry email address check error'));
}
- elseif($insert) {
+
+ if(!$error && $insert) {
$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($sortie['email_address']) . "'");
$check_email = tep_db_fetch_array($check_email_query);
if ($check_email['total'] > 0) {
- $error = true;
- self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'email_address'), ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
+ $error = true;
+ self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'email_address'), __('entry email error last exists'));
}
}
if (isset($_post['telephone']) && strlen($sortie['telephone']) < ENTRY_TELEPHONE_MIN_LENGTH) {
$error = true;
- self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'telephone'), ENTRY_TELEPHONE_NUMBER_ERROR);
+ self::PassmessageStack((!empty($ErrorClass)?$ErrorClass:'telephone'), sprintf(__('entry telephone number error %s'),ENTRY_TELEPHONE_MIN_LENGTH ));
}
// if ( ($resul=$this->CheckDataPassword($_post)) && $resul !=false && is_array($resul)) $sortie=array_merge($sortie,$resul);
@@ -929,8 +995,8 @@
}
else $sortie['fields_' . $extra_fields['fields_id']]=tep_db_prepare_input($_post['fields_' . $extra_fields['fields_id']]);
}
-// print_r($sortie);
-// exit;
+
+
return (!$error) ? $sortie : false;
}
Modified: trunk/catalog/includes/classes/shipping.php
===================================================================
--- trunk/catalog/includes/classes/shipping.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/classes/shipping.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -8,9 +8,9 @@
\author oscim <mail aur...@os...> <www http://www.oscim.fr>
\encode UTF-8
\class shipping
- \file
+ \file
\dir includes/classes/
-
+
\brief class de d'appel et execution des modules de livraison
*/
@@ -93,14 +93,14 @@
$shipping_weight = $total_weight;
if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {
- $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;
+ $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;
} else {
- $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);
+ $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);
}
if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes
- self::$shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);
- $shipping_weight = $shipping_weight/self::$shipping_num_boxes;
+ self::$shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);
+ $shipping_weight = $shipping_weight/self::$shipping_num_boxes;
}
$include_quotes = array();
@@ -108,16 +108,16 @@
reset($this->modules);
foreach($this->modules as $class=>$s){
- if (tep_not_null($module)) {
- if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) $include_quotes[] = $class;
- }
- elseif ($GLOBALS[$class]->enabled) $include_quotes[] = $class;
+ if (tep_not_null($module)) {
+ if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) $include_quotes[] = $class;
+ }
+ elseif ($GLOBALS[$class]->enabled) $include_quotes[] = $class;
}
$size = sizeof($include_quotes);
for ($i=0; $i<$size; $i++) {
- $quotes = $GLOBALS[$include_quotes[$i]]->quote($method);
- if (is_array($quotes)) $quotes_array[] = $quotes;
+ $quotes = $GLOBALS[$include_quotes[$i]]->quote($method);
+ if (is_array($quotes)) $quotes_array[] = $quotes;
}
}
@@ -134,27 +134,30 @@
reset($this->modules);
foreach($this->modules as $class=>$s){
- if ($GLOBALS[$class]->enabled && (($quotes = $GLOBALS[$class]->quotes) !=false) ) {
- for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) {
- if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) {
- $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],
- 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',
- 'cost_ht' => @$quotes['methods'][$i]['cost_ht'],
- 'cost' => $quotes['methods'][$i]['cost']);
- }
- }
- }
+ if ($GLOBALS[$class]->enabled && (($quotes = $GLOBALS[$class]->quotes) !=false) ) {
+ for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) {
+ if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) {
+ $rates[] =array_merge($quotes['methods'][$i], array(
+ 'id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],
+ 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',
+// 'cost_ht' => @$quotes['methods'][$i]['cost_ht'],
+// 'cost' => $quotes['methods'][$i]['cost']
+ )
+ );
+ }
+ }
+ }
}
$cheapest = false;
for ($i=0, $n=sizeof($rates); $i<$n; $i++) {
- if (is_array($cheapest)) {
- if ($rates[$i]['cost'] < $cheapest['cost']) {
- $cheapest = $rates[$i];
- }
- } else {
- $cheapest = $rates[$i];
- }
+ if (is_array($cheapest)) {
+ if ($rates[$i]['cost'] < $cheapest['cost']) {
+ $cheapest = $rates[$i];
+ }
+ } else {
+ $cheapest = $rates[$i];
+ }
}
return $cheapest;
@@ -162,7 +165,7 @@
}
/**
- * \fn getGeoZoneID($country_id, $zone_id)
+ * \fn getGeoZoneID($country_id, $zone_id)
\brief Necessaire dans les module enfants
Control $zone_id && $country_id. Si false module desactivé
@param $country_id \a int de customers venant de order
@@ -195,8 +198,8 @@
}
/**
- * \fn get_icon($path, $title)
- * \brief display icon if exist
+ * \fn get_icon($path, $title)
+ * \brief display icon if exist
* @param $path
* @param $title
*/
Modified: trunk/catalog/includes/classes/shopping_cart_action.php
===================================================================
--- trunk/catalog/includes/classes/shopping_cart_action.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/classes/shopping_cart_action.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -83,7 +83,8 @@
} else {
$cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id'])+1);
}
- }
+ }
+
}
/**
@@ -154,7 +155,7 @@
$page->add_object('order_total_modules',$order_total_modules);
}
- // protected action card by flag autorised action
+ // protected action card by flag autorised action
if(!in_array($this->action,self::$actionCart))
return;
@@ -173,7 +174,7 @@
Si action, pas de suite , redirect contenu dans l'action
Les action des modules ot_xxx doivent avoir une methode shopping_cart_action
*/
- $href=$order_total_modules->shopping_cart_action('',$action);
+// $href=$order_total_modules->shopping_cart_action('',$action);
if(!$href)
switch ($action) {
Modified: trunk/catalog/includes/inc_base_lib.php
===================================================================
--- trunk/catalog/includes/inc_base_lib.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/inc_base_lib.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -20,15 +20,21 @@
autoload::getInstance();
if( ($path=autoload::getPath('osCSS_Cache')) && $path != false) $file[]=$path;
- if( ($path=autoload::getPath('navigation_history')) && $path != false) $file[]=$path;
- if( ($path=autoload::getPath('language')) && $path != false) $file[]=$path;
+ if( ($path=autoload::getPath('language')) && $path != false) $file[]=$path;
+ if( ($path=autoload::getPath('DataTypes')) && $path != false) $file[]=$path;
+
+ if( ($path=autoload::getPath('seo_url')) && $path != false) $file[]=$path;
+
+
+ if( ($path=autoload::getPath('messageStack')) && $path != false) $file[]=$path;
+ if( ($path=autoload::getPath('image_ratio')) && $path != false) $file[]=$path;
+
if( ($path=autoload::getPath('price')) && $path != false) $file[]=$path;
- if( ($path=autoload::getPath('image_ratio')) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('shoppingCart')) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('breadcrumb')) && $path != false) $file[]=$path;
- if( ($path=autoload::getPath('messageStack')) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('AbstractAcaModule')) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('split_page_results')) && $path != false) $file[]=$path;
+ if( ($path=autoload::getPath('navigation_history')) && $path != false) $file[]=$path;
/**
TODO Adjust load driver based on PUBLIC_TYPE_PAGE
@@ -40,6 +46,7 @@
if( ($path=autoload::getPath('page')) && $path != false) $file[]=$path;
// if( ($path=autoload::getPath('drivers/page/'.PUBLIC_DRIVERS_PAGE)) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('customer')) && $path != false) $file[]=$path;
+ if( ($path=autoload::getPath('PasswordUtility')) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('oscss_plugins')) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('oscss_modules')) && $path != false) $file[]=$path;
if( ($path=autoload::getPath('oscss_boxes')) && $path != false) $file[]=$path;
Modified: trunk/catalog/includes/languages/fr_FR/account.txt
===================================================================
--- trunk/catalog/includes/languages/fr_FR/account.txt 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/languages/fr_FR/account.txt 2013-12-21 10:33:31 UTC (rev 4980)
@@ -64,6 +64,7 @@
$lang['entry password confirmation'] = "Confirmation";
$lang['entry newsletter']="Inscription aux newsletters";
+ $lang['entry gender required'] = "Preciser votre civilité";
$lang['entry post code required'] = "Preciser un code postal";
$lang['entry city required'] = "Preciser la ville";
$lang['entry city error %s'] = "La ville doit contenir un minimum de %s caractères";
@@ -76,10 +77,12 @@
$lang['entry email error last exists'] = "Creation : Cet email existe déjà dans notre base";
$lang['entry email address required'] = "Email requis";
$lang['entry email address error %s'] = "Votre email doit contenir un minimum de %s caractères";
+ $lang['entry email address check error'] = "Email requis";
$lang['entry password confirmation not macth'] = "Les mot de passe ne corresponde pas";
$lang['entry password confirmation required'] = "Confirmation requis";
$lang['entry password required'] = "Confirmation requis";
$lang['entry telephone number required'] = "Téléphone requis";
+ $lang['entry telephone number error %s'] = "Votre téléphone doit contenir un minimum de %s caractères";
$lang['entry country required'] = "Preciser le pays";
$lang['entry street address required'] = "Preciser votre addresse";
$lang['entry street address error %s'] = "Votre addresse doit contenir un minimum de %s caractères";
Modified: trunk/catalog/includes/modules/shipping/flat.php
===================================================================
--- trunk/catalog/includes/modules/shipping/flat.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/modules/shipping/flat.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -37,7 +37,7 @@
public function quote($method = '') {
global $order;
- $delai = (defined('MODULE_SHIPPING_FLAT_MIN_DELAI')? MODULE_SHIPPING_FLAT_MIN_DELAI: 0);
+ $delai = (defined('MODULE_SHIPPING_FLAT_MIN_DELAI')? MODULE_SHIPPING_FLAT_MIN_DELAI: 0);
$array = shippingUtility::getDelai( $delai );
@@ -45,14 +45,18 @@
$this->quotes = array(
'id' => $this->code,
'module' => __('module shipping flat text title in shipping'),
- 'methods' => array(array('id' => $this->code,
- 'tax'=>0,
- 'title' => __('module shipping flat text way'),
- 'delai' => $array['delai'],
- 'date_remise_provider' => $array['date_dep'],
- 'date_delivery' => $array['date_liv'],
- 'cost_ht' => MODULE_SHIPPING_FLAT_COST,
- 'cost' => MODULE_SHIPPING_FLAT_COST))
+ 'methods' => array(
+ array(
+ 'id' => $this->code,
+ 'tax'=>0,
+ 'title' => __('module shipping flat text way'),
+ 'delai' => $array['delai'],
+ 'date_remise_provider' => $array['date_dep'],
+ 'date_delivery' => $array['date_liv'],
+ 'cost_ht' => MODULE_SHIPPING_FLAT_COST,
+ 'cost' => MODULE_SHIPPING_FLAT_COST
+ )
+ )
);
/* Si taxe, on refefini */
if ($this->tax_class > 0) {
@@ -82,9 +86,9 @@
/** Interface InterfaceModule */
- /**
- @remarks implements InterfaceModule depend
- if module twin in backoffice, report all content install in the other module
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
public function check() {return true;}
public function install() {return true;}
public function remove() {return true;}
Modified: trunk/catalog/includes/modules/shipping/item.php
===================================================================
--- trunk/catalog/includes/modules/shipping/item.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/modules/shipping/item.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -9,9 +9,9 @@
@encode UTF-8
*/
class item
- implements
+ implements
InterfaceModule,
- InterfaceAcaShipping
+ InterfaceAcaShipping
{
public $code;
@@ -44,14 +44,30 @@
public function quote($method = '') {
global $order, $total_count;
- $this->quotes = array('id' => $this->code,
+ $delai = (defined('MODULE_SHIPPING_ITEM_MIN_DELAI')? MODULE_SHIPPING_ITEM_MIN_DELAI: 0);
+
+ $array = shippingUtility::getDelai( $delai );
+
+ $this->quotes = array(
+ 'id' => $this->code,
'module' => __('module shipping item text title in shipping'),
- 'methods' => array(array('id' => $this->code,
- 'tax'=>0,
- 'title' => __('module shipping item text way'),
- 'cost_ht' => ((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING),
- 'cost' => ((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING) ))
+ 'methods' => array(
+ array(
+ 'id' => $this->code,
+ 'tax'=>0,
+ 'title' => __('module shipping item text way'),
+
+ 'delai' => $array['delai'],
+ 'date_remise_provider' => $array['date_dep'],
+ 'date_delivery' => $array['date_liv'],
+
+ 'cost_ht' => ((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING),
+ 'cost' => ((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING)
+ )
+ )
);
+
+
/* Si taxe, on refefini */
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
@@ -82,9 +98,9 @@
/** Interface InterfaceModule */
- /**
- @remarks implements InterfaceModule depend
- if module twin in backoffice, report all content install in the other module
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
public function check() {return true;}
public function install() {return true;}
public function remove() {return true;}
Modified: trunk/catalog/includes/modules/shipping/mzmt.php
===================================================================
--- trunk/catalog/includes/modules/shipping/mzmt.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/modules/shipping/mzmt.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -10,7 +10,16 @@
class mzmt
implements InterfaceModule, InterfaceAcaShipping {
- var $code, $title, $description, $icon, $enabled, $num_zones, $num_tables, $delivery_geozone, $geozone_mode, $order_total;
+ public $code,
+ $title,
+ $description,
+ $icon,
+ $enabled,
+ $num_zones,
+ $num_tables,
+ $delivery_geozone,
+ $geozone_mode,
+ $order_total;
function __construct() {
@@ -28,8 +37,10 @@
global $order;
//! block suite si BO
- if(!is_object($order)) return false;
- else $this->update_status($order);
+ if(!is_object($order))
+ return false;
+ else
+ $this->update_status($order);
}
@@ -38,10 +49,16 @@
public function quote($method = '') {
global $order, $shipping_weight;
+ $delai = (defined('MODULE_SHIPPING_MZMT_MIN_DELAI')? MODULE_SHIPPING_MZMT_MIN_DELAI: 0);
+
+ $array = shippingUtility::getDelai( $delai );
+
$combined_quote_weight = (shipping::$shipping_num_boxes * $shipping_weight);
- $this->quotes = array('id' => $this->code,
- 'module' => __('module shipping mzmt geozone ' . $this->delivery_geozone . ' text title') . ' (' . $combined_quote_weight . ' '.UNIT_WEIGHT_NAME.')',
- 'methods' => array());
+ $this->quotes = array(
+ 'id' => $this->code,
+ 'module' => __('module shipping mzmt geozone ' . $this->delivery_geozone . ' text title') . ' (' . $combined_quote_weight . ' '.UNIT_WEIGHT_NAME.')',
+ 'methods' => array()
+ );
$this->determineTableMethod(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_MODE'));
@@ -51,8 +68,14 @@
$shipping = $this->determineShipping(preg_split("/[:,]/" , constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $j)));
- $this->quotes['methods'][] = array('id' => 'table' . $j,
+ $this->quotes['methods'][] = array(
+ 'id' => 'table' . $j,
'title' => __('module shipping mzmt geozone ' . $this->delivery_geozone . ' table ' . $j . ' text way'),
+
+ 'delai' => $array['delai'],
+ 'date_remise_provider' => $array['date_dep'],
+ 'date_delivery' => $array['date_liv'],
+
'cost_ht' => $shipping + constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING'),
'cost' => $shipping + constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING')
);
@@ -63,8 +86,14 @@
$shipping = $this->determineShipping(preg_split("/[:,]/" , constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $j)));
- $this->quotes['methods'][] = array('id' => 'table' . $j,
+ $this->quotes['methods'][] = array(
+ 'id' => 'table' . $j,
'title' => __('module shipping mzmt geozone ' . $this->delivery_geozone . ' table ' . $j . ' text way'),
+
+ 'delai' => $array['delai'],
+ 'date_remise_provider' => $array['date_dep'],
+ 'date_delivery' => $array['date_liv'],
+
'cost_ht' => $shipping + constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING'),
'cost' => $shipping + constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING')
);
@@ -79,27 +108,36 @@
if (defined('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON')) {
if ( tep_not_null(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON')) )
- $this->quotes['icon'] = shipping::get_icon(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON'), $this->title);
+ $this->quotes['icon'] = shipping::get_icon(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON'), $this->title);
}
return $this->quotes;
}
public function update_status($order) {
+
if ($this->enabled == true ) {
$this->enabled = false;
for ($n=1; $n<=$this->num_geozones; $n++) {
- if ( ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') > 0) && ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') == shipping::getGeoZoneID($order->delivery['country']['id'], $order->delivery['zone_id'])) ) {
- $this->enabled = true;
- $this->delivery_geozone = $n;
- break;
- } elseif ( ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') == 0) && ($n == (int)$this->num_geozones) ) {
- $this->enabled = true;
- $this->delivery_geozone = $n;
- break;
- }
+
+ if(tep_cst_define('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') =='false'){
+ break;
+ }
+
+ if ( ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') > 0) && ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') == shipping::getGeoZoneID($order->delivery['country']['id'], $order->delivery['zone_id'])) ) {
+ $this->enabled = true;
+ $this->delivery_geozone = $n;
+ break;
+ }
+// elseif ( ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') == 0) && ($n == (int)$this->num_geozones) ) {
+// $this->enabled = true;
+// $this->delivery_geozone = $n;
+// break;
+// }
}
}
+
+ var_dump($this->enabled );
}
/** Interface InterfaceModule */
Modified: trunk/catalog/includes/modules/shipping/spu.php
===================================================================
--- trunk/catalog/includes/modules/shipping/spu.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/catalog/includes/modules/shipping/spu.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -44,19 +44,32 @@
public function quote($method = '') {
global $order,$customer_id;
+ $delai = (defined('MODULE_SHIPPING_SPU_MIN_DELAI')? MODULE_SHIPPING_SPU_MIN_DELAI: 0);
+
+ $array = shippingUtility::getDelai( $delai );
+
$codep_query = tep_db_query("select c.configuration_value, ab.entry_postcode from " . TABLE_CONFIGURATION . " c, " . TABLE_ADDRESS_BOOK . " ab where c.configuration_key = 'MODULE_SHIPPING_SPU_ZIP' and ab.customers_id = '" . (int)$customer_id . "'");
$codep = tep_db_fetch_array($codep_query);
$dept_allow = explode(", ", $codep['configuration_value']);
$cust_cp = substr($codep['entry_postcode'], 0, 2);
if((in_array($cust_cp, $dept_allow))||($codep['configuration_value'] == '')){
- $this->quotes = array('id' => $this->code,
+ $this->quotes = array(
+ 'id' => $this->code,
'module' => __('Récupération des articles au magasin'),
- 'methods' => array(array('id' => $this->code,
+ 'methods' => array(
+ array(
+ 'id' => $this->code,
'tax'=>0,
'title' => __("Veuillez nous téléphoner avant de passer afin de confirmer la disponibilité et les horaires d'ouverture. "),
+
+ 'delai' => $array['delai'],
+ 'date_remise_provider' => $array['date_dep'],
+ 'date_delivery' => $array['date_liv'],
+
'cost_ht' => MODULE_SHIPPING_SPU_COST,
'cost' => MODULE_SHIPPING_SPU_COST
- ))
+ )
+ )
);
return $this->quotes;
}else{
@@ -70,12 +83,13 @@
/**
*/
public function update_status($order) {
+
if ($this->enabled == true ) {
$this->enabled = false;
if ( ((int)MODULE_SHIPPING_SPU_ZONE > 0) && ((int)MODULE_SHIPPING_SPU_ZONE == shipping::getGeoZoneID($order->delivery['country']['id'], $order->delivery['zone_id'])) )
- $this->enabled = true;
+ $this->enabled = true;
elseif ((int)MODULE_SHIPPING_SPU_ZONE == 0)
- $this->enabled = true;
+ $this->enabled = true;
}
}
@@ -83,9 +97,9 @@
/** Interface InterfaceModule */
- /**
- @remarks implements InterfaceModule depend
- if module twin in backoffice, report all content install in the other module
+ /**
+ @remarks implements InterfaceModule depend
+ if module twin in backoffice, report all content install in the other module
public function check() {return true;}
public function install() {return true;}
public function remove() {return true;}
Modified: trunk/test/phpunit/Front/customerTest.php
===================================================================
--- trunk/test/phpunit/Front/customerTest.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/test/phpunit/Front/customerTest.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -18,7 +18,7 @@
$page->init('account.php',$language);
// load class
-include_once($base_path.'includes/classes/page.customer.php');
+include_once($base_path.'includes/classes/core_page/customer.php');
/**
* \class customerTest
@@ -27,20 +27,23 @@
extends PHPUnit_Framework_TestCase
{
- static public $userId;
function __construct()
{
+ $cust=customer::getInstance();
+ // force retrun error immediatly
+ customer::definePostMess(0);
}
protected function setUp()
{
- global $address;
- $this->user=array('gender'=>'m',
+
+ $this->user=array(
+ 'gender'=>'m',
'firstname' => 'testtest',
'lastname' => 'testtest',
- 'email_address' => 'xx...@os...',
+ 'email_address' => 'x'.rand(1000,1000000).'xx...@os...',
'street_address'=>'testtest',
'suburb'=>'',
'postcode'=>'75000',
@@ -58,17 +61,18 @@
);
- $address=array( 'gender'=>'m',
- 'firstname' => 'testtest2',
- 'lastname' => 'testtest2',
- 'email_address' => 'os...@os...',
- 'street_address'=>'testtest2',
- 'suburb'=>'',
- 'postcode'=>'78000',
- 'city'=>'test',
- 'country'=>'73',
- 'company'=>'',
- 'company_tax_id'=>'',
+ $this->address=array(
+ 'gender'=>'m',
+ 'firstname' => 'testtest2',
+ 'lastname' => 'testtest2',
+ 'email_address' => 'os...@os...',
+ 'street_address'=>'testtest2',
+ 'suburb'=>'',
+ 'postcode'=>'78000',
+ 'city'=>'test',
+ 'country'=>'73',
+ 'company'=>'',
+ 'company_tax_id'=>'',
);
}
@@ -83,136 +87,209 @@
$res=$cust->userTestNotExist($this->user['email_address']);
-// var_dump($res);
+ $this -> assertTrue ( ($res == false) , 'user exists, delete after test ' ) ;
- echo $page->messageStack->_draw('error');
+ if($res == true){
- $this -> assertTrue ( ($res !=false) , 'user exists, not test possible ' ) ;
+ $id = customer::search('customers_email_address', $email, true);
+ $this -> assertTrue ( ($id >0) , 'erreur recup customers id exist ' ) ;
- print __FUNCTION__. "\n";
+
+ $cust=customer::getInstance($id);
+ $res=$cust->userDelete();
+
+ $this -> assertTrue ( ($res == false) , 'user delete ' ) ;
+ }
+
}
/**
* \brief test creat user
*/
public function testcustomerCreate()
{
- global $page;
-
$cust=customer::getInstance();
$res=$cust->userInsert($this->user);
-// var_dump($res);
-
- echo $page->messageStack->_draw('error');
-
$this -> assertTrue ( ($res !=false) , 'les insertions ne sont pas correctes' ) ;
- self::$userId=$res['customers_id'];
-
- print __FUNCTION__. " result id =".self::$userId. "\n";
+ return (int)$res->id;
}
/**
* \brief test load user
+ * @param $userId int id customer created
+ * @depends testcustomerCreate
*/
- public function testcustomerFetch(){
+ public function testcustomerFetch($userId){
$cust=customer::getInstance();
- $res=$cust->the_customer(self::$userId);
-// var_dump($res);
+ $res=$cust->the_customer($userId, true);
- $this -> assertTrue ( (is_object($res) ) , 'load data user not ok' ) ;
+ $this -> assertTrue ( (is_array($res) ) , 'load data user not ok' ) ;
- print __FUNCTION__. " result id =".$res['customers_id']. "\n";
+ $result = array();
+ foreach($res as $key=>$row)
+ $result[$key] = $row;
+
+ return $result;
}
/**
* \brief test update user
+ * @depends testcustomerFetch
*/
- public function testcustomerUpdate(){
+ public function testcustomerUpdate($arraydata){
- global $page;
- $cust=customer::getInstance(self::$userId);
- $res=$cust->userUpdate($this->user);
+ // force load current user
+ $cust=customer::getInstance($arraydata['id']);
- $this -> assertTrue ( ($res !=false) , 'update data user not ok' ) ;
+ $array = $arraydata;
+ $array['lastname'] ='tototo';
- print __FUNCTION__. " result id =".$res['customers_id']. "\n";
+ $res=$cust->userUpdate($array);
+
+ $this -> assertTrue ( ($res !=false) , 'update test 1 data user not ok' ) ;
+
+ // Check retrun no error if check
+ $array = $arraydata;
+ $array['lastname'] =$array['lastname'].rand(1000,1000000);
+ $res=$cust->userUpdate($array);
+
+ $this -> assertTrue ( ($res) , 'update test 2 data user not ok' ) ;
+
+
+ // Check retrun no error if check
+ $array = $arraydata;
+ $array['firstname'] =$array['firstname'].rand(1000,1000000);
+ $res=$cust->userUpdate($array);
+
+ $this -> assertTrue ( ($res) , 'update test 3 data user not ok' ) ;
+
+
}
/**
+ * \brief test update user
+ * @depends testcustomerFetch
+ */
+ public function testcustomerUpdateNotOk($arraydata){
+
+ // force load current user
+ $cust=customer::getInstance($arraydata['id']);
+
+ // Check retrun by error if not check
+ if(ENTRY_LAST_NAME_MIN_LENGTH > 0) {
+ $array = $arraydata;
+ $array['lastname'] =substr($array['lastname'].rand(1000,1000000), 0, ((int)ENTRY_LAST_NAME_MIN_LENGTH - 1) );
+ $res=$cust->userUpdate($array);
+
+ $this -> assertTrue ( ($res ==false) , 'update test 2 data user not ok' ) ;
+ }
+
+ // Check retrun by error if not check
+ if(ENTRY_LAST_NAME_MIN_LENGTH > 0) {
+ $array = $arraydata;
+ $array['firstname'] =substr($array['firstname'].rand(1000,1000000), 0, ((int)ENTRY_FIRST_NAME_MIN_LENGTH - 1) );
+ $res=$cust->userUpdate($array);
+
+ $this -> assertTrue ( ($res ==false) , 'update test 3 data user not ok' ) ;
+ }
+
+ if(_cst_bool('ACCOUNT_GENDER')){
+ $array = $arraydata;
+ $array['gender'] ='x';
+ $res=$cust->userUpdate($array);
+
+ $this -> assertTrue ( ($res ==false) , 'update test 3 data user not ok' ) ;
+ }
+
+ // Check retrun by error if not check
+// if(ENTRY_EMAIL_ADDRESS_MIN_LENGTH > 0) {
+// $array = $arraydata;
+// $array['email_address'] =substr('xxx'.rand(1000,1000000000), 0, ((int)ENTRY_EMAIL_ADDRESS_MIN_LENGTH - 1) ).'@oscss.org';
+// $res=$cust->userUpdate($array);
+//
+// $this -> assertTrue ( ($res ==false) , 'update test 4 data user not ok' ) ;
+//
+// $array = $arraydata;
+// $array['email_address'] ='sql...@no...';
+// $res=$cust->userUpdate($array);
+//
+// $this -> assertTrue ( ($res ==false) , 'update test 5 data user not ok' ) ;
+// }
+
+
+ }
+ /**
* \brief test update password user
+ * @depends testcustomerFetch
*/
- public function testcustomerUpdatePassword(){
- global $page;
+ public function testcustomerUpdatePassword($arraydata){
+ // force load current user
+ $cust=customer::getInstance($arraydata['id']);
- $cust=customer::getInstance(self::$userId);
-
- $res=$cust->userUpdatepassword(array( 'password_confirmation'=>'totto',
+ $res=$cust->userUpdatepassword(
+ array(
+ 'password_confirmation'=>'totto',
'password_new'=>'totto',
'password_current'=>$this->user['password'],
- ));
+ )
+ );
$this -> assertTrue ( ($res !=false) , 'update password user not ok' ) ;
-
- print __FUNCTION__."\n";
}
/**
* \brief test update notifi user
+ * @depends testcustomerFetch
*/
- public function testcustomerUpadteNotifi(){
- global $page;
- $cust=customer::getInstance(self::$userId);
+ public function testcustomerUpadteNotifi($arraydata){
+ // force load current user
+ $cust=customer::getInstance($arraydata['id']);
- $res=$cust->userNotifiUpdate(array( 'newsletter_product_notification'=>1,
+ $res=$cust->userNotifiUpdate(
+ array(
+ 'newsletter_product_notification'=>1,
'newsletter_general'=>1
- ));
+ )
+ );
$this -> assertTrue ( ($res !=false) , 'update notifi user not ok' ) ;
-
- print __FUNCTION__."\n";
}
/**
* \brief test for change address payement or shipping
+ * @depends testcustomerFetch
*/
- public function testcustomerAddAddressBook(){
- global $address;
- $cust=customer::getInstance(self::$userId);
+ public function testcustomerAddAddressBook($arraydata){
+ $cust=customer::getInstance($arraydata['id']);
- $res=$cust->userAddAddressBook($address);
+ $res=$cust->userAddAddressBook($this->address);
$this -> assertTrue ( ($res !=false) , 'add address book user not ok' ) ;
- print __FUNCTION__."\n";
}
/**
* \brief test delete user
+ * @depends testcustomerCreate
*/
- public function testcustomerDelete(){
- $cust=customer::getInstance(self::$userId);
+ public function testcustomerDelete($id){
+ $cust=customer::getInstance($id);
$res=$cust->userDelete();
- //var_dump($res);
-
$this -> assertTrue ( ($res !=false) , 'delete user not ok' ) ;
-
- print __FUNCTION__."\n";
}
}
-new customerTest;
-
?>
\ No newline at end of file
Deleted: trunk/test/phpunit/Front/orders_Test.php
===================================================================
--- trunk/test/phpunit/Front/orders_Test.php 2013-12-20 15:57:20 UTC (rev 4979)
+++ trunk/test/phpunit/Front/orders_Test.php 2013-12-21 10:33:31 UTC (rev 4980)
@@ -1,75 +0,0 @@
-<?php
-/**
- * \file test/phpunit/customerTest.php
- * \brief test unitaire class customer public
- * \remarks To run this script as CLI: phpunit filename.php
- * \author oscim <mail aur...@os...> <www http://www.oscim.fr>
- */
-
-// specific for test
-require('_top.php');
-
-// load init language
-$page->init('account.php',$language);
-
-// load class
-include_once($base_path.'includes/classes/page.customer.php');
-
-/**
- * \class customerTest
- */
-class orders_Test
- extends PHPUnit_Framework_TestCase
-{
-
- static public $userId;
-
- function __construct()
- {
-
- }
-
- protected function setUp()
- {
- global $user,$address;
-
-
- $address=array( 'gender'=>'m',
- 'firstname' => 'testtest2',
- 'lastname' => 'testtest2',
- 'email_address' => 'os...@os...',
- 'street_address'=>'testtest2',
- 'suburb'=>'',
- 'postcode'=>'78000',
- 'city'=>'test',
- 'country'=>'73',
- 'company'=>'',
- 'company_tax_id'=>'',
- );
- }
-
- /**
- * \brief test if not exist user for email in db
- */
- public function testorders_NotExist(){
- global $page,$user;
-
-
- $cust=customer::getInst...
[truncated message content] |