common utilities for a lot of procedure, classe More...
Go to the source code of this file.
Functions | |
ajax_disconnected ($div) | |
Should a dialog box that you are disconnected for ajax. | |
ajax_xml_error ($p_code, $p_string) | |
alert ($p_msg, $buffer=false) | |
alert in javascript | |
cmpDate ($p_date, $p_date_oth) | |
Compare 2 dates. | |
compute_variable ($p_string) | |
the string has the format a=b&c=d, it is parsed and an array[][key,value] is returned | |
Decode ($p_html) | |
Decode the html for the widegt richtext and remove newline. | |
display_dashboard_operation ($p_array, $p_title, $p_div) | |
echo_error ($p_log, $p_line="", $p_message="") | |
log error into the /tmp/noalyss_error.log it doesn't work on windows | |
echo_warning ($p_string) | |
warns | |
find_default_module () | |
Find the default module or the first one $g_user $g_user. | |
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 | |
FormatString ($p_string) | |
replaced by sql_string | |
get_array_column ($p_array, $key) | |
getPeriodeFromMonth ($p_cn, $p_date) | |
Return the period corresponding to the date. | |
getPeriodeName ($p_cn, $p_id, $pos='p_start') | |
Show the periode which found thanks its id. | |
h ($p_string) | |
to protect again bad characters which can lead to a cross scripting attack the string to be diplayed must be protected | |
h1 ($p_string, $p_class="") | |
h2 ($p_string, $p_class="", $raw="") | |
h2info ($p_string) | |
hb ($p_string) | |
hi ($p_string) | |
html_min_page_start ($p_theme="", $p_script="", $p_script2="") | |
Minimal page header for each page, used for small popup window. | |
html_page_start ($p_theme="", $p_script="", $p_script2="") | |
Default page header for each page. | |
html_page_stop () | |
end tag | |
isDate ($p_date) | |
isNumber (&$p_int) | |
j ($p_string) | |
escape correctly php string to javascript | |
nb ($p_number) | |
format the number for the CSV export | |
nbm ($p_number) | |
format the number with a sep. | |
NoAccess ($js=1) | |
Echo no access and stop. | |
put_global ($array) | |
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter) | |
set_language () | |
set the lang thanks the _SESSION['g_lang'] var. | |
show_menu ($module, $idx) | |
show the module $g_user | |
show_module ($selected) | |
ShowItem ($p_array, $p_dir='V', $class="mtitle", $class_ref="mtitle", $default="", $p_extra="") | |
/* | |
shrink_date ($p_date) | |
shrink the date, make a date shorter for the printing | |
smaller_date ($p_date) | |
shrink the date, make a date shorter for the printing | |
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. | |
sql_string ($p_string) | |
Fix the problem with the quote char for the database. | |
td ($p_string='', $p_extra='') | |
surround the string with td | |
th ($p_string, $p_extra='', $raw='') | |
tr ($p_string, $p_extra='') | |
what_os () | |
try to determine on what os you are running the pĥpcompte server |
common utilities for a lot of procedure, classe
Definition in file ac_common.php.
ajax_disconnected | ( | $ | div | ) |
Should a dialog box that you are disconnected for ajax.
if $_SESSION['g_user'] is not set : echo a warning
Definition at line 770 of file ac_common.php.
{ /** * if $_SESSION['g_user'] is not set : echo a warning */ if (!isset($_SESSION['g_user'])) { $script = 'var a=$("' . $div . '");a.style.height="70%";a.style.width="70%";'; $script.='a.style.top=posY-20+offsetY;a.style.left=posX+offsetX;'; $script = create_script($script); $html = $script; $html.=HtmlInput::anchor_close($div); $html.='<div>'; $html.=h2(_('Données non disponibles'), 'class="title" style="width:auto"'); $html.=h2(_('Veuillez vous reconnecter'), 'class="error"'); $html.=alert(_("Déconnecté"), true); $html = escape_xml($html); header('Content-type: text/xml; charset=UTF-8'); echo <<<EOF <?xml version="1.0" encoding="UTF-8"?> <data> <ctl>$div</ctl> <code>$html</code> </data> EOF; exit(); } }
ajax_xml_error | ( | $ | p_code, |
$ | p_string | ||
) |
Definition at line 1040 of file ac_common.php.
alert in javascript
$p_msg | is the message |
$buffer | if false, echo directly and execute the javascript, if $buffer is true, the alert javascript is in the return string |
Definition at line 633 of file ac_common.php.
Referenced by Fiche_Def\Add(), add_menu(), add_plugin(), add_row(), ajax_error_saldo(), ajax_get_failure(), ajax_misc_failure(), ajaxFid(), anc_refresh_remain(), ask_navigator(), boxsearch_card(), cal(), User\Check(), User\check_dossier(), check_hour(), Extension\check_version(), compute_total_table(), create_menu(), Anc_Group\display_html(), Anc_Acc_List\display_html(), display_periode(), dsp_letter(), encodeJSON(), error_box(), error_compute_ledger(), error_dsp_letter(), error_get_pj(), error_get_predef(), errorFid(), errorPoste(), errorRemoveDoc(), errorRemoveStock(), fill_box(), gestion_add_row(), get_properties(), hide_ledger_choice(), infodiv(), Acc_Ledger_Fin\input(), Document_type\insert(), Todo_List\insert(), Extension\insert_plugin(), js_include(), ledger_add_row(), mod_menu(), mod_plugin(), modify_document_success_box(), modify_menu(), op_save(), popup_select_tva(), profile_show(), Fiche\remove(), remove_action(), remove_bookmark(), Extension\remove_plugin(), result_card_search(), result_poste_search(), result_search_action(), Acc_Parm_Code\save(), save_bookmark(), save_card_category(), User\save_password(), save_periode(), search_action(), search_anc_form(), search_ca(), search_card(), search_letter(), search_operation(), search_poste(), set_action_related(), Document_type\set_number(), set_preference(), set_reconcile(), set_tva_label(), show_bookmark(), show_dbname(), show_fin_chdate(), show_ledger_choice(), show_reconcile(), show_tag(), stock_add_row(), success_box(), success_cat_doc_remove(), success_display_periode(), success_dsp_letter(), success_get_last_date(), success_misc(), success_popup_select_tva(), success_set_tva_label(), success_update_bank(), successFill_ipopcard(), successRemoveComment(), successRemoveDoc(), successRemoveOp(), successRemoveStock(), test(), ICard\test_me(), Acc_Ledger\test_me(), todo_list_show(), todo_list_show_error(), todo_list_show_success(), Document_type\update(), Todo_List\update(), update_card(), update_history_account(), update_history_card(), Extension\update_plugin(), update_predef(), update_row(), Acc_Report\upload(), Menu_Ref\verify(), verify_ca(), and view_action().
cmpDate | ( | $ | p_date, |
$ | p_date_oth | ||
) |
Compare 2 dates.
p_date | |
p_date_oth |
Definition at line 170 of file ac_common.php.
References isDate().
Referenced by Fiche\HtmlTable(), Acc_Ledger_Fin\verify(), Acc_Ledger_Sold\verify(), and Acc_Ledger_Purchase\verify().
{ date_default_timezone_set('Europe/Brussels'); $l_date = isDate($p_date); $l2_date = isDate($p_date_oth); if ($l_date == null || $l2_date == null) { throw new Exception("erreur date [$p_date] [$p_date_oth]"); } $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; }
compute_variable | ( | $ | p_string | ) |
the string has the format a=b&c=d, it is parsed and an array[][key,value] is returned
$p_string |
Definition at line 1025 of file ac_common.php.
Decode | ( | $ | p_html | ) |
Decode the html for the widegt richtext and remove newline.
$p_html | string to decode |
Definition at line 574 of file ac_common.php.
{ $p_html = str_replace('%0D', '', $p_html); $p_html = str_replace('%0A', '', $p_html); $p_html = urldecode($p_html); return $p_html; }
display_dashboard_operation | ( | $ | p_array, |
$ | p_title, | ||
$ | p_div | ||
) |
Definition at line 1052 of file ac_common.php.
{ ?> <div id="<?php echo $p_div;?>" class="inner_box" style="display:none;top:250;left:25%;width: 50%;min-height:50%;overflow:auto;"> <?php echo HtmlInput::title_box($p_title, $p_div, "hide"); ?> <?php if (count($p_array)>0) :?> <table class="result"> <tr> <th><?php echo _('Date')?></th> <th><?php echo _('Code Interne')?></th> <th><?php echo _('Description')?></th> <th> <?php echo _('Montant')?> </th> </tr> <?php for ($i=0;$i<count($p_array);$i++): ?> <tr class="<?php echo (($i%2)==0)?'odd':'even';?>"> <td> <?php echo smaller_date(format_date($p_array[$i]['jr_date']) );?> </td> <td> <?php echo HtmlInput::detail_op($p_array[$i]['jr_id'], $p_array[$i]['jr_internal']) ?> </td> <td> <?php echo h($p_array[$i]['jr_comment']) ?> </td> <td> <?php echo nbm($p_array[$i]['jr_montant']) ?> </td> </tr> <?php endfor; ?> </table> <?php else: ?> <h2 class="notice"><?php echo _('Aucune donnée')?></h2> <?php endif; ?> </div> <?php }
echo_error | ( | $ | p_log, |
$ | p_line = "" , |
||
$ | p_message = "" |
||
) |
log error into the /tmp/noalyss_error.log it doesn't work on windows
p_log | message |
p_line | line number |
p_message | is the message |
Definition at line 148 of file ac_common.php.
Referenced by Dossier\check(), Database\format_name(), Fiche\get_row(), Fiche\get_row_date(), getPeriodeName(), isValid_deprecrated(), Document_modele\Save(), Database\save_upload_document(), sql_filter_per(), and Document_modele\update().
echo_warning | ( | $ | p_string | ) |
warns
p_string | error message gen :
|
Definition at line 524 of file ac_common.php.
References echo.
Referenced by Document\Generate(), and Dossier\synchro_admin().
{ echo '<H2 class="error">' . $p_string . "</H2>"; }
Find the default module or the first one $g_user $g_user.
Definition at line 861 of file ac_common.php.
{ global $g_user; $cn = Dossier::connect(); $default_module = $cn->get_array("select me_code from profile_menu join profile_user using (p_id) where p_type_display='M' and user_name=$1 and pm_default=1", array($g_user->login)); /* * Try to find the smallest order for module */ if (empty($default_module)) { $default_module = $cn->get_array("select me_code from profile_menu join profile_user using (p_id) where p_type_display='M' and user_name=$1 order by p_order limit 1", array($g_user->login)); // if no default try to find the default menu if ( empty ($default_module)) { $default_module = $cn->get_array("select me_code from profile_menu join profile_user using (p_id) where p_type_display='E' and user_name=$1 and pm_default=1 ", array($g_user->login)); /* * Try to find a default menu by order */ if (empty ($default_module)) { $default_module = $cn->get_array("select me_code from profile_menu join profile_user using (p_id) where user_name=$1 and p_order=(select min(p_order) from profile_menu join profile_user using (p_id) where user_name=$2) limit 1", array($g_user->login, $g_user->login)); } /* * if nothing found, there is no profile for this user => exit */ if (empty ($default_module)) { echo_warning(_("Utilisateur n'a pas de profile, votre administrateur doit en configurer un dans CFGSEC")); exit(); } } return $default_module[0]['me_code']; } if (count($default_module) > 1) { // return the first module found return $default_module[0]['me_code']; } elseif (count($default_module) == 1) { return $default_module[0]['me_code']; } }
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
$p_date | format |
@return | date in the format DD.MM.YYYY |
Definition at line 728 of file ac_common.php.
Referenced by Stock\build_tmp_table(), Anticipation\display(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), Follow_Up\myList(), and Document\Replace().
{ if ($p_from_format == 'YYYY-MM-DD') { $date = explode('-', $p_date); if (count($date) != 3) return $p_date; } if ($p_from_format == 'DD.MM.YYYY') { $temp_date = explode('.', $p_date); if (count($temp_date) != 3) return $p_date; $date[0] = $temp_date[2]; // 0 is year $date[1] = $temp_date[1]; // 1 for month $date[2] = $temp_date[0]; // 2 for day } switch ($p_to_format) { case 'DD.MM.YYYY': $str_date = $date[2] . '.' . $date[1] . '.' . $date[0]; break; case 'YYYY-MM-DD': $str_date = $date[0] . '-' . $date[1] . '-' . $date[2]; break; case 'YYYYMMDD': $str_date = $date[0] . $date[1] . $date[2]; break; case 'YYYY/MM/DD': $str_date = $date[0] . '/' . $date[1] . '/' . $date[2]; break; } return $str_date; }
FormatString | ( | $ | p_string | ) |
replaced by sql_string
Definition at line 424 of file ac_common.php.
References sql_string().
{ return sql_string($p_string); }
get_array_column | ( | $ | p_array, |
$ | key | ||
) |
getPeriodeFromMonth | ( | $ | p_cn, |
$ | p_date | ||
) |
Return the period corresponding to the date.
p_cn | database connection |
p_date | the month + year 'MM.YYYY' |
Definition at line 560 of file ac_common.php.
{ $R = $p_cn->get_value("select p_id from parm_periode where to_char(p_start,'DD.MM.YYYY') = '01.$p_date'"); if ($R == "") return -1; return $R; }
getPeriodeName | ( | $ | p_cn, |
$ | p_id, | ||
$ | pos = 'p_start' |
||
) |
Show the periode which found thanks its id.
$p_cn | database connection |
p_id | |
pos | Start or end |
Definition at line 540 of file ac_common.php.
References $ret, and echo_error().
{ if ($pos != 'p_start' and $pos != 'p_end') echo_error('ac_common.php' . "-" . __LINE__ . ' UNDEFINED PERIODE'); $ret = $p_cn->get_value("select to_char($pos,'Mon YYYY') as t from parm_periode where p_id=$p_id"); return $ret; }
h | ( | $ | p_string | ) |
to protect again bad characters which can lead to a cross scripting attack the string to be diplayed must be protected
Definition at line 36 of file ac_common.php.
Referenced by check_hour(), Acc_Ledger_Fin\confirm(), Acc_Ledger_Sold\confirm(), Acc_Ledger_Purchase\confirm(), Acc_Ledger\confirm(), Acc_Ledger\create_document(), ITextarea\display(), ISelect\display(), Anticipation\display(), Anc_Balance_Simple\display_html(), Acc_Operation\display_jrnx_detail(), Acc_Account\form(), Fiche\get_gestion_title(), Acc_Ledger\get_row(), Anc_Operation\html_table(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), Acc_Ledger_Purchase\input(), Acc_Ledger_Sold\input(), Fiche_Def\input_detail(), Fiche\insert(), Acc_Ledger\list_operation(), Acc_Ledger\list_operation_to_reconcile(), Acc_Ledger\listing(), PDF\LongLine(), Database\make_array(), Document_modele\myList(), Fiche_Def\myList(), Follow_Up\myList(), Acc_Ledger\select_ledger(), User\show_dossier(), Html_Table\sql2table(), Fiche\update(), Fiche_Attr\verify(), Acc_Ledger_Purchase\verify(), and Acc_Bilan\warning().
{
return htmlspecialchars($p_string);
}
h1 | ( | $ | p_string, |
$ | p_class = "" |
||
) |
Definition at line 70 of file ac_common.php.
{ return '<h1 ' . $p_class . '>' . htmlspecialchars($p_string) . '</h1>'; }
h2 | ( | $ | p_string, |
$ | p_class = "" , |
||
$ | raw = "" |
||
) |
Definition at line 66 of file ac_common.php.
Referenced by Fiche\blank(), Fiche\Display(), Acc_Ledger\display_search_form(), Acc_Ledger_Fin\input(), Default_Menu\test_me(), HtmlInput\title_box(), and Follow_Up\Update().
{ return '<h2 ' . $p_class . '>' . $raw.htmlspecialchars($p_string) . '</h2>'; }
h2info | ( | $ | p_string | ) |
Definition at line 61 of file ac_common.php.
Referenced by Anc_Balance_Double\display_html(), Fiche_Attr\test_me(), and Profile_Menu_sql\test_me().
{ return '<h2 class="info">' . htmlspecialchars($p_string) . '</h2>'; }
hb | ( | $ | p_string | ) |
Definition at line 51 of file ac_common.php.
Referenced by Acc_Ledger_Sold\confirm(), and Acc_Ledger_Purchase\confirm().
{ return '<b>' . htmlspecialchars($p_string) . '</b>'; }
hi | ( | $ | p_string | ) |
Definition at line 46 of file ac_common.php.
{ return '<i>' . htmlspecialchars($p_string) . '</i>'; }
html_min_page_start | ( | $ | p_theme = "" , |
$ | p_script = "" , |
||
$ | p_script2 = "" |
||
) |
Minimal page header for each page, used for small popup window.
p_theme | default theme |
$p_script | |
$p_script2 | another js script |
Definition at line 342 of file ac_common.php.
References $cn, $Res, $s, $style, echo, Database\fetch_array(), and Database\num_row().
{ $cn = new Database(); if ($p_theme != "") { $Res = $cn->exec_sql("select the_filestyle from theme where the_name='" . $p_theme . "'"); if (Database::num_row($Res) == 0) $style = "style-classic.css"; else { $s = Database::fetch_array($Res, 0); $style = $s['the_filestyle']; } } else { $style = "style-classic.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>NOALYSS</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; } }
html_page_start | ( | $ | p_theme = "" , |
$ | p_script = "" , |
||
$ | p_script2 = "" |
||
) |
Default page header for each page.
p_theme | default theme |
$p_script | |
$p_script2 | another js script Must be called only once |
Definition at line 257 of file ac_common.php.
References $_REQUEST, $cn, $m, $Res, $s, $style, HtmlInput\button_action(), echo, Database\fetch_array(), Database\num_row(), set_language(), and HtmlInput\title_box().
Referenced by Acc_Ledger\test_me().
{ require_once 'class_html_input.php'; // check not called twiced static $already_call=0; if ( $already_call==1)return; $already_call=1; $cn = new Database(); if ($p_theme != "") { $Res = $cn->exec_sql("select the_filestyle from theme where the_name='" . $p_theme . "'"); if (Database::num_row($Res) == 0) $style = "style-classic.css"; else { $s = Database::fetch_array($Res, 0); $style = $s['the_filestyle']; } } else { $style = "style-classic.css"; } // end if $title="NOALYSS"; if ( isset ($_REQUEST['ac'])) { if (strpos($_REQUEST['ac'],'/') <> 0) { $m= explode('/',$_REQUEST['ac']); $title=$m[count($m)-1]." ".$title; } else $title=$_REQUEST['ac']." ".$title; } echo '<!doctype html>'; echo "<HTML>"; if ($p_script2 != "") $p_script2 = '<script src="' . $p_script2 . '" type="text/javascript"></script>'; echo "<HEAD> <TITLE>$title</TITLE> <link rel=\"icon\" type=\"image/ico\" href=\"favicon.ico\" /> <META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"> <LINK REL=\"stylesheet\" type=\"text/css\" href=\"$style\" media=\"screen\"> <link rel=\"stylesheet\" type=\"text/css\" href=\"style-print.css\" media=\"print\">" . $p_script2 . " "; 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>"; echo '<div id="info_div"></div>'; echo '<div id="error_div">'. HtmlInput::title_box(_("Erreur"), 'error_div','hide'). '<div id="error_content_div">'. '</div>'. '<p style="text-align:center">'. HtmlInput::button_action('Valider','$(\'error_div\').style.visibility=\'hidden\';$(\'error_content_div\').innerHTML=\'\';'). '</p>'. '</div>'; // language if (isset($_SESSION['g_lang'])) { set_language(); } }
html_page_stop | ( | ) |
isDate | ( | $ | p_date | ) |
Definition at line 218 of file ac_common.php.
References trim().
Referenced by Acc_Ledger\build_search_sql(), Todo_List\check(), Anc_Print\check(), cmpDate(), Acc_Ledger_Fin\confirm(), Follow_Up\create_query(), Acc_Reconciliation\filter_date(), Periode\insert(), Acc_Operation\operation_update_date_limit(), Stock_Goods\record_save(), Acc_Ledger\reverse(), Acc_Ledger_Fin\verify(), Acc_Ledger_Purchase\verify(), Acc_Ledger_Sold\verify(), and Todo_List\verify().
{ if (strlen(trim($p_date)) == 0) return null; if (preg_match("/^[0-9]{1,2}\.[0-9]{1,2}\.20[0-9]{2}$/", $p_date) == 0) { return null; } else { $l_date = explode(".", $p_date); if (sizeof($l_date) != 3) return null; if ($l_date[2] > COMPTA_MAX_YEAR || $l_date[2] < COMPTA_MIN_YEAR) { return null; } if (checkdate($l_date[1], $l_date[0], $l_date[2]) == false) { return null; } } return $p_date; }
isNumber | ( | &$ | p_int | ) |
Definition at line 197 of file ac_common.php.
References trim().
Referenced by Acc_Ledger\build_search_sql(), Todo_List\check(), Acc_Ledger\convert_from_follow(), Follow_Up\create_query(), Stock\create_query_histo(), Acc_Ledger\display_ledger(), Follow_Up\filter_by_tag(), Anc_Account\format_data(), Acc_Report_Row\from_array(), Follow_Up_Detail\from_array(), Lettering_Account\get_filter(), Lettering_Card\get_filter(), ITva_Popup\input(), Acc_Reconciliation\insert(), Acc_Ledger_Fin\insert(), Fiche\insert(), Acc_Reconciliation\insert_rapt(), Acc_Reconciliation\remove(), Document\replace_special_tag(), Document_modele\Save(), Acc_Ledger_Fin\verify(), Fiche_Attr\verify(), Acc_Ledger_Purchase\verify(), Acc_Ledger_Sold\verify(), and Acc_Ledger\verify_ledger().
{ if (strlen(trim($p_int)) == 0) return 0; if (is_numeric($p_int) === true) return 1; else return 0; }
j | ( | $ | p_string | ) |
escape correctly php string to javascript
Definition at line 93 of file ac_common.php.
References $a.
Referenced by action_tag_add(), action_tag_remove(), action_tag_select(), alert(), calendar_zoom(), Document_type\insert(), save_tag(), search_add_tag(), search_clear_tag(), and search_display_tag().
nb | ( | $ | p_number | ) |
format the number for the CSV export
$p_number | number |
Definition at line 104 of file ac_common.php.
References $r.
Referenced by Sort_Table\__construct(), Acc_Ledger\__construct(), Sort_Table\add(), anc_add_row(), Acc_Ledger\convert_from_follow(), Anc_Balance_Simple\display_csv(), Anc_Balance_Double\display_csv(), Anc_Group\export_csv(), Anc_Table\export_csv(), Anc_Acc_List\export_csv(), for_add_row(), gestion_add_row(), Sort_Table\get_header(), Sort_Table\get_sql_order(), hide_ledger_choice(), Acc_Ledger\input(), ledger_add_row(), ledger_fin_add_row(), quick_writing_add_row(), show_fin_chdate(), and stock_add_row().
nbm | ( | $ | p_number | ) |
format the number with a sep.
for the thousand
$p_number | number |
Definition at line 116 of file ac_common.php.
References $a, $r, exit, and trim().
Referenced by Acc_Ledger_Fin\confirm(), Acc_Ledger_Sold\confirm(), Acc_Ledger_Purchase\confirm(), Acc_Ledger\confirm(), Anc_Balance_Double\display_html(), Anc_Balance_Simple\display_html(), Anc_GrandLivre\display_html(), Anc_Acc_List\display_html(), Anc_Balance_Simple\display_pdf(), Print_Ledger_Financial\export(), Print_Ledger_Misc\export(), Print_Ledger_Detail\export(), Print_Ledger_Detail_Item\export(), Print_Ledger_Simple\export(), Print_Ledger_Simple\Footer(), Print_Ledger_Simple\Header(), Anc_Operation\html_table(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), Acc_Ledger_Fin\insert(), Acc_Ledger\list_operation(), Acc_Ledger\list_operation_to_reconcile(), and Fiche\Summary().
NoAccess | ( | $ | js = 1 | ) |
Echo no access and stop.
Definition at line 404 of file ac_common.php.
References $js, echo, and exit.
Referenced by Stock_Goods\input().
{ if ($js == 1) { echo "<script>"; echo "alert ('" . _('Cette action ne vous est pas autorisée Contactez votre responsable') . "');"; echo "</script>"; } else { echo '<div class="redcontent">'; echo '<h2 class="error">' . _(' Cette action ne vous est pas autorisée Contactez votre responsable') . '</h2>'; echo '</div>'; } exit - 1; }
put_global | ( | $ | array | ) |
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)
$array | [key] [value] |
Definition at line 1008 of file ac_common.php.
set_language | ( | ) |
set the lang thanks the _SESSION['g_lang'] var.
Definition at line 647 of file ac_common.php.
Referenced by html_page_start().
{ // desactivate local check if ( defined("LOCALE") && LOCALE==0 ) return; if ( ! isset ($_SESSION['g_lang'])) return; $dir = ""; // set differently the language depending of the operating system if (what_os() == 1) { $dir = setlocale(LC_MESSAGES, $_SESSION['g_lang']); if ($dir == "") { $g_lang = 'fr_FR.utf8'; $dir = setlocale(LC_MESSAGES, $g_lang); // echo '<span class="notice">' . $_SESSION['g_lang'] . ' domaine non supporté</h2>'; } bindtextdomain('messages', './lang'); textdomain('messages'); bind_textdomain_codeset('messages', 'UTF8'); return; } // for windows putenv('LANG=' . $_SESSION['g_lang']); $dir = setlocale(LC_ALL, $_SESSION['g_lang']); bindtextdomain('messages', '.\\lang'); textdomain('messages'); bind_textdomain_codeset('messages', 'UTF8'); }
show_menu | ( | $ | module, |
$ | idx | ||
) |
show the module $g_user
$module | the $_REQUEST['ac'] exploded into an array |
$idx | the index of the array : the AD code is splitted into an array thanks the slash |
Definition at line 932 of file ac_common.php.
{ global $g_user; $cn = Dossier::connect(); $amenu = $cn->get_array("select me_menu,me_code,me_url,me_javascript,me_type,me_description from v_all_menu where me_code_dep=$1 and user_name=$2 order by p_order", array($module[$idx], $g_user->login)); if (!empty($amenu) && count($amenu) > 1) { $a_style_menu=array('topmenu','menu2','menu3'); if ( $idx > count($a_style_menu)) $style_menu='menu3'; else { $style_menu=$a_style_menu[$idx]; } require 'template/menu.php'; } elseif (count($amenu) == 1) { echo '<div class="topmenu">'; echo h2info($amenu[0]['me_menu']); echo '</div>'; $module[$idx] = $amenu[0]['me_code']; } if (empty($amenu) || count($amenu) == 1) { $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type from menu_ref join profile_menu using (me_code) join profile_user using (p_id) where me_code=$1 and user_name=$2 and (me_file is not null or trim(me_file) <>'' or me_javascript is not null or trim (me_javascript) <> '')", array($module[$idx],$g_user->login)); if (count($file)==0) { echo "Configuration incorrecte pour ce module ".$module[$idx]; exit; } if ($file[0]['me_file'] != "") { if ($file[0]['me_parameter'] !== "") { // if there are paramter put them in superglobal $array=compute_variable($file[0]['me_parameter']); put_global($array); } // if file is not a plugin, include the file, otherwise // include the plugin launcher if ( $file[0]['me_type'] != 'PL') require_once $file[0]['me_file']; else require 'extension_get.inc.php'; exit(); } if ( $file[0]['me_javascript'] != '') { $js= str_replace('<DOSSIER>', dossier::id(), $file[0]['me_javascript']); echo create_script($js); } } }
show_module | ( | $ | selected | ) |
int | $selected | module selected |
Definition at line 804 of file ac_common.php.
{ global $g_user; $cn = Dossier::connect(); $amodule = $cn->get_array("select me_code,me_menu,me_url,me_javascript,p_order,me_type,me_description from v_all_menu where user_name=$1 and p_type_display='M' order by p_order", array($g_user->login)); if ($selected != -1) { require_once('template/module.php'); $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type,me_description from v_all_menu where me_code=$1 and user_name=$2", array($selected,$g_user->login)); if ( count($file ) == 0 ) { echo '</div>'; echo '</div>'; echo '<div class="content">'; echo_warning(_("Module inexistant")."[ $selected ] "); echo '</div>'; exit(); } if ($file[0]['me_file'] != '') { if ($file[0]['me_parameter'] != "") { // if there are paramter put them in superglobal $array=compute_variable($file[0]['me_parameter']); put_global($array); } // if file is not a plugin, include the file, otherwise // include the plugin launcher if ($file[0]['me_type'] != 'PL') { require_once $file[0]['me_file']; } else { // nothing : direct call to plugin } } if ( $file[0]['me_javascript'] != '') { create_script($file[0]['me_javascript']); } } }
ShowItem | ( | $ | p_array, |
$ | p_dir = 'V' , |
||
$ | class = "mtitle" , |
||
$ | class_ref = "mtitle" , |
||
$ | default = "" , |
||
$ | p_extra = "" |
||
) |
/*
store the string which print the content of p_array in a table used to display the menu
$p_array | array like ( 0=>HREF reference, 1=>visible item (name),2=>Help(opt), 3=>selected (opt) 4=>javascript (normally a onclick event) (opt) |
$p_dir | direction of the menu (H Horizontal V vertical) |
$class | CSS for TD tag |
$class_ref | CSS for the A tag |
$default | selected item |
$p_extra | extra code for the table tag (CSS or javascript) |
/*
Definition at line 459 of file ac_common.php.
References $all, $class, $href, $p_array, and $ret.
Referenced by MenuAdmin().
{ $ret = "<TABLE $p_extra>"; // direction Vertical if ($p_dir == 'V') { foreach ($p_array as $all => $href) { $javascript = (isset($href[4])) ? $href[4] : ""; $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"><A class="' . $class_ref . '" HREF="' . $href[0] . '" title="' . $title . '" ' . $javascript . '>' . $href[1] . '</A></TD></TR>'; else $ret.='<TR><TD CLASS="' . $class . '"><A class="' . $class_ref . '" HREF="' . $href[0] . '" title="' . $title . '" ' . $javascript . '>' . $href[1] . '</A></TD></TR>'; } } //direction Horizontal else if ($p_dir == 'H') { $ret.="<TR>"; foreach ($p_array as $all => $href) { $title = ""; $javascript = (isset($href[4])) ? $href[4] : ""; $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"><A class="' . $class_ref . '" HREF="' . $href[0] . '" title="' . $title . '" ' . $javascript . '>' . $href[1] . '</A></TD>'; } else { $ret.='<TD CLASS="' . $class . '"><A class="' . $class_ref . '" HREF="' . $href[0] . '" title="' . $title . '" ' . $javascript . '>' . $href[1] . '</A></TD>'; } } $ret.="</TR>"; } $ret.="</TABLE>"; return $ret; }
shrink_date | ( | $ | p_date | ) |
shrink the date, make a date shorter for the printing
$p_date | format DD.MM.YYYY |
Definition at line 704 of file ac_common.php.
smaller_date | ( | $ | p_date | ) |
shrink the date, make a date shorter for the printing
$p_date | format DD.MM.YYYY |
Definition at line 715 of file ac_common.php.
Referenced by Follow_Up\myList().
{
$str_date = substr($p_date, 0, 6) . substr($p_date, 8, 2);
return $str_date;
}
span | ( | $ | p_string, |
$ | p_extra = '' |
||
) |
Definition at line 41 of file ac_common.php.
{ return '<span ' . $p_extra . '>' . $p_string . '</span>'; }
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.
$p_cn | database conx |
$p_from | start date (date) |
$p_to | end date (date) |
$p_form | if the p_from and p_to are date or p_id |
$p_field | column name |
Definition at line 592 of file ac_common.php.
References $periode, $pPeriode, echo_error(), and exit.
Referenced by Anc_Operation\get_balance(), Acc_Account_Ledger\get_row(), Acc_Ledger\get_row(), Fiche\get_row(), Acc_Ledger\get_rowSimple(), Acc_Ledger\get_solde(), Impress\parse_formula(), Acc_Bilan\verify(), and Acc_Bilan\warning().
{ if ($p_form != 'p_id' && $p_form != 'date') { echo_error(__FILE__, __LINE__, 'Mauvais parametres '); exit(-1); } if ($p_form == 'p_id') { // retrieve the date $pPeriode = new Periode($p_cn); $a_start = $pPeriode->get_date_limit($p_from); $a_end = $pPeriode->get_date_limit($p_to); if ($a_start == null || $a_end == null) throw new Exception(__FILE__ . __LINE__ . sprintf(_('Attention periode non trouvee periode p_from= %s p_to_periode = %s'), $p_from , $p_to)); $p_from = $a_start['p_start']; $p_to = $a_end['p_end']; } if ($p_from == $p_to) $periode = " $p_field = (select p_id from parm_periode " . " where " . " p_start = 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; }
sql_string | ( | $ | p_string | ) |
Fix the problem with the quote char for the database.
$p_string |
Definition at line 435 of file ac_common.php.
References trim().
Referenced by Anc_Plan\add(), Fiche_Def\Add(), Acc_Account_Ledger\belong_ledger(), Acc_Ledger\build_search_sql(), Fiche\build_sql(), Fiche\count_by_modele(), Follow_Up\create_query(), Stock\create_query_histo(), Phpcompta_SQL\delete(), Follow_Up\filter_by_tag(), FormatString(), Anc_Account\get_by_name(), User\get_ledger(), Pre_operation_detail\get_operation(), Acc_Ledger_Sold\insert(), Acc_Ledger_Purchase\insert(), Acc_Ledger_Fin\insert(), Fiche\insert(), Acc_Ledger_Purchase\insert_no_deductible(), Acc_Parm_Code\save(), Fiche_Def\save_class_base(), Fiche_Def\SaveLabel(), HtmlInput\select_stock(), contact\Summary(), Fiche\Summary(), Anc_Plan\update(), and Fiche\update().
{ $p_string = trim($p_string); if (strlen($p_string) == 0) return null; $p_string = str_replace("'", "''", $p_string); $p_string = str_replace('\\', '\\\\', $p_string); return $p_string; }
td | ( | $ | p_string = '' , |
$ | p_extra = '' |
||
) |
surround the string with td
$p_string | string to surround by TD |
$p_extra | extra info (class, style, javascript...) |
Definition at line 81 of file ac_common.php.
Referenced by Fiche\blank(), Acc_Ledger_Fin\confirm(), Acc_Ledger_Sold\confirm(), Acc_Ledger_Purchase\confirm(), Acc_Ledger\confirm(), deleteRow(), deleteRowRec(), Pre_Op_Advanced\display(), Fiche\Display(), Acc_Bilan\display_form(), Periode\display_form_periode(), Anc_Balance_Double\display_html(), Anc_Listing\display_html(), Anc_Balance_Simple\display_html(), Anc_GrandLivre\display_html(), Anc_Acc_List\display_html(), display_security_fieldset(), Anc_Group_Operation\form(), Document_modele\form(), Anc_Account\form(), Anc_Operation\html_table(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), ITva_Popup\input(), IAncCard\input(), IPoste\input(), ICard\input(), Acc_Ledger\input(), Acc_Ledger_Fin\insert(), Acc_Ledger\list_operation(), Acc_Ledger\list_operation_to_reconcile(), Document_modele\myList(), Follow_Up\myList(), User\show_dossier(), Html_Table\sql2table(), Fiche\Summary(), and Acc_Bilan\verify().
{ return '<td ' . $p_extra . '>' . $p_string . '</td>'; }
th | ( | $ | p_string, |
$ | p_extra = '' , |
||
$ | raw = '' |
||
) |
Definition at line 56 of file ac_common.php.
Referenced by Anc_Balance_Double\display_html(), Anc_Listing\display_html(), Acc_Account_Ledger\HtmlTable(), Fiche\HtmlTable(), Acc_Ledger_Fin\insert(), Acc_Ledger\list_operation(), Acc_Ledger\list_operation_to_reconcile(), Document_modele\myList(), Follow_Up\myList(), and HtmlInput\select_ledger().
{ return '<th ' . $p_extra . '>' . htmlspecialchars($p_string).$raw . '</th>'; }
tr | ( | $ | p_string, |
$ | p_extra = '' |
||
) |
Definition at line 86 of file ac_common.php.
Referenced by Acc_Ledger_Fin\confirm(), Acc_Ledger\confirm(), deleteRow(), deleteRowRec(), Pre_Op_Advanced\display(), Anc_Operation\display_form_plan(), display_security_fieldset(), Acc_Ledger\input(), Acc_Ledger_Fin\insert(), and Acc_Bilan\verify().
{ return '<tr ' . $p_extra . '>' . $p_string . '</tr>'; }
what_os | ( | ) |
try to determine on what os you are running the pĥpcompte server
Definition at line 684 of file ac_common.php.