Reformat the code with
- astyle --style=ansi Broke : the <<<<EOF .
This commit is contained in:
parent
6c1a597fdf
commit
0e5fcddfc1
246 changed files with 42452 additions and 36227 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
|
|
@ -29,149 +29,155 @@
|
|||
require_once("class_itext.php");
|
||||
require_once('class_acc_account_ledger.php');
|
||||
|
||||
class Acc_Parm_Code {
|
||||
var $db; /*!< $db database connection */
|
||||
var $p_code; /*!< $p_code parm_code.p_code primary key */
|
||||
var $p_value; /*!< $p_value parm_code.p_value */
|
||||
var $p_comment; /*!< $p_comment parm_code.p_comment */
|
||||
// constructor
|
||||
function Acc_Parm_Code($p_cn,$p_id=-1)
|
||||
class Acc_Parm_Code
|
||||
{
|
||||
var $db; /*!< $db database connection */
|
||||
var $p_code; /*!< $p_code parm_code.p_code primary key */
|
||||
var $p_value; /*!< $p_value parm_code.p_value */
|
||||
var $p_comment; /*!< $p_comment parm_code.p_comment */
|
||||
// constructor
|
||||
function Acc_Parm_Code($p_cn,$p_id=-1)
|
||||
{
|
||||
$this->db=$p_cn;
|
||||
$this->p_code=$p_id;
|
||||
if ( $p_id != -1 )
|
||||
$this->load();
|
||||
$this->db=$p_cn;
|
||||
$this->p_code=$p_id;
|
||||
if ( $p_id != -1 )
|
||||
$this->load();
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief
|
||||
* Load all parmCode
|
||||
* return an array of Acc_Parm_Code object
|
||||
*
|
||||
* \return array
|
||||
*/
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief
|
||||
* Load all parmCode
|
||||
* return an array of Acc_Parm_Code object
|
||||
*
|
||||
* \return array
|
||||
*/
|
||||
|
||||
function load_all() {
|
||||
$sql="select * from parm_code order by p_code";
|
||||
$Res=$this->db->exec_sql($sql);
|
||||
$r= Database::fetch_all($Res);
|
||||
$idx=0;
|
||||
$array=array();
|
||||
|
||||
if ( $r === false ) return null;
|
||||
foreach ($r as $row )
|
||||
{
|
||||
$o=new Acc_Parm_Code($this->db,$row['p_code']);
|
||||
$array[$idx]=$o;
|
||||
$idx++;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief update a parm_object into the database
|
||||
* p_code is _not_ updatable
|
||||
* \return
|
||||
* nothing
|
||||
*/
|
||||
function save()
|
||||
function load_all()
|
||||
{
|
||||
// if p_code=="" nothing to save
|
||||
if ( $this->p_code== -1) return;
|
||||
// check if the account exists
|
||||
$acc=new Acc_Account_Ledger($this->db,$this->p_value);
|
||||
if ( $acc->load() == false ) {
|
||||
alert("Ce compte n'existe pas");
|
||||
} else {
|
||||
$this->p_comment=FormatString($this->p_comment);
|
||||
$this->p_value=FormatString($this->p_value);
|
||||
$this->p_code=FormatString($this->p_code);
|
||||
$sql="update parm_code set ".
|
||||
"p_comment='".$this->p_comment."' ".
|
||||
",p_value='".$this->p_value."' ".
|
||||
"where p_code='".$this->p_code."'";
|
||||
$Res=$this->db->exec_sql($sql);
|
||||
}
|
||||
$sql="select * from parm_code order by p_code";
|
||||
$Res=$this->db->exec_sql($sql);
|
||||
$r= Database::fetch_all($Res);
|
||||
$idx=0;
|
||||
$array=array();
|
||||
|
||||
if ( $r === false ) return null;
|
||||
foreach ($r as $row )
|
||||
{
|
||||
$o=new Acc_Parm_Code($this->db,$row['p_code']);
|
||||
$array[$idx]=$o;
|
||||
$idx++;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief Display an object, with the <TD> tag
|
||||
*
|
||||
* \return
|
||||
* string
|
||||
*/
|
||||
function display()
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief update a parm_object into the database
|
||||
* p_code is _not_ updatable
|
||||
* \return
|
||||
* nothing
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
$r="";
|
||||
$r.= '<TD>'.$this->p_code.'</TD>';
|
||||
$r.= '<TD>'.h($this->p_comment).'</TD>';
|
||||
$r.= '<TD>'.$this->p_value.'</TD>';
|
||||
|
||||
return $r;
|
||||
// if p_code=="" nothing to save
|
||||
if ( $this->p_code== -1) return;
|
||||
// check if the account exists
|
||||
$acc=new Acc_Account_Ledger($this->db,$this->p_value);
|
||||
if ( $acc->load() == false )
|
||||
{
|
||||
alert("Ce compte n'existe pas");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->p_comment=FormatString($this->p_comment);
|
||||
$this->p_value=FormatString($this->p_value);
|
||||
$this->p_code=FormatString($this->p_code);
|
||||
$sql="update parm_code set ".
|
||||
"p_comment='".$this->p_comment."' ".
|
||||
",p_value='".$this->p_value."' ".
|
||||
"where p_code='".$this->p_code."'";
|
||||
$Res=$this->db->exec_sql($sql);
|
||||
}
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief Display a form to enter info about
|
||||
* a parm_code object with the <TD> tag
|
||||
*
|
||||
* \return string
|
||||
*/
|
||||
function form()
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief Display an object, with the <TD> tag
|
||||
*
|
||||
* \return
|
||||
* string
|
||||
*/
|
||||
function display()
|
||||
{
|
||||
$comment=new IText();
|
||||
$comment->name='p_comment';
|
||||
$comment->value=$this->p_comment;
|
||||
$comment->size=45;
|
||||
$value=new IPoste();
|
||||
$value->name='p_value';
|
||||
$value->value=$this->p_value;
|
||||
$value->size=7;
|
||||
$value->set_attribute('ipopup','ipop_account');
|
||||
$value->set_attribute('account','p_value');
|
||||
$poste=new IText();
|
||||
$poste->setReadOnly(true);
|
||||
$poste->size=strlen($this->p_code)+1;
|
||||
$poste->name='p_code';
|
||||
$poste->value=$this->p_code;
|
||||
$r="";
|
||||
$r.='<tr>';
|
||||
$r.='<td align="right"> Code </td>';
|
||||
$r.= '<TD>'.$poste->input().'</TD>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td align="right"> Commentaire </td>';
|
||||
$r.= '<TD>'.$comment->input().'</TD>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td align="right"> Poste comptable </td>';
|
||||
$r.= '<TD>'.$value->input();
|
||||
$r.='<span id="p_value_label"></span></td>';
|
||||
$r.='</tr>';
|
||||
$r.=Dossier::hidden();
|
||||
return $r;
|
||||
|
||||
$r="";
|
||||
$r.= '<TD>'.$this->p_code.'</TD>';
|
||||
$r.= '<TD>'.h($this->p_comment).'</TD>';
|
||||
$r.= '<TD>'.$this->p_value.'</TD>';
|
||||
|
||||
return $r;
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief Display a form to enter info about
|
||||
* a parm_code object with the <TD> tag
|
||||
*
|
||||
* \return string
|
||||
*/
|
||||
function form()
|
||||
{
|
||||
$comment=new IText();
|
||||
$comment->name='p_comment';
|
||||
$comment->value=$this->p_comment;
|
||||
$comment->size=45;
|
||||
$value=new IPoste();
|
||||
$value->name='p_value';
|
||||
$value->value=$this->p_value;
|
||||
$value->size=7;
|
||||
$value->set_attribute('ipopup','ipop_account');
|
||||
$value->set_attribute('account','p_value');
|
||||
$poste=new IText();
|
||||
$poste->setReadOnly(true);
|
||||
$poste->size=strlen($this->p_code)+1;
|
||||
$poste->name='p_code';
|
||||
$poste->value=$this->p_code;
|
||||
$r="";
|
||||
$r.='<tr>';
|
||||
$r.='<td align="right"> Code </td>';
|
||||
$r.= '<TD>'.$poste->input().'</TD>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td align="right"> Commentaire </td>';
|
||||
$r.= '<TD>'.$comment->input().'</TD>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td align="right"> Poste comptable </td>';
|
||||
$r.= '<TD>'.$value->input();
|
||||
$r.='<span id="p_value_label"></span></td>';
|
||||
$r.='</tr>';
|
||||
$r.=Dossier::hidden();
|
||||
return $r;
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief
|
||||
* Complete a parm_code object thanks the p_code
|
||||
*
|
||||
* \return array
|
||||
*/
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief
|
||||
* Complete a parm_code object thanks the p_code
|
||||
*
|
||||
* \return array
|
||||
*/
|
||||
|
||||
function load() {
|
||||
if ( $this->p_code == -1 ) return "p_code non initialisé";
|
||||
$sql='select * from parm_code where p_code=$1 ';
|
||||
function load()
|
||||
{
|
||||
if ( $this->p_code == -1 ) return "p_code non initialisé";
|
||||
$sql='select * from parm_code where p_code=$1 ';
|
||||
|
||||
$Res=$this->db->exec_sql($sql,array($this->p_code));
|
||||
$Res=$this->db->exec_sql($sql,array($this->p_code));
|
||||
|
||||
if ( Database::num_row($Res) == 0 ) return 'INCONNU';
|
||||
$row= Database::fetch_array($Res,0);
|
||||
$this->p_value=$row['p_value'];
|
||||
$this->p_comment=$row['p_comment'];
|
||||
if ( Database::num_row($Res) == 0 ) return 'INCONNU';
|
||||
$row= Database::fetch_array($Res,0);
|
||||
$this->p_value=$row['p_value'];
|
||||
$this->p_comment=$row['p_comment'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue