Bug : fiche account not created automatically when empty , improve test
This commit is contained in:
parent
9d3e6db5eb
commit
f1ea56101d
5 changed files with 300 additions and 16 deletions
|
|
@ -495,7 +495,6 @@ class Card_Property
|
|||
if (mb_strlen($part2)>40)
|
||||
throw new Exception("CP476."._("Poste comptable trop long"), 1);
|
||||
|
||||
$part1=$p_fiche->cn->get_value('select format_account($1)', array($part1));
|
||||
$acc_account1=new Acc_Account($p_fiche->cn, $part1);
|
||||
|
||||
if ($acc_account1->get_parameter("id")==-1)
|
||||
|
|
@ -513,7 +512,6 @@ class Card_Property
|
|||
throw new Exception("CP493."._("Utilisation directe interdite du poste comptable $part1"));
|
||||
}
|
||||
// Part 2
|
||||
$part2=$p_fiche->cn->get_value('select format_account($1)', array($part2));
|
||||
$acc_account2=new Acc_Account($p_fiche->cn, $part2);
|
||||
|
||||
if ($acc_account2->get_parameter("id")==-1)
|
||||
|
|
@ -556,7 +554,7 @@ class Card_Property
|
|||
throw new Exception("CP537."._("Utilisation directe interdite du poste comptable $v"));
|
||||
}
|
||||
}
|
||||
$sql=sprintf("select account_update(%d,'%s')", $p_fiche->id, $v);
|
||||
$sql=sprintf("select account_insert(%d,'%s')", $p_fiche->id, $v);
|
||||
try
|
||||
{
|
||||
$p_fiche->cn->exec_sql($sql);
|
||||
|
|
@ -570,7 +568,7 @@ class Card_Property
|
|||
if (strlen(trim($v))==0)
|
||||
{
|
||||
|
||||
$sql=sprintf("select account_update(%d,null)", $p_fiche->id);
|
||||
$sql=sprintf("select account_insert(%d,null)", $p_fiche->id);
|
||||
try
|
||||
{
|
||||
$Ret=$p_fiche->cn->exec_sql($sql);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class Fiche
|
|||
* \param $p_qcode quick_code (ad_id=23)
|
||||
* \param $p_all retrieve all the attribut of the card, possible value
|
||||
* are true or false. false retrieves only the f_id. By default true
|
||||
* \return 0 success 1 error not found
|
||||
* \returns 0 success , card found / 1 error card not found
|
||||
*/
|
||||
function get_by_qcode($p_qcode=null,$p_all=true)
|
||||
{
|
||||
|
|
@ -477,8 +477,11 @@ class Fiche
|
|||
$this->setAttribut($property->ad_id, $p_array[$key]);
|
||||
}
|
||||
}
|
||||
// For accounting
|
||||
|
||||
Card_Property::update($this);
|
||||
$this->quick_code=$this->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
// reread from database
|
||||
$this->getAttribut();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue