Improve debugging and improve manage_table_sql

element will be added at the right place
Manage_Table_SQL can work also with a SQL query or a view
Icon place can be modified
This commit is contained in:
Dany De Bontridder 2017-07-23 13:24:53 +02:00
parent 52849e775f
commit a5ef1138a4
14 changed files with 1187 additions and 109 deletions

View file

@ -23,9 +23,22 @@
/**
* @file
* @brief this wrapper is used to created easily a wrapper to a table
* You must create a class extending this one, in the constructor
* these variables have to be defined
*
* - table = name of the view or empty
* - select = name of the select
* - name = array of column name, match between logic and actual name
* - type = array , match between column and type of data
* - default = array of column with a default value
* - date_format = format of the date
*
* After you call the parent constructor
* @note the view or the table must include an unique key, otherwise the load
* doesn't work.
*
* @class Noalyss_SQL
* Match a table into an object, you need to add the code for each table
* Match a table or a view into an object, you need to add the code for each table
* @note : the primary key must be an integer
*
* @code
@ -39,7 +52,7 @@
$this->name=array(
"id"=>"o_id",
"dolibarr"=>"o_doli",
"program"=>"o_prog",
"date"=>"o_date",
"qcode"=>"o_qcode",
"fiche"=>"f_id",
@ -49,7 +62,7 @@
$this->type = array(
"o_id"=>"numeric",
"o_doli"=>"numeric",
"o_prog"=>"numeric",
"o_date"=>"date",
"o_qcode"=>"text",
"f_id"=>"numeric",
@ -69,7 +82,9 @@
* @endcode
*
*/
abstract class Noalyss_SQL
require NOALYSS_INCLUDE."/lib/data_sql.class.php";
abstract class Noalyss_SQL extends Data_SQL
{
function __construct(&$p_cn, $p_id=-1)
@ -122,7 +137,7 @@ abstract class Noalyss_SQL
public function set($p_string, $p_value)
{
if (array_key_exists($p_string, $this->type)) {
$this->$idx=$p_value;
$this->$p_string=$p_value;
} else
throw new Exception(__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant '.$p_string);
}
@ -361,7 +376,8 @@ abstract class Noalyss_SQL
}
/**
* @brief return an array of objects. Do not use this function if they are too many objects, it takes a lot of memory,
* @brief return an array of objects.
* Do not use this function if they are too many objects, it takes a lot of memory,
* and could slow down your application.
* @param $cond condition, order...
* @param $p_array array to use for a condition