noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
ajax_add_concerned_card.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright 2014 Author Dany De Bontridder danydb@aevalys.eu
00022 // require_once '.php';
00023 if (!defined('ALLOWED'))
00024     die('Appel direct ne sont pas permis');
00025 ob_start();
00026 
00027 $ag_id=HtmlInput::default_value_get("ag_id", "0");
00028 
00029 if ($ag_id == 0 )    throw new Exception('ag_id is null');
00030 
00031 require_once('class_acc_ledger.php');
00032 $r=HtmlInput::title_box(_("Détail fiche"), 'search_card');
00033 
00034 $r.='<form id="search_card1_frm" method="GET" onsubmit="action_add_concerned_card(this);return false;">';
00035 $q=new IText('query');
00036 $q->value=(isset($query))?$query:'';
00037 $r.='<span style="margin-left:50px">';
00038 $r.=_('Fiche contenant').HtmlInput::infobulle(19);
00039 $r.=$q->input();
00040 $r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton");
00041 $r.='</span>';
00042 $r.=dossier::hidden().HtmlInput::hidden('op', 'add_concerned_card');
00043 $r.=HtmlInput::request_to_hidden(array('ag_id'));
00044 $r.='</form>';
00045 $query=HtmlInput::default_value_get("query", "");
00046 $sql_array['query']=$query;
00047 $sql_array['typecard']='all';
00048 
00049 $fiche=new Fiche($cn);
00050 /* Build the SQL and show result */
00051 $sql=$fiche->build_sql($sql_array);
00052 
00053 
00054 /* We limit the search to MAX_SEARCH_CARD records */
00055 $sql=$sql.' order by vw_name limit '.MAX_SEARCH_CARD;
00056 $a=$cn->get_array($sql);
00057 for ($i=0; $i<count($a); $i++)
00058 {
00059     $array[$i]['quick_code']=$a[$i]['quick_code'];
00060     $array[$i]['name']=h($a[$i]['vw_name']);
00061     $array[$i]['accounting']=$a[$i]['accounting'];
00062     $array[$i]['first_name']=h($a[$i]['vw_first_name']);
00063     $array[$i]['description']=h($a[$i]['vw_description']);
00064     $array[$i]['javascript']=sprintf("action_save_concerned(%d,'%s','%s')",$gDossier,$a[$i]['f_id'],$ag_id);
00065 }//foreach
00066 
00067 
00068 echo $r;
00069 require_once('template/card_result.php');
00070 $response=ob_get_contents();
00071 ob_end_clean();
00072 
00073 
00074 $html=escape_xml($response);
00075 if ( !headers_sent() ) { header('Content-type: text/xml; charset=UTF-8');} else {echo $response;echo $html;}
00076 echo <<<EOF
00077 <?xml version="1.0" encoding="UTF-8"?>
00078 <data>
00079 <ctl>unused</ctl>
00080 <code>$html</code>
00081 </data>
00082 EOF;
00083 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations