/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* $Revision$ */
include_once("preference.php");
include_once("fiche_inc.php");
include_once("user_common.php");
/* function InputType
* Purpose : Create the tag
*
* parm :
* - Label question
* - The type (text, select, text_big
* - Name of the variable
* - Default Value
* - View_only
* - $p_list for the select, give the possible values item[0] is the val and item[1]
* is the label or for the js_search p_list is a string (cred
* or deb or the fiche_def_type
* gen :
* - None
* return: string
*/
function InputType($p_label,$p_type,$p_name,$p_value,$p_viewonly=false,$p_list=null)
{
// View only
if ( $p_viewonly==true) {
if ( strlen($p_label) != 0) {
// name and value are set put the info in a hidden field
$hidden=(strlen($p_name) != 0) ?"":"";
// return
return "
$p_label $hidden
$p_value
";
} else {
// name and value are set put the info in a hidden field
$hidden=(strlen($p_name) != 0) ?"":"";
return "
$p_value $hidden
";
}
}
// Input type == select
if ( strtolower($p_type)=="select" ) {
$r="
$p_label
";
$r.=sprintf('
";
return $r;
}
// Input type == select2
if ( strtolower($p_type)=="select2" ) {
$r="
$p_label
";
$r.=sprintf('
";
return $r;
}
// input type == TEXT
if ( strtolower($p_type)=="text") {
if ( strlen(trim($p_label)) != 0 )
$label="
$p_label
";
else
$label="";
$r=sprintf('%s
',
$label,
$p_type,
$p_name,
$p_value);
return $r;
}
// input type == TEXT_BIG
if ( strtolower($p_type)=="text_big") {
$r=sprintf('
",
$l_sessid,$p_name);
return $r;
}
return $r;
}
/* function FormODS($p_cn,$p_jrn,$p_user,$p_array=null,$pview_only=true,$p_article=1)
* Purpose : Display the miscellaneous operation
* Used to show detail, encode a new oper
* or update one
*
* parm :
* - p_array which can be empty
* - the "journal"
* - $p_user = $g_user
* - $p_submit contains the submit string
* - view_only if we cannot change it (no right or centralized op)
* - $p_article number of article
* gen :
* -
* return: string with the form
*/
function FormODS($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=true,$p_article=6,$p_saved=false)
{
include_once("poste.php");
if ( $p_array != null ) {
// array contains old value
foreach ( $p_array as $a=>$v) {
${"$a"}=$v;
}
}
// The date
list ($l_date_start,$l_date_end)=GetPeriode($p_cn,$p_periode);
$flag=(isset($e_date))?1:0;
$e_date=( ! isset($e_date) ) ? substr($l_date_start,2,8):$e_date;
// Verify if valid date
if ( $flag==1 and VerifyOperationDate($p_cn,$p_periode,$e_date) == null) {
if ( $pview_only == true)
return null;
else
$e_date=substr($l_date_start,2,8);
}
$e_ech=(isset($e_ech))?$e_ech:"";
$e_comment=(isset($e_comment))?$e_comment:"";
// Save old value and set a new one
$r="";
if ( $pview_only == false) {
$r.=JS_SEARCH_POSTE;
}
$r.="