Titre ou référence: ', $a); $qcode=(isset($_GET['qcode']))?$_GET['qcode']:""; echo JS_SEARCH_CARD; $w=new widget('js_search_only'); $w->name='qcode'; $w->value=$qcode; $w->label='Quick Code'; $w->extra='4,9,14,16,8'; $w->table=0; $sp= new widget("span"); echo $sp->IOValue("qcode_label","",$qcode); echo $w->IOValue(); ?>
>
GetByQCode($_REQUEST['qcode']); $str=" and f_id= ".$fiche->id; } } $r=$act->myList(ACTION,$query.$str); echo $r; } // We need a sub action (3rd level) // show a list of already taken action // propose to add one // permit also a search // show detail $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:""; if ( $sub_action == "" ) $sub_action="list"; // if correction is asked go to directly to add_action if (isset($_POST['corr'] )) { $ag_comment=rawurldecode($_POST['ag_comment']); $sub_action="add_action"; } // if this page is called from another menu (customer, supplier,...) // a button back is added // TODO add function for generating url, hidden tags... $retour=''; $h_url=""; if ( isset ($_REQUEST['url'])) { $retour=sprintf('',urldecode($_REQUEST['url'])); $h_url=sprintf('',urldecode($_REQUEST['url'])); } //---------------------------------------------------------------------- // Update the detail if ( $sub_action=="update" ) { $act=new action($cn); $act->ag_id=$_POST['ag_id']; $act->ag_comment=$_POST['ag_comment']; $act->ag_timestamp=$_POST['ag_timestamp']; $act->d_state=$_POST['d_state']; $act->dt_id=(isset($_POST['dt_id']))?$_POST['dt_id']:0; $act->qcode=$_POST['qcode']; $act->ag_title=$_POST['ag_title']; $act->d_id=(isset($_POST['d_id']))?$_POST['d_id']:0; if ( $act->Update() == false ) { $sub_action="detail"; } else { ShowActionList($cn,$retour,$h_url); } } //-------------------------------------------------------------------------------- // Show the detail of an action // permit the update if ( $sub_action=='detail' ) { $act=new action($cn); $act->ag_id=$_REQUEST['ag_id']; echo $act->get(); $act->ag_comment=Decode($act->ag_comment); echo '
'; echo JS_SEARCH_CARD; echo $act->display('UPD',false); echo ''; echo ''; $upload=new widget("file"); $upload->name="file_upload"; $upload->value=""; echo "Enregistrer le fichier ".$upload->IOValue(); echo $upload->Submit("save","Sauve"); echo '
'; echo $retour; } //-------------------------------------------------------------------------------- // Show a list of the action if ( $sub_action == "list" ) ShowActionList($cn,$retour,$h_url); //-------------------------------------------------------------------------------- // Add an action if ( $sub_action == "add_action" ) { echo $retour; $act=new action($cn); $act->ag_id=0; $act->ag_timestamp=(isset($_POST['ag_timestamp']))?$_POST['ag_timestamp']:""; $act->qcode=isset($_POST['tiers'])?$_REQUEST['tiers']:""; $act->d_id=0; $act->dt_id=isset($_POST['dt_id'])?$_REQUEST['dt_id']:""; $act->d_state=(isset($_POST['d_state']))?$_POST['d_state']:""; $act->ag_ref=""; $act->ag_title=(isset($_POST['ag_title']))?$_POST['ag_title']:""; echo '
'; echo JS_SEARCH_CARD; // Add hidden tag echo '
'; $act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):""; echo $act->Display('NEW',false); echo ''; echo ''; echo $h_url; echo '

'. '
'. '
'; } //-------------------------------------------------------------------------------- // Save Action // Stage 1 : show the result and confirm //-------------------------------------------------------------------------------- if ( $sub_action == "save_action_st1" ) { $act=new action($cn); $act->ag_timestamp=$_POST['ag_timestamp']; $act->ag_comment=$_POST['ag_comment']; $act->ag_timestamp=$_POST['ag_timestamp']; $act->d_state=$_POST['d_state']; $act->dt_id=$_POST['dt_id']; $act->qcode=$_POST['qcode']; $act->ag_title=$_POST['ag_title']; $act->d_id=0; $act->ag_id=$_POST['ag_id']; echo $act->Confirm(); } //-------------------------------------------------------------------------------- // Save Action // Stage 2 : Save the action and propose to save a file //-------------------------------------------------------------------------------- if ( $sub_action == "save_action_st2" ) { $act=new action($cn); $act->ag_comment=$_POST['ag_comment']; $act->ag_timestamp=$_POST['ag_timestamp']; $act->d_state=$_POST['d_state']; $act->dt_id=$_POST['dt_id']; $act->qcode=$_POST['tiers']; $act->ag_title=$_POST['ag_title']; $act->d_id=0; $act->md_id=(isset($_POST['gen_doc']))?$_POST['gen_doc']:0; $act->gen=isset($_POST['p_gen'])?'on':'off'; // insert into action_gestion echo $act->SaveStage2(); echo ''; } //-------------------------------------------------------------------------------- // Save Document // Stage 3 : Save the document //-------------------------------------------------------------------------------- if ( $sub_action == "save_action_st3" ) { echo_debug("action.inc.php",__LINE__,'Stage 3'); $act=new action($cn); $act->ag_id=$_POST['ag_id']; $act->ag_comment=$_POST['ag_comment']; $act->ag_timestamp=$_POST['ag_timestamp']; $act->d_state=$_POST['d_state']; $act->dt_id=$_POST['dt_id']; $act->qcode=$_POST['qcode']; $act->ag_title=$_POST['ag_title']; $d_id=(isset($_POST['d_id']))?$_POST['d_id']:0; echo $act->SaveStage3($d_id); ShowActionList($cn,$retour,$h_url); } //---------------------------------------------------------------------