noalyss  Version-9
Functions
ac_common.php File Reference

common utilities for a lot of procedure, classe More...

Go to the source code of this file.

Functions

 add_http_link ($text)
 
 ajax_disconnected ($p_div)
 Should a dialog box when you are disconnected from an ajax call propose to reload or to connect in another tab. More...
 
 ajax_xml_error ($p_code, $p_string)
 
 alert ($p_msg, $buffer=false)
 alert in javascript More...
 
 cmpDate ($p_date, $p_date_oth)
 Compare 2 dates. More...
 
 complete_default_menu ($pa_menu)
 Check if there is a default menu for this user and add it. More...
 
 compute_variable ($p_string)
 the string has the format a=b&c=d, it is parsed and an array[][key,value] is returned More...
 
 confirm_with_string ($p_ctl_name, $p_car)
 generate a string of p_car character and a input text with name p_ctl_name work like a kind of captcha.The control code for checking is ctlcode. More...
 
if(!function_exists('tracedebug')) convert_to_rtf ($p_string)
 encode the string for RTF, return a stringu More...
 
 Decode ($p_html)
 Decode the html for the widegt richtext and remove newline. More...
 
 display_dashboard_operation ($p_array, $p_title, $p_div)
 Display a box with the contains. More...
 
 display_menu ($p_menuid)
 Display a menu @global type $g_user. More...
 
 echo_error ($p_log, $p_line="", $p_message="")
 log error into the /tmp/noalyss_error.log it doesn't work on windows More...
 
 echo_warning ($p_string)
 warns More...
 
 factory_Ledger (Database &$p_cn, $ledger_id)
 This function create a ledger object and return the right one. More...
 
 find_default_menu ($pn_menu)
 Find the menu marked as default in the given profile. More...
 
 find_default_module ()
 
 findSide ($p_number)
 return D if the number is smaller than 0 , C if bigger and an empty string if equal to 0. More...
 
 format_date ($p_date, $p_from_format='YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
 format the date, when taken from the database the format is MM-DD-YYYY More...
 
 FormatString ($p_string)
 replaced by sql_string More...
 
 generate_random_string ($car)
 Create randomly a string. More...
 
 get_array_column ($p_array, $key)
 
 getPeriodeFromMonth ($p_cn, $p_date)
 Return the period corresponding to the date. More...
 
 getPeriodeName ($p_cn, $p_id, $pos='p_start')
 Show the periode which found thanks its id. More...
 
 h ($p_string)
 to protect again bad characters which can lead to a cross scripting attack the string to be diplayed must be protected. More...
 
 h1 ($p_string, $p_class="")
 
 h2 ($p_string, $p_class="", $raw="")
 
 h2info ($p_string)
 
 hb ($p_string)
 
 header_csv ($p_filename)
 Send an header CSV with a filename. More...
 
 hi ($p_string)
 
 html_min_page_start ($p_theme="", $p_script="", $p_script2="")
 Minimal page header for each page, used for small popup window. More...
 
 html_page_start ($p_theme="", $p_script="", $p_script2="")
 Default page header for each page. More...
 
 html_page_stop ()
 end tag More...
 
 is_msie ()
 Check if we use IE 8 or 9. More...
 
 isDate ($p_date)
 
 isNumber ($p_int)
 
 j ($p_string)
 escape correctly php string to javascript More...
 
 nb ($p_number)
 format the number for the CSV export More...
 
 nbm ($p_number, $p_dec=2)
 format the number with a sep. More...
 
 NoAccess ($js=1)
 Echo no access and stop. More...
 
 p ($p_string)
 
 put_global ($array)
 Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter) More...
 
 rebuild_access_code ($pan_code)
 rebuild the access code More...
 
 record_log ($p_message)
 Record an error message into the log file of the server. More...
 
 remove_divide_zero ($p_formula)
 When it is needed to eval a formula , this function prevent the divide by zero. More...
 
 set_language ()
 set the lang thanks the _SESSION['g_lang'] var. More...
 
 show_menu ($module)
 
 show_module ($selected)
 Show the modules. More...
 
 ShowItem ($p_array, $p_dir='V', $class="nav-item", $class_ref="nav-link", $default="", $p_extra="nav nav-pills nav-fill")
 store the string which print the content of p_array in a table used to display the menu More...
 
 shrink_date ($p_date)
 shrink the date, make a date shorter for the printing More...
 
 smaller_date ($p_date)
 shrink the date, make a date shorter for the printing More...
 
 span ($p_string, $p_extra='')
 
 sql_filter_per ($p_cn, $p_from, $p_to, $p_form='p_id', $p_field='jr_tech_per')
 Create the condition to filter on the j_tech_per thanks a from and to date. More...
 
 sql_string ($p_string)
 Fix the problem with the quote char for the database. More...
 
 td ($p_string='', $p_extra='')
 surround the string with td More...
 
 th ($p_string, $p_extra='', $raw='')
 
 tr ($p_string, $p_extra='')
 
 transform_sql_filter_per ($p_sql)
 transform the SQL for ANALYTIC table operation_analytique More...
 
 what_os ()
 try to determine on what os you are running the pĥpcompte server More...
 

Detailed Description

common utilities for a lot of procedure, classe

Definition in file ac_common.php.

Function Documentation

◆ add_http_link()

add_http_link (   $text)

Definition at line 1570 of file ac_common.php.

1571 {
1572 
1573  $ret=preg_replace("!http[s]{0,1}://[[:graph:]*]*!",'<a href="\\0" target="_blank">\0</a>',$text);
1574 
1575  return $ret;
1576 
1577 }

References $ret, and $text.

◆ ajax_disconnected()

ajax_disconnected (   $p_div)

Should a dialog box when you are disconnected from an ajax call propose to reload or to connect in another tab.

Definition at line 898 of file ac_common.php.

899 {
900 
901  echo HtmlInput::title_box(_("Déconnecté"), $p_div);
902  echo h2(_('Données non disponibles'), 'class="error" ');
903  echo h2(_('Veuillez vous reconnecter soit dans une autre fenêtre soit '
904  . ' en cliquant sur le lien'), 'class="error"');
905  // Reload button
906  $reload=new IButton("reload");
907  $reload->value=_("Se connecter");
908  $reload->class="button";
909  $reload->javascript='window.location.reload()';
910  // Link to log in another tab
911  echo '<p style="text-align:center">';
912  echo $reload->input();
913  echo HtmlInput::button_close($p_div);
914  echo '</p>';
915 
916 
917 }

◆ ajax_xml_error()

ajax_xml_error (   $p_code,
  $p_string 
)

Definition at line 1260 of file ac_common.php.

1261 {
1262  $html = escape_xml($p_string);
1263  header('Content-type: text/xml; charset=UTF-8');
1264  echo <<<EOF
1265 <?xml version="1.0" encoding="UTF-8"?>
1266 <data>
1267 <code>$p_code</code>
1268 <value>$html</value>
1269 </data>
1270 EOF;
1271 }

References $html, escape_xml(), and value.

+ Here is the call graph for this function:

◆ alert()

alert (   $p_msg,
  $buffer = false 
)

alert in javascript

Parameters
$p_msgis the message
$bufferif false, echo directly and execute the javascript, if $buffer is true, the alert javascript is in the return string
Returns
string with alert javascript if $buffer is true

Definition at line 731 of file ac_common.php.

732 {
733  $r = '<script>';
734  $r.= 'alert_box(\'' . j($p_msg) . '\')';
735  $r.= '</script>';
736 
737  if ($buffer)
738  {
739  return $r;
740  }
741  echo $r;
742 }

References $p_msg, $r, and j().

Referenced by Fiche_Def\Add(), Extension\check_version(), Anc_Group\display_html(), Anc_Table\display_html(), Anc_Acc_List\display_html(), Acc_Ledger_Fin\input(), Todo_List\insert(), Extension\insert_plugin(), js_include(), Fiche\remove(), Extension\remove_plugin(), Acc_Parm_Code\save(), Document_Type\set_number(), ICard\test_me(), Acc_Ledger\test_me(), Extension\update_plugin(), Acc_Report\upload(), and Menu_Ref\verify().

+ Here is the call graph for this function:

◆ cmpDate()

cmpDate (   $p_date,
  $p_date_oth 
)

Compare 2 dates.

Parameters
p_date
p_date_oth
Returns
  • == 0 les dates sont identiques
  • > 0 date1 > date2
  • < 0 date1 < date2

Definition at line 191 of file ac_common.php.

192 {
193  date_default_timezone_set('Europe/Brussels');
194 
195  $l_date = isDate($p_date);
196  $l2_date = isDate($p_date_oth);
197  if ($l_date == null || $l2_date == null)
198  {
199  throw new Exception("erreur date [$p_date] [$p_date_oth]");
200  }
201  $l_adate = explode(".", $l_date);
202  $l2_adate = explode(".", $l2_date);
203  $l_mkdate = mktime(0, 0, 0, $l_adate[1], $l_adate[0], $l_adate[2]);
204  $l2_mkdate = mktime(0, 0, 0, $l2_adate[1], $l2_adate[0], $l2_adate[2]);
205  // si $p_date > $p_date_oth return > 0
206  return $l_mkdate - $l2_mkdate;
207 }

References $p_date, and isDate().

Referenced by Fiche\HtmlTable(), Acc_Ledger_Purchase\verify_operation(), Acc_Ledger_Sale\verify_operation(), and Acc_Ledger_Fin\verify_operation().

+ Here is the call graph for this function:

◆ complete_default_menu()

complete_default_menu (   $pa_menu)

Check if there is a default menu for this user and add it.

The array is filling from 1 to 3

* 
* COMPTA              0   -   0 - 173
* COMPTA/MENUACH      0   - 173 -   3
* COMPTA/MENUACH/ACH  173 -   3 -  85
* 
* 
Parameters
array$pa_menuif the array of option ; index pm_id_v1 , pm_id_v2 and pm_id_v3

Definition at line 1525 of file ac_common.php.

1526 {
1527  $a_result=$pa_menu;
1528  // find the first one which is null
1529  if ($pa_menu[0]['pm_id_v2'] == 0) {
1530  $tmp=find_default_menu($pa_menu[0]['pm_id_v1']);
1531  if ( $tmp <> 0 ) {
1532  $a_result[0]['pm_id_v2']=$pa_menu[0]['pm_id_v1'];
1533  $a_result[0]['pm_id_v1']=$tmp;
1534  }
1535  }
1536  if ($pa_menu[0]['pm_id_v3'] == 0) {
1537  $tmp=find_default_menu($a_result[0]['pm_id_v1']);
1538  if ( $tmp <> 0 ) {
1539  $a_result[0]['pm_id_v3']=$a_result[0]['pm_id_v2'];
1540  $a_result[0]['pm_id_v2']=$a_result[0]['pm_id_v1'];
1541  $a_result[0]['pm_id_v1']=$tmp;
1542  }
1543  }
1544  return $a_result;
1545 }

References $tmp, and find_default_menu().

+ Here is the call graph for this function:

◆ compute_variable()

compute_variable (   $p_string)

the string has the format a=b&c=d, it is parsed and an array[][key,value] is returned

Parameters
$p_string
Returns
$array usable in put_global

Definition at line 1245 of file ac_common.php.

1246 {
1247  $array=array();
1248  if ($p_string == '') return $array;
1249 
1250  $var=explode("&",$p_string);
1251  if (empty ($var)) return $array;
1252  for ($i=0;$i < count($var);$i++)
1253  {
1254  $var2=explode('=',$var[$i]);
1255  $array[$i]['key']=$var2[0];
1256  $array[$i]['value']=$var2[1];
1257  }
1258  return $array;
1259 }

References $array, $i, and $var.

Referenced by Noalyss\Mobile\execute_menu().

◆ confirm_with_string()

confirm_with_string (   $p_ctl_name,
  $p_car 
)

generate a string of p_car character and a input text with name p_ctl_name work like a kind of captcha.The control code for checking is ctlcode.

You compare the content of the variable p_ctl_name with ctlcode

Parameters
$p_ctl_namename of the HTML input text
$p_carlength of the string

Definition at line 1487 of file ac_common.php.

1488 {
1489  $code=generate_random_string($p_car );
1490  $r = HtmlInput::hidden("ctlcode",$code);
1491  $r.='<span style="margin-left:1.2em;margin-right:1.2em;font-size:112%;font-weight:bold">'. $code.'</span>';
1492  $ctl=new IText($p_ctl_name);
1493  $r.=$ctl->input();
1494  return $r;
1495 }

References $code, $ctl, $r, generate_random_string(), and HtmlInput\hidden().

+ Here is the call graph for this function:

◆ convert_to_rtf()

if (!function_exists( 'tracedebug')) convert_to_rtf (   $p_string)

encode the string for RTF, return a stringu

Parameters
$p_stringstring to convert
Returns
string

Definition at line 1433 of file ac_common.php.

1434 {
1435  $result="";
1436  $p_string2=utf8_decode($p_string);
1437  $nb_result=strlen($p_string2);
1438  for ($i = 0 ; $i < $nb_result ; $i++ ){
1439  if (ord($p_string[$i]) < 127 ) {
1440  $result.=$p_string[$i];
1441  } else {
1442  $result.='\u'.ord($p_string[$i]).chr(92).chr(39).'3f';
1443  }
1444  }
1445  return $result;
1446 }

References $i, and $result.

Referenced by Acc_Bilan\generate_plain().

◆ Decode()

Decode (   $p_html)

Decode the html for the widegt richtext and remove newline.

Parameters
$p_htmlstring to decode
Returns
the html code without new line

Definition at line 641 of file ac_common.php.

642 {
643  $p_html = str_replace('%0D', '', $p_html);
644  $p_html = str_replace('%0A', '', $p_html);
645  $p_html = urldecode($p_html);
646  return $p_html;
647 }

◆ display_dashboard_operation()

display_dashboard_operation (   $p_array,
  $p_title,
  $p_div 
)

Display a box with the contains.

Parameters
type$p_arrayData to display
type$p_titleTitle of the box
type$p_divid of the box

Definition at line 1278 of file ac_common.php.

1279 {
1280  ?>
1281 <div id="<?php echo $p_div;?>" class="inner_box" style="display:none;position:fixed;top:250px;left:12%;width: 75%;min-height:50%;overflow:auto;">
1282  <?php
1283  echo HtmlInput::title_box($p_title, $p_div, "hide",'','y');
1284  ?>
1285  <?php if (count($p_array)>0) :?>
1286  <table class="result">
1287  <tr>
1288  <th><?php echo _('Date')?></th>
1289  <th><?php echo _('Code Interne')?></th>
1290  <th><?php echo _('Pièce')?></th>
1291  <th><?php echo _('Description')?></th>
1292  <th>
1293  <?php echo _('Montant')?>
1294  </th>
1295 
1296  </tr>
1297  <?php
1298  for ($i=0;$i<count($p_array);$i++):
1299  ?>
1300  <tr class="<?php echo (($i%2)==0)?'odd':'even';?>">
1301  <td>
1302  <?php echo smaller_date(format_date($p_array[$i]['jr_date']) );?>
1303  </td>
1304  <td>
1305  <?php echo HtmlInput::detail_op($p_array[$i]['jr_id'], $p_array[$i]['jr_internal']) ?>
1306  </td>
1307  <td>
1308  <?php echo h($p_array[$i]['jr_pj_number'])?>
1309  </td>
1310  <td>
1311  <?php echo h($p_array[$i]['jr_comment']) ?>
1312  </td>
1313  <td>
1314  <?php echo nbm($p_array[$i]['jr_montant']) ?>
1315  </td>
1316  </tr>
1317  <?php
1318  endfor;
1319  ?>
1320  </table>
1321  <p style="text-align: center">
1322  <?php echo HtmlInput::button_hide($p_div)?>
1323  </p>
1324  <?php else: ?>
1325  <h2 class="notice"><?php echo _('Aucune donnée')?></h2>
1326  <?php
1327  endif;
1328  ?>
1329 </div>
1330 <?php
1331 }

References $i, $p_array, HtmlInput\button_hide(), HtmlInput\detail_op(), endfor, endif, format_date(), h(), h2(), nbm(), p(), smaller_date(), style, table, td(), th(), HtmlInput\title_box(), and tr().

+ Here is the call graph for this function:

◆ display_menu()

display_menu (   $p_menuid)

Display a menu @global type $g_user.

Parameters
type$p_menuid
Returns
type

Definition at line 1141 of file ac_common.php.

1142 {
1143  if ($p_menuid == 0) return;
1144  global $g_user;
1146 
1147  $file = $cn->get_array("
1148  select me_file,me_parameter,me_javascript,me_type
1149  from menu_ref
1150  join profile_menu using (me_code)
1151  join profile_user using (p_id)
1152  where
1153  pm_id=$1 and
1154  user_name=$2 and
1155  (me_file is not null or trim(me_file) <>'' or
1156  me_javascript is not null or trim (me_javascript) <> '')", array($p_menuid,$g_user->login));
1157 
1158  if (count($file)==0)
1159  {
1160  return;
1161  }
1162 
1163  if ($file[0]['me_file'] != "")
1164  {
1165  if ($file[0]['me_parameter'] !== "")
1166  {
1167  // if there are paramter put them in superglobal
1168  $array=compute_variable($file[0]['me_parameter']);
1169  put_global($array);
1170  }
1171  if ( DEBUGNOALYSS == 2)
1172  {
1173  echo $file[0]['me_file']," param : ",$file[0]['me_parameter'] ;
1174 
1175  }
1176  /*
1177  * Log the file we input to put in the folder test-noalyss for replaying it
1178  */
1179  if (LOGINPUT) {
1180  $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
1181  fwrite($file_loginput, "include '".$file[0]['me_file']."';");
1182  fwrite($file_loginput,"\n");
1183  fclose($file_loginput);
1184  }
1185  // if file is not a plugin, include the file, otherwise
1186  // include the plugin launcher
1187  if ( $file[0]['me_type'] != 'PL') {
1188  if (file_exists ($file[0]['me_file']) )
1189  {
1190  require_once $file[0]['me_file'];
1191  } elseif ( file_exists(NOALYSS_INCLUDE.'/'.$file[0]['me_file'])) {
1192  require_once NOALYSS_INCLUDE.'/'.$file[0]['me_file'];
1193  }else {
1194  echo echo_warning(_("Fichier non trouvé"));
1195  }
1196  } else {
1197  require 'extension_get.inc.php';
1198  }
1199 
1200  exit();
1201  } elseif ( $file[0]['me_javascript'] != '')
1202  {
1203  $js= str_replace('<DOSSIER>', dossier::id(), $file[0]['me_javascript']);
1204  echo create_script($js);
1205  }
1206 
1207 }

◆ echo_error()

echo_error (   $p_log,
  $p_line = "",
  $p_message = "" 
)

log error into the /tmp/noalyss_error.log it doesn't work on windows

Parameters
p_logmessage
p_lineline number
p_messageis the message
Returns
nothing

Definition at line 169 of file ac_common.php.

170 {
171  echo "ERREUR :" . $p_log . " " . $p_line . " " . $p_message;
172  $fdebug = fopen($_ENV['TMP'] . DIRECTORY_SEPARATOR . "noalyss_error.log", "a+");
173  if ($fdebug != null)
174  {
175  fwrite($fdebug, date("Ymd H:i:s") . $p_log . " " . $p_line . " " . $p_message . "\n");
176  fclose($fdebug);
177  }
178 }

Referenced by Dossier\check(), Database\format_name(), Fiche\get_row(), Fiche\get_row_date(), getPeriodeName(), isValid_deprecrated(), Document_modele\Save(), sql_filter_per(), Document_modele\update(), and DatabaseCore\upload().

◆ echo_warning()

echo_warning (   $p_string)

warns

Parameters
p_stringerror message gen :
  • none
Returns
:
  • none

Definition at line 582 of file ac_common.php.

583 {
584  echo '<H2 class="error">' . $p_string . "</H2>";
585 }

Referenced by Noalyss\Mobile\execute_menu(), Extension\read_definition(), Dossier\synchro_admin(), and Dossier\upgrade().

◆ factory_Ledger()

factory_Ledger ( Database $p_cn,
  $ledger_id 
)

This function create a ledger object and return the right one.

It uses the factory pattern

Parameters
Database$p_cn
type$ledger_id
Returns
Acc_Ledger
Exceptions
Exception

Definition at line 1353 of file ac_common.php.

1354 {
1355  include_once NOALYSS_INCLUDE.'/class/acc_ledger_sale.class.php';
1356  include_once NOALYSS_INCLUDE.'/class/acc_ledger_purchase.class.php';
1357  include_once NOALYSS_INCLUDE.'/class/acc_ledger_fin.class.php';
1358 
1359  $ledger=new Acc_Ledger($p_cn, $ledger_id);
1360  $type=$ledger->get_type();
1361 
1362  switch ($type)
1363  {
1364  case 'VEN':
1365  $obj=new Acc_Ledger_Sale($p_cn, $ledger_id);
1366  break;
1367  case 'ACH':
1368  $obj=new Acc_Ledger_Purchase($p_cn, $ledger_id);
1369  break;
1370  case 'FIN':
1371  $obj= new Acc_Ledger_Fin($p_cn, $ledger_id);
1372  break;
1373  case 'ODS':
1374  $obj=$ledger;
1375  break;
1376 
1377  default:
1378  throw new Exception('Ledger type not found');
1379  }
1380  return $obj;
1381 }

References $ledger, $ledger_id, $obj, and $type.

◆ find_default_menu()

find_default_menu (   $pn_menu)

Find the menu marked as default in the given profile.

Parameters
number$pn_menu(profile_menu.id)

Definition at line 1500 of file ac_common.php.

1501 {
1503  $sql = ' select pm_id from profile_menu where pm_default =1 and pm_id_dep = $1';
1504  $aresult=$cn->get_array($sql, [$pn_menu]);
1505  if (empty($aresult)) {
1506  return 0;
1507  }
1508  return $aresult[0]['pm_id'];
1509 }

References $cn, $sql, and Dossier\connect().

Referenced by complete_default_menu().

+ Here is the call graph for this function:

◆ find_default_module()

find_default_module ( )

Definition at line 982 of file ac_common.php.

983 {
984  global $g_user;
985  $cn = Dossier::connect();
986 
987  $default_module = $cn->get_array("select me_code
988  from profile_menu join profile_user using (p_id)
989  where
990  p_type_display='M' and
991  user_name=$1 and pm_default=1", array($g_user->login));
992 
993  /*
994  * Try to find the smallest order for module
995  */
996  if (empty($default_module))
997  {
998  $default_module = $cn->get_array("select me_code
999  from profile_menu join profile_user using (p_id)
1000  where
1001  p_type_display='M' and
1002  user_name=$1 order by p_order limit 1", array($g_user->login));
1003 
1004  // if no default try to find the default menu
1005  if ( empty ($default_module))
1006  {
1007  $default_module = $cn->get_array("select me_code
1008  from profile_menu join profile_user using (p_id)
1009  where
1010  p_type_display='E' and
1011  user_name=$1 and pm_default=1 ", array($g_user->login));
1012  /*
1013  * Try to find a default menu by order
1014  */
1015  if (empty ($default_module))
1016  {
1017  $default_module = $cn->get_array("select me_code
1018  from profile_menu join profile_user using (p_id)
1019  where
1020  user_name=$1 and p_order=(select min(p_order) from profile_menu join profile_user using (p_id)
1021  where user_name=$2) limit 1", array($g_user->login, $g_user->login));
1022  }
1023 
1024  /*
1025  * if nothing found, there is no profile for this user => exit
1026  */
1027  if (empty ($default_module))
1028  {
1029  /*
1030  * If administrateur, then we insert a default profile (1)
1031  * for him
1032  */
1033  if ( $g_user->admin == 1 )
1034  {
1035  $cn->exec_sql('insert into profile_user(user_name,p_id) values ($1,1) ',array($g_user->login));
1036  return find_default_module();
1037  }
1038  echo_warning(_("Utilisateur n'a pas de profil, votre administrateur doit en configurer un dans CFGSEC"));
1039  exit();
1040  }
1041  }
1042  return $default_module[0]['me_code'];
1043  }
1044 
1045  if (count($default_module) > 1)
1046  {
1047  // return the first module found
1048  return $default_module[0]['me_code'];
1049  }
1050  elseif (count($default_module) == 1)
1051  {
1052  return $default_module[0]['me_code'];
1053  }
1054 }

◆ findSide()

findSide (   $p_number)

return D if the number is smaller than 0 , C if bigger and an empty string if equal to 0.

Used for displaying saldo D / C (debit / credit )

Parameters
float$p_number

Definition at line 121 of file ac_common.php.

122 {
123  $return ='';
124  if ( $p_number > 0 ) {
125  $return ='D';
126  }else {
127  $return =($p_number== 0)?"":"C";
128  }
129  return $return;
130 }

Referenced by Anc_Listing\display_html().

◆ format_date()

format_date (   $p_date,
  $p_from_format = 'YYYY-MM-DD',
  $p_to_format = 'DD.MM.YYYY' 
)

format the date, when taken from the database the format is MM-DD-YYYY

Parameters
$p_dateformat
Exceptions
1if invalid format DOMEntity
Parameters

Definition at line 844 of file ac_common.php.

845 {
846  if ($p_from_format == 'YYYY-MM-DD')
847  {
848  $date = explode('-', $p_date);
849  if (count($date) != 3)
850  return $p_date;
851  }
852  if ($p_from_format == 'DD.MM.YYYY')
853  {
854  $temp_date = explode('.', $p_date);
855  if (count($temp_date) != 3)
856  return $p_date;
857  $date[0] = $temp_date[2]; // 0 is year
858  $date[1] = $temp_date[1]; // 1 for month
859  $date[2] = $temp_date[0]; // 2 for day
860  }
861 
862  switch ($p_to_format)
863  {
864  case 'DD.MM.YYYY':
865  $str_date = $date[2] . '.' . $date[1] . '.' . $date[0];
866  break;
867  case 'DD-MM-YYYY':
868  $str_date = $date[2] . '-' . $date[1] . '-' . $date[0];
869  break;
870  case 'YYYY-MM-DD':
871  $str_date = $date[0] . '-' . $date[1] . '-' . $date[2];
872  break;
873  case 'YYYYMMDD':
874  $str_date = $date[0] . $date[1] . $date[2];
875  break;
876  case 'YYYY/MM/DD':
877  $str_date = $date[0] . '/' . $date[1] . '/' . $date[2];
878  break;
879  case "DD.MM.YY":
880  $str_date = $date[2] . '.' . $date[1] . '.' . substr($date[0],2,2);
881  break;
882  case "DD-MM-YY":
883  $str_date = $date[2] . '-' . $date[1] . '-' . substr($date[0],2,2);
884  break;
885  default:
886  throw new Exception(_("Format Invalide"),1);
887 
888  }
889  return $str_date;
890 }

Referenced by Stock\build_tmp_table(), Anticipation\display(), display_dashboard_operation(), Periode_Ledger_Table\display_row(), Periode\display_row_global(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), Follow_Up\myList(), and Document\replace().

◆ FormatString()

FormatString (   $p_string)

replaced by sql_string

Deprecated:

Definition at line 493 of file ac_common.php.

494 {
495  return sql_string($p_string);
496 }

References sql_string().

+ Here is the call graph for this function:

◆ generate_random_string()

generate_random_string (   $car)

Create randomly a string.

Parameters
int$p_lengthlength of the generate string

Definition at line 1468 of file ac_common.php.

1469 {
1470  $string="";
1471  $chaine="abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY0123456789*/+-=";
1472  srand((double) microtime()*1020030);
1473  for ($i=0; $i<$car; $i++)
1474  {
1475  $string .= $chaine[rand()%strlen($chaine)];
1476  }
1477  return $string;
1478 }

References $i, and $string.

Referenced by confirm_with_string().

◆ get_array_column()

get_array_column (   $p_array,
  $key 
)

Definition at line 1332 of file ac_common.php.

1333 {
1334  $array=array();
1335  for ($i=0;$i<count($p_array);$i++)
1336  {
1337  $r=$p_array[$i];
1338  if ( isset($r[$key])) {
1339  $array[]=$r[$key];
1340  }
1341  }
1342  return $array;
1343 }

References $array, $i, $p_array, and $r.

◆ getPeriodeFromMonth()

getPeriodeFromMonth (   $p_cn,
  $p_date 
)

Return the period corresponding to the date.

Parameters
p_cndatabase connection
p_datethe month + year 'MM.YYYY'
Returns
: parm_periode.p_id

Definition at line 626 of file ac_common.php.

627 {
628  $R = $p_cn->get_value("select p_id from parm_periode where
629  to_char(p_start,'DD.MM.YYYY') = $1", array('01.'.$p_date));
630  if ($R == "")
631  return -1;
632  return $R;
633 }

References $p_date.

◆ getPeriodeName()

getPeriodeName (   $p_cn,
  $p_id,
  $pos = 'p_start' 
)

Show the periode which found thanks its id.

Parameters
$p_cndatabase connection
p_id
posStart or end
Returns
: string

Definition at line 598 of file ac_common.php.

599 {
600  if ($pos != 'p_start' && $pos != 'p_end')
601  {
602  echo_error('lib/ac_common.php' . "-" . __LINE__ . ' UNDEFINED PERIODE');
603  throw new Exception(_("paramètre invalide"));
604  }
605  if ( isNumber($p_id) == 0 )
606  {
607  throw new Exception("Paramètre invalide");
608  return;
609  }
610  $ret = $p_cn->get_value("select to_char($pos,'Mon YYYY') as t from parm_periode where p_id=$1",
611  array( $p_id));
612  return $ret;
613 }

References $p_id, $pos, $ret, echo_error(), and isNumber().

+ Here is the call graph for this function:

◆ h()

h (   $p_string)

to protect again bad characters which can lead to a cross scripting attack the string to be diplayed must be protected.

Side effects with htmlentities, especially for the date (transform dot in ) and number

Definition at line 35 of file ac_common.php.

36 {
37  return htmlspecialchars($p_string,ENT_QUOTES|ENT_HTML5,'UTF-8',true);
38 }

References ENT_QUOTES.

Referenced by display_dashboard_operation(), h1(), h2info(), hb(), hi(), and th().

◆ h1()

h1 (   $p_string,
  $p_class = "" 
)
Examples
acc_ledger_historyTest.php, and inplace_edit.test.php.

Definition at line 72 of file ac_common.php.

73 {
74  return '<h1 ' . $p_class . '>' . h($p_string) . '</h1>';
75 }

References h().

+ Here is the call graph for this function:

◆ h2()

h2 (   $p_string,
  $p_class = "",
  $raw = "" 
)

◆ h2info()

h2info (   $p_string)

Definition at line 63 of file ac_common.php.

64 {
65  return '<h2 class="info">' . h($p_string) . '</h2>';
66 }

References h().

Referenced by Anc_Balance_Double\display_html().

+ Here is the call graph for this function:

◆ hb()

hb (   $p_string)

Definition at line 53 of file ac_common.php.

54 {
55  return '<b>' . h($p_string) . '</b>';
56 }

References h().

Referenced by Acc_Ledger_Sale\confirm(), and Acc_Ledger_Purchase\confirm().

+ Here is the call graph for this function:

◆ header_csv()

header_csv (   $p_filename)

Send an header CSV with a filename.

Parameters
string$p_filename,filename , caution , it must be sanitized BEFORE calling this function

Definition at line 1212 of file ac_common.php.

1213 {
1214 
1215  header('Pragma: public');
1216  header('Content-type: application/csv');
1217  header("Content-Disposition: attachment;filename=\"{$p_filename}\"",
1218  FALSE);
1219  header('Cache-Control: no-store, no-cache, must-revalidate');
1220  header('Expires: Sun, 1 Jan 2000 12:00:00 GMT');
1221  header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT');
1222 }

◆ hi()

hi (   $p_string)

Definition at line 48 of file ac_common.php.

49 {
50  return '<i>' . h($p_string) . '</i>';
51 }

References h().

Referenced by Template_Card_Category\input().

+ Here is the call graph for this function:

◆ html_min_page_start()

html_min_page_start (   $p_theme = "",
  $p_script = "",
  $p_script2 = "" 
)

Minimal page header for each page, used for small popup window.

Parameters
p_themedefault theme
$p_script
$p_script2another js script
Returns
none

Definition at line 404 of file ac_common.php.

405 {
406 
407  $cn = new Database();
408  if ($p_theme != "")
409  {
410  $Res = $cn->exec_sql("select the_filestyle from theme
411  where the_name='" . $p_theme . "'");
412  if (Database::num_row($Res) == 0)
413  $style = "style-classic.css";
414  else
415  {
417  $style = $s['the_filestyle'];
418  }
419  }
420  else
421  {
422  $style = "style-classic.css";
423  } // end if
424  echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN">';
425  echo "<HTML>";
426 
427 
428  if ($p_script2!="")
429  {
430  $p_script2='<script src="'.$p_script2.'" type="text/javascript"></script>';
431  }
432 
433  echo "<HEAD>
434  <TITLE>NOALYSS</TITLE>
435  <META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF8\">
436  <LINK REL=\"stylesheet\" type=\"text/css\" href=\"css/$style\" media=\"screen\">
437  <link rel=\"stylesheet\" type=\"text/css\" href=\"css/style-print.css\" media=\"print\">" .
438  $p_script2 . "
439  <script src=\"js/prototype.js\" type=\"text/javascript\"></script>
440  <script src=\"js/noalyss_script.js\" type=\"text/javascript\"></script>
441  <script src=\"js/acc_ledger.js\" type=\"text/javascript\"></script>
442  <script src=\"js/smoke.js\" type=\"text/javascript\"></script>";
443  echo "<LINK id=\"pagestyle\" REL=\"stylesheet\" type=\"text/css\" href=\"css/font/fontello/css/fontello.css\" media=\"screen\"/>";
444  include_once NOALYSS_INCLUDE.'/lib/message_javascript.php';
445  echo '</HEAD>
446  ';
447 
448  echo "<BODY $p_script>";
449  /* If we are on the user_login page */
450  if (basename($_SERVER['PHP_SELF']) == 'user_login.php')
451  {
452  return;
453  }
454 }

References $cn, $Res, $s, $style, DatabaseCore\fetch_array(), and DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ html_page_start()

html_page_start (   $p_theme = "",
  $p_script = "",
  $p_script2 = "" 
)

Default page header for each page.

Parameters
p_themedefault theme
$p_script
$p_script2another js script Must be called only once
Returns
none
Examples
inplace_edit.test.php.

Definition at line 278 of file ac_common.php.

279 {
280  // check not called twiced
281  static $already_call=0;
282  if ( $already_call==1)return;
283  $already_call=1;
284 
285  $cn = new Database();
286  if ($p_theme != "")
287  {
288  $Res = $cn->exec_sql("select the_filestyle from theme
289  where the_name=$1" ,[$p_theme]);
290  if (Database::num_row($Res) == 0)
291  {
292  $style = "style-classic7.css";
293  }
294  else
295  {
297  $style = $s['the_filestyle'];
298  }
299  }
300  else
301  {
302  $style = "style-classic7.css";
303  } // end if
304  $title="NOALYSS";
305 
306  if ( isset ($_REQUEST['ac'])) {
307  $ac=strip_tags($_REQUEST['ac']);
308  if (strpos($ac,'/') <> 0)
309  {
310  $m= explode('/',$ac);
311  $title=$m[count($m)-1]." ".$title;
312  }
313  else
314  $title=$ac." ".$title;
315  }
316  $is_msie=is_msie();
317 
318  if ($is_msie == 0 )
319  {
320  echo '<!doctype html>';
321  printf("\n");
322 
323  }
324  else {
325  echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN" >';
326  printf("\n");
327  }
328  echo "<HTML>";
329 
330  if ($p_script2!="")
331  {
332  $p_script2='<script src="'.$p_script2.'" type="text/javascript"></script>';
333  }
334  $style=trim($style);
335  echo "<HEAD>";
336  echo '<meta charset="utf-8">';
337  echo "<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
338  if ($is_msie==1)
339  {
340  echo ' <meta http-equiv="x-ua-compatible" content="IE=edge"/>';
341  }
342  echo "
343  <TITLE>$title</TITLE>
344  <link rel=\"icon\" type=\"image/ico\" href=\"favicon.ico\" />
345  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
346  <LINK id=\"bootstrap\" REL=\"stylesheet\" type=\"text/css\" href=\"css/bootstrap.min.css\" media=\"screen\"/>
347  <LINK id=\"fontello\" REL=\"stylesheet\" type=\"text/css\" href=\"css/font/fontello/css/fontello.css\" media=\"screen\"/>
348  <LINK id=\"pagestyle\" REL=\"stylesheet\" type=\"text/css\" href=\"css/".$style."?version=".SVNINFO."\" media=\"screen\"/>
349  <link rel=\"stylesheet\" type=\"text/css\" href=\"css/style-print.css?version=".SVNINFO."\" media=\"print\"/>" .
350  $p_script2 . "
351  ";
352  // preload font
353  echo '<link rel="preload" href="./css/font/OpenSansRegular.woff" as="font" crossorigin="anonymous" />';
354  echo '<link rel="preload" href="./css/font/SansationLight/SansationLight.woff" as="font" crossorigin="anonymous" />';
355  echo '<link rel="preload" href="./css/font/fontello/fontello.woff" as="font" crossorigin="anonymous" />';
356 
357  echo '<script language="javascript" src="js/calendar.js"></script>
358  <script type="text/javascript" src="js/lang/calendar-en.js"></script>';
359 
360  if (isset($_SESSION[SESSION_KEY.'g_lang']) && $_SESSION[SESSION_KEY.'g_lang']=='fr_FR.utf8' )
361  {
362  echo '<script type="text/javascript" src="js/lang/calendar-fr.js"></script>';
363  }
364  if (isset($_SESSION[SESSION_KEY.'g_lang']) && $_SESSION[SESSION_KEY.'g_lang']=='nl_NL.utf8' )
365  {
366  echo '<script type="text/javascript" src="js/lang/calendar-nl.js"></script>';
367  }
368  echo '
369  <script language="javascript" src="js/calendar-setup.js"></script>
370  <LINK REL="stylesheet" type="text/css" href="css/calendar-blue.css" media="screen">
371  ';
372  // language
373  if (isset($_SESSION[SESSION_KEY.'g_lang']))
374  {
375  set_language();
376  }
377 
378  echo load_all_script();
379  echo ' </HEAD> ';
380 
381  echo "<BODY $p_script>";
382  echo '<div id="info_div"></div>';
383  echo '<div id="error_div">'.
384  HtmlInput::title_box(_("Erreur"), 'error_div','hide').
385  '<div id="error_content_div">'.
386  '</div>'.
387  '<p style="text-align:center">'.
388  HtmlInput::button_action('Valider','$(\'error_div\').style.visibility=\'hidden\';$(\'error_content_div\').innerHTML=\'\';').
389  '</p>'.
390  '</div>';
391 
392 }

References $_REQUEST, $ac, $cn, $m, $Res, $s, $style, $title, HtmlInput\button_action(), DatabaseCore\fetch_array(), is_msie(), load_all_script(), DatabaseCore\num_row(), set_language(), SVNINFO, and HtmlInput\title_box().

Referenced by Acc_Ledger\test_me().

+ Here is the call graph for this function:

◆ html_page_stop()

html_page_stop ( )

end tag

Definition at line 461 of file ac_common.php.

462 {
463  echo "</BODY>";
464  echo "</HTML>";
465 }

◆ is_msie()

is_msie ( )

Check if we use IE 8 or 9.

Returns
int 1 for IE8-9;0 otherwise

Definition at line 1386 of file ac_common.php.

1387 {
1388  if ( strpos ($_SERVER['HTTP_USER_AGENT'],'MSIE 8.0') != 0 ||
1389  strpos ($_SERVER['HTTP_USER_AGENT'],'MSIE 9.0') != 0 )
1390  $is_msie=1;
1391  else
1392  $is_msie=0;
1393  return $is_msie;
1394 }

Referenced by html_page_start().

◆ isDate()

isDate (   $p_date)

Definition at line 239 of file ac_common.php.

240 {
241  if (strlen(trim($p_date)) == 0)
242  return null;
243  if (preg_match("/^[0-9]{1,2}\.[0-9]{1,2}\.20[0-9]{2}$/", $p_date) == 0)
244  {
245 
246  return null;
247  }
248  else
249  {
250  $l_date = explode(".", $p_date);
251 
252  if (sizeof($l_date) != 3)
253  return null;
254 
255  if ($l_date[2] > COMPTA_MAX_YEAR || $l_date[2] < COMPTA_MIN_YEAR)
256  {
257  return null;
258  }
259 
260  if (checkdate($l_date[1], $l_date[0], $l_date[2]) == false)
261  {
262  return null;
263  }
264  }
265  return $p_date;
266 }

References $p_date, COMPTA_MAX_YEAR, and COMPTA_MIN_YEAR.

Referenced by Acc_Ledger_Search\build_search_sql(), Todo_List\check(), Currency_MTable\check(), Anc_Print\check(), HttpInput\check_type(), cmpDate(), Acc_Ledger_Fin\confirm(), Follow_Up\create_query(), Anc_Table\create_temp_table_account(), Anc_Table\create_temp_table_card(), Acc_Reconciliation\filter_date(), Acc_Currency\get_rate_date(), Periode\insert(), Acc_Operation\operation_update_date_limit(), Stock_Goods\record_save(), Acc_Ledger\reverse(), Tax_Summary\set_date_end(), Tax_Summary\set_date_start(), Anc_Acc_Link\set_sql_filter(), sql_filter_per(), Todo_List\verify(), Follow_Up\verify(), Acc_Ledger_Purchase\verify_operation(), Acc_Ledger_Sale\verify_operation(), and Acc_Ledger_Fin\verify_operation().

◆ isNumber()

isNumber (   $p_int)

◆ j()

j (   $p_string)

escape correctly php string to javascript

Definition at line 96 of file ac_common.php.

97 {
98  $a = preg_replace("/\r?\n/", "\\n", addslashes($p_string));
99  $a = str_replace("'", '\'', $a);
100  return $a;
101 }

References $a.

Referenced by alert().

◆ nb()

nb (   $p_number)

format the number for the CSV export

Parameters
$p_numbernumber

Definition at line 107 of file ac_common.php.

108 {
109  $r=trim($p_number);
110  $r = sprintf('%.4f', $p_number);
111  $r = str_replace('.', ',', $r);
112 
113  return $r;
114 }

References $r.

Referenced by Sort_Table\__construct(), Acc_Ledger\__construct(), Sort_Table\add(), Acc_Ledger\convert_from_follow(), Anc_Balance_Double\display_pdf(), Sort_Table\get_header(), Acc_Ledger\input(), and PDF_Operation\print_operation_info().

◆ nbm()

nbm (   $p_number,
  $p_dec = 2 
)

format the number with a sep.

for the thousand

Parameters
$p_numbernumber
$p_decnumber of decimal to display

Definition at line 137 of file ac_common.php.

138 {
139 
140  if (trim($p_number) == '')
141  return '';
142  if ($p_number == 0)
143  return "0,00";
144 
145  $a = doubleval($p_number);
146  $r = number_format($a, $p_dec, ",", ".");
147  if (trim($r) == '')
148  {
149  var_dump($r);
150  var_dump($p_number);
151  var_dump($a);
152  exit();
153  }
154 
155  return $r;
156 }

References $a, $r, and exit.

Referenced by Acc_Ledger_Fin\confirm(), Acc_Ledger\confirm(), Acc_Ledger_Sale\confirm(), Acc_Ledger_Purchase\confirm(), display_dashboard_operation(), Anc_Balance_Double\display_html(), Anc_Listing\display_html(), Anc_Balance_Simple\display_html(), Anc_GrandLivre\display_html(), Anc_Table\display_html(), Anc_Acc_List\display_html(), Anc_Balance_Simple\display_pdf(), Forecast_Item_MTable\display_row(), Print_Ledger_Detail\export(), Print_Ledger_Misc\export(), Print_Ledger_Detail_Item\export(), Print_Ledger_Financial\export(), Print_Ledger_Simple\export(), Print_Operation_Currency\export_csv(), Print_Operation_Currency\export_html(), Acc_Ledger_History_Generic\export_oneline_html(), Print_Ledger_Financial\Footer(), Print_Ledger_Simple\Footer(), Print_Ledger_Financial\Header(), Print_Ledger_Simple\Header(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), Acc_Ledger_Fin\insert(), Acc_Ledger_Search\list_operation(), Acc_Ledger_Search\list_operation_to_reconcile(), PDF_Operation\print_acc_writing(), PDF_Operation\print_anc_detail(), PDF_Operation\print_operation_info(), PDF_Operation\print_purchase(), PDF_Operation\print_sale(), Fiche\Summary(), Acc_Balance\summary_display(), and Acc_Balance\summary_display_pdf().

◆ NoAccess()

NoAccess (   $js = 1)

Echo no access and stop.

Returns
nothing

Definition at line 473 of file ac_common.php.

474 {
475  if ($js == 1)
476  {
477  echo "<script>";
478  echo "alert ('" . _('Cette action ne vous est pas autorisée Contactez votre responsable') . "');";
479  echo "</script>";
480  }
481  else
482  {
483  echo '<div class="redcontent">';
484  echo '<h2 class="error">' . _(' Cette action ne vous est pas autorisée Contactez votre responsable') . '</h2>';
485  echo '</div>';
486  }
487  exit - 1;
488 }

References $js, and exit.

Referenced by Stock_Goods\input().

◆ p()

p (   $p_string)
Examples
select-box-test.php.

Definition at line 39 of file ac_common.php.

40 {
41  return '<p>'.$p_string."</p>";
42 }

Referenced by display_dashboard_operation(), and Fiche_Def\input_detail().

◆ put_global()

put_global (   $array)

Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)

Parameters
$array[key] [value]

Definition at line 1228 of file ac_common.php.

1229 {
1230  for ($i=0;$i<count($array);$i++)
1231  {
1232  $key=$array[$i]['key'];
1233  $value=$array[$i]['value'];
1234  $_GET[$key]=$value;
1235  $_POST[$key]=$value;
1236  $_REQUEST[$key]=$value;
1237  }
1238 }

References $_GET, $_POST, $_REQUEST, $array, $i, and $value.

Referenced by Noalyss\Mobile\execute_menu(), and Dossier\set_current().

◆ rebuild_access_code()

rebuild_access_code (   $pan_code)

rebuild the access code

See also
complete_default_menu
Parameters
arrayof number $pan_code index row [0] = index pm_id_v1 , pm_id_v2 and pm_id_v3

Definition at line 1551 of file ac_common.php.

1552 {
1553  if ( empty ($pan_code)) {return;}
1554  $s_result="";
1556  $an_code=['pm_id_v3','pm_id_v2','pm_id_v1'];
1557  $sep="";
1558  for ($i=0;$i<3;$i++)
1559  {
1560  $ix=$an_code[$i];
1561  $s_result.=$sep.$cn->get_value("select me_code from profile_menu where pm_id=$1",[ $pan_code[0][$ix] ]);
1562  $sep=($s_result != "" )?"/":"";
1563  }
1564  return $s_result;
1565 }

References $cn, $i, $ix, $sep, and Dossier\connect().

+ Here is the call graph for this function:

◆ record_log()

record_log (   $p_message)

Record an error message into the log file of the server.

Record also the GET and POST data

Parameters
string$p_message

Definition at line 1400 of file ac_common.php.

1401 {
1402  error_log("noalyss".print_r($p_message,true),0);
1403  error_log("noalyss GET [".json_encode($_GET)."]");
1404  error_log("_POST [".json_encode($_POST)."]",0);
1405 }
1406 if(!function_exists('tracedebug')) {
1407  function tracedebug($file,$var, $label = NULL) {
1408 
1409  $tmp_file = sys_get_temp_dir().DIRECTORY_SEPARATOR.$file;
1410 
1411  $output = '';
1412  $output .= date('d-m-y H:i');
1413  if(!is_null($label)) {
1414  $output .= $label . ': ';
1415  }
1416  if ( gettype ($var) == 'object' && get_class($var)=='DOMDocument')
1417  {
1418  $var->formatOutput=true;
1419  $output.=$var->saveXML() .PHP_EOL;
1420  } else
1421  {
1422  $output .= print_r($var, 1) . PHP_EOL;
1423  }
1424 
1425  file_put_contents($tmp_file, $output, FILE_APPEND);
1426  }
1427 }

References $_GET, and $_POST.

Referenced by Anc_Group_Operation\add(), Sendmail_Core\compose(), Noalyss_Csv\correct_name(), Action_Document_Type_MTable\delete(), Acc_Ledger\delete_ledger(), Card_Multiple\display_option(), DatabaseCore\exec_sql(), Document\generate(), Table_Data_SQL\get_all_to_array(), Anc_Operation\get_balance(), Fiche\get_bank_ledger(), Acc_Ledger_History\get_ledger_type(), Acc_Ledger\input(), Acc_Ledger_Purchase\input(), Acc_Ledger_Info\insert(), Periode\insert(), Acc_Ledger_Sale\insert(), Fiche\insert(), Acc_Ledger_Fin\insert(), Periode\insert_exercice(), Acc_Bilan\load(), Document\parseDocument(), Stock_Goods\record_save(), Acc_Ledger\reverse(), Pre_op_fin\save(), Pre_op_ods\save(), Pre_op_ach\save(), Pre_op_ven\save(), Pre_Op_Advanced\save(), Default_Menu\save(), Document_modele\Save(), Anc_Key\save(), Anc_Group_Operation\save(), Pre_operation\save_insert(), Document_Type\set_number(), Follow_Up\sql_security_filter(), Dossier\synchro_admin(), Acc_Ledger\test_me(), Document\transform2pdf(), Acc_Ledger_Info\update(), Document_modele\update(), Card_Property\update(), and Acc_Ledger\verify_ledger().

◆ remove_divide_zero()

remove_divide_zero (   $p_formula)

When it is needed to eval a formula , this function prevent the divide by zero.

the formula is a math operation to evaluate like : 1.0+2.0/1 (...) , it is used in "report", it removes the operation "divide by 0 "

Parameters
string$p_formulastring containing a operation to evaluate
See also
Impress::parse_formula

Definition at line 1456 of file ac_common.php.

1457 {
1458  $test=str_replace(" ","",$p_formula).";";
1459  $p_formula=preg_replace("![0-9]+\.*[0-9]*/0\.{0,1}0*(\+|-|\*|/|;){1}!","0$1",$test);
1460  $p_formula=trim($p_formula,';');
1461  return $p_formula;
1462 }

Referenced by Impress\parse_formula().

◆ set_language()

set_language ( )

set the lang thanks the _SESSION['g_lang'] var.

Definition at line 747 of file ac_common.php.

748 {
749  // desactivate local check
750  if (defined("LOCALE")&&LOCALE==0)
751  {
752  return;
753  }
754  if (!isset($_SESSION[SESSION_KEY.'g_lang']))
755  {
756  return;
757  }
758 
759  /*
760  * If translation is not supported by current
761  */
762  if (!function_exists("bindtextdomain"))
763  {
764  return;
765  }
766 
767  $dir = "";
768  // set differently the language depending of the operating system
769  if (what_os() == 1)
770  {
771  $dir = setlocale(LC_MESSAGES, $_SESSION[SESSION_KEY.'g_lang']);
772  if ($dir == "")
773  {
774  $g_lang = 'fr_FR.utf8';
775  $dir = setlocale(LC_MESSAGES, $g_lang);
776  // echo '<span class="notice">' . $_SESSION[SESSION_KEY.'g_lang'] . ' domaine non supporté</h2>';
777  }
778  bindtextdomain('messages', NOALYSS_HOME.'/lang');
779  textdomain('messages');
780  bind_textdomain_codeset('messages', 'UTF8');
781 
782  return;
783  }
784  // for windows
785  putenv('LANG=' . $_SESSION[SESSION_KEY.'g_lang']);
786  $dir = setlocale(LC_ALL, $_SESSION[SESSION_KEY.'g_lang']);
787  bindtextdomain('messages', '.\\lang');
788  textdomain('messages');
789  bind_textdomain_codeset('messages', 'UTF8');
790 }

Referenced by html_page_start(), and Noalyss\Mobile\page_start().

◆ show_menu()

show_menu (   $module)

Show the submenus

Definition at line 1062 of file ac_common.php.

1063 {
1064  if ($module == 0)return;
1065  static $level=0;
1066  global $g_user;
1067  $http=new HttpInput();
1068  $access_code=$http->request("ac");
1069  $cn = Dossier::connect();
1070  /**
1071  * Show the submenus
1072  */
1073  $amenu = $cn->get_array("
1074  select
1075  pm_id,
1076  me_code,
1077  pm_id_dep,
1078  me_file,
1079  me_javascript,
1080  me_url,
1081  me_menu,
1082  me_description,
1083  me_description_etendue
1084  from profile_menu
1085  join menu_ref using (me_code)
1086  where pm_id_dep=$1 and p_id=$2
1087  order by p_order", array($module, $g_user->get_profile()));
1088 
1089  // There are submenuS, so show them
1090  if (!empty($amenu) && count($amenu) > 1)
1091  {
1092  $a_style_menu=array('topmenu','menu2','menu3');
1093  if ( $level > count($a_style_menu))
1094  $style_menu='menu3';
1095  else {
1096  $style_menu=$a_style_menu[$level];
1097  }
1098  require NOALYSS_TEMPLATE.'/menu.php';
1099  $level++;
1100  return;
1101  } elseif (count($amenu) == 1)
1102  {
1103  // there is only one submenu so we include the code or javascript
1104  // or we show the submenu
1105  if ( trim($amenu[0]['me_url']) != "" ||
1106  trim ($amenu[0]['me_file']) != "" ||
1107  trim ($amenu[0]['me_javascript']) != "" )
1108  {
1109  echo '<div class="topmenu">';
1110  echo h2info(_($amenu[0]['me_menu']));
1111  echo '</div>';
1112  $module = $amenu[0]['pm_id'];
1113  display_menu($module);
1114  $level++;
1115  return;
1116  } else {
1117  $url=$access_code.'/'.$amenu[0]['me_code'];
1118  echo '<a href="do.php?gDossier='.Dossier::id().'&ac='.$url.'">';
1119  echo _($amenu[0]['me_menu']);
1120  echo '</a>';
1121  $level++;
1122  return;
1123  }
1124  }
1125 
1126  // !!! this point should never be reached
1127  // There is no submenu or only one
1128  if (empty($amenu) || count($amenu) == 1)
1129  {
1130  display_menu($module);
1131 
1132  }
1133  $level++;
1134 }

◆ show_module()

show_module (   $selected)

Show the modules.

Parameters
int$selectedmodule selected profile_menu.pm_id

Definition at line 923 of file ac_common.php.

924 {
925  global $g_user;
926  $cn = Dossier::connect();
927  $amodule = $cn->get_array("select
928  me_code,me_menu,me_url,me_javascript,p_order,me_type,me_description
929  from v_all_menu
930  where
931  p_id=$1
932  and p_type_display='M'
933  order by p_order", array($g_user->get_profile()));
934 
935  if ($selected != -1)
936  {
937  $selected_module=$cn->get_value('select me_code from profile_menu where'
938  . ' pm_id = $1 ', array($selected));
939  require_once NOALYSS_TEMPLATE.'/module.php';
940  $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type,me_description from v_all_menu
941  where pm_id=$1 and p_id=$2", array($selected,$g_user->get_profile()));
942  if ( count($file ) == 0 )
943  {
944  echo '</div>';
945  echo '</div>';
946  echo '<div class="content">';
947  echo_warning(_("Module inexistant")."[ $selected ] ");
948  echo '</div>';
949  exit();
950  }
951  if ($file[0]['me_file'] != '')
952  {
953  if ($file[0]['me_parameter'] != "")
954  {
955  // if there are paramter put them in superglobal
956  $array=compute_variable($file[0]['me_parameter']);
958  }
959 
960  // if file is not a plugin, include the file, otherwise
961  // include the plugin launcher
962  if ($file[0]['me_type'] != 'PL')
963  {
964  require_once $file[0]['me_file'];
965  }
966  else
967  {
968  // nothing : direct call to plugin
969  }
970  }
971  if ( $file[0]['me_javascript'] != '')
972  {
973  create_script($file[0]['me_javascript']);
974  }
975  }
976 }

◆ ShowItem()

ShowItem (   $p_array,
  $p_dir = 'V',
  $class = "nav-item",
  $class_ref = "nav-link",
  $default = "",
  $p_extra = "nav nav-pills nav-fill" 
)

store the string which print the content of p_array in a table used to display the menu

Parameters
$p_arrayarray like ( 0=>HREF reference, 1=>visible item (name),2=>Help(opt), 3=>selected (opt) 4=>javascript (normally a onclick event) (opt)
$p_dirdirection of the menu (H Horizontal V vertical)
$classCSS for li tag
$class_refCSS for the A tag
$defaultselected item
$p_extraextra code for the table tag (CSS or javascript)

Definition at line 528 of file ac_common.php.

529 {
530  $ret = '';
531  // for comptability with old application mtitle for anchor is replace by nav-link
532 
533 
534  // direction Vertical
535  if ($p_dir == 'V')
536  {
537  $ret .= "<ul class=\"$p_extra \" flex-row>";
538  } else {
539  $ret .= "<ul class=\"$p_extra \" >";
540 
541  }
542 
543  foreach ($p_array as $all => $href)
544  {
545  $javascript = (isset($href[4])) ? $href[4] : "";
546  $title = "";
547  $set = "XX";
548  if (isset($href[2]))
549  {
550  $title=$href[2];
551  }
552  if (isset($href[3]))
553  {
554  $set=$href[3];
555  }
556 
557  if ($set==$default)
558  {
559  $ret.='<li class="nav-item"><A class="'.$class_ref.' active'.'" HREF="'.$href[0].'" title="'.$title.'" '.$javascript.'>'.$href[1].'</A></li>';
560  }
561  else
562  {
563  $ret.='<li class="nav-item"><A class="'.$class_ref.'" HREF="'.$href[0].'" title="'.$title.'" '.$javascript.'>'.$href[1].'</A></li>';
564  }
565 
566  }
567 
568  $ret.="</ul>";
569  return $ret;
570 }

References $all, $href, $p_array, $ret, and $title.

Referenced by MenuAdmin().

◆ shrink_date()

shrink_date (   $p_date)

shrink the date, make a date shorter for the printing

Parameters
$p_dateformat DD.MM.YYYY
Returns
date in the format DDMMYY (size = 13 mm in arial 8)

Definition at line 819 of file ac_common.php.

820 {
821  $date = str_replace('.', '', $p_date);
822  $str_date = substr($date, 0, 4) . substr($date, 6, 2);
823  return $str_date;
824 }

◆ smaller_date()

smaller_date (   $p_date)

shrink the date, make a date shorter for the printing

Parameters
$p_dateformat DD.MM.YYYY
Returns
date in the format DD.MM.YY (size = 13 mm in arial 8)

Definition at line 830 of file ac_common.php.

831 {
832  $str_date = substr($p_date, 0, 6) . substr($p_date, 8, 2);
833  return $str_date;
834 }

Referenced by display_dashboard_operation(), and Print_Ledger_Misc\export().

◆ span()

span (   $p_string,
  $p_extra = '' 
)

Definition at line 43 of file ac_common.php.

44 {
45  return '<span ' . $p_extra . '>' . $p_string . '</span>';
46 }

Referenced by Acc_Ledger_Sale\confirm(), Acc_Ledger_Purchase\confirm(), Anc_Print\display_form(), Document\generate(), Inplace_Edit\input(), Forecast_Item_MTable\input(), and Profile_Menu\sub_menu().

◆ sql_filter_per()

sql_filter_per (   $p_cn,
  $p_from,
  $p_to,
  $p_form = 'p_id',
  $p_field = 'jr_tech_per' 
)

Create the condition to filter on the j_tech_per thanks a from and to date.

Parameters
$p_cndatabase conx
$p_fromstart date (date)
$p_toend date (date)
$p_formif the p_from and p_to are date or p_id
$p_fieldcolumn name
Returns
a string containg the query

Definition at line 675 of file ac_common.php.

676 {
677 
678  if ($p_form != 'p_id' && $p_form != 'date')
679  {
680  echo_error(__FILE__, __LINE__, 'Mauvais parametres ');
681  exit(-1);
682  }
683  $p_from= sql_string($p_from);
684  $p_to= sql_string($p_to);
685  $p_field= sql_string($p_field);
686  if ($p_form == 'p_id')
687  {
688  if ( isNUmber($p_from)==0 || isNUmber($p_to)==0){
689  throw new Exception("SFP1"._("Nombre invalide")."\$p_from=$p_from \$p_to=$p_to");
690  }
691  // retrieve the date
692  $pPeriode = new Periode($p_cn);
693  $a_start = $pPeriode->get_date_limit($p_from);
694  $a_end = $pPeriode->get_date_limit($p_to);
695  if ($a_start==null||$a_end==null)
696  {
697  throw new Exception(__FILE__.__LINE__.sprintf(_('Attention periode
698  non trouvee periode p_from= %s p_to_periode = %s'), $p_from, $p_to));
699  }
700 
701 
702  $p_from = $a_start['p_start'];
703  $p_to = $a_end['p_end'];
704  }else {
705  if ( isDate($p_from)==NULL || isDate($p_to)==NULL){
706  throw new Exception("SFP2"._("Date invalide")."\$p_from=$p_from \$p_to=$p_to");
707  }
708  }
709  if ($p_from==$p_to)
710  {
711  $periode=" $p_field = (select p_id from parm_periode ".
712  " where ".
713  " p_start = to_date('$p_from','DD.MM.YYYY')) ";
714  }
715  else
716  {
717  $periode="$p_field in (select p_id from parm_periode ".
718  " where p_start >= to_date('$p_from','DD.MM.YYYY') and p_end <= to_date('$p_to','DD.MM.YYYY')) ";
719  }
720  return $periode;
721 }

References $periode, $pPeriode, echo_error(), exit, isDate(), and sql_string().

Referenced by Impress\compute_periode(), Anc_Operation\get_balance(), Acc_Account_Ledger\get_row(), Acc_Ledger_History_Financial\get_row(), Acc_Ledger_History_Sale\get_row(), Acc_Ledger_History_Purchase\get_row(), Acc_Ledger_History_Generic\get_row(), Fiche\get_row(), Acc_Ledger_History_Generic\get_rowSimple(), Acc_Ledger\get_solde(), Impress\parse_formula(), Acc_Bilan\verify(), and Acc_Bilan\warning().

+ Here is the call graph for this function:

◆ sql_string()

sql_string (   $p_string)

Fix the problem with the quote char for the database.

Parameters
$p_string
Returns
a string which won't let strange char for the database

Definition at line 504 of file ac_common.php.

505 {
506  $p_string = trim($p_string);
507  if (strlen($p_string) == 0)
508  return null;
509  $p_string = str_replace("'", "''", $p_string);
510  $p_string = str_replace('\\', '\\\\', $p_string);
511  return $p_string;
512 }

Referenced by Anc_Plan\add(), Fiche_Def\Add(), Acc_Ledger_Search\build_search_sql(), Card_Multiple\build_sql(), Fiche\build_sql(), Card_Multiple\count_sql(), Follow_Up\create_query(), Stock\create_query_histo(), Follow_Up\filter_by_tag(), FormatString(), Pre_operation\get_operation(), Acc_Ledger_Sale\insert(), Fiche\insert(), Acc_Ledger_Purchase\insert(), Acc_Ledger_Fin\insert(), Acc_Ledger_Purchase\insert_no_deductible(), Acc_Parm_Code\save(), Fiche_Def\save_class_base(), Fiche_Def\SaveLabel(), HtmlInput\select_stock(), sql_filter_per(), contact\Summary(), Fiche\Summary(), Anc_Plan\update(), and Card_Property\update().

◆ td()

td (   $p_string = '',
  $p_extra = '' 
)

surround the string with td

Parameters
$p_stringstring to surround by TD
$p_extraextra info (class, style, javascript...)
Returns
string surrounded by td

Definition at line 83 of file ac_common.php.

84 {
85  return '<td ' . $p_extra . '>' . $p_string . '</td>';
86 }

Referenced by Acc_Ledger_Fin\confirm(), Acc_Ledger\confirm(), Acc_Ledger_Sale\confirm(), Acc_Ledger_Purchase\confirm(), Pre_Op_Advanced\display(), Fiche\Display(), display_dashboard_operation(), Acc_Bilan\display_form(), Anc_Print\display_form(), Anc_Balance_Double\display_html(), Anc_Listing\display_html(), Anc_Balance_Simple\display_html(), Anc_GrandLivre\display_html(), Anc_Table\display_html(), Anc_Acc_List\display_html(), Forecast_Item_MTable\display_row(), Periode_Ledger_Table\display_row(), Follow_Up_Other_Concerned\display_row(), Manage_Table_SQL\display_row(), Fiche\display_row(), Card_Attribut_MTable\display_row_custom(), Acc_Report_MTable\display_row_custom(), Mobile_Device_MTable\display_row_custom(), Manage_Table_SQL\display_row_custom(), Periode\display_row_global(), display_security_fieldset(), Acc_Ledger_History_Generic\export_accounting_html(), Print_Operation_Currency\export_html(), Acc_Ledger_History_Generic\export_oneline_html(), Anc_Group_Operation\form(), Document_modele\form(), Periode\form_periode_add(), Anc_Operation\html_table(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), ITva_Popup\input(), IAncCard\input(), Template_Card_Category\input(), IPoste\input(), ICard\input(), Acc_Ledger\input(), Acc_Ledger_Purchase\input(), Mobile_Device_MTable\input_custom(), Acc_Ledger_Fin\insert(), Acc_Ledger_Search\list_operation(), Acc_Ledger_Search\list_operation_to_reconcile(), Document_modele\myList(), Follow_Up\myList(), Html_Table\sql2table(), Fiche\Summary(), Acc_Balance\summary_display(), and Acc_Bilan\verify().

◆ th()

th (   $p_string,
  $p_extra = '',
  $raw = '' 
)

◆ tr()

tr (   $p_string,
  $p_extra = '' 
)

◆ transform_sql_filter_per()

transform_sql_filter_per (   $p_sql)

transform the SQL for ANALYTIC table operation_analytique

See also
sql_filter_per
Parameters
string$p_sql

Definition at line 653 of file ac_common.php.

654 {
655  $result=str_replace("j_tech_per in (select p_id from parm_periode where","",$p_sql);
656  $result=str_replace("jr_tech_per in (select p_id from parm_periode where","",$result);
657  $result=str_replace("j_tech_per = (select p_id from parm_periode where p_start "," oa_date ",$result);
658  $result=str_replace("p_start >= to_date","oa_date >= to_date",$result);
659  $result=str_replace("p_end <= to_date","oa_date <= to_date",$result);
660 
661  $result="( $result";
662  return $result;
663 }

References $result.

◆ what_os()

what_os ( )

try to determine on what os you are running the pĥpcompte server

Returns
0 it is a windows 1 it is a Unix like

Definition at line 799 of file ac_common.php.

800 {
801  $inc_path = get_include_path();
802 
803  if (strpos($inc_path, ";") != 0)
804  {
805  $os = 0; /* $os is 0 for windoz */
806  }
807  else
808  {
809  $os = 1; /* $os is 1 for unix */
810  }
811  return $os;
812 }
$m
$m
Definition: ajax_create_menu.php:11
nbm
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
$dir
$dir
Definition: file-dir.php:3
endif
endif
Definition: ajax_bookmark.php:104
$ret
$ret
Definition: ajax_display_letter.php:51
display_menu
display_menu($p_menuid)
Display a menu @global type $g_user.
Definition: ac_common.php:1141
Periode
For the periode tables parm_periode and jrn_periode.
Definition: periode.class.php:32
style
$opd_description style
Definition: ajax_mod_predf_op.php:52
$string
$string
Definition: ajax_get_receipt.php:54
HtmlInput\button_hide
static button_hide($div_name)
Hide the HTML popup.
Definition: html_input.class.php:445
generate_random_string
generate_random_string($car)
Create randomly a string.
Definition: ac_common.php:1468
$access_code
$access_code
Definition: impress_rapport.inc.php:27
Acc_Ledger_Purchase
Handle the ledger of purchase,.
Definition: acc_ledger_purchase.class.php:33
IText
Html Input.
Definition: itext.class.php:29
what_os
what_os()
try to determine on what os you are running the pĥpcompte server
Definition: ac_common.php:799
HtmlInput\button_close
static button_close($div_name)
close button for the HTML popup
Definition: html_input.class.php:430
$_POST
$_POST['ac']
Definition: do.php:365
HttpInput
manage the http input (get , post, request) and extract from an array
Definition: http_input.class.php:37
echo_warning
echo_warning($p_string)
warns
Definition: ac_common.php:582
COMPTA_MIN_YEAR
const COMPTA_MIN_YEAR
Definition: constant.php:132
$href
$href
Definition: adm.inc.php:31
p
p($p_string)
Definition: ac_common.php:39
tr
tr($p_string, $p_extra='')
Definition: ac_common.php:88
create_script
create_script($p_string)
create the HTML for adding the script tags around of the script
Definition: function_javascript.php:38
$ledger_id
$ledger_id
Definition: ajax_periode.php:53
Acc_Ledger
Class for jrn, class acc_ledger for manipulating the ledger.
Definition: acc_ledger.class.php:32
format_date
format_date($p_date, $p_from_format='YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
format the date, when taken from the database the format is MM-DD-YYYY
Definition: ac_common.php:844
DatabaseCore\fetch_array
static fetch_array($ret, $p_indice=0)
wrapper for the function pg_fetch_array
Definition: database_core.class.php:745
HtmlInput\button_action
static button_action($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
button Html with javascript
Definition: html_input.class.php:494
$p_msg
if($request_jrn !="" && $g_user->check_jrn($request_jrn) !='W') $p_msg
Definition: compta_ach.inc.php:45
$_GET
$_GET['qcode']
Definition: category_followup.inc.php:53
$sql
$sql
Definition: ajax_add_concerned_card.php:100
COMPTA_MAX_YEAR
const COMPTA_MAX_YEAR
Definition: constant.php:131
$ac
if(isset($_REQUEST['show'])) if(isset($_REQUEST['del'])) $ac
Definition: ajax_todo_list.php:85
$type
$type
Definition: balance_age.inc.php:28
$output
$output
Definition: export_anc_axis_csv.php:40
$ix
$ix
Definition: dashboard.php:161
isDate
isDate($p_date)
Definition: ac_common.php:239
h
h($p_string)
to protect again bad characters which can lead to a cross scripting attack the string to be diplayed ...
Definition: ac_common.php:35
$code
$code
Definition: ajax_bookmark.php:80
HtmlInput\title_box
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
Definition: html_input.class.php:838
$sep
$sep
Definition: acc_ledger-input_extra_info.php:52
SVNINFO
const SVNINFO
Definition: constant.php:93
$text
$text
Definition: follow_up_detail_display.php:31
$result
$result
Definition: anc_great_ledger.inc.php:26
$periode
$periode
Definition: ajax_display_letter.php:48
sql_string
sql_string($p_string)
Fix the problem with the quote char for the database.
Definition: ac_common.php:504
Dossier\connect
static connect()
Definition: dossier.class.php:282
$array
$array
Definition: ajax_add_concerned_card.php:115
$inc_path
$inc_path
Definition: constant.php:31
$p_date
$p_date
Definition: export_balance_age_csv.php:46
id
$input_from id
Definition: balance.inc.php:63
$ctl
$ctl
Definition: ajax_action_remove_concerned.php:53
Acc_Ledger_Sale
Handle the ledger of sold,.
Definition: acc_ledger_sale.class.php:36
find_default_module
find_default_module()
Definition: ac_common.php:982
ENT_QUOTES
ENT_QUOTES
Definition: message_javascript.php:65
$all
$all
Definition: company.inc.php:137
$g_user
global $g_user
Find the default module or the first one.
Definition: action.inc.php:24
$value
$value
Definition: export_document.php:41
$file
$file
Definition: export_document_template.php:50
$os
$os
Definition: constant.php:64
$i
$i
Definition: action_document_type_mtable_input.php:83
h2
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
Acc_Ledger_Fin
the class Acc_Ledger_Fin inherits from Acc_Ledger, this object permit to manage the financial ledger
Definition: acc_ledger_fin.class.php:35
$selected
$selected
Definition: balance.inc.php:100
j
j($p_string)
escape correctly php string to javascript
Definition: ac_common.php:96
$pos
$pos
Definition: ajax_anc_key_compute.php:51
$a
$a
Definition: ajax_add_concerned_card.php:108
DatabaseCore\num_row
static num_row($ret)
wrapper for the function pg_NumRows
Definition: database_core.class.php:734
h2info
h2info($p_string)
Definition: ac_common.php:63
smaller_date
smaller_date($p_date)
shrink the date, make a date shorter for the printing
Definition: ac_common.php:830
$label
$label
Definition: impress_jrn.inc.php:115
isNumber
isNumber($p_int)
Definition: ac_common.php:218
$http
$http
Definition: action.common.inc.php:33
$s
$s
Definition: export_gl_pdf.php:88
$html
if(headers_sent() &&DEBUGNOALYSS > 0) $html
Definition: ajax_action_concerned_list.php:56
$url
$url
Definition: ajax_bookmark.php:66
$title
$title
Definition: export_balance_csv.php:72
$obj
$obj
Definition: ajax_accounting.php:43
$r
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
Definition: ajax_add_concerned_card.php:53
set_language
set_language()
set the lang thanks the _SESSION['g_lang'] var.
Definition: ac_common.php:747
$_REQUEST
$_REQUEST['ac']
Definition: ajax_search_action.php:26
escape_xml
escape_xml($p_xml)
When data are transfered thanks ajax in a xml document, the xml can not contains some character,...
Definition: function_javascript.php:2720
exit
for($e=0; $e< count($afiche); $e++) exit
Definition: export_fiche_balance_csv.php:109
endfor
endfor
Definition: stock_cfg.inc.php:108
echo_error
echo_error($p_log, $p_line="", $p_message="")
log error into the /tmp/noalyss_error.log it doesn't work on windows
Definition: ac_common.php:169
$pPeriode
if(sizeof($array)==0) $pPeriode
Definition: export_balance_pdf.php:101
$cn
$cn
Definition: ajax_anc_accounting.php:30
put_global
put_global($array)
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)
Definition: ac_common.php:1228
$Res
$Res
Definition: export_security_pdf.php:117
$date
$date
Definition: action_display_short.php:30
IButton
Html Input.
Definition: ibutton.class.php:30
Database
contains the class for connecting to Noalyss
Definition: database.class.php:32
find_default_menu
find_default_menu($pn_menu)
Find the menu marked as default in the given profile.
Definition: ac_common.php:1500
$ledger
$ledger
Definition: ajax_anc_key_choice.php:36
table
$all table
Definition: company.inc.php:138
load_all_script
load_all_script()
load all the javascript only one time
Definition: function_javascript.php:2752
is_msie
is_msie()
Check if we use IE 8 or 9.
Definition: ac_common.php:1386
$style
$style
Definition: ajax_preference.php:51
$tmp
$tmp
Definition: export_document_template.php:40
th
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
td
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
$var
$var
Definition: ajax_card.php:64
HtmlInput\hidden
static hidden($p_name, $p_value, $p_id="")
Definition: html_input.class.php:218
$p_array
$p_array
Definition: ajax_view_mod_stock.php:33
$p_id
$p_id
Definition: ajax_accounting.php:33
value
$q value
Definition: ajax_add_concerned_card.php:59
$js
$js
Definition: ajax_tag_list.php:32
HtmlInput\detail_op
static detail_op($p_jr_id, $p_mesg)
return a string containing the html code for calling the modifyOperation
Definition: html_input.class.php:271
compute_variable
compute_variable($p_string)
the string has the format a=b&c=d, it is parsed and an array[][key,value] is returned
Definition: ac_common.php:1245