- Override the function __toString to comply with xdebug
- Correct bug in input_switch.class.php when there is several input_switch - FicheDef the insertAttribut can have an order, usefull when installing new category + attribute
This commit is contained in:
parent
b382455dd0
commit
570e3c53a1
6 changed files with 64 additions and 10 deletions
|
|
@ -44,6 +44,12 @@ class Fiche_Def
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
return "fiche_def".print_r($this,true);
|
||||||
|
}
|
||||||
|
|
||||||
/*!\brief show the content of the form to create a new Fiche_Def_Ref
|
/*!\brief show the content of the form to create a new Fiche_Def_Ref
|
||||||
*/
|
*/
|
||||||
function input ()
|
function input ()
|
||||||
|
|
@ -258,7 +264,7 @@ $order
|
||||||
$sql="insert into fiche_def(fd_label,fd_class_base,frd_id,fd_create_account,fd_description)
|
$sql="insert into fiche_def(fd_label,fd_class_base,frd_id,fd_create_account,fd_description)
|
||||||
values ($1,$2,$3,$4,$5) returning fd_id";
|
values ($1,$2,$3,$4,$5) returning fd_id";
|
||||||
|
|
||||||
$fd_id=$this->cn->get_value($sql,array($p_nom_mod,$p_class_base,$p_fiche_def,$p_create,$p_fd_description));
|
$this->id=$this->cn->get_value($sql,array($p_nom_mod,$p_class_base,$p_fiche_def,$p_create,$p_fd_description));
|
||||||
|
|
||||||
// p_class must be added to tmp_pcmn if it is a single accounting
|
// p_class must be added to tmp_pcmn if it is a single accounting
|
||||||
if ( strpos(',',$p_class_base) ==0)
|
if ( strpos(',',$p_class_base) ==0)
|
||||||
|
|
@ -621,24 +627,32 @@ $order
|
||||||
|
|
||||||
/*!\brief insert a new attribut for this fiche_def
|
/*!\brief insert a new attribut for this fiche_def
|
||||||
* \param $p_ad_id id of the attribut
|
* \param $p_ad_id id of the attribut
|
||||||
|
* \param int $p_order order of the attribut if -1 then computed
|
||||||
*/
|
*/
|
||||||
function InsertAttribut($p_ad_id)
|
function insertAttribut($p_ad_id,$p_order=-1)
|
||||||
{
|
{
|
||||||
if ( $this->id == 0 ) return;
|
if ( $this->id == 0 ) return;
|
||||||
/* ORDER */
|
/* ORDER */
|
||||||
$this->GetAttribut();
|
$this->GetAttribut();
|
||||||
$max=sizeof($this->attribut)*15;
|
$order=$p_order;
|
||||||
|
if ( $p_order == -1 ) {
|
||||||
|
$order = $this->cn->get_value("select ad_default_order from attr_def where ad_id=$1",[$p_ad_id]);
|
||||||
|
if ( $order == 0 || empty($order)) {
|
||||||
|
$max=$this->get_value("select count(*) from jnt_fic_attr where fd_id=$1",[$this->id]);
|
||||||
|
$order=$max*15;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Insert a new attribute for the model
|
// Insert a new attribute for the model
|
||||||
// it means insert a row in jnt_fic_attr
|
// it means insert a row in jnt_fic_attr
|
||||||
$sql=sprintf("insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (%d,%d,%d)",
|
$sql=sprintf("insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (%d,%d,%d)",
|
||||||
$this->id,$p_ad_id,$max);
|
$this->id,$p_ad_id,$order);
|
||||||
$Res=$this->cn->exec_sql($sql);
|
$Res=$this->cn->exec_sql($sql);
|
||||||
}
|
}
|
||||||
/*!\brief remove an attribut for this fiche_def
|
/*!\brief remove an attribut for this fiche_def
|
||||||
* \param array of ad_id to remove
|
* \param array of ad_id to remove
|
||||||
* \remark you can't remove the attribut defined in attr_min
|
* \remark you can't remove the attribut defined in attr_min
|
||||||
*/
|
*/
|
||||||
function RemoveAttribut($array)
|
function removeAttribut($array)
|
||||||
{
|
{
|
||||||
foreach ($array as $ch)
|
foreach ($array as $ch)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,37 @@ class Noalyss_Parameter_Folder
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
$r = <<<EOF
|
||||||
|
MY_TVA = [ {$this->MY_TVA }]
|
||||||
|
MY_STREET = [ {$this->MY_STREET }]
|
||||||
|
MY_NUMBER= [ {$this->MY_NUMBER }]
|
||||||
|
MY_CP= [ {$this->MY_CP }]
|
||||||
|
MY_TEL= [ {$this->MY_TEL }]
|
||||||
|
MY_PAYS= [ {$this->MY_PAYS }]
|
||||||
|
MY_COMMUNE= [ {$this->MY_COMMUNE }]
|
||||||
|
MY_FAX= [ {$this->MY_FAX }]
|
||||||
|
MY_ANALYTIC= [ {$this->MY_ANALYTIC }]
|
||||||
|
MY_STRICT= [ {$this->MY_STRICT }]
|
||||||
|
MY_TVA_USE= [ {$this->MY_TVA_USE }]
|
||||||
|
MY_PJ_SUGGEST= [ {$this->MY_PJ_SUGGEST }]
|
||||||
|
MY_CHECK_PERIODE= [ {$this->MY_CHECK_PERIODE }]
|
||||||
|
MY_DATE_SUGGEST= [ {$this->MY_DATE_SUGGEST }]
|
||||||
|
MY_ALPHANUM= [ {$this->MY_ALPHANUM }]
|
||||||
|
MY_UPDLAB= [ {$this->MY_UPDLAB }]
|
||||||
|
MY_STOCK= [ {$this->MY_STOCK }]
|
||||||
|
MY_DEFAULT_ROUND_ERROR_DEB= [ {$this->MY_DEFAULT_ROUND_ERROR_DEB }]
|
||||||
|
MY_DEFAULT_ROUND_ERROR_CRED= [ {$this->MY_DEFAULT_ROUND_ERROR_CRED }]
|
||||||
|
MY_ANC_FILTER= [ {$this->MY_ANC_FILTER }]
|
||||||
|
MY_CURRENCY= [ {$this->MY_CURRENCY }]
|
||||||
|
|
||||||
|
|
||||||
|
EOF;
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
function check_anc_filter($p_value)
|
function check_anc_filter($p_value)
|
||||||
{
|
{
|
||||||
$tmp_value=$p_value;
|
$tmp_value=$p_value;
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,10 @@ class User
|
||||||
$this->load();
|
$this->load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
return "User ".print_r($this,true);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @brief check the password and user
|
* @brief check the password and user
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ class HttpInput
|
||||||
$this->array=null;
|
$this->array=null;
|
||||||
$this->empty="";
|
$this->empty="";
|
||||||
}
|
}
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
return "http_input".print_r($this,true);
|
||||||
|
}
|
||||||
public function get_array()
|
public function get_array()
|
||||||
{
|
{
|
||||||
return $this->array;
|
return $this->array;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ class InputSwitch extends HtmlInput
|
||||||
|
|
||||||
function __construct($name='', $value='', $p_id="")
|
function __construct($name='', $value='', $p_id="")
|
||||||
{
|
{
|
||||||
$this->value_container=$name;
|
$this->name=$name;
|
||||||
|
$this->value_container=uniqid();
|
||||||
$this->value=$value;
|
$this->value=$value;
|
||||||
$this->icon=$p_id;
|
$this->icon=$p_id;
|
||||||
$this->javascript="";
|
$this->javascript="";
|
||||||
|
|
@ -50,8 +51,8 @@ class InputSwitch extends HtmlInput
|
||||||
{
|
{
|
||||||
$r="";
|
$r="";
|
||||||
if ($p_name!=NULL)
|
if ($p_name!=NULL)
|
||||||
$this->value_container=$p_name;
|
$this->name=$p_name;
|
||||||
if ($p_value!==NULL)
|
if ($p_value!=NULL)
|
||||||
$this->value=$p_value;
|
$this->value=$p_value;
|
||||||
|
|
||||||
if ( $this->icon=="") $this->icon=uniqid ("inputSwitch");
|
if ( $this->icon=="") $this->icon=uniqid ("inputSwitch");
|
||||||
|
|
@ -62,7 +63,7 @@ class InputSwitch extends HtmlInput
|
||||||
if ($this->readOnly == TRUE) {
|
if ($this->readOnly == TRUE) {
|
||||||
return $this->display();
|
return $this->display();
|
||||||
}
|
}
|
||||||
$r.= HtmlInput::hidden($this->value_container, $this->value);
|
$r.= HtmlInput::hidden($this->name, $this->value,$this->value_container);
|
||||||
|
|
||||||
$this->javascript=sprintf('toggle_onoff(\'%s\',\'%s\');%s;',$this->icon,$this->value_container,$this->javascript);
|
$this->javascript=sprintf('toggle_onoff(\'%s\',\'%s\');%s;',$this->icon,$this->value_container,$this->javascript);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ class Fiche_DefTest extends Testcase
|
||||||
|
|
||||||
// percent deductible
|
// percent deductible
|
||||||
$fiche_def->InsertAttribut(20);
|
$fiche_def->InsertAttribut(20);
|
||||||
$fiche_def->InsertAttribut(21);
|
$fiche_def->InsertAttribut(21,120);
|
||||||
$fiche_def->InsertAttribut(22);
|
$fiche_def->InsertAttribut(22);
|
||||||
|
|
||||||
// accouting for not deductible
|
// accouting for not deductible
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue