altocompta/include/ac_common.php
Dany De Bontridder 8834d14ee5 Merged revisions 2258,2260-2262,2264-2268,2270-2283,2285-2297,2299-2322,2324-2340 via svnmerge from
svn+ssh://danydb@svn/svn/phpcompta/branches/rel430

........
  r2258 | danydb | 2008-12-18 23:21:00 +0100 (Thu, 18 Dec 2008) | 1 line
  
  Add debug
........
  r2262 | danydb | 2008-12-19 22:38:25 +0100 (Fri, 19 Dec 2008) | 1 line
  
  Add a local admin 
........
  r2270 | danydb | 2008-12-21 20:11:26 +0100 (Sun, 21 Dec 2008) | 1 line
  
  Doc. remove the useless todo list
........
  r2271 | danydb | 2008-12-22 21:18:46 +0100 (Mon, 22 Dec 2008) | 3 lines
  
  Remove obsolete functions insertRapt, deleteRapt and getconcerned
  Remove obsolete file user_update
........
  r2272 | danydb | 2008-12-22 21:21:46 +0100 (Mon, 22 Dec 2008) | 2 lines
  
  Remove obsolete function isFicheOfJrn
........
  r2273 | danydb | 2008-12-22 21:44:28 +0100 (Mon, 22 Dec 2008) | 1 line
  
  Improve Invoice : add the username 
........
  r2287 | danydb | 2009-01-13 21:37:07 +0100 (Tue, 13 Jan 2009) | 1 line
  
  Code cleaning replace GetConcerned by Acc_Reconciliation
........
  r2288 | danydb | 2009-01-13 21:38:40 +0100 (Tue, 13 Jan 2009) | 1 line
  
  Add a comment on jrn operation
........
  r2289 | danydb | 2009-01-13 21:40:13 +0100 (Tue, 13 Jan 2009) | 1 line
  
  Code cleaning : add comments to the code
........
  r2290 | danydb | 2009-01-13 21:40:46 +0100 (Tue, 13 Jan 2009) | 1 line
  
  Code cleaning replace GetConcerned by Acc_Reconciliation
........
  r2291 | danydb | 2009-01-13 21:41:35 +0100 (Tue, 13 Jan 2009) | 1 line
  
  Code cleaning replace GetConcerned by Acc_Reconciliation
........
  r2292 | danydb | 2009-01-13 21:42:15 +0100 (Tue, 13 Jan 2009) | 1 line
  
  Add documentation about new tags
........
  r2293 | danydb | 2009-01-13 21:43:22 +0100 (Tue, 13 Jan 2009) | 1 line
  
  Code cleaning start rewriting of the security part 
........
  r2294 | danydb | 2009-01-14 20:09:18 +0100 (Wed, 14 Jan 2009) | 1 line
  
  Improve : template of security + security code
........
  r2295 | danydb | 2009-01-14 20:21:51 +0100 (Wed, 14 Jan 2009) | 1 line
  
  Improve security : add new variable
........
  r2296 | danydb | 2009-01-14 20:39:58 +0100 (Wed, 14 Jan 2009) | 1 line
  
  Improve security : modify layout
........
  r2297 | danydb | 2009-01-15 19:21:47 +0100 (Thu, 15 Jan 2009) | 1 line
  
  Improve security : user setting
........
  r2299 | danydb | 2009-01-15 19:28:56 +0100 (Thu, 15 Jan 2009) | 2 lines
  
  Clean code : can_request doens't have a connx parameter
........
  r2300 | danydb | 2009-01-16 19:12:47 +0100 (Fri, 16 Jan 2009) | 1 line
  
  Improve Ecriture directe libelle : new widget js_search_card_control
........
  r2301 | danydb | 2009-01-16 22:29:39 +0100 (Fri, 16 Jan 2009) | 1 line
  
  Improve Quick Writing : remove span, and update the comment field
........
  r2302 | danydb | 2009-01-16 23:01:24 +0100 (Fri, 16 Jan 2009) | 1 line
  
  Improve cosmetic : GL + remove the select topmenu
........
  r2303 | danydb | 2009-01-19 08:41:09 +0100 (Mon, 19 Jan 2009) | 1 line
  
  Cosmetic : a inline
........
  r2304 | danydb | 2009-01-20 23:03:59 +0100 (Tue, 20 Jan 2009) | 6 lines
  
  Code Cleaning
  Security : remove obsolete files & function
  Class_user : add new functions for the security
  Only the menu in text mode with a break line
........
  r2305 | danydb | 2009-01-20 23:05:01 +0100 (Tue, 20 Jan 2009) | 1 line
  
  code cleaning rewriting of Security 
........
  r2306 | danydb | 2009-01-21 21:13:15 +0100 (Wed, 21 Jan 2009) | 1 line
  
  Security printing unicode and fix some bugs
........
  r2309 | danydb | 2009-01-26 19:56:28 +0100 (Mon, 26 Jan 2009) | 1 line
  
  ADD : company without VAT
........
  r2310 | danydb | 2009-01-26 23:33:14 +0100 (Mon, 26 Jan 2009) | 1 line
  
  Add : no vat for Purchase ledger 
........
  r2312 | danydb | 2009-01-28 19:57:30 +0100 (Wed, 28 Jan 2009) | 1 line
  
  Integration 
........
  r2313 | danydb | 2009-01-28 22:46:27 +0100 (Wed, 28 Jan 2009) | 1 line
  
  Work with or without VAT
........
  r2314 | danydb | 2009-01-29 22:18:57 +0100 (Thu, 29 Jan 2009) | 2 lines
  
  Remove debug info
........
  r2315 | danydb | 2009-01-29 23:23:14 +0100 (Thu, 29 Jan 2009) | 1 line
  
  ADD the possibility to enter a piece number
........
  r2316 | danydb | 2009-01-31 23:20:00 +0100 (Sat, 31 Jan 2009) | 1 line
  
  Documentation
........
  r2317 | danydb | 2009-02-04 20:14:54 +0100 (Wed, 04 Feb 2009) | 1 line
  
  Template for ledger
........
  r2318 | danydb | 2009-02-05 15:52:58 +0100 (Thu, 05 Feb 2009) | 1 line
  
  Add PJ setting + default in Ledger, fix bug in listJrn
........
  r2319 | danydb | 2009-02-05 17:09:56 +0100 (Thu, 05 Feb 2009) | 2 lines
  
  Search by PJ
........
  r2320 | danydb | 2009-02-05 17:23:24 +0100 (Thu, 05 Feb 2009) | 1 line
  
  Finished with pj
........
  r2321 | danydb | 2009-02-05 18:11:35 +0100 (Thu, 05 Feb 2009) | 1 line
  
  PJ is readonly
........
  r2322 | danydb | 2009-02-05 20:10:34 +0100 (Thu, 05 Feb 2009) | 1 line
  
  Saldo : write the first saldo (ajax)
........
  r2324 | danydb | 2009-02-06 00:07:50 +0100 (Fri, 06 Feb 2009) | 5 lines
  
  Add database script
  Cosmetic (menu)
  Fix Bug 
........
  r2325 | danydb | 2009-02-06 14:07:07 +0100 (Fri, 06 Feb 2009) | 1 line
  
  Improve Pj seq 
........
  r2326 | danydb | 2009-02-09 22:47:23 +0100 (Mon, 09 Feb 2009) | 6 lines
  
  Fix Bug privilege (compta_ven)
  Fix if the pj is empty do not increment the sequence (class_acc_operation)
  Fix remove PJ if pj is empty (modify_op.php)
  Cosmetic do not print PJ if pj is null or empty (listing)
........
  r2327 | danydb | 2009-02-10 21:04:48 +0100 (Tue, 10 Feb 2009) | 5 lines
  
  Fix bug in PJ seq
  Fix bug in export jrn csv
  Improve avoid the removal of vat rate
  Add security for card
........
  r2328 | danydb | 2009-02-12 20:26:36 +0100 (Thu, 12 Feb 2009) | 4 lines
  
  Cosmetic menu_tool
  Impression add tag PJ
  Cosmetic menu administration
........
  r2329 | danydb | 2009-02-12 21:43:19 +0100 (Thu, 12 Feb 2009) | 5 lines
  
  filter the folder the local admin can access
  add a function check_dossier which must be implemented everywhere
  Printing with PJ
  NoAccess default = javascript
........
  r2330 | danydb | 2009-02-14 18:11:49 +0100 (Sat, 14 Feb 2009) | 2 lines
  
  improve add libelle for balance csv
........
  r2331 | danydb | 2009-02-14 19:10:56 +0100 (Sat, 14 Feb 2009) | 7 lines
  
  Balance csv add label
  Bug Financial ledger list
  BUG period access 
  BUG stock access
  IMPROVE list ledger with PJ
........
  r2332 | danydb | 2009-02-15 18:21:59 +0100 (Sun, 15 Feb 2009) | 1 line
  
  Bug order was not saved for report
........
  r2333 | danydb | 2009-02-15 18:22:17 +0100 (Sun, 15 Feb 2009) | 1 line
  
  Add security for normal user
........
  r2334 | danydb | 2009-02-15 18:23:24 +0100 (Sun, 15 Feb 2009) | 3 lines
  
  Bug forget to import class
........
  r2335 | danydb | 2009-02-17 21:33:17 +0100 (Tue, 17 Feb 2009) | 5 lines
  
  Fix quick writing let write
  Fix card priv
  Remove button if no priv to add card or cancel an op
........
  r2336 | danydb | 2009-02-19 21:01:36 +0100 (Thu, 19 Feb 2009) | 4 lines
  
  Check for CA
  common Bug with the repository
........
  r2337 | danydb | 2009-02-19 21:50:35 +0100 (Thu, 19 Feb 2009) | 2 lines
  
  Test the parameter security part
........
2009-02-19 21:11:08 +00:00

539 lines
14 KiB
PHP

<?php
/*
* 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
/*! \file
* \brief common utilities for a lot of procedure, classe
*/
include_once("debug.php");
include_once("constant.php");
require_once('preference.php');
require_once ("postgres.php");
/*!\brief to protect again bad characters which can lead to a cross scripting attack
the string to be diplayed must be protected
*/
function h($p_string) { return htmlspecialchars($p_string);}
function hi($p_string) { return '<i>'.htmlspecialchars($p_string).'</i>';}
function hb($p_string) { return '<b>'.htmlspecialchars($p_string).'</b>';}
/*!
* \brief log error into the /tmp/phpcompta_error.log it doesn't work on windows
*
* \param p_log message
* \param p_line line number
* \param p_message is the message
*
* \return nothing
*
*/
function echo_error ($p_log, $p_line="", $p_message="") {
$fdebug=fopen($_ENV['TMP'].DIRECTORY_SEPARATOR."phpcompta_error.log","a+");
if ( $fdebug == false) {
echo "ERREUR :".$p_log." ".$p_line." ".$p_message;
} else {
fwrite($fdebug,date("Ymd H:i:s").$p_log." ".$p_line." ".$p_message."\n");
fclose($fdebug);
echo_debug($p_log,$p_line,$p_message);
}
}
/*!
* \brief Compare 2 dates
* \param p_date
* \param p_date_oth
*
* \return
* - == 0 les dates sont identiques
* - > 0 date1 > date2
* - < 0 date1 < date2
*/
function cmpDate ($p_date,$p_date_oth) {
date_default_timezone_set ('Europe/Brussels');
$l_date=isDate($p_date);
$l2_date=isDate($p_date_oth);
if ($l_date == null || $l2_date == null ) {
echo "erreur date";
return null;
}
$l_adate=explode(".",$l_date);
$l2_adate=explode(".",$l2_date);
$l_mkdate=mktime(0,0,0,$l_adate[1],$l_adate[0],$l_adate[2]);
$l2_mkdate=mktime(0,0,0,$l2_adate[1],$l2_adate[0],$l2_adate[2]);
// si $p_date > $p_date_oth return > 0
return $l_mkdate-$l2_mkdate;
}
/*!
* \brief check if the argument is a number
*
* \param $p_int number to test
*
* \return
* - 1 it's a number
* - 0 it is not
*/
function isNumber(&$p_int) {
if ( strlen (trim($p_int)) == 0 ) return 0;
if ( is_numeric($p_int) === true)
return 1;
else
return 0;
}
/*!
* \brief Verifie qu'une date est bien formaté
* en d.m.y et est valable
* \param $p_date
*
* \return
* - null si la date est invalide ou malformaté
* - $p_date si tout est bon
*
*/
function isDate ( $p_date) {
if ( strlen (trim($p_date)) == 0 ) return null;
if (! ereg ("^[0-9]{1,2}\.[0-9]{1,2}\.20[0-9]{2}",$p_date) ) {
return null;
} else {
$l_date=explode(".",$p_date);
if ( sizeof ($l_date) != 3 )
return null;
if ( $l_date[2] > 2020 ) {
return null;
}
echo_debug('ac_common.php',__LINE__,' date = '.var_export($l_date,true));
if ( checkdate ($l_date[1],$l_date[0],$l_date[2]) == false) {
return null;
}
}// !ereg
return $p_date;
}
/*!
* \brief call cmpDate & add quotes
*
* \return the date or the quoted string null
*/
function formatDate($p_date) {
if ( isDate($p_date)== null) return "null";
return "'".$p_date."'";
}
/*!
* \brief Default page header for each page
*
* \param p_theme default theme
* \param $p_script
* \param $p_script2 another js script
*
* \return none
*/
function html_page_start($p_theme="",$p_script="",$p_script2="")
{
$cn=DbConnect();
if ( $p_theme != "") {
$Res=ExecSql($cn,"select the_filestyle from theme
where the_name='".$p_theme."'");
if (pg_NumRows($Res)==0)
$style="style.css";
else {
$s=pg_fetch_array($Res,0);
$style=$s['the_filestyle'];
}
}else {
$style="style.css";
} // end if
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN">';
echo "<HTML>";
if ( $p_script2 != "" )
$p_script2='<script src="'.$p_script2.'" type="text/javascript"></script>';
echo "<HEAD>
<TITLE>PhpCompta</TITLE>
<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF8\">
<LINK REL=\"stylesheet\" type=\"text/css\" href=\"$style\" media=\"screen\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"style-print.css\" media=\"print\">".
$p_script2. "
<script src=\"js/scripts.js\" type=\"text/javascript\"></script>";
echo '<script language="javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>
<script language="javascript" src="js/calendar-setup.js"></script>
<LINK REL="stylesheet" type="text/css" href="calendar-blue.css" media="screen">
</HEAD>
';
echo "<BODY $p_script>";
/* If we are on the user_login page */
if ( basename($_SERVER['PHP_SELF']) == 'user_login.php') {
return;
}
}
/*!
* \brief Minimal page header for each page, used for small popup window
*
* \param p_theme default theme
* \param $p_script
* \param $p_script2 another js script
*
* \return none
*/
function html_min_page_start($p_theme="",$p_script="",$p_script2="")
{
$cn=DbConnect();
if ( $p_theme != "") {
$Res=ExecSql($cn,"select the_filestyle from theme
where the_name='".$p_theme."'");
if (pg_NumRows($Res)==0)
$style="style.css";
else {
$s=pg_fetch_array($Res,0);
$style=$s['the_filestyle'];
}
}else {
$style="style.css";
} // end if
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN">';
echo "<HTML>";
if ( $p_script2 != "" )
$p_script2='<script src="'.$p_script2.'" type="text/javascript"></script>';
echo "<HEAD>
<TITLE>PhpCompta</TITLE>
<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF8\">
<LINK REL=\"stylesheet\" type=\"text/css\" href=\"$style\" media=\"screen\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"style-print.css\" media=\"print\">".
$p_script2. "
<script src=\"js/scripts.js\" type=\"text/javascript\"></script>";
echo '</HEAD>
';
echo "<BODY $p_script>";
/* If we are on the user_login page */
if ( basename($_SERVER['PHP_SELF']) == 'user_login.php') {
return;
}
}
/*!
* \brief end tag
*
*/
function html_page_stop()
{
echo "</BODY>";
echo "</HTML>";
}
/*!
* \brief Button logout
*
* \return nothing
*/
function html_button_logout() {
echo "<A class=\"mtitle\" HREF=logout.php> Logout </A>";
}
/*!
* \brief Echo no access and stop
*
* \return nothing
*/
function NoAccess($js=1)
{
if ( $js == 1 )
{
echo "<script>";
echo "alert ('Cette action ne vous est pas autorisée Contactez votre responsable');";
echo "</script>";
}
else
{
echo '<div class="u_redcontent">';
echo '<h2 class="error"> Cette action ne vous est pas autorisée Contactez votre responsable</h2>';
echo '</div>';
}
exit -1;
}
/*!
* \brief Fix the problem with the quote char for the database
*
* \param $p_string
* \return a string which won't let strange char for the database
*/
function FormatString($p_string)
{
if ( !isset ($p_string) ) {
echo_error("ac_common.php FormatString p_string empty");
return null;
}
$p_string=trim($p_string);
if (strlen($p_string) == 0 ) return null;
$p_string=str_replace("\'","'",$p_string);
$p_string=str_replace("''","'",$p_string);
$p_string=str_replace("'","\'",$p_string);
return $p_string;
}
/*!
/* \brief store the string which print
* the content of p_array in a table
* used to display the menu
* \param $p_array array like ( HREF reference, visible item (name),Help(opt),
* selected (opt)
* \param $p_dir direction of the menu (H Horizontal V vertical)
* \param $class CSS for TD tag
* \param $class_ref CSS for the A tag
* \param $default selected item
* \param $p_extra extra code for the table tag (CSS or javascript)
/* \return : string */
function ShowItem($p_array,$p_dir='V',$class="mtitle",$class_ref="mtitle",$default="",$p_extra="")
{
$ret="<TABLE $p_extra>";
// direction Vertical
if ( $p_dir == 'V') {
foreach ($p_array as $all=>$href){
$title="";
$set="XX";
if ( isset ($href[2] ))
$title=$href[2];
if ( isset($href[3] ))
$set=$href[3];
if ( $set == $default )
$ret.='<tr><TD CLASS="selectedcell">'.$href[1].'</TD></tr>';
else
$ret.='<TR><TD CLASS="'.$class.'"><A class="'.$class_ref.'" HREF="'.$href[0].'" title="'.$title.'">'.$href[1].'</A></TD></TR>';
}
}
//direction Horizontal
else if ( $p_dir == 'H' ) {
$ret.="<TR>";
foreach ($p_array as $all=>$href){
$title="";
$set="A";
if ( isset ($href[2] ))
$title=$href[2];
if ( isset($href[3]))
$set=$href[3];
if ( $default=== $href[0]||$set===$default ) {
$ret.='<TD CLASS="selectedcell">'.$href[1].'</TD>';
} else {
$ret.='<TD CLASS="'.$class.'"><A class="'.$class_ref.'" HREF="'.$href[0].'" title="'.$title.'">'.$href[1].'</A></TD>';
}
}
$ret.="</TR>";
}
$ret.="</TABLE>";
return $ret;
}
/*!
* \brief warns
*
* \param p_string error message
* gen :
* - none
* \return:
* - none
*/
function echo_warning($p_string)
{
echo '<H2 class="info">'.$p_string."</H2>";
}
/*!
**************************************************
* \brief make a array with the sql
*
* \param $p_cn dbatabase connection
* \param $p_sql related sql
* \param $p_null if the array start with a null value
*
* \return: a double array [value,label]
*/
function make_array($p_cn,$p_sql,$p_null=0) {
echo_debug('ac_common',__LINE__,$p_sql);
$a=ExecSql($p_cn,$p_sql);
$max=pg_NumRows($a);
if ( $max==0) return null;
for ($i=0;$i<$max;$i++) {
$row=pg_fetch_row($a);
$r[$i]['value']=$row[0];
$r[$i]['label']=$row[1];
}
// add a blank item ?
if ( $p_null == 1 ) {
for ($i=$max;$i!=0;$i--) {
$r[$i]['value']= $r[$i-1]['value'];
$r[$i]['label']= $r[$i-1]['label'];
}
$r[0]['value']=-1;
$r[0]['label']=" ";
} // if ( $p_null == 1 )
return $r;
}
/*!
**************************************************
* \brief Show the periode which found thanks its id
*
*
* \param $p_cn database connection
* \param p_id
* \param pos Start or end
*
* \return: string
*/
function getPeriodeName($p_cn,$p_id,$pos='p_start') {
if ( $pos != 'p_start' and
$pos != 'p_end')
echo_error('ac_common.php'."-".__LINE__.' UNDEFINED PERIODE');
$ret=execSql($p_cn,"select to_char($pos,'Mon YYYY') as t from parm_periode where p_id=$p_id");
if (pg_NumRows($ret) == 0) return null;
$a=pg_fetch_array($ret,0);
return $a['t'];
}
/*!
**************************************************
* \brief Return the period corresponding to the
* date
*
* \param p_cn database connection
* \param p_date the month + year 'MM.YYYY'
*
* \return:
* parm_periode.p_id
*/
function getPeriodeFromMonth($p_cn,$p_date) {
$R=ExecSql($p_cn,"select p_id from parm_periode where
to_char(p_start,'DD.MM.YYYY') = '01.$p_date'");
if ( pg_NumRows($R) == 0 )
return -1;
$a=pg_fetch_array($R,0);
return $a['p_id'];
}
/*!
**************************************************
* \brief Return the period corresponding to the
* date
*
*
* \param p_cn database connection
* \param p_date the date 'DD.MM.YYYY'
* \return parm_periode.p_id
*
*/
function getPeriodeFromDate($p_cn,$p_date) {
$R=ExecSql($p_cn,"select p_id from parm_periode where
p_start <= to_date('$p_date','DD.MM.YYYY')
and p_end >= to_date('$p_date','DD.MM.YYYY')
");
if ( pg_NumRows($R) == 0 )
return -1;
$a=pg_fetch_array($R,0);
return $a['p_id'];
}
/*!\brief Decode the html for the widegt richtext and remove newline
*\param $p_html string to decode
* \return the html code without new line
*/
function Decode($p_html){
$p_html=str_replace('%0D','',$p_html);
$p_html=str_replace('%0A','',$p_html);
$p_html=urldecode($p_html);
return $p_html;
}
/*!\brief Create the condition to filter on the j_tech_per
* thanks a from and to date.
* \param $p_cn database conx
* \param $p_from start date (date)
* \param $p_to end date (date)
* \param $p_form if the p_from and p_to are date or p_id
* \param $p_field column name
* \return a string containg the query
*/
function sql_filter_per($p_cn,$p_from,$p_to,$p_form='p_id',$p_field='jr_tech_per')
{
if ( $p_form != 'p_id' &&
$p_form != 'date' )
{
echo_error (__FILE__,__LINE__,'Mauvais parametres ');
exit(-1);
}
if ( $p_form == 'p_id' )
{
// retrieve the date
$a_start=get_periode($p_cn,$p_from);
$a_end=get_periode($p_cn,$p_to);
if ( $a_start == null or $a_end == null )
{
echo_debug(__FILE__,__LINE__,'Attention periode '.
' non trouvee periode p_from='.$p_from.
'p_to_periode = '.$p_to);
}
$p_from=($a_start==null)?'01.01.1900':$a_start['p_start'];
$p_to=($a_end==null)?'01.01.2100':$a_end['p_end'];
}
if ( $p_from == $p_to )
$periode=" $p_field = to_date('$p_from','DD.MM.YYYY') ";
else
$periode = "$p_field in (select p_id from parm_periode ".
" where p_start >= to_date('$p_from','DD.MM.YYYY') and p_end <= to_date('$p_to','DD.MM.YYYY')) ";
return $periode;
}
/*!\brief alert in javascript
*\param $p_msg is the message
*/
function alert($p_msg)
{
echo '<script language="javascript">';
echo 'alert(\''.FormatString($p_msg).'\')';
echo '</script>';
}
?>