@@ -31,24 +31,24 @@ discard block |
||
31 | 31 | class modModuleBuilder extends DolibarrModules |
32 | 32 | { |
33 | 33 | /** |
34 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
35 | - * |
|
36 | - * @param DoliDB $db Database handler |
|
34 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
35 | + * |
|
36 | + * @param DoliDB $db Database handler |
|
37 | 37 | */ |
38 | 38 | function __construct($db) |
39 | 39 | { |
40 | - global $langs,$conf; |
|
40 | + global $langs,$conf; |
|
41 | 41 | |
42 | 42 | $this->db = $db; |
43 | 43 | $this->numero = 3300; |
44 | 44 | |
45 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
46 | - // It is used to group modules in module setup page |
|
45 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
46 | + // It is used to group modules in module setup page |
|
47 | 47 | $this->family = "technic"; |
48 | 48 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
49 | 49 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
50 | 50 | $this->description = "A RAD (Rapid Application Development) tool to help developers to build their own module."; |
51 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
51 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
52 | 52 | $this->version = 'dolibarr'; |
53 | 53 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
54 | 54 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | |
65 | 65 | // Dependencies |
66 | 66 | //------------- |
67 | - $this->hidden = false; // A condition to disable module |
|
68 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
67 | + $this->hidden = false; // A condition to disable module |
|
68 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
69 | 69 | $this->requiredby = array(); // List of modules id to disable if this one is disabled |
70 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
70 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
71 | 71 | $this->langfiles = array(); |
72 | 72 | |
73 | 73 | // Constants |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup blockedlog |
24 | 24 | * \brief Description and activation file for module ModuleBuilder |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
26 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Class to describe a ModuleBuilder module |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function __construct($db) |
39 | 39 | { |
40 | - global $langs,$conf; |
|
40 | + global $langs, $conf; |
|
41 | 41 | |
42 | 42 | $this->db = $db; |
43 | 43 | $this->numero = 3300; |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | // It is used to group modules in module setup page |
47 | 47 | $this->family = "technic"; |
48 | 48 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
49 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
49 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
50 | 50 | $this->description = "A RAD (Rapid Application Development) tool to help developers to build their own module."; |
51 | 51 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
52 | 52 | $this->version = 'dolibarr'; |
53 | 53 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
54 | 54 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
55 | 55 | // Name of image file used for this module. |
56 | - $this->picto='technic'; |
|
56 | + $this->picto = 'technic'; |
|
57 | 57 | |
58 | 58 | // Data directories to create when module is enabled |
59 | 59 | $this->dirs = array(); |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | |
65 | 65 | // Dependencies |
66 | 66 | //------------- |
67 | - $this->hidden = false; // A condition to disable module |
|
68 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
69 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
70 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
67 | + $this->hidden = false; // A condition to disable module |
|
68 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
69 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
70 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
71 | 71 | $this->langfiles = array(); |
72 | 72 | |
73 | 73 | // Constants |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | //------------------ |
87 | 87 | $this->menu = array(); |
88 | 88 | |
89 | - $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', |
|
89 | + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', |
|
90 | 90 | 'type'=>'left', |
91 | 91 | 'titre'=>'ModuleBuilder', |
92 | 92 | 'mainmenu'=>'home', |
@@ -7,168 +7,168 @@ |
||
7 | 7 | */ |
8 | 8 | class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface |
9 | 9 | { |
10 | - var $code = 'chromephp'; |
|
11 | - |
|
12 | - /** |
|
13 | - * Return name of logger |
|
14 | - * |
|
15 | - * @return string Name of logger |
|
16 | - */ |
|
17 | - public function getName() |
|
18 | - { |
|
19 | - return 'ChromePHP'; |
|
20 | - } |
|
21 | - |
|
22 | - /** |
|
23 | - * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function getVersion() |
|
28 | - { |
|
29 | - return 'dolibarr'; |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Content of the info tooltip. |
|
34 | - * |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function getInfo() |
|
38 | - { |
|
39 | - return ''; |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * Return warning if something is wrong with logger |
|
44 | - * |
|
45 | - * @return string |
|
46 | - */ |
|
47 | - public function getWarning() |
|
48 | - { |
|
49 | - global $langs; |
|
50 | - |
|
51 | - return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php'); |
|
52 | - } |
|
10 | + var $code = 'chromephp'; |
|
11 | + |
|
12 | + /** |
|
13 | + * Return name of logger |
|
14 | + * |
|
15 | + * @return string Name of logger |
|
16 | + */ |
|
17 | + public function getName() |
|
18 | + { |
|
19 | + return 'ChromePHP'; |
|
20 | + } |
|
21 | + |
|
22 | + /** |
|
23 | + * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function getVersion() |
|
28 | + { |
|
29 | + return 'dolibarr'; |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Content of the info tooltip. |
|
34 | + * |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function getInfo() |
|
38 | + { |
|
39 | + return ''; |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * Return warning if something is wrong with logger |
|
44 | + * |
|
45 | + * @return string |
|
46 | + */ |
|
47 | + public function getWarning() |
|
48 | + { |
|
49 | + global $langs; |
|
50 | + |
|
51 | + return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php'); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Is the module active ? |
|
56 | - * |
|
57 | - * @return int -1 if not active, 0 if active but lib/path not found, 1 if OK |
|
58 | - */ |
|
59 | - public function isActive() |
|
60 | - { |
|
61 | - global $conf; |
|
62 | - try |
|
63 | - { |
|
64 | - if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) { |
|
65 | - $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'; |
|
66 | - } |
|
67 | - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
|
68 | - |
|
69 | - $res = @include_once 'ChromePhp.php'; |
|
70 | - if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
71 | - |
|
72 | - restore_include_path(); |
|
73 | - |
|
74 | - if ($res) |
|
75 | - { |
|
76 | - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler |
|
77 | - } |
|
78 | - else |
|
79 | - { |
|
80 | - return 0; |
|
81 | - } |
|
82 | - } |
|
83 | - catch(Exception $e) |
|
84 | - { |
|
85 | - print '<!-- ChromePHP not available into PHP -->'."\n"; |
|
86 | - } |
|
87 | - |
|
88 | - return -1; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Return array of configuration data |
|
93 | - * |
|
94 | - * @return array Return array of configuration data |
|
95 | - */ |
|
96 | - public function configure() |
|
97 | - { |
|
98 | - global $langs; |
|
99 | - |
|
100 | - return array( |
|
101 | - array( |
|
102 | - 'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'), |
|
103 | - 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', |
|
104 | - 'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/', |
|
105 | - 'attr' => 'size="60"', |
|
106 | - 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/' |
|
107 | - ) |
|
108 | - ); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Return if configuration is valid |
|
113 | - * |
|
114 | - * @return array Array of errors. Empty array if ok. |
|
115 | - */ |
|
116 | - public function checkConfiguration() |
|
117 | - { |
|
118 | - global $langs,$conf; |
|
119 | - |
|
120 | - $errors = array(); |
|
121 | - |
|
122 | - if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) |
|
123 | - { |
|
124 | - $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop |
|
125 | - if (is_object($langs)) // $langs may not be defined yet. |
|
126 | - { |
|
127 | - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); |
|
128 | - } |
|
129 | - else |
|
130 | - { |
|
131 | - $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - return $errors; |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * Output log content. We also start output buffering at first log write. |
|
140 | - * |
|
141 | - * @param array $content Content to log |
|
142 | - * @return null|false |
|
143 | - */ |
|
144 | - public function export($content) |
|
145 | - { |
|
146 | - global $conf; |
|
147 | - |
|
148 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler |
|
149 | - |
|
150 | - //We check the configuration to avoid showing PHP warnings |
|
151 | - if (count($this->checkConfiguration()) > 0) return false; |
|
152 | - |
|
153 | - try |
|
154 | - { |
|
155 | - // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from |
|
156 | - // database or config file because we must be able to log data before database or config file read. |
|
157 | - $oldinclude=get_include_path(); |
|
158 | - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
|
159 | - $res = @include_once 'ChromePhp.php'; |
|
160 | - if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
161 | - set_include_path($oldinclude); |
|
54 | + /** |
|
55 | + * Is the module active ? |
|
56 | + * |
|
57 | + * @return int -1 if not active, 0 if active but lib/path not found, 1 if OK |
|
58 | + */ |
|
59 | + public function isActive() |
|
60 | + { |
|
61 | + global $conf; |
|
62 | + try |
|
63 | + { |
|
64 | + if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) { |
|
65 | + $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'; |
|
66 | + } |
|
67 | + set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
|
68 | + |
|
69 | + $res = @include_once 'ChromePhp.php'; |
|
70 | + if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
71 | + |
|
72 | + restore_include_path(); |
|
73 | + |
|
74 | + if ($res) |
|
75 | + { |
|
76 | + return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler |
|
77 | + } |
|
78 | + else |
|
79 | + { |
|
80 | + return 0; |
|
81 | + } |
|
82 | + } |
|
83 | + catch(Exception $e) |
|
84 | + { |
|
85 | + print '<!-- ChromePHP not available into PHP -->'."\n"; |
|
86 | + } |
|
87 | + |
|
88 | + return -1; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Return array of configuration data |
|
93 | + * |
|
94 | + * @return array Return array of configuration data |
|
95 | + */ |
|
96 | + public function configure() |
|
97 | + { |
|
98 | + global $langs; |
|
99 | + |
|
100 | + return array( |
|
101 | + array( |
|
102 | + 'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'), |
|
103 | + 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', |
|
104 | + 'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/', |
|
105 | + 'attr' => 'size="60"', |
|
106 | + 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/' |
|
107 | + ) |
|
108 | + ); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Return if configuration is valid |
|
113 | + * |
|
114 | + * @return array Array of errors. Empty array if ok. |
|
115 | + */ |
|
116 | + public function checkConfiguration() |
|
117 | + { |
|
118 | + global $langs,$conf; |
|
119 | + |
|
120 | + $errors = array(); |
|
121 | + |
|
122 | + if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) |
|
123 | + { |
|
124 | + $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop |
|
125 | + if (is_object($langs)) // $langs may not be defined yet. |
|
126 | + { |
|
127 | + $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); |
|
128 | + } |
|
129 | + else |
|
130 | + { |
|
131 | + $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + return $errors; |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * Output log content. We also start output buffering at first log write. |
|
140 | + * |
|
141 | + * @param array $content Content to log |
|
142 | + * @return null|false |
|
143 | + */ |
|
144 | + public function export($content) |
|
145 | + { |
|
146 | + global $conf; |
|
147 | + |
|
148 | + if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler |
|
149 | + |
|
150 | + //We check the configuration to avoid showing PHP warnings |
|
151 | + if (count($this->checkConfiguration()) > 0) return false; |
|
152 | + |
|
153 | + try |
|
154 | + { |
|
155 | + // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from |
|
156 | + // database or config file because we must be able to log data before database or config file read. |
|
157 | + $oldinclude=get_include_path(); |
|
158 | + set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
|
159 | + $res = @include_once 'ChromePhp.php'; |
|
160 | + if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
161 | + set_include_path($oldinclude); |
|
162 | 162 | |
163 | - ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
164 | - if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); |
|
165 | - elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); |
|
166 | - elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']); |
|
167 | - else ChromePhp::log($content['message']); |
|
168 | - } |
|
169 | - catch (Exception $e) |
|
170 | - { |
|
171 | - // Do not use dol_syslog here to avoid infinite loop |
|
172 | - } |
|
173 | - } |
|
163 | + ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
164 | + if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); |
|
165 | + elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); |
|
166 | + elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']); |
|
167 | + else ChromePhp::log($content['message']); |
|
168 | + } |
|
169 | + catch (Exception $e) |
|
170 | + { |
|
171 | + // Do not use dol_syslog here to avoid infinite loop |
|
172 | + } |
|
173 | + } |
|
174 | 174 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | global $langs; |
50 | 50 | |
51 | - return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php'); |
|
51 | + return ($this->isActive() == 1) ? '' : $langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | try |
63 | 63 | { |
64 | 64 | if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) { |
65 | - $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'; |
|
65 | + $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT.'/includes/ccampbell/chromephp/'; |
|
66 | 66 | } |
67 | 67 | set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
68 | 68 | |
69 | 69 | $res = @include_once 'ChromePhp.php'; |
70 | - if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
70 | + if (!$res) $res = @include_once 'ChromePhp.class.php'; |
|
71 | 71 | |
72 | 72 | restore_include_path(); |
73 | 73 | |
74 | 74 | if ($res) |
75 | 75 | { |
76 | - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler |
|
76 | + return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP) ? 1 : 0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler |
|
77 | 77 | } |
78 | 78 | else |
79 | 79 | { |
80 | 80 | return 0; |
81 | 81 | } |
82 | 82 | } |
83 | - catch(Exception $e) |
|
83 | + catch (Exception $e) |
|
84 | 84 | { |
85 | 85 | print '<!-- ChromePHP not available into PHP -->'."\n"; |
86 | 86 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | |
100 | 100 | return array( |
101 | 101 | array( |
102 | - 'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'), |
|
102 | + 'name' => $langs->trans('IncludePath', 'SYSLOG_CHROMEPHP_INCLUDEPATH'), |
|
103 | 103 | 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', |
104 | - 'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/', |
|
104 | + 'default' => DOL_DOCUMENT_ROOT.'/includes/ccampbell/chromephp/', |
|
105 | 105 | 'attr' => 'size="60"', |
106 | - 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/' |
|
106 | + 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT.'/includes/ccampbell/chromephp/' |
|
107 | 107 | ) |
108 | 108 | ); |
109 | 109 | } |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function checkConfiguration() |
117 | 117 | { |
118 | - global $langs,$conf; |
|
118 | + global $langs, $conf; |
|
119 | 119 | |
120 | 120 | $errors = array(); |
121 | 121 | |
122 | - if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) |
|
122 | + if (!file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && !file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) |
|
123 | 123 | { |
124 | 124 | $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop |
125 | 125 | if (is_object($langs)) // $langs may not be defined yet. |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | global $conf; |
147 | 147 | |
148 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler |
|
148 | + if (!empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler |
|
149 | 149 | |
150 | 150 | //We check the configuration to avoid showing PHP warnings |
151 | 151 | if (count($this->checkConfiguration()) > 0) return false; |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | { |
155 | 155 | // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from |
156 | 156 | // database or config file because we must be able to log data before database or config file read. |
157 | - $oldinclude=get_include_path(); |
|
157 | + $oldinclude = get_include_path(); |
|
158 | 158 | set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
159 | 159 | $res = @include_once 'ChromePhp.php'; |
160 | - if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
160 | + if (!$res) $res = @include_once 'ChromePhp.class.php'; |
|
161 | 161 | set_include_path($oldinclude); |
162 | 162 | |
163 | - ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
163 | + ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
164 | 164 | if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); |
165 | 165 | elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); |
166 | 166 | elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']); |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
68 | 68 | |
69 | 69 | $res = @include_once 'ChromePhp.php'; |
70 | - if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
70 | + if (! $res) { |
|
71 | + $res=@include_once 'ChromePhp.class.php'; |
|
72 | + } |
|
71 | 73 | |
72 | 74 | restore_include_path(); |
73 | 75 | |
74 | 76 | if ($res) |
75 | 77 | { |
76 | 78 | return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler |
77 | - } |
|
78 | - else |
|
79 | + } else |
|
79 | 80 | { |
80 | 81 | return 0; |
81 | 82 | } |
82 | - } |
|
83 | - catch(Exception $e) |
|
83 | + } catch(Exception $e) |
|
84 | 84 | { |
85 | 85 | print '<!-- ChromePHP not available into PHP -->'."\n"; |
86 | 86 | } |
@@ -122,11 +122,12 @@ discard block |
||
122 | 122 | if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) |
123 | 123 | { |
124 | 124 | $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop |
125 | - if (is_object($langs)) // $langs may not be defined yet. |
|
125 | + if (is_object($langs)) { |
|
126 | + // $langs may not be defined yet. |
|
126 | 127 | { |
127 | 128 | $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); |
128 | 129 | } |
129 | - else |
|
130 | + } else |
|
130 | 131 | { |
131 | 132 | $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; |
132 | 133 | } |
@@ -145,10 +146,15 @@ discard block |
||
145 | 146 | { |
146 | 147 | global $conf; |
147 | 148 | |
148 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler |
|
149 | + if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) { |
|
150 | + return; |
|
151 | + } |
|
152 | + // Global option to disable output of this handler |
|
149 | 153 | |
150 | 154 | //We check the configuration to avoid showing PHP warnings |
151 | - if (count($this->checkConfiguration()) > 0) return false; |
|
155 | + if (count($this->checkConfiguration()) > 0) { |
|
156 | + return false; |
|
157 | + } |
|
152 | 158 | |
153 | 159 | try |
154 | 160 | { |
@@ -157,16 +163,22 @@ discard block |
||
157 | 163 | $oldinclude=get_include_path(); |
158 | 164 | set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); |
159 | 165 | $res = @include_once 'ChromePhp.php'; |
160 | - if (! $res) $res=@include_once 'ChromePhp.class.php'; |
|
166 | + if (! $res) { |
|
167 | + $res=@include_once 'ChromePhp.class.php'; |
|
168 | + } |
|
161 | 169 | set_include_path($oldinclude); |
162 | 170 | |
163 | 171 | ob_start(); // To be sure headers are not flushed until all page is completely processed |
164 | - if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); |
|
165 | - elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); |
|
166 | - elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']); |
|
167 | - else ChromePhp::log($content['message']); |
|
168 | - } |
|
169 | - catch (Exception $e) |
|
172 | + if ($content['level'] == LOG_ERR) { |
|
173 | + ChromePhp::error($content['message']); |
|
174 | + } elseif ($content['level'] == LOG_WARNING) { |
|
175 | + ChromePhp::warn($content['message']); |
|
176 | + } elseif ($content['level'] == LOG_INFO) { |
|
177 | + ChromePhp::log($content['message']); |
|
178 | + } else { |
|
179 | + ChromePhp::log($content['message']); |
|
180 | + } |
|
181 | + } catch (Exception $e) |
|
170 | 182 | { |
171 | 183 | // Do not use dol_syslog here to avoid infinite loop |
172 | 184 | } |
@@ -7,121 +7,121 @@ |
||
7 | 7 | */ |
8 | 8 | class mod_syslog_syslog extends LogHandler implements LogHandlerInterface |
9 | 9 | { |
10 | - var $code = 'syslog'; |
|
11 | - |
|
12 | - /** |
|
13 | - * Return name of logger |
|
14 | - * |
|
15 | - * @return string Name of logger |
|
16 | - */ |
|
17 | - public function getName() |
|
18 | - { |
|
19 | - return 'Syslog'; |
|
20 | - } |
|
21 | - |
|
22 | - /** |
|
23 | - * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function getVersion() |
|
28 | - { |
|
29 | - return 'dolibarr'; |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Content of the info tooltip. |
|
34 | - * |
|
35 | - * @return false|string |
|
36 | - */ |
|
37 | - public function getInfo() |
|
38 | - { |
|
39 | - global $langs; |
|
40 | - |
|
41 | - return $langs->trans('OnlyWindowsLOG_USER'); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Is the module active ? |
|
46 | - * |
|
47 | - * @return int |
|
48 | - */ |
|
49 | - public function isActive() |
|
50 | - { |
|
51 | - global $conf; |
|
52 | - |
|
53 | - // This function does not exists on some ISP (Ex: Free in France) |
|
54 | - if (!function_exists('openlog')) return 0; |
|
55 | - |
|
56 | - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * Return array of configuration data |
|
61 | - * |
|
62 | - * @return array Return array of configuration data |
|
63 | - */ |
|
64 | - public function configure() |
|
65 | - { |
|
66 | - global $langs; |
|
67 | - |
|
68 | - return array( |
|
69 | - array( |
|
70 | - 'constant' => 'SYSLOG_FACILITY', |
|
71 | - 'name' => $langs->trans('SyslogFacility'), |
|
72 | - 'default' => 'LOG_USER' |
|
73 | - ) |
|
74 | - ); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Return if configuration is valid |
|
79 | - * |
|
80 | - * @return array Array of errors. Empty array if ok. |
|
81 | - */ |
|
82 | - public function checkConfiguration() |
|
83 | - { |
|
84 | - global $conf, $langs; |
|
85 | - |
|
86 | - $errors = array(); |
|
87 | - |
|
88 | - $facility = constant($conf->global->SYSLOG_FACILITY); |
|
89 | - if ($facility) |
|
90 | - { |
|
91 | - // Only LOG_USER supported on Windows |
|
92 | - if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER'); |
|
93 | - |
|
94 | - dol_syslog("admin/syslog: facility ".$facility); |
|
95 | - } |
|
96 | - else |
|
97 | - { |
|
98 | - $errors[] = $langs->trans("ErrorUnknownSyslogConstant", $facility); |
|
99 | - } |
|
100 | - |
|
101 | - return $errors; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * Export the message |
|
106 | - * |
|
107 | - * @param array $content Array containing the info about the message |
|
108 | - * @return void |
|
109 | - */ |
|
110 | - public function export($content) |
|
111 | - { |
|
112 | - global $conf; |
|
113 | - |
|
114 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler |
|
115 | - |
|
116 | - if (! empty($conf->global->SYSLOG_FACILITY)) // Example LOG_USER |
|
117 | - { |
|
118 | - $facility = constant($conf->global->SYSLOG_FACILITY); |
|
119 | - } |
|
120 | - else $facility = constant('LOG_USER'); |
|
121 | - |
|
122 | - // (int) is required to avoid error parameter 3 expected to be long |
|
123 | - openlog('dolibarr', LOG_PID | LOG_PERROR, (int) $facility); |
|
124 | - syslog($content['level'], $content['message']); |
|
125 | - closelog(); |
|
126 | - } |
|
10 | + var $code = 'syslog'; |
|
11 | + |
|
12 | + /** |
|
13 | + * Return name of logger |
|
14 | + * |
|
15 | + * @return string Name of logger |
|
16 | + */ |
|
17 | + public function getName() |
|
18 | + { |
|
19 | + return 'Syslog'; |
|
20 | + } |
|
21 | + |
|
22 | + /** |
|
23 | + * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function getVersion() |
|
28 | + { |
|
29 | + return 'dolibarr'; |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Content of the info tooltip. |
|
34 | + * |
|
35 | + * @return false|string |
|
36 | + */ |
|
37 | + public function getInfo() |
|
38 | + { |
|
39 | + global $langs; |
|
40 | + |
|
41 | + return $langs->trans('OnlyWindowsLOG_USER'); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Is the module active ? |
|
46 | + * |
|
47 | + * @return int |
|
48 | + */ |
|
49 | + public function isActive() |
|
50 | + { |
|
51 | + global $conf; |
|
52 | + |
|
53 | + // This function does not exists on some ISP (Ex: Free in France) |
|
54 | + if (!function_exists('openlog')) return 0; |
|
55 | + |
|
56 | + return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * Return array of configuration data |
|
61 | + * |
|
62 | + * @return array Return array of configuration data |
|
63 | + */ |
|
64 | + public function configure() |
|
65 | + { |
|
66 | + global $langs; |
|
67 | + |
|
68 | + return array( |
|
69 | + array( |
|
70 | + 'constant' => 'SYSLOG_FACILITY', |
|
71 | + 'name' => $langs->trans('SyslogFacility'), |
|
72 | + 'default' => 'LOG_USER' |
|
73 | + ) |
|
74 | + ); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Return if configuration is valid |
|
79 | + * |
|
80 | + * @return array Array of errors. Empty array if ok. |
|
81 | + */ |
|
82 | + public function checkConfiguration() |
|
83 | + { |
|
84 | + global $conf, $langs; |
|
85 | + |
|
86 | + $errors = array(); |
|
87 | + |
|
88 | + $facility = constant($conf->global->SYSLOG_FACILITY); |
|
89 | + if ($facility) |
|
90 | + { |
|
91 | + // Only LOG_USER supported on Windows |
|
92 | + if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER'); |
|
93 | + |
|
94 | + dol_syslog("admin/syslog: facility ".$facility); |
|
95 | + } |
|
96 | + else |
|
97 | + { |
|
98 | + $errors[] = $langs->trans("ErrorUnknownSyslogConstant", $facility); |
|
99 | + } |
|
100 | + |
|
101 | + return $errors; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * Export the message |
|
106 | + * |
|
107 | + * @param array $content Array containing the info about the message |
|
108 | + * @return void |
|
109 | + */ |
|
110 | + public function export($content) |
|
111 | + { |
|
112 | + global $conf; |
|
113 | + |
|
114 | + if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler |
|
115 | + |
|
116 | + if (! empty($conf->global->SYSLOG_FACILITY)) // Example LOG_USER |
|
117 | + { |
|
118 | + $facility = constant($conf->global->SYSLOG_FACILITY); |
|
119 | + } |
|
120 | + else $facility = constant('LOG_USER'); |
|
121 | + |
|
122 | + // (int) is required to avoid error parameter 3 expected to be long |
|
123 | + openlog('dolibarr', LOG_PID | LOG_PERROR, (int) $facility); |
|
124 | + syslog($content['level'], $content['message']); |
|
125 | + closelog(); |
|
126 | + } |
|
127 | 127 | } |
128 | 128 | \ No newline at end of file |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // This function does not exists on some ISP (Ex: Free in France) |
54 | 54 | if (!function_exists('openlog')) return 0; |
55 | 55 | |
56 | - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler |
|
56 | + return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG) ? 1 : 0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($facility) |
90 | 90 | { |
91 | 91 | // Only LOG_USER supported on Windows |
92 | - if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER'); |
|
92 | + if (!empty($_SERVER["WINDIR"])) $facility = constant('LOG_USER'); |
|
93 | 93 | |
94 | 94 | dol_syslog("admin/syslog: facility ".$facility); |
95 | 95 | } |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | { |
112 | 112 | global $conf; |
113 | 113 | |
114 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler |
|
114 | + if (!empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler |
|
115 | 115 | |
116 | - if (! empty($conf->global->SYSLOG_FACILITY)) // Example LOG_USER |
|
116 | + if (!empty($conf->global->SYSLOG_FACILITY)) // Example LOG_USER |
|
117 | 117 | { |
118 | 118 | $facility = constant($conf->global->SYSLOG_FACILITY); |
119 | 119 | } |
@@ -51,7 +51,9 @@ discard block |
||
51 | 51 | global $conf; |
52 | 52 | |
53 | 53 | // This function does not exists on some ISP (Ex: Free in France) |
54 | - if (!function_exists('openlog')) return 0; |
|
54 | + if (!function_exists('openlog')) { |
|
55 | + return 0; |
|
56 | + } |
|
55 | 57 | |
56 | 58 | return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler |
57 | 59 | } |
@@ -89,11 +91,12 @@ discard block |
||
89 | 91 | if ($facility) |
90 | 92 | { |
91 | 93 | // Only LOG_USER supported on Windows |
92 | - if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER'); |
|
94 | + if (! empty($_SERVER["WINDIR"])) { |
|
95 | + $facility=constant('LOG_USER'); |
|
96 | + } |
|
93 | 97 | |
94 | 98 | dol_syslog("admin/syslog: facility ".$facility); |
95 | - } |
|
96 | - else |
|
99 | + } else |
|
97 | 100 | { |
98 | 101 | $errors[] = $langs->trans("ErrorUnknownSyslogConstant", $facility); |
99 | 102 | } |
@@ -111,13 +114,19 @@ discard block |
||
111 | 114 | { |
112 | 115 | global $conf; |
113 | 116 | |
114 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler |
|
117 | + if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) { |
|
118 | + return; |
|
119 | + } |
|
120 | + // Global option to disable output of this handler |
|
115 | 121 | |
116 | - if (! empty($conf->global->SYSLOG_FACILITY)) // Example LOG_USER |
|
122 | + if (! empty($conf->global->SYSLOG_FACILITY)) { |
|
123 | + // Example LOG_USER |
|
117 | 124 | { |
118 | 125 | $facility = constant($conf->global->SYSLOG_FACILITY); |
119 | 126 | } |
120 | - else $facility = constant('LOG_USER'); |
|
127 | + } else { |
|
128 | + $facility = constant('LOG_USER'); |
|
129 | + } |
|
121 | 130 | |
122 | 131 | // (int) is required to avoid error parameter 3 expected to be long |
123 | 132 | openlog('dolibarr', LOG_PID | LOG_PERROR, (int) $facility); |
@@ -23,153 +23,153 @@ |
||
23 | 23 | */ |
24 | 24 | class mod_syslog_firephp extends LogHandler implements LogHandlerInterface |
25 | 25 | { |
26 | - public $code = 'firephp'; |
|
27 | - private static $firephp_include_path = '/includes/firephp/firephp-core/lib/'; |
|
28 | - private static $firephp_class_path = 'FirePHPCore/FirePHP.class.php'; |
|
29 | - |
|
30 | - /** |
|
31 | - * Return name of logger |
|
32 | - * |
|
33 | - * @return string Name of logger |
|
34 | - */ |
|
35 | - public function getName() |
|
36 | - { |
|
37 | - return 'FirePHP'; |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') |
|
42 | - * |
|
43 | - * @return string |
|
44 | - */ |
|
45 | - public function getVersion() |
|
46 | - { |
|
47 | - return 'dolibarr'; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * Content of the info tooltip. |
|
52 | - * |
|
53 | - * @return false|string |
|
54 | - */ |
|
55 | - public function getInfo() |
|
56 | - { |
|
57 | - global $langs; |
|
58 | - |
|
59 | - return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Is the module active ? |
|
64 | - * |
|
65 | - * @return int |
|
66 | - */ |
|
67 | - public function isActive() |
|
68 | - { |
|
69 | - global $conf; |
|
70 | - try |
|
71 | - { |
|
72 | - if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) { |
|
73 | - $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path; |
|
74 | - } |
|
75 | - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); |
|
76 | - $res = @include_once self::$firephp_class_path; |
|
77 | - restore_include_path(); |
|
78 | - if ($res) { |
|
79 | - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler |
|
80 | - } else { |
|
81 | - return 0; |
|
82 | - } |
|
83 | - } |
|
84 | - catch(Exception $e) |
|
85 | - { |
|
86 | - print '<!-- FirePHP not available into PHP -->'."\n"; |
|
87 | - } |
|
88 | - |
|
89 | - return -1; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Return array of configuration data |
|
94 | - * |
|
95 | - * @return array Return array of configuration data |
|
96 | - */ |
|
97 | - public function configure() |
|
98 | - { |
|
99 | - global $langs; |
|
100 | - |
|
101 | - return array( |
|
102 | - array( |
|
103 | - 'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'), |
|
104 | - 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH', |
|
105 | - 'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path, |
|
106 | - 'attr' => 'size="60"', |
|
107 | - 'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path |
|
108 | - ) |
|
109 | - ); |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Return if configuration is valid |
|
114 | - * |
|
115 | - * @return array Array of errors. Empty array if ok. |
|
116 | - */ |
|
117 | - public function checkConfiguration() |
|
118 | - { |
|
119 | - global $conf, $langs; |
|
120 | - |
|
121 | - $errors = array(); |
|
122 | - |
|
123 | - if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) |
|
124 | - { |
|
125 | - $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop |
|
126 | - if (is_object($langs)) // $langs may not be defined yet. |
|
127 | - { |
|
128 | - $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); |
|
129 | - } |
|
130 | - else |
|
131 | - { |
|
132 | - $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - return $errors; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Output log content |
|
141 | - * |
|
142 | - * @param array $content Content to log |
|
143 | - * @return null|false |
|
144 | - */ |
|
145 | - public function export($content) |
|
146 | - { |
|
147 | - global $conf; |
|
148 | - |
|
149 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler |
|
150 | - |
|
151 | - //We check the configuration to avoid showing PHP warnings |
|
152 | - if (count($this->checkConfiguration())) return false; |
|
153 | - |
|
154 | - try |
|
155 | - { |
|
156 | - // Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once a constant from |
|
157 | - // database or config file because we must be able to log data before database or config file read. |
|
158 | - $oldinclude=get_include_path(); |
|
159 | - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); |
|
160 | - include_once self::$firephp_class_path; |
|
161 | - set_include_path($oldinclude); |
|
162 | - ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
163 | - $firephp = FirePHP::getInstance(true); |
|
164 | - if ($content['level'] == LOG_ERR) $firephp->error($content['message']); |
|
165 | - elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']); |
|
166 | - elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']); |
|
167 | - else $firephp->log($content['message']); |
|
168 | - } |
|
169 | - catch (Exception $e) |
|
170 | - { |
|
171 | - // Do not use dol_syslog here to avoid infinite loop |
|
172 | - return false; |
|
173 | - } |
|
174 | - } |
|
26 | + public $code = 'firephp'; |
|
27 | + private static $firephp_include_path = '/includes/firephp/firephp-core/lib/'; |
|
28 | + private static $firephp_class_path = 'FirePHPCore/FirePHP.class.php'; |
|
29 | + |
|
30 | + /** |
|
31 | + * Return name of logger |
|
32 | + * |
|
33 | + * @return string Name of logger |
|
34 | + */ |
|
35 | + public function getName() |
|
36 | + { |
|
37 | + return 'FirePHP'; |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') |
|
42 | + * |
|
43 | + * @return string |
|
44 | + */ |
|
45 | + public function getVersion() |
|
46 | + { |
|
47 | + return 'dolibarr'; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * Content of the info tooltip. |
|
52 | + * |
|
53 | + * @return false|string |
|
54 | + */ |
|
55 | + public function getInfo() |
|
56 | + { |
|
57 | + global $langs; |
|
58 | + |
|
59 | + return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Is the module active ? |
|
64 | + * |
|
65 | + * @return int |
|
66 | + */ |
|
67 | + public function isActive() |
|
68 | + { |
|
69 | + global $conf; |
|
70 | + try |
|
71 | + { |
|
72 | + if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) { |
|
73 | + $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path; |
|
74 | + } |
|
75 | + set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); |
|
76 | + $res = @include_once self::$firephp_class_path; |
|
77 | + restore_include_path(); |
|
78 | + if ($res) { |
|
79 | + return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler |
|
80 | + } else { |
|
81 | + return 0; |
|
82 | + } |
|
83 | + } |
|
84 | + catch(Exception $e) |
|
85 | + { |
|
86 | + print '<!-- FirePHP not available into PHP -->'."\n"; |
|
87 | + } |
|
88 | + |
|
89 | + return -1; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Return array of configuration data |
|
94 | + * |
|
95 | + * @return array Return array of configuration data |
|
96 | + */ |
|
97 | + public function configure() |
|
98 | + { |
|
99 | + global $langs; |
|
100 | + |
|
101 | + return array( |
|
102 | + array( |
|
103 | + 'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'), |
|
104 | + 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH', |
|
105 | + 'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path, |
|
106 | + 'attr' => 'size="60"', |
|
107 | + 'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path |
|
108 | + ) |
|
109 | + ); |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Return if configuration is valid |
|
114 | + * |
|
115 | + * @return array Array of errors. Empty array if ok. |
|
116 | + */ |
|
117 | + public function checkConfiguration() |
|
118 | + { |
|
119 | + global $conf, $langs; |
|
120 | + |
|
121 | + $errors = array(); |
|
122 | + |
|
123 | + if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) |
|
124 | + { |
|
125 | + $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop |
|
126 | + if (is_object($langs)) // $langs may not be defined yet. |
|
127 | + { |
|
128 | + $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); |
|
129 | + } |
|
130 | + else |
|
131 | + { |
|
132 | + $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + return $errors; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Output log content |
|
141 | + * |
|
142 | + * @param array $content Content to log |
|
143 | + * @return null|false |
|
144 | + */ |
|
145 | + public function export($content) |
|
146 | + { |
|
147 | + global $conf; |
|
148 | + |
|
149 | + if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler |
|
150 | + |
|
151 | + //We check the configuration to avoid showing PHP warnings |
|
152 | + if (count($this->checkConfiguration())) return false; |
|
153 | + |
|
154 | + try |
|
155 | + { |
|
156 | + // Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once a constant from |
|
157 | + // database or config file because we must be able to log data before database or config file read. |
|
158 | + $oldinclude=get_include_path(); |
|
159 | + set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); |
|
160 | + include_once self::$firephp_class_path; |
|
161 | + set_include_path($oldinclude); |
|
162 | + ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
163 | + $firephp = FirePHP::getInstance(true); |
|
164 | + if ($content['level'] == LOG_ERR) $firephp->error($content['message']); |
|
165 | + elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']); |
|
166 | + elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']); |
|
167 | + else $firephp->log($content['message']); |
|
168 | + } |
|
169 | + catch (Exception $e) |
|
170 | + { |
|
171 | + // Do not use dol_syslog here to avoid infinite loop |
|
172 | + return false; |
|
173 | + } |
|
174 | + } |
|
175 | 175 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | global $langs; |
58 | 58 | |
59 | - return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path); |
|
59 | + return ($this->isActive() == 1) ? '' : $langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | try |
71 | 71 | { |
72 | 72 | if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) { |
73 | - $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path; |
|
73 | + $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT.self::$firephp_include_path; |
|
74 | 74 | } |
75 | 75 | set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); |
76 | 76 | $res = @include_once self::$firephp_class_path; |
77 | 77 | restore_include_path(); |
78 | 78 | if ($res) { |
79 | - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler |
|
79 | + return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP) ? 1 : 0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler |
|
80 | 80 | } else { |
81 | 81 | return 0; |
82 | 82 | } |
83 | 83 | } |
84 | - catch(Exception $e) |
|
84 | + catch (Exception $e) |
|
85 | 85 | { |
86 | 86 | print '<!-- FirePHP not available into PHP -->'."\n"; |
87 | 87 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | array( |
103 | 103 | 'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'), |
104 | 104 | 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH', |
105 | - 'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path, |
|
105 | + 'default' => DOL_DOCUMENT_ROOT.self::$firephp_include_path, |
|
106 | 106 | 'attr' => 'size="60"', |
107 | - 'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path |
|
107 | + 'example' => '/usr/share/php, '.DOL_DOCUMENT_ROOT.self::$firephp_include_path |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $errors = array(); |
122 | 122 | |
123 | - if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) |
|
123 | + if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH.self::$firephp_class_path)) |
|
124 | 124 | { |
125 | 125 | $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop |
126 | 126 | if (is_object($langs)) // $langs may not be defined yet. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | else |
131 | 131 | { |
132 | - $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; |
|
132 | + $errors[] = "ErrorFailedToOpenFile ".self::$firephp_class_path; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | global $conf; |
148 | 148 | |
149 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler |
|
149 | + if (!empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler |
|
150 | 150 | |
151 | 151 | //We check the configuration to avoid showing PHP warnings |
152 | 152 | if (count($this->checkConfiguration())) return false; |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | { |
156 | 156 | // Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once a constant from |
157 | 157 | // database or config file because we must be able to log data before database or config file read. |
158 | - $oldinclude=get_include_path(); |
|
158 | + $oldinclude = get_include_path(); |
|
159 | 159 | set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); |
160 | 160 | include_once self::$firephp_class_path; |
161 | 161 | set_include_path($oldinclude); |
162 | - ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
162 | + ob_start(); // To be sure headers are not flushed until all page is completely processed |
|
163 | 163 | $firephp = FirePHP::getInstance(true); |
164 | 164 | if ($content['level'] == LOG_ERR) $firephp->error($content['message']); |
165 | 165 | elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']); |
@@ -80,8 +80,7 @@ discard block |
||
80 | 80 | } else { |
81 | 81 | return 0; |
82 | 82 | } |
83 | - } |
|
84 | - catch(Exception $e) |
|
83 | + } catch(Exception $e) |
|
85 | 84 | { |
86 | 85 | print '<!-- FirePHP not available into PHP -->'."\n"; |
87 | 86 | } |
@@ -123,11 +122,12 @@ discard block |
||
123 | 122 | if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) |
124 | 123 | { |
125 | 124 | $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop |
126 | - if (is_object($langs)) // $langs may not be defined yet. |
|
125 | + if (is_object($langs)) { |
|
126 | + // $langs may not be defined yet. |
|
127 | 127 | { |
128 | 128 | $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); |
129 | 129 | } |
130 | - else |
|
130 | + } else |
|
131 | 131 | { |
132 | 132 | $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; |
133 | 133 | } |
@@ -146,10 +146,15 @@ discard block |
||
146 | 146 | { |
147 | 147 | global $conf; |
148 | 148 | |
149 | - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler |
|
149 | + if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) { |
|
150 | + return; |
|
151 | + } |
|
152 | + // Global option to disable output of this handler |
|
150 | 153 | |
151 | 154 | //We check the configuration to avoid showing PHP warnings |
152 | - if (count($this->checkConfiguration())) return false; |
|
155 | + if (count($this->checkConfiguration())) { |
|
156 | + return false; |
|
157 | + } |
|
153 | 158 | |
154 | 159 | try |
155 | 160 | { |
@@ -161,12 +166,16 @@ discard block |
||
161 | 166 | set_include_path($oldinclude); |
162 | 167 | ob_start(); // To be sure headers are not flushed until all page is completely processed |
163 | 168 | $firephp = FirePHP::getInstance(true); |
164 | - if ($content['level'] == LOG_ERR) $firephp->error($content['message']); |
|
165 | - elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']); |
|
166 | - elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']); |
|
167 | - else $firephp->log($content['message']); |
|
168 | - } |
|
169 | - catch (Exception $e) |
|
169 | + if ($content['level'] == LOG_ERR) { |
|
170 | + $firephp->error($content['message']); |
|
171 | + } elseif ($content['level'] == LOG_WARNING) { |
|
172 | + $firephp->warn($content['message']); |
|
173 | + } elseif ($content['level'] == LOG_INFO) { |
|
174 | + $firephp->log($content['message']); |
|
175 | + } else { |
|
176 | + $firephp->log($content['message']); |
|
177 | + } |
|
178 | + } catch (Exception $e) |
|
170 | 179 | { |
171 | 180 | // Do not use dol_syslog here to avoid infinite loop |
172 | 181 | return false; |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | { |
39 | 39 | |
40 | 40 | /** |
41 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
42 | - * |
|
43 | - * @param DoliDB $db Database handler |
|
41 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
42 | + * |
|
43 | + * @param DoliDB $db Database handler |
|
44 | 44 | */ |
45 | 45 | function __construct($db) |
46 | 46 | { |
47 | - global $conf; |
|
47 | + global $conf; |
|
48 | 48 | |
49 | 49 | $this->db = $db; |
50 | 50 | $this->numero = 310; |
51 | 51 | |
52 | 52 | $this->family = "hr"; |
53 | 53 | $this->module_position = '55'; |
54 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
55 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
54 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
55 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
56 | 56 | $this->description = "Management of members of a foundation or association"; |
57 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
57 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
58 | 58 | $this->version = 'dolibarr'; |
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | 60 | $this->picto='user'; |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | |
68 | 68 | // Dependencies |
69 | 69 | $this->hidden = false; // A condition to hide module |
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array('modMailmanSpip'); // List of module class names as string this module is in conflict with |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array('modMailmanSpip'); // List of module class names as string this module is in conflict with |
|
73 | 73 | $this->langfiles = array("members","companies"); |
74 | 74 | $this->phpmin = array(5,4); // Minimum version of PHP required by module |
75 | 75 | |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | $this->rights[$r][5] = 'creer'; |
249 | 249 | |
250 | 250 | |
251 | - // Menus |
|
252 | - //------- |
|
253 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
251 | + // Menus |
|
252 | + //------- |
|
253 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
254 | 254 | |
255 | 255 | |
256 | 256 | // Exports |
@@ -269,36 +269,36 @@ discard block |
||
269 | 269 | $this->export_label[$r]='MembersAndSubscriptions'; |
270 | 270 | $this->export_permission[$r]=array(array("adherent","export")); |
271 | 271 | $this->export_fields_array[$r]=array( |
272 | - 'a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.gender'=>"Gender",'a.morphy'=>'Nature', |
|
273 | - 'a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country", |
|
274 | - 'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status", |
|
275 | - 'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation', |
|
276 | - 'a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel', |
|
277 | - 'c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.subscription'=>'Amount' |
|
278 | - ); |
|
272 | + 'a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.gender'=>"Gender",'a.morphy'=>'Nature', |
|
273 | + 'a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country", |
|
274 | + 'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status", |
|
275 | + 'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation', |
|
276 | + 'a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel', |
|
277 | + 'c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.subscription'=>'Amount' |
|
278 | + ); |
|
279 | 279 | $this->export_TypeFields_array[$r]=array( |
280 | - 'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.gender'=>'Text','a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text", |
|
281 | - 'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text", |
|
282 | - 'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date', |
|
283 | - 'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric' |
|
284 | - ); |
|
280 | + 'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.gender'=>'Text','a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text", |
|
281 | + 'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text", |
|
282 | + 'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date', |
|
283 | + 'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric' |
|
284 | + ); |
|
285 | 285 | $this->export_entities_array[$r]=array( |
286 | - 'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.gender'=>'member','a.morphy'=>'member', |
|
287 | - 'a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member", |
|
288 | - 'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member", |
|
289 | - 'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member', |
|
290 | - 'a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.subscription'=>'subscription' |
|
291 | - ); |
|
286 | + 'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.gender'=>'member','a.morphy'=>'member', |
|
287 | + 'a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member", |
|
288 | + 'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member", |
|
289 | + 'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member', |
|
290 | + 'a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.subscription'=>'subscription' |
|
291 | + ); |
|
292 | 292 | // Add extra fields |
293 | 293 | $keyforselect='adherent'; $keyforelement='member'; $keyforaliasextra='extra'; |
294 | 294 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
295 | - // End add axtra fields |
|
295 | + // End add axtra fields |
|
296 | 296 | $this->export_sql_start[$r]='SELECT DISTINCT '; |
297 | 297 | $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'adherent_type as ta, '.MAIN_DB_PREFIX.'adherent as a)'; |
298 | 298 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON a.rowid = extra.fk_object'; |
299 | 299 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'subscription as c ON c.fk_adherent = a.rowid'; |
300 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid'; |
|
301 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid'; |
|
300 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid'; |
|
301 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid'; |
|
302 | 302 | $this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity('member_type').') '; |
303 | 303 | $this->export_dependencies_array[$r]=array('subscription'=>'c.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
304 | 304 | |
@@ -317,54 +317,54 @@ discard block |
||
317 | 317 | $this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent','extra'=>MAIN_DB_PREFIX.'adherent_extrafields'); |
318 | 318 | $this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id |
319 | 319 | $this->import_fields_array[$r]=array( |
320 | - 'a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.gender'=>"Gender",'a.login'=>"Login*","a.pass"=>"Password", |
|
321 | - "a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town", |
|
322 | - 'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile", |
|
323 | - 'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate", |
|
324 | - 'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription' |
|
325 | - ); |
|
326 | - // Add extra fields |
|
327 | - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; |
|
328 | - $resql=$this->db->query($sql); |
|
329 | - if ($resql) // This can fail when class is used on old database (during migration for example) |
|
330 | - { |
|
331 | - while ($obj=$this->db->fetch_object($resql)) |
|
332 | - { |
|
333 | - $fieldname='extra.'.$obj->name; |
|
334 | - $fieldlabel=ucfirst($obj->label); |
|
335 | - $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); |
|
336 | - } |
|
337 | - } |
|
338 | - // End add extra fields |
|
339 | - $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
|
340 | - $this->import_regex_array[$r]=array( |
|
341 | - 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)', |
|
342 | - 'a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); |
|
320 | + 'a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.gender'=>"Gender",'a.login'=>"Login*","a.pass"=>"Password", |
|
321 | + "a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town", |
|
322 | + 'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile", |
|
323 | + 'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate", |
|
324 | + 'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription' |
|
325 | + ); |
|
326 | + // Add extra fields |
|
327 | + $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; |
|
328 | + $resql=$this->db->query($sql); |
|
329 | + if ($resql) // This can fail when class is used on old database (during migration for example) |
|
330 | + { |
|
331 | + while ($obj=$this->db->fetch_object($resql)) |
|
332 | + { |
|
333 | + $fieldname='extra.'.$obj->name; |
|
334 | + $fieldlabel=ucfirst($obj->label); |
|
335 | + $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); |
|
336 | + } |
|
337 | + } |
|
338 | + // End add extra fields |
|
339 | + $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
|
340 | + $this->import_regex_array[$r]=array( |
|
341 | + 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)', |
|
342 | + 'a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); |
|
343 | 343 | $this->import_examplevalues_array[$r]=array( |
344 | - 'a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1', |
|
345 | - 'a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1', |
|
346 | - 'a.email'=>'[email protected]','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member", |
|
347 | - 'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d') |
|
348 | - ); |
|
344 | + 'a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1', |
|
345 | + 'a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1', |
|
346 | + 'a.email'=>'[email protected]','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member", |
|
347 | + 'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d') |
|
348 | + ); |
|
349 | 349 | |
350 | 350 | // Cronjobs |
351 | 351 | $arraydate=dol_getdate(dol_now()); |
352 | 352 | $datestart=dol_mktime(22, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); |
353 | 353 | $this->cronjobs = array( |
354 | - 0=>array( |
|
355 | - 'label'=>'SendReminderForExpiredSubscriptionTitle', |
|
356 | - 'jobtype'=>'method', 'class'=>'adherents/class/adherent.class.php', |
|
357 | - 'objectname'=>'Adherent', |
|
358 | - 'method'=>'sendReminderForExpiredSubscription', |
|
359 | - 'parameters'=>'10;0', |
|
360 | - 'comment'=>'SendReminderForExpiredSubscription', |
|
361 | - 'frequency'=>1, |
|
362 | - 'unitfrequency'=> 3600 * 24, |
|
363 | - 'priority'=>50, |
|
364 | - 'status'=>1, |
|
365 | - 'test'=>'$conf->adherent->enabled', |
|
366 | - 'datestart'=>$datestart |
|
367 | - ), |
|
354 | + 0=>array( |
|
355 | + 'label'=>'SendReminderForExpiredSubscriptionTitle', |
|
356 | + 'jobtype'=>'method', 'class'=>'adherents/class/adherent.class.php', |
|
357 | + 'objectname'=>'Adherent', |
|
358 | + 'method'=>'sendReminderForExpiredSubscription', |
|
359 | + 'parameters'=>'10;0', |
|
360 | + 'comment'=>'SendReminderForExpiredSubscription', |
|
361 | + 'frequency'=>1, |
|
362 | + 'unitfrequency'=> 3600 * 24, |
|
363 | + 'priority'=>50, |
|
364 | + 'status'=>1, |
|
365 | + 'test'=>'$conf->adherent->enabled', |
|
366 | + 'datestart'=>$datestart |
|
367 | + ), |
|
368 | 368 | ); |
369 | 369 | } |
370 | 370 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * \ingroup member |
30 | 30 | * \brief File descriptor or module Member |
31 | 31 | */ |
32 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
32 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Class to describe and enable module Adherent |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | $this->family = "hr"; |
53 | 53 | $this->module_position = '55'; |
54 | 54 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
55 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
55 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
56 | 56 | $this->description = "Management of members of a foundation or association"; |
57 | 57 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
58 | 58 | $this->version = 'dolibarr'; |
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | - $this->picto='user'; |
|
60 | + $this->picto = 'user'; |
|
61 | 61 | |
62 | 62 | // Data directories to create when module is enabled |
63 | 63 | $this->dirs = array("/adherent/temp"); |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | $this->config_page_url = array("adherent.php@adherents"); |
67 | 67 | |
68 | 68 | // Dependencies |
69 | - $this->hidden = false; // A condition to hide module |
|
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array('modMailmanSpip'); // List of module class names as string this module is in conflict with |
|
73 | - $this->langfiles = array("members","companies"); |
|
74 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
69 | + $this->hidden = false; // A condition to hide module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array('modMailmanSpip'); // List of module class names as string this module is in conflict with |
|
73 | + $this->langfiles = array("members", "companies"); |
|
74 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
75 | 75 | |
76 | 76 | // Constants |
77 | 77 | $this->const = array(); |
78 | - $r=0; |
|
78 | + $r = 0; |
|
79 | 79 | |
80 | 80 | $this->const[$r][0] = "ADHERENT_ADDON_PDF"; |
81 | 81 | $this->const[$r][1] = "chaine"; |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | |
182 | 182 | // Boxes |
183 | 183 | //------- |
184 | - $this->boxes = array(0=>array('file'=>'box_members.php','enabledbydefaulton'=>'Home')); |
|
184 | + $this->boxes = array(0=>array('file'=>'box_members.php', 'enabledbydefaulton'=>'Home')); |
|
185 | 185 | |
186 | 186 | // Permissions |
187 | 187 | //------------ |
188 | 188 | $this->rights = array(); |
189 | 189 | $this->rights_class = 'adherent'; |
190 | - $r=0; |
|
190 | + $r = 0; |
|
191 | 191 | |
192 | 192 | // $this->rights[$r][0] Id permission (unique tous modules confondus) |
193 | 193 | // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | |
251 | 251 | // Menus |
252 | 252 | //------- |
253 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
253 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
254 | 254 | |
255 | 255 | |
256 | 256 | // Exports |
257 | 257 | //-------- |
258 | - $r=0; |
|
258 | + $r = 0; |
|
259 | 259 | |
260 | 260 | // $this->export_code[$r] Code unique identifiant l'export (tous modules confondus) |
261 | 261 | // $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code) |
@@ -265,91 +265,91 @@ discard block |
||
265 | 265 | // $this->export_sql[$r] Requete sql qui offre les donnees a l'export |
266 | 266 | |
267 | 267 | $r++; |
268 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
269 | - $this->export_label[$r]='MembersAndSubscriptions'; |
|
270 | - $this->export_permission[$r]=array(array("adherent","export")); |
|
271 | - $this->export_fields_array[$r]=array( |
|
272 | - 'a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.gender'=>"Gender",'a.morphy'=>'Nature', |
|
273 | - 'a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country", |
|
274 | - 'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status", |
|
275 | - 'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation', |
|
276 | - 'a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel', |
|
277 | - 'c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.subscription'=>'Amount' |
|
268 | + $this->export_code[$r] = $this->rights_class.'_'.$r; |
|
269 | + $this->export_label[$r] = 'MembersAndSubscriptions'; |
|
270 | + $this->export_permission[$r] = array(array("adherent", "export")); |
|
271 | + $this->export_fields_array[$r] = array( |
|
272 | + 'a.rowid'=>'Id', 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname", 'a.firstname'=>"Firstname", 'a.login'=>"Login", 'a.gender'=>"Gender", 'a.morphy'=>'Nature', |
|
273 | + 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", 'd.nom'=>"State", 'co.code'=>"CountryCode", 'co.label'=>"Country", |
|
274 | + 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status", |
|
275 | + 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.datec'=>'DateCreation', 'a.datevalid'=>'DateValidation', |
|
276 | + 'a.tms'=>'DateLastModification', 'a.datefin'=>'DateEndSubscription', 'ta.rowid'=>'MemberTypeId', 'ta.libelle'=>'MemberTypeLabel', |
|
277 | + 'c.rowid'=>'SubscriptionId', 'c.dateadh'=>'DateSubscription', 'c.subscription'=>'Amount' |
|
278 | 278 | ); |
279 | - $this->export_TypeFields_array[$r]=array( |
|
280 | - 'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.gender'=>'Text','a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text", |
|
281 | - 'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text", |
|
282 | - 'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date', |
|
283 | - 'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric' |
|
279 | + $this->export_TypeFields_array[$r] = array( |
|
280 | + 'a.civility'=>"Text", 'a.lastname'=>"Text", 'a.firstname'=>"Text", 'a.login'=>"Text", 'a.gender'=>'Text', 'a.morphy'=>'Text', 'a.societe'=>'Text', 'a.address'=>"Text", |
|
281 | + 'a.zip'=>"Text", 'a.town'=>"Text", 'd.nom'=>"Text", 'co.code'=>'Text', 'co.label'=>"Text", 'a.phone'=>"Text", 'a.phone_perso'=>"Text", 'a.phone_mobile'=>"Text", |
|
282 | + 'a.email'=>"Text", 'a.birth'=>"Date", 'a.statut'=>"Status", 'a.note_public'=>"Text", 'a.note_private'=>"Text", 'a.datec'=>'Date', 'a.datevalid'=>'Date', |
|
283 | + 'a.tms'=>'Date', 'a.datefin'=>'Date', 'ta.rowid'=>'List:adherent_type:libelle', 'ta.libelle'=>'Text', 'c.rowid'=>'Numeric', 'c.dateadh'=>'Date', 'c.subscription'=>'Numeric' |
|
284 | 284 | ); |
285 | - $this->export_entities_array[$r]=array( |
|
286 | - 'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.gender'=>'member','a.morphy'=>'member', |
|
287 | - 'a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member", |
|
288 | - 'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member", |
|
289 | - 'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member', |
|
290 | - 'a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.subscription'=>'subscription' |
|
285 | + $this->export_entities_array[$r] = array( |
|
286 | + 'a.rowid'=>'member', 'a.civility'=>"member", 'a.lastname'=>"member", 'a.firstname'=>"member", 'a.login'=>"member", 'a.gender'=>'member', 'a.morphy'=>'member', |
|
287 | + 'a.societe'=>'member', 'a.address'=>"member", 'a.zip'=>"member", 'a.town'=>"member", 'd.nom'=>"member", 'co.code'=>"member", 'co.label'=>"member", |
|
288 | + 'a.phone'=>"member", 'a.phone_perso'=>"member", 'a.phone_mobile'=>"member", 'a.email'=>"member", 'a.birth'=>"member", 'a.statut'=>"member", |
|
289 | + 'a.photo'=>"member", 'a.note_public'=>"member", 'a.note_private'=>"member", 'a.datec'=>'member', 'a.datevalid'=>'member', 'a.tms'=>'member', |
|
290 | + 'a.datefin'=>'member', 'ta.rowid'=>'member_type', 'ta.libelle'=>'member_type', 'c.rowid'=>'subscription', 'c.dateadh'=>'subscription', 'c.subscription'=>'subscription' |
|
291 | 291 | ); |
292 | 292 | // Add extra fields |
293 | - $keyforselect='adherent'; $keyforelement='member'; $keyforaliasextra='extra'; |
|
293 | + $keyforselect = 'adherent'; $keyforelement = 'member'; $keyforaliasextra = 'extra'; |
|
294 | 294 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
295 | 295 | // End add axtra fields |
296 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
297 | - $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'adherent_type as ta, '.MAIN_DB_PREFIX.'adherent as a)'; |
|
298 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON a.rowid = extra.fk_object'; |
|
299 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'subscription as c ON c.fk_adherent = a.rowid'; |
|
300 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid'; |
|
301 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid'; |
|
302 | - $this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity('member_type').') '; |
|
303 | - $this->export_dependencies_array[$r]=array('subscription'=>'c.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
296 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
297 | + $this->export_sql_end[$r] = ' FROM ('.MAIN_DB_PREFIX.'adherent_type as ta, '.MAIN_DB_PREFIX.'adherent as a)'; |
|
298 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON a.rowid = extra.fk_object'; |
|
299 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'subscription as c ON c.fk_adherent = a.rowid'; |
|
300 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid'; |
|
301 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid'; |
|
302 | + $this->export_sql_end[$r] .= ' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity('member_type').') '; |
|
303 | + $this->export_dependencies_array[$r] = array('subscription'=>'c.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
304 | 304 | |
305 | 305 | // Imports |
306 | 306 | //-------- |
307 | - $r=0; |
|
307 | + $r = 0; |
|
308 | 308 | |
309 | - $now=dol_now(); |
|
309 | + $now = dol_now(); |
|
310 | 310 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
311 | 311 | |
312 | 312 | $r++; |
313 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
314 | - $this->import_label[$r]="Members"; // Translation key |
|
315 | - $this->import_icon[$r]=$this->picto; |
|
316 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
317 | - $this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent','extra'=>MAIN_DB_PREFIX.'adherent_extrafields'); |
|
318 | - $this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id |
|
319 | - $this->import_fields_array[$r]=array( |
|
320 | - 'a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.gender'=>"Gender",'a.login'=>"Login*","a.pass"=>"Password", |
|
321 | - "a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town", |
|
322 | - 'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile", |
|
323 | - 'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate", |
|
324 | - 'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription' |
|
313 | + $this->import_code[$r] = $this->rights_class.'_'.$r; |
|
314 | + $this->import_label[$r] = "Members"; // Translation key |
|
315 | + $this->import_icon[$r] = $this->picto; |
|
316 | + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
|
317 | + $this->import_tables_array[$r] = array('a'=>MAIN_DB_PREFIX.'adherent', 'extra'=>MAIN_DB_PREFIX.'adherent_extrafields'); |
|
318 | + $this->import_tables_creator_array[$r] = array('a'=>'fk_user_author'); // Fields to store import user id |
|
319 | + $this->import_fields_array[$r] = array( |
|
320 | + 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname*", 'a.firstname'=>"Firstname", 'a.gender'=>"Gender", 'a.login'=>"Login*", "a.pass"=>"Password", |
|
321 | + "a.fk_adherent_type"=>"MemberType*", 'a.morphy'=>'Nature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", |
|
322 | + 'a.state_id'=>'StateId', 'a.country'=>"CountryId", 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", |
|
323 | + 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status*", 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", |
|
324 | + 'a.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription' |
|
325 | 325 | ); |
326 | 326 | // Add extra fields |
327 | - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; |
|
328 | - $resql=$this->db->query($sql); |
|
327 | + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; |
|
328 | + $resql = $this->db->query($sql); |
|
329 | 329 | if ($resql) // This can fail when class is used on old database (during migration for example) |
330 | 330 | { |
331 | - while ($obj=$this->db->fetch_object($resql)) |
|
331 | + while ($obj = $this->db->fetch_object($resql)) |
|
332 | 332 | { |
333 | - $fieldname='extra.'.$obj->name; |
|
334 | - $fieldlabel=ucfirst($obj->label); |
|
335 | - $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); |
|
333 | + $fieldname = 'extra.'.$obj->name; |
|
334 | + $fieldlabel = ucfirst($obj->label); |
|
335 | + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | // End add extra fields |
339 | - $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
|
340 | - $this->import_regex_array[$r]=array( |
|
341 | - 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)', |
|
342 | - 'a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); |
|
343 | - $this->import_examplevalues_array[$r]=array( |
|
344 | - 'a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1', |
|
345 | - 'a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1', |
|
346 | - 'a.email'=>'[email protected]','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member", |
|
347 | - 'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d') |
|
339 | + $this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
|
340 | + $this->import_regex_array[$r] = array( |
|
341 | + 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility', 'a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type', 'a.morphy'=>'(phy|mor)', |
|
342 | + 'a.statut'=>'^[0|1]', 'a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); |
|
343 | + $this->import_examplevalues_array[$r] = array( |
|
344 | + 'a.civility'=>"MR", 'a.lastname'=>'Smith', 'a.firstname'=>'John', 'a.login'=>'jsmith', 'a.pass'=>'passofjsmith', 'a.fk_adherent_type'=>'1', |
|
345 | + 'a.morphy'=>'"mor" or "phy"', 'a.societe'=>'JS company', 'a.address'=>'21 jump street', 'a.zip'=>'55000', 'a.town'=>'New York', 'a.country'=>'1', |
|
346 | + 'a.email'=>'[email protected]', 'a.birth'=>'1972-10-10', 'a.statut'=>"0 or 1", 'a.note_public'=>"This is a public comment on member", |
|
347 | + 'a.note_private'=>"This is private comment on member", 'a.datec'=>dol_print_date($now, '%Y-%m__%d'), 'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'), '%Y-%m-%d') |
|
348 | 348 | ); |
349 | 349 | |
350 | 350 | // Cronjobs |
351 | - $arraydate=dol_getdate(dol_now()); |
|
352 | - $datestart=dol_mktime(22, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); |
|
351 | + $arraydate = dol_getdate(dol_now()); |
|
352 | + $datestart = dol_mktime(22, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); |
|
353 | 353 | $this->cronjobs = array( |
354 | 354 | 0=>array( |
355 | 355 | 'label'=>'SendReminderForExpiredSubscriptionTitle', |
@@ -377,9 +377,9 @@ discard block |
||
377 | 377 | * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes') |
378 | 378 | * @return int 1 if OK, 0 if KO |
379 | 379 | */ |
380 | - function init($options='') |
|
380 | + function init($options = '') |
|
381 | 381 | { |
382 | - global $conf,$langs; |
|
382 | + global $conf, $langs; |
|
383 | 383 | |
384 | 384 | // Permissions |
385 | 385 | $this->remove($options); |
@@ -408,6 +408,6 @@ discard block |
||
408 | 408 | "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".$conf->entity.")" |
409 | 409 | ); |
410 | 410 | |
411 | - return $this->_init($sql,$options); |
|
411 | + return $this->_init($sql, $options); |
|
412 | 412 | } |
413 | 413 | } |
@@ -326,11 +326,13 @@ |
||
326 | 326 | // Add extra fields |
327 | 327 | $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; |
328 | 328 | $resql=$this->db->query($sql); |
329 | - if ($resql) // This can fail when class is used on old database (during migration for example) |
|
329 | + if ($resql) { |
|
330 | + // This can fail when class is used on old database (during migration for example) |
|
330 | 331 | { |
331 | 332 | while ($obj=$this->db->fetch_object($resql)) |
332 | 333 | { |
333 | 334 | $fieldname='extra.'.$obj->name; |
335 | + } |
|
334 | 336 | $fieldlabel=ucfirst($obj->label); |
335 | 337 | $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); |
336 | 338 | } |
@@ -32,157 +32,157 @@ discard block |
||
32 | 32 | */ |
33 | 33 | class modCategorie extends DolibarrModules |
34 | 34 | { |
35 | - /** |
|
36 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
37 | - * |
|
38 | - * @param DoliDB $db Database handler |
|
39 | - */ |
|
40 | - function __construct($db) |
|
41 | - { |
|
42 | - global $conf; |
|
43 | - |
|
44 | - $this->db = $db; |
|
45 | - $this->numero = 1780; |
|
46 | - |
|
47 | - $this->family = "technic"; |
|
48 | - $this->module_position = '20'; |
|
49 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | - $this->description = "Gestion des categories (produits, clients, fournisseurs...)"; |
|
52 | - |
|
53 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
54 | - $this->version = 'dolibarr'; |
|
55 | - |
|
56 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
57 | - $this->picto = 'category'; |
|
58 | - |
|
59 | - // Data directories to create when module is enabled |
|
60 | - $this->dirs = array(); |
|
61 | - |
|
62 | - // Dependencies |
|
63 | - $this->depends = array(); |
|
64 | - |
|
65 | - // Config pages |
|
66 | - $this->config_page_url = array('categorie.php@categories'); |
|
67 | - $this->langfiles = array("products","companies","categories","members"); |
|
68 | - |
|
69 | - // Constants |
|
70 | - $this->const = array(); |
|
71 | - $r=0; |
|
72 | - $this->const[$r][0] = "CATEGORIE_RECURSIV_ADD"; |
|
73 | - $this->const[$r][1] = "yesno"; |
|
74 | - $this->const[$r][2] = "0"; |
|
75 | - $this->const[$r][3] = 'Affect parent categories'; |
|
76 | - $this->const[$r][4] = 0; |
|
77 | - $r++; |
|
78 | - |
|
79 | - // Boxes |
|
80 | - $this->boxes = array(); |
|
81 | - |
|
82 | - // Permissions |
|
83 | - $this->rights = array(); |
|
84 | - $this->rights_class = 'categorie'; |
|
85 | - |
|
86 | - $r=0; |
|
87 | - |
|
88 | - $this->rights[$r][0] = 241; // id de la permission |
|
89 | - $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission |
|
90 | - $this->rights[$r][2] = 'r'; // type de la permission (deprecated) |
|
91 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
92 | - $this->rights[$r][4] = 'lire'; |
|
93 | - $r++; |
|
94 | - |
|
95 | - $this->rights[$r][0] = 242; // id de la permission |
|
96 | - $this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission |
|
97 | - $this->rights[$r][2] = 'w'; // type de la permission (deprecated) |
|
98 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
99 | - $this->rights[$r][4] = 'creer'; |
|
100 | - $r++; |
|
101 | - |
|
102 | - $this->rights[$r][0] = 243; // id de la permission |
|
103 | - $this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission |
|
104 | - $this->rights[$r][2] = 'd'; // type de la permission (deprecated) |
|
105 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
106 | - $this->rights[$r][4] = 'supprimer'; |
|
107 | - $r++; |
|
108 | - |
|
109 | - |
|
110 | - // Menus |
|
111 | - //------- |
|
112 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
113 | - |
|
114 | - |
|
115 | - // Exports |
|
116 | - //-------- |
|
117 | - $r=0; |
|
118 | - |
|
119 | - $r++; |
|
120 | - $this->export_code[$r]='category_'.$r; |
|
121 | - $this->export_label[$r]='CatSupList'; |
|
122 | - $this->export_icon[$r]='category'; |
|
123 | - $this->export_enabled[$r]='$conf->fournisseur->enabled'; |
|
124 | - $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire")); |
|
125 | - $this->export_fields_array[$r]=array( |
|
126 | - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", |
|
127 | - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", |
|
128 | - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", |
|
129 | - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", |
|
130 | - 's.note_public'=>"NotePublic" |
|
131 | - ); |
|
132 | - $this->export_TypeFields_array[$r]=array( |
|
133 | - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date", |
|
134 | - 's.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text", |
|
135 | - 's.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text", |
|
136 | - 's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text" |
|
137 | - ); |
|
138 | - $this->export_entities_array[$r]=array( |
|
139 | - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", |
|
140 | - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", |
|
141 | - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", |
|
142 | - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company" |
|
143 | - ); // We define here only fields that use another picto |
|
144 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
145 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
146 | - $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, '; |
|
147 | - $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; |
|
148 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
149 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
150 | - $this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories |
|
151 | - |
|
152 | - $r++; |
|
153 | - $this->export_code[$r]='category_'.$r; |
|
154 | - $this->export_label[$r]='CatCusList'; |
|
155 | - $this->export_icon[$r]='category'; |
|
35 | + /** |
|
36 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
37 | + * |
|
38 | + * @param DoliDB $db Database handler |
|
39 | + */ |
|
40 | + function __construct($db) |
|
41 | + { |
|
42 | + global $conf; |
|
43 | + |
|
44 | + $this->db = $db; |
|
45 | + $this->numero = 1780; |
|
46 | + |
|
47 | + $this->family = "technic"; |
|
48 | + $this->module_position = '20'; |
|
49 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->description = "Gestion des categories (produits, clients, fournisseurs...)"; |
|
52 | + |
|
53 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
54 | + $this->version = 'dolibarr'; |
|
55 | + |
|
56 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
57 | + $this->picto = 'category'; |
|
58 | + |
|
59 | + // Data directories to create when module is enabled |
|
60 | + $this->dirs = array(); |
|
61 | + |
|
62 | + // Dependencies |
|
63 | + $this->depends = array(); |
|
64 | + |
|
65 | + // Config pages |
|
66 | + $this->config_page_url = array('categorie.php@categories'); |
|
67 | + $this->langfiles = array("products","companies","categories","members"); |
|
68 | + |
|
69 | + // Constants |
|
70 | + $this->const = array(); |
|
71 | + $r=0; |
|
72 | + $this->const[$r][0] = "CATEGORIE_RECURSIV_ADD"; |
|
73 | + $this->const[$r][1] = "yesno"; |
|
74 | + $this->const[$r][2] = "0"; |
|
75 | + $this->const[$r][3] = 'Affect parent categories'; |
|
76 | + $this->const[$r][4] = 0; |
|
77 | + $r++; |
|
78 | + |
|
79 | + // Boxes |
|
80 | + $this->boxes = array(); |
|
81 | + |
|
82 | + // Permissions |
|
83 | + $this->rights = array(); |
|
84 | + $this->rights_class = 'categorie'; |
|
85 | + |
|
86 | + $r=0; |
|
87 | + |
|
88 | + $this->rights[$r][0] = 241; // id de la permission |
|
89 | + $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission |
|
90 | + $this->rights[$r][2] = 'r'; // type de la permission (deprecated) |
|
91 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
92 | + $this->rights[$r][4] = 'lire'; |
|
93 | + $r++; |
|
94 | + |
|
95 | + $this->rights[$r][0] = 242; // id de la permission |
|
96 | + $this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission |
|
97 | + $this->rights[$r][2] = 'w'; // type de la permission (deprecated) |
|
98 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
99 | + $this->rights[$r][4] = 'creer'; |
|
100 | + $r++; |
|
101 | + |
|
102 | + $this->rights[$r][0] = 243; // id de la permission |
|
103 | + $this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission |
|
104 | + $this->rights[$r][2] = 'd'; // type de la permission (deprecated) |
|
105 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
106 | + $this->rights[$r][4] = 'supprimer'; |
|
107 | + $r++; |
|
108 | + |
|
109 | + |
|
110 | + // Menus |
|
111 | + //------- |
|
112 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
113 | + |
|
114 | + |
|
115 | + // Exports |
|
116 | + //-------- |
|
117 | + $r=0; |
|
118 | + |
|
119 | + $r++; |
|
120 | + $this->export_code[$r]='category_'.$r; |
|
121 | + $this->export_label[$r]='CatSupList'; |
|
122 | + $this->export_icon[$r]='category'; |
|
123 | + $this->export_enabled[$r]='$conf->fournisseur->enabled'; |
|
124 | + $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire")); |
|
125 | + $this->export_fields_array[$r]=array( |
|
126 | + 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", |
|
127 | + 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", |
|
128 | + 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", |
|
129 | + 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", |
|
130 | + 's.note_public'=>"NotePublic" |
|
131 | + ); |
|
132 | + $this->export_TypeFields_array[$r]=array( |
|
133 | + 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date", |
|
134 | + 's.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text", |
|
135 | + 's.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text", |
|
136 | + 's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text" |
|
137 | + ); |
|
138 | + $this->export_entities_array[$r]=array( |
|
139 | + 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", |
|
140 | + 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", |
|
141 | + 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", |
|
142 | + 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company" |
|
143 | + ); // We define here only fields that use another picto |
|
144 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
145 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
146 | + $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, '; |
|
147 | + $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; |
|
148 | + $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
149 | + $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
150 | + $this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories |
|
151 | + |
|
152 | + $r++; |
|
153 | + $this->export_code[$r]='category_'.$r; |
|
154 | + $this->export_label[$r]='CatCusList'; |
|
155 | + $this->export_icon[$r]='category'; |
|
156 | 156 | $this->export_enabled[$r]='$conf->societe->enabled'; |
157 | - $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire")); |
|
158 | - $this->export_fields_array[$r]=array( |
|
159 | - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", |
|
160 | - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", |
|
161 | - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", |
|
162 | - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", |
|
163 | - 's.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus' |
|
164 | - ); |
|
165 | - $this->export_TypeFields_array[$r]=array( |
|
166 | - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text", |
|
167 | - 's.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label", |
|
168 | - 'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text", |
|
169 | - 's.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code', |
|
170 | - 's.fk_stcomm'=>'List:c_stcomm:libelle:code' |
|
171 | - ); |
|
172 | - $this->export_entities_array[$r]=array( |
|
173 | - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", |
|
174 | - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", |
|
175 | - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", |
|
176 | - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company', |
|
177 | - 's.fk_stcomm'=>'company' |
|
178 | - ); // We define here only fields that use another picto |
|
179 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
180 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
181 | - $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, '; |
|
182 | - $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object '; |
|
183 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
184 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
185 | - $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories |
|
157 | + $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire")); |
|
158 | + $this->export_fields_array[$r]=array( |
|
159 | + 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", |
|
160 | + 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", |
|
161 | + 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", |
|
162 | + 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", |
|
163 | + 's.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus' |
|
164 | + ); |
|
165 | + $this->export_TypeFields_array[$r]=array( |
|
166 | + 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text", |
|
167 | + 's.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label", |
|
168 | + 'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text", |
|
169 | + 's.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code', |
|
170 | + 's.fk_stcomm'=>'List:c_stcomm:libelle:code' |
|
171 | + ); |
|
172 | + $this->export_entities_array[$r]=array( |
|
173 | + 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", |
|
174 | + 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", |
|
175 | + 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", |
|
176 | + 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company', |
|
177 | + 's.fk_stcomm'=>'company' |
|
178 | + ); // We define here only fields that use another picto |
|
179 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
180 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
181 | + $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, '; |
|
182 | + $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object '; |
|
183 | + $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
184 | + $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
185 | + $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories |
|
186 | 186 | |
187 | 187 | // Add extra fields |
188 | 188 | $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'"; |
@@ -226,270 +226,270 @@ discard block |
||
226 | 226 | |
227 | 227 | |
228 | 228 | |
229 | - $r++; |
|
230 | - $this->export_code[$r]='category_'.$r; |
|
231 | - $this->export_label[$r]='CatProdList'; |
|
232 | - $this->export_icon[$r]='category'; |
|
229 | + $r++; |
|
230 | + $this->export_code[$r]='category_'.$r; |
|
231 | + $this->export_label[$r]='CatProdList'; |
|
232 | + $this->export_icon[$r]='category'; |
|
233 | 233 | $this->export_enabled[$r]='$conf->produit->enabled'; |
234 | - $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); |
|
235 | - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); |
|
236 | - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text'); |
|
237 | - $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto |
|
238 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
239 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; |
|
240 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; |
|
241 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
242 | - $this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories |
|
243 | - |
|
244 | - $r++; |
|
245 | - $this->export_code[$r]='category_'.$r; |
|
246 | - $this->export_label[$r]='CatMemberList'; |
|
247 | - $this->export_icon[$r]='category'; |
|
234 | + $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); |
|
235 | + $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); |
|
236 | + $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text'); |
|
237 | + $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto |
|
238 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
239 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; |
|
240 | + $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; |
|
241 | + $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
242 | + $this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories |
|
243 | + |
|
244 | + $r++; |
|
245 | + $this->export_code[$r]='category_'.$r; |
|
246 | + $this->export_label[$r]='CatMemberList'; |
|
247 | + $this->export_icon[$r]='category'; |
|
248 | 248 | $this->export_enabled[$r]='$conf->adherent->enabled'; |
249 | - $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); |
|
250 | - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); |
|
251 | - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text'); |
|
252 | - $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto |
|
253 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
254 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; |
|
255 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; |
|
256 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
257 | - $this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories |
|
258 | - |
|
259 | - $r++; |
|
260 | - $this->export_code[$r]='category_'.$r; |
|
261 | - $this->export_label[$r]='CatContactList'; |
|
262 | - $this->export_icon[$r]='category'; |
|
263 | - $this->export_enabled[$r]='$conf->societe->enabled'; |
|
264 | - $this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire")); |
|
265 | - $this->export_fields_array[$r]=array ( |
|
266 | - 'u.rowid' => "CategId", |
|
267 | - 'u.label' => "Label", |
|
268 | - 'u.description' => "Description", |
|
269 | - 'p.rowid' => 'ContactId', |
|
270 | - 'p.civility' => 'UserTitle', |
|
271 | - 'p.lastname' => 'LastName', |
|
272 | - 'p.firstname' => 'Firstname', |
|
273 | - 'p.address' => 'Address', |
|
274 | - 'p.zip' => 'Zip', |
|
275 | - 'p.town' => 'Town', |
|
276 | - 'country.code' => 'CountryCode', |
|
277 | - 'country.label' => 'Country', |
|
278 | - 'p.birthday' => 'DateToBirth', |
|
279 | - 'p.poste' => 'PostOrFunction', |
|
280 | - 'p.phone' => 'Phone', |
|
281 | - 'p.phone_perso' => 'PhonePerso', |
|
282 | - 'p.phone_mobile' => 'PhoneMobile', |
|
283 | - 'p.fax' => 'Fax', |
|
284 | - 'p.email' => 'Email', |
|
285 | - 'p.note_private' => 'NotePrivate', |
|
286 | - 'p.note_public' => 'NotePublic', |
|
249 | + $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); |
|
250 | + $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); |
|
251 | + $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text'); |
|
252 | + $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto |
|
253 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
254 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; |
|
255 | + $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; |
|
256 | + $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
257 | + $this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories |
|
258 | + |
|
259 | + $r++; |
|
260 | + $this->export_code[$r]='category_'.$r; |
|
261 | + $this->export_label[$r]='CatContactList'; |
|
262 | + $this->export_icon[$r]='category'; |
|
263 | + $this->export_enabled[$r]='$conf->societe->enabled'; |
|
264 | + $this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire")); |
|
265 | + $this->export_fields_array[$r]=array ( |
|
266 | + 'u.rowid' => "CategId", |
|
267 | + 'u.label' => "Label", |
|
268 | + 'u.description' => "Description", |
|
269 | + 'p.rowid' => 'ContactId', |
|
270 | + 'p.civility' => 'UserTitle', |
|
271 | + 'p.lastname' => 'LastName', |
|
272 | + 'p.firstname' => 'Firstname', |
|
273 | + 'p.address' => 'Address', |
|
274 | + 'p.zip' => 'Zip', |
|
275 | + 'p.town' => 'Town', |
|
276 | + 'country.code' => 'CountryCode', |
|
277 | + 'country.label' => 'Country', |
|
278 | + 'p.birthday' => 'DateToBirth', |
|
279 | + 'p.poste' => 'PostOrFunction', |
|
280 | + 'p.phone' => 'Phone', |
|
281 | + 'p.phone_perso' => 'PhonePerso', |
|
282 | + 'p.phone_mobile' => 'PhoneMobile', |
|
283 | + 'p.fax' => 'Fax', |
|
284 | + 'p.email' => 'Email', |
|
285 | + 'p.note_private' => 'NotePrivate', |
|
286 | + 'p.note_public' => 'NotePublic', |
|
287 | 287 | 'p.statut' => 'Status', |
288 | - 's.nom'=>"Name", |
|
289 | - 's.client'=>"Customer", |
|
290 | - 's.fournisseur'=>"Supplier", |
|
291 | - 's.status'=>"Status", |
|
292 | - 's.address'=>"Address", |
|
293 | - 's.zip'=>"Zip", |
|
294 | - 's.town'=>"Town", |
|
295 | - 's.phone'=>"Phone", |
|
296 | - 's.fax'=>"Fax", |
|
297 | - 's.url'=>"Url", |
|
298 | - 's.email'=>"Email" |
|
299 | - ); |
|
300 | - $this->export_TypeFields_array[$r] = array ( |
|
301 | - 'u.label' => "Text", |
|
302 | - 'u.description' => "Text", |
|
303 | - 'p.lastname' => 'Text', |
|
304 | - 'p.firstname' => 'Text', |
|
288 | + 's.nom'=>"Name", |
|
289 | + 's.client'=>"Customer", |
|
290 | + 's.fournisseur'=>"Supplier", |
|
291 | + 's.status'=>"Status", |
|
292 | + 's.address'=>"Address", |
|
293 | + 's.zip'=>"Zip", |
|
294 | + 's.town'=>"Town", |
|
295 | + 's.phone'=>"Phone", |
|
296 | + 's.fax'=>"Fax", |
|
297 | + 's.url'=>"Url", |
|
298 | + 's.email'=>"Email" |
|
299 | + ); |
|
300 | + $this->export_TypeFields_array[$r] = array ( |
|
301 | + 'u.label' => "Text", |
|
302 | + 'u.description' => "Text", |
|
303 | + 'p.lastname' => 'Text', |
|
304 | + 'p.firstname' => 'Text', |
|
305 | 305 | 'p.statut'=>"Numeric", |
306 | - 's.nom'=>"Text", |
|
307 | - 's.status'=>"Text", |
|
308 | - 's.address'=>"Text", |
|
309 | - 's.zip'=>"Text", |
|
310 | - 's.town'=>"Text", |
|
311 | - 's.phone'=>"Text", |
|
312 | - 's.fax'=>"Text", |
|
313 | - 's.url'=>"Text", |
|
314 | - 's.email'=>"Text" |
|
315 | - ); |
|
316 | - $this->export_entities_array[$r] = array ( |
|
317 | - 'u.rowid' => "category", |
|
318 | - 'u.label' => "category", |
|
319 | - 'u.description' => "category", |
|
320 | - 'p.rowid' => 'contact', |
|
321 | - 'p.civility' => 'contact', |
|
322 | - 'p.lastname' => 'contact', |
|
323 | - 'p.firstname' => 'contact', |
|
324 | - 'p.address' => 'contact', |
|
325 | - 'p.zip' => 'contact', |
|
326 | - 'p.town' => 'contact', |
|
327 | - 'country.code' => 'contact', |
|
328 | - 'country.label' => 'contact', |
|
329 | - 'p.birthday' => 'contact', |
|
330 | - 'p.poste' => 'contact', |
|
331 | - 'p.phone' => 'contact', |
|
332 | - 'p.phone_perso' => 'contact', |
|
333 | - 'p.phone_mobile' => 'contact', |
|
334 | - 'p.fax' => 'contact', |
|
335 | - 'p.email' => 'contact', |
|
336 | - 'p.note_private' => 'contact', |
|
337 | - 'p.note_public' => 'contact', |
|
306 | + 's.nom'=>"Text", |
|
307 | + 's.status'=>"Text", |
|
308 | + 's.address'=>"Text", |
|
309 | + 's.zip'=>"Text", |
|
310 | + 's.town'=>"Text", |
|
311 | + 's.phone'=>"Text", |
|
312 | + 's.fax'=>"Text", |
|
313 | + 's.url'=>"Text", |
|
314 | + 's.email'=>"Text" |
|
315 | + ); |
|
316 | + $this->export_entities_array[$r] = array ( |
|
317 | + 'u.rowid' => "category", |
|
318 | + 'u.label' => "category", |
|
319 | + 'u.description' => "category", |
|
320 | + 'p.rowid' => 'contact', |
|
321 | + 'p.civility' => 'contact', |
|
322 | + 'p.lastname' => 'contact', |
|
323 | + 'p.firstname' => 'contact', |
|
324 | + 'p.address' => 'contact', |
|
325 | + 'p.zip' => 'contact', |
|
326 | + 'p.town' => 'contact', |
|
327 | + 'country.code' => 'contact', |
|
328 | + 'country.label' => 'contact', |
|
329 | + 'p.birthday' => 'contact', |
|
330 | + 'p.poste' => 'contact', |
|
331 | + 'p.phone' => 'contact', |
|
332 | + 'p.phone_perso' => 'contact', |
|
333 | + 'p.phone_mobile' => 'contact', |
|
334 | + 'p.fax' => 'contact', |
|
335 | + 'p.email' => 'contact', |
|
336 | + 'p.note_private' => 'contact', |
|
337 | + 'p.note_public' => 'contact', |
|
338 | 338 | 'p.statut' => 'contact', |
339 | - 's.nom'=>"company", |
|
340 | - 's.client'=>"company", |
|
341 | - 's.fournisseur'=>"company", |
|
342 | - 's.status'=>"company", |
|
343 | - 's.address'=>"company", |
|
344 | - 's.zip'=>"company", |
|
345 | - 's.town'=>"company", |
|
346 | - 's.phone'=>"company", |
|
347 | - 's.fax'=>"company", |
|
348 | - 's.url'=>"company", |
|
349 | - 's.email'=>"company" |
|
350 | - ); // We define here only fields that use another picto |
|
339 | + 's.nom'=>"company", |
|
340 | + 's.client'=>"company", |
|
341 | + 's.fournisseur'=>"company", |
|
342 | + 's.status'=>"company", |
|
343 | + 's.address'=>"company", |
|
344 | + 's.zip'=>"company", |
|
345 | + 's.town'=>"company", |
|
346 | + 's.phone'=>"company", |
|
347 | + 's.fax'=>"company", |
|
348 | + 's.url'=>"company", |
|
349 | + 's.email'=>"company" |
|
350 | + ); // We define here only fields that use another picto |
|
351 | 351 | |
352 | 352 | // Add extra fields |
353 | 353 | $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'"; |
354 | 354 | $resql=$this->db->query($sql); |
355 | 355 | if ($resql) // This can fail when class is used on old database (during migration for example) |
356 | 356 | { |
357 | - while ($obj=$this->db->fetch_object($resql)) |
|
358 | - { |
|
359 | - $fieldname='extra.'.$obj->name; |
|
360 | - $fieldlabel=ucfirst($obj->label); |
|
361 | - $typeFilter="Text"; |
|
362 | - switch($obj->type) |
|
363 | - { |
|
364 | - case 'int': |
|
365 | - case 'double': |
|
366 | - case 'price': |
|
367 | - $typeFilter="Numeric"; |
|
368 | - break; |
|
369 | - case 'date': |
|
370 | - case 'datetime': |
|
371 | - $typeFilter="Date"; |
|
372 | - break; |
|
373 | - case 'boolean': |
|
374 | - $typeFilter="Boolean"; |
|
375 | - break; |
|
376 | - case 'sellist': |
|
377 | - $typeFilter="List:".$obj->param; |
|
378 | - break; |
|
379 | - case 'select': |
|
380 | - $typeFilter="Select:".$obj->param; |
|
381 | - break; |
|
382 | - } |
|
383 | - $this->export_fields_array[$r][$fieldname]=$fieldlabel; |
|
384 | - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; |
|
385 | - $this->export_entities_array[$r][$fieldname]='contact'; |
|
386 | - } |
|
357 | + while ($obj=$this->db->fetch_object($resql)) |
|
358 | + { |
|
359 | + $fieldname='extra.'.$obj->name; |
|
360 | + $fieldlabel=ucfirst($obj->label); |
|
361 | + $typeFilter="Text"; |
|
362 | + switch($obj->type) |
|
363 | + { |
|
364 | + case 'int': |
|
365 | + case 'double': |
|
366 | + case 'price': |
|
367 | + $typeFilter="Numeric"; |
|
368 | + break; |
|
369 | + case 'date': |
|
370 | + case 'datetime': |
|
371 | + $typeFilter="Date"; |
|
372 | + break; |
|
373 | + case 'boolean': |
|
374 | + $typeFilter="Boolean"; |
|
375 | + break; |
|
376 | + case 'sellist': |
|
377 | + $typeFilter="List:".$obj->param; |
|
378 | + break; |
|
379 | + case 'select': |
|
380 | + $typeFilter="Select:".$obj->param; |
|
381 | + break; |
|
382 | + } |
|
383 | + $this->export_fields_array[$r][$fieldname]=$fieldlabel; |
|
384 | + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; |
|
385 | + $this->export_entities_array[$r][$fieldname]='contact'; |
|
386 | + } |
|
387 | 387 | } |
388 | 388 | // End add axtra fields |
389 | 389 | |
390 | - $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
391 | - $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; |
|
392 | - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; |
|
393 | - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; |
|
390 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
391 | + $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; |
|
392 | + $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; |
|
393 | + $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; |
|
394 | 394 | $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; |
395 | - $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')'; |
|
396 | - $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories |
|
397 | - |
|
398 | - // Imports |
|
399 | - //-------- |
|
400 | - |
|
401 | - $r=0; |
|
402 | - |
|
403 | - $r++; |
|
404 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
405 | - $this->import_label[$r]="CatList"; // Translation key |
|
406 | - $this->import_icon[$r]=$this->picto; |
|
407 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
408 | - $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie'); |
|
409 | - $this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description"); |
|
410 | - |
|
411 | - $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); |
|
412 | - $typeexample=""; |
|
413 | - if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; } |
|
414 | - if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; } |
|
415 | - if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; } |
|
416 | - if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; } |
|
417 | - $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category"); |
|
418 | - |
|
419 | - if (! empty($conf->product->enabled)) |
|
420 | - { |
|
421 | - //Products |
|
422 | - $r++; |
|
423 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
424 | - $this->import_label[$r]="CatProdLinks"; // Translation key |
|
425 | - $this->import_icon[$r]=$this->picto; |
|
426 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
427 | - $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product'); |
|
428 | - $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*" |
|
429 | - ); |
|
430 | - |
|
431 | - $this->import_convertvalue_array[$r]=array( |
|
432 | - 'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
433 | - 'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product') |
|
434 | - ); |
|
435 | - $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456"); |
|
436 | - } |
|
437 | - |
|
438 | - if (! empty($conf->societe->enabled)) |
|
439 | - { |
|
440 | - //Customers |
|
441 | - $r++; |
|
442 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
443 | - $this->import_label[$r]="CatCusLinks"; // Translation key |
|
444 | - $this->import_icon[$r]=$this->picto; |
|
445 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
446 | - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); |
|
447 | - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*" |
|
448 | - ); |
|
449 | - |
|
450 | - $this->import_convertvalue_array[$r]=array( |
|
451 | - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
452 | - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') |
|
453 | - ); |
|
454 | - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); |
|
455 | - } |
|
456 | - |
|
457 | - if (! empty($conf->fournisseur->enabled)) |
|
458 | - { |
|
459 | - // Suppliers |
|
460 | - $r++; |
|
461 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
462 | - $this->import_label[$r]="CatSupLinks"; // Translation key |
|
463 | - $this->import_icon[$r]=$this->picto; |
|
464 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
465 | - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); |
|
466 | - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*" |
|
467 | - ); |
|
468 | - |
|
469 | - $this->import_convertvalue_array[$r]=array( |
|
470 | - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
471 | - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') |
|
472 | - ); |
|
473 | - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); |
|
474 | - } |
|
475 | - } |
|
395 | + $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')'; |
|
396 | + $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories |
|
397 | + |
|
398 | + // Imports |
|
399 | + //-------- |
|
400 | + |
|
401 | + $r=0; |
|
402 | + |
|
403 | + $r++; |
|
404 | + $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
405 | + $this->import_label[$r]="CatList"; // Translation key |
|
406 | + $this->import_icon[$r]=$this->picto; |
|
407 | + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
408 | + $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie'); |
|
409 | + $this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description"); |
|
410 | + |
|
411 | + $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); |
|
412 | + $typeexample=""; |
|
413 | + if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; } |
|
414 | + if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; } |
|
415 | + if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; } |
|
416 | + if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; } |
|
417 | + $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category"); |
|
418 | + |
|
419 | + if (! empty($conf->product->enabled)) |
|
420 | + { |
|
421 | + //Products |
|
422 | + $r++; |
|
423 | + $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
424 | + $this->import_label[$r]="CatProdLinks"; // Translation key |
|
425 | + $this->import_icon[$r]=$this->picto; |
|
426 | + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
427 | + $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product'); |
|
428 | + $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*" |
|
429 | + ); |
|
430 | + |
|
431 | + $this->import_convertvalue_array[$r]=array( |
|
432 | + 'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
433 | + 'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product') |
|
434 | + ); |
|
435 | + $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456"); |
|
436 | + } |
|
437 | + |
|
438 | + if (! empty($conf->societe->enabled)) |
|
439 | + { |
|
440 | + //Customers |
|
441 | + $r++; |
|
442 | + $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
443 | + $this->import_label[$r]="CatCusLinks"; // Translation key |
|
444 | + $this->import_icon[$r]=$this->picto; |
|
445 | + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
446 | + $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); |
|
447 | + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*" |
|
448 | + ); |
|
449 | + |
|
450 | + $this->import_convertvalue_array[$r]=array( |
|
451 | + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
452 | + 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') |
|
453 | + ); |
|
454 | + $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); |
|
455 | + } |
|
456 | + |
|
457 | + if (! empty($conf->fournisseur->enabled)) |
|
458 | + { |
|
459 | + // Suppliers |
|
460 | + $r++; |
|
461 | + $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
462 | + $this->import_label[$r]="CatSupLinks"; // Translation key |
|
463 | + $this->import_icon[$r]=$this->picto; |
|
464 | + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
465 | + $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); |
|
466 | + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*" |
|
467 | + ); |
|
468 | + |
|
469 | + $this->import_convertvalue_array[$r]=array( |
|
470 | + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
471 | + 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') |
|
472 | + ); |
|
473 | + $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); |
|
474 | + } |
|
475 | + } |
|
476 | 476 | |
477 | 477 | |
478 | 478 | /** |
479 | - * Function called when module is enabled. |
|
480 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
481 | - * It also creates data directories |
|
482 | - * |
|
479 | + * Function called when module is enabled. |
|
480 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
481 | + * It also creates data directories |
|
482 | + * |
|
483 | 483 | * @param string $options Options when enabling module ('', 'noboxes') |
484 | - * @return int 1 if OK, 0 if KO |
|
484 | + * @return int 1 if OK, 0 if KO |
|
485 | 485 | */ |
486 | - function init($options='') |
|
487 | - { |
|
488 | - // Permissions |
|
489 | - $this->remove($options); |
|
486 | + function init($options='') |
|
487 | + { |
|
488 | + // Permissions |
|
489 | + $this->remove($options); |
|
490 | 490 | |
491 | - $sql = array(); |
|
491 | + $sql = array(); |
|
492 | 492 | |
493 | - return $this->_init($sql,$options); |
|
494 | - } |
|
493 | + return $this->_init($sql,$options); |
|
494 | + } |
|
495 | 495 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \ingroup category |
25 | 25 | * \brief Fichier de description et activation du module Categorie |
26 | 26 | */ |
27 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
27 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this->family = "technic"; |
48 | 48 | $this->module_position = '20'; |
49 | 49 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
50 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
51 | 51 | $this->description = "Gestion des categories (produits, clients, fournisseurs...)"; |
52 | 52 | |
53 | 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | |
65 | 65 | // Config pages |
66 | 66 | $this->config_page_url = array('categorie.php@categories'); |
67 | - $this->langfiles = array("products","companies","categories","members"); |
|
67 | + $this->langfiles = array("products", "companies", "categories", "members"); |
|
68 | 68 | |
69 | 69 | // Constants |
70 | 70 | $this->const = array(); |
71 | - $r=0; |
|
71 | + $r = 0; |
|
72 | 72 | $this->const[$r][0] = "CATEGORIE_RECURSIV_ADD"; |
73 | 73 | $this->const[$r][1] = "yesno"; |
74 | 74 | $this->const[$r][2] = "0"; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->rights = array(); |
84 | 84 | $this->rights_class = 'categorie'; |
85 | 85 | |
86 | - $r=0; |
|
86 | + $r = 0; |
|
87 | 87 | |
88 | 88 | $this->rights[$r][0] = 241; // id de la permission |
89 | 89 | $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission |
@@ -109,115 +109,115 @@ discard block |
||
109 | 109 | |
110 | 110 | // Menus |
111 | 111 | //------- |
112 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
112 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
113 | 113 | |
114 | 114 | |
115 | 115 | // Exports |
116 | 116 | //-------- |
117 | - $r=0; |
|
117 | + $r = 0; |
|
118 | 118 | |
119 | 119 | $r++; |
120 | - $this->export_code[$r]='category_'.$r; |
|
121 | - $this->export_label[$r]='CatSupList'; |
|
122 | - $this->export_icon[$r]='category'; |
|
123 | - $this->export_enabled[$r]='$conf->fournisseur->enabled'; |
|
124 | - $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire")); |
|
125 | - $this->export_fields_array[$r]=array( |
|
126 | - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", |
|
127 | - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", |
|
128 | - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", |
|
129 | - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", |
|
120 | + $this->export_code[$r] = 'category_'.$r; |
|
121 | + $this->export_label[$r] = 'CatSupList'; |
|
122 | + $this->export_icon[$r] = 'category'; |
|
123 | + $this->export_enabled[$r] = '$conf->fournisseur->enabled'; |
|
124 | + $this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); |
|
125 | + $this->export_fields_array[$r] = array( |
|
126 | + 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", |
|
127 | + 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", |
|
128 | + 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", |
|
129 | + 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", |
|
130 | 130 | 's.note_public'=>"NotePublic" |
131 | 131 | ); |
132 | - $this->export_TypeFields_array[$r]=array( |
|
133 | - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date", |
|
134 | - 's.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text", |
|
135 | - 's.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text", |
|
136 | - 's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text" |
|
132 | + $this->export_TypeFields_array[$r] = array( |
|
133 | + 'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", |
|
134 | + 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", |
|
135 | + 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", |
|
136 | + 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text" |
|
137 | 137 | ); |
138 | - $this->export_entities_array[$r]=array( |
|
139 | - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", |
|
140 | - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", |
|
141 | - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", |
|
142 | - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company" |
|
143 | - ); // We define here only fields that use another picto |
|
144 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
145 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
138 | + $this->export_entities_array[$r] = array( |
|
139 | + 's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", |
|
140 | + 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", |
|
141 | + 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", |
|
142 | + 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company" |
|
143 | + ); // We define here only fields that use another picto |
|
144 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
145 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
146 | 146 | $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, '; |
147 | 147 | $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; |
148 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
149 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
150 | - $this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories |
|
148 | + $this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
149 | + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; |
|
150 | + $this->export_sql_end[$r] .= ' AND u.type = 1'; // Supplier categories |
|
151 | 151 | |
152 | 152 | $r++; |
153 | - $this->export_code[$r]='category_'.$r; |
|
154 | - $this->export_label[$r]='CatCusList'; |
|
155 | - $this->export_icon[$r]='category'; |
|
156 | - $this->export_enabled[$r]='$conf->societe->enabled'; |
|
157 | - $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire")); |
|
158 | - $this->export_fields_array[$r]=array( |
|
159 | - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", |
|
160 | - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", |
|
161 | - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", |
|
162 | - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", |
|
163 | - 's.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus' |
|
153 | + $this->export_code[$r] = 'category_'.$r; |
|
154 | + $this->export_label[$r] = 'CatCusList'; |
|
155 | + $this->export_icon[$r] = 'category'; |
|
156 | + $this->export_enabled[$r] = '$conf->societe->enabled'; |
|
157 | + $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire")); |
|
158 | + $this->export_fields_array[$r] = array( |
|
159 | + 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", |
|
160 | + 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", |
|
161 | + 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", |
|
162 | + 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", |
|
163 | + 's.note_public'=>"NotePublic", 's.fk_prospectlevel'=>'ProspectLevel', 's.fk_stcomm'=>'ProspectStatus' |
|
164 | 164 | ); |
165 | - $this->export_TypeFields_array[$r]=array( |
|
166 | - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text", |
|
167 | - 's.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label", |
|
168 | - 'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text", |
|
169 | - 's.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code', |
|
165 | + $this->export_TypeFields_array[$r] = array( |
|
166 | + 'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", |
|
167 | + 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", |
|
168 | + 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", |
|
169 | + 's.idprof4'=>"Text", 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code', |
|
170 | 170 | 's.fk_stcomm'=>'List:c_stcomm:libelle:code' |
171 | 171 | ); |
172 | - $this->export_entities_array[$r]=array( |
|
173 | - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", |
|
174 | - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", |
|
175 | - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", |
|
176 | - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company', |
|
172 | + $this->export_entities_array[$r] = array( |
|
173 | + 's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", |
|
174 | + 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", |
|
175 | + 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", |
|
176 | + 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company", 's.fk_prospectlevel'=>'company', |
|
177 | 177 | 's.fk_stcomm'=>'company' |
178 | - ); // We define here only fields that use another picto |
|
179 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
180 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
178 | + ); // We define here only fields that use another picto |
|
179 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
180 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '; |
|
181 | 181 | $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, '; |
182 | 182 | $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object '; |
183 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
184 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
185 | - $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories |
|
183 | + $this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; |
|
184 | + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; |
|
185 | + $this->export_sql_end[$r] .= ' AND u.type = 2'; // Customer/Prospect categories |
|
186 | 186 | |
187 | 187 | // Add extra fields |
188 | - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'"; |
|
189 | - $resql=$this->db->query($sql); |
|
188 | + $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'"; |
|
189 | + $resql = $this->db->query($sql); |
|
190 | 190 | if ($resql) // This can fail when class is used on old database (during migration for example) |
191 | 191 | { |
192 | - while ($obj=$this->db->fetch_object($resql)) |
|
192 | + while ($obj = $this->db->fetch_object($resql)) |
|
193 | 193 | { |
194 | - $fieldname='extra.'.$obj->name; |
|
195 | - $fieldlabel=ucfirst($obj->label); |
|
196 | - $typeFilter="Text"; |
|
197 | - switch($obj->type) |
|
194 | + $fieldname = 'extra.'.$obj->name; |
|
195 | + $fieldlabel = ucfirst($obj->label); |
|
196 | + $typeFilter = "Text"; |
|
197 | + switch ($obj->type) |
|
198 | 198 | { |
199 | 199 | case 'int': |
200 | 200 | case 'double': |
201 | 201 | case 'price': |
202 | - $typeFilter="Numeric"; |
|
202 | + $typeFilter = "Numeric"; |
|
203 | 203 | break; |
204 | 204 | case 'date': |
205 | 205 | case 'datetime': |
206 | - $typeFilter="Date"; |
|
206 | + $typeFilter = "Date"; |
|
207 | 207 | break; |
208 | 208 | case 'boolean': |
209 | - $typeFilter="Boolean"; |
|
209 | + $typeFilter = "Boolean"; |
|
210 | 210 | break; |
211 | 211 | case 'sellist': |
212 | - $typeFilter="List:".$obj->param; |
|
212 | + $typeFilter = "List:".$obj->param; |
|
213 | 213 | break; |
214 | 214 | case 'select': |
215 | - $typeFilter="Select:".$obj->param; |
|
215 | + $typeFilter = "Select:".$obj->param; |
|
216 | 216 | break; |
217 | 217 | } |
218 | - $this->export_fields_array[$r][$fieldname]=$fieldlabel; |
|
219 | - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; |
|
220 | - $this->export_entities_array[$r][$fieldname]='company'; |
|
218 | + $this->export_fields_array[$r][$fieldname] = $fieldlabel; |
|
219 | + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; |
|
220 | + $this->export_entities_array[$r][$fieldname] = 'company'; |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | // End add axtra fields |
@@ -227,42 +227,42 @@ discard block |
||
227 | 227 | |
228 | 228 | |
229 | 229 | $r++; |
230 | - $this->export_code[$r]='category_'.$r; |
|
231 | - $this->export_label[$r]='CatProdList'; |
|
232 | - $this->export_icon[$r]='category'; |
|
233 | - $this->export_enabled[$r]='$conf->produit->enabled'; |
|
234 | - $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); |
|
235 | - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); |
|
236 | - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text'); |
|
237 | - $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto |
|
238 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
239 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; |
|
240 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; |
|
241 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
242 | - $this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories |
|
230 | + $this->export_code[$r] = 'category_'.$r; |
|
231 | + $this->export_label[$r] = 'CatProdList'; |
|
232 | + $this->export_icon[$r] = 'category'; |
|
233 | + $this->export_enabled[$r] = '$conf->produit->enabled'; |
|
234 | + $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "lire")); |
|
235 | + $this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref'); |
|
236 | + $this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.ref'=>'Text'); |
|
237 | + $this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product'); // We define here only fields that use another picto |
|
238 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
239 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; |
|
240 | + $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; |
|
241 | + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; |
|
242 | + $this->export_sql_end[$r] .= ' AND u.type = 0'; // Supplier categories |
|
243 | 243 | |
244 | 244 | $r++; |
245 | - $this->export_code[$r]='category_'.$r; |
|
246 | - $this->export_label[$r]='CatMemberList'; |
|
247 | - $this->export_icon[$r]='category'; |
|
248 | - $this->export_enabled[$r]='$conf->adherent->enabled'; |
|
249 | - $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); |
|
250 | - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); |
|
251 | - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text'); |
|
252 | - $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto |
|
253 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
254 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; |
|
255 | - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; |
|
256 | - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; |
|
257 | - $this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories |
|
245 | + $this->export_code[$r] = 'category_'.$r; |
|
246 | + $this->export_label[$r] = 'CatMemberList'; |
|
247 | + $this->export_icon[$r] = 'category'; |
|
248 | + $this->export_enabled[$r] = '$conf->adherent->enabled'; |
|
249 | + $this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "lire")); |
|
250 | + $this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); |
|
251 | + $this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.lastname'=>'Text', 'p.firstname'=>'Text'); |
|
252 | + $this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto |
|
253 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
254 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; |
|
255 | + $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; |
|
256 | + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; |
|
257 | + $this->export_sql_end[$r] .= ' AND u.type = 3'; // Member categories |
|
258 | 258 | |
259 | 259 | $r++; |
260 | - $this->export_code[$r]='category_'.$r; |
|
261 | - $this->export_label[$r]='CatContactList'; |
|
262 | - $this->export_icon[$r]='category'; |
|
263 | - $this->export_enabled[$r]='$conf->societe->enabled'; |
|
264 | - $this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire")); |
|
265 | - $this->export_fields_array[$r]=array ( |
|
260 | + $this->export_code[$r] = 'category_'.$r; |
|
261 | + $this->export_label[$r] = 'CatContactList'; |
|
262 | + $this->export_icon[$r] = 'category'; |
|
263 | + $this->export_enabled[$r] = '$conf->societe->enabled'; |
|
264 | + $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire")); |
|
265 | + $this->export_fields_array[$r] = array( |
|
266 | 266 | 'u.rowid' => "CategId", |
267 | 267 | 'u.label' => "Label", |
268 | 268 | 'u.description' => "Description", |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | 's.url'=>"Url", |
298 | 298 | 's.email'=>"Email" |
299 | 299 | ); |
300 | - $this->export_TypeFields_array[$r] = array ( |
|
300 | + $this->export_TypeFields_array[$r] = array( |
|
301 | 301 | 'u.label' => "Text", |
302 | 302 | 'u.description' => "Text", |
303 | 303 | 'p.lastname' => 'Text', |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | 's.url'=>"Text", |
314 | 314 | 's.email'=>"Text" |
315 | 315 | ); |
316 | - $this->export_entities_array[$r] = array ( |
|
316 | + $this->export_entities_array[$r] = array( |
|
317 | 317 | 'u.rowid' => "category", |
318 | 318 | 'u.label' => "category", |
319 | 319 | 'u.description' => "category", |
@@ -350,127 +350,127 @@ discard block |
||
350 | 350 | ); // We define here only fields that use another picto |
351 | 351 | |
352 | 352 | // Add extra fields |
353 | - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'"; |
|
354 | - $resql=$this->db->query($sql); |
|
353 | + $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'"; |
|
354 | + $resql = $this->db->query($sql); |
|
355 | 355 | if ($resql) // This can fail when class is used on old database (during migration for example) |
356 | 356 | { |
357 | - while ($obj=$this->db->fetch_object($resql)) |
|
357 | + while ($obj = $this->db->fetch_object($resql)) |
|
358 | 358 | { |
359 | - $fieldname='extra.'.$obj->name; |
|
360 | - $fieldlabel=ucfirst($obj->label); |
|
361 | - $typeFilter="Text"; |
|
362 | - switch($obj->type) |
|
359 | + $fieldname = 'extra.'.$obj->name; |
|
360 | + $fieldlabel = ucfirst($obj->label); |
|
361 | + $typeFilter = "Text"; |
|
362 | + switch ($obj->type) |
|
363 | 363 | { |
364 | 364 | case 'int': |
365 | 365 | case 'double': |
366 | 366 | case 'price': |
367 | - $typeFilter="Numeric"; |
|
367 | + $typeFilter = "Numeric"; |
|
368 | 368 | break; |
369 | 369 | case 'date': |
370 | 370 | case 'datetime': |
371 | - $typeFilter="Date"; |
|
371 | + $typeFilter = "Date"; |
|
372 | 372 | break; |
373 | 373 | case 'boolean': |
374 | - $typeFilter="Boolean"; |
|
374 | + $typeFilter = "Boolean"; |
|
375 | 375 | break; |
376 | 376 | case 'sellist': |
377 | - $typeFilter="List:".$obj->param; |
|
377 | + $typeFilter = "List:".$obj->param; |
|
378 | 378 | break; |
379 | 379 | case 'select': |
380 | - $typeFilter="Select:".$obj->param; |
|
380 | + $typeFilter = "Select:".$obj->param; |
|
381 | 381 | break; |
382 | 382 | } |
383 | - $this->export_fields_array[$r][$fieldname]=$fieldlabel; |
|
384 | - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; |
|
385 | - $this->export_entities_array[$r][$fieldname]='contact'; |
|
383 | + $this->export_fields_array[$r][$fieldname] = $fieldlabel; |
|
384 | + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; |
|
385 | + $this->export_entities_array[$r][$fieldname] = 'contact'; |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | // End add axtra fields |
389 | 389 | |
390 | 390 | $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
391 | - $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; |
|
392 | - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; |
|
393 | - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; |
|
394 | - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; |
|
391 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_contact as cp, '.MAIN_DB_PREFIX.'socpeople as p'; |
|
392 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as country ON p.fk_pays = country.rowid'; |
|
393 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc'; |
|
394 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; |
|
395 | 395 | $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')'; |
396 | 396 | $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories |
397 | 397 | |
398 | 398 | // Imports |
399 | 399 | //-------- |
400 | 400 | |
401 | - $r=0; |
|
401 | + $r = 0; |
|
402 | 402 | |
403 | 403 | $r++; |
404 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
405 | - $this->import_label[$r]="CatList"; // Translation key |
|
406 | - $this->import_icon[$r]=$this->picto; |
|
407 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
408 | - $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie'); |
|
409 | - $this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description"); |
|
410 | - |
|
411 | - $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); |
|
412 | - $typeexample=""; |
|
413 | - if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; } |
|
414 | - if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; } |
|
415 | - if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; } |
|
416 | - if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; } |
|
417 | - $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category"); |
|
418 | - |
|
419 | - if (! empty($conf->product->enabled)) |
|
404 | + $this->import_code[$r] = $this->rights_class.'_'.$r; |
|
405 | + $this->import_label[$r] = "CatList"; // Translation key |
|
406 | + $this->import_icon[$r] = $this->picto; |
|
407 | + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
|
408 | + $this->import_tables_array[$r] = array('ca'=>MAIN_DB_PREFIX.'categorie'); |
|
409 | + $this->import_fields_array[$r] = array('ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description"); |
|
410 | + |
|
411 | + $this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]'); |
|
412 | + $typeexample = ""; |
|
413 | + if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; } |
|
414 | + if ($conf->fournisseur->enabled) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; } |
|
415 | + if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; } |
|
416 | + if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; } |
|
417 | + $this->import_examplevalues_array[$r] = array('ca.label'=>"Supplier Category", 'ca.type'=>$typeexample, 'ca.description'=>"Imported category"); |
|
418 | + |
|
419 | + if (!empty($conf->product->enabled)) |
|
420 | 420 | { |
421 | 421 | //Products |
422 | 422 | $r++; |
423 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
424 | - $this->import_label[$r]="CatProdLinks"; // Translation key |
|
425 | - $this->import_icon[$r]=$this->picto; |
|
426 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
427 | - $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product'); |
|
428 | - $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*" |
|
423 | + $this->import_code[$r] = $this->rights_class.'_'.$r; |
|
424 | + $this->import_label[$r] = "CatProdLinks"; // Translation key |
|
425 | + $this->import_icon[$r] = $this->picto; |
|
426 | + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
|
427 | + $this->import_tables_array[$r] = array('cp'=>MAIN_DB_PREFIX.'categorie_product'); |
|
428 | + $this->import_fields_array[$r] = array('cp.fk_categorie'=>"Category*", 'cp.fk_product'=>"Product*" |
|
429 | 429 | ); |
430 | 430 | |
431 | - $this->import_convertvalue_array[$r]=array( |
|
432 | - 'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
433 | - 'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product') |
|
431 | + $this->import_convertvalue_array[$r] = array( |
|
432 | + 'cp.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), |
|
433 | + 'cp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'product') |
|
434 | 434 | ); |
435 | - $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456"); |
|
435 | + $this->import_examplevalues_array[$r] = array('cp.fk_categorie'=>"Imported category", 'cp.fk_product'=>"PREF123456"); |
|
436 | 436 | } |
437 | 437 | |
438 | - if (! empty($conf->societe->enabled)) |
|
438 | + if (!empty($conf->societe->enabled)) |
|
439 | 439 | { |
440 | 440 | //Customers |
441 | 441 | $r++; |
442 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
443 | - $this->import_label[$r]="CatCusLinks"; // Translation key |
|
444 | - $this->import_icon[$r]=$this->picto; |
|
445 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
446 | - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); |
|
447 | - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*" |
|
442 | + $this->import_code[$r] = $this->rights_class.'_'.$r; |
|
443 | + $this->import_label[$r] = "CatCusLinks"; // Translation key |
|
444 | + $this->import_icon[$r] = $this->picto; |
|
445 | + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
|
446 | + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); |
|
447 | + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"ThirdParty*" |
|
448 | 448 | ); |
449 | 449 | |
450 | - $this->import_convertvalue_array[$r]=array( |
|
451 | - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
452 | - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') |
|
450 | + $this->import_convertvalue_array[$r] = array( |
|
451 | + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), |
|
452 | + 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') |
|
453 | 453 | ); |
454 | - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); |
|
454 | + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany"); |
|
455 | 455 | } |
456 | 456 | |
457 | - if (! empty($conf->fournisseur->enabled)) |
|
457 | + if (!empty($conf->fournisseur->enabled)) |
|
458 | 458 | { |
459 | 459 | // Suppliers |
460 | 460 | $r++; |
461 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
462 | - $this->import_label[$r]="CatSupLinks"; // Translation key |
|
463 | - $this->import_icon[$r]=$this->picto; |
|
464 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
465 | - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); |
|
466 | - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*" |
|
461 | + $this->import_code[$r] = $this->rights_class.'_'.$r; |
|
462 | + $this->import_label[$r] = "CatSupLinks"; // Translation key |
|
463 | + $this->import_icon[$r] = $this->picto; |
|
464 | + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
|
465 | + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); |
|
466 | + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"Supplier*" |
|
467 | 467 | ); |
468 | 468 | |
469 | - $this->import_convertvalue_array[$r]=array( |
|
470 | - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), |
|
471 | - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') |
|
469 | + $this->import_convertvalue_array[$r] = array( |
|
470 | + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), |
|
471 | + 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') |
|
472 | 472 | ); |
473 | - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); |
|
473 | + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany"); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | * @param string $options Options when enabling module ('', 'noboxes') |
484 | 484 | * @return int 1 if OK, 0 if KO |
485 | 485 | */ |
486 | - function init($options='') |
|
486 | + function init($options = '') |
|
487 | 487 | { |
488 | 488 | // Permissions |
489 | 489 | $this->remove($options); |
490 | 490 | |
491 | 491 | $sql = array(); |
492 | 492 | |
493 | - return $this->_init($sql,$options); |
|
493 | + return $this->_init($sql, $options); |
|
494 | 494 | } |
495 | 495 | } |
@@ -187,11 +187,13 @@ discard block |
||
187 | 187 | // Add extra fields |
188 | 188 | $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'"; |
189 | 189 | $resql=$this->db->query($sql); |
190 | - if ($resql) // This can fail when class is used on old database (during migration for example) |
|
190 | + if ($resql) { |
|
191 | + // This can fail when class is used on old database (during migration for example) |
|
191 | 192 | { |
192 | 193 | while ($obj=$this->db->fetch_object($resql)) |
193 | 194 | { |
194 | 195 | $fieldname='extra.'.$obj->name; |
196 | + } |
|
195 | 197 | $fieldlabel=ucfirst($obj->label); |
196 | 198 | $typeFilter="Text"; |
197 | 199 | switch($obj->type) |
@@ -352,11 +354,13 @@ discard block |
||
352 | 354 | // Add extra fields |
353 | 355 | $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'"; |
354 | 356 | $resql=$this->db->query($sql); |
355 | - if ($resql) // This can fail when class is used on old database (during migration for example) |
|
357 | + if ($resql) { |
|
358 | + // This can fail when class is used on old database (during migration for example) |
|
356 | 359 | { |
357 | 360 | while ($obj=$this->db->fetch_object($resql)) |
358 | 361 | { |
359 | 362 | $fieldname='extra.'.$obj->name; |
363 | + } |
|
360 | 364 | $fieldlabel=ucfirst($obj->label); |
361 | 365 | $typeFilter="Text"; |
362 | 366 | switch($obj->type) |
@@ -34,84 +34,84 @@ |
||
34 | 34 | class modDocumentGeneration extends DolibarrModules |
35 | 35 | { |
36 | 36 | |
37 | - /** |
|
38 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
39 | - * |
|
40 | - * @param DoliDB $db Database handler |
|
41 | - */ |
|
42 | - function __construct($db) |
|
43 | - { |
|
44 | - $this->db = $db; |
|
45 | - $this->numero = 1520; |
|
46 | - |
|
47 | - $this->family = "technic"; |
|
48 | - $this->module_position = '80'; |
|
49 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | - $this->description = "Direct mail document generation"; |
|
52 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
53 | - $this->version = 'development'; |
|
54 | - |
|
55 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
56 | - $this->picto='email'; |
|
57 | - |
|
58 | - // Data directories to create when module is enabled |
|
59 | - $this->dirs = array("/documentgeneration/temp"); |
|
60 | - |
|
61 | - // Config pages |
|
62 | - //$this->config_page_url = array("document.php"); |
|
63 | - |
|
64 | - // Dependencies |
|
65 | - $this->depends = array(); |
|
66 | - $this->requiredby = array(); |
|
67 | - $this->conflictwith = array(); |
|
68 | - $this->langfiles = array("orders","bills","companies","mails"); |
|
69 | - |
|
70 | - // Constants |
|
71 | - |
|
72 | - $this->const = array(); |
|
73 | - |
|
74 | - // Boxes |
|
75 | - $this->boxes = array(); |
|
76 | - |
|
77 | - // Permissions |
|
78 | - $this->rights = array(); |
|
79 | - $this->rights_class = 'document'; |
|
80 | - |
|
81 | - $r=0; |
|
82 | - |
|
83 | - $this->rights[$r][0] = 1521; |
|
84 | - $this->rights[$r][1] = 'Lire les documents'; |
|
85 | - $this->rights[$r][2] = 'r'; |
|
86 | - $this->rights[$r][3] = 0; |
|
87 | - $this->rights[$r][4] = 'lire'; |
|
88 | - |
|
89 | - $r++; |
|
90 | - $this->rights[$r][0] = 1522; |
|
91 | - $this->rights[$r][1] = 'Supprimer les documents clients'; |
|
92 | - $this->rights[$r][2] = 'd'; |
|
93 | - $this->rights[$r][3] = 0; |
|
94 | - $this->rights[$r][4] = 'supprimer'; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * Function called when module is enabled. |
|
100 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
101 | - * It also creates data directories |
|
102 | - * |
|
37 | + /** |
|
38 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
39 | + * |
|
40 | + * @param DoliDB $db Database handler |
|
41 | + */ |
|
42 | + function __construct($db) |
|
43 | + { |
|
44 | + $this->db = $db; |
|
45 | + $this->numero = 1520; |
|
46 | + |
|
47 | + $this->family = "technic"; |
|
48 | + $this->module_position = '80'; |
|
49 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->description = "Direct mail document generation"; |
|
52 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
53 | + $this->version = 'development'; |
|
54 | + |
|
55 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
56 | + $this->picto='email'; |
|
57 | + |
|
58 | + // Data directories to create when module is enabled |
|
59 | + $this->dirs = array("/documentgeneration/temp"); |
|
60 | + |
|
61 | + // Config pages |
|
62 | + //$this->config_page_url = array("document.php"); |
|
63 | + |
|
64 | + // Dependencies |
|
65 | + $this->depends = array(); |
|
66 | + $this->requiredby = array(); |
|
67 | + $this->conflictwith = array(); |
|
68 | + $this->langfiles = array("orders","bills","companies","mails"); |
|
69 | + |
|
70 | + // Constants |
|
71 | + |
|
72 | + $this->const = array(); |
|
73 | + |
|
74 | + // Boxes |
|
75 | + $this->boxes = array(); |
|
76 | + |
|
77 | + // Permissions |
|
78 | + $this->rights = array(); |
|
79 | + $this->rights_class = 'document'; |
|
80 | + |
|
81 | + $r=0; |
|
82 | + |
|
83 | + $this->rights[$r][0] = 1521; |
|
84 | + $this->rights[$r][1] = 'Lire les documents'; |
|
85 | + $this->rights[$r][2] = 'r'; |
|
86 | + $this->rights[$r][3] = 0; |
|
87 | + $this->rights[$r][4] = 'lire'; |
|
88 | + |
|
89 | + $r++; |
|
90 | + $this->rights[$r][0] = 1522; |
|
91 | + $this->rights[$r][1] = 'Supprimer les documents clients'; |
|
92 | + $this->rights[$r][2] = 'd'; |
|
93 | + $this->rights[$r][3] = 0; |
|
94 | + $this->rights[$r][4] = 'supprimer'; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * Function called when module is enabled. |
|
100 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
101 | + * It also creates data directories |
|
102 | + * |
|
103 | 103 | * @param string $options Options when enabling module ('', 'noboxes') |
104 | - * @return int 1 if OK, 0 if KO |
|
105 | - */ |
|
106 | - function init($options='') |
|
107 | - { |
|
108 | - global $conf; |
|
104 | + * @return int 1 if OK, 0 if KO |
|
105 | + */ |
|
106 | + function init($options='') |
|
107 | + { |
|
108 | + global $conf; |
|
109 | 109 | |
110 | - // Permissions |
|
111 | - $this->remove($options); |
|
110 | + // Permissions |
|
111 | + $this->remove($options); |
|
112 | 112 | |
113 | - $sql = array(); |
|
113 | + $sql = array(); |
|
114 | 114 | |
115 | - return $this->_init($sql,$options); |
|
116 | - } |
|
115 | + return $this->_init($sql,$options); |
|
116 | + } |
|
117 | 117 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \brief Fichier de description et activation du module Generation document |
26 | 26 | */ |
27 | 27 | |
28 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
28 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | $this->family = "technic"; |
48 | 48 | $this->module_position = '80'; |
49 | 49 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
50 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
51 | 51 | $this->description = "Direct mail document generation"; |
52 | 52 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
53 | 53 | $this->version = 'development'; |
54 | 54 | |
55 | 55 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
56 | - $this->picto='email'; |
|
56 | + $this->picto = 'email'; |
|
57 | 57 | |
58 | 58 | // Data directories to create when module is enabled |
59 | 59 | $this->dirs = array("/documentgeneration/temp"); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->depends = array(); |
66 | 66 | $this->requiredby = array(); |
67 | 67 | $this->conflictwith = array(); |
68 | - $this->langfiles = array("orders","bills","companies","mails"); |
|
68 | + $this->langfiles = array("orders", "bills", "companies", "mails"); |
|
69 | 69 | |
70 | 70 | // Constants |
71 | 71 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->rights = array(); |
79 | 79 | $this->rights_class = 'document'; |
80 | 80 | |
81 | - $r=0; |
|
81 | + $r = 0; |
|
82 | 82 | |
83 | 83 | $this->rights[$r][0] = 1521; |
84 | 84 | $this->rights[$r][1] = 'Lire les documents'; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $options Options when enabling module ('', 'noboxes') |
104 | 104 | * @return int 1 if OK, 0 if KO |
105 | 105 | */ |
106 | - function init($options='') |
|
106 | + function init($options = '') |
|
107 | 107 | { |
108 | 108 | global $conf; |
109 | 109 | |
@@ -112,6 +112,6 @@ discard block |
||
112 | 112 | |
113 | 113 | $sql = array(); |
114 | 114 | |
115 | - return $this->_init($sql,$options); |
|
115 | + return $this->_init($sql, $options); |
|
116 | 116 | } |
117 | 117 | } |
@@ -33,105 +33,105 @@ discard block |
||
33 | 33 | */ |
34 | 34 | class modMultiCurrency extends DolibarrModules |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | - * |
|
39 | - * @param DoliDB $db Database handler |
|
40 | - */ |
|
41 | - public function __construct($db) |
|
42 | - { |
|
36 | + /** |
|
37 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | + * |
|
39 | + * @param DoliDB $db Database handler |
|
40 | + */ |
|
41 | + public function __construct($db) |
|
42 | + { |
|
43 | 43 | global $langs, $conf; |
44 | 44 | |
45 | 45 | $this->db = $db; |
46 | 46 | |
47 | - // Id for module (must be unique). |
|
48 | - // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
49 | - $this->numero = 40000; |
|
50 | - // Key text used to identify module (for permissions, menus, etc...) |
|
51 | - $this->rights_class = 'multicurrency'; |
|
52 | - |
|
53 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
54 | - // It is used to group modules in module setup page |
|
55 | - $this->family = "technic"; |
|
56 | - // Module position in the family |
|
57 | - $this->module_position = '40'; |
|
58 | - |
|
59 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
60 | - $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | - // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
|
62 | - $this->description = "Module to manage several foreign currencies in prices and documents"; |
|
63 | - |
|
64 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
65 | - $this->version = 'dolibarr'; |
|
66 | - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
67 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
68 | - // Name of image file used for this module. |
|
69 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
70 | - // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
71 | - $this->picto = 'multicurrency'; |
|
72 | - |
|
73 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
74 | - // for default path (eg: /multicurrency/core/xxxxx) (0=disable, 1=enable) |
|
75 | - // for specific path of parts (eg: /multicurrency/core/modules/barcode) |
|
76 | - // for specific css file (eg: /multicurrency/css/multicurrency.css.php) |
|
77 | - $this->module_parts = array(); |
|
78 | - |
|
79 | - // Data directories to create when module is enabled. |
|
80 | - // Example: this->dirs = array("/multicurrency/temp"); |
|
81 | - $this->dirs = array(); |
|
82 | - |
|
83 | - // Config pages. Put here list of php page, stored into multicurrency/admin directory, to use to setup module. |
|
84 | - $this->config_page_url = array("multicurrency.php"); |
|
85 | - |
|
86 | - // Dependencies |
|
87 | - $this->hidden = false; // A condition to hide module |
|
88 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
89 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
90 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
91 | - $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
92 | - $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module |
|
93 | - $this->langfiles = array("multicurrency"); |
|
94 | - |
|
95 | - // Constants |
|
96 | - // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
97 | - // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
98 | - // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
99 | - // ); |
|
100 | - $this->const = array(); |
|
101 | - |
|
102 | - // Array to add new pages in new tabs |
|
103 | - // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@multicurrency:$user->rights->multicurrency->read:/multicurrency/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 |
|
47 | + // Id for module (must be unique). |
|
48 | + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
49 | + $this->numero = 40000; |
|
50 | + // Key text used to identify module (for permissions, menus, etc...) |
|
51 | + $this->rights_class = 'multicurrency'; |
|
52 | + |
|
53 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
54 | + // It is used to group modules in module setup page |
|
55 | + $this->family = "technic"; |
|
56 | + // Module position in the family |
|
57 | + $this->module_position = '40'; |
|
58 | + |
|
59 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | + // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
|
62 | + $this->description = "Module to manage several foreign currencies in prices and documents"; |
|
63 | + |
|
64 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
65 | + $this->version = 'dolibarr'; |
|
66 | + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
67 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
68 | + // Name of image file used for this module. |
|
69 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
70 | + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
71 | + $this->picto = 'multicurrency'; |
|
72 | + |
|
73 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
74 | + // for default path (eg: /multicurrency/core/xxxxx) (0=disable, 1=enable) |
|
75 | + // for specific path of parts (eg: /multicurrency/core/modules/barcode) |
|
76 | + // for specific css file (eg: /multicurrency/css/multicurrency.css.php) |
|
77 | + $this->module_parts = array(); |
|
78 | + |
|
79 | + // Data directories to create when module is enabled. |
|
80 | + // Example: this->dirs = array("/multicurrency/temp"); |
|
81 | + $this->dirs = array(); |
|
82 | + |
|
83 | + // Config pages. Put here list of php page, stored into multicurrency/admin directory, to use to setup module. |
|
84 | + $this->config_page_url = array("multicurrency.php"); |
|
85 | + |
|
86 | + // Dependencies |
|
87 | + $this->hidden = false; // A condition to hide module |
|
88 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
89 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
90 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
91 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
92 | + $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module |
|
93 | + $this->langfiles = array("multicurrency"); |
|
94 | + |
|
95 | + // Constants |
|
96 | + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
97 | + // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
98 | + // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
99 | + // ); |
|
100 | + $this->const = array(); |
|
101 | + |
|
102 | + // Array to add new pages in new tabs |
|
103 | + // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@multicurrency:$user->rights->multicurrency->read:/multicurrency/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 |
|
104 | 104 | // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@multicurrency:$user->rights->othermodule->read:/multicurrency/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. |
105 | 105 | // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname |
106 | - // where objecttype can be |
|
107 | - // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
108 | - // 'contact' to add a tab in contact view |
|
109 | - // 'contract' to add a tab in contract view |
|
110 | - // 'group' to add a tab in group view |
|
111 | - // 'intervention' to add a tab in intervention view |
|
112 | - // 'invoice' to add a tab in customer invoice view |
|
113 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
114 | - // 'member' to add a tab in fundation member view |
|
115 | - // 'opensurveypoll' to add a tab in opensurvey poll view |
|
116 | - // 'order' to add a tab in customer order view |
|
117 | - // 'order_supplier' to add a tab in supplier order view |
|
118 | - // 'payment' to add a tab in payment view |
|
119 | - // 'payment_supplier' to add a tab in supplier payment view |
|
120 | - // 'product' to add a tab in product view |
|
121 | - // 'propal' to add a tab in propal view |
|
122 | - // 'project' to add a tab in project view |
|
123 | - // 'stock' to add a tab in stock view |
|
124 | - // 'thirdparty' to add a tab in third party view |
|
125 | - // 'user' to add a tab in user view |
|
106 | + // where objecttype can be |
|
107 | + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
108 | + // 'contact' to add a tab in contact view |
|
109 | + // 'contract' to add a tab in contract view |
|
110 | + // 'group' to add a tab in group view |
|
111 | + // 'intervention' to add a tab in intervention view |
|
112 | + // 'invoice' to add a tab in customer invoice view |
|
113 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
114 | + // 'member' to add a tab in fundation member view |
|
115 | + // 'opensurveypoll' to add a tab in opensurvey poll view |
|
116 | + // 'order' to add a tab in customer order view |
|
117 | + // 'order_supplier' to add a tab in supplier order view |
|
118 | + // 'payment' to add a tab in payment view |
|
119 | + // 'payment_supplier' to add a tab in supplier payment view |
|
120 | + // 'product' to add a tab in product view |
|
121 | + // 'propal' to add a tab in propal view |
|
122 | + // 'project' to add a tab in project view |
|
123 | + // 'stock' to add a tab in stock view |
|
124 | + // 'thirdparty' to add a tab in third party view |
|
125 | + // 'user' to add a tab in user view |
|
126 | 126 | $this->tabs = array(); |
127 | 127 | |
128 | 128 | // Dictionaries |
129 | - if (!isset($conf->multicurrency->enabled)) |
|
129 | + if (!isset($conf->multicurrency->enabled)) |
|
130 | 130 | { |
131 | - $conf->multicurrency = new stdClass(); |
|
132 | - $conf->multicurrency->enabled = 0; |
|
131 | + $conf->multicurrency = new stdClass(); |
|
132 | + $conf->multicurrency->enabled = 0; |
|
133 | 133 | } |
134 | - $this->dictionaries = array(); |
|
134 | + $this->dictionaries = array(); |
|
135 | 135 | /* Example: |
136 | 136 | if (! isset($conf->multicurrency->enabled)) $conf->multicurrency->enabled=0; // This is to avoid warnings |
137 | 137 | $this->dictionaries=array( |
@@ -150,169 +150,169 @@ discard block |
||
150 | 150 | */ |
151 | 151 | |
152 | 152 | // Boxes |
153 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
153 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
154 | 154 | $this->boxes = array(); // List of boxes |
155 | - // Example: |
|
156 | - //$this->boxes=array( |
|
157 | - // 0=>array('file'=>'myboxa.php@multicurrency','note'=>'','enabledbydefaulton'=>'Home'), |
|
158 | - // 1=>array('file'=>'myboxb.php@multicurrency','note'=>''), |
|
159 | - // 2=>array('file'=>'myboxc.php@multicurrency','note'=>'') |
|
160 | - //); |
|
161 | - |
|
162 | - // Permissions |
|
163 | - $this->rights = array(); // Permission array used by this module |
|
164 | - $r = 0; |
|
165 | - |
|
166 | - // Add here list of permission defined by an id, a label, a boolean and two constant strings. |
|
167 | - // Example: |
|
168 | - // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) |
|
169 | - // $this->rights[$r][1] = 'Permision label'; // Permission label |
|
170 | - // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
171 | - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
172 | - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
173 | - // $r++; |
|
174 | - |
|
175 | - // Main menu entries |
|
176 | - $this->menu = array(); // List of menus to add |
|
177 | - $r = 0; |
|
178 | - |
|
179 | - // Add here entries to declare new menus |
|
180 | - // |
|
181 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
182 | - // $this->menu[$r]=array( 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
183 | - // 'type'=>'top', // This is a Top menu entry |
|
184 | - // 'titre'=>'MyModule top menu', |
|
185 | - // 'mainmenu'=>'multicurrency', |
|
186 | - // 'leftmenu'=>'multicurrency', |
|
187 | - // 'url'=>'/multicurrency/pagetop.php', |
|
188 | - // 'langs'=>'mylangfile@multicurrency', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
189 | - // 'position'=>100, |
|
190 | - // 'enabled'=>'$conf->multicurrency->enabled', // Define condition to show or hide menu entry. Use '$conf->multicurrency->enabled' if entry must be visible if module is enabled. |
|
191 | - // 'perms'=>'1', // Use 'perms'=>'$user->rights->multicurrency->level1->level2' if you want your menu with a permission rules |
|
192 | - // 'target'=>'', |
|
193 | - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
194 | - // $r++; |
|
195 | - // |
|
196 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
197 | - // $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
198 | - // 'type'=>'left', // This is a Left menu entry |
|
199 | - // 'titre'=>'MyModule left menu', |
|
200 | - // 'mainmenu'=>'xxx', |
|
201 | - // 'leftmenu'=>'multicurrency', |
|
202 | - // 'url'=>'/multicurrency/pagelevel2.php', |
|
203 | - // 'langs'=>'mylangfile@multicurrency', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
204 | - // 'position'=>100, |
|
205 | - // 'enabled'=>'$conf->multicurrency->enabled', // Define condition to show or hide menu entry. Use '$conf->multicurrency->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
206 | - // 'perms'=>'1', // Use 'perms'=>'$user->rights->multicurrency->level1->level2' if you want your menu with a permission rules |
|
207 | - // 'target'=>'', |
|
208 | - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
209 | - // $r++; |
|
210 | - |
|
211 | - |
|
212 | - // Exports |
|
213 | - $r = 1; |
|
214 | - |
|
215 | - // Example: |
|
216 | - // $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
217 | - // $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
155 | + // Example: |
|
156 | + //$this->boxes=array( |
|
157 | + // 0=>array('file'=>'myboxa.php@multicurrency','note'=>'','enabledbydefaulton'=>'Home'), |
|
158 | + // 1=>array('file'=>'myboxb.php@multicurrency','note'=>''), |
|
159 | + // 2=>array('file'=>'myboxc.php@multicurrency','note'=>'') |
|
160 | + //); |
|
161 | + |
|
162 | + // Permissions |
|
163 | + $this->rights = array(); // Permission array used by this module |
|
164 | + $r = 0; |
|
165 | + |
|
166 | + // Add here list of permission defined by an id, a label, a boolean and two constant strings. |
|
167 | + // Example: |
|
168 | + // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) |
|
169 | + // $this->rights[$r][1] = 'Permision label'; // Permission label |
|
170 | + // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
171 | + // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
172 | + // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
173 | + // $r++; |
|
174 | + |
|
175 | + // Main menu entries |
|
176 | + $this->menu = array(); // List of menus to add |
|
177 | + $r = 0; |
|
178 | + |
|
179 | + // Add here entries to declare new menus |
|
180 | + // |
|
181 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
182 | + // $this->menu[$r]=array( 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
183 | + // 'type'=>'top', // This is a Top menu entry |
|
184 | + // 'titre'=>'MyModule top menu', |
|
185 | + // 'mainmenu'=>'multicurrency', |
|
186 | + // 'leftmenu'=>'multicurrency', |
|
187 | + // 'url'=>'/multicurrency/pagetop.php', |
|
188 | + // 'langs'=>'mylangfile@multicurrency', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
189 | + // 'position'=>100, |
|
190 | + // 'enabled'=>'$conf->multicurrency->enabled', // Define condition to show or hide menu entry. Use '$conf->multicurrency->enabled' if entry must be visible if module is enabled. |
|
191 | + // 'perms'=>'1', // Use 'perms'=>'$user->rights->multicurrency->level1->level2' if you want your menu with a permission rules |
|
192 | + // 'target'=>'', |
|
193 | + // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
194 | + // $r++; |
|
195 | + // |
|
196 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
197 | + // $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
198 | + // 'type'=>'left', // This is a Left menu entry |
|
199 | + // 'titre'=>'MyModule left menu', |
|
200 | + // 'mainmenu'=>'xxx', |
|
201 | + // 'leftmenu'=>'multicurrency', |
|
202 | + // 'url'=>'/multicurrency/pagelevel2.php', |
|
203 | + // 'langs'=>'mylangfile@multicurrency', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
204 | + // 'position'=>100, |
|
205 | + // 'enabled'=>'$conf->multicurrency->enabled', // Define condition to show or hide menu entry. Use '$conf->multicurrency->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
206 | + // 'perms'=>'1', // Use 'perms'=>'$user->rights->multicurrency->level1->level2' if you want your menu with a permission rules |
|
207 | + // 'target'=>'', |
|
208 | + // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
209 | + // $r++; |
|
210 | + |
|
211 | + |
|
212 | + // Exports |
|
213 | + $r = 1; |
|
214 | + |
|
215 | + // Example: |
|
216 | + // $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
217 | + // $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
218 | 218 | // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. |
219 | 219 | // $this->export_icon[$r]='generic:MyModule'; |
220 | - // $this->export_permission[$r]=array(array("multicurrency","level1","level2")); |
|
221 | - // $this->export_fields_array[$r]=array( |
|
222 | - // 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone', |
|
223 | - // 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', |
|
224 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation", |
|
225 | - // 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus', |
|
226 | - // 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate", |
|
227 | - // 'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart", |
|
228 | - // 'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef' |
|
229 | - //); |
|
230 | - // $this->export_TypeFields_array[$r]=array( |
|
231 | - // 't.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', |
|
232 | - // 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text', |
|
233 | - // 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text', |
|
234 | - // 'f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric", |
|
235 | - // 'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric", |
|
236 | - // 'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date", |
|
237 | - // 'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text', |
|
238 | - // 'p.accountancy_code_sell'=>'Text' |
|
239 | - //); |
|
240 | - // $this->export_entities_array[$r]=array( |
|
241 | - // 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company', |
|
242 | - // 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', |
|
243 | - // 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice", |
|
244 | - // 'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line", |
|
245 | - // 'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line", |
|
246 | - // 'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product' |
|
247 | - //); |
|
248 | - // $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
249 | - // $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
250 | - // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; |
|
251 | - // $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; |
|
252 | - // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; |
|
253 | - // $this->export_sql_order[$r] .=' ORDER BY s.nom'; |
|
254 | - // $r++; |
|
255 | - } |
|
256 | - |
|
257 | - /** |
|
258 | - * Function called when module is enabled. |
|
259 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
260 | - * It also creates data directories |
|
261 | - * |
|
220 | + // $this->export_permission[$r]=array(array("multicurrency","level1","level2")); |
|
221 | + // $this->export_fields_array[$r]=array( |
|
222 | + // 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone', |
|
223 | + // 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', |
|
224 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation", |
|
225 | + // 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus', |
|
226 | + // 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate", |
|
227 | + // 'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart", |
|
228 | + // 'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef' |
|
229 | + //); |
|
230 | + // $this->export_TypeFields_array[$r]=array( |
|
231 | + // 't.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', |
|
232 | + // 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text', |
|
233 | + // 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text', |
|
234 | + // 'f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric", |
|
235 | + // 'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric", |
|
236 | + // 'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date", |
|
237 | + // 'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text', |
|
238 | + // 'p.accountancy_code_sell'=>'Text' |
|
239 | + //); |
|
240 | + // $this->export_entities_array[$r]=array( |
|
241 | + // 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company', |
|
242 | + // 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', |
|
243 | + // 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice", |
|
244 | + // 'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line", |
|
245 | + // 'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line", |
|
246 | + // 'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product' |
|
247 | + //); |
|
248 | + // $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
249 | + // $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
250 | + // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; |
|
251 | + // $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; |
|
252 | + // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; |
|
253 | + // $this->export_sql_order[$r] .=' ORDER BY s.nom'; |
|
254 | + // $r++; |
|
255 | + } |
|
256 | + |
|
257 | + /** |
|
258 | + * Function called when module is enabled. |
|
259 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
260 | + * It also creates data directories |
|
261 | + * |
|
262 | 262 | * @param string $options Options when enabling module ('', 'noboxes') |
263 | - * @return int 1 if OK, 0 if KO |
|
264 | - */ |
|
265 | - public function init($options = '') |
|
266 | - { |
|
267 | - $sql = array(); |
|
268 | - |
|
269 | - //$this->_load_tables('/multicurrency/sql/'); |
|
270 | - $res = $this->_init($sql, $options); |
|
271 | - |
|
272 | - if ($res) |
|
273 | - { |
|
274 | - $this->createFirstCurrency(); |
|
275 | - } |
|
276 | - |
|
277 | - return $res; |
|
278 | - } |
|
279 | - |
|
280 | - /** |
|
281 | - * Function called when module is disabled. |
|
282 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
283 | - * Data directories are not deleted |
|
284 | - * |
|
285 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
286 | - * @return int 1 if OK, 0 if KO |
|
287 | - */ |
|
288 | - public function remove($options = '') |
|
289 | - { |
|
290 | - $sql = array(); |
|
291 | - |
|
292 | - return $this->_remove($sql, $options); |
|
293 | - } |
|
294 | - |
|
295 | - /** |
|
296 | - * Function called when module is enabled |
|
297 | - * Create the currency from general setting |
|
298 | - * |
|
299 | - * @return int 1 if OK, 0 if KO |
|
300 | - */ |
|
301 | - private function createFirstCurrency() |
|
302 | - { |
|
303 | - global $conf, $user, $langs; |
|
304 | - |
|
305 | - if (!MultiCurrency::checkCodeAlreadyExists($conf->currency)) |
|
306 | - { |
|
307 | - $langs->loadCacheCurrencies(''); |
|
308 | - |
|
309 | - $multicurrency = new MultiCurrency($this->db); |
|
310 | - $multicurrency->code = $conf->currency; |
|
311 | - $multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')'; |
|
312 | - $r = $multicurrency->create($user); |
|
313 | - |
|
314 | - if ($r > 0) $multicurrency->addRate(1); |
|
315 | - } |
|
316 | - } |
|
263 | + * @return int 1 if OK, 0 if KO |
|
264 | + */ |
|
265 | + public function init($options = '') |
|
266 | + { |
|
267 | + $sql = array(); |
|
268 | + |
|
269 | + //$this->_load_tables('/multicurrency/sql/'); |
|
270 | + $res = $this->_init($sql, $options); |
|
271 | + |
|
272 | + if ($res) |
|
273 | + { |
|
274 | + $this->createFirstCurrency(); |
|
275 | + } |
|
276 | + |
|
277 | + return $res; |
|
278 | + } |
|
279 | + |
|
280 | + /** |
|
281 | + * Function called when module is disabled. |
|
282 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
283 | + * Data directories are not deleted |
|
284 | + * |
|
285 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
286 | + * @return int 1 if OK, 0 if KO |
|
287 | + */ |
|
288 | + public function remove($options = '') |
|
289 | + { |
|
290 | + $sql = array(); |
|
291 | + |
|
292 | + return $this->_remove($sql, $options); |
|
293 | + } |
|
294 | + |
|
295 | + /** |
|
296 | + * Function called when module is enabled |
|
297 | + * Create the currency from general setting |
|
298 | + * |
|
299 | + * @return int 1 if OK, 0 if KO |
|
300 | + */ |
|
301 | + private function createFirstCurrency() |
|
302 | + { |
|
303 | + global $conf, $user, $langs; |
|
304 | + |
|
305 | + if (!MultiCurrency::checkCodeAlreadyExists($conf->currency)) |
|
306 | + { |
|
307 | + $langs->loadCacheCurrencies(''); |
|
308 | + |
|
309 | + $multicurrency = new MultiCurrency($this->db); |
|
310 | + $multicurrency->code = $conf->currency; |
|
311 | + $multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')'; |
|
312 | + $r = $multicurrency->create($user); |
|
313 | + |
|
314 | + if ($r > 0) $multicurrency->addRate(1); |
|
315 | + } |
|
316 | + } |
|
317 | 317 | } |
318 | 318 |
@@ -311,7 +311,9 @@ |
||
311 | 311 | $multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')'; |
312 | 312 | $r = $multicurrency->create($user); |
313 | 313 | |
314 | - if ($r > 0) $multicurrency->addRate(1); |
|
314 | + if ($r > 0) { |
|
315 | + $multicurrency->addRate(1); |
|
316 | + } |
|
315 | 317 | } |
316 | 318 | } |
317 | 319 | } |
@@ -33,60 +33,60 @@ discard block |
||
33 | 33 | */ |
34 | 34 | class modIncoterm extends DolibarrModules |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | - * |
|
39 | - * @param DoliDB $db Database handler |
|
40 | - */ |
|
41 | - function __construct($db) |
|
42 | - { |
|
36 | + /** |
|
37 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | + * |
|
39 | + * @param DoliDB $db Database handler |
|
40 | + */ |
|
41 | + function __construct($db) |
|
42 | + { |
|
43 | 43 | global $langs,$conf; |
44 | 44 | |
45 | 45 | $this->db = $db; |
46 | 46 | |
47 | - // Id for module (must be unique). |
|
48 | - // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
49 | - $this->numero = 62000; |
|
50 | - // Key text used to identify module (for permissions, menus, etc...) |
|
51 | - $this->rights_class = 'incoterm'; |
|
47 | + // Id for module (must be unique). |
|
48 | + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
49 | + $this->numero = 62000; |
|
50 | + // Key text used to identify module (for permissions, menus, etc...) |
|
51 | + $this->rights_class = 'incoterm'; |
|
52 | 52 | |
53 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
54 | - $this->family = "srm"; |
|
55 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
56 | - $this->description = "Incoterm management"; |
|
57 | - $this->version = 'dolibarr'; |
|
58 | - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
59 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
60 | - $this->picto='generic'; |
|
53 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
54 | + $this->family = "srm"; |
|
55 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
56 | + $this->description = "Incoterm management"; |
|
57 | + $this->version = 'dolibarr'; |
|
58 | + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
59 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
60 | + $this->picto='generic'; |
|
61 | 61 | |
62 | - $this->module_parts = array(); |
|
63 | - $this->dirs = array(); |
|
62 | + $this->module_parts = array(); |
|
63 | + $this->dirs = array(); |
|
64 | 64 | |
65 | - $this->config_page_url = array(); |
|
65 | + $this->config_page_url = array(); |
|
66 | 66 | |
67 | - // Dependencies |
|
68 | - $this->hidden = false; // A condition to hide module |
|
69 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
70 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
71 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
72 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
73 | - $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module |
|
74 | - $this->langfiles = array("incoterm"); |
|
67 | + // Dependencies |
|
68 | + $this->hidden = false; // A condition to hide module |
|
69 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
70 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
71 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
72 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
73 | + $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module |
|
74 | + $this->langfiles = array("incoterm"); |
|
75 | 75 | |
76 | - $this->const = array( |
|
77 | - array('INCOTERM_ACTIVATE', 'chaine', 0, 'Description de INCOTERM_ACTIVATE') |
|
78 | - ); |
|
76 | + $this->const = array( |
|
77 | + array('INCOTERM_ACTIVATE', 'chaine', 0, 'Description de INCOTERM_ACTIVATE') |
|
78 | + ); |
|
79 | 79 | |
80 | 80 | $this->tabs = array(); |
81 | 81 | |
82 | 82 | // Dictionaries |
83 | - if (! isset($conf->incoterm->enabled)) |
|
83 | + if (! isset($conf->incoterm->enabled)) |
|
84 | 84 | { |
85 | - $conf->incoterm=new stdClass(); |
|
86 | - $conf->incoterm->enabled=0; |
|
85 | + $conf->incoterm=new stdClass(); |
|
86 | + $conf->incoterm->enabled=0; |
|
87 | 87 | } |
88 | - $this->dictionaries=array( |
|
89 | - 'langs'=>'incoterm', |
|
88 | + $this->dictionaries=array( |
|
89 | + 'langs'=>'incoterm', |
|
90 | 90 | 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor |
91 | 91 | 'tablib'=>array("Incoterms"), // Label of tables |
92 | 92 | 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) |
97 | 97 | 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') |
98 | 98 | 'tabcond'=>array($conf->incoterm->enabled) |
99 | - ); |
|
99 | + ); |
|
100 | 100 | |
101 | 101 | $this->boxes = array(); // List of boxes |
102 | - $r=0; |
|
102 | + $r=0; |
|
103 | 103 | |
104 | - // Permissions |
|
105 | - $this->rights = array(); // Permission array used by this module |
|
106 | - $r=0; |
|
104 | + // Permissions |
|
105 | + $this->rights = array(); // Permission array used by this module |
|
106 | + $r=0; |
|
107 | 107 | |
108 | - // Main menu entries |
|
109 | - $this->menus = array(); // List of menus to add |
|
110 | - $r=0; |
|
111 | - } |
|
108 | + // Main menu entries |
|
109 | + $this->menus = array(); // List of menus to add |
|
110 | + $r=0; |
|
111 | + } |
|
112 | 112 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup mymodule |
26 | 26 | * \brief Description and activation file for module MyModule |
27 | 27 | */ |
28 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
28 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function __construct($db) |
42 | 42 | { |
43 | - global $langs,$conf; |
|
43 | + global $langs, $conf; |
|
44 | 44 | |
45 | 45 | $this->db = $db; |
46 | 46 | |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
54 | 54 | $this->family = "srm"; |
55 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
55 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
56 | 56 | $this->description = "Incoterm management"; |
57 | 57 | $this->version = 'dolibarr'; |
58 | 58 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | - $this->picto='generic'; |
|
60 | + $this->picto = 'generic'; |
|
61 | 61 | |
62 | 62 | $this->module_parts = array(); |
63 | 63 | $this->dirs = array(); |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | $this->config_page_url = array(); |
66 | 66 | |
67 | 67 | // Dependencies |
68 | - $this->hidden = false; // A condition to hide module |
|
69 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
70 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
71 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
72 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
73 | - $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module |
|
68 | + $this->hidden = false; // A condition to hide module |
|
69 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
70 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
71 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
72 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
73 | + $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module |
|
74 | 74 | $this->langfiles = array("incoterm"); |
75 | 75 | |
76 | 76 | $this->const = array( |
@@ -80,33 +80,33 @@ discard block |
||
80 | 80 | $this->tabs = array(); |
81 | 81 | |
82 | 82 | // Dictionaries |
83 | - if (! isset($conf->incoterm->enabled)) |
|
83 | + if (!isset($conf->incoterm->enabled)) |
|
84 | 84 | { |
85 | - $conf->incoterm=new stdClass(); |
|
86 | - $conf->incoterm->enabled=0; |
|
85 | + $conf->incoterm = new stdClass(); |
|
86 | + $conf->incoterm->enabled = 0; |
|
87 | 87 | } |
88 | - $this->dictionaries=array( |
|
88 | + $this->dictionaries = array( |
|
89 | 89 | 'langs'=>'incoterm', |
90 | - 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor |
|
91 | - 'tablib'=>array("Incoterms"), // Label of tables |
|
92 | - 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields |
|
93 | - 'tabsqlsort'=>array("rowid ASC"), // Sort order |
|
94 | - 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary) |
|
95 | - 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) |
|
96 | - 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) |
|
97 | - 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') |
|
90 | + 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor |
|
91 | + 'tablib'=>array("Incoterms"), // Label of tables |
|
92 | + 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields |
|
93 | + 'tabsqlsort'=>array("rowid ASC"), // Sort order |
|
94 | + 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary) |
|
95 | + 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) |
|
96 | + 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) |
|
97 | + 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') |
|
98 | 98 | 'tabcond'=>array($conf->incoterm->enabled) |
99 | 99 | ); |
100 | 100 | |
101 | - $this->boxes = array(); // List of boxes |
|
102 | - $r=0; |
|
101 | + $this->boxes = array(); // List of boxes |
|
102 | + $r = 0; |
|
103 | 103 | |
104 | 104 | // Permissions |
105 | - $this->rights = array(); // Permission array used by this module |
|
106 | - $r=0; |
|
105 | + $this->rights = array(); // Permission array used by this module |
|
106 | + $r = 0; |
|
107 | 107 | |
108 | 108 | // Main menu entries |
109 | - $this->menus = array(); // List of menus to add |
|
110 | - $r=0; |
|
109 | + $this->menus = array(); // List of menus to add |
|
110 | + $r = 0; |
|
111 | 111 | } |
112 | 112 | } |