';
/* 1st possibility is not defined */
if ( ! isset ($_REQUEST['bh_id'])) {
$wHypo=new widget("select","","bh_id");
$wHypo->value=make_array($cn,"select bh_id,bh_name from bud_hypothese",0);
$wHypo->selected=(isset($_REQUEST['bh_id']))?$_REQUEST['bh_id']:"";
$wHypo->javascript='onChange="this.form.submit();"';
echo '
';
echo '
';
exit;
}
$button_other=widget::button_href('Autre detail','?gDossier='.dossier::id().
'&p_action=detail');
/* 2nd Step BH_ID is defined
* if $wPost_Analytic->value is not empty then there is an analytic
* plan, a analytic account must be choosen otherwise go directly to
* the detail
*/
$wPost_Analytic=new widget("select","","po_id");
$wPost_Analytic->value=make_array($cn,"select po_id,po_name from poste_analytique join ".
" bud_hypothese as a using (pa_id) ".
" where a.bh_id=".$_REQUEST['bh_id']);
$po_id=(isset($_REQUEST['po_id']))?$_REQUEST['po_id']:-2;
if ( empty ($wPost_Analytic->value) ) {
$po_id=-1;
}
$Hyp=new Bud_Hypo($cn,$_REQUEST['bh_id']);
$Hyp->load();
if ( ! empty ($wPost_Analytic->value) && $po_id==-2 ) {
$wHypo=new widget("text","","bh_id",$Hyp->bh_name);
$wHypo->readonly=true;
$wPost_Analytic->javascript='onChange="this.form.submit();"';
echo '';
echo $button_other;
echo '
';
exit();
}
/* 3rd Step
* po_id is set now we can add/update/delete details
*/
$wHypo=new widget("text","","bh_id",$Hyp->bh_name);
$wHypo->readonly=true;
echo "Hypothèse ".$wHypo->IOValue();
if ( $po_id !== -1 ) {
$oPo_id=new Anc_Account($cn,$po_id);
$oPo_id->get_by_id();
$wPo_id=new widget("text","","po_id",$oPo_id->name);
$wPo_id->readonly=true;
echo "Poste Analytique ".$wPo_id->IOValue();
}
echo $button_other;
if ( isset ($_GET['po_id'] ) )
$str_po_id="&po_id=".$_REQUEST['po_id'];
else
$str_po_id="";
echo widget::button_href("Recharger","?".dossier::get()."&bh_id=".$_GET['bh_id']."&p_action=detail".$str_po_id);
echo '
';
//----------------------------------------------------------------------
// Show 20 lines by default
//----------------------------------------------------------------------
require_once ('class_bud_data.php');
echo JS_PROTOTYPE;
echo JS_BUD_SCRIPT;
extract($_GET);
$obj=new Bud_Data($cn,$bh_id,$po_id);
$r=$obj->load();
echo $obj->form();