*
Document ".$doc->anchor().'
'; $doc_ref.=$h2->input().$d_id->input('d_id', $this->d_id); } } // title $title=new IText(); $title->readOnly=$readonly; $title->name="ag_title"; $title->value=$this->ag_title; $title->size=60; // Priority of the ag_priority $ag_priority=new ISelect(); $ag_priority->readOnly=$readonly; $ag_priority->name="ag_priority"; $ag_priority->selected=$this->ag_priority; $ag_priority->value=array(array('value'=>1, 'label'=>_('Haute')), array('value'=>2, 'label'=>_('Moyenne')), array('value'=>3, 'label'=>_('Basse')) ); $str_ag_priority=$ag_priority->input(); // hour of the action (meeting) ag_hour $ag_hour=new IText(); $ag_hour->readOnly=$readonly; $ag_hour->name="ag_hour"; $ag_hour->value=$this->ag_hour; $ag_hour->size=6; $ag_hour->javascript=" onblur=check_hour('ag_hour');"; $str_ag_hour=$ag_hour->input(); // Profile in charged of the action $ag_dest=new ISelect(); $ag_dest->readOnly=$readonly; $ag_dest->name="ag_dest"; // select profile $aAg_dest=$this->db->make_array("select p_id as value, ". "p_name as label ". " from profile where p_id in ".$g_user->get_writable_profile()."order by 2"); $ag_dest->value=$aAg_dest; $ag_dest->selected=$this->ag_dest; $str_ag_dest=$ag_dest->input(); // ag_ref // Always false for update $client_label=new ISpan(); /* Add button */ $f_add_button=new IButton('add_card'); $f_add_button->label=_('Créer une nouvelle fiche'); $f_add_button->set_attribute('ipopup', 'ipop_newcard'); $filter=$this->db->make_list('select fd_id from fiche_def '); $f_add_button->set_attribute('filter', $filter); $f_add_button->javascript=" select_card_type(this);"; $str_add_button=$f_add_button->input(); // f_id_dest sender if ($this->qcode_dest!=NOTFOUND&&strlen(trim($this->qcode_dest))!=0) { $tiers=new Fiche($this->db); $tiers->get_by_qcode($this->qcode_dest); $qcode_dest_label=$tiers->strAttribut(1); $this->f_id_dest=$tiers->id; } else { $qcode_dest_label=($this->f_id_dest==0||trim($this->qcode_dest)=="")?'Interne ':'Error'; } $h_ag_id=new IHidden(); // if concerns another action : show the link otherwise nothing // // sender $w=new ICard(); $w->readOnly=$readonly; $w->jrn=0; $w->name='qcode_dest'; $w->value=($this->f_id_dest!=0)?$this->qcode_dest:""; $w->label=""; $list_recipient=$this->db->make_list('select fd_id from fiche_def where frd_id in (14,25,8,9,16)'); $w->extra=$list_recipient; $w->set_attribute('typecard', $list_recipient); $w->set_dblclick("fill_ipopcard(this);"); $w->set_attribute('ipopup', 'ipopcard'); // name of the field to update with the name of the card $w->set_attribute('label', 'qcode_dest_label'); // name of the field to update with the name of the card $w->set_attribute('typecard', $w->extra); $w->set_function('fill_data'); $w->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $w->name); $sp=new ISpan(); $sp->name='qcode_dest_label'; $sp->value=$qcode_dest_label; // autre - a refaire pour avoir plusieurs fiches // Sur le modèle des tags $ag_contact=new ICard(); $ag_contact->readOnly=$readonly; $ag_contact->jrn=0; $ag_contact->name='ag_contact'; $ag_contact->value=''; $ag_contact->set_attribute('ipopup', 'ipopcard'); if ($this->ag_contact!=0) { $contact=new Fiche($this->db, $this->ag_contact); $ag_contact->value=$contact->get_quick_code(); } $ag_contact->label=""; $list_contact=$this->db->make_list('select fd_id from fiche_def where frd_id=16'); $ag_contact->extra=$list_contact; $ag_contact->set_dblclick("fill_ipopcard(this);"); // name of the field to update with the name of the card $ag_contact->set_attribute('label', 'ag_contact_label'); // name of the field to update with the name of the card $ag_contact->set_attribute('typecard', $list_contact); $ag_contact->set_function('fill_data'); $ag_contact->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $ag_contact->name); $spcontact=new ISpan(); $spcontact->name='ag_contact_label'; $spcontact->value=''; $fiche_contact=new Fiche($this->db); $fiche_contact->get_by_qcode($this->ag_contact); if ($fiche_contact->id!=0) { $spcontact->value=$fiche_contact->strAttribut(ATTR_DEF_NAME); } $h_agrefid=new IHidden(); $iag_ref=new IText("ag_ref"); $iag_ref->value=$this->ag_ref; $iag_ref->readOnly=($p_view=="NEW"||$p_view=='READ')?true:false; $str_ag_ref=$iag_ref->input(); // Preparing the return string $r=""; /* for new files */ $upload=new IFile(); $upload->name="file_upload[]"; $upload->readOnly=$readonly; $upload->value=""; $aAttachedFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype,'. '\'export.php?act=RAW:document&'. Dossier::get().'&d_id=\'||d_id as link'. ' from document where ag_id=$1', array($this->ag_id)); /* create the select for document */ $aDocMod=new ISelect(); $aDocMod->name='doc_mod'; $aDocMod->value=$this->db->make_array('select md_id,dt_value||\' : \'||md_name as md_name'. ' from document_modele join document_type on (md_type=dt_id)'. ' order by md_name'); $str_select_doc=$aDocMod->input(); /* if no document then do not show the generate button */ if (empty($aDocMod->value)) $str_submit_generate=""; else $str_submit_generate=HtmlInput::submit("generate", _("Génére le document")); $ag_id=$this->ag_id; /* fid = Icard */ $icard=new ICard(); $icard->jrn=0; $icard->table=0; $icard->extra2='QuickCode'; $icard->noadd="no"; $icard->extra='all'; /* Text desc */ $text=new IText(); $num=new INum(); /* TVA */ $itva=new ITva_Popup($this->db); $itva->in_table=true; $aCard=array(); /* create aArticle for the detail section */ $article_count=(count($this->aAction_detail)==0)?MAX_ARTICLE:count($this->aAction_detail); /* Compute total */ $tot_item=0; $tot_vat=0; for ($i=0; $i<$article_count; $i++) { /* fid = Icard */ $icard=new ICard(); $icard->jrn=0; $icard->table=0; $icard->noadd="no"; $icard->extra='all'; $icard->name="e_march".$i; $tmp_ad=(isset($this->aAction_detail[$i]))?$this->aAction_detail[$i]:false; $icard->readOnly=$readonly; $icard->value=''; $aCard[$i]=0; if ($tmp_ad) { $march=new Fiche($this->db); $f=$tmp_ad->get_parameter('qcode'); if ($f!=0) { $march->id=$f; $icard->value=$march->get_quick_code(); $aCard[$i]=$f; } } $icard->set_dblclick("fill_ipopcard(this);"); // name of the field to update with the name of the card $icard->set_attribute('label', "e_march".$i."_label"); // name of the field to update with the name of the card $icard->set_attribute('typecard', $icard->extra); $icard->set_attribute('ipopup', 'ipopcard'); $icard->set_function('fill_data'); $icard->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name); $aArticle[$i]['fid']=$icard->search().$icard->input(); $text->javascript=' onchange="clean_tva('.$i.');compute_ledger('.$i.')"'; $text->css_size="100%"; $text->name="e_march".$i."_label"; $text->id="e_march".$i."_label"; $text->size=40; $text->value=($tmp_ad)?$tmp_ad->get_parameter('text'):""; $text->readOnly=$readonly; $aArticle[$i]['desc']=$text->input(); $num->javascript=' onchange="format_number(this,4);clean_tva('.$i.');compute_ledger('.$i.')"'; $num->name="e_march".$i."_price"; $num->id="e_march".$i."_price"; $num->size=8; $num->readOnly=$readonly; $num->value=($tmp_ad)?$tmp_ad->get_parameter('price_unit'):0; $aArticle[$i]['pu']=$num->input(); $num->name="e_quant".$i; $num->id="e_quant".$i; $num->size=8; $num->value=($tmp_ad)?$tmp_ad->get_parameter('quantity'):0; $aArticle[$i]['quant']=$num->input(); $itva->name='e_march'.$i.'_tva_id'; $itva->id='e_march'.$i.'_tva_id'; $itva->value=($tmp_ad)?$tmp_ad->get_parameter('tva_id'):0; $itva->readOnly=$readonly; $itva->js=' onchange="format_number(this);clean_tva('.$i.');compute_ledger('.$i.')"'; $itva->set_attribute('compute', $i); $aArticle[$i]['tvaid']=$itva->input(); $num->name="e_march".$i."_tva_amount"; $num->id="e_march".$i."_tva_amount"; $num->value=($tmp_ad)?$tmp_ad->get_parameter('tva_amount'):0; $num->javascript=" onchange=\"compute_ledger('".$i." ')\""; $num->size=8; $aArticle[$i]['tva']=$num->input(); $tot_vat=bcadd($tot_vat,$num->value); $num->name="tvac_march".$i; $num->id="tvac_march".$i; $num->value=($tmp_ad)?$tmp_ad->get_parameter('total'):0; $num->size=8; $aArticle[$i]['tvac']=$num->input(); $tot_item=bcadd($tot_item,$num->value); $aArticle[$i]['hidden_htva']=HtmlInput::hidden('htva_march'.$i, 0); $aArticle[$i]['hidden_tva']=HtmlInput::hidden('tva_march'.$i, 0); $aArticle[$i]['ad_id']=($tmp_ad)?HtmlInput::hidden('ad_id'.$i, $tmp_ad->get_parameter('id')):HtmlInput::hidden('ad_id'.$i, 0); } /* Add the needed hidden values */ $r.=dossier::hidden(); /* add the number of item */ $Hid=new IHidden(); $r.=$Hid->input("nb_item", $article_count); $r.=HtmlInput::request_to_hidden(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag")); $a_tag=$this->tag_get(); $menu=new Default_Menu(); /* get template */ ob_start(); require NOALYSS_TEMPLATE.'/detail-action.php'; $content=ob_get_contents(); ob_end_clean(); $r.=$content; //hidden $r.=""; $r.=$h2->input(); $r.=$h_ag_id->input('ag_id', $this->ag_id); $hidden2=new IHidden(); $r.=$hidden2->input('f_id_dest', $this->f_id_dest); $r.="
"; return $r; } //---------------------------------------------------------------------- /** * \brief This function shows the detail of an action thanks the ag_id */ function get() { $sql="select ag_id,to_char (ag_timestamp,'DD.MM.YYYY') as ag_timestamp,". " f_id_dest,ag_title,ag_ref,d_id,ag_type,ag_state, ag_owner, ". " ag_dest, ag_hour, ag_priority, ag_contact,to_char (ag_remind_date,'DD.MM.YYYY') as ag_remind_date ". " from action_gestion left join document using (ag_id) where ag_id=".$this->ag_id; $r=$this->db->exec_sql($sql); $row=Database::fetch_all($r); if ($row==false) { $this->ag_id=0; return; } $this->ag_timestamp=$row[0]['ag_timestamp']; $this->ag_contact=$row[0]['ag_contact']; $this->f_id_dest=$row[0]['f_id_dest']; $this->ag_title=$row[0]['ag_title']; $this->ag_type=$row[0]['ag_type']; $this->ag_ref=$row[0]['ag_ref']; $this->ag_state=$row[0]['ag_state']; $this->d_id=$row[0]['d_id']; $this->ag_dest=$row[0]['ag_dest']; $this->ag_hour=$row[0]['ag_hour']; $this->ag_priority=$row[0]['ag_priority']; $this->ag_remind_date=$row[0]['ag_remind_date']; $this->ag_owner=$row[0]['ag_owner']; $action_detail=new Follow_Up_Detail($this->db); $action_detail->set_parameter('ag_id', $this->ag_id); $this->aAction_detail=$action_detail->load_all(); // if there is no document set 0 to d_id if ($this->d_id=="") $this->d_id=0; // if there is a document fill the object if ($this->d_id!=0) { $this->state=$row['0']['ag_state']; $this->ag_state=$row[0]['ag_state']; } $this->dt_id=$this->ag_type; $aexp=new Fiche($this->db, $this->f_id_dest); $this->qcode_dest=$aexp->strAttribut(ATTR_DEF_QUICKCODE); } /** * \brief Save the document and propose to save the generated document or * to upload one, the data are included except the file. Temporary the generated * document is save. * The files into $_FILES['file_upload'] will be saved * @note the array $_POST['input_desc'] must be set, contains the description * of the uploaded files * * \return */ function save() { // Get The sequence id, $seq_name="seq_doc_type_".$this->dt_id; $str_file=""; $add_file=''; // f_id exp $exp=new Fiche($this->db); $exp->get_by_qcode($this->qcode_dest); $exp->id=($exp->id==0)?null:$exp->id; $contact=new Fiche($this->db); $contact->get_by_qcode($this->ag_contact); if (trim($this->ag_title)=="") { $doc_mod=new document_type($this->db); $doc_mod->dt_id=$this->dt_id; $doc_mod->get(); $this->ag_title=$doc_mod->dt_value; } $this->ag_id=$this->db->get_next_seq('action_gestion_ag_id_seq'); // Create the reference $ag_ref=$this->db->get_value('select dt_prefix from document_type where dt_id=$1', array($this->dt_id)).'-'.$this->db->get_next_seq($seq_name); $this->ag_ref=$ag_ref; // save into the database if ($this->ag_remind_date!=null||$this->ag_remind_date!='') { $sql="insert into action_gestion". "(ag_id,ag_timestamp,ag_type,ag_title,f_id_dest,ag_ref, ag_dest, ". " ag_hour, ag_priority,ag_owner,ag_contact,ag_state,ag_remind_date) ". " values ($1,to_date($2,'DD.MM.YYYY'),$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,to_date($13,'DD.MM.YYYY'))"; } else { $this->ag_remind_date=null; $sql="insert into action_gestion". "(ag_id,ag_timestamp,ag_type,ag_title,f_id_dest,ag_ref, ag_dest, ". " ag_hour, ag_priority,ag_owner,ag_contact,ag_state,ag_remind_date) ". " values ($1,to_date($2,'DD.MM.YYYY'),$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)"; } $this->db->exec_sql($sql, array($this->ag_id, /* 1 */ $this->ag_timestamp, /* 2 */ $this->dt_id, /* 3 */ $this->ag_title, /* 4 */ $exp->id, /* 5 */ $ag_ref, /* 6 */ $this->ag_dest, /* 7 */ $this->ag_hour, /* 8 */ $this->ag_priority, /* 9 */ $_SESSION['g_user'], /* 10 */ $contact->id, /* 11 */ $this->ag_state, /* 12 */ $this->ag_remind_date /* 13 */ ) ); /* insert also the details */ for ($i=0; $i<$_POST['nb_item']; $i++) { $act=new Follow_Up_Detail($this->db); $act->from_array($_POST, $i); if ($act->f_id==0) continue; $act->ag_id=$this->ag_id; $act->save(); } /* Upload the documents */ $doc=new Document($this->db); $doc->Upload($this->ag_id); 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['g_user'], $this->ag_comment)); } $this->insert_operation(); $this->insert_action(); } /** * myList($p_base, $p_filter = "", $p_search = "") * Show list of action by default if sorted on date * @param $p_base base url with ac... * @param $p_filter filters on the document_type * @param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%')) * @return string containing html code */ function myList($p_base, $p_filter="", $p_search="") { // for the sort $url=HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag")).'&'.$p_base; $table=new Sort_Table(); $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd'); $table->add('Date Comm.', $url, 'order by last_comment', 'order by last_comment desc', 'dca', 'dcd'); $table->add('Date Limite', $url, 'order by ag_remind_date asc', 'order by ag_remind_date desc', 'ra', 'rd'); $table->add('Tag', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad'); $table->add('Réf.', $url, 'order by ag_ref asc', 'order by ag_ref desc', 'ra', 'rd'); $table->add('Groupe', $url, "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded'); $table->add('Dest/Exp', $url, 'order by name asc', 'order by name desc', 'ea', 'ed'); $table->add('Titre', $url, 'order by ag_title asc', 'order by ag_title desc', 'ta', 'td'); $ord=(!isset($_GET['ord']))?"dcd":$_GET['ord']; $sort=$table->get_sql_order($ord); if (strlen(trim($p_filter))!=0) $p_filter_doc=" dt_id in ( $p_filter )"; else $p_filter_doc=" 1=1 "; $sql=" select ag_id,to_char(ag_timestamp,'DD.MM.YYYY') as my_date, to_char(ag_remind_date,'DD.MM.YYYY') as my_remind, to_char(coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp),'DD.MM.YY') as str_last_comment, coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp) as last_comment, f_id_dest, s_value, ag_title,dt_value,ag_ref, ag_priority,ag_state, coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest, (select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name, array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags from action_gestion as ag join document_type on (ag_type=dt_id) join document_state on (ag_state=s_id) where $p_filter_doc $p_search $sort"; $max_line=$this->db->count_sql($sql); $step=$_SESSION['g_pagesize']; $page=(isset($_GET['offset']))?$_GET['page']:1; $offset=(isset($_GET['offset']))?Database::escape_string($_GET['offset']):0; if ($step!=-1) $limit=" LIMIT $step OFFSET $offset "; else $limit=''; $bar=navigation_bar($offset, $max_line, $step, $page); $Res=$this->db->exec_sql($sql.$limit); $a_row=Database::fetch_all($Res); $r=""; $r.=''.$bar.'
'; $r.=''.$bar.'
'; return $r; } //---------------------------------------------------------------------- /* * \brief Update the data into the database * * \return true on success otherwise false */ function Update() { // if ag_id == 0 nothing to do if ($this->ag_id==0) return; // retrieve customer // f_id if (trim($this->qcode_dest)=="") { // internal document $this->f_id_dest=null; // internal document } else { $tiers=new Fiche($this->db); if ($tiers->get_by_qcode($this->qcode_dest)==-1) // Error we cannot retrieve this qcode return false; else $this->f_id_dest=$tiers->id; } $contact=new Fiche($this->db); if ($contact->get_by_qcode($this->ag_contact)==-1) $contact->id=0; // reload the old one $old=new Follow_Up($this->db); $old->ag_id=$this->ag_id; $old->get(); // If ag_ref changed then check if unique if ($old->ag_ref!=$this->ag_ref) { $nAg_ref=$this->db->get_value("select count(*) from action_gestion where ag_ref=$1", array($this->ag_ref)); if ($nAg_ref!=0) { echo h2("Référence en double, référence non sauvée", 'class="error"'); $this->ag_ref=$old->ag_ref; } } if ($this->ag_remind_date!=null) { $this->db->exec_sql("update action_gestion set ". " ag_timestamp=to_date($1,'DD.MM.YYYY'),". " ag_title=$2,". " ag_type=$3, ". " f_id_dest=$4, ". "ag_state=$5,". " ag_hour = $7 ,". " ag_priority = $8 ,". " ag_dest = $9 , ". " ag_contact = $10, ". " ag_ref = $11, ". " ag_remind_date=to_date($12,'DD.MM.YYYY') ". " where ag_id = $6", array( $this->ag_timestamp, /* 1 */ $this->ag_title, /* 2 */ $this->dt_id, /* 3 */ $this->f_id_dest, /* 4 */ $this->ag_state, /* 5 */ $this->ag_id, /* 6 */ $this->ag_hour, /* 7 */ $this->ag_priority, /* 8 */ $this->ag_dest, /* 9 */ $contact->id, /* 10 */ $this->ag_ref, /* 11 */ $this->ag_remind_date /* 12 */ )); } else { $this->db->exec_sql("update action_gestion set ". " ag_timestamp=to_date($1,'DD.MM.YYYY'),". " ag_title=$2,". " ag_type=$3, ". " f_id_dest=$4, ". "ag_state=$5,". " ag_hour = $7 ,". " ag_priority = $8 ,". " ag_dest = $9 , ". " ag_contact = $10, ". " ag_ref = $11, ". " ag_remind_date=null ". " where ag_id = $6", array( $this->ag_timestamp, /* 1 */ $this->ag_title, /* 2 */ $this->dt_id, /* 3 */ $this->f_id_dest, /* 4 */ $this->ag_state, /* 5 */ $this->ag_id, /* 6 */ $this->ag_hour, /* 7 */ $this->ag_priority, /* 8 */ $this->ag_dest, /* 9 */ $contact->id, /* 10 */ $this->ag_ref /* 11 */ )); } // Upload documents $doc=new Document($this->db); $doc->Upload($this->ag_id); /* save action details */ for ($i=0; $i<$_POST['nb_item']; $i++) { $act=new Follow_Up_Detail($this->db); $act->from_array($_POST, $i); if ($act->f_id==0&&$act->ad_id!=0) $act->delete(); if ($act->f_id==0) continue; $act->save(); } 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['g_user'], $this->ag_comment)); } $this->insert_operation(); $this->insert_action(); return true; } /** * \brief generate the document and add it to the action * \param md_id is the id of the document_modele * \param $p_array contains normally the $_POST */ function generate_document($md_id, $p_array) { $doc=new Document($this->db); $mod=new Document_Modele($this->db, $md_id); $mod->load(); $doc->f_id=$this->f_id_dest; $doc->md_id=$md_id; $doc->ag_id=$this->ag_id; $doc->Generate($p_array,$this->ag_id); } /** * \brief put an array in the variable member, the indice * is the member name * \param $p_array to parse * - ag_id id of the Follow_up * - ag_ref reference of the action * - qcode_dest quick_code of the card of dest * - f_id_dest f_id of the card of dest * - dt_id Document_Modele::dt_id * - ag_state document_state::s_id (default:2) * - ag_title title of the action * - ag_hour * - ag_dest Profile, profile of the user * - ag_comment comment * - ag_remind_date Remind Date * - operation related operation * - action related action * - op deprecated * \return nothing */ function fromArray($p_array) { global $g_user; $this->ag_id=(isset($p_array['ag_id']))?$p_array['ag_id']:0; $this->ag_ref=(isset($p_array['ag_ref']))?$p_array['ag_ref']:""; $this->qcode_dest=(isset($p_array['qcode_dest']))?$p_array['qcode_dest']:""; $this->f_id_dest=(isset($p_array['f_id_dest']))?$p_array['f_id_dest']:null; $this->ag_timestamp=(isset($p_array['ag_timestamp']))?$p_array['ag_timestamp']:date('d.m.Y'); $this->qcode_dest=(isset($p_array['qcode_dest']))?$p_array['qcode_dest']:""; $this->dt_id=(isset($p_array['dt_id']))?$p_array['dt_id']:""; $this->ag_state=(isset($p_array['ag_state']))?$p_array['ag_state']:2; $this->ag_ref=(isset($p_array['ag_ref']))?$p_array['ag_ref']:""; $this->ag_title=(isset($p_array['ag_title']))?$p_array['ag_title']:""; $this->ag_hour=(isset($p_array['ag_hour']))?$p_array['ag_hour']:""; $this->ag_dest=(isset($p_array['ag_dest']))?$p_array['ag_dest']:$g_user->get_profile(); $this->ag_priority=(isset($p_array['ag_priority']))?$p_array['ag_priority']:2; $this->ag_contact=(isset($p_array['ag_contact']))?$p_array['ag_contact']:""; $this->ag_comment=(isset($p_array['ag_comment']))?$p_array['ag_comment']:""; $this->ag_remind_date=(isset($p_array['ag_remind_date']))?$p_array['ag_remind_date']:null; $this->operation=(isset($p_array['operation']))?$p_array['operation']:null; /** * @todo * deprecated : to remove $this->op = (isset($p_array['op'])) ? $p_array['op'] : null; */ $this->action=(isset($p_array['action']))?$p_array['action']:null; } /** * \brief remove the action * */ function remove() { $this->get(); // remove the key $sql="delete from action_gestion where ag_id=$1"; $this->db->exec_sql($sql, array($this->ag_id)); /* check the number of attached document */ $doc=new Document($this->db); $aDoc=$doc->get_all($this->ag_id); if (!empty($aDoc)) { // if there are documents for ($i=0; $i- -
'; } } function tag_clear() { $this->db->exec_sql('delete from action_tags where ag_id=$1', array($this->ag_id)); } static function action_set_state($cn, $p_array) { global $g_user; $mag_id=$p_array['mag_id']; $state=$p_array['ag_state']; for ($i=0; $i