noalyss Version-9
constant.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19// Copyright Author Dany De Bontridder danydb@aevalys.eu
20
21/*! \file
22 * \brief Contains all the variable + the javascript
23 * and some parameter
24 */
25
27// version
28define('NOALYSS_VERSION', 9201 );
29
30// Database schema version
31define("DBVERSION", 196);
32
33// version for MONO_DATABASE
34define("MONO_DATABASE", 25);
35
36// Version schema of account_repository database
37define("DBVERSIONREPO", 20);
38/*
39 * Include path
40 */
41$inc_path = get_include_path();
42$dirname = dirname(__FILE__);
43
44/* Global variable of the include dir */
47$g_ext_dir = $dirname . "/ext";
48$g_template_dir = $dirname . "/template";
49
50if (file_exists($dirname . '/config.inc.php')) require_once $dirname . '/config.inc.php';
51
52if (!defined("NOALYSS_HOME")) define("NOALYSS_HOME", dirname($dirname) . "/html");
53if (!defined("NOALYSS_BASE")) define("NOALYSS_BASE", dirname($dirname) );
54if (!defined("NOALYSS_PLUGIN")) define("NOALYSS_PLUGIN", $g_ext_dir);
55if (!defined("NOALYSS_INCLUDE")) define("NOALYSS_INCLUDE", $g_include_dir);
56if (!defined("NOALYSS_TEMPLATE")) define("NOALYSS_TEMPLATE", $g_template_dir);
57// pdftk can deal with all the PDF , for some of them it is preferable to fix it
58// with convert , see also PDF2PS and PS2PDF if yes
59if (!defined("FIX_BROKEN_PDF")) define("FIX_BROKEN_PDF", 'NO');
60
61// version < 6.9.1.4 , the default administrator was phpcompta
62if (!defined('NOALYSS_ADMINISTRATOR')) {
63 define('NOALYSS_ADMINISTRATOR', 'phpcompta');
64}
65if (!defined("SESSION_KEY")) {
66 define("SESSION_KEY", "RtYu0uu");
67}
68require_once NOALYSS_INCLUDE . '/constant.security.php';
69
70if (strpos($inc_path, ";") != 0) {
71 $new_path = $inc_path . ';' . $dirname;
72 $os = 0; /* $os is 0 for windoz */
73} else {
74 $new_path = $inc_path . ':' . $dirname;
75 $os = 1; /* $os is 1 for unix */
76}
77set_include_path($new_path);
78@ini_set('default_charset', "UTF-8");
79@ini_set('session.use_cookies', 1);
80// deprecated
81@ini_set('magic_quotes_gpc', 'off');
82
83if (!defined('OVERRIDE_PARAM')) {
84 ini_set('max_execution_time', 240);
85 ini_set('memory_limit', '256M');
86}
87@ini_set('session.use_trans_sid', 'on');
88@session_start();
89
90/*
91 * Ini session
92 */
93
94if (!defined('NOALYSS_CAPTCHA')) {
95 define("NOALYSS_CAPTCHA", false);
96}
97
99$g_failed = "<span style=\"font-size:18px;color:red\">&#x2716;</span>";
100$g_succeed = "<span style=\"font-size:18px;color:green\">&#x2713;</span>";
101define('SMALLX', '#xe816;');
102define('BUTTONADD', "&#10010;");
103
104// If noalyss_version is not defined it is likely directly taken from
105// git and so this variable is not set, this cause some issue
106if (!defined('DEBUGNOALYSS')) {
107 define("DEBUGNOALYSS", 0);
108}
109
110if (!defined('LOGINPUT')) {
111 define("LOGINPUT", false);
112}
113
114if (!defined('DEBUGNOALYSS')) {
115 define('DEBUGNOALYSS', 0);
116}
118
119// If you don't want to be notified of the update
120if (!defined("SITE_UPDATE"))
121 define("SITE_UPDATE", 'https://www.noalyss.eu/last_version.txt');
122if (!defined("SITE_UPDATE_PLUGIN"))
123 define("SITE_UPDATE_PLUGIN", 'https://www.noalyss.eu/plugin_last_version.txt');
124if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
125 define("NOALYSS_PACKAGE_REPOSITORY", "https://package.noalyss.eu/");
126}
127// If you don't want that the system information is accessible
128if (!defined("SYSINFO_DISPLAY")) {
129 define("SYSINFO_DISPLAY", TRUE);
130}
131define('NOTFOUND', '--not found--');
132define("MAX_COMPTE", 4);
133define('MAX_ARTICLE', 5);
134define('MAX_ARTICLE_STOCK', 10);
135define('MAX_CAT', 15);
136define('MAX_CARD_SEARCH', 550);
137define('MAX_FORECAST_ITEM', 10);
138define('MAX_PREDEFINED_OPERATION', 50);
139define('MAX_COMPTE_CARD', 4);
140define('COMPTA_MAX_YEAR', 2100);
141define('COMPTA_MIN_YEAR', 1900);
142define('MAX_RECONCILE', 25);
143define('MAX_QCODE', 4);
144if (!defined('MAX_SEARCH_CARD')) {
145 define('MAX_SEARCH_CARD', 20);
146}
147
148define('MAX_FOLDER_TO_SHOW', 80);
149define('MAX_ACTION_SHOW', 20);
150
151if (DEBUGNOALYSS == 0) {
152 // PRODUCTION : nothing is displaid , report only errors and warning
153 // Rapporte les erreurs d'exécution de script
154 error_reporting(E_ERROR | E_WARNING);
155 ini_set("display_errors", 0);
156 ini_set("html_errors", 0);
157 ini_set('log_errors', 1);
158 ini_set('log_errors_max_len', 0);
159} elseif (DEBUGNOALYSS == 1) {
160 /* DEVELOPPEMENT : display all errors warning notice deprecated ...*/
161 error_reporting(2147483647);
162 ini_set("display_errors", 1);
163 ini_set("display_startup_errors", 1);
164 ini_set("html_errors", 1);
165 ini_set('log_errors', 1);
166 ini_set('log_errors_max_len', 0);
167} elseif (DEBUGNOALYSS == 2) {
168 // like level 1 plus extra info (filename, ...)
169 error_reporting(2147483647);
170 ini_set("display_errors", 1);
171 ini_set("display_startup_errors", 1);
172 ini_set("html_errors", 1);
173 ini_set('log_errors', 1);
174 ini_set('log_errors_max_len', 0);
175
176
177}
178// Erreur
179define("NOERROR", 0);
180define("BADPARM", 1);
181define("BADDATE", 2);
182define("NOTPERIODE", 3);
183define("PERIODCLOSED", 4);
184define("INVALID_ECH", 5);
185define("RAPPT_ALREADY_USED", 6);
186define("RAPPT_NOT_EXIST", 7);
187define("DIFF_AMOUNT", 8);
188define("RAPPT_NOMATCH_AMOUNT", 9);
189define("NO_PERIOD_SELECTED", 10);
190define("NO_POST_SELECTED", 11);
191define("LAST", 1);
192define("FIRST", 0);
193define("ERROR", 12);
194
195//!<ACTION defines document_type for action
196define('ACTION', '1,5,6,7,8');
197
198//valeurs standardd
199define("YES", 1);
200define("NO", 0);
201define("OPEN", 1);
202define("CLOSED", 0);
203define("NOTCENTRALIZED", 3);
204define("ALL", 4);
205
206// Pour les ShowMenuComptaLeft
207define("MENU_FACT", 1);
208define("MENU_FICHE", 2);
209define("MENU_PARAM", 3);
210
211// for the fiche_inc.GetSqlFiche function
212define("ALL_FICHE_DEF_REF", 1000);
213
214// fixed value for attr_def data
215define("ATTR_DEF_ACCOUNT", 5);
216define("ATTR_DEF_NAME", 1);
217define("ATTR_DEF_BQ_NO", 3);
218define("ATTR_DEF_BQ_NAME", 4);
219define("ATTR_DEF_PRIX_ACHAT", 7);
220define("ATTR_DEF_PRIX_VENTE", 6);
221define("ATTR_DEF_TVA", 2);
222define("ATTR_DEF_NUMTVA", 13);
223define("ATTR_DEF_ADRESS", 14);
224define("ATTR_DEF_CP", 15);
225define("ATTR_DEF_PAYS", 16);
226define("ATTR_DEF_STOCK", 19);
227define("ATTR_DEF_TEL", 17);
228define("ATTR_DEF_EMAIL", 18);
229define("ATTR_DEF_CITY", 24);
230define("ATTR_DEF_COMPANY", 25);
231define("ATTR_DEF_FAX", 26);
232define("ATTR_DEF_NUMBER_CUSTOMER", 30);
233define("ATTR_DEF_DEP_PRIV", 31);
234define("ATTR_DEF_DEPENSE_NON_DEDUCTIBLE", 20);
235define("ATTR_DEF_TVA_NON_DEDUCTIBLE", 21);
236define("ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP", 22);
237define("ATTR_DEF_QUICKCODE", 23);
238define("ATTR_DEF_FIRST_NAME", 32);
239define("ATTR_DEF_WEBSITE", 34);
240
241define('ATTR_DEF_ACCOUNT_ND_TVA', 50);
242define('ATTR_DEF_ACCOUNT_ND_TVA_ND', 51);
243define('ATTR_DEF_ACCOUNT_ND_PERSO', 52);
244define('ATTR_DEF_ACCOUNT_ND', 53);
245define('ATTR_DEF_ACTIF', 54);
246
247define("FICHE_TYPE_CLIENT", 9);
248define("FICHE_TYPE_VENTE", 1);
249define("FICHE_TYPE_FOURNISSEUR", 8);
250define("FICHE_TYPE_FIN", 4);
251define("FICHE_TYPE_CONTACT", 16);
252define("FICHE_TYPE_EMPL", 25);
253define("FICHE_TYPE_ADM_TAX", 14);
254define("FICHE_TYPE_ACH_MAR", 2);
255define("FICHE_TYPE_ACH_SER", 3);
256define("FICHE_TYPE_ACH_MAT", 7);
257define("FICHE_TYPE_PROJET", 26);
258define("FICHE_TYPE_MATERIAL", 7);
259// Max size is defined by default to 2MB,
260if (!defined("MAX_FILE_SIZE")) {
261 define("MAX_FILE_SIZE", 2097152);
262}
263/**
264 * -- pour utiliser unoconv démarrer un server libreoffice
265 * commande
266 * libreoffice --headless --accept="socket,host=127.0.0.1,port=2002;urp;" --nofirststartwizard
267 * ou
268 * unoconv -l -v -s localhost
269 */
270if (!defined('OFFICE')) define('OFFICE', '');
271if (!defined('GENERATE_PDF')) define('GENERATE_PDF', 'NO');
272
273/**
274 * Pour conversion GIF en PDF
275 */
276$convert_gif_pdf = '/usr/bin/convert';
277if (file_exists($convert_gif_pdf)) {
278 define('CONVERT_GIF_PDF', $convert_gif_pdf);
279} else {
280 define('CONVERT_GIF_PDF', 'NOT');
281
282}
283/**
284 * PDF2PS is used when the PDF is broken , used with FIX_BROKEN_PDF
285 */
286$pdf2ps = '/usr/bin/pdf2ps';
287
288if (!file_exists($pdf2ps))
289 define('PDF2PS', 'NOT');
290else
291 define('PDF2PS', $pdf2ps);
292/**
293 * PS2PDF is used when the PDF is broken , used with FIX_BROKEN_PDF
294 */
295$ps2pdf = '/usr/bin/ps2pdf';
296
297if (!file_exists($ps2pdf))
298 define('PS2PDF', 'NOT');
299else
300 define('PS2PDF', $ps2pdf);
301
302
303/**
304 * Outil pour manipuler les PDF
305 */
306if (!isset ($pdftk)) {
307 $pdftk = '/usr/bin/pdftk';
308}
309if (file_exists($pdftk)) {
310 define('PDFTK', $pdftk);
311} else {
312 define('PDFTK', 'NOT');
313}
314
315// If it is not a mono folder it is a multi one
316if (!defined('MULTI')) {
317 define('MULTI', 1);
318}
319
320define('JS_INFOBULLE', '
321 <DIV id="bulle" class="infobulle"></DIV>
322 <script type="text/javascript" language="javascript" src="js/infobulle.js">
323 </script>');
324
325
326// Sql string
327define("SQL_LIST_ALL_INVOICE", "");
328
329define("SQL_LIST_UNPAID_INVOICE", " (jr_rapt is null or jr_rapt = '') and jr_valid = true "
331
332
333define("SQL_LIST_UNPAID_INVOICE_DATE_LIMIT", "
334 where (jr_rapt is null or jr_rapt = '')
335 and to_date(to_char(jr_ech,'DD.MM.YYYY'),'DD.MM.YYYY') < to_date(to_char(now(),'DD.MM.YYYY'),'DD.MM.YYYY')
336 and jr_valid = true");
337
338/**
339 * Exception
340 */
341// Limit email exceeds parameter
342define('EMAIL_LIMIT', 1002);
343define('EXC_PARAM_VALUE', 1005);
344define('EXC_PARAM_TYPE', 1006);
345define('EXC_DUPLICATE', 1200);
346define('EXC_INVALID', 1400);
347define('EXC_FORBIDDEN', 1500);
348define("UNPINDG", "&#xf047;");
349define("PINDG", "&#xe809;");
350
351// Url of NOALYSS (http://...)
352//
353if (!defined("NOALYSS_URL")) {
354 $protocol = "http";
355 if (isset ($_SERVER['REQUEST_SCHEME'])) {
356 $protocol = $_SERVER['REQUEST_SCHEME'];
357 }
358 $base = $protocol . '://' .
359 $_SERVER['SERVER_NAME'] .
360 ":" . $_SERVER['SERVER_PORT'] .
361 dirname($_SERVER['PHP_SELF']);
362 define("NOALYSS_URL", $base);
363}
364if (!defined("DEFAULT_SERVER_VIDEO_CONF")) {
365 define("DEFAULT_SERVER_VIDEO_CONF", "https://www.free-solutions.org/");
366}
367/**
368 * @brief load automatically class
369 *
370 * @param string $class classname to load
371 */
373{
374 $class = strtolower($class);
375
376 foreach (array("class","lib","database") as $path) {
377 if ( file_exists(NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php')) {
378 require_once NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php';
379 return;
380 }
381
382 }
383 $aClass = array(
384 "database" => "class/database.class.php",
385 "acc_detail" => "class/acc_operation.class.php",
386 "acc_sold" => "class/acc_operation.class.php",
387 "acc_misc" => "class/acc_operation.class.php",
388 "acc_purchase" => "class/acc_operation.class.php",
389 "acc_fin" => "class/acc_operation.class.php",
390 "lettering_card" => "class/lettering.class.php",
391 "lettering_account" => "class/lettering.class.php",
392 "print_ledger_financial" => "class/print_ledger_fin.class.php",
393 "anc_key_ledger_sql" => "database/anc_key_sql.class.php",
394 "anc_key_detail_sql" => "database/anc_key_sql.class.php",
395 "anc_key_activity_sql" => "database/anc_key_sql.class.php",
396 "databasecore" => "lib/database_core.class.php",
397 "httpinput" => "lib/http_input.class.php",
398 "ismallbutton" => "lib/ibutton.class.php",
399 "inputswitch" => "lib/input_switch.class.php",
400 'noalyss\mobile' => "class/mobile.class.php",
401 "htmlinput" => "lib/html_input.class.php",
402 'noalyss\dbg'=>"lib/dbg.php",
403 'noalyss\file_cache'=>"lib/file_cache.class.php",
404 "pdfland"=>"class/pdf_land.class.php"
405 );
406 if (isset ($aClass[$class])) {
407 require_once NOALYSS_INCLUDE . "/" . $aClass[$class];
408 }
409
410}
411
412spl_autoload_register('\noalyss_class_autoloader', true);
$base
Definition: action.inc.php:56
if(LOGINPUT) $path
Definition: ajax_misc.php:152
$class
if(!defined('NOALYSS_CAPTCHA')) global $g_failed
Definition: constant.php:94
$convert_gif_pdf
Pour conversion GIF en PDF.
Definition: constant.php:276
$pdf2ps
PDF2PS is used when the PDF is broken , used with FIX_BROKEN_PDF.
Definition: constant.php:286
$os
Definition: constant.php:75
global $g_ext_dir
Definition: constant.php:45
global $g_template_dir
Definition: constant.php:45
$ps2pdf
PS2PDF is used when the PDF is broken , used with FIX_BROKEN_PDF.
Definition: constant.php:295
$dirname
Definition: constant.php:42
if(!defined('NOALYSS_CAPTCHA')) global $g_succeed
Definition: constant.php:98
const NOALYSS_VERSION
Definition: constant.php:28
global $g_include_dir
Definition: constant.php:45
if(!defined("NOALYSS_URL")) if(!defined("DEFAULT_SERVER_VIDEO_CONF")) noalyss_class_autoloader($class)
load automatically class
Definition: constant.php:372
global $version_noalyss
Definition: constant.php:26
$inc_path
Definition: constant.php:41
if( $delta< 0) elseif( $delta==0)