diff --git a/Acc_Operation_NoteTest.php b/Acc_Operation_NoteTest.php new file mode 100644 index 000000000..7a7706672 --- /dev/null +++ b/Acc_Operation_NoteTest.php @@ -0,0 +1,60 @@ +assertEquals(7,$note->getJrnNoteSql()->getp("n_id"),' cannot retrieve a note'); + + $note=Acc_Operation_Note::build_jrn_id(686); + $this->assertEquals(14,$note->getJrnNoteSql()->getp("n_id"),' cannot retrieve a note'); + + $note=Acc_Operation_Note::build_jrn_id(1000); + $this->assertEquals(-1,$note->getJrnNoteSql()->getp("n_id"),' cannot retrieve a note'); + } + public function testSave() + { + $cn=Dossier::connect(); + $cn->exec_sql("delete from jrn_note where jr_id=251"); + // Add a new note + $note=Acc_Operation_Note::build_jrn_id(251); + $this->assertEquals(-1,$note->getJrnNoteSql()->getp("n_id"),"note already exist"); + + $note->setNote("Test 1"); + $note->setOperation_id(251); + $note->save(); + + $compare=Acc_Operation_Note::build_jrn_id(251); + $id=$note->getJrnNoteSql()->getp("n_id"); + $this->assertGreaterThan(0,$compare->getJrnNoteSql()->getp("n_id"),"note not created"); + $this->assertEquals($id,$compare->getJrnNoteSql()->getp("n_id"),"Note not loaded"); + $note->setNote("Test 2"); + $note->save(); + $compare->load(); + $this->assertEquals("Test 2",$compare->getJrnNoteSql()->getp("n_text"),"note not updated and loaded"); + $this->assertEquals("Test 2",$compare->getNote(),"note not updated, match incorrect"); + } +} diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 8f422529f..0595a7998 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -626,6 +626,7 @@ class Acc_Ledger extends jrn_def_sql return _("Aucun résultat"); $anc=null; extract($p_array, EXTR_SKIP); + if ( !isset($p_array['jrn_note_input'])) {$p_array['jrn_note_input']='';} $lPeriode=new Periode($this->db); if ($this->check_periode()==true) { @@ -651,6 +652,9 @@ class Acc_Ledger extends jrn_def_sql $date_limit=$lPeriode->get_date_limit(); $ret.='
'. h($p_array['jrn_note_input']).''; + $ret.="
| '; + $ret.=_("Note"). + Icon_Action::show_note('jrn_note_div'); + $ret.=' | '; + $ret.=''; // Currency $currency_select = $this->CurrencyInput("currency_code", "p_currency_rate" , "p_currency_euro"); $currency_select->selected=$http->request('p_currency_code','string',0); @@ -958,6 +970,13 @@ class Acc_Ledger extends jrn_def_sql $ret.=' |
'._('Note').' '.h($p_array['jrn_note_input']).'';
$r.='';
$r.=''._('Note').' '.h($p_array['jrn_note_input']).'';
$r.=''.h($this->note).''; + } +} \ No newline at end of file diff --git a/include/database/jrn_note_sql.class.php b/include/database/jrn_note_sql.class.php new file mode 100644 index 000000000..08604a4a5 --- /dev/null +++ b/include/database/jrn_note_sql.class.php @@ -0,0 +1,66 @@ +table="public.jrn_note"; + $this->primary_key="n_id"; + /* + * List of columns + */ + $this->name=array( + "n_id"=>"n_id" + , "jr_id"=>"jr_id" + ,"n_text"=>"n_text" + ); + /* + * Type of columns + */ + $this->type=array( + "n_id"=>"number" + , "jr_id"=>"number" + ,"n_text"=>"text" + ); + + + $this->default=array( + "n_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} \ No newline at end of file diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php index 6e865164a..65a3485ee 100644 --- a/include/lib/icon_action.class.php +++ b/include/lib/icon_action.class.php @@ -458,7 +458,17 @@ class Icon_Action $r=sprintf('%s', - $p_domid,$p_domid,$p_size,""); + $p_domid,$p_domid,$p_size,""); + return $r; + } + /** + * @brief Increase size of input_text (p_domid) with p_domid + * @param $p_domid domid of the input "text" element + * @param $p_size size of the element + * @return string HTML string + */ + static function show_note($p_domid) { + $r=''; return $r; } } diff --git a/include/template/acc_operation_note-input.php b/include/template/acc_operation_note-input.php new file mode 100644 index 000000000..17efd9ad7 --- /dev/null +++ b/include/template/acc_operation_note-input.php @@ -0,0 +1,37 @@ + + + \ No newline at end of file diff --git a/include/template/form_ledger_detail.php b/include/template/form_ledger_detail.php index 12ad9303b..ed6a7c342 100644 --- a/include/template/form_ledger_detail.php +++ b/include/template/form_ledger_detail.php @@ -67,6 +67,16 @@ +