noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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', 9308 );
29
30// Database schema version
31define("DBVERSION", 203);
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\">x</span>";
100$g_succeed = "<span style=\"font-size:18px;color:green\">&#x2713;</span>";
101define('SMALLX', '#xe816;');
102define('BUTTONADD', "&#10010;");
103define('ICON_SEARCH', '&#x1F50E;');
104define('ICON_CLEAN', '&#x2715;');
105
106// If noalyss_version is not defined it is likely directly taken from
107// git and so this variable is not set, this cause some issue
108if (!defined('DEBUGNOALYSS')) {
109 define("DEBUGNOALYSS", 0);
110}
111
112if (!defined('LOGINPUT')) {
113 define("LOGINPUT", false);
114}
115
117
118// If you don't want to be notified of the update
119if (!defined("SITE_UPDATE"))
120 define("SITE_UPDATE", 'https://www.noalyss.eu/last_version.txt');
121if (!defined("SITE_UPDATE_PLUGIN"))
122 define("SITE_UPDATE_PLUGIN", 'https://www.noalyss.eu/plugin_last_version.txt');
123if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
124 define("NOALYSS_PACKAGE_REPOSITORY", "https://package.noalyss.eu/");
125}
126// If you don't want that the system information is accessible
127if (!defined("SYSINFO_DISPLAY")) {
128 define("SYSINFO_DISPLAY", TRUE);
129}
130define('NOTFOUND', '--not found--');
131define("MAX_COMPTE", 4);
132define('MAX_ARTICLE', 5);
133define('MAX_ARTICLE_STOCK', 10);
134define('MAX_CAT', 15);
135define('MAX_CARD_SEARCH', 550);
136define('MAX_FORECAST_ITEM', 10);
137define('MAX_PREDEFINED_OPERATION', 50);
138define('MAX_COMPTE_CARD', 4);
139define('COMPTA_MAX_YEAR', 2100);
140define('COMPTA_MIN_YEAR', 1900);
141define('MAX_RECONCILE', 25);
142define('MAX_QCODE', 4);
143if (!defined('MAX_SEARCH_CARD')) {
144 define('MAX_SEARCH_CARD', 20);
145}
146
147define('MAX_FOLDER_TO_SHOW', 80);
148define('MAX_ACTION_SHOW', 20);
149
150if (DEBUGNOALYSS == 0) {
151 // PRODUCTION : nothing is displaid , report only errors and warning
152 // Rapporte les erreurs d'exécution de script
153 error_reporting(E_ERROR | E_WARNING);
154 ini_set("display_errors", 0);
155 ini_set("html_errors", 0);
156 ini_set('log_errors', 1);
157 ini_set('log_errors_max_len', 0);
158 if(function_exists('xdebug_disable')) { xdebug_disable(); }
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);
348// exception when balance is incorrect when saving an operation
349define('EXC_BALANCE', 1501);
350define("UNPINDG", "&#xf047;");
351define("PINDG", "&#xe809;");
352define("ARROWLEFT","&#8678;");
353define("ARROWRIGHT","&#8680;");
354define("ARROWDOWN","&#8681;");
355define("ARROWUP","&#8679;");
356// Url of NOALYSS (http://...)
357//
358if (!defined("NOALYSS_URL")) {
359 $protocol = "http";
360 if (isset ($_SERVER['REQUEST_SCHEME'])) {
361 $protocol = $_SERVER['REQUEST_SCHEME'];
362 }
363 $base = $protocol . '://' .
364 $_SERVER['SERVER_NAME'] .
365 ":" . $_SERVER['SERVER_PORT'] .
366 dirname($_SERVER['PHP_SELF']);
367 define("NOALYSS_URL", $base);
368}
369if (!defined("DEFAULT_SERVER_VIDEO_CONF")) {
370 define("DEFAULT_SERVER_VIDEO_CONF", "https://www.free-solutions.org/");
371}
372
373define ("VATCHECK_URL","https://ec.europa.eu/taxation_customs/vies/rest-api/");
374
375/**
376 * @brief load automatically class
377 *
378 * @param string $class classname to load
379 */
381{
382 $class = strtolower($class);
383
384 foreach (array("class","lib","database") as $path) {
385 if ( file_exists(NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php')) {
386 require_once NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php';
387 return;
388 }
389
390 }
391 $aClass = array(
392 "database" => "class/database.class.php",
393 "acc_detail" => "class/acc_operation.class.php",
394 "acc_sold" => "class/acc_operation.class.php",
395 "acc_misc" => "class/acc_operation.class.php",
396 "acc_purchase" => "class/acc_operation.class.php",
397 "acc_fin" => "class/acc_operation.class.php",
398 "lettering_card" => "class/lettering.class.php",
399 "lettering_account" => "class/lettering.class.php",
400 "print_ledger_financial" => "class/print_ledger_fin.class.php",
401 "anc_key_ledger_sql" => "database/anc_key_sql.class.php",
402 "anc_key_detail_sql" => "database/anc_key_sql.class.php",
403 "anc_key_activity_sql" => "database/anc_key_sql.class.php",
404 "databasecore" => "lib/database_core.class.php",
405 "httpinput" => "lib/http_input.class.php",
406 "ismallbutton" => "lib/ibutton.class.php",
407 "inputswitch" => "lib/input_switch.class.php",
408 'noalyss\mobile' => "class/mobile.class.php",
409 "htmlinput" => "lib/html_input.class.php",
410 'noalyss\dbg'=>"lib/dbg.php",
411 'noalyss\file_cache'=>"lib/file_cache.class.php",
412 "pdfland"=>"class/pdf_land.class.php",
413 "noalyss\widget\widget"=>"widget/widget.php"
414 );
415 if (isset ($aClass[$class])) {
416 require_once NOALYSS_INCLUDE . "/" . $aClass[$class];
417 }
418
419}
420
421spl_autoload_register('\noalyss_class_autoloader', true);
$base
if(LOGINPUT) if($op=='widget') $path
for widget we call immediately a file outside the ajax folder
global $g_failed
global $g_succeed
$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
global $version_noalyss
Definition constant.php:26
$dirname
Definition constant.php:42
const NOALYSS_VERSION
Definition constant.php:28
global $g_include_dir
Definition constant.php:45
noalyss_class_autoloader($class)
load automatically class
Definition constant.php:380
$inc_path
Definition constant.php:41
if( $delta< 0) elseif( $delta==0)