restructure files and folders
This commit is contained in:
parent
75953bcf95
commit
083ba483cc
335 changed files with 1096 additions and 1096 deletions
159
include/database/class_anc_key_sql.php
Normal file
159
include/database/class_anc_key_sql.php
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 Dany De Bontridder <danydb@aevalys.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Class to manage distribution keys for SQL.
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
|
||||
|
||||
/**
|
||||
* @brief Manage the table key_distribution.
|
||||
*/
|
||||
class Anc_Key_SQL extends Noalyss_SQL
|
||||
{
|
||||
|
||||
function __construct($p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "public.key_distribution";
|
||||
$this->primary_key = "kd_id";
|
||||
|
||||
$this->name = array(
|
||||
"id" => "kd_id",
|
||||
"name"=>"kd_name",
|
||||
"description"=>"kd_description"
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"kd_id" => "numeric",
|
||||
"kd_name" => "text",
|
||||
"kd_description" => "text"
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"kd_id" => "auto"
|
||||
);
|
||||
// PHPUNIT seems to have a problem with this line
|
||||
//global $cn;
|
||||
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief manage table key_distribution_ledger
|
||||
*/
|
||||
class Anc_Key_Ledger_SQL extends Noalyss_SQL
|
||||
{
|
||||
function __construct(&$p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "public.key_distribution_ledger";
|
||||
$this->primary_key = "kl_id";
|
||||
|
||||
$this->name = array(
|
||||
"id" => "kl_id",
|
||||
"key"=>"kd_id",
|
||||
"ledger"=>"jrn_def_id"
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"kl_id" => "numeric",
|
||||
"kd_id" => "numeric",
|
||||
"jrn_def_id" => "numeric"
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"kl_id" => "auto"
|
||||
);
|
||||
// PHPUNIT seems to have a problem with this line
|
||||
//global $cn;
|
||||
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief manage table key_distribution_detail
|
||||
*/
|
||||
class Anc_Key_Detail_SQL extends Noalyss_SQL
|
||||
{
|
||||
function __construct(&$p_cn, $p_id = -1)
|
||||
{
|
||||
|
||||
$this->table = "public.key_distribution_detail";
|
||||
$this->primary_key = "ke_id";
|
||||
|
||||
$this->name = array(
|
||||
"id" => "ke_id",
|
||||
"key"=>"kd_id",
|
||||
"row"=>"ke_row",
|
||||
"percent"=>"ke_percent"
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"ke_id" => "numeric",
|
||||
"kd_id" => "numeric",
|
||||
"ke_row" => "numeric",
|
||||
"ke_percent" => "numeric"
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"ke_id" => "auto"
|
||||
);
|
||||
// PHPUNIT seems to have a problem with this line
|
||||
//global $cn;
|
||||
|
||||
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief manage table key_distribution_activity
|
||||
*/
|
||||
class Anc_Key_Activity_SQL extends Noalyss_SQL
|
||||
{
|
||||
function __construct($p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "public.key_distribution_activity";
|
||||
$this->primary_key = "ka_id";
|
||||
|
||||
$this->name = array(
|
||||
"id" => "ka_id",
|
||||
"detail"=>"ke_id",
|
||||
"activity"=>"po_id",
|
||||
"plan"=>"pa_id"
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"ka_id" => "numeric",
|
||||
"ke_id" => "numeric",
|
||||
"po_id" => "numeric",
|
||||
"pa_id" => "numeric"
|
||||
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"ka_id" => "auto"
|
||||
);
|
||||
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
}
|
||||
57
include/database/class_default_menu_sql.php
Normal file
57
include/database/class_default_menu_sql.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**
|
||||
* Description of class_default_menu_sql
|
||||
*
|
||||
* @author dany
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
|
||||
class Default_Menu_SQL extends Noalyss_SQL
|
||||
{
|
||||
var $md_id;
|
||||
var $md_code;
|
||||
var $me_code;
|
||||
|
||||
function __construct(&$p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "public.menu_default";
|
||||
$this->primary_key = "md_id";
|
||||
|
||||
$this->name = array(
|
||||
"md_id"=>"md_id",
|
||||
"md_code" => "md_code",
|
||||
"me_code" => "me_code"
|
||||
);
|
||||
$this->type = array(
|
||||
"md_id"=>"md_id"
|
||||
,"md_code" => "text"
|
||||
, "me_code" => "text"
|
||||
);
|
||||
$this->default = array(
|
||||
"md_id"
|
||||
);
|
||||
global $cn;
|
||||
|
||||
parent::__construct($cn, $p_id);
|
||||
}
|
||||
|
||||
}
|
||||
408
include/database/class_jrn_def_sql.php
Normal file
408
include/database/class_jrn_def_sql.php
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Manage the table public.jrn_def
|
||||
*
|
||||
*
|
||||
Example
|
||||
@code
|
||||
|
||||
@endcode
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
|
||||
/**
|
||||
* @brief Manage the table public.jrn_def
|
||||
*/
|
||||
class Jrn_Def_sql
|
||||
{
|
||||
/* example private $variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0); */
|
||||
|
||||
protected $variable = array(
|
||||
"jrn_def_id" => "jrn_def_id",
|
||||
"jrn_def_name" => "jrn_def_name"
|
||||
, "jrn_def_class_deb" => "jrn_def_class_deb"
|
||||
, "jrn_def_class_cred" => "jrn_def_class_cred"
|
||||
, "jrn_def_fiche_deb" => "jrn_def_fiche_deb"
|
||||
, "jrn_def_fiche_cred" => "jrn_def_fiche_cred"
|
||||
, "jrn_deb_max_line" => "jrn_deb_max_line"
|
||||
, "jrn_cred_max_line" => "jrn_cred_max_line"
|
||||
, "jrn_def_ech" => "jrn_def_ech"
|
||||
, "jrn_def_ech_lib" => "jrn_def_ech_lib"
|
||||
, "jrn_def_type" => "jrn_def_type"
|
||||
, "jrn_def_code" => "jrn_def_code"
|
||||
, "jrn_def_pj_pref" => "jrn_def_pj_pref"
|
||||
, "jrn_def_bank" => "jrn_def_bank"
|
||||
, "jrn_def_num_op" => "jrn_def_num_op"
|
||||
, "jrn_def_description" => "jrn_def_description"
|
||||
);
|
||||
|
||||
function __construct(& $p_cn, $p_id=-1)
|
||||
{
|
||||
$this->db = $p_cn;
|
||||
$this->jrn_def_id = $p_id;
|
||||
|
||||
if ($p_id == -1)
|
||||
{
|
||||
/* Initialize an empty object */
|
||||
foreach ($this->variable as $key => $value)
|
||||
$this->$value = null;
|
||||
$this->jrn_def_id = $p_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* load it */
|
||||
|
||||
$this->load();
|
||||
}
|
||||
}
|
||||
|
||||
public function get_parameter($p_string)
|
||||
{
|
||||
if (array_key_exists($p_string, $this->variable))
|
||||
{
|
||||
$idx = $this->variable[$p_string];
|
||||
return $this->$idx;
|
||||
}
|
||||
else
|
||||
throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur attribut inexistant');
|
||||
}
|
||||
|
||||
public function set_parameter($p_string, $p_value)
|
||||
{
|
||||
if (array_key_exists($p_string, $this->variable))
|
||||
{
|
||||
$idx = $this->variable[$p_string];
|
||||
$this->$idx = $p_value;
|
||||
}
|
||||
else
|
||||
throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur attribut inexistant');
|
||||
}
|
||||
|
||||
public function get_info()
|
||||
{
|
||||
return var_export($this, true);
|
||||
}
|
||||
|
||||
public function verify_sql()
|
||||
{
|
||||
// Verify that the elt we want to add is correct
|
||||
/* verify only the datatype */
|
||||
if (trim($this->jrn_def_name) == '')
|
||||
$this->jrn_def_name = null;
|
||||
if (trim($this->jrn_def_class_deb) == '')
|
||||
$this->jrn_def_class_deb = null;
|
||||
if (trim($this->jrn_def_class_cred) == '')
|
||||
$this->jrn_def_class_cred = null;
|
||||
if (trim($this->jrn_def_fiche_deb) == '')
|
||||
$this->jrn_def_fiche_deb = null;
|
||||
if (trim($this->jrn_def_fiche_cred) == '')
|
||||
$this->jrn_def_fiche_cred = null;
|
||||
if (trim($this->jrn_deb_max_line) == '')
|
||||
$this->jrn_deb_max_line = null;
|
||||
if ($this->jrn_deb_max_line !== null && settype($this->jrn_deb_max_line, 'float') == false)
|
||||
throw new Exception('DATATYPE jrn_deb_max_line $this->jrn_deb_max_line non numerique');
|
||||
if (trim($this->jrn_cred_max_line) == '')
|
||||
$this->jrn_cred_max_line = null;
|
||||
if ($this->jrn_cred_max_line !== null && settype($this->jrn_cred_max_line, 'float') == false)
|
||||
throw new Exception('DATATYPE jrn_cred_max_line $this->jrn_cred_max_line non numerique');
|
||||
if (trim($this->jrn_def_ech) == '')
|
||||
$this->jrn_def_ech = null;
|
||||
if (trim($this->jrn_def_ech_lib) == '')
|
||||
$this->jrn_def_ech_lib = null;
|
||||
if (trim($this->jrn_def_type) == '')
|
||||
$this->jrn_def_type = null;
|
||||
if (trim($this->jrn_def_code) == '')
|
||||
$this->jrn_def_code = null;
|
||||
if (trim($this->jrn_def_pj_pref) == '')
|
||||
$this->jrn_def_pj_pref = null;
|
||||
if (trim($this->jrn_def_bank) == '')
|
||||
$this->jrn_def_bank = null;
|
||||
if ($this->jrn_def_bank !== null && settype($this->jrn_def_bank, 'float') == false)
|
||||
throw new Exception('DATATYPE jrn_def_bank $this->jrn_def_bank non numerique');
|
||||
if (trim($this->jrn_def_num_op) == '')
|
||||
$this->jrn_def_num_op = null;
|
||||
if ($this->jrn_def_num_op !== null && settype($this->jrn_def_num_op, 'float') == false)
|
||||
throw new Exception('DATATYPE jrn_def_num_op $this->jrn_def_num_op non numerique');
|
||||
}
|
||||
|
||||
public function save($p_string='')
|
||||
{
|
||||
/* please adapt */
|
||||
if ($this->jrn_def_id == -1)
|
||||
$this->insert();
|
||||
else
|
||||
$this->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief retrieve array of object thanks a condition
|
||||
* @param $cond condition (where clause) (optional by default all the rows are fetched)
|
||||
* you can use this parameter for the order or subselect
|
||||
* @param $p_array array for the SQL stmt
|
||||
* @see Database::exec_sql get_object Database::num_row
|
||||
* @return the return value of exec_sql
|
||||
*/
|
||||
public function seek($cond='', $p_array=null)
|
||||
{
|
||||
$sql = "select * from public.jrn_def $cond";
|
||||
$aobj = array();
|
||||
$ret = $this->db->exec_sql($sql, $p_array);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_seek return the next object, the return of the query must have all the column
|
||||
* of the object
|
||||
* @param $p_ret is the return value of an exec_sql
|
||||
* @param $idx is the index
|
||||
* @see seek
|
||||
* @return object
|
||||
*/
|
||||
public function get_object($p_ret, $idx)
|
||||
{
|
||||
// map each row in a object
|
||||
$oobj = new Jrn_Def_sql($this->db);
|
||||
$array = Database::fetch_array($p_ret, $idx);
|
||||
foreach ($array as $idx => $value)
|
||||
{
|
||||
$oobj->$idx = $value;
|
||||
}
|
||||
return $oobj;
|
||||
}
|
||||
|
||||
public function insert($p_array=null)
|
||||
{
|
||||
if ($this->verify_sql() != 0)
|
||||
return;
|
||||
if ($this->jrn_def_id == -1)
|
||||
{
|
||||
/* please adapt */
|
||||
$sql = "insert into public.jrn_def(jrn_def_name
|
||||
,jrn_def_class_deb
|
||||
,jrn_def_class_cred
|
||||
,jrn_def_fiche_deb
|
||||
,jrn_def_fiche_cred
|
||||
,jrn_deb_max_line
|
||||
,jrn_cred_max_line
|
||||
,jrn_def_ech
|
||||
,jrn_def_ech_lib
|
||||
,jrn_def_type
|
||||
,jrn_def_code
|
||||
,jrn_def_pj_pref
|
||||
,jrn_def_bank
|
||||
,jrn_def_num_op
|
||||
,jrn_def_description
|
||||
) values ($1
|
||||
,$2
|
||||
,$3
|
||||
,$4
|
||||
,$5
|
||||
,$6
|
||||
,$7
|
||||
,$8
|
||||
,$9
|
||||
,$10
|
||||
,$11
|
||||
,$12
|
||||
,$13
|
||||
,$14
|
||||
,$15
|
||||
) returning jrn_def_id";
|
||||
|
||||
$this->jrn_def_id = $this->db->get_value(
|
||||
$sql, array($this->jrn_def_name
|
||||
, $this->jrn_def_class_deb
|
||||
, $this->jrn_def_class_cred
|
||||
, $this->jrn_def_fiche_deb
|
||||
, $this->jrn_def_fiche_cred
|
||||
, $this->jrn_deb_max_line
|
||||
, $this->jrn_cred_max_line
|
||||
, $this->jrn_def_ech
|
||||
, $this->jrn_def_ech_lib
|
||||
, $this->jrn_def_type
|
||||
, $this->jrn_def_code
|
||||
, $this->jrn_def_pj_pref
|
||||
, $this->jrn_def_bank
|
||||
, $this->jrn_def_num_op
|
||||
, strip_tags($this->jrn_def_description)
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "insert into public.jrn_def(jrn_def_name
|
||||
,jrn_def_class_deb
|
||||
,jrn_def_class_cred
|
||||
,jrn_def_fiche_deb
|
||||
,jrn_def_fiche_cred
|
||||
,jrn_deb_max_line
|
||||
,jrn_cred_max_line
|
||||
,jrn_def_ech
|
||||
,jrn_def_ech_lib
|
||||
,jrn_def_type
|
||||
,jrn_def_code
|
||||
,jrn_def_pj_pref
|
||||
,jrn_def_bank
|
||||
,jrn_def_num_op
|
||||
,jrn_def_id
|
||||
,jrn_def_description) values ($1
|
||||
,$2
|
||||
,$3
|
||||
,$4
|
||||
,$5
|
||||
,$6
|
||||
,$7
|
||||
,$8
|
||||
,$9
|
||||
,$10
|
||||
,$11
|
||||
,$12
|
||||
,$13
|
||||
,$14
|
||||
,$15
|
||||
,$16
|
||||
) returning jrn_def_id";
|
||||
|
||||
$this->jrn_def_id = $this->db->get_value(
|
||||
$sql, array($this->jrn_def_name
|
||||
, $this->jrn_def_class_deb
|
||||
, $this->jrn_def_class_cred
|
||||
, $this->jrn_def_fiche_deb
|
||||
, $this->jrn_def_fiche_cred
|
||||
, $this->jrn_deb_max_line
|
||||
, $this->jrn_cred_max_line
|
||||
, $this->jrn_def_ech
|
||||
, $this->jrn_def_ech_lib
|
||||
, $this->jrn_def_type
|
||||
, $this->jrn_def_code
|
||||
, $this->jrn_def_pj_pref
|
||||
, $this->jrn_def_bank
|
||||
, $this->jrn_def_num_op
|
||||
, $this->jrn_def_id
|
||||
, strip_tags($this->jrn_def_description))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function update($p_string='')
|
||||
{
|
||||
if ($this->verify_sql() != 0)
|
||||
return;
|
||||
/* please adapt */
|
||||
$sql = " update public.jrn_def set jrn_def_name = $1
|
||||
,jrn_def_class_deb = $2
|
||||
,jrn_def_class_cred = $3
|
||||
,jrn_def_fiche_deb = $4
|
||||
,jrn_def_fiche_cred = $5
|
||||
,jrn_deb_max_line = $6
|
||||
,jrn_cred_max_line = $7
|
||||
,jrn_def_ech = $8
|
||||
,jrn_def_ech_lib = $9
|
||||
,jrn_def_type = $10
|
||||
,jrn_def_code = $11
|
||||
,jrn_def_pj_pref = $12
|
||||
,jrn_def_bank = $13
|
||||
,jrn_def_num_op = $14
|
||||
,jrn_def_description = $15
|
||||
where jrn_def_id= $16";
|
||||
$res = $this->db->exec_sql(
|
||||
$sql, array($this->jrn_def_name
|
||||
, $this->jrn_def_class_deb
|
||||
, $this->jrn_def_class_cred
|
||||
, $this->jrn_def_fiche_deb
|
||||
, $this->jrn_def_fiche_cred
|
||||
, $this->jrn_deb_max_line
|
||||
, $this->jrn_cred_max_line
|
||||
, $this->jrn_def_ech
|
||||
, $this->jrn_def_ech_lib
|
||||
, $this->jrn_def_type
|
||||
, $this->jrn_def_code
|
||||
, $this->jrn_def_pj_pref
|
||||
, $this->jrn_def_bank
|
||||
, $this->jrn_def_num_op
|
||||
, strip_tags($this->jrn_def_description)
|
||||
, $this->jrn_def_id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief load a object
|
||||
* @return 0 on success -1 the object is not found
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
|
||||
$sql = "select jrn_def_name
|
||||
,jrn_def_class_deb
|
||||
,jrn_def_class_cred
|
||||
,jrn_def_fiche_deb
|
||||
,jrn_def_fiche_cred
|
||||
,jrn_deb_max_line
|
||||
,jrn_cred_max_line
|
||||
,jrn_def_ech
|
||||
,jrn_def_ech_lib
|
||||
,jrn_def_type
|
||||
,jrn_def_code
|
||||
,jrn_def_pj_pref
|
||||
,jrn_def_bank
|
||||
,jrn_def_num_op
|
||||
,jrn_def_description
|
||||
from public.jrn_def where jrn_def_id=$1";
|
||||
/* please adapt */
|
||||
$res = $this->db->get_array(
|
||||
$sql, array($this->jrn_def_id)
|
||||
);
|
||||
|
||||
if (count($res) == 0)
|
||||
{
|
||||
/* Initialize an empty object */
|
||||
foreach ($this->variable as $key => $value)
|
||||
$this->$key = '';
|
||||
|
||||
return -1;
|
||||
}
|
||||
foreach ($res[0] as $idx => $value)
|
||||
{
|
||||
$this->$idx = $value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$sql = "delete from public.jrn_def where jrn_def_id=$1";
|
||||
$res = $this->db->exec_sql($sql, array($this->jrn_def_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit test for the class
|
||||
*/
|
||||
static function test_me()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Jrn_Def_sql::test_me();
|
||||
?>
|
||||
66
include/database/class_menu_ref_sql.php
Normal file
66
include/database/class_menu_ref_sql.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Manage the table public.menu_ref
|
||||
*
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
|
||||
/**
|
||||
* @brief Manage the table public.menu_ref
|
||||
*/
|
||||
class Menu_Ref_SQL extends Noalyss_SQL
|
||||
{
|
||||
protected $table="public.menu_ref";
|
||||
protected $primary_key="me_code";
|
||||
protected $name = array(
|
||||
"me_code" => "me_code"
|
||||
, "me_menu" => "me_menu"
|
||||
, "me_file" => "me_file"
|
||||
, "me_url" => "me_url"
|
||||
, "me_description" => "me_description"
|
||||
, "me_parameter" => "me_parameter"
|
||||
, "me_javascript" => "me_javascript"
|
||||
, "me_type" => "me_type"
|
||||
, 'me_description_etendue'=>'me_description_etendue'
|
||||
);
|
||||
protected $type=array(
|
||||
"me_code" => "text"
|
||||
, "me_menu" => "text"
|
||||
, "me_file" => "text"
|
||||
, "me_url" => "text"
|
||||
, "me_description" => "text"
|
||||
, "me_parameter" => "text"
|
||||
, "me_javascript" => "text"
|
||||
, "me_type" => "text"
|
||||
,"me_description_etendue"=>"text"
|
||||
);
|
||||
function __construct(Database &$p_cn,$p_id=-1)
|
||||
{
|
||||
parent::__construct($p_cn,$p_id);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
333
include/database/class_noalyss_sql.php
Normal file
333
include/database/class_noalyss_sql.php
Normal file
|
|
@ -0,0 +1,333 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief this wrapper is used to created easily a wrapper to a table
|
||||
*
|
||||
* @class
|
||||
* Match a table into an object, you need to add the code for each table
|
||||
* @note : the primary key must be an integer
|
||||
*
|
||||
* @code
|
||||
class table_name_sql extends Noalyss_SQL
|
||||
{
|
||||
|
||||
function __construct($p_id=-1)
|
||||
{
|
||||
$this->table = "schema.table";
|
||||
$this->primary_key = "o_id";
|
||||
|
||||
$this->name=array(
|
||||
"id"=>"o_id",
|
||||
"dolibarr"=>"o_doli",
|
||||
"date"=>"o_date",
|
||||
"qcode"=>"o_qcode",
|
||||
"fiche"=>"f_id",
|
||||
|
||||
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"o_id"=>"numeric",
|
||||
"o_doli"=>"numeric",
|
||||
"o_date"=>"date",
|
||||
"o_qcode"=>"text",
|
||||
"f_id"=>"numeric",
|
||||
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"o_id" => "auto",
|
||||
);
|
||||
$this->date_format = "DD.MM.YYYY";
|
||||
global $cn;
|
||||
|
||||
parent::__construct($cn,$p_id);
|
||||
}
|
||||
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
abstract class Noalyss_SQL
|
||||
{
|
||||
|
||||
function __construct(&$p_cn, $p_id=-1)
|
||||
{
|
||||
$this->cn=$p_cn;
|
||||
$pk=$this->primary_key;
|
||||
$this->$pk=$p_id;
|
||||
|
||||
/* Initialize an empty object */
|
||||
foreach ($this->name as $key)
|
||||
{
|
||||
$this->$key=null;
|
||||
}
|
||||
$this->$pk=$p_id;
|
||||
/* load it */
|
||||
if ($p_id != -1 )$this->load();
|
||||
}
|
||||
/**
|
||||
* Insert or update : if the row already exists, update otherwise insert
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$pk=$this->primary_key;
|
||||
$count=$this->cn->get_value('select count(*) from '.$this->table.' where '.$this->primary_key.'=$1',array($this->$pk));
|
||||
|
||||
if ($count == 0)
|
||||
$this->insert();
|
||||
else
|
||||
$this->update();
|
||||
}
|
||||
|
||||
public function getp($p_string)
|
||||
{
|
||||
if (array_key_exists($p_string, $this->name)) {
|
||||
$idx=$this->name[$p_string];
|
||||
return $this->$idx;
|
||||
}
|
||||
else
|
||||
throw new Exception(__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant '.$p_string);
|
||||
}
|
||||
|
||||
public function setp($p_string, $p_value)
|
||||
{
|
||||
if (array_key_exists($p_string, $this->name)) {
|
||||
$idx=$this->name[$p_string];
|
||||
$this->$idx=$p_value;
|
||||
} else
|
||||
throw new Exception(__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant '.$p_string);
|
||||
}
|
||||
|
||||
public function insert()
|
||||
{
|
||||
$this->verify();
|
||||
$sql="insert into ".$this->table." ( ";
|
||||
$sep="";
|
||||
$par="";
|
||||
$idx=1;
|
||||
$array=array();
|
||||
foreach ($this->name as $key=> $value)
|
||||
{
|
||||
if (isset($this->default[$value])&&$this->default[$value]=="auto"&&$this->$value==null)
|
||||
continue;
|
||||
if ($value==$this->primary_key&&$this->$value==-1)
|
||||
continue;
|
||||
$sql.=$sep.$value;
|
||||
switch ($this->type[$value])
|
||||
{
|
||||
case "date":
|
||||
if ($this->date_format=="")
|
||||
throw new Exception('Format Date invalide');
|
||||
$par .=$sep.'to_date($'.$idx.",'".$this->date_format."')";
|
||||
break;
|
||||
default:
|
||||
$par .= $sep."$".$idx;
|
||||
}
|
||||
|
||||
$array[]=$this->$value;
|
||||
$sep=",";
|
||||
$idx++;
|
||||
}
|
||||
$sql.=") values (".$par.") returning ".$this->primary_key;
|
||||
$pk=$this->primary_key;
|
||||
$this->$pk=$this->cn->get_value($sql, $array);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$pk=$this->primary_key;
|
||||
$sql=" delete from ".$this->table." where ".$this->primary_key."= $1";
|
||||
$this->cn->exec_sql($sql,array($this->$pk));
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$this->verify();
|
||||
$pk=$this->primary_key;
|
||||
$sql="update ".$this->table." ";
|
||||
$sep="";
|
||||
$idx=1;
|
||||
$array=array();
|
||||
$set=" set ";
|
||||
foreach ($this->name as $key=> $value) {
|
||||
if (isset($this->default[$value])&&$this->default[$value]=="auto")
|
||||
continue;
|
||||
switch ($this->type[$value])
|
||||
{
|
||||
case "date":
|
||||
$par=$value.'=to_date($'.$idx.",'".$this->date_format."')";
|
||||
break;
|
||||
default:
|
||||
$par=$value."= $".$idx;
|
||||
}
|
||||
$sql.=$sep." $set ".$par;
|
||||
$array[]=$this->$value;
|
||||
$sep=",";
|
||||
$set="";
|
||||
$idx++;
|
||||
}
|
||||
$array[]=$this->$pk;
|
||||
$sql.=" where ".$this->primary_key." = $".$idx;
|
||||
$this->cn->exec_sql($sql, $array);
|
||||
}
|
||||
|
||||
public function load()
|
||||
{
|
||||
$sql=" select ";
|
||||
$sep="";
|
||||
foreach ($this->name as $key) {
|
||||
switch ($this->type[$key])
|
||||
{
|
||||
case "date":
|
||||
$sql .= $sep.'to_char('.$key.",'".$this->date_format."') as ".$key;
|
||||
break;
|
||||
default:
|
||||
$sql.=$sep.$key;
|
||||
}
|
||||
$sep=",";
|
||||
}
|
||||
$pk=$this->primary_key;
|
||||
$sql.=" from ".$this->table;
|
||||
|
||||
$sql.=" where ".$this->primary_key." = $1";
|
||||
|
||||
$result=$this->cn->get_array($sql,array ($this->$pk));
|
||||
if ($this->cn->count()==0)
|
||||
{
|
||||
$this->$pk=-1;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($result[0] as $key=> $value)
|
||||
{
|
||||
$this->$key=$value;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_info()
|
||||
{
|
||||
return var_export($this, true);
|
||||
}
|
||||
/**
|
||||
* @todo ajout vérification type (date, text ou numeric)
|
||||
* @return int
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
foreach ($this->name as $key)
|
||||
{
|
||||
if (trim($this->$key)=='')
|
||||
$this->$key=null;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform an array into object
|
||||
* @param type $p_array
|
||||
* @return object
|
||||
*/
|
||||
public function from_array($p_array)
|
||||
{
|
||||
foreach ($this->name as $key=> $value)
|
||||
{
|
||||
if (isset($p_array[$value]))
|
||||
{
|
||||
$this->$value=$p_array[$value];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->$value=null;
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief retrieve array of object thanks a condition
|
||||
* @param $cond condition (where clause) (optional by default all the rows are fetched)
|
||||
* you can use this parameter for the order or subselect
|
||||
* @param $p_array array for the SQL stmt
|
||||
* @see Database::exec_sql get_object Database::num_row
|
||||
* @return the return value of exec_sql
|
||||
*/
|
||||
function seek($cond='', $p_array=null)
|
||||
{
|
||||
$sql="select * from ".$this->table." $cond";
|
||||
$ret=$this->cn->exec_sql($sql, $p_array);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_seek return the next object, the return of the query must have all the column
|
||||
* of the object
|
||||
* @param $p_ret is the return value of an exec_sql
|
||||
* @param $idx is the index
|
||||
* @see seek
|
||||
* @return object
|
||||
*/
|
||||
public function next($ret, $i)
|
||||
{
|
||||
$array=$this->cn->fetch_array($ret, $i);
|
||||
return $this->from_array($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see next
|
||||
*/
|
||||
public function get_object($p_ret, $idx)
|
||||
{
|
||||
return $this->next($p_ret, $idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @note this function could slow down your application.
|
||||
*/
|
||||
function collect_objects($cond='', $p_array=null)
|
||||
{
|
||||
if ($p_array != null && ! is_array($p_array) )
|
||||
{
|
||||
throw new Exception(_("Erreur : exec_sql attend un array"));
|
||||
}
|
||||
$ret=$this->seek($cond, $p_array);
|
||||
$max=Database::num_row($ret);
|
||||
$a_return=array();
|
||||
for ($i=0; $i<$max; $i++)
|
||||
{
|
||||
$a_return[$i]=clone $this->next($ret, $i);
|
||||
}
|
||||
return $a_return;
|
||||
}
|
||||
public function count($p_where="",$p_array=null) {
|
||||
$count=$this->cn->get_value("select count(*) from $this->table".$p_where,$p_array);
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
76
include/database/class_profile_menu_sql.php
Normal file
76
include/database/class_profile_menu_sql.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
/**
|
||||
* @file
|
||||
* @brief Manage the table public.profile_menu
|
||||
*
|
||||
*
|
||||
Example
|
||||
@code
|
||||
|
||||
@endcode
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
|
||||
/**
|
||||
* @brief Manage the table public.profile_menu
|
||||
*/
|
||||
class Profile_Menu_sql extends Noalyss_SQL
|
||||
{
|
||||
|
||||
function __construct(&$p_cn,$p_id=-1)
|
||||
{
|
||||
$this->table="public.profile_menu";
|
||||
$this->primary_key="pm_id";
|
||||
|
||||
$this->name=array(
|
||||
"pm_id"=>"pm_id", "me_code"=>"me_code"
|
||||
, "me_code_dep"=>"me_code_dep"
|
||||
, "p_id"=>"p_id"
|
||||
, "p_order"=>"p_order"
|
||||
, "p_type_display"=>"p_type_display"
|
||||
, "pm_default"=>"pm_default"
|
||||
,"pm_id_dep"=>"pm_id_dep"
|
||||
);
|
||||
|
||||
$this->type=array(
|
||||
"pm_id"=>"number",
|
||||
"me_code"=>"text"
|
||||
, "me_code_dep"=>"text"
|
||||
, "p_id"=>"number"
|
||||
, "p_order"=>"number"
|
||||
, "p_type_display"=>"text"
|
||||
, "pm_default"=>"text"
|
||||
, "pm_id_dep"=>"number"
|
||||
);
|
||||
|
||||
$this->default=array(
|
||||
"pm_id"=>"auto"
|
||||
);
|
||||
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
72
include/database/class_profile_sql.php
Normal file
72
include/database/class_profile_sql.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Manage the table public.profile
|
||||
*
|
||||
*
|
||||
Example
|
||||
@code
|
||||
|
||||
@endcode
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
|
||||
/**
|
||||
* @brief Manage the table public.profile
|
||||
*/
|
||||
class Profile_sql extends Noalyss_SQL
|
||||
{
|
||||
/* example private $variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0); */
|
||||
|
||||
function __construct(& $p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "public.profile";
|
||||
$this->primary_key = "p_id";
|
||||
|
||||
$this->name = array(
|
||||
"p_id" => "p_id"
|
||||
, "p_name" => "p_name"
|
||||
, "p_desc" => "p_desc"
|
||||
, "with_calc" => "with_calc"
|
||||
, "with_direct_form" => "with_direct_form"
|
||||
);
|
||||
$this->type = array(
|
||||
"p_id" => "numeric"
|
||||
, "p_name" => "text"
|
||||
, "p_desc" => "text"
|
||||
, "with_calc" => "text"
|
||||
, "with_direct_form" => "text"
|
||||
);
|
||||
$this->default = array(
|
||||
"p_id" => "auto",
|
||||
);
|
||||
|
||||
parent::__construct($p_cn,$p_id);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Profile_sql::test_me();
|
||||
?>
|
||||
120
include/database/class_stock_goods_sql.php
Normal file
120
include/database/class_stock_goods_sql.php
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
|
||||
class Stock_Goods_Sql extends Noalyss_SQL
|
||||
{
|
||||
|
||||
function __construct($cn,$p_id = -1)
|
||||
{
|
||||
$this->table = "public.stock_goods";
|
||||
$this->primary_key = "sg_id";
|
||||
$this->date_format="DD.MM.YYYY";
|
||||
|
||||
$this->name = array(
|
||||
"sg_id" => "sg_id",
|
||||
"j_id" => "j_id",
|
||||
"f_id" => "f_id",
|
||||
"sg_code" => "sg_code",
|
||||
"sg_quantity" => "sg_quantity",
|
||||
"sg_type" => "sg_type",
|
||||
"sg_date" => "sg_date",
|
||||
"sg_tech_date" => "sg_tech_date",
|
||||
"sg_tech_user" => "sg_tech_user",
|
||||
"sg_comment" => "sg_comment",
|
||||
"sg_exercice" => "sg_exercice",
|
||||
"r_id" => "r_id",
|
||||
"c_id"=>"c_id"
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"sg_id" => "numeric",
|
||||
"j_id" => "numeric",
|
||||
"f_id" => "numeric",
|
||||
"sg_code" => "text",
|
||||
"sg_quantity" => "text",
|
||||
"sg_type" => "text",
|
||||
"sg_date" => "date",
|
||||
"sg_tech_date" => "date",
|
||||
"sg_tech_user" => "text",
|
||||
"sg_comment" => "text",
|
||||
"sg_exercice" => "sg_exercice",
|
||||
"r_id" => "numeric",
|
||||
"c_id" => "numeric"
|
||||
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"sg_id" => "auto",
|
||||
"sg_tech_date" => "auto",
|
||||
"sg_user" => "auto"
|
||||
);
|
||||
global $cn;
|
||||
|
||||
parent::__construct($cn, $p_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Stock_Change_Sql extends Noalyss_SQL
|
||||
{
|
||||
|
||||
function __construct($cn,$p_id = -1)
|
||||
{
|
||||
$this->date_format="DD.MM.YYYY";
|
||||
$this->table = "public.stock_change";
|
||||
$this->primary_key = "c_id";
|
||||
|
||||
$this->name = array(
|
||||
"id" => "c_id",
|
||||
"c_comment" => "c_comment",
|
||||
"c_date" => "c_date",
|
||||
"tech_date"=>"tech_date",
|
||||
"tech_user"=>"tech_user",
|
||||
"r_id"=>"r_id"
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"c_id" => "numeric",
|
||||
"c_comment" => "text",
|
||||
"c_date" => "date",
|
||||
"tech_date"=>"date",
|
||||
"tech_user"=>"text",
|
||||
"r_id"=>"numeric"
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"c_id" => "auto",
|
||||
"tech_date" => "auto"
|
||||
);
|
||||
global $cn;
|
||||
|
||||
parent::__construct($cn, $p_id);
|
||||
}
|
||||
}
|
||||
?>
|
||||
63
include/database/class_stock_sql.php
Normal file
63
include/database/class_stock_sql.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
|
||||
class Stock_Sql extends Noalyss_SQL {
|
||||
function __construct($cn,$p_id=-1)
|
||||
{
|
||||
$this->table = "public.stock_repository";
|
||||
$this->primary_key = "r_id";
|
||||
|
||||
$this->name=array(
|
||||
"id"=>"r_id",
|
||||
"name"=>"r_name",
|
||||
"adress"=>"r_adress",
|
||||
"city"=>"r_city",
|
||||
"country"=>"r_country",
|
||||
"phone"=>"r_phone"
|
||||
);
|
||||
|
||||
$this->type = array(
|
||||
"r_id"=>"numeric",
|
||||
"r_name"=>"text",
|
||||
"r_adress"=>"text",
|
||||
"r_city"=>"text",
|
||||
"r_country"=>"text",
|
||||
"r_phone"=>"text"
|
||||
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"r_id" => "auto",
|
||||
);
|
||||
global $cn;
|
||||
|
||||
parent::__construct($cn,$p_id);
|
||||
}
|
||||
}
|
||||
?>
|
||||
54
include/database/class_tag_sql.php
Normal file
54
include/database/class_tag_sql.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/database/class_noalyss_sql.php';
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* NOALYSS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NOALYSS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NOALYSS; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
/**
|
||||
* @brief Manage the table public.tag
|
||||
*/
|
||||
class Tag_SQL extends Noalyss_SQL
|
||||
{
|
||||
/* example private $variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0); */
|
||||
|
||||
function __construct(& $p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "public.tags";
|
||||
$this->primary_key = "t_id";
|
||||
|
||||
$this->name = array(
|
||||
"t_id" => "t_id"
|
||||
, "t_tag" => "t_tag"
|
||||
, "t_description" => "t_description"
|
||||
);
|
||||
$this->type = array(
|
||||
"t_id" => "numeric"
|
||||
, "t_tag" => "text"
|
||||
, "t_description" => "text"
|
||||
);
|
||||
$this->default = array(
|
||||
"t_id" => "auto",
|
||||
);
|
||||
|
||||
parent::__construct($p_cn,$p_id);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue