fromArray($_POST); if ($act->ag_id == 0 ) { $act->save(); $ag_id=$act->ag_id; } else { $act->Update(); } $act->generate_document($_POST['doc_mod']); $sub_action='detail'; } /* for delete */ if ( isset($_POST['delete'] )) $sub_action='delete'; if ( $sub_action == "" ) $sub_action="list"; // if correction is asked go to directly to add_action if (isset($_POST['corr'] )) { $ag_comment=urldecode($_POST['ag_comment']); $sub_action="add_action"; } // if this page is called from another menu (customer, supplier,...) // a button back is added //---------------------------------------------------------------------- // Update the detail // Add a new action related to this one or update //---------------------------------------------------------------------- if ( $sub_action=="update" ) { // Update the modification if ( isset($_POST['save'])) { $act2=new Action($cn); $act2->fromArray($_POST ); if ( $act2->Update() == false ) { $sub_action="detail"; } else { $url="?$base&sa=detail&ag_id=".$act2->ag_id.'&'.dossier::get(); echo '

'.hb(_('Action sauvée').' : '.$act2->ag_ref).'

'; ShowActionList($cn,$base); echo '

'.hb(_('Action sauvée').' : '.$act2->ag_ref).'

'; } } //---------------------------------------------------------------------- // Add a related action //---------------------------------------------------------------------- if ( isset ($_POST['add_action_here']) ) { $act=new Action($cn); //---------------------------------------- // puis comme ajout normal (copier / coller ) $act->fromArray($_POST); $act->ag_id=0; $act->d_id=0; $act->ag_ref_ag_id=$_POST['ag_id']; echo '
'; // Add hidden tag echo '
'; echo dossier::hidden(); $act->ag_comment=""; if (isset($_REQUEST['qcode_dest'])) $act->qcode_dest=$_REQUEST['qcode_dest']; echo $act->Display('NEW',false,$base,$retour); echo ''; echo ''; echo ''; echo '

'; echo $supl_hidden; echo '
'; echo '
'; } } //-------------------------------------------------------------------------------- // Show the detail of an action // permit the update if ( $sub_action=='detail' ) { echo '
'; $act=new Action($cn); $act->ag_id=$ag_id; echo $act->get(); $act->ag_comment=Decode($act->ag_comment); echo '
'; echo $supl_hidden; echo HtmlInput::hidden('p_action',$_REQUEST['p_action']); echo dossier::hidden(); echo $act->Display('UPD',false,$base,$retour); echo ''; echo ''; echo HtmlInput::submit("save","Sauve"); echo HtmlInput::submit("add_action_here",_("Ajoute une action à celle-ci")); echo HtmlInput::submit("delete",_("Efface cette action"),' onclick="return confirm(\''._("Vous confirmez l\'effacement").'\')" '); echo '
'; echo '
'; } //------------------------------------------------------------------------------- // Delete an action if ( $sub_action == 'delete' ) { // confirmed $cn->start(); $act=new Action($cn); $act->ag_id=$_REQUEST['ag_id']; $act->get(); $act->remove(); $sub_action="list"; $cn->commit(); ShowActionList($cn,$base); if ( isset( $act->ag_ref) ) echo hb(_('Action ').$act->ag_ref._(' effacée')); exit(); } //-------------------------------------------------------------------------------- // Show a list of the action if ( $sub_action == "list" ) { ShowActionList($cn,$base); } //-------------------------------------------------------------------------------- // Add an action if ( $sub_action == "add_action" ) { $act=new Action($cn); $act->fromArray($_POST ); $act->ag_id=0; $act->d_id=0; echo '
'; // Add hidden tag echo '
'; echo $supl_hidden; echo dossier::hidden(); $act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):""; if (isset($_REQUEST['qcode'])) $act->qcode_dest=$_REQUEST['qcode']; echo $act->Display('NEW',false,$base,$retour); echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; } //-------------------------------------------------------------------------------- // Save Action // Stage 2 : Save the action + Files and generate eventually a document //-------------------------------------------------------------------------------- if ( $sub_action == "save_action_st2" ) { $act=new Action($cn); $act->fromArray($_POST); $act->d_id=0; $act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0; $act->md_id=(isset($_POST['gen_doc']))?$_POST['gen_doc']:0; // insert into action_gestion echo $act->save(); $url="?$base&sa=detail&ag_id=".$act2->ag_id.'&'.dossier::get(); echo '

'.hb('Action Sauvée : '.$act->ag_ref).'

'; ShowActionList($cn,$base); $url="?$base&sa=detail&ag_id=".$act->ag_id.'&'.dossier::get(); echo '

'.hb('Action Sauvée : '.$act->ag_ref).'

'; } //--------------------------------------------------------------------- function ShowActionList($cn,$p_base) { // show the search menu ?>
get_quick_code()); } if( isset($_REQUEST['sb'])) $supl_hidden.=HtmlInput::hidden('sb',$_REQUEST['sb']); $w=new ICard(); $w->name='qcode'; $w->value=$qcode; $w->extra="all"; $w->typecard='all'; $w->jrn=0; $w->table=0; $list=$cn->make_list("select fd_id from fiche_def where frd_id in (4,8,9,14,15,16,25)"); $w->extra=$list; echo _('Fiche').' :'.$w->search().$w->input().'
'; printf (_('Titre ou référence').': ', $a); echo '
'; /* type of documents */ $type_doc=new ISelect ('tdoc'); $aTDoc=$cn->make_array('select dt_id,dt_value from document_type'); $aTDoc[]=array('value'=>'-1','label'=>_('Tous les types')); $type_doc->value=$aTDoc; $type_doc->selected=(isset ($_GET['tdoc']))?$_GET['tdoc']:-1; echo 'Type de document'; echo $type_doc->input(); echo '
'; $see_all=new ICheckBox('see_all'); $my_action=new ICheckBox('all_action'); if ( $_REQUEST ['p_action'] != 'suivi_courrier') { $see_all->selected=true; $my_action->selected= true; } else { $see_all->selected=(isset($_REQUEST ['see_all']))?true:false; $my_action->selected= (isset($_REQUEST ['all_action']))?true:false; } echo _('les actions fermées aussi:').$see_all->input().'
'; echo _('affecté à d\'autre:').$my_action->input().'
'; ?>
">
get_by_qcode($_REQUEST['qcode']); // if quick code not found then nothing if ( $fiche->id == 0 ) $str=' and false '; else $str=" and (f_id_dest= ".$fiche->id." ) "; } } if (isset($_GET['tdoc']) && $_GET['tdoc'] != -1 ) { $query .= ' and dt_id = '.Formatstring($_GET['tdoc']); } if ( ! $see_all->selected ) $query .= ' and ag_state in (2,3) '; if ( ! $my_action->selected ) $query .= " and (ag_owner='".$_SESSION['g_user']."' or ag_dest='".$_SESSION['g_user']."')"; $r=$act->myList($p_base,"",$query.$str); echo $r; }