noalyss Version-10
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', 10000 );
29
30// Database schema version
31define("DBVERSION", 207);
32
33// version for MONO_DATABASE
34define("MONO_DATABASE", 25);
35
36// Version schema of account_repository database
37define("DBVERSIONREPO", 21);
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}
68
69if ( !defined ('ADMIN_WEB')) {
70 $a=gethostname();
71 define('ADMIN_WEB',"noalyss-no-reply@$a");
72}
73require_once NOALYSS_INCLUDE . '/constant.security.php';
74
75if (strpos($inc_path, ";") != 0) {
76 $new_path = $inc_path . ';' . $dirname;
77 $os = 0; /* $os is 0 for windoz */
78} else {
79 $new_path = $inc_path . ':' . $dirname;
80 $os = 1; /* $os is 1 for unix */
81}
82set_include_path($new_path);
83@ini_set('default_charset', "UTF-8");
84@ini_set('session.use_cookies', 1);
85// deprecated
86@ini_set('magic_quotes_gpc', 'off');
87
88if (!defined('OVERRIDE_PARAM')) {
89 ini_set('max_execution_time', 240);
90 ini_set('memory_limit', '256M');
91}
92@ini_set('session.use_trans_sid', 'on');
93@session_start();
94
95/*
96 * Ini session
97 */
98
99if (!defined('NOALYSS_CAPTCHA')) {
100 define("NOALYSS_CAPTCHA", false);
101}
102
104$g_failed = "<span style=\"font-size:18px;color:red\">x</span>";
105$g_succeed = "<span style=\"font-size:18px;color:green\">&#x2713;</span>";
106define('SMALLX', '#xe816;');
107define('BUTTONADD', "&#10010;");
108define('ICON_SEARCH', '&#x1F50E;');
109define('ICON_CLEAN', '&#x2715;');
110
111// If noalyss_version is not defined it is likely directly taken from
112// git and so this variable is not set, this cause some issue
113if (!defined('DEBUGNOALYSS')) {
114 define("DEBUGNOALYSS", 0);
115}
116
117if (!defined('LOGINPUT')) {
118 define("LOGINPUT", false);
119}
120
122
123// If you don't want to be notified of the update
124if (!defined("SITE_UPDATE"))
125 define("SITE_UPDATE", 'https://www.noalyss.eu/last_version.txt');
126if (!defined("SITE_UPDATE_PLUGIN"))
127 define("SITE_UPDATE_PLUGIN", 'https://www.noalyss.eu/plugin_last_version.txt');
128if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
129 define("NOALYSS_PACKAGE_REPOSITORY", "https://package.noalyss.eu/");
130}
131// If you don't want that the system information is accessible
132if (!defined("SYSINFO_DISPLAY")) {
133 define("SYSINFO_DISPLAY", TRUE);
134}
135define('NOTFOUND', '--not found--');
136define("MAX_COMPTE", 4);
137define('MAX_ARTICLE', 5);
138define('MAX_ARTICLE_STOCK', 10);
139define('MAX_CAT', 15);
140define('MAX_CARD_SEARCH', 550);
141define('MAX_FORECAST_ITEM', 10);
142define('MAX_PREDEFINED_OPERATION', 50);
143define('MAX_COMPTE_CARD', 4);
144define('COMPTA_MAX_YEAR', 2100);
145define('COMPTA_MIN_YEAR', 1900);
146define('MAX_RECONCILE', 25);
147define('MAX_QCODE', 4);
148if (!defined('MAX_SEARCH_CARD')) {
149 define('MAX_SEARCH_CARD', 20);
150}
151
152define('MAX_FOLDER_TO_SHOW', 80);
153define('MAX_ACTION_SHOW', 20);
154
155if (DEBUGNOALYSS == 0) {
156 // PRODUCTION : nothing is displaid , report only errors and warning
157 error_reporting(E_ERROR | E_WARNING);
158 ini_set("display_errors", 0);
159 ini_set("html_errors", 0);
160 ini_set('log_errors', 1);
161 ini_set('log_errors_max_len', 0);
162 if(function_exists('xdebug_disable')) { xdebug_disable(); }
163} elseif (DEBUGNOALYSS == 1) {
164 /* DEVELOPPEMENT : display all errors warning notice deprecated ...*/
165 error_reporting(2147483647);
166 ini_set("display_errors", 1);
167 ini_set("display_startup_errors", 1);
168 ini_set("html_errors", 1);
169 ini_set('log_errors', 1);
170 ini_set('log_errors_max_len', 0);
171 ini_set('xdebug.show_exception_trace', false);
172
173} elseif (DEBUGNOALYSS == 2) {
174 // like level 1 plus extra info (filename, ...)
175 error_reporting(2147483647);
176 ini_set("display_errors", 1);
177 ini_set("display_startup_errors", 1);
178 ini_set("html_errors", 1);
179 ini_set('log_errors', 1);
180 ini_set('log_errors_max_len', 0);
181 ini_set('xdebug.show_exception_trace', true);
182
183}
184// Erreur
185define("NOERROR", 0);
186define("BADPARM", 1);
187define("BADDATE", 2);
188define("NOTPERIODE", 3);
189define("PERIODCLOSED", 4);
190define("INVALID_ECH", 5);
191define("RAPPT_ALREADY_USED", 6);
192define("RAPPT_NOT_EXIST", 7);
193define("DIFF_AMOUNT", 8);
194define("RAPPT_NOMATCH_AMOUNT", 9);
195define("NO_PERIOD_SELECTED", 10);
196define("NO_POST_SELECTED", 11);
197define("LAST", 1);
198define("FIRST", 0);
199define("ERROR", 12);
200
201//!<ACTION defines document_type for action
202define('ACTION', '1,5,6,7,8');
203
204//valeurs standardd
205define("YES", 1);
206define("NO", 0);
207define("OPEN", 1);
208define("CLOSED", 0);
209define("NOTCENTRALIZED", 3);
210define("ALL", 4);
211define("INVOICE_STD", -2);
212
213// Pour les ShowMenuComptaLeft
214define("MENU_FACT", 1);
215define("MENU_FICHE", 2);
216define("MENU_PARAM", 3);
217
218// for the fiche_inc.GetSqlFiche function
219define("ALL_FICHE_DEF_REF", 1000);
220
221// fixed value for attr_def data
222define("ATTR_DEF_ACCOUNT", 5);
223define("ATTR_DEF_NAME", 1);
224define("ATTR_DEF_BQ_NO", 3);
225define("ATTR_DEF_BQ_NAME", 4);
226define("ATTR_DEF_PRIX_ACHAT", 7);
227define("ATTR_DEF_PRIX_VENTE", 6);
228define("ATTR_DEF_TVA", 2); // usable VAT for goods and services
229define("ATTR_DEF_NUMTVA", 13); // number of VAT
230define("ATTR_DEF_ADRESS", 14);
231define("ATTR_DEF_POSTCODE", 15);
232define("ATTR_DEF_COUNTRY", 16);
233define("ATTR_DEF_STOCK", 19);
234define("ATTR_DEF_PHONE", 17);
235define("ATTR_DEF_EMAIL", 18);
236define("ATTR_DEF_CITY", 24);
237define("ATTR_DEF_COMPANY", 25);
238define("ATTR_DEF_FAX", 26);
239define("ATTR_DEF_NUMBER_CUSTOMER", 30);
240define("ATTR_DEF_DEP_PRIV", 31);
241define("ATTR_DEF_DEPENSE_NON_DEDUCTIBLE", 20);
242define("ATTR_DEF_TVA_NON_DEDUCTIBLE", 21);
243define("ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP", 22);
244define("ATTR_DEF_QUICKCODE", 23);
245define("ATTR_DEF_FIRST_NAME", 32);
246define("ATTR_DEF_WEBSITE", 34);
247
248define('ATTR_DEF_ACCOUNT_ND_TVA', 50);
249define('ATTR_DEF_ACCOUNT_ND_TVA_ND', 51);
250define('ATTR_DEF_ACCOUNT_ND_PERSO', 52);
251define('ATTR_DEF_ACCOUNT_ND', 53);
252define('ATTR_DEF_ENABLE', 54);
253define('ATTR_DEF_SIREN', 55);
254define('ATTR_DEF_SIRET', 56);
255define('ATTR_DEF_COUNTRY_CODE', 57);
256define('ATTR_DEF_PEPPOLID', 58);
257define('ATTR_DEF_QUANTITY_TYPE', 59);
258
259define("FICHE_TYPE_CLIENT", 9);
260define("FICHE_TYPE_VENTE", 1);
261define("FICHE_TYPE_FOURNISSEUR", 8);
262define("FICHE_TYPE_FIN", 4);
263define("FICHE_TYPE_CONTACT", 16);
264define("FICHE_TYPE_EMPL", 25);
265define("FICHE_TYPE_ADM_TAX", 14);
266define("FICHE_TYPE_ACH_MAR", 2);
267define("FICHE_TYPE_ACH_SER", 3);
268define("FICHE_TYPE_ACH_MAT", 7);
269define("FICHE_TYPE_PROJET", 26);
270define("FICHE_TYPE_MATERIAL", 7);
271// Max size is defined by default to 2MB,
272if (!defined("MAX_FILE_SIZE")) {
273 define("MAX_FILE_SIZE", 2097152);
274}
275/**
276 * -- pour utiliser unoconv démarrer un server libreoffice
277 * commande
278 * libreoffice --headless --accept="socket,host=127.0.0.1,port=2002;urp;" --nofirststartwizard
279 * ou
280 * unoconv -l -v -s localhost
281 */
282if (!defined('OFFICE')) define('OFFICE', '');
283if (!defined('GENERATE_PDF')) define('GENERATE_PDF', 'NO');
284
285/**
286 * Pour conversion GIF en PDF
287 */
288$convert_gif_pdf = '/usr/bin/convert';
289if (file_exists($convert_gif_pdf)) {
290 define('CONVERT_GIF_PDF', $convert_gif_pdf);
291} else {
292 define('CONVERT_GIF_PDF', 'NOT');
293
294}
295/**
296 * PDF2PS is used when the PDF is broken , used with FIX_BROKEN_PDF
297 */
298$pdf2ps = '/usr/bin/pdf2ps';
299
300if (!file_exists($pdf2ps))
301 define('PDF2PS', 'NOT');
302else
303 define('PDF2PS', $pdf2ps);
304/**
305 * PS2PDF is used when the PDF is broken , used with FIX_BROKEN_PDF
306 */
307$ps2pdf = '/usr/bin/ps2pdf';
308
309if (!file_exists($ps2pdf))
310 define('PS2PDF', 'NOT');
311else
312 define('PS2PDF', $ps2pdf);
313
314
315/**
316 * Outil pour manipuler les PDF
317 */
318if (!isset ($pdftk)) {
319 $pdftk = '/usr/bin/pdftk';
320}
321if (file_exists($pdftk)) {
322 define('PDFTK', $pdftk);
323} else {
324 define('PDFTK', 'NOT');
325}
326
327// If it is not a mono folder it is a multi one
328if (!defined('MULTI')) {
329 define('MULTI', 1);
330}
331
332define('JS_INFOBULLE', '
333 <DIV id="bulle" class="infobulle"></DIV>
334 <script type="text/javascript" language="javascript" src="js/infobulle.js">
335 </script>');
336
337
338// Sql string
339define("SQL_LIST_ALL_INVOICE", "");
340
341define("SQL_LIST_UNPAID_INVOICE", " (jr_rapt is null or jr_rapt = '') and jr_valid = true "
343
344
345define("SQL_LIST_UNPAID_INVOICE_DATE_LIMIT", "
346 where (jr_rapt is null or jr_rapt = '')
347 and to_date(to_char(jr_ech,'DD.MM.YYYY'),'DD.MM.YYYY') < to_date(to_char(now(),'DD.MM.YYYY'),'DD.MM.YYYY')
348 and jr_valid = true");
349
350/**
351 * Exception
352 */
353// Limit email exceeds parameter
354define('EMAIL_LIMIT', 1002);
355define('EXC_PARAM_VALUE', 1005);
356define('EXC_PARAM_TYPE', 1006);
357define('EXC_DUPLICATE', 1200);
358define('EXC_INVALID', 1400);
359define('EXC_FORBIDDEN', 1500);
360define('EXC_DATA_SQL', 2001);
361// exception when balance is incorrect when saving an operation
362define('EXC_BALANCE', 1501);
363define("UNPINDG", "&#xf047;");
364define("PINDG", "&#xe809;");
365define("ARROWLEFT","&#8678;");
366define("ARROWRIGHT","&#8680;");
367define("ARROWDOWN","&#8681;");
368define("ARROWUP","&#8679;");
369// Url of NOALYSS (http://...)
370//
371if (!defined("NOALYSS_URL")) {
372 if ( isset ( $_SERVER)) {
373 $protocol = "http";
374 if (isset ($_SERVER['REQUEST_SCHEME'])) {
375 $protocol = $_SERVER['REQUEST_SCHEME'];
376 }
377 $base = $protocol . '://' .
378 $_SERVER['SERVER_NAME'] .
379 ":" . $_SERVER['SERVER_PORT'] .
380 dirname($_SERVER['PHP_SELF']);
381 define("NOALYSS_URL", $base);
382 }else {
383 define("NOALYSS_URL","command-line");
384 }
385}
386if (!defined("DEFAULT_SERVER_VIDEO_CONF")) {
387 define("DEFAULT_SERVER_VIDEO_CONF", "https://www.free-solutions.org/");
388}
389
390define ("VATCHECK_URL","https://ec.europa.eu/taxation_customs/vies/rest-api/");
391
392// define email setting name for NOALYSS
393define ("MAIL_SETTING_NOALYSS","noalyss");
394
395/**
396 * @brief load automatically class
397 *
398 * @param string $class classname to load
399 */
401{
402 $class = strtolower($class);
403 foreach (array("class","lib","database") as $path) {
404 if ( file_exists(NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php')) {
405 require_once NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php';
406 return;
407 }
408 }
409
410 $aClass = array(
411 "trait_card"=>"class/trait_card.php",
412 "database" => "class/database.class.php",
413 "acc_detail" => "class/acc_operation.class.php",
414 "acc_sold" => "class/acc_operation.class.php",
415 "acc_misc" => "class/acc_operation.class.php",
416 "acc_purchase" => "class/acc_operation.class.php",
417 "acc_fin" => "class/acc_operation.class.php",
418 "lettering_card" => "class/lettering.class.php",
419 "lettering_account" => "class/lettering.class.php",
420 "print_ledger_financial" => "class/print_ledger_fin.class.php",
421 "anc_key_ledger_sql" => "database/anc_key_sql.class.php",
422 "anc_key_detail_sql" => "database/anc_key_sql.class.php",
423 "anc_key_activity_sql" => "database/anc_key_sql.class.php",
424 "databasecore" => "lib/database_core.class.php",
425 "httpinput" => "lib/http_input.class.php",
426 "ismallbutton" => "lib/ibutton.class.php",
427 "inputswitch" => "lib/input_switch.class.php",
428 'noalyss\mobile' => "class/mobile.class.php",
429 "htmlinput" => "lib/html_input.class.php",
430 'noalyss\dbg'=>"lib/dbg.php",
431 'noalyss\file_cache'=>"lib/file_cache.class.php",
432 "pdfland"=>"class/pdf_land.class.php",
433 "noalyss\widget\widget"=>"widget/widget.php",
434 "noalyss\otp"=>"lib/otp.class.php",
435 'noalyss\xmldocument\xmlinvoice'=>'XMLDocument/xmlinvoice.class.php',
436 'noalyss\xmldocument\facturx'=>'XMLDocument/facturx.class.php',
437 'noalyss\xmldocument\invoiceubl21'=>'XMLDocument/invoiceubl21.class.php',
438 'noalyss\xmldocument\error_message'=>'XMLDocument/error_message.class.php',
439 "noalyss\invoice_pdf"=>"class/invoice_pdf.class.php",
440 'noalyss\xmldocument\xmlinvoice_reader'=>'XMLDocument/xmlinvoice_reader.class.php',
441 'noalyss\mail_parameter'=>'lib/mail_parameter.class.php',
442 'noalyss\smtpmail'=>'lib/smtpmail.class.php',
443 'noalyss\iban_number'=>'lib/iban_number.class.php',
444 'noalyss\xmldocument\document_reference'=>'XMLDocument/document_reference_type.class.php',
445 'noalyss\xmldocument\binary_object'=>'XMLDocument/document_reference_type.class.php',
446 'noalyss\xmldocument\xml_reader'=>'XMLDocument/xml_reader.class.php',
447 "noalyss\xmldocument\xmlcreditnote_reader"=>"XMLDocument/xmlcreditnote_reader.class.php",
448 "noalyss\xmldocument\pdf"=>"XMLDocument/pdf.class.php"
449 );
450 if (isset ($aClass[$class])) {
451 require_once NOALYSS_INCLUDE . "/" . $aClass[$class];
452 }
453
454}
455
456spl_autoload_register('\noalyss_class_autoloader', true);
457
458require_once NOALYSS_BASE.'/vendor/autoload.php';
$base
if(LOGINPUT) if($op=='widget') $path
for widget we call immediately a file outside the ajax folder
$class
Display the Plugin and for each profile were it is installed or not.
global $g_failed
global $g_succeed
$convert_gif_pdf
Pour conversion GIF en PDF.
Definition constant.php:288
$pdf2ps
PDF2PS is used when the PDF is broken , used with FIX_BROKEN_PDF.
Definition constant.php:298
$os
Definition constant.php:80
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:307
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:400
$inc_path
Definition constant.php:41
if( $delta< 0) elseif( $delta==0)