Bug : fix create event from AGENDA
This commit is contained in:
parent
a026155f19
commit
d58e687d7e
6 changed files with 66 additions and 9 deletions
|
|
@ -3353,6 +3353,10 @@ li.li-active {
|
|||
* style in TEXTAREA wysiwyg must be encapsuled in div with the class nicEdit-main
|
||||
*
|
||||
*/
|
||||
div.nicEdit-main {
|
||||
|
||||
font-family: 'OpenSansRegular';
|
||||
}
|
||||
div.nicEdit-main blockquote {
|
||||
margin-left:2rem !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ if ($op=='action_save')
|
|||
$event_group=$http->get("event_group", "string",0);
|
||||
$event_priority=$http->get("event_priority", "string",0);
|
||||
$title=$http->get("title_event","string", NULL);
|
||||
$summary=$http->get("summary","string", "");
|
||||
$summary= $http->get("summary","raw", "");
|
||||
$type_event=$http->get('type_event', "string",-1);
|
||||
$hour_event=$http->get('hour_event', "string",null);
|
||||
if ($date_event==-1||isDate($date_event)==0)
|
||||
|
|
@ -103,7 +103,8 @@ if ($op=='action_save')
|
|||
$gestion->f_id_dest=$dest_id;
|
||||
$gestion->ag_state=3;
|
||||
$gestion->dt_id=$type_event;
|
||||
$gestion->ag_comment=h($summary);
|
||||
$gestion->ag_comment=strip_tags($summary);
|
||||
$gestion->ag_comment=$summary;
|
||||
$gestion->ag_timestamp=$date_event;
|
||||
$gestion->ag_remind_date=$date_event;
|
||||
$gestion->ag_hour=$hour_event;
|
||||
|
|
|
|||
|
|
@ -1936,7 +1936,7 @@ where
|
|||
include NOALYSS_TEMPLATE.'/action_display_short.php';
|
||||
}
|
||||
/**
|
||||
* Add an event , with the minimum of informations,
|
||||
* @brief Add an event , with the minimum of informations,
|
||||
* used in Dashboard and Scheduler
|
||||
*/
|
||||
function save_short()
|
||||
|
|
@ -1996,8 +1996,12 @@ where
|
|||
|
||||
if (trim($this->ag_comment??"")!='')
|
||||
{
|
||||
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment) values ($1,$2,$3)"
|
||||
, array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $this->ag_comment));
|
||||
$action_comment=new Action_Gestion_Comment_SQL($this->db);
|
||||
$action_comment->ag_id=$this->ag_id;
|
||||
$action_comment->tech_user= $_SESSION[SESSION_KEY.'g_user'];
|
||||
$action_comment->agc_comment=$this->ag_comment;
|
||||
$action_comment->agc_comment_raw=$this->ag_comment;
|
||||
$action_comment->insert();
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
@ -2028,7 +2032,7 @@ where
|
|||
return -1;
|
||||
}
|
||||
/**
|
||||
* Compute an array of the complete tree depending of $p_id
|
||||
* @brief Compute an array of the complete tree depending of $p_id
|
||||
* @param $p_id ag_id
|
||||
* @return array
|
||||
* key index :
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class Action_Gestion_Comment_SQL extends Table_Data_SQL
|
|||
, "ag_id"=>"ag_id"
|
||||
, "agc_date"=>"agc_date"
|
||||
, "agc_comment"=>"agc_comment"
|
||||
, "agc_comment_raw"=>"agc_comment_raw"
|
||||
, "tech_user"=>"tech_user"
|
||||
);
|
||||
/*
|
||||
|
|
@ -55,6 +56,7 @@ class Action_Gestion_Comment_SQL extends Table_Data_SQL
|
|||
, "ag_id"=>"numeric"
|
||||
, "agc_date"=>"timestamp with time zone"
|
||||
, "agc_comment"=>"text"
|
||||
, "agc_comment_raw"=>"text"
|
||||
, "tech_user"=>"text"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ $title->size="60";
|
|||
$title->css_isze="60%";
|
||||
// Description
|
||||
$summary=new ITextarea('summary');
|
||||
$summary->style='class="itextarea" style="padding:0px;margin:0px"';
|
||||
$summary->set_enrichText('enrich');
|
||||
$summary->style='class="itextarea" style="background-color:white;padding:0px;margin:0px"';
|
||||
|
||||
// Type of document / event
|
||||
$type=new ISelect("type_event");
|
||||
|
|
@ -113,9 +114,9 @@ echo HtmlInput::title_box(_('Nouvel événement'), 'action_add_div',"close","","
|
|||
</p>
|
||||
<span > <?php echo _("Description")?>
|
||||
</span>
|
||||
<p>
|
||||
<div style="background-color:white">
|
||||
<?php echo $summary->input()?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
echo HtmlInput::hidden('gDossier',Dossier::id());
|
||||
echo HtmlInput::hidden('op','action_save');
|
||||
|
|
|
|||
|
|
@ -168,5 +168,50 @@ class FollowupTest extends TestCase
|
|||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox save a short event
|
||||
* @covers Follow_Up::save_short
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testSaveShort() {
|
||||
global $g_user;
|
||||
$title='phpunit'.date('y.m.d H:i');
|
||||
$array=array(
|
||||
"date_event"=>'22.04.2022'
|
||||
,"dest"=>''
|
||||
,'event_group'=>1
|
||||
,'event_priority'=>2
|
||||
,'title_event'=>$title
|
||||
,'summary'=>'<h1>Test</h1>'
|
||||
,"type_event"=>2
|
||||
,'hour_event'=>'07:30'
|
||||
,'op'=>'action_save'
|
||||
,'gDossier'=>DOSSIER
|
||||
);
|
||||
$_GET=$array;
|
||||
$_REQUEST=$array;
|
||||
ob_start();
|
||||
require NOALYSS_HOME.'/ajax_misc.php';
|
||||
$content=ob_get_clean();
|
||||
|
||||
$this->assertStringContainsString('<status>OK</status>',$content);
|
||||
|
||||
|
||||
global $cn;
|
||||
$id = $cn->get_value("select ag_id from action_gestion where ag_title=$1",[$title]);
|
||||
|
||||
$this->assertTrue(!empty($id),'event not save in action_gestion');
|
||||
|
||||
$comment_nb=$cn->get_value("select count(*) from action_gestion_comment where ag_id=$1",[$id]);
|
||||
$this->assertTrue($comment_nb != 0 ,' event has no description');
|
||||
|
||||
$comment_id=$cn->get_value("select agc_id from action_gestion_comment where ag_id=$1",[$id]);
|
||||
|
||||
$a_row=new Action_Gestion_Comment_SQL($cn,$comment_id);
|
||||
$this->assertTrue( ! empty($a_row->agc_comment) , 'comment not saved');
|
||||
$this->assertTrue( ! empty($a_row->agc_comment_raw) , 'comment raw not saved');
|
||||
|
||||
$cn->exec_sql("delete from action_gestion where ag_title like 'phpunit%'");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue