Function load : give the return type
This commit is contained in:
parent
c9a16035ca
commit
073c0efbef
29 changed files with 45 additions and 40 deletions
|
|
@ -94,9 +94,9 @@ class Acc_Account
|
|||
* the data member are set
|
||||
* \return false if this account doesn't exist otherwise true
|
||||
*/
|
||||
function load()
|
||||
function load():bool
|
||||
{
|
||||
$this->data_sql->load();
|
||||
return $this->data_sql->load();
|
||||
}
|
||||
|
||||
function count($p_value)
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ class Acc_Account_Ledger
|
|||
* the data member are set
|
||||
* \return false if this account doesn't exist otherwise true
|
||||
*/
|
||||
function load()
|
||||
function load():bool
|
||||
{
|
||||
$ret=$this->db->exec_sql("select pcm_lib,pcm_val_parent from
|
||||
tmp_pcmn where pcm_val=$1",array($this->id));
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ class Acc_Bilan
|
|||
$this->to=$http->get("to_periode","number",-1);
|
||||
}
|
||||
/*!\brief load from the database the document data */
|
||||
function load()
|
||||
function load():void
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2561,7 +2561,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
function display_ledger()
|
||||
{
|
||||
if ($this->load()==-1)
|
||||
if ($this->load()==false)
|
||||
{
|
||||
throw new Exception(_("Journal n'existe pas"), -1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Acc_Ledger_Info
|
|||
* @brief load the todo_list row thanks it's ID
|
||||
* @return boolean true if found else false
|
||||
*/
|
||||
function load()
|
||||
function load():bool
|
||||
{
|
||||
$sql="select jr_id,id_type,ji_value from jrn_info where ji_id=$1";
|
||||
$r=$this->cn->exec_sql($sql,[$this->ji_id]);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class Acc_Operation_Note
|
|||
return new Acc_Operation_Note(new Jrn_Note_SQL($cn,$n_id));
|
||||
|
||||
}
|
||||
function save()
|
||||
function save():Acc_Operation_Note
|
||||
{
|
||||
$cn=Dossier::connect();
|
||||
$this->jrn_note_sql->setp("jr_id",$this->operation_id);
|
||||
|
|
@ -104,7 +104,7 @@ class Acc_Operation_Note
|
|||
function getOperation_id() {
|
||||
return $this->operation_id;
|
||||
}
|
||||
function load()
|
||||
function load():void
|
||||
{
|
||||
$this->jrn_note_sql->load();
|
||||
$this->operation_id=$this->jrn_note_sql->jr_id;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class Acc_Payment
|
|||
return var_export(self::$variable,true);
|
||||
}
|
||||
|
||||
public function load()
|
||||
public function load():bool
|
||||
{
|
||||
$sql='select mp_id,mp_lib,mp_fd_id,mp_jrn_def_id,mp_qcode,jrn_def_id from payment_method '.
|
||||
' where mp_id = $1';
|
||||
|
|
|
|||
|
|
@ -122,9 +122,10 @@ class Acc_Report
|
|||
$this->form_definition->save();
|
||||
}
|
||||
|
||||
/*!\brief the fr_id MUST be set before calling
|
||||
/*!
|
||||
* \brief the fr_id MUST be set before calling
|
||||
*/
|
||||
function load()
|
||||
function load():void
|
||||
{
|
||||
$this->form_definition->load();
|
||||
|
||||
|
|
@ -133,7 +134,8 @@ class Acc_Report
|
|||
{
|
||||
$this->form_definition->delete();
|
||||
}
|
||||
/*!\brief get a list from form_definition of all defined form
|
||||
/*!
|
||||
* \brief get a list from form_definition of all defined form
|
||||
*
|
||||
*\return array of object rapport
|
||||
*
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class Acc_Tva
|
|||
*@note if the label is not found then we get an message error, so the best is probably
|
||||
*to initialize the VAT object with default value
|
||||
*/
|
||||
public function load()
|
||||
public function load():int
|
||||
{
|
||||
$this->tva_rate_sql->setp("tva_id",$this->tva_id);
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ class Acc_Tva
|
|||
*/
|
||||
public function get_side($p_side)
|
||||
{
|
||||
if ( strlen($this->tva_poste) == 0 ) $this->load();
|
||||
if ( strlen($this->tva_poste??"") == 0 ) $this->load();
|
||||
list($deb,$cred)=explode(",",$this->tva_poste);
|
||||
switch ($p_side)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Anc_Balance_Simple extends Anc_Print
|
|||
/*!
|
||||
* \brief load the data from the database
|
||||
*
|
||||
* \return array
|
||||
* \return array or null
|
||||
*/
|
||||
function load()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class Anc_Group extends Anc_Print
|
|||
* @brief load the todo_list row thanks it's ID
|
||||
* @return boolean true if found else false
|
||||
*/
|
||||
function load()
|
||||
function load():bool
|
||||
{
|
||||
$sql="select ga_id, ga_description,pa_id from groupe_analytique where".
|
||||
" ga_id = $1";
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ class Document_modele
|
|||
}
|
||||
/*!\brief load the value of a document_modele,the ag_id variable must be set
|
||||
*/
|
||||
function load()
|
||||
function load():void
|
||||
{
|
||||
$array=$this->cn->get_array("SELECT md_id, md_name, md_lob, md_type, md_filename, md_mimetype,md_affect".
|
||||
" FROM document_modele where md_id=$1",array($this->md_id));
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class Extension extends Menu_Ref_sql
|
|||
function search($p_what)
|
||||
{
|
||||
$this->me_code=strtoupper($p_what);
|
||||
if ($this->load()==-1)
|
||||
if ($this->load()==false)
|
||||
return null;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ class Fiche
|
|||
}
|
||||
/*!\brief Synonum of fiche::getAttribut
|
||||
*/
|
||||
function load()
|
||||
function load() :void
|
||||
{
|
||||
$this->getAttribut();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class Fiche_Def
|
|||
* @brief alias for Fiche_Def->get(),
|
||||
* @return void
|
||||
*/
|
||||
function load()
|
||||
function load():void
|
||||
{
|
||||
$this->get();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class Follow_Up_Detail
|
|||
* @brief load the todo_list row thanks it's ID
|
||||
* @return boolean true if found else false
|
||||
*/
|
||||
public function load()
|
||||
public function load():bool
|
||||
{
|
||||
$sql="SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
|
||||
ad_total_amount, ag_id FROM action_detail".
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class Forecast
|
|||
* @brief load from db
|
||||
* @return boolean true if found else false
|
||||
*/
|
||||
public function load()
|
||||
public function load():bool
|
||||
{
|
||||
$sql="select f_id, f_name,f_start_date ,f_end_date from forecast where f_id=$1";
|
||||
$res=$this->cn->exec_sql(
|
||||
|
|
|
|||
|
|
@ -460,6 +460,7 @@ class Lettering
|
|||
public function load()
|
||||
{
|
||||
|
||||
throw new Exception('load not implemented');
|
||||
}
|
||||
|
||||
public function delete()
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class Noalyss_Appearance
|
|||
$this->aColor=self::$aCSSColor;
|
||||
}
|
||||
|
||||
function load()
|
||||
function load():void
|
||||
{
|
||||
$cn = Dossier::connect();
|
||||
$aColor = $cn->get_array("select a_code,a_value from parm_appearance");
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ class Noalyss_User
|
|||
* return -1 if nothing is found or the use_id
|
||||
*/
|
||||
|
||||
function load()
|
||||
function load():int
|
||||
{
|
||||
/* if this->id == -1, it is unknown so we have to retrieve it from
|
||||
the database thanks it login */
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ EOF;
|
|||
* \return 0 on success and -1 on error
|
||||
*/
|
||||
|
||||
function load()
|
||||
function load():int
|
||||
{
|
||||
if ($this->p_id=='')
|
||||
$this->p_id=-1;
|
||||
|
|
@ -330,11 +330,11 @@ EOF;
|
|||
array($p_exercice));
|
||||
$rMax=new Periode($this->cn);
|
||||
$rMax->p_id=$max;
|
||||
if ($rMax->load())
|
||||
if ($rMax->load() == -1)
|
||||
throw new Exception('Periode n\'existe pas');
|
||||
$rMin=new Periode($this->cn);
|
||||
$rMin->p_id=$min;
|
||||
if ($rMin->load())
|
||||
if ($rMin->load() == -1)
|
||||
throw new Exception('Periode n\'existe pas');
|
||||
return array($rMax, $rMin);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class Pre_operation
|
|||
/*!\brief load the data from the database and return an array
|
||||
* \return an double array containing all the data from database
|
||||
*/
|
||||
function load()
|
||||
function load():array
|
||||
{
|
||||
$this->isloaded=true;
|
||||
//------------------------------------------
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class Todo_List
|
|||
* @brief load the todo_list row thanks it's ID
|
||||
* @return boolean true if found else false
|
||||
*/
|
||||
public function load()
|
||||
public function load():bool
|
||||
{
|
||||
|
||||
$sql="select tl_id,tl_title,tl_desc,to_char( tl_date,'DD.MM.YYYY') as tl_date,is_public,use_login
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class Acc_Plan_SQL extends Data_SQL
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
public function load()
|
||||
public function load():bool
|
||||
{
|
||||
$pk=$this->primary_key;
|
||||
if ( $this->get_limit_fiche_qcode() != 0 )
|
||||
|
|
@ -135,13 +135,14 @@ class Acc_Plan_SQL extends Data_SQL
|
|||
if ($this->cn->count()==0)
|
||||
{
|
||||
$this->$pk=-1;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($result[0] as $key=> $value)
|
||||
{
|
||||
$this->$key=$value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function seek($cond='', $p_array=null)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class V_Contact_SQL extends Data_SQL
|
|||
throw new Exception("not implemented");
|
||||
}
|
||||
|
||||
function load()
|
||||
function load():bool
|
||||
{
|
||||
$array=$this->cn->get_row("select * from ".$this->table." where f_id=$1",array($this->f_id));
|
||||
if (empty ($array) ) { $this->f_id=-1;return false;}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class V_Currency_Last_Value_SQL extends Data_SQL
|
|||
|
||||
}
|
||||
|
||||
public function load()
|
||||
public function load():bool
|
||||
{
|
||||
$sql=" select ";
|
||||
$sep="";
|
||||
|
|
@ -133,13 +133,14 @@ class V_Currency_Last_Value_SQL extends Data_SQL
|
|||
if ($this->cn->count()==0)
|
||||
{
|
||||
$this->$pk=-1;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($result[0] as $key=> $value)
|
||||
{
|
||||
$this->$key=$value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function seek($cond='', $p_array=null)
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ abstract class Data_SQL
|
|||
if ( empty($this->date_format) ) $this->date_format="DD.MM.YYYY";
|
||||
}
|
||||
/**
|
||||
* Insert or update : if the row already exists, update otherwise insert
|
||||
*@brief Insert or update : if the row already exists, update otherwise insert
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
|
|
@ -199,7 +199,7 @@ abstract class Data_SQL
|
|||
return $this->$pk;
|
||||
}
|
||||
|
||||
abstract function load();
|
||||
abstract function load():bool;
|
||||
|
||||
public function get_info()
|
||||
{
|
||||
|
|
@ -241,7 +241,7 @@ abstract class Data_SQL
|
|||
}
|
||||
/**
|
||||
*
|
||||
* Turn an object (row) into an array, and the key could be prefixed with $prefix
|
||||
* @brief Turn an object (row) into an array, and the key could be prefixed with $prefix
|
||||
* @param string $prefix before the key
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -277,7 +277,7 @@ abstract class Data_SQL
|
|||
abstract function seek($cond='', $p_array=null);
|
||||
|
||||
/**
|
||||
* get_seek return the next object, the return of the query must have all the column
|
||||
* @brief 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
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ abstract class Table_Data_SQL extends Data_SQL
|
|||
/***
|
||||
* @brief load a row , corresponding to the primary key
|
||||
*/
|
||||
public function load()
|
||||
public function load():bool
|
||||
{
|
||||
$sql=$this->build_query();
|
||||
$pk=$this->primary_key;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class Acc_AccountTest extends TestCase
|
|||
public function testLoad()
|
||||
{
|
||||
$r=$this->object->load();
|
||||
$this->assertNotEquals($r,-1);
|
||||
$this->assertNotEquals($r,false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue