@@ -33,162 +33,162 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function user_prepare_head($object) |
35 | 35 | { |
36 | - global $langs, $conf, $user, $db; |
|
37 | - |
|
38 | - $langs->load("users"); |
|
39 | - |
|
40 | - $canreadperms=true; |
|
41 | - if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
42 | - { |
|
43 | - $canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms)); |
|
44 | - } |
|
45 | - |
|
46 | - $h = 0; |
|
47 | - $head = array(); |
|
48 | - |
|
49 | - $head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id; |
|
50 | - $head[$h][1] = $langs->trans("UserCard"); |
|
51 | - $head[$h][2] = 'user'; |
|
52 | - $h++; |
|
53 | - |
|
54 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
55 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
56 | - { |
|
57 | - $langs->load("ldap"); |
|
58 | - $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id; |
|
59 | - $head[$h][1] = $langs->trans("LDAPCard"); |
|
60 | - $head[$h][2] = 'ldap'; |
|
61 | - $h++; |
|
62 | - } |
|
63 | - |
|
64 | - if ($canreadperms) |
|
65 | - { |
|
66 | - $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id; |
|
67 | - $head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>'; |
|
68 | - $head[$h][2] = 'rights'; |
|
69 | - $h++; |
|
70 | - } |
|
71 | - |
|
72 | - $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id; |
|
73 | - $head[$h][1] = $langs->trans("UserGUISetup"); |
|
74 | - $head[$h][2] = 'guisetup'; |
|
75 | - $h++; |
|
76 | - |
|
77 | - if (! empty($conf->agenda->enabled)) |
|
78 | - { |
|
79 | - if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; |
|
80 | - $MAXAGENDA=$conf->global->AGENDA_EXT_NB; |
|
81 | - |
|
82 | - $i=1; |
|
83 | - $nbagenda = 0; |
|
84 | - while ($i <= $MAXAGENDA) |
|
85 | - { |
|
86 | - $key=$i; |
|
87 | - $name='AGENDA_EXT_NAME_'.$object->id.'_'.$key; |
|
88 | - $src='AGENDA_EXT_SRC_'.$object->id.'_'.$key; |
|
89 | - $offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key; |
|
90 | - $color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key; |
|
91 | - $i++; |
|
92 | - |
|
93 | - if (! empty($object->conf->$name)) $nbagenda++; |
|
94 | - } |
|
95 | - |
|
96 | - $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id; |
|
97 | - $head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : ''); |
|
98 | - $head[$h][2] = 'extsites'; |
|
99 | - $h++; |
|
100 | - } |
|
101 | - |
|
102 | - if (! empty($conf->clicktodial->enabled)) |
|
103 | - { |
|
104 | - $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id; |
|
105 | - $head[$h][1] = $langs->trans("ClickToDial"); |
|
106 | - $head[$h][2] = 'clicktodial'; |
|
107 | - $h++; |
|
108 | - } |
|
109 | - |
|
110 | - // Notifications |
|
111 | - if ($user->societe_id == 0 && ! empty($conf->notification->enabled)) |
|
112 | - { |
|
113 | - $nbNote = 0; |
|
114 | - $sql = "SELECT COUNT(n.rowid) as nb"; |
|
115 | - $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; |
|
116 | - $sql.= " WHERE fk_user = ".$object->id; |
|
117 | - $resql=$db->query($sql); |
|
118 | - if ($resql) |
|
119 | - { |
|
120 | - $num = $db->num_rows($resql); |
|
121 | - $i = 0; |
|
122 | - while ($i < $num) |
|
123 | - { |
|
124 | - $obj = $db->fetch_object($resql); |
|
125 | - $nbNote=$obj->nb; |
|
126 | - $i++; |
|
127 | - } |
|
128 | - } |
|
129 | - else { |
|
130 | - dol_print_error($db); |
|
131 | - } |
|
132 | - |
|
133 | - $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id; |
|
134 | - $head[$h][1] = $langs->trans("Notifications"); |
|
135 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
136 | - $head[$h][2] = 'notify'; |
|
137 | - $h++; |
|
138 | - } |
|
139 | - |
|
140 | - // Show more tabs from modules |
|
141 | - // Entries must be declared in modules descriptor with line |
|
142 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
143 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
144 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); |
|
145 | - |
|
146 | - if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) |
|
147 | - || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)) |
|
148 | - || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id) |
|
149 | - || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id ) |
|
150 | - ) |
|
151 | - { |
|
152 | - // Bank |
|
153 | - $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; |
|
154 | - $head[$h][1] = $langs->trans("HRAndBank"); |
|
155 | - $head[$h][2] = 'bank'; |
|
156 | - $h++; |
|
157 | - } |
|
158 | - |
|
159 | - // Such info on users is visible only by internal user |
|
160 | - if (empty($user->societe_id)) |
|
161 | - { |
|
162 | - // Notes |
|
163 | - $nbNote = 0; |
|
164 | - if(!empty($object->note)) $nbNote++; |
|
165 | - $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; |
|
166 | - $head[$h][1] = $langs->trans("Note"); |
|
167 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
168 | - $head[$h][2] = 'note'; |
|
169 | - $h++; |
|
170 | - |
|
171 | - // Attached files |
|
172 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
173 | - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
174 | - $upload_dir = $conf->user->dir_output . "/" . $object->id; |
|
175 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
176 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
177 | - $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; |
|
178 | - $head[$h][1] = $langs->trans("Documents"); |
|
179 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
180 | - $head[$h][2] = 'document'; |
|
181 | - $h++; |
|
182 | - |
|
183 | - $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id; |
|
184 | - $head[$h][1] = $langs->trans("Info"); |
|
185 | - $head[$h][2] = 'info'; |
|
186 | - $h++; |
|
187 | - } |
|
188 | - |
|
189 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove'); |
|
190 | - |
|
191 | - return $head; |
|
36 | + global $langs, $conf, $user, $db; |
|
37 | + |
|
38 | + $langs->load("users"); |
|
39 | + |
|
40 | + $canreadperms=true; |
|
41 | + if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
42 | + { |
|
43 | + $canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms)); |
|
44 | + } |
|
45 | + |
|
46 | + $h = 0; |
|
47 | + $head = array(); |
|
48 | + |
|
49 | + $head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id; |
|
50 | + $head[$h][1] = $langs->trans("UserCard"); |
|
51 | + $head[$h][2] = 'user'; |
|
52 | + $h++; |
|
53 | + |
|
54 | + if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
55 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
56 | + { |
|
57 | + $langs->load("ldap"); |
|
58 | + $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id; |
|
59 | + $head[$h][1] = $langs->trans("LDAPCard"); |
|
60 | + $head[$h][2] = 'ldap'; |
|
61 | + $h++; |
|
62 | + } |
|
63 | + |
|
64 | + if ($canreadperms) |
|
65 | + { |
|
66 | + $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id; |
|
67 | + $head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>'; |
|
68 | + $head[$h][2] = 'rights'; |
|
69 | + $h++; |
|
70 | + } |
|
71 | + |
|
72 | + $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id; |
|
73 | + $head[$h][1] = $langs->trans("UserGUISetup"); |
|
74 | + $head[$h][2] = 'guisetup'; |
|
75 | + $h++; |
|
76 | + |
|
77 | + if (! empty($conf->agenda->enabled)) |
|
78 | + { |
|
79 | + if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; |
|
80 | + $MAXAGENDA=$conf->global->AGENDA_EXT_NB; |
|
81 | + |
|
82 | + $i=1; |
|
83 | + $nbagenda = 0; |
|
84 | + while ($i <= $MAXAGENDA) |
|
85 | + { |
|
86 | + $key=$i; |
|
87 | + $name='AGENDA_EXT_NAME_'.$object->id.'_'.$key; |
|
88 | + $src='AGENDA_EXT_SRC_'.$object->id.'_'.$key; |
|
89 | + $offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key; |
|
90 | + $color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key; |
|
91 | + $i++; |
|
92 | + |
|
93 | + if (! empty($object->conf->$name)) $nbagenda++; |
|
94 | + } |
|
95 | + |
|
96 | + $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id; |
|
97 | + $head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : ''); |
|
98 | + $head[$h][2] = 'extsites'; |
|
99 | + $h++; |
|
100 | + } |
|
101 | + |
|
102 | + if (! empty($conf->clicktodial->enabled)) |
|
103 | + { |
|
104 | + $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id; |
|
105 | + $head[$h][1] = $langs->trans("ClickToDial"); |
|
106 | + $head[$h][2] = 'clicktodial'; |
|
107 | + $h++; |
|
108 | + } |
|
109 | + |
|
110 | + // Notifications |
|
111 | + if ($user->societe_id == 0 && ! empty($conf->notification->enabled)) |
|
112 | + { |
|
113 | + $nbNote = 0; |
|
114 | + $sql = "SELECT COUNT(n.rowid) as nb"; |
|
115 | + $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; |
|
116 | + $sql.= " WHERE fk_user = ".$object->id; |
|
117 | + $resql=$db->query($sql); |
|
118 | + if ($resql) |
|
119 | + { |
|
120 | + $num = $db->num_rows($resql); |
|
121 | + $i = 0; |
|
122 | + while ($i < $num) |
|
123 | + { |
|
124 | + $obj = $db->fetch_object($resql); |
|
125 | + $nbNote=$obj->nb; |
|
126 | + $i++; |
|
127 | + } |
|
128 | + } |
|
129 | + else { |
|
130 | + dol_print_error($db); |
|
131 | + } |
|
132 | + |
|
133 | + $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id; |
|
134 | + $head[$h][1] = $langs->trans("Notifications"); |
|
135 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
136 | + $head[$h][2] = 'notify'; |
|
137 | + $h++; |
|
138 | + } |
|
139 | + |
|
140 | + // Show more tabs from modules |
|
141 | + // Entries must be declared in modules descriptor with line |
|
142 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
143 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
144 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); |
|
145 | + |
|
146 | + if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) |
|
147 | + || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)) |
|
148 | + || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id) |
|
149 | + || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id ) |
|
150 | + ) |
|
151 | + { |
|
152 | + // Bank |
|
153 | + $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; |
|
154 | + $head[$h][1] = $langs->trans("HRAndBank"); |
|
155 | + $head[$h][2] = 'bank'; |
|
156 | + $h++; |
|
157 | + } |
|
158 | + |
|
159 | + // Such info on users is visible only by internal user |
|
160 | + if (empty($user->societe_id)) |
|
161 | + { |
|
162 | + // Notes |
|
163 | + $nbNote = 0; |
|
164 | + if(!empty($object->note)) $nbNote++; |
|
165 | + $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; |
|
166 | + $head[$h][1] = $langs->trans("Note"); |
|
167 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
168 | + $head[$h][2] = 'note'; |
|
169 | + $h++; |
|
170 | + |
|
171 | + // Attached files |
|
172 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
173 | + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
174 | + $upload_dir = $conf->user->dir_output . "/" . $object->id; |
|
175 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
176 | + $nbLinks=Link::count($db, $object->element, $object->id); |
|
177 | + $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; |
|
178 | + $head[$h][1] = $langs->trans("Documents"); |
|
179 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
180 | + $head[$h][2] = 'document'; |
|
181 | + $h++; |
|
182 | + |
|
183 | + $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id; |
|
184 | + $head[$h][1] = $langs->trans("Info"); |
|
185 | + $head[$h][2] = 'info'; |
|
186 | + $h++; |
|
187 | + } |
|
188 | + |
|
189 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove'); |
|
190 | + |
|
191 | + return $head; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -199,49 +199,49 @@ discard block |
||
199 | 199 | */ |
200 | 200 | function group_prepare_head($object) |
201 | 201 | { |
202 | - global $langs, $conf, $user; |
|
203 | - |
|
204 | - $canreadperms=true; |
|
205 | - if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
206 | - { |
|
207 | - $canreadperms=($user->admin || $user->rights->user->group_advance->readperms); |
|
208 | - } |
|
209 | - |
|
210 | - $h = 0; |
|
211 | - $head = array(); |
|
212 | - |
|
213 | - $head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id; |
|
214 | - $head[$h][1] = $langs->trans("GroupCard"); |
|
215 | - $head[$h][2] = 'group'; |
|
216 | - $h++; |
|
217 | - |
|
218 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
219 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
220 | - { |
|
221 | - $langs->load("ldap"); |
|
222 | - $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id; |
|
223 | - $head[$h][1] = $langs->trans("LDAPCard"); |
|
224 | - $head[$h][2] = 'ldap'; |
|
225 | - $h++; |
|
226 | - } |
|
227 | - |
|
228 | - if ($canreadperms) |
|
229 | - { |
|
230 | - $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id; |
|
231 | - $head[$h][1] = $langs->trans("GroupRights"). ' <span class="badge">'.($object->nb_rights).'</span>'; |
|
232 | - $head[$h][2] = 'rights'; |
|
233 | - $h++; |
|
234 | - } |
|
235 | - |
|
236 | - // Show more tabs from modules |
|
237 | - // Entries must be declared in modules descriptor with line |
|
238 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
239 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
240 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'group'); |
|
241 | - |
|
242 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove'); |
|
243 | - |
|
244 | - return $head; |
|
202 | + global $langs, $conf, $user; |
|
203 | + |
|
204 | + $canreadperms=true; |
|
205 | + if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
206 | + { |
|
207 | + $canreadperms=($user->admin || $user->rights->user->group_advance->readperms); |
|
208 | + } |
|
209 | + |
|
210 | + $h = 0; |
|
211 | + $head = array(); |
|
212 | + |
|
213 | + $head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id; |
|
214 | + $head[$h][1] = $langs->trans("GroupCard"); |
|
215 | + $head[$h][2] = 'group'; |
|
216 | + $h++; |
|
217 | + |
|
218 | + if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
219 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
220 | + { |
|
221 | + $langs->load("ldap"); |
|
222 | + $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id; |
|
223 | + $head[$h][1] = $langs->trans("LDAPCard"); |
|
224 | + $head[$h][2] = 'ldap'; |
|
225 | + $h++; |
|
226 | + } |
|
227 | + |
|
228 | + if ($canreadperms) |
|
229 | + { |
|
230 | + $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id; |
|
231 | + $head[$h][1] = $langs->trans("GroupRights"). ' <span class="badge">'.($object->nb_rights).'</span>'; |
|
232 | + $head[$h][2] = 'rights'; |
|
233 | + $h++; |
|
234 | + } |
|
235 | + |
|
236 | + // Show more tabs from modules |
|
237 | + // Entries must be declared in modules descriptor with line |
|
238 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
239 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
240 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'group'); |
|
241 | + |
|
242 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove'); |
|
243 | + |
|
244 | + return $head; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -251,40 +251,40 @@ discard block |
||
251 | 251 | */ |
252 | 252 | function user_admin_prepare_head() |
253 | 253 | { |
254 | - global $langs, $conf, $user; |
|
254 | + global $langs, $conf, $user; |
|
255 | 255 | |
256 | - $langs->load("users"); |
|
257 | - $h=0; |
|
256 | + $langs->load("users"); |
|
257 | + $h=0; |
|
258 | 258 | |
259 | - $head[$h][0] = DOL_URL_ROOT.'/admin/user.php'; |
|
260 | - $head[$h][1] = $langs->trans("Parameters"); |
|
261 | - $head[$h][2] = 'card'; |
|
262 | - $h++; |
|
259 | + $head[$h][0] = DOL_URL_ROOT.'/admin/user.php'; |
|
260 | + $head[$h][1] = $langs->trans("Parameters"); |
|
261 | + $head[$h][2] = 'card'; |
|
262 | + $h++; |
|
263 | 263 | |
264 | - $head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php'; |
|
265 | - $head[$h][1] = $langs->trans("Group"); |
|
266 | - $head[$h][2] = 'usergroupcard'; |
|
267 | - $h++; |
|
264 | + $head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php'; |
|
265 | + $head[$h][1] = $langs->trans("Group"); |
|
266 | + $head[$h][2] = 'usergroupcard'; |
|
267 | + $h++; |
|
268 | 268 | |
269 | - $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php'; |
|
270 | - $head[$h][1] = $langs->trans("ExtraFields"); |
|
271 | - $head[$h][2] = 'attributes'; |
|
272 | - $h++; |
|
269 | + $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php'; |
|
270 | + $head[$h][1] = $langs->trans("ExtraFields"); |
|
271 | + $head[$h][2] = 'attributes'; |
|
272 | + $h++; |
|
273 | 273 | |
274 | - $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php'; |
|
275 | - $head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups"); |
|
276 | - $head[$h][2] = 'attributes_group'; |
|
277 | - $h++; |
|
274 | + $head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php'; |
|
275 | + $head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups"); |
|
276 | + $head[$h][2] = 'attributes_group'; |
|
277 | + $h++; |
|
278 | 278 | |
279 | - // Show more tabs from modules |
|
280 | - // Entries must be declared in modules descriptor with line |
|
281 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
282 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
283 | - complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin'); |
|
279 | + // Show more tabs from modules |
|
280 | + // Entries must be declared in modules descriptor with line |
|
281 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
282 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
283 | + complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin'); |
|
284 | 284 | |
285 | - complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove'); |
|
285 | + complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove'); |
|
286 | 286 | |
287 | - return $head; |
|
287 | + return $head; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -297,138 +297,138 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function show_theme($fuser,$edit=0,$foruserprofile=false) |
299 | 299 | { |
300 | - global $conf,$langs,$db,$form; |
|
301 | - global $bc; |
|
302 | - |
|
303 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
304 | - |
|
305 | - $formother = new FormOther($db); |
|
306 | - |
|
307 | - $dirthemes=array('/theme'); |
|
308 | - if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application |
|
309 | - { |
|
310 | - foreach($conf->modules_parts['theme'] as $reldir) |
|
311 | - { |
|
312 | - $dirthemes=array_merge($dirthemes,(array) ($reldir.'theme')); |
|
313 | - } |
|
314 | - } |
|
315 | - $dirthemes=array_unique($dirthemes); |
|
316 | - // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme') |
|
317 | - |
|
318 | - $selected_theme=''; |
|
319 | - if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME; |
|
320 | - else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); |
|
321 | - |
|
322 | - $hoverdisabled=''; |
|
323 | - if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); |
|
324 | - else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):''); |
|
325 | - |
|
326 | - $checkeddisabled=''; |
|
327 | - if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0'); |
|
328 | - else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):''); |
|
329 | - |
|
330 | - $colspan=2; |
|
331 | - if ($foruserprofile) $colspan=4; |
|
332 | - |
|
333 | - $thumbsbyrow=6; |
|
334 | - print '<table class="noborder" width="100%">'; |
|
335 | - |
|
336 | - // Title |
|
337 | - if ($foruserprofile) |
|
338 | - { |
|
339 | - print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>'; |
|
340 | - print '<th colspan="2"> </th>'; |
|
341 | - print '</tr>'; |
|
342 | - |
|
343 | - print '<tr>'; |
|
344 | - print '<td>'.$langs->trans("DefaultSkin").'</td>'; |
|
345 | - print '<td>'.$conf->global->MAIN_THEME.'</td>'; |
|
346 | - print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; |
|
347 | - print '<td> </td>'; |
|
348 | - print '</tr>'; |
|
349 | - } |
|
350 | - else |
|
351 | - { |
|
352 | - print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>'; |
|
353 | - print '<th align="right">'; |
|
354 | - $url='https://www.dolistore.com/lang-en/4-skins'; |
|
355 | - if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes'; |
|
356 | - //if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes'; |
|
357 | - print '<a href="'.$url.'" target="_blank">'; |
|
358 | - print $langs->trans('DownloadMoreSkins'); |
|
359 | - print '</a>'; |
|
360 | - print '</th></tr>'; |
|
361 | - |
|
362 | - print '<tr>'; |
|
363 | - print '<td>'.$langs->trans("ThemeDir").'</td>'; |
|
364 | - print '<td>'; |
|
365 | - foreach($dirthemes as $dirtheme) |
|
366 | - { |
|
367 | - echo '"'.$dirtheme.'" '; |
|
368 | - } |
|
369 | - print '</td>'; |
|
370 | - print '</tr>'; |
|
371 | - } |
|
372 | - |
|
373 | - print '<tr><td colspan="'.$colspan.'">'; |
|
374 | - |
|
375 | - print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">'; |
|
376 | - |
|
377 | - $i=0; |
|
378 | - foreach($dirthemes as $dir) |
|
379 | - { |
|
380 | - //print $dirroot.$dir;exit; |
|
381 | - $dirtheme=dol_buildpath($dir,0); // This include loop on $conf->file->dol_document_root |
|
382 | - $urltheme=dol_buildpath($dir,1); |
|
383 | - |
|
384 | - if (is_dir($dirtheme)) |
|
385 | - { |
|
386 | - $handle=opendir($dirtheme); |
|
387 | - if (is_resource($handle)) |
|
388 | - { |
|
389 | - while (($subdir = readdir($handle))!==false) |
|
390 | - { |
|
391 | - if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.' |
|
392 | - && substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir)) |
|
393 | - { |
|
394 | - // Disable not stable themes (dir ends with _exp or _dev) |
|
395 | - if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue; |
|
396 | - if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue; |
|
397 | - |
|
398 | - print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">'; |
|
399 | - $file=$dirtheme."/".$subdir."/thumb.png"; |
|
400 | - $url=$urltheme."/".$subdir."/thumb.png"; |
|
401 | - if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png'; |
|
402 | - print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">'; |
|
403 | - if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); |
|
404 | - else $title=$langs->trans("ShowPreview"); |
|
405 | - print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">'; |
|
406 | - print '</a><br>'; |
|
407 | - if ($subdir == $selected_theme) |
|
408 | - { |
|
409 | - print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>'; |
|
410 | - } |
|
411 | - else |
|
412 | - { |
|
413 | - print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir; |
|
414 | - } |
|
415 | - print '</div>'; |
|
416 | - |
|
417 | - $i++; |
|
418 | - } |
|
419 | - } |
|
420 | - } |
|
421 | - } |
|
422 | - } |
|
423 | - |
|
424 | - print '</div></td></tr></table>'; |
|
425 | - |
|
426 | - print '</td></tr>'; |
|
427 | - |
|
428 | - // TopMenuDisableImages |
|
429 | - if ($foruserprofile) |
|
430 | - { |
|
431 | - /* |
|
300 | + global $conf,$langs,$db,$form; |
|
301 | + global $bc; |
|
302 | + |
|
303 | + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
304 | + |
|
305 | + $formother = new FormOther($db); |
|
306 | + |
|
307 | + $dirthemes=array('/theme'); |
|
308 | + if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application |
|
309 | + { |
|
310 | + foreach($conf->modules_parts['theme'] as $reldir) |
|
311 | + { |
|
312 | + $dirthemes=array_merge($dirthemes,(array) ($reldir.'theme')); |
|
313 | + } |
|
314 | + } |
|
315 | + $dirthemes=array_unique($dirthemes); |
|
316 | + // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme') |
|
317 | + |
|
318 | + $selected_theme=''; |
|
319 | + if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME; |
|
320 | + else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); |
|
321 | + |
|
322 | + $hoverdisabled=''; |
|
323 | + if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); |
|
324 | + else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):''); |
|
325 | + |
|
326 | + $checkeddisabled=''; |
|
327 | + if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0'); |
|
328 | + else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):''); |
|
329 | + |
|
330 | + $colspan=2; |
|
331 | + if ($foruserprofile) $colspan=4; |
|
332 | + |
|
333 | + $thumbsbyrow=6; |
|
334 | + print '<table class="noborder" width="100%">'; |
|
335 | + |
|
336 | + // Title |
|
337 | + if ($foruserprofile) |
|
338 | + { |
|
339 | + print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>'; |
|
340 | + print '<th colspan="2"> </th>'; |
|
341 | + print '</tr>'; |
|
342 | + |
|
343 | + print '<tr>'; |
|
344 | + print '<td>'.$langs->trans("DefaultSkin").'</td>'; |
|
345 | + print '<td>'.$conf->global->MAIN_THEME.'</td>'; |
|
346 | + print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; |
|
347 | + print '<td> </td>'; |
|
348 | + print '</tr>'; |
|
349 | + } |
|
350 | + else |
|
351 | + { |
|
352 | + print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>'; |
|
353 | + print '<th align="right">'; |
|
354 | + $url='https://www.dolistore.com/lang-en/4-skins'; |
|
355 | + if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes'; |
|
356 | + //if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes'; |
|
357 | + print '<a href="'.$url.'" target="_blank">'; |
|
358 | + print $langs->trans('DownloadMoreSkins'); |
|
359 | + print '</a>'; |
|
360 | + print '</th></tr>'; |
|
361 | + |
|
362 | + print '<tr>'; |
|
363 | + print '<td>'.$langs->trans("ThemeDir").'</td>'; |
|
364 | + print '<td>'; |
|
365 | + foreach($dirthemes as $dirtheme) |
|
366 | + { |
|
367 | + echo '"'.$dirtheme.'" '; |
|
368 | + } |
|
369 | + print '</td>'; |
|
370 | + print '</tr>'; |
|
371 | + } |
|
372 | + |
|
373 | + print '<tr><td colspan="'.$colspan.'">'; |
|
374 | + |
|
375 | + print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">'; |
|
376 | + |
|
377 | + $i=0; |
|
378 | + foreach($dirthemes as $dir) |
|
379 | + { |
|
380 | + //print $dirroot.$dir;exit; |
|
381 | + $dirtheme=dol_buildpath($dir,0); // This include loop on $conf->file->dol_document_root |
|
382 | + $urltheme=dol_buildpath($dir,1); |
|
383 | + |
|
384 | + if (is_dir($dirtheme)) |
|
385 | + { |
|
386 | + $handle=opendir($dirtheme); |
|
387 | + if (is_resource($handle)) |
|
388 | + { |
|
389 | + while (($subdir = readdir($handle))!==false) |
|
390 | + { |
|
391 | + if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.' |
|
392 | + && substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir)) |
|
393 | + { |
|
394 | + // Disable not stable themes (dir ends with _exp or _dev) |
|
395 | + if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue; |
|
396 | + if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue; |
|
397 | + |
|
398 | + print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">'; |
|
399 | + $file=$dirtheme."/".$subdir."/thumb.png"; |
|
400 | + $url=$urltheme."/".$subdir."/thumb.png"; |
|
401 | + if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png'; |
|
402 | + print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">'; |
|
403 | + if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); |
|
404 | + else $title=$langs->trans("ShowPreview"); |
|
405 | + print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">'; |
|
406 | + print '</a><br>'; |
|
407 | + if ($subdir == $selected_theme) |
|
408 | + { |
|
409 | + print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>'; |
|
410 | + } |
|
411 | + else |
|
412 | + { |
|
413 | + print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir; |
|
414 | + } |
|
415 | + print '</div>'; |
|
416 | + |
|
417 | + $i++; |
|
418 | + } |
|
419 | + } |
|
420 | + } |
|
421 | + } |
|
422 | + } |
|
423 | + |
|
424 | + print '</div></td></tr></table>'; |
|
425 | + |
|
426 | + print '</td></tr>'; |
|
427 | + |
|
428 | + // TopMenuDisableImages |
|
429 | + if ($foruserprofile) |
|
430 | + { |
|
431 | + /* |
|
432 | 432 | print '<tr class="oddeven">'; |
433 | 433 | print '<td>'.$langs->trans("TopMenuDisableImages").'</td>'; |
434 | 434 | print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>'; |
@@ -448,31 +448,31 @@ discard block |
||
448 | 448 | } |
449 | 449 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
450 | 450 | print '</td>';*/ |
451 | - } |
|
452 | - else |
|
453 | - { |
|
454 | - $default=$langs->trans('No'); |
|
455 | - print '<tr class="oddeven">'; |
|
456 | - print '<td>'.$langs->trans("TopMenuDisableImages").'</td>'; |
|
457 | - print '<td colspan="'.($colspan-1).'">'; |
|
458 | - if ($edit) |
|
459 | - { |
|
460 | - print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); |
|
461 | - } |
|
462 | - else |
|
463 | - { |
|
464 | - print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); |
|
465 | - } |
|
466 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
467 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
468 | - print '</span>'; |
|
469 | - print '</td>'; |
|
470 | - } |
|
471 | - |
|
472 | - // Background color THEME_ELDY_BACKBODY |
|
473 | - if ($foruserprofile) |
|
474 | - { |
|
475 | - /* |
|
451 | + } |
|
452 | + else |
|
453 | + { |
|
454 | + $default=$langs->trans('No'); |
|
455 | + print '<tr class="oddeven">'; |
|
456 | + print '<td>'.$langs->trans("TopMenuDisableImages").'</td>'; |
|
457 | + print '<td colspan="'.($colspan-1).'">'; |
|
458 | + if ($edit) |
|
459 | + { |
|
460 | + print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); |
|
461 | + } |
|
462 | + else |
|
463 | + { |
|
464 | + print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); |
|
465 | + } |
|
466 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
467 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
468 | + print '</span>'; |
|
469 | + print '</td>'; |
|
470 | + } |
|
471 | + |
|
472 | + // Background color THEME_ELDY_BACKBODY |
|
473 | + if ($foruserprofile) |
|
474 | + { |
|
475 | + /* |
|
476 | 476 | print '<tr class="oddeven">'; |
477 | 477 | print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
478 | 478 | print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>'; |
@@ -492,33 +492,33 @@ discard block |
||
492 | 492 | } |
493 | 493 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
494 | 494 | print '</td>';*/ |
495 | - } |
|
496 | - else |
|
497 | - { |
|
498 | - print '<tr class="oddeven">'; |
|
499 | - print '<td>'.$langs->trans("BackgroundColor").'</td>'; |
|
500 | - print '<td colspan="'.($colspan-1).'">'; |
|
501 | - //var_dump($conf->global->THEME_ELDY_BACKBODY); |
|
502 | - if ($edit) |
|
503 | - { |
|
504 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' '; |
|
505 | - } |
|
506 | - else |
|
507 | - { |
|
508 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''); |
|
509 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
510 | - else print $langs->trans("Default"); |
|
511 | - } |
|
512 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>ffffff</strong>) '; |
|
513 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
514 | - print '</span>'; |
|
515 | - print '</td>'; |
|
516 | - } |
|
517 | - |
|
518 | - // TopMenuBackgroundColor |
|
519 | - if ($foruserprofile) |
|
520 | - { |
|
521 | - /* |
|
495 | + } |
|
496 | + else |
|
497 | + { |
|
498 | + print '<tr class="oddeven">'; |
|
499 | + print '<td>'.$langs->trans("BackgroundColor").'</td>'; |
|
500 | + print '<td colspan="'.($colspan-1).'">'; |
|
501 | + //var_dump($conf->global->THEME_ELDY_BACKBODY); |
|
502 | + if ($edit) |
|
503 | + { |
|
504 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' '; |
|
505 | + } |
|
506 | + else |
|
507 | + { |
|
508 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''); |
|
509 | + if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
510 | + else print $langs->trans("Default"); |
|
511 | + } |
|
512 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>ffffff</strong>) '; |
|
513 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
514 | + print '</span>'; |
|
515 | + print '</td>'; |
|
516 | + } |
|
517 | + |
|
518 | + // TopMenuBackgroundColor |
|
519 | + if ($foruserprofile) |
|
520 | + { |
|
521 | + /* |
|
522 | 522 | print '<tr class="oddeven">'; |
523 | 523 | print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
524 | 524 | print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>'; |
@@ -538,35 +538,35 @@ discard block |
||
538 | 538 | } |
539 | 539 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
540 | 540 | print '</td>';*/ |
541 | - } |
|
542 | - else |
|
543 | - { |
|
544 | - $default='5a6482'; |
|
545 | - if ($conf->theme == 'md') $default='5a3278'; |
|
546 | - |
|
547 | - print '<tr class="oddeven">'; |
|
548 | - print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
|
549 | - print '<td colspan="'.($colspan-1).'">'; |
|
550 | - if ($edit) |
|
551 | - { |
|
552 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; |
|
553 | - } |
|
554 | - else |
|
555 | - { |
|
556 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); |
|
557 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
558 | - else print $langs->trans("Default"); |
|
559 | - } |
|
560 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
561 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
562 | - print '</span>'; |
|
563 | - print '</td>'; |
|
564 | - } |
|
565 | - |
|
566 | - // LeftMenuBackgroundColor |
|
567 | - if ($foruserprofile) |
|
568 | - { |
|
569 | - /* |
|
541 | + } |
|
542 | + else |
|
543 | + { |
|
544 | + $default='5a6482'; |
|
545 | + if ($conf->theme == 'md') $default='5a3278'; |
|
546 | + |
|
547 | + print '<tr class="oddeven">'; |
|
548 | + print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
|
549 | + print '<td colspan="'.($colspan-1).'">'; |
|
550 | + if ($edit) |
|
551 | + { |
|
552 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; |
|
553 | + } |
|
554 | + else |
|
555 | + { |
|
556 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); |
|
557 | + if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
558 | + else print $langs->trans("Default"); |
|
559 | + } |
|
560 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
561 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
562 | + print '</span>'; |
|
563 | + print '</td>'; |
|
564 | + } |
|
565 | + |
|
566 | + // LeftMenuBackgroundColor |
|
567 | + if ($foruserprofile) |
|
568 | + { |
|
569 | + /* |
|
570 | 570 | print '<tr class="oddeven">'; |
571 | 571 | print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
572 | 572 | print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_VERMENU_BACK1:$langs->trans("Default")).'</td>'; |
@@ -586,174 +586,174 @@ discard block |
||
586 | 586 | } |
587 | 587 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
588 | 588 | print '</td>';*/ |
589 | - } |
|
590 | - else |
|
591 | - { |
|
592 | - $default='f0f0f0'; |
|
593 | - if ($conf->theme == 'md') $default='ffffff'; |
|
594 | - |
|
595 | - print '<tr class="oddeven">'; |
|
596 | - print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>'; |
|
597 | - print '<td colspan="'.($colspan-1).'">'; |
|
598 | - if ($edit) |
|
599 | - { |
|
600 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' '; |
|
601 | - } |
|
602 | - else |
|
603 | - { |
|
604 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''); |
|
605 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
606 | - else print $langs->trans("Default"); |
|
607 | - } |
|
608 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
609 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
610 | - print '</span>'; |
|
611 | - print '</td>'; |
|
612 | - } |
|
613 | - |
|
614 | - // TextTitleColor for title of Pages |
|
615 | - if ($foruserprofile) |
|
616 | - { |
|
617 | - |
|
618 | - |
|
619 | - } |
|
620 | - else |
|
621 | - { |
|
622 | - print '<tr class="oddeven">'; |
|
623 | - print '<td>'.$langs->trans("TextTitleColor").'</td>'; |
|
624 | - print '<td colspan="'.($colspan-1).'">'; |
|
625 | - if ($edit) |
|
626 | - { |
|
627 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' '; |
|
628 | - } |
|
629 | - else |
|
630 | - { |
|
631 | - print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); |
|
632 | - } |
|
633 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #643c14">643c14</span></strong>) '; |
|
634 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
635 | - print '</span>'; |
|
636 | - print '</td>'; |
|
637 | - |
|
638 | - print '</tr>'; |
|
639 | - } |
|
640 | - |
|
641 | - // BackgroundTableTitleColor |
|
642 | - if ($foruserprofile) |
|
643 | - { |
|
644 | - |
|
645 | - |
|
646 | - } |
|
647 | - else |
|
648 | - { |
|
649 | - print '<tr class="oddeven">'; |
|
650 | - print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>'; |
|
651 | - print '<td colspan="'.($colspan-1).'">'; |
|
652 | - if ($edit) |
|
653 | - { |
|
654 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' '; |
|
655 | - } |
|
656 | - else |
|
657 | - { |
|
658 | - print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); |
|
659 | - } |
|
660 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS |
|
661 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
662 | - print '</span>'; |
|
663 | - print '</td>'; |
|
664 | - |
|
665 | - print '</tr>'; |
|
666 | - } |
|
667 | - |
|
668 | - // TextTitleColor |
|
669 | - if ($foruserprofile) |
|
670 | - { |
|
671 | - |
|
672 | - |
|
673 | - } |
|
674 | - else |
|
675 | - { |
|
676 | - print '<tr class="oddeven">'; |
|
677 | - print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>'; |
|
678 | - print '<td colspan="'.($colspan-1).'">'; |
|
679 | - if ($edit) |
|
680 | - { |
|
681 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' '; |
|
682 | - } |
|
683 | - else |
|
684 | - { |
|
685 | - print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); |
|
686 | - } |
|
687 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000000">000000</span></strong>) '; |
|
688 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
689 | - print '</span>'; |
|
690 | - print '</td>'; |
|
691 | - |
|
692 | - print '</tr>'; |
|
693 | - } |
|
694 | - |
|
695 | - // BackgroundTableLineOddColor |
|
696 | - if ($foruserprofile) |
|
697 | - { |
|
698 | - |
|
699 | - } |
|
700 | - else |
|
701 | - { |
|
702 | - $default='ffffff'; |
|
703 | - if ($conf->theme == 'md') $default='ffffff'; |
|
704 | - |
|
705 | - print '<tr class="oddeven">'; |
|
706 | - print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>'; |
|
707 | - print '<td colspan="'.($colspan-1).'">'; |
|
708 | - if ($edit) |
|
709 | - { |
|
710 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' '; |
|
711 | - } |
|
712 | - else |
|
713 | - { |
|
714 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''); |
|
715 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
716 | - else print $langs->trans("Default"); |
|
717 | - } |
|
718 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
719 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
720 | - print '</span>'; |
|
721 | - print '</td>'; |
|
722 | - } |
|
723 | - |
|
724 | - // BackgroundTableLineEvenColor |
|
725 | - if ($foruserprofile) |
|
726 | - { |
|
727 | - |
|
728 | - } |
|
729 | - else |
|
730 | - { |
|
731 | - $default='f8f8f8'; |
|
732 | - if ($conf->theme == 'md') $default='f8f8f8'; |
|
733 | - |
|
734 | - print '<tr class="oddeven">'; |
|
735 | - print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>'; |
|
736 | - print '<td colspan="'.($colspan-1).'">'; |
|
737 | - if ($edit) |
|
738 | - { |
|
739 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' '; |
|
740 | - } |
|
741 | - else |
|
742 | - { |
|
743 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''); |
|
744 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
745 | - else print $langs->trans("Default"); |
|
746 | - } |
|
747 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
748 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
749 | - print '</span>'; |
|
750 | - print '</td>'; |
|
751 | - } |
|
752 | - |
|
753 | - // Text LinkColor |
|
754 | - if ($foruserprofile) |
|
755 | - { |
|
756 | - /* |
|
589 | + } |
|
590 | + else |
|
591 | + { |
|
592 | + $default='f0f0f0'; |
|
593 | + if ($conf->theme == 'md') $default='ffffff'; |
|
594 | + |
|
595 | + print '<tr class="oddeven">'; |
|
596 | + print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>'; |
|
597 | + print '<td colspan="'.($colspan-1).'">'; |
|
598 | + if ($edit) |
|
599 | + { |
|
600 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' '; |
|
601 | + } |
|
602 | + else |
|
603 | + { |
|
604 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''); |
|
605 | + if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
606 | + else print $langs->trans("Default"); |
|
607 | + } |
|
608 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
609 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
610 | + print '</span>'; |
|
611 | + print '</td>'; |
|
612 | + } |
|
613 | + |
|
614 | + // TextTitleColor for title of Pages |
|
615 | + if ($foruserprofile) |
|
616 | + { |
|
617 | + |
|
618 | + |
|
619 | + } |
|
620 | + else |
|
621 | + { |
|
622 | + print '<tr class="oddeven">'; |
|
623 | + print '<td>'.$langs->trans("TextTitleColor").'</td>'; |
|
624 | + print '<td colspan="'.($colspan-1).'">'; |
|
625 | + if ($edit) |
|
626 | + { |
|
627 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' '; |
|
628 | + } |
|
629 | + else |
|
630 | + { |
|
631 | + print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); |
|
632 | + } |
|
633 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #643c14">643c14</span></strong>) '; |
|
634 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
635 | + print '</span>'; |
|
636 | + print '</td>'; |
|
637 | + |
|
638 | + print '</tr>'; |
|
639 | + } |
|
640 | + |
|
641 | + // BackgroundTableTitleColor |
|
642 | + if ($foruserprofile) |
|
643 | + { |
|
644 | + |
|
645 | + |
|
646 | + } |
|
647 | + else |
|
648 | + { |
|
649 | + print '<tr class="oddeven">'; |
|
650 | + print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>'; |
|
651 | + print '<td colspan="'.($colspan-1).'">'; |
|
652 | + if ($edit) |
|
653 | + { |
|
654 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' '; |
|
655 | + } |
|
656 | + else |
|
657 | + { |
|
658 | + print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); |
|
659 | + } |
|
660 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS |
|
661 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
662 | + print '</span>'; |
|
663 | + print '</td>'; |
|
664 | + |
|
665 | + print '</tr>'; |
|
666 | + } |
|
667 | + |
|
668 | + // TextTitleColor |
|
669 | + if ($foruserprofile) |
|
670 | + { |
|
671 | + |
|
672 | + |
|
673 | + } |
|
674 | + else |
|
675 | + { |
|
676 | + print '<tr class="oddeven">'; |
|
677 | + print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>'; |
|
678 | + print '<td colspan="'.($colspan-1).'">'; |
|
679 | + if ($edit) |
|
680 | + { |
|
681 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' '; |
|
682 | + } |
|
683 | + else |
|
684 | + { |
|
685 | + print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); |
|
686 | + } |
|
687 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000000">000000</span></strong>) '; |
|
688 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
689 | + print '</span>'; |
|
690 | + print '</td>'; |
|
691 | + |
|
692 | + print '</tr>'; |
|
693 | + } |
|
694 | + |
|
695 | + // BackgroundTableLineOddColor |
|
696 | + if ($foruserprofile) |
|
697 | + { |
|
698 | + |
|
699 | + } |
|
700 | + else |
|
701 | + { |
|
702 | + $default='ffffff'; |
|
703 | + if ($conf->theme == 'md') $default='ffffff'; |
|
704 | + |
|
705 | + print '<tr class="oddeven">'; |
|
706 | + print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>'; |
|
707 | + print '<td colspan="'.($colspan-1).'">'; |
|
708 | + if ($edit) |
|
709 | + { |
|
710 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' '; |
|
711 | + } |
|
712 | + else |
|
713 | + { |
|
714 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''); |
|
715 | + if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
716 | + else print $langs->trans("Default"); |
|
717 | + } |
|
718 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
719 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
720 | + print '</span>'; |
|
721 | + print '</td>'; |
|
722 | + } |
|
723 | + |
|
724 | + // BackgroundTableLineEvenColor |
|
725 | + if ($foruserprofile) |
|
726 | + { |
|
727 | + |
|
728 | + } |
|
729 | + else |
|
730 | + { |
|
731 | + $default='f8f8f8'; |
|
732 | + if ($conf->theme == 'md') $default='f8f8f8'; |
|
733 | + |
|
734 | + print '<tr class="oddeven">'; |
|
735 | + print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>'; |
|
736 | + print '<td colspan="'.($colspan-1).'">'; |
|
737 | + if ($edit) |
|
738 | + { |
|
739 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' '; |
|
740 | + } |
|
741 | + else |
|
742 | + { |
|
743 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''); |
|
744 | + if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
745 | + else print $langs->trans("Default"); |
|
746 | + } |
|
747 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
|
748 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
749 | + print '</span>'; |
|
750 | + print '</td>'; |
|
751 | + } |
|
752 | + |
|
753 | + // Text LinkColor |
|
754 | + if ($foruserprofile) |
|
755 | + { |
|
756 | + /* |
|
757 | 757 | print '<tr class="oddeven">'; |
758 | 758 | print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
759 | 759 | print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>'; |
@@ -773,37 +773,37 @@ discard block |
||
773 | 773 | } |
774 | 774 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
775 | 775 | print '</td>';*/ |
776 | - } |
|
777 | - else |
|
778 | - { |
|
779 | - print '<tr class="oddeven">'; |
|
780 | - print '<td>'.$langs->trans("LinkColor").'</td>'; |
|
781 | - print '<td colspan="'.($colspan-1).'">'; |
|
782 | - if ($edit) |
|
783 | - { |
|
784 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; |
|
785 | - } |
|
786 | - else |
|
787 | - { |
|
788 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); |
|
789 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
790 | - else |
|
791 | - { |
|
792 | - //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">'; |
|
793 | - //print '<span style="color: #000078">'.$langs->trans("Default").'</span>'; |
|
794 | - print $langs->trans("Default"); |
|
795 | - } |
|
796 | - } |
|
797 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) '; |
|
798 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
799 | - print '</span>'; |
|
800 | - print '</td>'; |
|
801 | - } |
|
802 | - |
|
803 | - // Use Hover |
|
804 | - if ($foruserprofile) |
|
805 | - { |
|
806 | - /* Must first change option to choose color of highlight instead of yes or no. |
|
776 | + } |
|
777 | + else |
|
778 | + { |
|
779 | + print '<tr class="oddeven">'; |
|
780 | + print '<td>'.$langs->trans("LinkColor").'</td>'; |
|
781 | + print '<td colspan="'.($colspan-1).'">'; |
|
782 | + if ($edit) |
|
783 | + { |
|
784 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; |
|
785 | + } |
|
786 | + else |
|
787 | + { |
|
788 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); |
|
789 | + if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
790 | + else |
|
791 | + { |
|
792 | + //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">'; |
|
793 | + //print '<span style="color: #000078">'.$langs->trans("Default").'</span>'; |
|
794 | + print $langs->trans("Default"); |
|
795 | + } |
|
796 | + } |
|
797 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) '; |
|
798 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
799 | + print '</span>'; |
|
800 | + print '</td>'; |
|
801 | + } |
|
802 | + |
|
803 | + // Use Hover |
|
804 | + if ($foruserprofile) |
|
805 | + { |
|
806 | + /* Must first change option to choose color of highlight instead of yes or no. |
|
807 | 807 | print '<tr class="oddeven">'; |
808 | 808 | print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>'; |
809 | 809 | print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>'; |
@@ -813,40 +813,40 @@ discard block |
||
813 | 813 | print '</td>'; |
814 | 814 | print '</tr>'; |
815 | 815 | */ |
816 | - } |
|
817 | - else { |
|
818 | - print '<tr class="oddeven">'; |
|
819 | - print '<td>'.$langs->trans("HighlightLinesColor").'</td>'; |
|
820 | - print '<td colspan="'.($colspan-1).'">'; |
|
821 | - //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
|
822 | - //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
|
823 | - if ($edit) |
|
824 | - { |
|
825 | - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
826 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
827 | - print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' '; |
|
828 | - } |
|
829 | - else |
|
830 | - { |
|
831 | - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
832 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
833 | - if ($color) |
|
834 | - { |
|
835 | - if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
836 | - else print $langs->trans("Default"); |
|
837 | - } |
|
838 | - else print $langs->trans("None"); |
|
839 | - } |
|
840 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; |
|
841 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
842 | - print '</span>'; |
|
843 | - print '</td>'; |
|
844 | - } |
|
845 | - |
|
846 | - // Use Checked |
|
847 | - if ($foruserprofile) |
|
848 | - { |
|
849 | - /* Must first change option to choose color of highlight instead of yes or no. |
|
816 | + } |
|
817 | + else { |
|
818 | + print '<tr class="oddeven">'; |
|
819 | + print '<td>'.$langs->trans("HighlightLinesColor").'</td>'; |
|
820 | + print '<td colspan="'.($colspan-1).'">'; |
|
821 | + //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
|
822 | + //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
|
823 | + if ($edit) |
|
824 | + { |
|
825 | + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
826 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
827 | + print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' '; |
|
828 | + } |
|
829 | + else |
|
830 | + { |
|
831 | + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
832 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
833 | + if ($color) |
|
834 | + { |
|
835 | + if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
836 | + else print $langs->trans("Default"); |
|
837 | + } |
|
838 | + else print $langs->trans("None"); |
|
839 | + } |
|
840 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; |
|
841 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
842 | + print '</span>'; |
|
843 | + print '</td>'; |
|
844 | + } |
|
845 | + |
|
846 | + // Use Checked |
|
847 | + if ($foruserprofile) |
|
848 | + { |
|
849 | + /* Must first change option to choose color of highlight instead of yes or no. |
|
850 | 850 | print '<tr class="oddeven">'; |
851 | 851 | print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>'; |
852 | 852 | print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>'; |
@@ -856,37 +856,37 @@ discard block |
||
856 | 856 | print '</td>'; |
857 | 857 | print '</tr>'; |
858 | 858 | */ |
859 | - } |
|
860 | - else |
|
861 | - { |
|
862 | - print '<tr class="oddeven">'; |
|
863 | - print '<td>'.$langs->trans("HighlightLinesChecked").'</td>'; |
|
864 | - print '<td colspan="'.($colspan-1).'">'; |
|
865 | - //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
|
866 | - //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
|
867 | - if ($edit) |
|
868 | - { |
|
869 | - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
870 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
871 | - print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' '; |
|
872 | - } |
|
873 | - else |
|
874 | - { |
|
875 | - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
876 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
877 | - if ($color) |
|
878 | - { |
|
879 | - if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
880 | - else print $langs->trans("Default"); |
|
881 | - } |
|
882 | - else print $langs->trans("None"); |
|
883 | - } |
|
884 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; |
|
885 | - print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
886 | - print '</span>'; |
|
887 | - print '</td>'; |
|
888 | - print '</tr>'; |
|
889 | - } |
|
890 | - |
|
891 | - print '</table>'; |
|
859 | + } |
|
860 | + else |
|
861 | + { |
|
862 | + print '<tr class="oddeven">'; |
|
863 | + print '<td>'.$langs->trans("HighlightLinesChecked").'</td>'; |
|
864 | + print '<td colspan="'.($colspan-1).'">'; |
|
865 | + //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
|
866 | + //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
|
867 | + if ($edit) |
|
868 | + { |
|
869 | + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
870 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
871 | + print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' '; |
|
872 | + } |
|
873 | + else |
|
874 | + { |
|
875 | + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
876 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
877 | + if ($color) |
|
878 | + { |
|
879 | + if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
880 | + else print $langs->trans("Default"); |
|
881 | + } |
|
882 | + else print $langs->trans("None"); |
|
883 | + } |
|
884 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; |
|
885 | + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
|
886 | + print '</span>'; |
|
887 | + print '</td>'; |
|
888 | + print '</tr>'; |
|
889 | + } |
|
890 | + |
|
891 | + print '</table>'; |
|
892 | 892 | } |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | $langs->load("users"); |
39 | 39 | |
40 | - $canreadperms=true; |
|
41 | - if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
40 | + $canreadperms = true; |
|
41 | + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
42 | 42 | { |
43 | - $canreadperms=($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms)); |
|
43 | + $canreadperms = ($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $h = 0; |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | $head[$h][2] = 'user'; |
52 | 52 | $h++; |
53 | 53 | |
54 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
55 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
54 | + if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
55 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) |
|
56 | 56 | { |
57 | 57 | $langs->load("ldap"); |
58 | 58 | $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if ($canreadperms) |
65 | 65 | { |
66 | 66 | $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id; |
67 | - $head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>'; |
|
67 | + $head[$h][1] = $langs->trans("Rights").' <span class="badge">'.($object->nb_rights).'</span>'; |
|
68 | 68 | $head[$h][2] = 'rights'; |
69 | 69 | $h++; |
70 | 70 | } |
@@ -74,23 +74,23 @@ discard block |
||
74 | 74 | $head[$h][2] = 'guisetup'; |
75 | 75 | $h++; |
76 | 76 | |
77 | - if (! empty($conf->agenda->enabled)) |
|
77 | + if (!empty($conf->agenda->enabled)) |
|
78 | 78 | { |
79 | - if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; |
|
80 | - $MAXAGENDA=$conf->global->AGENDA_EXT_NB; |
|
79 | + if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5; |
|
80 | + $MAXAGENDA = $conf->global->AGENDA_EXT_NB; |
|
81 | 81 | |
82 | - $i=1; |
|
82 | + $i = 1; |
|
83 | 83 | $nbagenda = 0; |
84 | 84 | while ($i <= $MAXAGENDA) |
85 | 85 | { |
86 | - $key=$i; |
|
87 | - $name='AGENDA_EXT_NAME_'.$object->id.'_'.$key; |
|
88 | - $src='AGENDA_EXT_SRC_'.$object->id.'_'.$key; |
|
89 | - $offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key; |
|
90 | - $color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key; |
|
86 | + $key = $i; |
|
87 | + $name = 'AGENDA_EXT_NAME_'.$object->id.'_'.$key; |
|
88 | + $src = 'AGENDA_EXT_SRC_'.$object->id.'_'.$key; |
|
89 | + $offsettz = 'AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key; |
|
90 | + $color = 'AGENDA_EXT_COLOR_'.$object->id.'_'.$key; |
|
91 | 91 | $i++; |
92 | 92 | |
93 | - if (! empty($object->conf->$name)) $nbagenda++; |
|
93 | + if (!empty($object->conf->$name)) $nbagenda++; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $h++; |
100 | 100 | } |
101 | 101 | |
102 | - if (! empty($conf->clicktodial->enabled)) |
|
102 | + if (!empty($conf->clicktodial->enabled)) |
|
103 | 103 | { |
104 | 104 | $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id; |
105 | 105 | $head[$h][1] = $langs->trans("ClickToDial"); |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | // Notifications |
111 | - if ($user->societe_id == 0 && ! empty($conf->notification->enabled)) |
|
111 | + if ($user->societe_id == 0 && !empty($conf->notification->enabled)) |
|
112 | 112 | { |
113 | 113 | $nbNote = 0; |
114 | 114 | $sql = "SELECT COUNT(n.rowid) as nb"; |
115 | - $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; |
|
116 | - $sql.= " WHERE fk_user = ".$object->id; |
|
117 | - $resql=$db->query($sql); |
|
115 | + $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n"; |
|
116 | + $sql .= " WHERE fk_user = ".$object->id; |
|
117 | + $resql = $db->query($sql); |
|
118 | 118 | if ($resql) |
119 | 119 | { |
120 | 120 | $num = $db->num_rows($resql); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | while ($i < $num) |
123 | 123 | { |
124 | 124 | $obj = $db->fetch_object($resql); |
125 | - $nbNote=$obj->nb; |
|
125 | + $nbNote = $obj->nb; |
|
126 | 126 | $i++; |
127 | 127 | } |
128 | 128 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id; |
134 | 134 | $head[$h][1] = $langs->trans("Notifications"); |
135 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
135 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
136 | 136 | $head[$h][2] = 'notify'; |
137 | 137 | $h++; |
138 | 138 | } |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | // Entries must be declared in modules descriptor with line |
142 | 142 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
143 | 143 | // $this->tabs = array('entity:-tabname); to remove a tab |
144 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); |
|
144 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'user'); |
|
145 | 145 | |
146 | - if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) |
|
147 | - || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)) |
|
148 | - || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id) |
|
149 | - || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id ) |
|
146 | + if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) |
|
147 | + || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)) |
|
148 | + || (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && $user->id == $object->id) |
|
149 | + || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && $user->id == $object->id) |
|
150 | 150 | ) |
151 | 151 | { |
152 | 152 | // Bank |
@@ -161,22 +161,22 @@ discard block |
||
161 | 161 | { |
162 | 162 | // Notes |
163 | 163 | $nbNote = 0; |
164 | - if(!empty($object->note)) $nbNote++; |
|
164 | + if (!empty($object->note)) $nbNote++; |
|
165 | 165 | $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; |
166 | 166 | $head[$h][1] = $langs->trans("Note"); |
167 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
167 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
168 | 168 | $head[$h][2] = 'note'; |
169 | 169 | $h++; |
170 | 170 | |
171 | 171 | // Attached files |
172 | 172 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
173 | 173 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
174 | - $upload_dir = $conf->user->dir_output . "/" . $object->id; |
|
175 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
176 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
174 | + $upload_dir = $conf->user->dir_output."/".$object->id; |
|
175 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
176 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
177 | 177 | $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; |
178 | 178 | $head[$h][1] = $langs->trans("Documents"); |
179 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
179 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
180 | 180 | $head[$h][2] = 'document'; |
181 | 181 | $h++; |
182 | 182 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $h++; |
187 | 187 | } |
188 | 188 | |
189 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove'); |
|
189 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'user', 'remove'); |
|
190 | 190 | |
191 | 191 | return $head; |
192 | 192 | } |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | { |
202 | 202 | global $langs, $conf, $user; |
203 | 203 | |
204 | - $canreadperms=true; |
|
205 | - if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
204 | + $canreadperms = true; |
|
205 | + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) |
|
206 | 206 | { |
207 | - $canreadperms=($user->admin || $user->rights->user->group_advance->readperms); |
|
207 | + $canreadperms = ($user->admin || $user->rights->user->group_advance->readperms); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | $h = 0; |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | $head[$h][2] = 'group'; |
216 | 216 | $h++; |
217 | 217 | |
218 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
219 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
218 | + if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
219 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) |
|
220 | 220 | { |
221 | 221 | $langs->load("ldap"); |
222 | 222 | $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | if ($canreadperms) |
229 | 229 | { |
230 | 230 | $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id; |
231 | - $head[$h][1] = $langs->trans("GroupRights"). ' <span class="badge">'.($object->nb_rights).'</span>'; |
|
231 | + $head[$h][1] = $langs->trans("GroupRights").' <span class="badge">'.($object->nb_rights).'</span>'; |
|
232 | 232 | $head[$h][2] = 'rights'; |
233 | 233 | $h++; |
234 | 234 | } |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | // Entries must be declared in modules descriptor with line |
238 | 238 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
239 | 239 | // $this->tabs = array('entity:-tabname); to remove a tab |
240 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'group'); |
|
240 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'group'); |
|
241 | 241 | |
242 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove'); |
|
242 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'group', 'remove'); |
|
243 | 243 | |
244 | 244 | return $head; |
245 | 245 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | global $langs, $conf, $user; |
255 | 255 | |
256 | 256 | $langs->load("users"); |
257 | - $h=0; |
|
257 | + $h = 0; |
|
258 | 258 | |
259 | 259 | $head[$h][0] = DOL_URL_ROOT.'/admin/user.php'; |
260 | 260 | $head[$h][1] = $langs->trans("Parameters"); |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | // Entries must be declared in modules descriptor with line |
281 | 281 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
282 | 282 | // $this->tabs = array('entity:-tabname); to remove a tab |
283 | - complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin'); |
|
283 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin'); |
|
284 | 284 | |
285 | - complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove'); |
|
285 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'useradmin', 'remove'); |
|
286 | 286 | |
287 | 287 | return $head; |
288 | 288 | } |
@@ -295,42 +295,42 @@ discard block |
||
295 | 295 | * @param boolean $foruserprofile Show for user profile view |
296 | 296 | * @return void |
297 | 297 | */ |
298 | -function show_theme($fuser,$edit=0,$foruserprofile=false) |
|
298 | +function show_theme($fuser, $edit = 0, $foruserprofile = false) |
|
299 | 299 | { |
300 | - global $conf,$langs,$db,$form; |
|
300 | + global $conf, $langs, $db, $form; |
|
301 | 301 | global $bc; |
302 | 302 | |
303 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
303 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
|
304 | 304 | |
305 | 305 | $formother = new FormOther($db); |
306 | 306 | |
307 | - $dirthemes=array('/theme'); |
|
308 | - if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application |
|
307 | + $dirthemes = array('/theme'); |
|
308 | + if (!empty($conf->modules_parts['theme'])) // Using this feature slow down application |
|
309 | 309 | { |
310 | - foreach($conf->modules_parts['theme'] as $reldir) |
|
310 | + foreach ($conf->modules_parts['theme'] as $reldir) |
|
311 | 311 | { |
312 | - $dirthemes=array_merge($dirthemes,(array) ($reldir.'theme')); |
|
312 | + $dirthemes = array_merge($dirthemes, (array) ($reldir.'theme')); |
|
313 | 313 | } |
314 | 314 | } |
315 | - $dirthemes=array_unique($dirthemes); |
|
315 | + $dirthemes = array_unique($dirthemes); |
|
316 | 316 | // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme') |
317 | 317 | |
318 | - $selected_theme=''; |
|
319 | - if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME; |
|
320 | - else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); |
|
318 | + $selected_theme = ''; |
|
319 | + if (empty($foruserprofile)) $selected_theme = $conf->global->MAIN_THEME; |
|
320 | + else $selected_theme = ((is_object($fuser) && !empty($fuser->conf->MAIN_THEME)) ? $fuser->conf->MAIN_THEME : ''); |
|
321 | 321 | |
322 | - $hoverdisabled=''; |
|
323 | - if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); |
|
324 | - else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):''); |
|
322 | + $hoverdisabled = ''; |
|
323 | + if (empty($foruserprofile)) $hoverdisabled = (isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); |
|
324 | + else $hoverdisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0') : ''); |
|
325 | 325 | |
326 | - $checkeddisabled=''; |
|
327 | - if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0'); |
|
328 | - else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):''); |
|
326 | + $checkeddisabled = ''; |
|
327 | + if (empty($foruserprofile)) $checkeddisabled = (isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0'); |
|
328 | + else $checkeddisabled = (is_object($fuser) ? (empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0') : ''); |
|
329 | 329 | |
330 | - $colspan=2; |
|
331 | - if ($foruserprofile) $colspan=4; |
|
330 | + $colspan = 2; |
|
331 | + if ($foruserprofile) $colspan = 4; |
|
332 | 332 | |
333 | - $thumbsbyrow=6; |
|
333 | + $thumbsbyrow = 6; |
|
334 | 334 | print '<table class="noborder" width="100%">'; |
335 | 335 | |
336 | 336 | // Title |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | print '<tr>'; |
344 | 344 | print '<td>'.$langs->trans("DefaultSkin").'</td>'; |
345 | 345 | print '<td>'.$conf->global->MAIN_THEME.'</td>'; |
346 | - print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; |
|
346 | + print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit ? '' : ' disabled').' type="checkbox" '.($selected_theme ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>'; |
|
347 | 347 | print '<td> </td>'; |
348 | 348 | print '</tr>'; |
349 | 349 | } |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | { |
352 | 352 | print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>'; |
353 | 353 | print '<th align="right">'; |
354 | - $url='https://www.dolistore.com/lang-en/4-skins'; |
|
355 | - if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes'; |
|
354 | + $url = 'https://www.dolistore.com/lang-en/4-skins'; |
|
355 | + if (preg_match('/fr/i', $langs->defaultlang)) $url = 'https://www.dolistore.com/fr/4-themes'; |
|
356 | 356 | //if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes'; |
357 | 357 | print '<a href="'.$url.'" target="_blank">'; |
358 | 358 | print $langs->trans('DownloadMoreSkins'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | print '<tr>'; |
363 | 363 | print '<td>'.$langs->trans("ThemeDir").'</td>'; |
364 | 364 | print '<td>'; |
365 | - foreach($dirthemes as $dirtheme) |
|
365 | + foreach ($dirthemes as $dirtheme) |
|
366 | 366 | { |
367 | 367 | echo '"'.$dirtheme.'" '; |
368 | 368 | } |
@@ -374,43 +374,43 @@ discard block |
||
374 | 374 | |
375 | 375 | print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">'; |
376 | 376 | |
377 | - $i=0; |
|
378 | - foreach($dirthemes as $dir) |
|
377 | + $i = 0; |
|
378 | + foreach ($dirthemes as $dir) |
|
379 | 379 | { |
380 | 380 | //print $dirroot.$dir;exit; |
381 | - $dirtheme=dol_buildpath($dir,0); // This include loop on $conf->file->dol_document_root |
|
382 | - $urltheme=dol_buildpath($dir,1); |
|
381 | + $dirtheme = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root |
|
382 | + $urltheme = dol_buildpath($dir, 1); |
|
383 | 383 | |
384 | 384 | if (is_dir($dirtheme)) |
385 | 385 | { |
386 | - $handle=opendir($dirtheme); |
|
386 | + $handle = opendir($dirtheme); |
|
387 | 387 | if (is_resource($handle)) |
388 | 388 | { |
389 | - while (($subdir = readdir($handle))!==false) |
|
389 | + while (($subdir = readdir($handle)) !== false) |
|
390 | 390 | { |
391 | 391 | if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.' |
392 | - && substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir)) |
|
392 | + && substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) |
|
393 | 393 | { |
394 | 394 | // Disable not stable themes (dir ends with _exp or _dev) |
395 | - if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue; |
|
396 | - if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue; |
|
395 | + if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue; |
|
396 | + if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue; |
|
397 | 397 | |
398 | 398 | print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">'; |
399 | - $file=$dirtheme."/".$subdir."/thumb.png"; |
|
400 | - $url=$urltheme."/".$subdir."/thumb.png"; |
|
401 | - if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png'; |
|
402 | - print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">'; |
|
403 | - if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); |
|
404 | - else $title=$langs->trans("ShowPreview"); |
|
399 | + $file = $dirtheme."/".$subdir."/thumb.png"; |
|
400 | + $url = $urltheme."/".$subdir."/thumb.png"; |
|
401 | + if (!file_exists($file)) $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png'; |
|
402 | + print '<a href="'.$_SERVER["PHP_SELF"].($edit ? '?action=edit&theme=' : '?theme=').$subdir.(GETPOST('optioncss', 'alpha', 1) ? '&optioncss='.GETPOST('optioncss', 'alpha', 1) : '').($fuser ? '&id='.$fuser->id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">'; |
|
403 | + if ($subdir == $conf->global->MAIN_THEME) $title = $langs->trans("ThemeCurrentlyActive"); |
|
404 | + else $title = $langs->trans("ShowPreview"); |
|
405 | 405 | print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">'; |
406 | 406 | print '</a><br>'; |
407 | 407 | if ($subdir == $selected_theme) |
408 | 408 | { |
409 | - print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>'; |
|
409 | + print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>'; |
|
410 | 410 | } |
411 | 411 | else |
412 | 412 | { |
413 | - print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir; |
|
413 | + print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir; |
|
414 | 414 | } |
415 | 415 | print '</div>'; |
416 | 416 | |
@@ -451,10 +451,10 @@ discard block |
||
451 | 451 | } |
452 | 452 | else |
453 | 453 | { |
454 | - $default=$langs->trans('No'); |
|
454 | + $default = $langs->trans('No'); |
|
455 | 455 | print '<tr class="oddeven">'; |
456 | 456 | print '<td>'.$langs->trans("TopMenuDisableImages").'</td>'; |
457 | - print '<td colspan="'.($colspan-1).'">'; |
|
457 | + print '<td colspan="'.($colspan - 1).'">'; |
|
458 | 458 | if ($edit) |
459 | 459 | { |
460 | 460 | print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); |
@@ -497,15 +497,15 @@ discard block |
||
497 | 497 | { |
498 | 498 | print '<tr class="oddeven">'; |
499 | 499 | print '<td>'.$langs->trans("BackgroundColor").'</td>'; |
500 | - print '<td colspan="'.($colspan-1).'">'; |
|
500 | + print '<td colspan="'.($colspan - 1).'">'; |
|
501 | 501 | //var_dump($conf->global->THEME_ELDY_BACKBODY); |
502 | 502 | if ($edit) |
503 | 503 | { |
504 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' '; |
|
504 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', 'formcolor', 1).' '; |
|
505 | 505 | } |
506 | 506 | else |
507 | 507 | { |
508 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''); |
|
508 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''); |
|
509 | 509 | if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
510 | 510 | else print $langs->trans("Default"); |
511 | 511 | } |
@@ -541,19 +541,19 @@ discard block |
||
541 | 541 | } |
542 | 542 | else |
543 | 543 | { |
544 | - $default='5a6482'; |
|
545 | - if ($conf->theme == 'md') $default='5a3278'; |
|
544 | + $default = '5a6482'; |
|
545 | + if ($conf->theme == 'md') $default = '5a3278'; |
|
546 | 546 | |
547 | 547 | print '<tr class="oddeven">'; |
548 | 548 | print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
549 | - print '<td colspan="'.($colspan-1).'">'; |
|
549 | + print '<td colspan="'.($colspan - 1).'">'; |
|
550 | 550 | if ($edit) |
551 | 551 | { |
552 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; |
|
552 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', 'formcolor', 1).' '; |
|
553 | 553 | } |
554 | 554 | else |
555 | 555 | { |
556 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); |
|
556 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''); |
|
557 | 557 | if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
558 | 558 | else print $langs->trans("Default"); |
559 | 559 | } |
@@ -589,19 +589,19 @@ discard block |
||
589 | 589 | } |
590 | 590 | else |
591 | 591 | { |
592 | - $default='f0f0f0'; |
|
593 | - if ($conf->theme == 'md') $default='ffffff'; |
|
592 | + $default = 'f0f0f0'; |
|
593 | + if ($conf->theme == 'md') $default = 'ffffff'; |
|
594 | 594 | |
595 | 595 | print '<tr class="oddeven">'; |
596 | 596 | print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>'; |
597 | - print '<td colspan="'.($colspan-1).'">'; |
|
597 | + print '<td colspan="'.($colspan - 1).'">'; |
|
598 | 598 | if ($edit) |
599 | 599 | { |
600 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' '; |
|
600 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', 'formcolor', 1).' '; |
|
601 | 601 | } |
602 | 602 | else |
603 | 603 | { |
604 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''); |
|
604 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''); |
|
605 | 605 | if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
606 | 606 | else print $langs->trans("Default"); |
607 | 607 | } |
@@ -621,10 +621,10 @@ discard block |
||
621 | 621 | { |
622 | 622 | print '<tr class="oddeven">'; |
623 | 623 | print '<td>'.$langs->trans("TextTitleColor").'</td>'; |
624 | - print '<td colspan="'.($colspan-1).'">'; |
|
624 | + print '<td colspan="'.($colspan - 1).'">'; |
|
625 | 625 | if ($edit) |
626 | 626 | { |
627 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' '; |
|
627 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', 'formcolor', 1).' '; |
|
628 | 628 | } |
629 | 629 | else |
630 | 630 | { |
@@ -648,16 +648,16 @@ discard block |
||
648 | 648 | { |
649 | 649 | print '<tr class="oddeven">'; |
650 | 650 | print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>'; |
651 | - print '<td colspan="'.($colspan-1).'">'; |
|
651 | + print '<td colspan="'.($colspan - 1).'">'; |
|
652 | 652 | if ($edit) |
653 | 653 | { |
654 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' '; |
|
654 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', 'formcolor', 1).' '; |
|
655 | 655 | } |
656 | 656 | else |
657 | 657 | { |
658 | 658 | print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); |
659 | 659 | } |
660 | - print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS |
|
660 | + print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>f0f0f0</strong>) '; // $colorbacktitle1 in CSS |
|
661 | 661 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
662 | 662 | print '</span>'; |
663 | 663 | print '</td>'; |
@@ -675,10 +675,10 @@ discard block |
||
675 | 675 | { |
676 | 676 | print '<tr class="oddeven">'; |
677 | 677 | print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>'; |
678 | - print '<td colspan="'.($colspan-1).'">'; |
|
678 | + print '<td colspan="'.($colspan - 1).'">'; |
|
679 | 679 | if ($edit) |
680 | 680 | { |
681 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' '; |
|
681 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', 'formcolor', 1).' '; |
|
682 | 682 | } |
683 | 683 | else |
684 | 684 | { |
@@ -699,19 +699,19 @@ discard block |
||
699 | 699 | } |
700 | 700 | else |
701 | 701 | { |
702 | - $default='ffffff'; |
|
703 | - if ($conf->theme == 'md') $default='ffffff'; |
|
702 | + $default = 'ffffff'; |
|
703 | + if ($conf->theme == 'md') $default = 'ffffff'; |
|
704 | 704 | |
705 | 705 | print '<tr class="oddeven">'; |
706 | 706 | print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>'; |
707 | - print '<td colspan="'.($colspan-1).'">'; |
|
707 | + print '<td colspan="'.($colspan - 1).'">'; |
|
708 | 708 | if ($edit) |
709 | 709 | { |
710 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' '; |
|
710 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', 'formcolor', 1).' '; |
|
711 | 711 | } |
712 | 712 | else |
713 | 713 | { |
714 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''); |
|
714 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''); |
|
715 | 715 | if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
716 | 716 | else print $langs->trans("Default"); |
717 | 717 | } |
@@ -728,19 +728,19 @@ discard block |
||
728 | 728 | } |
729 | 729 | else |
730 | 730 | { |
731 | - $default='f8f8f8'; |
|
732 | - if ($conf->theme == 'md') $default='f8f8f8'; |
|
731 | + $default = 'f8f8f8'; |
|
732 | + if ($conf->theme == 'md') $default = 'f8f8f8'; |
|
733 | 733 | |
734 | 734 | print '<tr class="oddeven">'; |
735 | 735 | print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>'; |
736 | - print '<td colspan="'.($colspan-1).'">'; |
|
736 | + print '<td colspan="'.($colspan - 1).'">'; |
|
737 | 737 | if ($edit) |
738 | 738 | { |
739 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' '; |
|
739 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', 'formcolor', 1).' '; |
|
740 | 740 | } |
741 | 741 | else |
742 | 742 | { |
743 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''); |
|
743 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''); |
|
744 | 744 | if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
745 | 745 | else print $langs->trans("Default"); |
746 | 746 | } |
@@ -778,14 +778,14 @@ discard block |
||
778 | 778 | { |
779 | 779 | print '<tr class="oddeven">'; |
780 | 780 | print '<td>'.$langs->trans("LinkColor").'</td>'; |
781 | - print '<td colspan="'.($colspan-1).'">'; |
|
781 | + print '<td colspan="'.($colspan - 1).'">'; |
|
782 | 782 | if ($edit) |
783 | 783 | { |
784 | - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; |
|
784 | + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', 'formcolor', 1).' '; |
|
785 | 785 | } |
786 | 786 | else |
787 | 787 | { |
788 | - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); |
|
788 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''); |
|
789 | 789 | if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
790 | 790 | else |
791 | 791 | { |
@@ -817,19 +817,19 @@ discard block |
||
817 | 817 | else { |
818 | 818 | print '<tr class="oddeven">'; |
819 | 819 | print '<td>'.$langs->trans("HighlightLinesColor").'</td>'; |
820 | - print '<td colspan="'.($colspan-1).'">'; |
|
820 | + print '<td colspan="'.($colspan - 1).'">'; |
|
821 | 821 | //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
822 | 822 | //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
823 | 823 | if ($edit) |
824 | 824 | { |
825 | - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
826 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
827 | - print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' '; |
|
825 | + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = 'e6edf0'; |
|
826 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); |
|
827 | + print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1).' '; |
|
828 | 828 | } |
829 | 829 | else |
830 | 830 | { |
831 | - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
832 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
831 | + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = 'e6edf0'; |
|
832 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); |
|
833 | 833 | if ($color) |
834 | 834 | { |
835 | 835 | if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
@@ -861,19 +861,19 @@ discard block |
||
861 | 861 | { |
862 | 862 | print '<tr class="oddeven">'; |
863 | 863 | print '<td>'.$langs->trans("HighlightLinesChecked").'</td>'; |
864 | - print '<td colspan="'.($colspan-1).'">'; |
|
864 | + print '<td colspan="'.($colspan - 1).'">'; |
|
865 | 865 | //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>'; |
866 | 866 | //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
867 | 867 | if ($edit) |
868 | 868 | { |
869 | - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
870 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
871 | - print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' '; |
|
869 | + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; |
|
870 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); |
|
871 | + print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', 'formcolor', 1).' '; |
|
872 | 872 | } |
873 | 873 | else |
874 | 874 | { |
875 | - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
876 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
875 | + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; |
|
876 | + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); |
|
877 | 877 | if ($color) |
878 | 878 | { |
879 | 879 | if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
@@ -76,7 +76,9 @@ discard block |
||
76 | 76 | |
77 | 77 | if (! empty($conf->agenda->enabled)) |
78 | 78 | { |
79 | - if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; |
|
79 | + if (empty($conf->global->AGENDA_EXT_NB)) { |
|
80 | + $conf->global->AGENDA_EXT_NB=5; |
|
81 | + } |
|
80 | 82 | $MAXAGENDA=$conf->global->AGENDA_EXT_NB; |
81 | 83 | |
82 | 84 | $i=1; |
@@ -90,7 +92,9 @@ discard block |
||
90 | 92 | $color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key; |
91 | 93 | $i++; |
92 | 94 | |
93 | - if (! empty($object->conf->$name)) $nbagenda++; |
|
95 | + if (! empty($object->conf->$name)) { |
|
96 | + $nbagenda++; |
|
97 | + } |
|
94 | 98 | } |
95 | 99 | |
96 | 100 | $head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id; |
@@ -125,14 +129,15 @@ discard block |
||
125 | 129 | $nbNote=$obj->nb; |
126 | 130 | $i++; |
127 | 131 | } |
128 | - } |
|
129 | - else { |
|
132 | + } else { |
|
130 | 133 | dol_print_error($db); |
131 | 134 | } |
132 | 135 | |
133 | 136 | $head[$h][0] = DOL_URL_ROOT.'/user/notify/card.php?id='.$object->id; |
134 | 137 | $head[$h][1] = $langs->trans("Notifications"); |
135 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
138 | + if ($nbNote > 0) { |
|
139 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
140 | + } |
|
136 | 141 | $head[$h][2] = 'notify'; |
137 | 142 | $h++; |
138 | 143 | } |
@@ -161,10 +166,14 @@ discard block |
||
161 | 166 | { |
162 | 167 | // Notes |
163 | 168 | $nbNote = 0; |
164 | - if(!empty($object->note)) $nbNote++; |
|
169 | + if(!empty($object->note)) { |
|
170 | + $nbNote++; |
|
171 | + } |
|
165 | 172 | $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; |
166 | 173 | $head[$h][1] = $langs->trans("Note"); |
167 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
174 | + if ($nbNote > 0) { |
|
175 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
176 | + } |
|
168 | 177 | $head[$h][2] = 'note'; |
169 | 178 | $h++; |
170 | 179 | |
@@ -176,7 +185,9 @@ discard block |
||
176 | 185 | $nbLinks=Link::count($db, $object->element, $object->id); |
177 | 186 | $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; |
178 | 187 | $head[$h][1] = $langs->trans("Documents"); |
179 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
188 | + if (($nbFiles+$nbLinks) > 0) { |
|
189 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
190 | + } |
|
180 | 191 | $head[$h][2] = 'document'; |
181 | 192 | $h++; |
182 | 193 | |
@@ -305,30 +316,43 @@ discard block |
||
305 | 316 | $formother = new FormOther($db); |
306 | 317 | |
307 | 318 | $dirthemes=array('/theme'); |
308 | - if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application |
|
319 | + if (! empty($conf->modules_parts['theme'])) { |
|
320 | + // Using this feature slow down application |
|
309 | 321 | { |
310 | 322 | foreach($conf->modules_parts['theme'] as $reldir) |
311 | 323 | { |
312 | 324 | $dirthemes=array_merge($dirthemes,(array) ($reldir.'theme')); |
325 | + } |
|
313 | 326 | } |
314 | 327 | } |
315 | 328 | $dirthemes=array_unique($dirthemes); |
316 | 329 | // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme') |
317 | 330 | |
318 | 331 | $selected_theme=''; |
319 | - if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME; |
|
320 | - else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); |
|
332 | + if (empty($foruserprofile)) { |
|
333 | + $selected_theme=$conf->global->MAIN_THEME; |
|
334 | + } else { |
|
335 | + $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); |
|
336 | + } |
|
321 | 337 | |
322 | 338 | $hoverdisabled=''; |
323 | - if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); |
|
324 | - else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):''); |
|
339 | + if (empty($foruserprofile)) { |
|
340 | + $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); |
|
341 | + } else { |
|
342 | + $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):''); |
|
343 | + } |
|
325 | 344 | |
326 | 345 | $checkeddisabled=''; |
327 | - if (empty($foruserprofile)) $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0'); |
|
328 | - else $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):''); |
|
346 | + if (empty($foruserprofile)) { |
|
347 | + $checkeddisabled=(isset($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '0'); |
|
348 | + } else { |
|
349 | + $checkeddisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_CHECKED) || $fuser->conf->THEME_ELDY_USE_CHECKED == '0'):''); |
|
350 | + } |
|
329 | 351 | |
330 | 352 | $colspan=2; |
331 | - if ($foruserprofile) $colspan=4; |
|
353 | + if ($foruserprofile) { |
|
354 | + $colspan=4; |
|
355 | + } |
|
332 | 356 | |
333 | 357 | $thumbsbyrow=6; |
334 | 358 | print '<table class="noborder" width="100%">'; |
@@ -346,13 +370,14 @@ discard block |
||
346 | 370 | print '<td align="left" class="nowrap" width="20%"><input id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; |
347 | 371 | print '<td> </td>'; |
348 | 372 | print '</tr>'; |
349 | - } |
|
350 | - else |
|
373 | + } else |
|
351 | 374 | { |
352 | 375 | print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>'; |
353 | 376 | print '<th align="right">'; |
354 | 377 | $url='https://www.dolistore.com/lang-en/4-skins'; |
355 | - if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes'; |
|
378 | + if (preg_match('/fr/i',$langs->defaultlang)) { |
|
379 | + $url='https://www.dolistore.com/fr/4-themes'; |
|
380 | + } |
|
356 | 381 | //if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes'; |
357 | 382 | print '<a href="'.$url.'" target="_blank">'; |
358 | 383 | print $langs->trans('DownloadMoreSkins'); |
@@ -392,23 +417,31 @@ discard block |
||
392 | 417 | && substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir)) |
393 | 418 | { |
394 | 419 | // Disable not stable themes (dir ends with _exp or _dev) |
395 | - if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) continue; |
|
396 | - if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) continue; |
|
420 | + if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i',$subdir)) { |
|
421 | + continue; |
|
422 | + } |
|
423 | + if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i',$subdir)) { |
|
424 | + continue; |
|
425 | + } |
|
397 | 426 | |
398 | 427 | print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">'; |
399 | 428 | $file=$dirtheme."/".$subdir."/thumb.png"; |
400 | 429 | $url=$urltheme."/".$subdir."/thumb.png"; |
401 | - if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png'; |
|
430 | + if (! file_exists($file)) { |
|
431 | + $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png'; |
|
432 | + } |
|
402 | 433 | print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST('optioncss','alpha',1)?'&optioncss='.GETPOST('optioncss','alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">'; |
403 | - if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive"); |
|
404 | - else $title=$langs->trans("ShowPreview"); |
|
434 | + if ($subdir == $conf->global->MAIN_THEME) { |
|
435 | + $title=$langs->trans("ThemeCurrentlyActive"); |
|
436 | + } else { |
|
437 | + $title=$langs->trans("ShowPreview"); |
|
438 | + } |
|
405 | 439 | print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">'; |
406 | 440 | print '</a><br>'; |
407 | 441 | if ($subdir == $selected_theme) |
408 | 442 | { |
409 | 443 | print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>'; |
410 | - } |
|
411 | - else |
|
444 | + } else |
|
412 | 445 | { |
413 | 446 | print '<input '.($edit?'':'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir; |
414 | 447 | } |
@@ -448,8 +481,7 @@ discard block |
||
448 | 481 | } |
449 | 482 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
450 | 483 | print '</td>';*/ |
451 | - } |
|
452 | - else |
|
484 | + } else |
|
453 | 485 | { |
454 | 486 | $default=$langs->trans('No'); |
455 | 487 | print '<tr class="oddeven">'; |
@@ -458,8 +490,7 @@ discard block |
||
458 | 490 | if ($edit) |
459 | 491 | { |
460 | 492 | print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); |
461 | - } |
|
462 | - else |
|
493 | + } else |
|
463 | 494 | { |
464 | 495 | print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); |
465 | 496 | } |
@@ -492,8 +523,7 @@ discard block |
||
492 | 523 | } |
493 | 524 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
494 | 525 | print '</td>';*/ |
495 | - } |
|
496 | - else |
|
526 | + } else |
|
497 | 527 | { |
498 | 528 | print '<tr class="oddeven">'; |
499 | 529 | print '<td>'.$langs->trans("BackgroundColor").'</td>'; |
@@ -502,12 +532,14 @@ discard block |
||
502 | 532 | if ($edit) |
503 | 533 | { |
504 | 534 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''),'THEME_ELDY_BACKBODY','formcolor',1).' '; |
505 | - } |
|
506 | - else |
|
535 | + } else |
|
507 | 536 | { |
508 | 537 | $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''); |
509 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
510 | - else print $langs->trans("Default"); |
|
538 | + if ($color) { |
|
539 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
540 | + } else { |
|
541 | + print $langs->trans("Default"); |
|
542 | + } |
|
511 | 543 | } |
512 | 544 | print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>ffffff</strong>) '; |
513 | 545 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
@@ -538,11 +570,12 @@ discard block |
||
538 | 570 | } |
539 | 571 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
540 | 572 | print '</td>';*/ |
541 | - } |
|
542 | - else |
|
573 | + } else |
|
543 | 574 | { |
544 | 575 | $default='5a6482'; |
545 | - if ($conf->theme == 'md') $default='5a3278'; |
|
576 | + if ($conf->theme == 'md') { |
|
577 | + $default='5a3278'; |
|
578 | + } |
|
546 | 579 | |
547 | 580 | print '<tr class="oddeven">'; |
548 | 581 | print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>'; |
@@ -550,12 +583,14 @@ discard block |
||
550 | 583 | if ($edit) |
551 | 584 | { |
552 | 585 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; |
553 | - } |
|
554 | - else |
|
586 | + } else |
|
555 | 587 | { |
556 | 588 | $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); |
557 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
558 | - else print $langs->trans("Default"); |
|
589 | + if ($color) { |
|
590 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
591 | + } else { |
|
592 | + print $langs->trans("Default"); |
|
593 | + } |
|
559 | 594 | } |
560 | 595 | print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
561 | 596 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
@@ -586,11 +621,12 @@ discard block |
||
586 | 621 | } |
587 | 622 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
588 | 623 | print '</td>';*/ |
589 | - } |
|
590 | - else |
|
624 | + } else |
|
591 | 625 | { |
592 | 626 | $default='f0f0f0'; |
593 | - if ($conf->theme == 'md') $default='ffffff'; |
|
627 | + if ($conf->theme == 'md') { |
|
628 | + $default='ffffff'; |
|
629 | + } |
|
594 | 630 | |
595 | 631 | print '<tr class="oddeven">'; |
596 | 632 | print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>'; |
@@ -598,12 +634,14 @@ discard block |
||
598 | 634 | if ($edit) |
599 | 635 | { |
600 | 636 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' '; |
601 | - } |
|
602 | - else |
|
637 | + } else |
|
603 | 638 | { |
604 | 639 | $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''); |
605 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
606 | - else print $langs->trans("Default"); |
|
640 | + if ($color) { |
|
641 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
642 | + } else { |
|
643 | + print $langs->trans("Default"); |
|
644 | + } |
|
607 | 645 | } |
608 | 646 | print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
609 | 647 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
@@ -616,8 +654,7 @@ discard block |
||
616 | 654 | { |
617 | 655 | |
618 | 656 | |
619 | - } |
|
620 | - else |
|
657 | + } else |
|
621 | 658 | { |
622 | 659 | print '<tr class="oddeven">'; |
623 | 660 | print '<td>'.$langs->trans("TextTitleColor").'</td>'; |
@@ -625,8 +662,7 @@ discard block |
||
625 | 662 | if ($edit) |
626 | 663 | { |
627 | 664 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB,array()),''),'THEME_ELDY_TEXTTITLENOTAB','formcolor',1).' '; |
628 | - } |
|
629 | - else |
|
665 | + } else |
|
630 | 666 | { |
631 | 667 | print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); |
632 | 668 | } |
@@ -643,8 +679,7 @@ discard block |
||
643 | 679 | { |
644 | 680 | |
645 | 681 | |
646 | - } |
|
647 | - else |
|
682 | + } else |
|
648 | 683 | { |
649 | 684 | print '<tr class="oddeven">'; |
650 | 685 | print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>'; |
@@ -652,8 +687,7 @@ discard block |
||
652 | 687 | if ($edit) |
653 | 688 | { |
654 | 689 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' '; |
655 | - } |
|
656 | - else |
|
690 | + } else |
|
657 | 691 | { |
658 | 692 | print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); |
659 | 693 | } |
@@ -670,8 +704,7 @@ discard block |
||
670 | 704 | { |
671 | 705 | |
672 | 706 | |
673 | - } |
|
674 | - else |
|
707 | + } else |
|
675 | 708 | { |
676 | 709 | print '<tr class="oddeven">'; |
677 | 710 | print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>'; |
@@ -679,8 +712,7 @@ discard block |
||
679 | 712 | if ($edit) |
680 | 713 | { |
681 | 714 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE,array()),''),'THEME_ELDY_TEXTTITLE','formcolor',1).' '; |
682 | - } |
|
683 | - else |
|
715 | + } else |
|
684 | 716 | { |
685 | 717 | print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); |
686 | 718 | } |
@@ -696,11 +728,12 @@ discard block |
||
696 | 728 | if ($foruserprofile) |
697 | 729 | { |
698 | 730 | |
699 | - } |
|
700 | - else |
|
731 | + } else |
|
701 | 732 | { |
702 | 733 | $default='ffffff'; |
703 | - if ($conf->theme == 'md') $default='ffffff'; |
|
734 | + if ($conf->theme == 'md') { |
|
735 | + $default='ffffff'; |
|
736 | + } |
|
704 | 737 | |
705 | 738 | print '<tr class="oddeven">'; |
706 | 739 | print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>'; |
@@ -708,12 +741,14 @@ discard block |
||
708 | 741 | if ($edit) |
709 | 742 | { |
710 | 743 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''),'THEME_ELDY_LINEIMPAIR1','formcolor',1).' '; |
711 | - } |
|
712 | - else |
|
744 | + } else |
|
713 | 745 | { |
714 | 746 | $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1,array()),''); |
715 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
716 | - else print $langs->trans("Default"); |
|
747 | + if ($color) { |
|
748 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
749 | + } else { |
|
750 | + print $langs->trans("Default"); |
|
751 | + } |
|
717 | 752 | } |
718 | 753 | print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
719 | 754 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
@@ -725,11 +760,12 @@ discard block |
||
725 | 760 | if ($foruserprofile) |
726 | 761 | { |
727 | 762 | |
728 | - } |
|
729 | - else |
|
763 | + } else |
|
730 | 764 | { |
731 | 765 | $default='f8f8f8'; |
732 | - if ($conf->theme == 'md') $default='f8f8f8'; |
|
766 | + if ($conf->theme == 'md') { |
|
767 | + $default='f8f8f8'; |
|
768 | + } |
|
733 | 769 | |
734 | 770 | print '<tr class="oddeven">'; |
735 | 771 | print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>'; |
@@ -737,12 +773,14 @@ discard block |
||
737 | 773 | if ($edit) |
738 | 774 | { |
739 | 775 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''),'THEME_ELDY_LINEPAIR1','formcolor',1).' '; |
740 | - } |
|
741 | - else |
|
776 | + } else |
|
742 | 777 | { |
743 | 778 | $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1,array()),''); |
744 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
745 | - else print $langs->trans("Default"); |
|
779 | + if ($color) { |
|
780 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
781 | + } else { |
|
782 | + print $langs->trans("Default"); |
|
783 | + } |
|
746 | 784 | } |
747 | 785 | print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>'.$default.'</strong>) '; |
748 | 786 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
@@ -773,8 +811,7 @@ discard block |
||
773 | 811 | } |
774 | 812 | if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
775 | 813 | print '</td>';*/ |
776 | - } |
|
777 | - else |
|
814 | + } else |
|
778 | 815 | { |
779 | 816 | print '<tr class="oddeven">'; |
780 | 817 | print '<td>'.$langs->trans("LinkColor").'</td>'; |
@@ -782,12 +819,12 @@ discard block |
||
782 | 819 | if ($edit) |
783 | 820 | { |
784 | 821 | print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; |
785 | - } |
|
786 | - else |
|
822 | + } else |
|
787 | 823 | { |
788 | 824 | $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); |
789 | - if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
790 | - else |
|
825 | + if ($color) { |
|
826 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
827 | + } else |
|
791 | 828 | { |
792 | 829 | //print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">'; |
793 | 830 | //print '<span style="color: #000078">'.$langs->trans("Default").'</span>'; |
@@ -813,8 +850,7 @@ discard block |
||
813 | 850 | print '</td>'; |
814 | 851 | print '</tr>'; |
815 | 852 | */ |
816 | - } |
|
817 | - else { |
|
853 | + } else { |
|
818 | 854 | print '<tr class="oddeven">'; |
819 | 855 | print '<td>'.$langs->trans("HighlightLinesColor").'</td>'; |
820 | 856 | print '<td colspan="'.($colspan-1).'">'; |
@@ -822,20 +858,29 @@ discard block |
||
822 | 858 | //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
823 | 859 | if ($edit) |
824 | 860 | { |
825 | - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
826 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
861 | + if ($conf->global->THEME_ELDY_USE_HOVER == '1') { |
|
862 | + $color='e6edf0'; |
|
863 | + } else { |
|
864 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
865 | + } |
|
827 | 866 | print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' '; |
828 | - } |
|
829 | - else |
|
867 | + } else |
|
830 | 868 | { |
831 | - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; |
|
832 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
869 | + if ($conf->global->THEME_ELDY_USE_HOVER == '1') { |
|
870 | + $color='e6edf0'; |
|
871 | + } else { |
|
872 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); |
|
873 | + } |
|
833 | 874 | if ($color) |
834 | 875 | { |
835 | - if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
836 | - else print $langs->trans("Default"); |
|
876 | + if ($color != 'e6edf0') { |
|
877 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
878 | + } else { |
|
879 | + print $langs->trans("Default"); |
|
880 | + } |
|
881 | + } else { |
|
882 | + print $langs->trans("None"); |
|
837 | 883 | } |
838 | - else print $langs->trans("None"); |
|
839 | 884 | } |
840 | 885 | print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; |
841 | 886 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
@@ -856,8 +901,7 @@ discard block |
||
856 | 901 | print '</td>'; |
857 | 902 | print '</tr>'; |
858 | 903 | */ |
859 | - } |
|
860 | - else |
|
904 | + } else |
|
861 | 905 | { |
862 | 906 | print '<tr class="oddeven">'; |
863 | 907 | print '<td>'.$langs->trans("HighlightLinesChecked").'</td>'; |
@@ -866,20 +910,29 @@ discard block |
||
866 | 910 | //print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; |
867 | 911 | if ($edit) |
868 | 912 | { |
869 | - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
870 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
913 | + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') { |
|
914 | + $color='e6edf0'; |
|
915 | + } else { |
|
916 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
917 | + } |
|
871 | 918 | print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' '; |
872 | - } |
|
873 | - else |
|
919 | + } else |
|
874 | 920 | { |
875 | - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0'; |
|
876 | - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
921 | + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') { |
|
922 | + $color='e6edf0'; |
|
923 | + } else { |
|
924 | + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); |
|
925 | + } |
|
877 | 926 | if ($color) |
878 | 927 | { |
879 | - if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
880 | - else print $langs->trans("Default"); |
|
928 | + if ($color != 'e6edf0') { |
|
929 | + print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; |
|
930 | + } else { |
|
931 | + print $langs->trans("Default"); |
|
932 | + } |
|
933 | + } else { |
|
934 | + print $langs->trans("None"); |
|
881 | 935 | } |
882 | - else print $langs->trans("None"); |
|
883 | 936 | } |
884 | 937 | print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) '; |
885 | 938 | print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); |
@@ -34,22 +34,22 @@ |
||
34 | 34 | */ |
35 | 35 | function import_prepare_head($param, $maxstep=0) |
36 | 36 | { |
37 | - global $langs; |
|
37 | + global $langs; |
|
38 | 38 | |
39 | - if (empty($maxstep)) $maxstep=6; |
|
39 | + if (empty($maxstep)) $maxstep=6; |
|
40 | 40 | |
41 | - $h=0; |
|
42 | - $head = array(); |
|
43 | - $i=1; |
|
44 | - while($i <= $maxstep) |
|
45 | - { |
|
46 | - $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param; |
|
47 | - $head[$h][1] = $langs->trans("Step")." ".$i; |
|
48 | - $head[$h][2] = 'step'.$i; |
|
49 | - $h++; |
|
50 | - $i++; |
|
51 | - } |
|
41 | + $h=0; |
|
42 | + $head = array(); |
|
43 | + $i=1; |
|
44 | + while($i <= $maxstep) |
|
45 | + { |
|
46 | + $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param; |
|
47 | + $head[$h][1] = $langs->trans("Step")." ".$i; |
|
48 | + $head[$h][2] = 'step'.$i; |
|
49 | + $h++; |
|
50 | + $i++; |
|
51 | + } |
|
52 | 52 | |
53 | - return $head; |
|
53 | + return $head; |
|
54 | 54 | } |
55 | 55 |
@@ -32,16 +32,16 @@ |
||
32 | 32 | * @param int $maxstep Limit steps to maxstep or no limit if 0 |
33 | 33 | * @return array Array of tabs |
34 | 34 | */ |
35 | -function import_prepare_head($param, $maxstep=0) |
|
35 | +function import_prepare_head($param, $maxstep = 0) |
|
36 | 36 | { |
37 | 37 | global $langs; |
38 | 38 | |
39 | - if (empty($maxstep)) $maxstep=6; |
|
39 | + if (empty($maxstep)) $maxstep = 6; |
|
40 | 40 | |
41 | - $h=0; |
|
41 | + $h = 0; |
|
42 | 42 | $head = array(); |
43 | - $i=1; |
|
44 | - while($i <= $maxstep) |
|
43 | + $i = 1; |
|
44 | + while ($i <= $maxstep) |
|
45 | 45 | { |
46 | 46 | $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param; |
47 | 47 | $head[$h][1] = $langs->trans("Step")." ".$i; |
@@ -36,7 +36,9 @@ |
||
36 | 36 | { |
37 | 37 | global $langs; |
38 | 38 | |
39 | - if (empty($maxstep)) $maxstep=6; |
|
39 | + if (empty($maxstep)) { |
|
40 | + $maxstep=6; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | $h=0; |
42 | 44 | $head = array(); |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | |
136 | 136 | if (! is_numeric($linelengthlimit)) |
137 | 137 | { |
138 | - dol_syslog("Admin.lib::run_sql param linelengthlimit is not a numeric", LOG_ERR); |
|
139 | - return -1; |
|
138 | + dol_syslog("Admin.lib::run_sql param linelengthlimit is not a numeric", LOG_ERR); |
|
139 | + return -1; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $ok=0; |
@@ -153,46 +153,46 @@ discard block |
||
153 | 153 | { |
154 | 154 | while (! feof($fp)) |
155 | 155 | { |
156 | - // Warning fgets with second parameter that is null or 0 hang. |
|
157 | - if ($linelengthlimit > 0) $buf = fgets($fp, $linelengthlimit); |
|
158 | - else $buf = fgets($fp); |
|
156 | + // Warning fgets with second parameter that is null or 0 hang. |
|
157 | + if ($linelengthlimit > 0) $buf = fgets($fp, $linelengthlimit); |
|
158 | + else $buf = fgets($fp); |
|
159 | 159 | |
160 | 160 | // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment) |
161 | 161 | if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i',$buf,$reg)) |
162 | 162 | { |
163 | - $qualified=1; |
|
164 | - |
|
165 | - // restrict on database type |
|
166 | - if (! empty($reg[1])) |
|
167 | - { |
|
168 | - if (! preg_match('/'.preg_quote($reg[1]).'/i',$db->type)) $qualified=0; |
|
169 | - } |
|
170 | - |
|
171 | - // restrict on version |
|
172 | - if ($qualified) |
|
173 | - { |
|
174 | - if (! empty($reg[2])) |
|
175 | - { |
|
176 | - if (is_numeric($reg[2])) // This is a version |
|
177 | - { |
|
178 | - $versionrequest=explode('.',$reg[2]); |
|
179 | - //print var_dump($versionrequest); |
|
180 | - //print var_dump($versionarray); |
|
181 | - if (! count($versionrequest) || ! count($versionarray) || versioncompare($versionrequest,$versionarray) > 0) |
|
182 | - { |
|
183 | - $qualified=0; |
|
184 | - } |
|
185 | - } |
|
186 | - else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE |
|
187 | - { |
|
188 | - $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); |
|
189 | - //var_dump($reg[2]); |
|
190 | - //var_dump($dbcollation); |
|
191 | - if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) $qualified=0; |
|
192 | - //var_dump($qualified); |
|
193 | - } |
|
194 | - } |
|
195 | - } |
|
163 | + $qualified=1; |
|
164 | + |
|
165 | + // restrict on database type |
|
166 | + if (! empty($reg[1])) |
|
167 | + { |
|
168 | + if (! preg_match('/'.preg_quote($reg[1]).'/i',$db->type)) $qualified=0; |
|
169 | + } |
|
170 | + |
|
171 | + // restrict on version |
|
172 | + if ($qualified) |
|
173 | + { |
|
174 | + if (! empty($reg[2])) |
|
175 | + { |
|
176 | + if (is_numeric($reg[2])) // This is a version |
|
177 | + { |
|
178 | + $versionrequest=explode('.',$reg[2]); |
|
179 | + //print var_dump($versionrequest); |
|
180 | + //print var_dump($versionarray); |
|
181 | + if (! count($versionrequest) || ! count($versionarray) || versioncompare($versionrequest,$versionarray) > 0) |
|
182 | + { |
|
183 | + $qualified=0; |
|
184 | + } |
|
185 | + } |
|
186 | + else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE |
|
187 | + { |
|
188 | + $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); |
|
189 | + //var_dump($reg[2]); |
|
190 | + //var_dump($dbcollation); |
|
191 | + if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) $qualified=0; |
|
192 | + //var_dump($qualified); |
|
193 | + } |
|
194 | + } |
|
195 | + } |
|
196 | 196 | |
197 | 197 | if ($qualified) |
198 | 198 | { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | // Add line buf to buffer if not a comment |
206 | 206 | if ($nocommentremoval || ! preg_match('/^\s*--/',$buf)) |
207 | 207 | { |
208 | - if (empty($nocommentremoval)) $buf=preg_replace('/([,;ERLT\)])\s*--.*$/i','\1',$buf); //remove comment from a line that not start with -- before add it to the buffer |
|
208 | + if (empty($nocommentremoval)) $buf=preg_replace('/([,;ERLT\)])\s*--.*$/i','\1',$buf); //remove comment from a line that not start with -- before add it to the buffer |
|
209 | 209 | $buffer .= trim($buf); |
210 | 210 | } |
211 | 211 | |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | |
270 | 270 | if ($offsetforchartofaccount > 0) |
271 | 271 | { |
272 | - // Replace lines |
|
273 | - // 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);' |
|
274 | - // with |
|
275 | - // 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);' |
|
276 | - $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql); |
|
277 | - $newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql); |
|
278 | - //var_dump($newsql); |
|
279 | - $arraysql[$i] = $newsql; |
|
272 | + // Replace lines |
|
273 | + // 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);' |
|
274 | + // with |
|
275 | + // 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);' |
|
276 | + $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql); |
|
277 | + $newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql); |
|
278 | + //var_dump($newsql); |
|
279 | + $arraysql[$i] = $newsql; |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | { |
288 | 288 | if ($sql) |
289 | 289 | { |
290 | - // Replace the prefix tables |
|
291 | - if (MAIN_DB_PREFIX != 'llx_') |
|
292 | - { |
|
293 | - $sql=preg_replace('/llx_/i',MAIN_DB_PREFIX,$sql); |
|
294 | - } |
|
290 | + // Replace the prefix tables |
|
291 | + if (MAIN_DB_PREFIX != 'llx_') |
|
292 | + { |
|
293 | + $sql=preg_replace('/llx_/i',MAIN_DB_PREFIX,$sql); |
|
294 | + } |
|
295 | 295 | |
296 | 296 | if (!empty($handler)) $sql=preg_replace('/__HANDLER__/i',"'".$handler."'",$sql); |
297 | 297 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) |
301 | 301 | if (! $silent) print '<tr><td class="tdtop">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n"; |
302 | 302 | dol_syslog('Admin.lib::run_sql Request '.($i+1), LOG_DEBUG); |
303 | - $sqlmodified=0; |
|
303 | + $sqlmodified=0; |
|
304 | 304 | |
305 | 305 | // Replace for encrypt data |
306 | 306 | if (preg_match_all('/__ENCRYPT\(\'([^\']+)\'\)__/i',$newsql,$reg)) |
@@ -372,33 +372,33 @@ discard block |
||
372 | 372 | $errno=$db->errno(); |
373 | 373 | if (! $silent) print '<!-- Result = '.$errno.' -->'."\n"; |
374 | 374 | |
375 | - // Define list of errors we accept (array $okerrors) |
|
376 | - $okerrors=array( // By default |
|
377 | - 'DB_ERROR_TABLE_ALREADY_EXISTS', |
|
378 | - 'DB_ERROR_COLUMN_ALREADY_EXISTS', |
|
379 | - 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', |
|
380 | - 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS', // PgSql use same code for table and key already exist |
|
381 | - 'DB_ERROR_RECORD_ALREADY_EXISTS', |
|
382 | - 'DB_ERROR_NOSUCHTABLE', |
|
383 | - 'DB_ERROR_NOSUCHFIELD', |
|
384 | - 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP', |
|
385 | - 'DB_ERROR_NO_INDEX_TO_DROP', |
|
386 | - 'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante |
|
387 | - 'DB_ERROR_CANT_DROP_PRIMARY_KEY', |
|
388 | - 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS', |
|
389 | - 'DB_ERROR_22P02' |
|
390 | - ); |
|
375 | + // Define list of errors we accept (array $okerrors) |
|
376 | + $okerrors=array( // By default |
|
377 | + 'DB_ERROR_TABLE_ALREADY_EXISTS', |
|
378 | + 'DB_ERROR_COLUMN_ALREADY_EXISTS', |
|
379 | + 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', |
|
380 | + 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS', // PgSql use same code for table and key already exist |
|
381 | + 'DB_ERROR_RECORD_ALREADY_EXISTS', |
|
382 | + 'DB_ERROR_NOSUCHTABLE', |
|
383 | + 'DB_ERROR_NOSUCHFIELD', |
|
384 | + 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP', |
|
385 | + 'DB_ERROR_NO_INDEX_TO_DROP', |
|
386 | + 'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante |
|
387 | + 'DB_ERROR_CANT_DROP_PRIMARY_KEY', |
|
388 | + 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS', |
|
389 | + 'DB_ERROR_22P02' |
|
390 | + ); |
|
391 | 391 | if ($okerror == 'none') $okerrors=array(); |
392 | 392 | |
393 | 393 | // Is it an error we accept |
394 | - if (! in_array($errno,$okerrors)) |
|
395 | - { |
|
396 | - if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
397 | - if (! $silent) print '<div class="error">'.$langs->trans("Error")." ".$db->errno().": ".$newsql."<br>".$db->error()."</div></td>"; |
|
398 | - if (! $silent) print '</tr>'."\n"; |
|
399 | - dol_syslog('Admin.lib::run_sql Request '.($i+1)." Error ".$db->errno()." ".$newsql."<br>".$db->error(), LOG_ERR); |
|
400 | - $error++; |
|
401 | - } |
|
394 | + if (! in_array($errno,$okerrors)) |
|
395 | + { |
|
396 | + if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
397 | + if (! $silent) print '<div class="error">'.$langs->trans("Error")." ".$db->errno().": ".$newsql."<br>".$db->error()."</div></td>"; |
|
398 | + if (! $silent) print '</tr>'."\n"; |
|
399 | + dol_syslog('Admin.lib::run_sql Request '.($i+1)." Error ".$db->errno()." ".$newsql."<br>".$db->error(), LOG_ERR); |
|
400 | + $error++; |
|
401 | + } |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | if (! $silent) print '</tr>'."\n"; |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | |
439 | 439 | if (empty($name)) |
440 | 440 | { |
441 | - dol_print_error('','Error call dolibar_del_const with parameter name empty'); |
|
442 | - return -1; |
|
441 | + dol_print_error('','Error call dolibar_del_const with parameter name empty'); |
|
442 | + return -1; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; |
@@ -570,31 +570,31 @@ discard block |
||
570 | 570 | */ |
571 | 571 | function modules_prepare_head() |
572 | 572 | { |
573 | - global $langs, $conf, $user; |
|
574 | - $h = 0; |
|
575 | - $head = array(); |
|
576 | - |
|
577 | - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common"; |
|
578 | - $head[$h][1] = $langs->trans("AvailableModules"); |
|
579 | - $head[$h][2] = 'common'; |
|
580 | - $h++; |
|
581 | - |
|
582 | - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace"; |
|
583 | - $head[$h][1] = $langs->trans("ModulesMarketPlaces"); |
|
584 | - $head[$h][2] = 'marketplace'; |
|
585 | - $h++; |
|
586 | - |
|
587 | - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=deploy"; |
|
588 | - $head[$h][1] = $langs->trans("AddExtensionThemeModuleOrOther"); |
|
589 | - $head[$h][2] = 'deploy'; |
|
590 | - $h++; |
|
591 | - |
|
592 | - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=develop"; |
|
593 | - $head[$h][1] = $langs->trans("ModulesDevelopYourModule"); |
|
594 | - $head[$h][2] = 'develop'; |
|
595 | - $h++; |
|
596 | - |
|
597 | - return $head; |
|
573 | + global $langs, $conf, $user; |
|
574 | + $h = 0; |
|
575 | + $head = array(); |
|
576 | + |
|
577 | + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common"; |
|
578 | + $head[$h][1] = $langs->trans("AvailableModules"); |
|
579 | + $head[$h][2] = 'common'; |
|
580 | + $h++; |
|
581 | + |
|
582 | + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace"; |
|
583 | + $head[$h][1] = $langs->trans("ModulesMarketPlaces"); |
|
584 | + $head[$h][2] = 'marketplace'; |
|
585 | + $h++; |
|
586 | + |
|
587 | + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=deploy"; |
|
588 | + $head[$h][1] = $langs->trans("AddExtensionThemeModuleOrOther"); |
|
589 | + $head[$h][2] = 'deploy'; |
|
590 | + $h++; |
|
591 | + |
|
592 | + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=develop"; |
|
593 | + $head[$h][1] = $langs->trans("ModulesDevelopYourModule"); |
|
594 | + $head[$h][2] = 'develop'; |
|
595 | + $h++; |
|
596 | + |
|
597 | + return $head; |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | |
@@ -653,8 +653,8 @@ discard block |
||
653 | 653 | $resql = $db->query($sql); |
654 | 654 | if ($resql) |
655 | 655 | { |
656 | - $obj = $db->fetch_object($resql); |
|
657 | - if ($obj) $nbPerms = $obj->nb; |
|
656 | + $obj = $db->fetch_object($resql); |
|
657 | + if ($obj) $nbPerms = $obj->nb; |
|
658 | 658 | } |
659 | 659 | else dol_print_error($db); |
660 | 660 | |
@@ -726,15 +726,15 @@ discard block |
||
726 | 726 | |
727 | 727 | if (! empty($conf->use_javascript_ajax)) |
728 | 728 | { |
729 | - $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus"; |
|
730 | - $head[$h][1] = $langs->trans("DefaultFocus"); |
|
731 | - $head[$h][2] = 'focus'; |
|
732 | - $h++; |
|
733 | - |
|
734 | - $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=mandatory"; |
|
735 | - $head[$h][1] = $langs->trans("DefaultMandatory"); |
|
736 | - $head[$h][2] = 'mandatory'; |
|
737 | - $h++; |
|
729 | + $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus"; |
|
730 | + $head[$h][1] = $langs->trans("DefaultFocus"); |
|
731 | + $head[$h][2] = 'focus'; |
|
732 | + $h++; |
|
733 | + |
|
734 | + $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=mandatory"; |
|
735 | + $head[$h][1] = $langs->trans("DefaultMandatory"); |
|
736 | + $head[$h][2] = 'mandatory'; |
|
737 | + $h++; |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | /*$head[$h][0] = DOL_URL_ROOT."/admin/translation.php?mode=searchkey"; |
@@ -782,9 +782,9 @@ discard block |
||
782 | 782 | { |
783 | 783 | $sessValues = file_get_contents($fullpath); // get raw session data |
784 | 784 | // Example of possible value |
785 | - //$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f"; |
|
786 | - // dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920"; |
|
787 | - // dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";'; |
|
785 | + //$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f"; |
|
786 | + // dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920"; |
|
787 | + // dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";'; |
|
788 | 788 | |
789 | 789 | if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session |
790 | 790 | (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity |
@@ -868,11 +868,11 @@ discard block |
||
868 | 868 | { |
869 | 869 | global $db, $modules, $langs, $conf, $mysoc; |
870 | 870 | |
871 | - // Check parameters |
|
872 | - if (empty($value)) { |
|
873 | - $ret['errors'][] = 'ErrorBadParameter'; |
|
874 | - return $ret; |
|
875 | - } |
|
871 | + // Check parameters |
|
872 | + if (empty($value)) { |
|
873 | + $ret['errors'][] = 'ErrorBadParameter'; |
|
874 | + return $ret; |
|
875 | + } |
|
876 | 876 | |
877 | 877 | $ret=array('nbmodules'=>0, 'errors'=>array(), 'nbperms'=>0); |
878 | 878 | $modName = $value; |
@@ -897,28 +897,28 @@ discard block |
||
897 | 897 | // Test if PHP version ok |
898 | 898 | $verphp=versionphparray(); |
899 | 899 | $vermin=isset($objMod->phpmin)?$objMod->phpmin:0; |
900 | - if (is_array($vermin) && versioncompare($verphp, $vermin) < 0) { |
|
901 | - $ret['errors'][] = $langs->trans("ErrorModuleRequirePHPVersion", versiontostring($vermin)); |
|
902 | - return $ret; |
|
903 | - } |
|
900 | + if (is_array($vermin) && versioncompare($verphp, $vermin) < 0) { |
|
901 | + $ret['errors'][] = $langs->trans("ErrorModuleRequirePHPVersion", versiontostring($vermin)); |
|
902 | + return $ret; |
|
903 | + } |
|
904 | 904 | |
905 | 905 | // Test if Dolibarr version ok |
906 | 906 | $verdol=versiondolibarrarray(); |
907 | 907 | $vermin=isset($objMod->need_dolibarr_version)?$objMod->need_dolibarr_version:0; |
908 | 908 | //print 'version: '.versioncompare($verdol,$vermin).' - '.join(',',$verdol).' - '.join(',',$vermin);exit; |
909 | - if (is_array($vermin) && versioncompare($verdol, $vermin) < 0) { |
|
910 | - $ret['errors'][] = $langs->trans("ErrorModuleRequireDolibarrVersion", versiontostring($vermin)); |
|
911 | - return $ret; |
|
912 | - } |
|
913 | - |
|
914 | - // Test if javascript requirement ok |
|
915 | - if (!empty($objMod->need_javascript_ajax) && empty($conf->use_javascript_ajax)) { |
|
916 | - $ret['errors'][] = $langs->trans("ErrorModuleRequireJavascript"); |
|
917 | - return $ret; |
|
918 | - } |
|
919 | - |
|
920 | - $const_name = $objMod->const_name; |
|
921 | - if(!empty($conf->global->$const_name)){ |
|
909 | + if (is_array($vermin) && versioncompare($verdol, $vermin) < 0) { |
|
910 | + $ret['errors'][] = $langs->trans("ErrorModuleRequireDolibarrVersion", versiontostring($vermin)); |
|
911 | + return $ret; |
|
912 | + } |
|
913 | + |
|
914 | + // Test if javascript requirement ok |
|
915 | + if (!empty($objMod->need_javascript_ajax) && empty($conf->use_javascript_ajax)) { |
|
916 | + $ret['errors'][] = $langs->trans("ErrorModuleRequireJavascript"); |
|
917 | + return $ret; |
|
918 | + } |
|
919 | + |
|
920 | + $const_name = $objMod->const_name; |
|
921 | + if(!empty($conf->global->$const_name)){ |
|
922 | 922 | return $ret; |
923 | 923 | } |
924 | 924 | |
@@ -938,38 +938,38 @@ discard block |
||
938 | 938 | // this->depends may be array('modModule1', 'mmodModule2') or array('always1'=>"modModule1", 'FR'=>'modModule2') |
939 | 939 | foreach ($objMod->depends as $key => $modulestring) |
940 | 940 | { |
941 | - //var_dump((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key));exit; |
|
942 | - if ((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key)) |
|
941 | + //var_dump((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key));exit; |
|
942 | + if ((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key)) |
|
943 | 943 | { |
944 | 944 | dol_syslog("We are not concerned by dependency with key=".$key." because our country is ".$mysoc->country_code); |
945 | 945 | continue; |
946 | 946 | } |
947 | - $activate = false; |
|
948 | - foreach ($modulesdir as $dir) |
|
949 | - { |
|
950 | - if (file_exists($dir.$modulestring.".class.php")) |
|
951 | - { |
|
952 | - $resarray = activateModule($modulestring); |
|
953 | - if (empty($resarray['errors'])){ |
|
954 | - $activate = true; |
|
947 | + $activate = false; |
|
948 | + foreach ($modulesdir as $dir) |
|
949 | + { |
|
950 | + if (file_exists($dir.$modulestring.".class.php")) |
|
951 | + { |
|
952 | + $resarray = activateModule($modulestring); |
|
953 | + if (empty($resarray['errors'])){ |
|
954 | + $activate = true; |
|
955 | 955 | }else{ |
956 | - foreach ($resarray['errors'] as $errorMessage){ |
|
956 | + foreach ($resarray['errors'] as $errorMessage){ |
|
957 | 957 | dol_syslog($errorMessage, LOG_ERR); |
958 | 958 | } |
959 | 959 | } |
960 | - break; |
|
961 | - } |
|
962 | - } |
|
963 | - |
|
964 | - if ($activate) |
|
965 | - { |
|
966 | - $ret['nbmodules']+=$resarray['nbmodules']; |
|
967 | - $ret['nbperms']+=$resarray['nbperms']; |
|
968 | - } |
|
969 | - else |
|
970 | - { |
|
971 | - $ret['errors'][] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $modulestring); |
|
972 | - } |
|
960 | + break; |
|
961 | + } |
|
962 | + } |
|
963 | + |
|
964 | + if ($activate) |
|
965 | + { |
|
966 | + $ret['nbmodules']+=$resarray['nbmodules']; |
|
967 | + $ret['nbperms']+=$resarray['nbperms']; |
|
968 | + } |
|
969 | + else |
|
970 | + { |
|
971 | + $ret['errors'][] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $modulestring); |
|
972 | + } |
|
973 | 973 | } |
974 | 974 | } |
975 | 975 | |
@@ -979,13 +979,13 @@ discard block |
||
979 | 979 | $num = count($objMod->conflictwith); |
980 | 980 | for ($i = 0; $i < $num; $i++) |
981 | 981 | { |
982 | - foreach ($modulesdir as $dir) |
|
983 | - { |
|
984 | - if (file_exists($dir.$objMod->conflictwith[$i].".class.php")) |
|
985 | - { |
|
986 | - unActivateModule($objMod->conflictwith[$i],0); |
|
987 | - } |
|
988 | - } |
|
982 | + foreach ($modulesdir as $dir) |
|
983 | + { |
|
984 | + if (file_exists($dir.$objMod->conflictwith[$i].".class.php")) |
|
985 | + { |
|
986 | + unActivateModule($objMod->conflictwith[$i],0); |
|
987 | + } |
|
988 | + } |
|
989 | 989 | } |
990 | 990 | } |
991 | 991 | } |
@@ -1042,9 +1042,9 @@ discard block |
||
1042 | 1042 | else |
1043 | 1043 | { |
1044 | 1044 | //print $dir.$modFile; |
1045 | - // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded |
|
1045 | + // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded |
|
1046 | 1046 | include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
1047 | - $genericMod = new DolibarrModules($db); |
|
1047 | + $genericMod = new DolibarrModules($db); |
|
1048 | 1048 | $genericMod->name=preg_replace('/^mod/i','',$modName); |
1049 | 1049 | $genericMod->rights_class=strtolower(preg_replace('/^mod/i','',$modName)); |
1050 | 1050 | $genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',$modName)); |
@@ -1090,15 +1090,15 @@ discard block |
||
1090 | 1090 | global $db, $modules, $conf, $langs; |
1091 | 1091 | |
1092 | 1092 | // Search modules |
1093 | - $modulesdir = dolGetModulesDirs(); |
|
1093 | + $modulesdir = dolGetModulesDirs(); |
|
1094 | 1094 | $i = 0; // is a sequencer of modules found |
1095 | 1095 | $j = 0; // j is module number. Automatically affected if module number not defined. |
1096 | 1096 | |
1097 | 1097 | foreach ($modulesdir as $dir) |
1098 | 1098 | { |
1099 | - // Load modules attributes in arrays (name, numero, orders) from dir directory |
|
1100 | - //print $dir."\n<br>"; |
|
1101 | - dol_syslog("Scan directory ".$dir." for modules"); |
|
1099 | + // Load modules attributes in arrays (name, numero, orders) from dir directory |
|
1100 | + //print $dir."\n<br>"; |
|
1101 | + dol_syslog("Scan directory ".$dir." for modules"); |
|
1102 | 1102 | $handle=@opendir(dol_osencode($dir)); |
1103 | 1103 | if (is_resource($handle)) |
1104 | 1104 | { |
@@ -1134,12 +1134,12 @@ discard block |
||
1134 | 1134 | |
1135 | 1135 | if ($modulequalified) |
1136 | 1136 | { |
1137 | - // Load languages files of module |
|
1138 | - if (isset($objMod->langfiles) && is_array($objMod->langfiles)) { |
|
1139 | - foreach ($objMod->langfiles as $langfile) { |
|
1140 | - $langs->load($langfile); |
|
1141 | - } |
|
1142 | - } |
|
1137 | + // Load languages files of module |
|
1138 | + if (isset($objMod->langfiles) && is_array($objMod->langfiles)) { |
|
1139 | + foreach ($objMod->langfiles as $langfile) { |
|
1140 | + $langs->load($langfile); |
|
1141 | + } |
|
1142 | + } |
|
1143 | 1143 | |
1144 | 1144 | // Complete the arrays &$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond |
1145 | 1145 | if (empty($objMod->dictionaries) && ! empty($objMod->dictionnaries)) $objMod->dictionaries=$objMod->dictionnaries; // For backward compatibility |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | else |
1169 | 1169 | { |
1170 | - $taborder[] = 0; // Add an empty line |
|
1170 | + $taborder[] = 0; // Add an empty line |
|
1171 | 1171 | } |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1197,60 +1197,60 @@ discard block |
||
1197 | 1197 | */ |
1198 | 1198 | function activateModulesRequiredByCountry($country_code) |
1199 | 1199 | { |
1200 | - global $db, $conf, $langs; |
|
1201 | - |
|
1202 | - $modulesdir = dolGetModulesDirs(); |
|
1203 | - |
|
1204 | - foreach ($modulesdir as $dir) |
|
1205 | - { |
|
1206 | - // Load modules attributes in arrays (name, numero, orders) from dir directory |
|
1207 | - dol_syslog("Scan directory ".$dir." for modules"); |
|
1208 | - $handle=@opendir(dol_osencode($dir)); |
|
1209 | - if (is_resource($handle)) |
|
1210 | - { |
|
1211 | - while (($file = readdir($handle))!==false) |
|
1212 | - { |
|
1213 | - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1214 | - { |
|
1215 | - $modName = substr($file, 0, dol_strlen($file) - 10); |
|
1216 | - |
|
1217 | - if ($modName) |
|
1218 | - { |
|
1219 | - include_once $dir.$file; |
|
1220 | - $objMod = new $modName($db); |
|
1221 | - |
|
1222 | - $modulequalified=1; |
|
1223 | - |
|
1224 | - // We discard modules according to features level (PS: if module is activated we always show it) |
|
1225 | - $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
|
1226 | - |
|
1227 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; |
|
1228 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; |
|
1229 | - if(!empty($conf->global->$const_name)) $modulequalified=0; // already activated |
|
1230 | - |
|
1231 | - if ($modulequalified) |
|
1232 | - { |
|
1233 | - // Load languages files of module |
|
1234 | - if (isset($objMod->automatic_activation) && is_array($objMod->automatic_activation) && isset($objMod->automatic_activation[$country_code])) |
|
1235 | - { |
|
1236 | - activateModule($modName); |
|
1237 | - |
|
1238 | - setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings'); |
|
1239 | - } |
|
1240 | - } |
|
1241 | - else dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1242 | - } |
|
1243 | - } |
|
1244 | - } |
|
1245 | - closedir($handle); |
|
1246 | - } |
|
1247 | - else |
|
1248 | - { |
|
1249 | - dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); |
|
1250 | - } |
|
1251 | - } |
|
1252 | - |
|
1253 | - return 1; |
|
1200 | + global $db, $conf, $langs; |
|
1201 | + |
|
1202 | + $modulesdir = dolGetModulesDirs(); |
|
1203 | + |
|
1204 | + foreach ($modulesdir as $dir) |
|
1205 | + { |
|
1206 | + // Load modules attributes in arrays (name, numero, orders) from dir directory |
|
1207 | + dol_syslog("Scan directory ".$dir." for modules"); |
|
1208 | + $handle=@opendir(dol_osencode($dir)); |
|
1209 | + if (is_resource($handle)) |
|
1210 | + { |
|
1211 | + while (($file = readdir($handle))!==false) |
|
1212 | + { |
|
1213 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1214 | + { |
|
1215 | + $modName = substr($file, 0, dol_strlen($file) - 10); |
|
1216 | + |
|
1217 | + if ($modName) |
|
1218 | + { |
|
1219 | + include_once $dir.$file; |
|
1220 | + $objMod = new $modName($db); |
|
1221 | + |
|
1222 | + $modulequalified=1; |
|
1223 | + |
|
1224 | + // We discard modules according to features level (PS: if module is activated we always show it) |
|
1225 | + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
|
1226 | + |
|
1227 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; |
|
1228 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; |
|
1229 | + if(!empty($conf->global->$const_name)) $modulequalified=0; // already activated |
|
1230 | + |
|
1231 | + if ($modulequalified) |
|
1232 | + { |
|
1233 | + // Load languages files of module |
|
1234 | + if (isset($objMod->automatic_activation) && is_array($objMod->automatic_activation) && isset($objMod->automatic_activation[$country_code])) |
|
1235 | + { |
|
1236 | + activateModule($modName); |
|
1237 | + |
|
1238 | + setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings'); |
|
1239 | + } |
|
1240 | + } |
|
1241 | + else dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1242 | + } |
|
1243 | + } |
|
1244 | + } |
|
1245 | + closedir($handle); |
|
1246 | + } |
|
1247 | + else |
|
1248 | + { |
|
1249 | + dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); |
|
1250 | + } |
|
1251 | + } |
|
1252 | + |
|
1253 | + return 1; |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | /** |
@@ -1277,9 +1277,9 @@ discard block |
||
1277 | 1277 | |
1278 | 1278 | foreach ($modulesdir as $dir) |
1279 | 1279 | { |
1280 | - // Load modules attributes in arrays (name, numero, orders) from dir directory |
|
1281 | - //print $dir."\n<br>"; |
|
1282 | - dol_syslog("Scan directory ".$dir." for modules"); |
|
1280 | + // Load modules attributes in arrays (name, numero, orders) from dir directory |
|
1281 | + //print $dir."\n<br>"; |
|
1282 | + dol_syslog("Scan directory ".$dir." for modules"); |
|
1283 | 1283 | $handle=@opendir(dol_osencode($dir)); |
1284 | 1284 | if (is_resource($handle)) |
1285 | 1285 | { |
@@ -1315,14 +1315,14 @@ discard block |
||
1315 | 1315 | |
1316 | 1316 | if ($modulequalified) |
1317 | 1317 | { |
1318 | - // Load languages files of module |
|
1318 | + // Load languages files of module |
|
1319 | 1319 | if (isset($objMod->langfiles) && is_array($objMod->langfiles)) |
1320 | 1320 | { |
1321 | - foreach($objMod->langfiles as $langfile) |
|
1322 | - { |
|
1323 | - $langs->load($langfile); |
|
1324 | - } |
|
1325 | - } |
|
1321 | + foreach($objMod->langfiles as $langfile) |
|
1322 | + { |
|
1323 | + $langs->load($langfile); |
|
1324 | + } |
|
1325 | + } |
|
1326 | 1326 | |
1327 | 1327 | $modules[$i] = $objMod; |
1328 | 1328 | $filename[$i]= $modName; |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | |
1333 | 1333 | if (! empty($objMod->module_parts['contactelement'])) |
1334 | 1334 | { |
1335 | - $elementList[$objMod->name] = $langs->trans($objMod->name); |
|
1335 | + $elementList[$objMod->name] = $langs->trans($objMod->name); |
|
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | $j++; |
@@ -1385,25 +1385,25 @@ discard block |
||
1385 | 1385 | $listofparam=array(); |
1386 | 1386 | foreach($tableau as $key => $const) // Loop on each param |
1387 | 1387 | { |
1388 | - $label=''; |
|
1389 | - // $const is a const key like 'MYMODULE_ABC' |
|
1390 | - if (is_numeric($key)) { // Very old behaviour |
|
1391 | - $type = 'string'; |
|
1392 | - } |
|
1393 | - else |
|
1394 | - { |
|
1395 | - if (is_array($const)) |
|
1396 | - { |
|
1397 | - $type = $const['type']; |
|
1398 | - $label = $const['label']; |
|
1399 | - $const = $key; |
|
1400 | - } |
|
1401 | - else |
|
1402 | - { |
|
1403 | - $type = $const; |
|
1404 | - $const = $key; |
|
1405 | - } |
|
1406 | - } |
|
1388 | + $label=''; |
|
1389 | + // $const is a const key like 'MYMODULE_ABC' |
|
1390 | + if (is_numeric($key)) { // Very old behaviour |
|
1391 | + $type = 'string'; |
|
1392 | + } |
|
1393 | + else |
|
1394 | + { |
|
1395 | + if (is_array($const)) |
|
1396 | + { |
|
1397 | + $type = $const['type']; |
|
1398 | + $label = $const['label']; |
|
1399 | + $const = $key; |
|
1400 | + } |
|
1401 | + else |
|
1402 | + { |
|
1403 | + $type = $const; |
|
1404 | + $const = $key; |
|
1405 | + } |
|
1406 | + } |
|
1407 | 1407 | |
1408 | 1408 | $sql = "SELECT "; |
1409 | 1409 | $sql.= "rowid"; |
@@ -1424,13 +1424,13 @@ discard block |
||
1424 | 1424 | |
1425 | 1425 | if (empty($obj)) // If not yet into table |
1426 | 1426 | { |
1427 | - $obj = (object) array('rowid'=>'','name'=>$const,'value'=>'','type'=>$type,'note'=>''); |
|
1427 | + $obj = (object) array('rowid'=>'','name'=>$const,'value'=>'','type'=>$type,'note'=>''); |
|
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | if (empty($strictw3c)) |
1431 | 1431 | { |
1432 | - print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
1433 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
1432 | + print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
1433 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
1434 | 1434 | } |
1435 | 1435 | |
1436 | 1436 | print '<tr class="oddeven">'; |
@@ -1463,14 +1463,14 @@ discard block |
||
1463 | 1463 | } |
1464 | 1464 | if ($const == 'ADHERENT_MAILMAN_LISTS') |
1465 | 1465 | { |
1466 | - print '. '.$langs->trans("Example").': <a href="#" id="exampleclick3">'.img_down().'</a><br>'; |
|
1467 | - print '<div id="example3" class="hidden">'; |
|
1468 | - print 'mymailmanlist<br>'; |
|
1469 | - print 'mymailmanlist1,mymailmanlist2<br>'; |
|
1470 | - print 'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>'; |
|
1471 | - if ($conf->categorie->enabled) print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>'; |
|
1472 | - print '</div>'; |
|
1473 | - //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; |
|
1466 | + print '. '.$langs->trans("Example").': <a href="#" id="exampleclick3">'.img_down().'</a><br>'; |
|
1467 | + print '<div id="example3" class="hidden">'; |
|
1468 | + print 'mymailmanlist<br>'; |
|
1469 | + print 'mymailmanlist1,mymailmanlist2<br>'; |
|
1470 | + print 'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>'; |
|
1471 | + if ($conf->categorie->enabled) print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>'; |
|
1472 | + print '</div>'; |
|
1473 | + //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; |
|
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | print "</td>\n"; |
@@ -1504,37 +1504,37 @@ discard block |
||
1504 | 1504 | } |
1505 | 1505 | elseif ($obj->type == 'html') |
1506 | 1506 | { |
1507 | - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
1508 | - $doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,ROWS_5,'90%'); |
|
1509 | - $doleditor->Create(); |
|
1507 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
1508 | + $doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,ROWS_5,'90%'); |
|
1509 | + $doleditor->Create(); |
|
1510 | 1510 | } |
1511 | 1511 | elseif ($obj->type == 'yesno') |
1512 | 1512 | { |
1513 | - print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1); |
|
1513 | + print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1); |
|
1514 | 1514 | } |
1515 | 1515 | elseif (preg_match('/emailtemplate/', $obj->type)) |
1516 | 1516 | { |
1517 | - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
1518 | - $formmail = new FormMail($db); |
|
1519 | - |
|
1520 | - $tmp=explode(':', $obj->type); |
|
1521 | - |
|
1522 | - $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1); // We set lang=null to get in priority record with no lang |
|
1523 | - //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); |
|
1524 | - $arrayofmessagename=array(); |
|
1525 | - if (is_array($formmail->lines_model)) |
|
1526 | - { |
|
1527 | - foreach($formmail->lines_model as $modelmail) |
|
1528 | - { |
|
1529 | - //var_dump($modelmail); |
|
1530 | - $moreonlabel=''; |
|
1531 | - if (! empty($arrayofmessagename[$modelmail->label])) $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; |
|
1532 | - $arrayofmessagename[$modelmail->label]=$langs->trans(preg_replace('/\(|\)/','',$modelmail->label)).$moreonlabel; |
|
1533 | - } |
|
1534 | - } |
|
1535 | - //var_dump($arraydefaultmessage); |
|
1536 | - //var_dump($arrayofmessagename); |
|
1537 | - print $form->selectarray('constvalue_'.$obj->name, $arrayofmessagename, $obj->value, 'None', 1, 0, '', 0, 0, 0, '', '', 1); |
|
1517 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
1518 | + $formmail = new FormMail($db); |
|
1519 | + |
|
1520 | + $tmp=explode(':', $obj->type); |
|
1521 | + |
|
1522 | + $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1); // We set lang=null to get in priority record with no lang |
|
1523 | + //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); |
|
1524 | + $arrayofmessagename=array(); |
|
1525 | + if (is_array($formmail->lines_model)) |
|
1526 | + { |
|
1527 | + foreach($formmail->lines_model as $modelmail) |
|
1528 | + { |
|
1529 | + //var_dump($modelmail); |
|
1530 | + $moreonlabel=''; |
|
1531 | + if (! empty($arrayofmessagename[$modelmail->label])) $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; |
|
1532 | + $arrayofmessagename[$modelmail->label]=$langs->trans(preg_replace('/\(|\)/','',$modelmail->label)).$moreonlabel; |
|
1533 | + } |
|
1534 | + } |
|
1535 | + //var_dump($arraydefaultmessage); |
|
1536 | + //var_dump($arrayofmessagename); |
|
1537 | + print $form->selectarray('constvalue_'.$obj->name, $arrayofmessagename, $obj->value, 'None', 1, 0, '', 0, 0, 0, '', '', 1); |
|
1538 | 1538 | } |
1539 | 1539 | else // type = 'string' ou 'chaine' |
1540 | 1540 | { |
@@ -1545,11 +1545,11 @@ discard block |
||
1545 | 1545 | // Submit |
1546 | 1546 | if (empty($strictw3c)) |
1547 | 1547 | { |
1548 | - print '<td align="center">'; |
|
1549 | - print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">'; |
|
1550 | - print "</td>"; |
|
1548 | + print '<td align="center">'; |
|
1549 | + print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">'; |
|
1550 | + print "</td>"; |
|
1551 | 1551 | } |
1552 | - print "</tr>\n"; |
|
1552 | + print "</tr>\n"; |
|
1553 | 1553 | if (empty($strictw3c)) print "</form>\n"; |
1554 | 1554 | } |
1555 | 1555 | } |
@@ -1557,8 +1557,8 @@ discard block |
||
1557 | 1557 | |
1558 | 1558 | if (! empty($strictw3c) && $strictw3c == 1) |
1559 | 1559 | { |
1560 | - print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>'; |
|
1561 | - print "</form>\n"; |
|
1560 | + print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>'; |
|
1561 | + print "</form>\n"; |
|
1562 | 1562 | } |
1563 | 1563 | } |
1564 | 1564 | |
@@ -1571,29 +1571,29 @@ discard block |
||
1571 | 1571 | */ |
1572 | 1572 | function showModulesExludedForExternal($modules) |
1573 | 1573 | { |
1574 | - global $conf,$langs; |
|
1575 | - |
|
1576 | - $text=$langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); |
|
1577 | - $listofmodules=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); |
|
1578 | - $i=0; |
|
1579 | - if (!empty($modules)) { |
|
1580 | - foreach($modules as $module) |
|
1581 | - { |
|
1582 | - $moduleconst=$module->const_name; |
|
1583 | - $modulename=strtolower($module->name); |
|
1584 | - //print 'modulename='.$modulename; |
|
1585 | - |
|
1586 | - //if (empty($conf->global->$moduleconst)) continue; |
|
1587 | - if (! in_array($modulename,$listofmodules)) continue; |
|
1588 | - //var_dump($modulename.' - '.$langs->trans('Module'.$module->numero.'Name')); |
|
1589 | - |
|
1590 | - if ($i > 0) $text.=', '; |
|
1591 | - else $text.=' '; |
|
1592 | - $i++; |
|
1593 | - $text .= $langs->trans('Module'.$module->numero.'Name'); |
|
1594 | - } |
|
1595 | - } |
|
1596 | - return $text; |
|
1574 | + global $conf,$langs; |
|
1575 | + |
|
1576 | + $text=$langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); |
|
1577 | + $listofmodules=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); |
|
1578 | + $i=0; |
|
1579 | + if (!empty($modules)) { |
|
1580 | + foreach($modules as $module) |
|
1581 | + { |
|
1582 | + $moduleconst=$module->const_name; |
|
1583 | + $modulename=strtolower($module->name); |
|
1584 | + //print 'modulename='.$modulename; |
|
1585 | + |
|
1586 | + //if (empty($conf->global->$moduleconst)) continue; |
|
1587 | + if (! in_array($modulename,$listofmodules)) continue; |
|
1588 | + //var_dump($modulename.' - '.$langs->trans('Module'.$module->numero.'Name')); |
|
1589 | + |
|
1590 | + if ($i > 0) $text.=', '; |
|
1591 | + else $text.=' '; |
|
1592 | + $i++; |
|
1593 | + $text .= $langs->trans('Module'.$module->numero.'Name'); |
|
1594 | + } |
|
1595 | + } |
|
1596 | + return $text; |
|
1597 | 1597 | } |
1598 | 1598 | |
1599 | 1599 | |
@@ -1608,9 +1608,9 @@ discard block |
||
1608 | 1608 | */ |
1609 | 1609 | function addDocumentModel($name, $type, $label='', $description='') |
1610 | 1610 | { |
1611 | - global $db, $conf; |
|
1611 | + global $db, $conf; |
|
1612 | 1612 | |
1613 | - $db->begin(); |
|
1613 | + $db->begin(); |
|
1614 | 1614 | |
1615 | 1615 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; |
1616 | 1616 | $sql.= " VALUES ('".$db->escape($name)."','".$type."',".$conf->entity.", "; |
@@ -1619,18 +1619,18 @@ discard block |
||
1619 | 1619 | $sql.= ")"; |
1620 | 1620 | |
1621 | 1621 | dol_syslog("admin.lib::addDocumentModel", LOG_DEBUG); |
1622 | - $resql=$db->query($sql); |
|
1623 | - if ($resql) |
|
1624 | - { |
|
1625 | - $db->commit(); |
|
1626 | - return 1; |
|
1627 | - } |
|
1628 | - else |
|
1629 | - { |
|
1630 | - dol_print_error($db); |
|
1631 | - $db->rollback(); |
|
1632 | - return -1; |
|
1633 | - } |
|
1622 | + $resql=$db->query($sql); |
|
1623 | + if ($resql) |
|
1624 | + { |
|
1625 | + $db->commit(); |
|
1626 | + return 1; |
|
1627 | + } |
|
1628 | + else |
|
1629 | + { |
|
1630 | + dol_print_error($db); |
|
1631 | + $db->rollback(); |
|
1632 | + return -1; |
|
1633 | + } |
|
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | /** |
@@ -1642,28 +1642,28 @@ discard block |
||
1642 | 1642 | */ |
1643 | 1643 | function delDocumentModel($name, $type) |
1644 | 1644 | { |
1645 | - global $db, $conf; |
|
1646 | - |
|
1647 | - $db->begin(); |
|
1648 | - |
|
1649 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; |
|
1650 | - $sql.= " WHERE nom = '".$db->escape($name)."'"; |
|
1651 | - $sql.= " AND type = '".$type."'"; |
|
1652 | - $sql.= " AND entity = ".$conf->entity; |
|
1653 | - |
|
1654 | - dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG); |
|
1655 | - $resql=$db->query($sql); |
|
1656 | - if ($resql) |
|
1657 | - { |
|
1658 | - $db->commit(); |
|
1659 | - return 1; |
|
1660 | - } |
|
1661 | - else |
|
1662 | - { |
|
1663 | - dol_print_error($db); |
|
1664 | - $db->rollback(); |
|
1665 | - return -1; |
|
1666 | - } |
|
1645 | + global $db, $conf; |
|
1646 | + |
|
1647 | + $db->begin(); |
|
1648 | + |
|
1649 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; |
|
1650 | + $sql.= " WHERE nom = '".$db->escape($name)."'"; |
|
1651 | + $sql.= " AND type = '".$type."'"; |
|
1652 | + $sql.= " AND entity = ".$conf->entity; |
|
1653 | + |
|
1654 | + dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG); |
|
1655 | + $resql=$db->query($sql); |
|
1656 | + if ($resql) |
|
1657 | + { |
|
1658 | + $db->commit(); |
|
1659 | + return 1; |
|
1660 | + } |
|
1661 | + else |
|
1662 | + { |
|
1663 | + dol_print_error($db); |
|
1664 | + $db->rollback(); |
|
1665 | + return -1; |
|
1666 | + } |
|
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
@@ -1674,25 +1674,25 @@ discard block |
||
1674 | 1674 | */ |
1675 | 1675 | function phpinfo_array() |
1676 | 1676 | { |
1677 | - ob_start(); |
|
1678 | - phpinfo(); |
|
1679 | - $info_arr = array(); |
|
1680 | - $info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>")); // end of ob_start() |
|
1681 | - $cat = "General"; |
|
1682 | - foreach($info_lines as $line) |
|
1683 | - { |
|
1684 | - // new cat? |
|
1685 | - preg_match("~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : null; |
|
1686 | - if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1687 | - { |
|
1688 | - $info_arr[trim($cat)][trim($val[1])] = $val[2]; |
|
1689 | - } |
|
1690 | - elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1691 | - { |
|
1692 | - $info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]); |
|
1693 | - } |
|
1694 | - } |
|
1695 | - return $info_arr; |
|
1677 | + ob_start(); |
|
1678 | + phpinfo(); |
|
1679 | + $info_arr = array(); |
|
1680 | + $info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>")); // end of ob_start() |
|
1681 | + $cat = "General"; |
|
1682 | + foreach($info_lines as $line) |
|
1683 | + { |
|
1684 | + // new cat? |
|
1685 | + preg_match("~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : null; |
|
1686 | + if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1687 | + { |
|
1688 | + $info_arr[trim($cat)][trim($val[1])] = $val[2]; |
|
1689 | + } |
|
1690 | + elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1691 | + { |
|
1692 | + $info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]); |
|
1693 | + } |
|
1694 | + } |
|
1695 | + return $info_arr; |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | /** |
@@ -1702,24 +1702,24 @@ discard block |
||
1702 | 1702 | */ |
1703 | 1703 | function company_admin_prepare_head() |
1704 | 1704 | { |
1705 | - global $langs, $conf, $user; |
|
1705 | + global $langs, $conf, $user; |
|
1706 | 1706 | |
1707 | - $h = 0; |
|
1708 | - $head = array(); |
|
1707 | + $h = 0; |
|
1708 | + $head = array(); |
|
1709 | 1709 | |
1710 | - $head[$h][0] = DOL_URL_ROOT."/admin/company.php"; |
|
1711 | - $head[$h][1] = $langs->trans("Company"); |
|
1712 | - $head[$h][2] = 'company'; |
|
1713 | - $h++; |
|
1710 | + $head[$h][0] = DOL_URL_ROOT."/admin/company.php"; |
|
1711 | + $head[$h][1] = $langs->trans("Company"); |
|
1712 | + $head[$h][2] = 'company'; |
|
1713 | + $h++; |
|
1714 | 1714 | |
1715 | - $head[$h][0] = DOL_URL_ROOT."/admin/accountant.php"; |
|
1716 | - $head[$h][1] = $langs->trans("Accountant"); |
|
1717 | - $head[$h][2] = 'accountant'; |
|
1718 | - $h++; |
|
1715 | + $head[$h][0] = DOL_URL_ROOT."/admin/accountant.php"; |
|
1716 | + $head[$h][1] = $langs->trans("Accountant"); |
|
1717 | + $head[$h][2] = 'accountant'; |
|
1718 | + $h++; |
|
1719 | 1719 | |
1720 | - complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove'); |
|
1720 | + complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove'); |
|
1721 | 1721 | |
1722 | - return $head; |
|
1722 | + return $head; |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | /** |
@@ -1729,43 +1729,43 @@ discard block |
||
1729 | 1729 | */ |
1730 | 1730 | function email_admin_prepare_head() |
1731 | 1731 | { |
1732 | - global $langs, $conf, $user; |
|
1733 | - |
|
1734 | - $h = 0; |
|
1735 | - $head = array(); |
|
1736 | - |
|
1737 | - if (! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1738 | - { |
|
1739 | - $head[$h][0] = DOL_URL_ROOT."/admin/mails.php"; |
|
1740 | - $head[$h][1] = $langs->trans("OutGoingEmailSetup"); |
|
1741 | - $head[$h][2] = 'common'; |
|
1742 | - $h++; |
|
1743 | - |
|
1744 | - if ($conf->mailing->enabled) |
|
1745 | - { |
|
1746 | - $head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php"; |
|
1747 | - $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing"); |
|
1748 | - $head[$h][2] = 'common_emailing'; |
|
1749 | - $h++; |
|
1750 | - } |
|
1751 | - } |
|
1752 | - |
|
1753 | - $head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php"; |
|
1754 | - $head[$h][1] = $langs->trans("EMailTemplates"); |
|
1755 | - $head[$h][2] = 'templates'; |
|
1756 | - $h++; |
|
1757 | - |
|
1758 | - if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && ! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1759 | - { |
|
1760 | - $head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php"; |
|
1761 | - $head[$h][1] = $langs->trans("EmailSenderProfiles"); |
|
1762 | - $head[$h][2] = 'senderprofiles'; |
|
1763 | - $h++; |
|
1764 | - } |
|
1765 | - |
|
1766 | - complete_head_from_modules($conf,$langs,null,$head,$h,'email_admin','remove'); |
|
1767 | - |
|
1768 | - return $head; |
|
1732 | + global $langs, $conf, $user; |
|
1733 | + |
|
1734 | + $h = 0; |
|
1735 | + $head = array(); |
|
1736 | + |
|
1737 | + if (! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1738 | + { |
|
1739 | + $head[$h][0] = DOL_URL_ROOT."/admin/mails.php"; |
|
1740 | + $head[$h][1] = $langs->trans("OutGoingEmailSetup"); |
|
1741 | + $head[$h][2] = 'common'; |
|
1742 | + $h++; |
|
1743 | + |
|
1744 | + if ($conf->mailing->enabled) |
|
1745 | + { |
|
1746 | + $head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php"; |
|
1747 | + $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing"); |
|
1748 | + $head[$h][2] = 'common_emailing'; |
|
1749 | + $h++; |
|
1750 | + } |
|
1751 | + } |
|
1752 | + |
|
1753 | + $head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php"; |
|
1754 | + $head[$h][1] = $langs->trans("EMailTemplates"); |
|
1755 | + $head[$h][2] = 'templates'; |
|
1756 | + $h++; |
|
1757 | + |
|
1758 | + if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && ! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1759 | + { |
|
1760 | + $head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php"; |
|
1761 | + $head[$h][1] = $langs->trans("EmailSenderProfiles"); |
|
1762 | + $head[$h][2] = 'senderprofiles'; |
|
1763 | + $h++; |
|
1764 | + } |
|
1765 | + |
|
1766 | + complete_head_from_modules($conf,$langs,null,$head,$h,'email_admin','remove'); |
|
1767 | + |
|
1768 | + return $head; |
|
1769 | 1769 | } |
1770 | 1770 | |
1771 | 1771 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \brief Library of admin functions |
25 | 25 | */ |
26 | 26 | |
27 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
27 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Renvoi une version en chaine depuis une version en tableau |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function versiontostring($versionarray) |
36 | 36 | { |
37 | - $string='?'; |
|
38 | - if (isset($versionarray[0])) $string=$versionarray[0]; |
|
39 | - if (isset($versionarray[1])) $string.='.'.$versionarray[1]; |
|
40 | - if (isset($versionarray[2])) $string.='.'.$versionarray[2]; |
|
37 | + $string = '?'; |
|
38 | + if (isset($versionarray[0])) $string = $versionarray[0]; |
|
39 | + if (isset($versionarray[1])) $string .= '.'.$versionarray[1]; |
|
40 | + if (isset($versionarray[2])) $string .= '.'.$versionarray[2]; |
|
41 | 41 | return $string; |
42 | 42 | } |
43 | 43 | |
@@ -55,27 +55,27 @@ discard block |
||
55 | 55 | * 0 if same |
56 | 56 | * 1,2,3,4 if versionarray1>versionarray2 (value depends on level of difference) |
57 | 57 | */ |
58 | -function versioncompare($versionarray1,$versionarray2) |
|
58 | +function versioncompare($versionarray1, $versionarray2) |
|
59 | 59 | { |
60 | - $ret=0; |
|
61 | - $level=0; |
|
62 | - $count1=count($versionarray1); |
|
63 | - $count2=count($versionarray2); |
|
64 | - $maxcount=max($count1,$count2); |
|
60 | + $ret = 0; |
|
61 | + $level = 0; |
|
62 | + $count1 = count($versionarray1); |
|
63 | + $count2 = count($versionarray2); |
|
64 | + $maxcount = max($count1, $count2); |
|
65 | 65 | while ($level < $maxcount) |
66 | 66 | { |
67 | - $operande1=isset($versionarray1[$level])?$versionarray1[$level]:0; |
|
68 | - $operande2=isset($versionarray2[$level])?$versionarray2[$level]:0; |
|
69 | - if (preg_match('/alpha|dev/i',$operande1)) $operande1=-5; |
|
70 | - if (preg_match('/alpha|dev/i',$operande2)) $operande2=-5; |
|
71 | - if (preg_match('/beta$/i',$operande1)) $operande1=-4; |
|
72 | - if (preg_match('/beta$/i',$operande2)) $operande2=-4; |
|
73 | - if (preg_match('/beta([0-9])+/i',$operande1)) $operande1=-3; |
|
74 | - if (preg_match('/beta([0-9])+/i',$operande2)) $operande2=-3; |
|
75 | - if (preg_match('/rc$/i',$operande1)) $operande1=-2; |
|
76 | - if (preg_match('/rc$/i',$operande2)) $operande2=-2; |
|
77 | - if (preg_match('/rc([0-9])+/i',$operande1)) $operande1=-1; |
|
78 | - if (preg_match('/rc([0-9])+/i',$operande2)) $operande2=-1; |
|
67 | + $operande1 = isset($versionarray1[$level]) ? $versionarray1[$level] : 0; |
|
68 | + $operande2 = isset($versionarray2[$level]) ? $versionarray2[$level] : 0; |
|
69 | + if (preg_match('/alpha|dev/i', $operande1)) $operande1 = -5; |
|
70 | + if (preg_match('/alpha|dev/i', $operande2)) $operande2 = -5; |
|
71 | + if (preg_match('/beta$/i', $operande1)) $operande1 = -4; |
|
72 | + if (preg_match('/beta$/i', $operande2)) $operande2 = -4; |
|
73 | + if (preg_match('/beta([0-9])+/i', $operande1)) $operande1 = -3; |
|
74 | + if (preg_match('/beta([0-9])+/i', $operande2)) $operande2 = -3; |
|
75 | + if (preg_match('/rc$/i', $operande1)) $operande1 = -2; |
|
76 | + if (preg_match('/rc$/i', $operande2)) $operande2 = -2; |
|
77 | + if (preg_match('/rc([0-9])+/i', $operande1)) $operande1 = -1; |
|
78 | + if (preg_match('/rc([0-9])+/i', $operande2)) $operande2 = -1; |
|
79 | 79 | $level++; |
80 | 80 | //print 'level '.$level.' '.$operande1.'-'.$operande2.'<br>'; |
81 | 81 | if ($operande1 < $operande2) { $ret = -$level; break; } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | function versionphparray() |
95 | 95 | { |
96 | - return explode('.',PHP_VERSION); |
|
96 | + return explode('.', PHP_VERSION); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function versiondolibarrarray() |
105 | 105 | { |
106 | - return explode('.',DOL_VERSION); |
|
106 | + return explode('.', DOL_VERSION); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -127,60 +127,60 @@ discard block |
||
127 | 127 | * @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value |
128 | 128 | * @return int <=0 if KO, >0 if OK |
129 | 129 | */ |
130 | -function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0) |
|
130 | +function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0) |
|
131 | 131 | { |
132 | 132 | global $db, $conf, $langs, $user; |
133 | 133 | |
134 | 134 | dol_syslog("Admin.lib::run_sql run sql file ".$sqlfile." silent=".$silent." entity=".$entity." usesavepoint=".$usesavepoint." handler=".$handler." okerror=".$okerror, LOG_DEBUG); |
135 | 135 | |
136 | - if (! is_numeric($linelengthlimit)) |
|
136 | + if (!is_numeric($linelengthlimit)) |
|
137 | 137 | { |
138 | 138 | dol_syslog("Admin.lib::run_sql param linelengthlimit is not a numeric", LOG_ERR); |
139 | 139 | return -1; |
140 | 140 | } |
141 | 141 | |
142 | - $ok=0; |
|
143 | - $error=0; |
|
144 | - $i=0; |
|
142 | + $ok = 0; |
|
143 | + $error = 0; |
|
144 | + $i = 0; |
|
145 | 145 | $buffer = ''; |
146 | 146 | $arraysql = array(); |
147 | 147 | |
148 | 148 | // Get version of database |
149 | - $versionarray=$db->getVersionArray(); |
|
149 | + $versionarray = $db->getVersionArray(); |
|
150 | 150 | |
151 | - $fp = fopen($sqlfile,"r"); |
|
151 | + $fp = fopen($sqlfile, "r"); |
|
152 | 152 | if ($fp) |
153 | 153 | { |
154 | - while (! feof($fp)) |
|
154 | + while (!feof($fp)) |
|
155 | 155 | { |
156 | 156 | // Warning fgets with second parameter that is null or 0 hang. |
157 | 157 | if ($linelengthlimit > 0) $buf = fgets($fp, $linelengthlimit); |
158 | 158 | else $buf = fgets($fp); |
159 | 159 | |
160 | 160 | // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment) |
161 | - if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i',$buf,$reg)) |
|
161 | + if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i', $buf, $reg)) |
|
162 | 162 | { |
163 | - $qualified=1; |
|
163 | + $qualified = 1; |
|
164 | 164 | |
165 | 165 | // restrict on database type |
166 | - if (! empty($reg[1])) |
|
166 | + if (!empty($reg[1])) |
|
167 | 167 | { |
168 | - if (! preg_match('/'.preg_quote($reg[1]).'/i',$db->type)) $qualified=0; |
|
168 | + if (!preg_match('/'.preg_quote($reg[1]).'/i', $db->type)) $qualified = 0; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | // restrict on version |
172 | 172 | if ($qualified) |
173 | 173 | { |
174 | - if (! empty($reg[2])) |
|
174 | + if (!empty($reg[2])) |
|
175 | 175 | { |
176 | 176 | if (is_numeric($reg[2])) // This is a version |
177 | 177 | { |
178 | - $versionrequest=explode('.',$reg[2]); |
|
178 | + $versionrequest = explode('.', $reg[2]); |
|
179 | 179 | //print var_dump($versionrequest); |
180 | 180 | //print var_dump($versionarray); |
181 | - if (! count($versionrequest) || ! count($versionarray) || versioncompare($versionrequest,$versionarray) > 0) |
|
181 | + if (!count($versionrequest) || !count($versionarray) || versioncompare($versionrequest, $versionarray) > 0) |
|
182 | 182 | { |
183 | - $qualified=0; |
|
183 | + $qualified = 0; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); |
189 | 189 | //var_dump($reg[2]); |
190 | 190 | //var_dump($dbcollation); |
191 | - if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) $qualified=0; |
|
191 | + if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) $qualified = 0; |
|
192 | 192 | //var_dump($qualified); |
193 | 193 | } |
194 | 194 | } |
@@ -197,30 +197,30 @@ discard block |
||
197 | 197 | if ($qualified) |
198 | 198 | { |
199 | 199 | // Version qualified, delete SQL comments |
200 | - $buf=preg_replace('/^--\sV(MYSQL|PGSQL)([^\s]*)/i','',$buf); |
|
200 | + $buf = preg_replace('/^--\sV(MYSQL|PGSQL)([^\s]*)/i', '', $buf); |
|
201 | 201 | //print "Ligne $i qualifi?e par version: ".$buf.'<br>'; |
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Add line buf to buffer if not a comment |
206 | - if ($nocommentremoval || ! preg_match('/^\s*--/',$buf)) |
|
206 | + if ($nocommentremoval || !preg_match('/^\s*--/', $buf)) |
|
207 | 207 | { |
208 | - if (empty($nocommentremoval)) $buf=preg_replace('/([,;ERLT\)])\s*--.*$/i','\1',$buf); //remove comment from a line that not start with -- before add it to the buffer |
|
208 | + if (empty($nocommentremoval)) $buf = preg_replace('/([,;ERLT\)])\s*--.*$/i', '\1', $buf); //remove comment from a line that not start with -- before add it to the buffer |
|
209 | 209 | $buffer .= trim($buf); |
210 | 210 | } |
211 | 211 | |
212 | 212 | //print $buf.'<br>';exit; |
213 | 213 | |
214 | - if (preg_match('/;/',$buffer)) // If string contains ';', it's end of a request string, we save it in arraysql. |
|
214 | + if (preg_match('/;/', $buffer)) // If string contains ';', it's end of a request string, we save it in arraysql. |
|
215 | 215 | { |
216 | 216 | // Found new request |
217 | - if ($buffer) $arraysql[$i]=$buffer; |
|
217 | + if ($buffer) $arraysql[$i] = $buffer; |
|
218 | 218 | $i++; |
219 | - $buffer=''; |
|
219 | + $buffer = ''; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | - if ($buffer) $arraysql[$i]=$buffer; |
|
223 | + if ($buffer) $arraysql[$i] = $buffer; |
|
224 | 224 | fclose($fp); |
225 | 225 | } |
226 | 226 | else |
@@ -229,42 +229,42 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // Loop on each request to see if there is a __+MAX_table__ key |
232 | - $listofmaxrowid=array(); // This is a cache table |
|
233 | - foreach($arraysql as $i => $sql) |
|
232 | + $listofmaxrowid = array(); // This is a cache table |
|
233 | + foreach ($arraysql as $i => $sql) |
|
234 | 234 | { |
235 | - $newsql=$sql; |
|
235 | + $newsql = $sql; |
|
236 | 236 | |
237 | 237 | // Replace __+MAX_table__ with max of table |
238 | - while (preg_match('/__\+MAX_([A-Za-z_]+)__/i',$newsql,$reg)) |
|
238 | + while (preg_match('/__\+MAX_([A-Za-z_]+)__/i', $newsql, $reg)) |
|
239 | 239 | { |
240 | - $table=$reg[1]; |
|
241 | - if (! isset($listofmaxrowid[$table])) |
|
240 | + $table = $reg[1]; |
|
241 | + if (!isset($listofmaxrowid[$table])) |
|
242 | 242 | { |
243 | 243 | //var_dump($db); |
244 | - $sqlgetrowid='SELECT MAX(rowid) as max from '.preg_replace('/^llx_/', MAIN_DB_PREFIX, $table); |
|
245 | - $resql=$db->query($sqlgetrowid); |
|
244 | + $sqlgetrowid = 'SELECT MAX(rowid) as max from '.preg_replace('/^llx_/', MAIN_DB_PREFIX, $table); |
|
245 | + $resql = $db->query($sqlgetrowid); |
|
246 | 246 | if ($resql) |
247 | 247 | { |
248 | - $obj=$db->fetch_object($resql); |
|
249 | - $listofmaxrowid[$table]=$obj->max; |
|
250 | - if (empty($listofmaxrowid[$table])) $listofmaxrowid[$table]=0; |
|
248 | + $obj = $db->fetch_object($resql); |
|
249 | + $listofmaxrowid[$table] = $obj->max; |
|
250 | + if (empty($listofmaxrowid[$table])) $listofmaxrowid[$table] = 0; |
|
251 | 251 | } |
252 | 252 | else |
253 | 253 | { |
254 | - if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
255 | - if (! $silent) print '<div class="error">'.$langs->trans("Failed to get max rowid for ".$table)."</div></td>"; |
|
256 | - if (! $silent) print '</tr>'; |
|
254 | + if (!$silent) print '<tr><td valign="top" colspan="2">'; |
|
255 | + if (!$silent) print '<div class="error">'.$langs->trans("Failed to get max rowid for ".$table)."</div></td>"; |
|
256 | + if (!$silent) print '</tr>'; |
|
257 | 257 | $error++; |
258 | 258 | break; |
259 | 259 | } |
260 | 260 | } |
261 | 261 | // Replace __+MAX_llx_table__ with +999 |
262 | - $from='__+MAX_'.$table.'__'; |
|
263 | - $to='+'.$listofmaxrowid[$table]; |
|
264 | - $newsql=str_replace($from, $to, $newsql); |
|
265 | - dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.')', LOG_DEBUG); |
|
262 | + $from = '__+MAX_'.$table.'__'; |
|
263 | + $to = '+'.$listofmaxrowid[$table]; |
|
264 | + $newsql = str_replace($from, $to, $newsql); |
|
265 | + dol_syslog('Admin.lib::run_sql New Request '.($i + 1).' (replacing '.$from.' to '.$to.')', LOG_DEBUG); |
|
266 | 266 | |
267 | - $arraysql[$i]=$newsql; |
|
267 | + $arraysql[$i] = $newsql; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | if ($offsetforchartofaccount > 0) |
@@ -281,140 +281,140 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | // Loop on each request to execute request |
284 | - $cursorinsert=0; |
|
285 | - $listofinsertedrowid=array(); |
|
286 | - foreach($arraysql as $i => $sql) |
|
284 | + $cursorinsert = 0; |
|
285 | + $listofinsertedrowid = array(); |
|
286 | + foreach ($arraysql as $i => $sql) |
|
287 | 287 | { |
288 | 288 | if ($sql) |
289 | 289 | { |
290 | 290 | // Replace the prefix tables |
291 | 291 | if (MAIN_DB_PREFIX != 'llx_') |
292 | 292 | { |
293 | - $sql=preg_replace('/llx_/i',MAIN_DB_PREFIX,$sql); |
|
293 | + $sql = preg_replace('/llx_/i', MAIN_DB_PREFIX, $sql); |
|
294 | 294 | } |
295 | 295 | |
296 | - if (!empty($handler)) $sql=preg_replace('/__HANDLER__/i',"'".$handler."'",$sql); |
|
296 | + if (!empty($handler)) $sql = preg_replace('/__HANDLER__/i', "'".$handler."'", $sql); |
|
297 | 297 | |
298 | - $newsql=preg_replace('/__ENTITY__/i',(!empty($entity)?$entity:$conf->entity),$sql); |
|
298 | + $newsql = preg_replace('/__ENTITY__/i', (!empty($entity) ? $entity : $conf->entity), $sql); |
|
299 | 299 | |
300 | 300 | // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) |
301 | - if (! $silent) print '<tr><td class="tdtop">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n"; |
|
302 | - dol_syslog('Admin.lib::run_sql Request '.($i+1), LOG_DEBUG); |
|
303 | - $sqlmodified=0; |
|
301 | + if (!$silent) print '<tr><td class="tdtop">'.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'</td></tr>\n"; |
|
302 | + dol_syslog('Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG); |
|
303 | + $sqlmodified = 0; |
|
304 | 304 | |
305 | 305 | // Replace for encrypt data |
306 | - if (preg_match_all('/__ENCRYPT\(\'([^\']+)\'\)__/i',$newsql,$reg)) |
|
306 | + if (preg_match_all('/__ENCRYPT\(\'([^\']+)\'\)__/i', $newsql, $reg)) |
|
307 | 307 | { |
308 | - $num=count($reg[0]); |
|
308 | + $num = count($reg[0]); |
|
309 | 309 | |
310 | - for($j=0;$j<$num;$j++) |
|
310 | + for ($j = 0; $j < $num; $j++) |
|
311 | 311 | { |
312 | - $from = $reg[0][$j]; |
|
313 | - $to = $db->encrypt($reg[1][$j],1); |
|
314 | - $newsql = str_replace($from,$to,$newsql); |
|
312 | + $from = $reg[0][$j]; |
|
313 | + $to = $db->encrypt($reg[1][$j], 1); |
|
314 | + $newsql = str_replace($from, $to, $newsql); |
|
315 | 315 | } |
316 | 316 | $sqlmodified++; |
317 | 317 | } |
318 | 318 | |
319 | 319 | // Replace for decrypt data |
320 | - if (preg_match_all('/__DECRYPT\(\'([A-Za-z0-9_]+)\'\)__/i',$newsql,$reg)) |
|
320 | + if (preg_match_all('/__DECRYPT\(\'([A-Za-z0-9_]+)\'\)__/i', $newsql, $reg)) |
|
321 | 321 | { |
322 | - $num=count($reg[0]); |
|
322 | + $num = count($reg[0]); |
|
323 | 323 | |
324 | - for($j=0;$j<$num;$j++) |
|
324 | + for ($j = 0; $j < $num; $j++) |
|
325 | 325 | { |
326 | - $from = $reg[0][$j]; |
|
327 | - $to = $db->decrypt($reg[1][$j]); |
|
328 | - $newsql = str_replace($from,$to,$newsql); |
|
326 | + $from = $reg[0][$j]; |
|
327 | + $to = $db->decrypt($reg[1][$j]); |
|
328 | + $newsql = str_replace($from, $to, $newsql); |
|
329 | 329 | } |
330 | 330 | $sqlmodified++; |
331 | 331 | } |
332 | 332 | |
333 | 333 | // Replace __x__ with rowid of insert nb x |
334 | - while (preg_match('/__([0-9]+)__/',$newsql,$reg)) |
|
334 | + while (preg_match('/__([0-9]+)__/', $newsql, $reg)) |
|
335 | 335 | { |
336 | - $cursor=$reg[1]; |
|
336 | + $cursor = $reg[1]; |
|
337 | 337 | if (empty($listofinsertedrowid[$cursor])) |
338 | 338 | { |
339 | - if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
340 | - if (! $silent) print '<div class="error">'.$langs->trans("FileIsNotCorrect")."</div></td>"; |
|
341 | - if (! $silent) print '</tr>'; |
|
339 | + if (!$silent) print '<tr><td valign="top" colspan="2">'; |
|
340 | + if (!$silent) print '<div class="error">'.$langs->trans("FileIsNotCorrect")."</div></td>"; |
|
341 | + if (!$silent) print '</tr>'; |
|
342 | 342 | $error++; |
343 | 343 | break; |
344 | 344 | } |
345 | - $from='__'.$cursor.'__'; |
|
346 | - $to=$listofinsertedrowid[$cursor]; |
|
347 | - $newsql=str_replace($from,$to,$newsql); |
|
345 | + $from = '__'.$cursor.'__'; |
|
346 | + $to = $listofinsertedrowid[$cursor]; |
|
347 | + $newsql = str_replace($from, $to, $newsql); |
|
348 | 348 | $sqlmodified++; |
349 | 349 | } |
350 | 350 | |
351 | - if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1), LOG_DEBUG); |
|
351 | + if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i + 1), LOG_DEBUG); |
|
352 | 352 | |
353 | - $result=$db->query($newsql,$usesavepoint); |
|
353 | + $result = $db->query($newsql, $usesavepoint); |
|
354 | 354 | if ($result) |
355 | 355 | { |
356 | - if (! $silent) print '<!-- Result = OK -->'."\n"; |
|
356 | + if (!$silent) print '<!-- Result = OK -->'."\n"; |
|
357 | 357 | |
358 | - if (preg_replace('/insert into ([^\s]+)/i',$newsql,$reg)) |
|
358 | + if (preg_replace('/insert into ([^\s]+)/i', $newsql, $reg)) |
|
359 | 359 | { |
360 | 360 | $cursorinsert++; |
361 | 361 | |
362 | 362 | // It's an insert |
363 | - $table=preg_replace('/([^a-zA-Z_]+)/i','',$reg[1]); |
|
364 | - $insertedrowid=$db->last_insert_id($table); |
|
365 | - $listofinsertedrowid[$cursorinsert]=$insertedrowid; |
|
363 | + $table = preg_replace('/([^a-zA-Z_]+)/i', '', $reg[1]); |
|
364 | + $insertedrowid = $db->last_insert_id($table); |
|
365 | + $listofinsertedrowid[$cursorinsert] = $insertedrowid; |
|
366 | 366 | dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG); |
367 | 367 | } |
368 | 368 | // print '<td align="right">OK</td>'; |
369 | 369 | } |
370 | 370 | else |
371 | 371 | { |
372 | - $errno=$db->errno(); |
|
373 | - if (! $silent) print '<!-- Result = '.$errno.' -->'."\n"; |
|
372 | + $errno = $db->errno(); |
|
373 | + if (!$silent) print '<!-- Result = '.$errno.' -->'."\n"; |
|
374 | 374 | |
375 | 375 | // Define list of errors we accept (array $okerrors) |
376 | - $okerrors=array( // By default |
|
376 | + $okerrors = array( // By default |
|
377 | 377 | 'DB_ERROR_TABLE_ALREADY_EXISTS', |
378 | 378 | 'DB_ERROR_COLUMN_ALREADY_EXISTS', |
379 | 379 | 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', |
380 | - 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS', // PgSql use same code for table and key already exist |
|
380 | + 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS', // PgSql use same code for table and key already exist |
|
381 | 381 | 'DB_ERROR_RECORD_ALREADY_EXISTS', |
382 | 382 | 'DB_ERROR_NOSUCHTABLE', |
383 | 383 | 'DB_ERROR_NOSUCHFIELD', |
384 | 384 | 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP', |
385 | 385 | 'DB_ERROR_NO_INDEX_TO_DROP', |
386 | - 'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante |
|
386 | + 'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante |
|
387 | 387 | 'DB_ERROR_CANT_DROP_PRIMARY_KEY', |
388 | 388 | 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS', |
389 | 389 | 'DB_ERROR_22P02' |
390 | 390 | ); |
391 | - if ($okerror == 'none') $okerrors=array(); |
|
391 | + if ($okerror == 'none') $okerrors = array(); |
|
392 | 392 | |
393 | 393 | // Is it an error we accept |
394 | - if (! in_array($errno,$okerrors)) |
|
394 | + if (!in_array($errno, $okerrors)) |
|
395 | 395 | { |
396 | - if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
397 | - if (! $silent) print '<div class="error">'.$langs->trans("Error")." ".$db->errno().": ".$newsql."<br>".$db->error()."</div></td>"; |
|
398 | - if (! $silent) print '</tr>'."\n"; |
|
399 | - dol_syslog('Admin.lib::run_sql Request '.($i+1)." Error ".$db->errno()." ".$newsql."<br>".$db->error(), LOG_ERR); |
|
396 | + if (!$silent) print '<tr><td valign="top" colspan="2">'; |
|
397 | + if (!$silent) print '<div class="error">'.$langs->trans("Error")." ".$db->errno().": ".$newsql."<br>".$db->error()."</div></td>"; |
|
398 | + if (!$silent) print '</tr>'."\n"; |
|
399 | + dol_syslog('Admin.lib::run_sql Request '.($i + 1)." Error ".$db->errno()." ".$newsql."<br>".$db->error(), LOG_ERR); |
|
400 | 400 | $error++; |
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - if (! $silent) print '</tr>'."\n"; |
|
404 | + if (!$silent) print '</tr>'."\n"; |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | 408 | if ($error == 0) |
409 | 409 | { |
410 | - if (! $silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
411 | - if (! $silent) print '<td align="right">'.$langs->trans("OK").'</td></tr>'."\n"; |
|
410 | + if (!$silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
411 | + if (!$silent) print '<td align="right">'.$langs->trans("OK").'</td></tr>'."\n"; |
|
412 | 412 | $ok = 1; |
413 | 413 | } |
414 | 414 | else |
415 | 415 | { |
416 | - if (! $silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
417 | - if (! $silent) print '<td align="right"><font class="error">'.$langs->trans("KO").'</font></td></tr>'."\n"; |
|
416 | + if (!$silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
417 | + if (!$silent) print '<td align="right"><font class="error">'.$langs->trans("KO").'</font></td></tr>'."\n"; |
|
418 | 418 | $ok = 0; |
419 | 419 | } |
420 | 420 | |
@@ -432,27 +432,27 @@ discard block |
||
432 | 432 | * |
433 | 433 | * @see dolibarr_get_const, dolibarr_set_const, dol_set_user_param |
434 | 434 | */ |
435 | -function dolibarr_del_const($db, $name, $entity=1) |
|
435 | +function dolibarr_del_const($db, $name, $entity = 1) |
|
436 | 436 | { |
437 | 437 | global $conf; |
438 | 438 | |
439 | 439 | if (empty($name)) |
440 | 440 | { |
441 | - dol_print_error('','Error call dolibar_del_const with parameter name empty'); |
|
441 | + dol_print_error('', 'Error call dolibar_del_const with parameter name empty'); |
|
442 | 442 | return -1; |
443 | 443 | } |
444 | 444 | |
445 | 445 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; |
446 | - $sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'"; |
|
447 | - if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'"; |
|
448 | - $sql.= ")"; |
|
449 | - if ($entity >= 0) $sql.= " AND entity = ".$entity; |
|
446 | + $sql .= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'"; |
|
447 | + if (is_numeric($name)) $sql .= " OR rowid = '".$db->escape($name)."'"; |
|
448 | + $sql .= ")"; |
|
449 | + if ($entity >= 0) $sql .= " AND entity = ".$entity; |
|
450 | 450 | |
451 | 451 | dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG); |
452 | - $resql=$db->query($sql); |
|
452 | + $resql = $db->query($sql); |
|
453 | 453 | if ($resql) |
454 | 454 | { |
455 | - $conf->global->$name=''; |
|
455 | + $conf->global->$name = ''; |
|
456 | 456 | return 1; |
457 | 457 | } |
458 | 458 | else |
@@ -472,22 +472,22 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @see dolibarr_del_const, dolibarr_set_const, dol_set_user_param |
474 | 474 | */ |
475 | -function dolibarr_get_const($db, $name, $entity=1) |
|
475 | +function dolibarr_get_const($db, $name, $entity = 1) |
|
476 | 476 | { |
477 | 477 | global $conf; |
478 | - $value=''; |
|
478 | + $value = ''; |
|
479 | 479 | |
480 | 480 | $sql = "SELECT ".$db->decrypt('value')." as value"; |
481 | - $sql.= " FROM ".MAIN_DB_PREFIX."const"; |
|
482 | - $sql.= " WHERE name = ".$db->encrypt($name,1); |
|
483 | - $sql.= " AND entity = ".$entity; |
|
481 | + $sql .= " FROM ".MAIN_DB_PREFIX."const"; |
|
482 | + $sql .= " WHERE name = ".$db->encrypt($name, 1); |
|
483 | + $sql .= " AND entity = ".$entity; |
|
484 | 484 | |
485 | 485 | dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG); |
486 | - $resql=$db->query($sql); |
|
486 | + $resql = $db->query($sql); |
|
487 | 487 | if ($resql) |
488 | 488 | { |
489 | - $obj=$db->fetch_object($resql); |
|
490 | - if ($obj) $value=$obj->value; |
|
489 | + $obj = $db->fetch_object($resql); |
|
490 | + if ($obj) $value = $obj->value; |
|
491 | 491 | } |
492 | 492 | return $value; |
493 | 493 | } |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * |
508 | 508 | * @see dolibarr_del_const, dolibarr_get_const, dol_set_user_param |
509 | 509 | */ |
510 | -function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1) |
|
510 | +function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0, $note = '', $entity = 1) |
|
511 | 511 | { |
512 | 512 | global $conf; |
513 | 513 | |
514 | 514 | // Clean parameters |
515 | - $name=trim($name); |
|
515 | + $name = trim($name); |
|
516 | 516 | |
517 | 517 | // Check parameters |
518 | 518 | if (empty($name)) |
519 | 519 | { |
520 | - dol_print_error($db,"Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR); |
|
520 | + dol_print_error($db, "Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR); |
|
521 | 521 | exit; |
522 | 522 | } |
523 | 523 | |
@@ -526,35 +526,35 @@ discard block |
||
526 | 526 | $db->begin(); |
527 | 527 | |
528 | 528 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; |
529 | - $sql.= " WHERE name = ".$db->encrypt($name,1); |
|
530 | - if ($entity >= 0) $sql.= " AND entity = ".$entity; |
|
529 | + $sql .= " WHERE name = ".$db->encrypt($name, 1); |
|
530 | + if ($entity >= 0) $sql .= " AND entity = ".$entity; |
|
531 | 531 | |
532 | 532 | dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); |
533 | - $resql=$db->query($sql); |
|
533 | + $resql = $db->query($sql); |
|
534 | 534 | |
535 | - if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0 |
|
535 | + if (strcmp($value, '')) // true if different. Must work for $value='0' or $value=0 |
|
536 | 536 | { |
537 | 537 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity)"; |
538 | - $sql.= " VALUES ("; |
|
539 | - $sql.= $db->encrypt($name,1); |
|
540 | - $sql.= ", ".$db->encrypt($value,1); |
|
541 | - $sql.= ",'".$db->escape($type)."',".$visible.",'".$db->escape($note)."',".$entity.")"; |
|
538 | + $sql .= " VALUES ("; |
|
539 | + $sql .= $db->encrypt($name, 1); |
|
540 | + $sql .= ", ".$db->encrypt($value, 1); |
|
541 | + $sql .= ",'".$db->escape($type)."',".$visible.",'".$db->escape($note)."',".$entity.")"; |
|
542 | 542 | |
543 | 543 | //print "sql".$value."-".pg_escape_string($value)."-".$sql;exit; |
544 | 544 | //print "xx".$db->escape($value); |
545 | 545 | dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); |
546 | - $resql=$db->query($sql); |
|
546 | + $resql = $db->query($sql); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | if ($resql) |
550 | 550 | { |
551 | 551 | $db->commit(); |
552 | - $conf->global->$name=$value; |
|
552 | + $conf->global->$name = $value; |
|
553 | 553 | return 1; |
554 | 554 | } |
555 | 555 | else |
556 | 556 | { |
557 | - $error=$db->lasterror(); |
|
557 | + $error = $db->lasterror(); |
|
558 | 558 | $db->rollback(); |
559 | 559 | return -1; |
560 | 560 | } |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | |
644 | 644 | |
645 | 645 | // Show permissions lines |
646 | - $nbPerms=0; |
|
646 | + $nbPerms = 0; |
|
647 | 647 | $sql = "SELECT COUNT(r.id) as nb"; |
648 | - $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; |
|
649 | - $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" |
|
650 | - $sql.= " AND entity = ".$conf->entity; |
|
651 | - $sql.= " AND bydefault = 1"; |
|
652 | - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled |
|
648 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; |
|
649 | + $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" |
|
650 | + $sql .= " AND entity = ".$conf->entity; |
|
651 | + $sql .= " AND bydefault = 1"; |
|
652 | + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled |
|
653 | 653 | $resql = $db->query($sql); |
654 | 654 | if ($resql) |
655 | 655 | { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | |
661 | 661 | $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; |
662 | 662 | $head[$h][1] = $langs->trans("DefaultRights"); |
663 | - if ($nbPerms > 0) $head[$h][1].= ' <span class="badge">'.$nbPerms.'</span>'; |
|
663 | + if ($nbPerms > 0) $head[$h][1] .= ' <span class="badge">'.$nbPerms.'</span>'; |
|
664 | 664 | $head[$h][2] = 'default'; |
665 | 665 | $h++; |
666 | 666 | |
@@ -689,9 +689,9 @@ discard block |
||
689 | 689 | $head[$h][2] = 'searchkey'; |
690 | 690 | $h++; |
691 | 691 | |
692 | - complete_head_from_modules($conf,$langs,null,$head,$h,'translation_admin'); |
|
692 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'translation_admin'); |
|
693 | 693 | |
694 | - complete_head_from_modules($conf,$langs,null,$head,$h,'translation_admin','remove'); |
|
694 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'translation_admin', 'remove'); |
|
695 | 695 | |
696 | 696 | |
697 | 697 | return $head; |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | $head[$h][2] = 'sortorder'; |
725 | 725 | $h++; |
726 | 726 | |
727 | - if (! empty($conf->use_javascript_ajax)) |
|
727 | + if (!empty($conf->use_javascript_ajax)) |
|
728 | 728 | { |
729 | 729 | $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus"; |
730 | 730 | $head[$h][1] = $langs->trans("DefaultFocus"); |
@@ -742,9 +742,9 @@ discard block |
||
742 | 742 | $head[$h][2] = 'searchkey'; |
743 | 743 | $h++;*/ |
744 | 744 | |
745 | - complete_head_from_modules($conf,$langs,null,$head,$h,'defaultvalues_admin'); |
|
745 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'defaultvalues_admin'); |
|
746 | 746 | |
747 | - complete_head_from_modules($conf,$langs,null,$head,$h,'defaultvalues_admin','remove'); |
|
747 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'defaultvalues_admin', 'remove'); |
|
748 | 748 | |
749 | 749 | |
750 | 750 | return $head; |
@@ -773,28 +773,28 @@ discard block |
||
773 | 773 | $dh = @opendir(dol_osencode($sessPath)); |
774 | 774 | if ($dh) |
775 | 775 | { |
776 | - while(($file = @readdir($dh)) !== false) |
|
776 | + while (($file = @readdir($dh)) !== false) |
|
777 | 777 | { |
778 | - if (preg_match('/^sess_/i',$file) && $file != "." && $file != "..") |
|
778 | + if (preg_match('/^sess_/i', $file) && $file != "." && $file != "..") |
|
779 | 779 | { |
780 | 780 | $fullpath = $sessPath.$file; |
781 | - if(! @is_dir($fullpath) && is_readable($fullpath)) |
|
781 | + if (!@is_dir($fullpath) && is_readable($fullpath)) |
|
782 | 782 | { |
783 | - $sessValues = file_get_contents($fullpath); // get raw session data |
|
783 | + $sessValues = file_get_contents($fullpath); // get raw session data |
|
784 | 784 | // Example of possible value |
785 | 785 | //$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f"; |
786 | 786 | // dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920"; |
787 | 787 | // dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";'; |
788 | 788 | |
789 | - if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session |
|
790 | - (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity |
|
791 | - preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name |
|
789 | + if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session |
|
790 | + (preg_match('/dol_entity\|i:'.$conf->entity.';/i', $sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i', $sessValues)) && // limit to current entity |
|
791 | + preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i', $sessValues)) // limit to company name |
|
792 | 792 | { |
793 | - $tmp=explode('_', $file); |
|
794 | - $idsess=$tmp[1]; |
|
795 | - $login = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i',$sessValues,$regs); |
|
793 | + $tmp = explode('_', $file); |
|
794 | + $idsess = $tmp[1]; |
|
795 | + $login = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i', $sessValues, $regs); |
|
796 | 796 | $arrayofSessions[$idsess]["login"] = $regs[1]; |
797 | - $arrayofSessions[$idsess]["age"] = time()-filectime($fullpath); |
|
797 | + $arrayofSessions[$idsess]["age"] = time() - filectime($fullpath); |
|
798 | 798 | $arrayofSessions[$idsess]["creation"] = filectime($fullpath); |
799 | 799 | $arrayofSessions[$idsess]["modification"] = filemtime($fullpath); |
800 | 800 | $arrayofSessions[$idsess]["raw"] = $sessValues; |
@@ -822,28 +822,28 @@ discard block |
||
822 | 822 | $sessPath = ini_get("session.save_path")."/"; |
823 | 823 | dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath); |
824 | 824 | |
825 | - $error=0; |
|
825 | + $error = 0; |
|
826 | 826 | $dh = @opendir(dol_osencode($sessPath)); |
827 | - while(($file = @readdir($dh)) !== false) |
|
827 | + while (($file = @readdir($dh)) !== false) |
|
828 | 828 | { |
829 | 829 | if ($file != "." && $file != "..") |
830 | 830 | { |
831 | 831 | $fullpath = $sessPath.$file; |
832 | - if(! @is_dir($fullpath)) |
|
832 | + if (!@is_dir($fullpath)) |
|
833 | 833 | { |
834 | - $sessValues = file_get_contents($fullpath); // get raw session data |
|
834 | + $sessValues = file_get_contents($fullpath); // get raw session data |
|
835 | 835 | |
836 | - if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session |
|
837 | - preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity |
|
838 | - preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name |
|
836 | + if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session |
|
837 | + preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i', $sessValues) && // limit to current entity |
|
838 | + preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i', $sessValues)) // limit to company name |
|
839 | 839 | { |
840 | - $tmp=explode('_', $file); |
|
841 | - $idsess=$tmp[1]; |
|
840 | + $tmp = explode('_', $file); |
|
841 | + $idsess = $tmp[1]; |
|
842 | 842 | // We remove session if it's not ourself |
843 | 843 | if ($idsess != $mysessionid) |
844 | 844 | { |
845 | - $res=@unlink($fullpath); |
|
846 | - if (! $res) $error++; |
|
845 | + $res = @unlink($fullpath); |
|
846 | + if (!$res) $error++; |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | } |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | } |
852 | 852 | @closedir($dh); |
853 | 853 | |
854 | - if (! $error) return 1; |
|
854 | + if (!$error) return 1; |
|
855 | 855 | else return -$error; |
856 | 856 | } |
857 | 857 | |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | * @param int $withdeps Activate/Disable also all dependencies |
865 | 865 | * @return array array('nbmodules'=>nb modules activated with success, 'errors=>array of error messages, 'nbperms'=>Nb permission added); |
866 | 866 | */ |
867 | -function activateModule($value,$withdeps=1) |
|
867 | +function activateModule($value, $withdeps = 1) |
|
868 | 868 | { |
869 | 869 | global $db, $modules, $langs, $conf, $mysoc; |
870 | 870 | |
@@ -874,20 +874,20 @@ discard block |
||
874 | 874 | return $ret; |
875 | 875 | } |
876 | 876 | |
877 | - $ret=array('nbmodules'=>0, 'errors'=>array(), 'nbperms'=>0); |
|
877 | + $ret = array('nbmodules'=>0, 'errors'=>array(), 'nbperms'=>0); |
|
878 | 878 | $modName = $value; |
879 | - $modFile = $modName . ".class.php"; |
|
879 | + $modFile = $modName.".class.php"; |
|
880 | 880 | |
881 | 881 | // Loop on each directory to fill $modulesdir |
882 | 882 | $modulesdir = dolGetModulesDirs(); |
883 | 883 | |
884 | 884 | // Loop on each modulesdir directories |
885 | - $found=false; |
|
885 | + $found = false; |
|
886 | 886 | foreach ($modulesdir as $dir) |
887 | 887 | { |
888 | 888 | if (file_exists($dir.$modFile)) |
889 | 889 | { |
890 | - $found=@include_once $dir.$modFile; |
|
890 | + $found = @include_once $dir.$modFile; |
|
891 | 891 | if ($found) break; |
892 | 892 | } |
893 | 893 | } |
@@ -895,16 +895,16 @@ discard block |
||
895 | 895 | $objMod = new $modName($db); |
896 | 896 | |
897 | 897 | // Test if PHP version ok |
898 | - $verphp=versionphparray(); |
|
899 | - $vermin=isset($objMod->phpmin)?$objMod->phpmin:0; |
|
898 | + $verphp = versionphparray(); |
|
899 | + $vermin = isset($objMod->phpmin) ? $objMod->phpmin : 0; |
|
900 | 900 | if (is_array($vermin) && versioncompare($verphp, $vermin) < 0) { |
901 | 901 | $ret['errors'][] = $langs->trans("ErrorModuleRequirePHPVersion", versiontostring($vermin)); |
902 | 902 | return $ret; |
903 | 903 | } |
904 | 904 | |
905 | 905 | // Test if Dolibarr version ok |
906 | - $verdol=versiondolibarrarray(); |
|
907 | - $vermin=isset($objMod->need_dolibarr_version)?$objMod->need_dolibarr_version:0; |
|
906 | + $verdol = versiondolibarrarray(); |
|
907 | + $vermin = isset($objMod->need_dolibarr_version) ? $objMod->need_dolibarr_version : 0; |
|
908 | 908 | //print 'version: '.versioncompare($verdol,$vermin).' - '.join(',',$verdol).' - '.join(',',$vermin);exit; |
909 | 909 | if (is_array($vermin) && versioncompare($verdol, $vermin) < 0) { |
910 | 910 | $ret['errors'][] = $langs->trans("ErrorModuleRequireDolibarrVersion", versiontostring($vermin)); |
@@ -918,28 +918,28 @@ discard block |
||
918 | 918 | } |
919 | 919 | |
920 | 920 | $const_name = $objMod->const_name; |
921 | - if(!empty($conf->global->$const_name)){ |
|
921 | + if (!empty($conf->global->$const_name)) { |
|
922 | 922 | return $ret; |
923 | 923 | } |
924 | 924 | |
925 | - $result=$objMod->init(); // Enable module |
|
925 | + $result = $objMod->init(); // Enable module |
|
926 | 926 | |
927 | 927 | if ($result <= 0) |
928 | 928 | { |
929 | - $ret['errors'][]=$objMod->error; |
|
929 | + $ret['errors'][] = $objMod->error; |
|
930 | 930 | } |
931 | 931 | else |
932 | 932 | { |
933 | 933 | if ($withdeps) |
934 | 934 | { |
935 | - if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends)) |
|
935 | + if (isset($objMod->depends) && is_array($objMod->depends) && !empty($objMod->depends)) |
|
936 | 936 | { |
937 | 937 | // Activation of modules this module depends on |
938 | 938 | // this->depends may be array('modModule1', 'mmodModule2') or array('always1'=>"modModule1", 'FR'=>'modModule2') |
939 | 939 | foreach ($objMod->depends as $key => $modulestring) |
940 | 940 | { |
941 | 941 | //var_dump((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key));exit; |
942 | - if ((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key)) |
|
942 | + if ((!is_numeric($key)) && !preg_match('/^always/', $key) && $mysoc->country_code && !preg_match('/^'.$mysoc->country_code.'/', $key)) |
|
943 | 943 | { |
944 | 944 | dol_syslog("We are not concerned by dependency with key=".$key." because our country is ".$mysoc->country_code); |
945 | 945 | continue; |
@@ -950,10 +950,10 @@ discard block |
||
950 | 950 | if (file_exists($dir.$modulestring.".class.php")) |
951 | 951 | { |
952 | 952 | $resarray = activateModule($modulestring); |
953 | - if (empty($resarray['errors'])){ |
|
953 | + if (empty($resarray['errors'])) { |
|
954 | 954 | $activate = true; |
955 | - }else{ |
|
956 | - foreach ($resarray['errors'] as $errorMessage){ |
|
955 | + } else { |
|
956 | + foreach ($resarray['errors'] as $errorMessage) { |
|
957 | 957 | dol_syslog($errorMessage, LOG_ERR); |
958 | 958 | } |
959 | 959 | } |
@@ -963,8 +963,8 @@ discard block |
||
963 | 963 | |
964 | 964 | if ($activate) |
965 | 965 | { |
966 | - $ret['nbmodules']+=$resarray['nbmodules']; |
|
967 | - $ret['nbperms']+=$resarray['nbperms']; |
|
966 | + $ret['nbmodules'] += $resarray['nbmodules']; |
|
967 | + $ret['nbperms'] += $resarray['nbperms']; |
|
968 | 968 | } |
969 | 969 | else |
970 | 970 | { |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | } |
974 | 974 | } |
975 | 975 | |
976 | - if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && ! empty($objMod->conflictwith)) |
|
976 | + if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && !empty($objMod->conflictwith)) |
|
977 | 977 | { |
978 | 978 | // Desactivation des modules qui entrent en conflit |
979 | 979 | $num = count($objMod->conflictwith); |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | { |
984 | 984 | if (file_exists($dir.$objMod->conflictwith[$i].".class.php")) |
985 | 985 | { |
986 | - unActivateModule($objMod->conflictwith[$i],0); |
|
986 | + unActivateModule($objMod->conflictwith[$i], 0); |
|
987 | 987 | } |
988 | 988 | } |
989 | 989 | } |
@@ -991,10 +991,10 @@ discard block |
||
991 | 991 | } |
992 | 992 | } |
993 | 993 | |
994 | - if (! count($ret['errors'])) |
|
994 | + if (!count($ret['errors'])) |
|
995 | 995 | { |
996 | 996 | $ret['nbmodules']++; |
997 | - $ret['nbperms']+=count($objMod->rights); |
|
997 | + $ret['nbperms'] += count($objMod->rights); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | return $ret; |
@@ -1008,27 +1008,27 @@ discard block |
||
1008 | 1008 | * @param int $requiredby 1=Desactive aussi modules dependants |
1009 | 1009 | * @return string Error message or ''; |
1010 | 1010 | */ |
1011 | -function unActivateModule($value, $requiredby=1) |
|
1011 | +function unActivateModule($value, $requiredby = 1) |
|
1012 | 1012 | { |
1013 | 1013 | global $db, $modules, $conf; |
1014 | 1014 | |
1015 | 1015 | // Check parameters |
1016 | 1016 | if (empty($value)) return 'ErrorBadParameter'; |
1017 | 1017 | |
1018 | - $ret=''; |
|
1018 | + $ret = ''; |
|
1019 | 1019 | $modName = $value; |
1020 | - $modFile = $modName . ".class.php"; |
|
1020 | + $modFile = $modName.".class.php"; |
|
1021 | 1021 | |
1022 | 1022 | // Loop on each directory to fill $modulesdir |
1023 | 1023 | $modulesdir = dolGetModulesDirs(); |
1024 | 1024 | |
1025 | 1025 | // Loop on each modulesdir directories |
1026 | - $found=false; |
|
1026 | + $found = false; |
|
1027 | 1027 | foreach ($modulesdir as $dir) |
1028 | 1028 | { |
1029 | 1029 | if (file_exists($dir.$modFile)) |
1030 | 1030 | { |
1031 | - $found=@include_once $dir.$modFile; |
|
1031 | + $found = @include_once $dir.$modFile; |
|
1032 | 1032 | if ($found) break; |
1033 | 1033 | } |
1034 | 1034 | } |
@@ -1036,8 +1036,8 @@ discard block |
||
1036 | 1036 | if ($found) |
1037 | 1037 | { |
1038 | 1038 | $objMod = new $modName($db); |
1039 | - $result=$objMod->remove(); |
|
1040 | - if ($result <= 0) $ret=$objMod->error; |
|
1039 | + $result = $objMod->remove(); |
|
1040 | + if ($result <= 0) $ret = $objMod->error; |
|
1041 | 1041 | } |
1042 | 1042 | else |
1043 | 1043 | { |
@@ -1045,17 +1045,17 @@ discard block |
||
1045 | 1045 | // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded |
1046 | 1046 | include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
1047 | 1047 | $genericMod = new DolibarrModules($db); |
1048 | - $genericMod->name=preg_replace('/^mod/i','',$modName); |
|
1049 | - $genericMod->rights_class=strtolower(preg_replace('/^mod/i','',$modName)); |
|
1050 | - $genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',$modName)); |
|
1051 | - dol_syslog("modules::unActivateModule Failed to find module file, we use generic function with name " . $modName); |
|
1048 | + $genericMod->name = preg_replace('/^mod/i', '', $modName); |
|
1049 | + $genericMod->rights_class = strtolower(preg_replace('/^mod/i', '', $modName)); |
|
1050 | + $genericMod->const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', $modName)); |
|
1051 | + dol_syslog("modules::unActivateModule Failed to find module file, we use generic function with name ".$modName); |
|
1052 | 1052 | $genericMod->_remove(array()); |
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | // Desactivation des modules qui dependent de lui |
1056 | - if (! $ret && $requiredby) |
|
1056 | + if (!$ret && $requiredby) |
|
1057 | 1057 | { |
1058 | - $countrb=count($objMod->requiredby); |
|
1058 | + $countrb = count($objMod->requiredby); |
|
1059 | 1059 | for ($i = 0; $i < $countrb; $i++) |
1060 | 1060 | { |
1061 | 1061 | //var_dump($objMod->requiredby[$i]); |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | * @param array $tabfieldcheck Tabfieldcheck |
1086 | 1086 | * @return int 1 |
1087 | 1087 | */ |
1088 | -function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp,&$tabfieldcheck) |
|
1088 | +function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabfieldcheck) |
|
1089 | 1089 | { |
1090 | 1090 | global $db, $modules, $conf, $langs; |
1091 | 1091 | |
@@ -1099,13 +1099,13 @@ discard block |
||
1099 | 1099 | // Load modules attributes in arrays (name, numero, orders) from dir directory |
1100 | 1100 | //print $dir."\n<br>"; |
1101 | 1101 | dol_syslog("Scan directory ".$dir." for modules"); |
1102 | - $handle=@opendir(dol_osencode($dir)); |
|
1102 | + $handle = @opendir(dol_osencode($dir)); |
|
1103 | 1103 | if (is_resource($handle)) |
1104 | 1104 | { |
1105 | - while (($file = readdir($handle))!==false) |
|
1105 | + while (($file = readdir($handle)) !== false) |
|
1106 | 1106 | { |
1107 | 1107 | //print "$i ".$file."\n<br>"; |
1108 | - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1108 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1109 | 1109 | { |
1110 | 1110 | $modName = substr($file, 0, dol_strlen($file) - 10); |
1111 | 1111 | |
@@ -1123,14 +1123,14 @@ discard block |
||
1123 | 1123 | $j = 1000 + $i; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $modulequalified=1; |
|
1126 | + $modulequalified = 1; |
|
1127 | 1127 | |
1128 | 1128 | // We discard modules according to features level (PS: if module is activated we always show it) |
1129 | - $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
|
1130 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
1131 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
1129 | + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); |
|
1130 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) $modulequalified = 0; |
|
1131 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) $modulequalified = 0; |
|
1132 | 1132 | //If module is not activated disqualified |
1133 | - if (empty($conf->global->$const_name)) $modulequalified=0; |
|
1133 | + if (empty($conf->global->$const_name)) $modulequalified = 0; |
|
1134 | 1134 | |
1135 | 1135 | if ($modulequalified) |
1136 | 1136 | { |
@@ -1142,23 +1142,23 @@ discard block |
||
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | // Complete the arrays &$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond |
1145 | - if (empty($objMod->dictionaries) && ! empty($objMod->dictionnaries)) $objMod->dictionaries=$objMod->dictionnaries; // For backward compatibility |
|
1145 | + if (empty($objMod->dictionaries) && !empty($objMod->dictionnaries)) $objMod->dictionaries = $objMod->dictionnaries; // For backward compatibility |
|
1146 | 1146 | |
1147 | - if (! empty($objMod->dictionaries)) |
|
1147 | + if (!empty($objMod->dictionaries)) |
|
1148 | 1148 | { |
1149 | 1149 | //var_dump($objMod->dictionaries['tabname']); |
1150 | - $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp=0; |
|
1151 | - foreach($objMod->dictionaries['tabname'] as $val) { $nbtabname++; $taborder[] = max($taborder)+1; $tabname[] = $val; } // Position |
|
1152 | - foreach($objMod->dictionaries['tablib'] as $val) { $nbtablib++; $tablib[] = $val; } |
|
1153 | - foreach($objMod->dictionaries['tabsql'] as $val) { $nbtabsql++; $tabsql[] = $val; } |
|
1154 | - foreach($objMod->dictionaries['tabsqlsort'] as $val) { $nbtabsqlsort++; $tabsqlsort[] = $val; } |
|
1155 | - foreach($objMod->dictionaries['tabfield'] as $val) { $nbtabfield++; $tabfield[] = $val; } |
|
1156 | - foreach($objMod->dictionaries['tabfieldvalue'] as $val) { $nbtabfieldvalue++; $tabfieldvalue[] = $val; } |
|
1157 | - foreach($objMod->dictionaries['tabfieldinsert'] as $val) { $nbtabfieldinsert++; $tabfieldinsert[] = $val; } |
|
1158 | - foreach($objMod->dictionaries['tabrowid'] as $val) { $nbtabrowid++; $tabrowid[] = $val; } |
|
1159 | - foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; } |
|
1160 | - if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; } |
|
1161 | - if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; } |
|
1150 | + $nbtabname = $nbtablib = $nbtabsql = $nbtabsqlsort = $nbtabfield = $nbtabfieldvalue = $nbtabfieldinsert = $nbtabrowid = $nbtabcond = $nbtabfieldcheck = $nbtabhelp = 0; |
|
1151 | + foreach ($objMod->dictionaries['tabname'] as $val) { $nbtabname++; $taborder[] = max($taborder) + 1; $tabname[] = $val; } // Position |
|
1152 | + foreach ($objMod->dictionaries['tablib'] as $val) { $nbtablib++; $tablib[] = $val; } |
|
1153 | + foreach ($objMod->dictionaries['tabsql'] as $val) { $nbtabsql++; $tabsql[] = $val; } |
|
1154 | + foreach ($objMod->dictionaries['tabsqlsort'] as $val) { $nbtabsqlsort++; $tabsqlsort[] = $val; } |
|
1155 | + foreach ($objMod->dictionaries['tabfield'] as $val) { $nbtabfield++; $tabfield[] = $val; } |
|
1156 | + foreach ($objMod->dictionaries['tabfieldvalue'] as $val) { $nbtabfieldvalue++; $tabfieldvalue[] = $val; } |
|
1157 | + foreach ($objMod->dictionaries['tabfieldinsert'] as $val) { $nbtabfieldinsert++; $tabfieldinsert[] = $val; } |
|
1158 | + foreach ($objMod->dictionaries['tabrowid'] as $val) { $nbtabrowid++; $tabrowid[] = $val; } |
|
1159 | + foreach ($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; } |
|
1160 | + if (!empty($objMod->dictionaries['tabhelp'])) foreach ($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; } |
|
1161 | + if (!empty($objMod->dictionaries['tabfieldcheck'])) foreach ($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; } |
|
1162 | 1162 | |
1163 | 1163 | if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort) |
1164 | 1164 | { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | else |
1169 | 1169 | { |
1170 | - $taborder[] = 0; // Add an empty line |
|
1170 | + $taborder[] = 0; // Add an empty line |
|
1171 | 1171 | } |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1205,12 +1205,12 @@ discard block |
||
1205 | 1205 | { |
1206 | 1206 | // Load modules attributes in arrays (name, numero, orders) from dir directory |
1207 | 1207 | dol_syslog("Scan directory ".$dir." for modules"); |
1208 | - $handle=@opendir(dol_osencode($dir)); |
|
1208 | + $handle = @opendir(dol_osencode($dir)); |
|
1209 | 1209 | if (is_resource($handle)) |
1210 | 1210 | { |
1211 | - while (($file = readdir($handle))!==false) |
|
1211 | + while (($file = readdir($handle)) !== false) |
|
1212 | 1212 | { |
1213 | - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1213 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1214 | 1214 | { |
1215 | 1215 | $modName = substr($file, 0, dol_strlen($file) - 10); |
1216 | 1216 | |
@@ -1219,14 +1219,14 @@ discard block |
||
1219 | 1219 | include_once $dir.$file; |
1220 | 1220 | $objMod = new $modName($db); |
1221 | 1221 | |
1222 | - $modulequalified=1; |
|
1222 | + $modulequalified = 1; |
|
1223 | 1223 | |
1224 | 1224 | // We discard modules according to features level (PS: if module is activated we always show it) |
1225 | - $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
|
1225 | + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); |
|
1226 | 1226 | |
1227 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; |
|
1228 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; |
|
1229 | - if(!empty($conf->global->$const_name)) $modulequalified=0; // already activated |
|
1227 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; |
|
1228 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; |
|
1229 | + if (!empty($conf->global->$const_name)) $modulequalified = 0; // already activated |
|
1230 | 1230 | |
1231 | 1231 | if ($modulequalified) |
1232 | 1232 | { |
@@ -1280,13 +1280,13 @@ discard block |
||
1280 | 1280 | // Load modules attributes in arrays (name, numero, orders) from dir directory |
1281 | 1281 | //print $dir."\n<br>"; |
1282 | 1282 | dol_syslog("Scan directory ".$dir." for modules"); |
1283 | - $handle=@opendir(dol_osencode($dir)); |
|
1283 | + $handle = @opendir(dol_osencode($dir)); |
|
1284 | 1284 | if (is_resource($handle)) |
1285 | 1285 | { |
1286 | - while (($file = readdir($handle))!==false) |
|
1286 | + while (($file = readdir($handle)) !== false) |
|
1287 | 1287 | { |
1288 | 1288 | //print "$i ".$file."\n<br>"; |
1289 | - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1289 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
1290 | 1290 | { |
1291 | 1291 | $modName = substr($file, 0, dol_strlen($file) - 10); |
1292 | 1292 | |
@@ -1304,33 +1304,33 @@ discard block |
||
1304 | 1304 | $j = 1000 + $i; |
1305 | 1305 | } |
1306 | 1306 | |
1307 | - $modulequalified=1; |
|
1307 | + $modulequalified = 1; |
|
1308 | 1308 | |
1309 | 1309 | // We discard modules according to features level (PS: if module is activated we always show it) |
1310 | - $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
|
1311 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
1312 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
1310 | + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); |
|
1311 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) $modulequalified = 0; |
|
1312 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) $modulequalified = 0; |
|
1313 | 1313 | //If module is not activated disqualified |
1314 | - if (empty($conf->global->$const_name)) $modulequalified=0; |
|
1314 | + if (empty($conf->global->$const_name)) $modulequalified = 0; |
|
1315 | 1315 | |
1316 | 1316 | if ($modulequalified) |
1317 | 1317 | { |
1318 | 1318 | // Load languages files of module |
1319 | 1319 | if (isset($objMod->langfiles) && is_array($objMod->langfiles)) |
1320 | 1320 | { |
1321 | - foreach($objMod->langfiles as $langfile) |
|
1321 | + foreach ($objMod->langfiles as $langfile) |
|
1322 | 1322 | { |
1323 | 1323 | $langs->load($langfile); |
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 | |
1327 | 1327 | $modules[$i] = $objMod; |
1328 | - $filename[$i]= $modName; |
|
1329 | - $orders[$i] = $objMod->family."_".$j; // Sort on family then module number |
|
1328 | + $filename[$i] = $modName; |
|
1329 | + $orders[$i] = $objMod->family."_".$j; // Sort on family then module number |
|
1330 | 1330 | $dirmod[$i] = $dir; |
1331 | 1331 | //print "x".$modName." ".$orders[$i]."\n<br>"; |
1332 | 1332 | |
1333 | - if (! empty($objMod->module_parts['contactelement'])) |
|
1333 | + if (!empty($objMod->module_parts['contactelement'])) |
|
1334 | 1334 | { |
1335 | 1335 | $elementList[$objMod->name] = $langs->trans($objMod->name); |
1336 | 1336 | } |
@@ -1362,14 +1362,14 @@ discard block |
||
1362 | 1362 | * @param string $helptext Help |
1363 | 1363 | * @return void |
1364 | 1364 | */ |
1365 | -function form_constantes($tableau, $strictw3c=0, $helptext='') |
|
1365 | +function form_constantes($tableau, $strictw3c = 0, $helptext = '') |
|
1366 | 1366 | { |
1367 | - global $db,$bc,$langs,$conf,$user; |
|
1367 | + global $db, $bc, $langs, $conf, $user; |
|
1368 | 1368 | global $_Avery_Labels; |
1369 | 1369 | |
1370 | 1370 | $form = new Form($db); |
1371 | 1371 | |
1372 | - if (! empty($strictw3c) && $strictw3c == 1) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
1372 | + if (!empty($strictw3c) && $strictw3c == 1) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
1373 | 1373 | |
1374 | 1374 | print '<table class="noborder" width="100%">'; |
1375 | 1375 | print '<tr class="liste_titre">'; |
@@ -1381,11 +1381,11 @@ discard block |
||
1381 | 1381 | if (empty($strictw3c)) print '<td align="center" width="80">'.$langs->trans("Action").'</td>'; |
1382 | 1382 | print "</tr>\n"; |
1383 | 1383 | |
1384 | - $label=''; |
|
1385 | - $listofparam=array(); |
|
1386 | - foreach($tableau as $key => $const) // Loop on each param |
|
1384 | + $label = ''; |
|
1385 | + $listofparam = array(); |
|
1386 | + foreach ($tableau as $key => $const) // Loop on each param |
|
1387 | 1387 | { |
1388 | - $label=''; |
|
1388 | + $label = ''; |
|
1389 | 1389 | // $const is a const key like 'MYMODULE_ABC' |
1390 | 1390 | if (is_numeric($key)) { // Very old behaviour |
1391 | 1391 | $type = 'string'; |
@@ -1406,25 +1406,25 @@ discard block |
||
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | $sql = "SELECT "; |
1409 | - $sql.= "rowid"; |
|
1410 | - $sql.= ", ".$db->decrypt('name')." as name"; |
|
1411 | - $sql.= ", ".$db->decrypt('value')." as value"; |
|
1412 | - $sql.= ", type"; |
|
1413 | - $sql.= ", note"; |
|
1414 | - $sql.= " FROM ".MAIN_DB_PREFIX."const"; |
|
1415 | - $sql.= " WHERE ".$db->decrypt('name')." = '".$db->escape($const)."'"; |
|
1416 | - $sql.= " AND entity IN (0, ".$conf->entity.")"; |
|
1417 | - $sql.= " ORDER BY name ASC, entity DESC"; |
|
1409 | + $sql .= "rowid"; |
|
1410 | + $sql .= ", ".$db->decrypt('name')." as name"; |
|
1411 | + $sql .= ", ".$db->decrypt('value')." as value"; |
|
1412 | + $sql .= ", type"; |
|
1413 | + $sql .= ", note"; |
|
1414 | + $sql .= " FROM ".MAIN_DB_PREFIX."const"; |
|
1415 | + $sql .= " WHERE ".$db->decrypt('name')." = '".$db->escape($const)."'"; |
|
1416 | + $sql .= " AND entity IN (0, ".$conf->entity.")"; |
|
1417 | + $sql .= " ORDER BY name ASC, entity DESC"; |
|
1418 | 1418 | $result = $db->query($sql); |
1419 | 1419 | |
1420 | 1420 | dol_syslog("List params", LOG_DEBUG); |
1421 | 1421 | if ($result) |
1422 | 1422 | { |
1423 | - $obj = $db->fetch_object($result); // Take first result of select |
|
1423 | + $obj = $db->fetch_object($result); // Take first result of select |
|
1424 | 1424 | |
1425 | 1425 | if (empty($obj)) // If not yet into table |
1426 | 1426 | { |
1427 | - $obj = (object) array('rowid'=>'','name'=>$const,'value'=>'','type'=>$type,'note'=>''); |
|
1427 | + $obj = (object) array('rowid'=>'', 'name'=>$const, 'value'=>'', 'type'=>$type, 'note'=>''); |
|
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | if (empty($strictw3c)) |
@@ -1438,10 +1438,10 @@ discard block |
||
1438 | 1438 | // Show constant |
1439 | 1439 | print '<td>'; |
1440 | 1440 | if (empty($strictw3c)) print '<input type="hidden" name="action" value="update">'; |
1441 | - print '<input type="hidden" name="rowid'.(empty($strictw3c)?'':'[]').'" value="'.$obj->rowid.'">'; |
|
1442 | - print '<input type="hidden" name="constname'.(empty($strictw3c)?'':'[]').'" value="'.$const.'">'; |
|
1441 | + print '<input type="hidden" name="rowid'.(empty($strictw3c) ? '' : '[]').'" value="'.$obj->rowid.'">'; |
|
1442 | + print '<input type="hidden" name="constname'.(empty($strictw3c) ? '' : '[]').'" value="'.$const.'">'; |
|
1443 | 1443 | print '<input type="hidden" name="constnote_'.$obj->name.'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">'; |
1444 | - print '<input type="hidden" name="consttype_'.$obj->name.'" value="'.($obj->type?$obj->type:'string').'">'; |
|
1444 | + print '<input type="hidden" name="consttype_'.$obj->name.'" value="'.($obj->type ? $obj->type : 'string').'">'; |
|
1445 | 1445 | |
1446 | 1446 | print ($label ? $label : $langs->trans('Desc'.$const)); |
1447 | 1447 | |
@@ -1481,55 +1481,55 @@ discard block |
||
1481 | 1481 | print '<td>'; |
1482 | 1482 | // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) |
1483 | 1483 | require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; |
1484 | - $arrayoflabels=array(); |
|
1485 | - foreach(array_keys($_Avery_Labels) as $codecards) |
|
1484 | + $arrayoflabels = array(); |
|
1485 | + foreach (array_keys($_Avery_Labels) as $codecards) |
|
1486 | 1486 | { |
1487 | - $arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; |
|
1487 | + $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; |
|
1488 | 1488 | } |
1489 | - print $form->selectarray('constvalue'.(empty($strictw3c)?'':'[]'),$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0); |
|
1489 | + print $form->selectarray('constvalue'.(empty($strictw3c) ? '' : '[]'), $arrayoflabels, ($obj->value ? $obj->value : 'CARD'), 1, 0, 0); |
|
1490 | 1490 | print '<input type="hidden" name="consttype" value="yesno">'; |
1491 | - print '<input type="hidden" name="constnote'.(empty($strictw3c)?'':'[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">'; |
|
1491 | + print '<input type="hidden" name="constnote'.(empty($strictw3c) ? '' : '[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">'; |
|
1492 | 1492 | print '</td>'; |
1493 | 1493 | } |
1494 | 1494 | else |
1495 | 1495 | { |
1496 | 1496 | print '<td>'; |
1497 | - print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="'.($obj->type?$obj->type:'string').'">'; |
|
1498 | - print '<input type="hidden" name="constnote'.(empty($strictw3c)?'':'[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">'; |
|
1499 | - if ($obj->type == 'textarea' || in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT','ADHERENT_ETIQUETTE_TEXT'))) |
|
1497 | + print '<input type="hidden" name="consttype'.(empty($strictw3c) ? '' : '[]').'" value="'.($obj->type ? $obj->type : 'string').'">'; |
|
1498 | + print '<input type="hidden" name="constnote'.(empty($strictw3c) ? '' : '[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">'; |
|
1499 | + if ($obj->type == 'textarea' || in_array($const, array('ADHERENT_CARD_TEXT', 'ADHERENT_CARD_TEXT_RIGHT', 'ADHERENT_ETIQUETTE_TEXT'))) |
|
1500 | 1500 | { |
1501 | - print '<textarea class="flat" name="constvalue'.(empty($strictw3c)?'':'[]').'" cols="50" rows="5" wrap="soft">'."\n"; |
|
1501 | + print '<textarea class="flat" name="constvalue'.(empty($strictw3c) ? '' : '[]').'" cols="50" rows="5" wrap="soft">'."\n"; |
|
1502 | 1502 | print $obj->value; |
1503 | 1503 | print "</textarea>\n"; |
1504 | 1504 | } |
1505 | 1505 | elseif ($obj->type == 'html') |
1506 | 1506 | { |
1507 | 1507 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
1508 | - $doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,ROWS_5,'90%'); |
|
1508 | + $doleditor = new DolEditor('constvalue_'.$const.(empty($strictw3c) ? '' : '[]'), $obj->value, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); |
|
1509 | 1509 | $doleditor->Create(); |
1510 | 1510 | } |
1511 | 1511 | elseif ($obj->type == 'yesno') |
1512 | 1512 | { |
1513 | - print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1); |
|
1513 | + print $form->selectyesno('constvalue'.(empty($strictw3c) ? '' : '[]'), $obj->value, 1); |
|
1514 | 1514 | } |
1515 | 1515 | elseif (preg_match('/emailtemplate/', $obj->type)) |
1516 | 1516 | { |
1517 | 1517 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
1518 | 1518 | $formmail = new FormMail($db); |
1519 | 1519 | |
1520 | - $tmp=explode(':', $obj->type); |
|
1520 | + $tmp = explode(':', $obj->type); |
|
1521 | 1521 | |
1522 | - $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1); // We set lang=null to get in priority record with no lang |
|
1522 | + $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1); // We set lang=null to get in priority record with no lang |
|
1523 | 1523 | //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); |
1524 | - $arrayofmessagename=array(); |
|
1524 | + $arrayofmessagename = array(); |
|
1525 | 1525 | if (is_array($formmail->lines_model)) |
1526 | 1526 | { |
1527 | - foreach($formmail->lines_model as $modelmail) |
|
1527 | + foreach ($formmail->lines_model as $modelmail) |
|
1528 | 1528 | { |
1529 | 1529 | //var_dump($modelmail); |
1530 | - $moreonlabel=''; |
|
1531 | - if (! empty($arrayofmessagename[$modelmail->label])) $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; |
|
1532 | - $arrayofmessagename[$modelmail->label]=$langs->trans(preg_replace('/\(|\)/','',$modelmail->label)).$moreonlabel; |
|
1530 | + $moreonlabel = ''; |
|
1531 | + if (!empty($arrayofmessagename[$modelmail->label])) $moreonlabel = ' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; |
|
1532 | + $arrayofmessagename[$modelmail->label] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)).$moreonlabel; |
|
1533 | 1533 | } |
1534 | 1534 | } |
1535 | 1535 | //var_dump($arraydefaultmessage); |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | } |
1539 | 1539 | else // type = 'string' ou 'chaine' |
1540 | 1540 | { |
1541 | - print '<input type="text" class="flat" size="48" name="constvalue'.(empty($strictw3c)?'':'[]').'" value="'.dol_escape_htmltag($obj->value).'">'; |
|
1541 | + print '<input type="text" class="flat" size="48" name="constvalue'.(empty($strictw3c) ? '' : '[]').'" value="'.dol_escape_htmltag($obj->value).'">'; |
|
1542 | 1542 | } |
1543 | 1543 | print '</td>'; |
1544 | 1544 | } |
@@ -1555,7 +1555,7 @@ discard block |
||
1555 | 1555 | } |
1556 | 1556 | print '</table>'; |
1557 | 1557 | |
1558 | - if (! empty($strictw3c) && $strictw3c == 1) |
|
1558 | + if (!empty($strictw3c) && $strictw3c == 1) |
|
1559 | 1559 | { |
1560 | 1560 | print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>'; |
1561 | 1561 | print "</form>\n"; |
@@ -1571,24 +1571,24 @@ discard block |
||
1571 | 1571 | */ |
1572 | 1572 | function showModulesExludedForExternal($modules) |
1573 | 1573 | { |
1574 | - global $conf,$langs; |
|
1574 | + global $conf, $langs; |
|
1575 | 1575 | |
1576 | - $text=$langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); |
|
1577 | - $listofmodules=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); |
|
1578 | - $i=0; |
|
1576 | + $text = $langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); |
|
1577 | + $listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); |
|
1578 | + $i = 0; |
|
1579 | 1579 | if (!empty($modules)) { |
1580 | - foreach($modules as $module) |
|
1580 | + foreach ($modules as $module) |
|
1581 | 1581 | { |
1582 | - $moduleconst=$module->const_name; |
|
1583 | - $modulename=strtolower($module->name); |
|
1582 | + $moduleconst = $module->const_name; |
|
1583 | + $modulename = strtolower($module->name); |
|
1584 | 1584 | //print 'modulename='.$modulename; |
1585 | 1585 | |
1586 | 1586 | //if (empty($conf->global->$moduleconst)) continue; |
1587 | - if (! in_array($modulename,$listofmodules)) continue; |
|
1587 | + if (!in_array($modulename, $listofmodules)) continue; |
|
1588 | 1588 | //var_dump($modulename.' - '.$langs->trans('Module'.$module->numero.'Name')); |
1589 | 1589 | |
1590 | - if ($i > 0) $text.=', '; |
|
1591 | - else $text.=' '; |
|
1590 | + if ($i > 0) $text .= ', '; |
|
1591 | + else $text .= ' '; |
|
1592 | 1592 | $i++; |
1593 | 1593 | $text .= $langs->trans('Module'.$module->numero.'Name'); |
1594 | 1594 | } |
@@ -1606,20 +1606,20 @@ discard block |
||
1606 | 1606 | * @param string $description Model description |
1607 | 1607 | * @return int <0 if KO, >0 if OK |
1608 | 1608 | */ |
1609 | -function addDocumentModel($name, $type, $label='', $description='') |
|
1609 | +function addDocumentModel($name, $type, $label = '', $description = '') |
|
1610 | 1610 | { |
1611 | 1611 | global $db, $conf; |
1612 | 1612 | |
1613 | 1613 | $db->begin(); |
1614 | 1614 | |
1615 | 1615 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; |
1616 | - $sql.= " VALUES ('".$db->escape($name)."','".$type."',".$conf->entity.", "; |
|
1617 | - $sql.= ($label?"'".$db->escape($label)."'":'null').", "; |
|
1618 | - $sql.= (! empty($description)?"'".$db->escape($description)."'":"null"); |
|
1619 | - $sql.= ")"; |
|
1616 | + $sql .= " VALUES ('".$db->escape($name)."','".$type."',".$conf->entity.", "; |
|
1617 | + $sql .= ($label ? "'".$db->escape($label)."'" : 'null').", "; |
|
1618 | + $sql .= (!empty($description) ? "'".$db->escape($description)."'" : "null"); |
|
1619 | + $sql .= ")"; |
|
1620 | 1620 | |
1621 | 1621 | dol_syslog("admin.lib::addDocumentModel", LOG_DEBUG); |
1622 | - $resql=$db->query($sql); |
|
1622 | + $resql = $db->query($sql); |
|
1623 | 1623 | if ($resql) |
1624 | 1624 | { |
1625 | 1625 | $db->commit(); |
@@ -1647,12 +1647,12 @@ discard block |
||
1647 | 1647 | $db->begin(); |
1648 | 1648 | |
1649 | 1649 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; |
1650 | - $sql.= " WHERE nom = '".$db->escape($name)."'"; |
|
1651 | - $sql.= " AND type = '".$type."'"; |
|
1652 | - $sql.= " AND entity = ".$conf->entity; |
|
1650 | + $sql .= " WHERE nom = '".$db->escape($name)."'"; |
|
1651 | + $sql .= " AND type = '".$type."'"; |
|
1652 | + $sql .= " AND entity = ".$conf->entity; |
|
1653 | 1653 | |
1654 | 1654 | dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG); |
1655 | - $resql=$db->query($sql); |
|
1655 | + $resql = $db->query($sql); |
|
1656 | 1656 | if ($resql) |
1657 | 1657 | { |
1658 | 1658 | $db->commit(); |
@@ -1677,17 +1677,17 @@ discard block |
||
1677 | 1677 | ob_start(); |
1678 | 1678 | phpinfo(); |
1679 | 1679 | $info_arr = array(); |
1680 | - $info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>")); // end of ob_start() |
|
1680 | + $info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>")); // end of ob_start() |
|
1681 | 1681 | $cat = "General"; |
1682 | - foreach($info_lines as $line) |
|
1682 | + foreach ($info_lines as $line) |
|
1683 | 1683 | { |
1684 | 1684 | // new cat? |
1685 | 1685 | preg_match("~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : null; |
1686 | - if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1686 | + if (preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1687 | 1687 | { |
1688 | 1688 | $info_arr[trim($cat)][trim($val[1])] = $val[2]; |
1689 | 1689 | } |
1690 | - elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1690 | + elseif (preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1691 | 1691 | { |
1692 | 1692 | $info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]); |
1693 | 1693 | } |
@@ -1717,7 +1717,7 @@ discard block |
||
1717 | 1717 | $head[$h][2] = 'accountant'; |
1718 | 1718 | $h++; |
1719 | 1719 | |
1720 | - complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove'); |
|
1720 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'remove'); |
|
1721 | 1721 | |
1722 | 1722 | return $head; |
1723 | 1723 | } |
@@ -1734,7 +1734,7 @@ discard block |
||
1734 | 1734 | $h = 0; |
1735 | 1735 | $head = array(); |
1736 | 1736 | |
1737 | - if (! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1737 | + if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1738 | 1738 | { |
1739 | 1739 | $head[$h][0] = DOL_URL_ROOT."/admin/mails.php"; |
1740 | 1740 | $head[$h][1] = $langs->trans("OutGoingEmailSetup"); |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | $head[$h][2] = 'templates'; |
1756 | 1756 | $h++; |
1757 | 1757 | |
1758 | - if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && ! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1758 | + if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && !empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) |
|
1759 | 1759 | { |
1760 | 1760 | $head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php"; |
1761 | 1761 | $head[$h][1] = $langs->trans("EmailSenderProfiles"); |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | $h++; |
1764 | 1764 | } |
1765 | 1765 | |
1766 | - complete_head_from_modules($conf,$langs,null,$head,$h,'email_admin','remove'); |
|
1766 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'email_admin', 'remove'); |
|
1767 | 1767 | |
1768 | 1768 | return $head; |
1769 | 1769 | } |
@@ -35,9 +35,15 @@ discard block |
||
35 | 35 | function versiontostring($versionarray) |
36 | 36 | { |
37 | 37 | $string='?'; |
38 | - if (isset($versionarray[0])) $string=$versionarray[0]; |
|
39 | - if (isset($versionarray[1])) $string.='.'.$versionarray[1]; |
|
40 | - if (isset($versionarray[2])) $string.='.'.$versionarray[2]; |
|
38 | + if (isset($versionarray[0])) { |
|
39 | + $string=$versionarray[0]; |
|
40 | + } |
|
41 | + if (isset($versionarray[1])) { |
|
42 | + $string.='.'.$versionarray[1]; |
|
43 | + } |
|
44 | + if (isset($versionarray[2])) { |
|
45 | + $string.='.'.$versionarray[2]; |
|
46 | + } |
|
41 | 47 | return $string; |
42 | 48 | } |
43 | 49 | |
@@ -66,16 +72,36 @@ discard block |
||
66 | 72 | { |
67 | 73 | $operande1=isset($versionarray1[$level])?$versionarray1[$level]:0; |
68 | 74 | $operande2=isset($versionarray2[$level])?$versionarray2[$level]:0; |
69 | - if (preg_match('/alpha|dev/i',$operande1)) $operande1=-5; |
|
70 | - if (preg_match('/alpha|dev/i',$operande2)) $operande2=-5; |
|
71 | - if (preg_match('/beta$/i',$operande1)) $operande1=-4; |
|
72 | - if (preg_match('/beta$/i',$operande2)) $operande2=-4; |
|
73 | - if (preg_match('/beta([0-9])+/i',$operande1)) $operande1=-3; |
|
74 | - if (preg_match('/beta([0-9])+/i',$operande2)) $operande2=-3; |
|
75 | - if (preg_match('/rc$/i',$operande1)) $operande1=-2; |
|
76 | - if (preg_match('/rc$/i',$operande2)) $operande2=-2; |
|
77 | - if (preg_match('/rc([0-9])+/i',$operande1)) $operande1=-1; |
|
78 | - if (preg_match('/rc([0-9])+/i',$operande2)) $operande2=-1; |
|
75 | + if (preg_match('/alpha|dev/i',$operande1)) { |
|
76 | + $operande1=-5; |
|
77 | + } |
|
78 | + if (preg_match('/alpha|dev/i',$operande2)) { |
|
79 | + $operande2=-5; |
|
80 | + } |
|
81 | + if (preg_match('/beta$/i',$operande1)) { |
|
82 | + $operande1=-4; |
|
83 | + } |
|
84 | + if (preg_match('/beta$/i',$operande2)) { |
|
85 | + $operande2=-4; |
|
86 | + } |
|
87 | + if (preg_match('/beta([0-9])+/i',$operande1)) { |
|
88 | + $operande1=-3; |
|
89 | + } |
|
90 | + if (preg_match('/beta([0-9])+/i',$operande2)) { |
|
91 | + $operande2=-3; |
|
92 | + } |
|
93 | + if (preg_match('/rc$/i',$operande1)) { |
|
94 | + $operande1=-2; |
|
95 | + } |
|
96 | + if (preg_match('/rc$/i',$operande2)) { |
|
97 | + $operande2=-2; |
|
98 | + } |
|
99 | + if (preg_match('/rc([0-9])+/i',$operande1)) { |
|
100 | + $operande1=-1; |
|
101 | + } |
|
102 | + if (preg_match('/rc([0-9])+/i',$operande2)) { |
|
103 | + $operande2=-1; |
|
104 | + } |
|
79 | 105 | $level++; |
80 | 106 | //print 'level '.$level.' '.$operande1.'-'.$operande2.'<br>'; |
81 | 107 | if ($operande1 < $operande2) { $ret = -$level; break; } |
@@ -154,8 +180,11 @@ discard block |
||
154 | 180 | while (! feof($fp)) |
155 | 181 | { |
156 | 182 | // Warning fgets with second parameter that is null or 0 hang. |
157 | - if ($linelengthlimit > 0) $buf = fgets($fp, $linelengthlimit); |
|
158 | - else $buf = fgets($fp); |
|
183 | + if ($linelengthlimit > 0) { |
|
184 | + $buf = fgets($fp, $linelengthlimit); |
|
185 | + } else { |
|
186 | + $buf = fgets($fp); |
|
187 | + } |
|
159 | 188 | |
160 | 189 | // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment) |
161 | 190 | if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i',$buf,$reg)) |
@@ -165,7 +194,9 @@ discard block |
||
165 | 194 | // restrict on database type |
166 | 195 | if (! empty($reg[1])) |
167 | 196 | { |
168 | - if (! preg_match('/'.preg_quote($reg[1]).'/i',$db->type)) $qualified=0; |
|
197 | + if (! preg_match('/'.preg_quote($reg[1]).'/i',$db->type)) { |
|
198 | + $qualified=0; |
|
199 | + } |
|
169 | 200 | } |
170 | 201 | |
171 | 202 | // restrict on version |
@@ -173,22 +204,25 @@ discard block |
||
173 | 204 | { |
174 | 205 | if (! empty($reg[2])) |
175 | 206 | { |
176 | - if (is_numeric($reg[2])) // This is a version |
|
207 | + if (is_numeric($reg[2])) { |
|
208 | + // This is a version |
|
177 | 209 | { |
178 | 210 | $versionrequest=explode('.',$reg[2]); |
211 | + } |
|
179 | 212 | //print var_dump($versionrequest); |
180 | 213 | //print var_dump($versionarray); |
181 | 214 | if (! count($versionrequest) || ! count($versionarray) || versioncompare($versionrequest,$versionarray) > 0) |
182 | 215 | { |
183 | 216 | $qualified=0; |
184 | 217 | } |
185 | - } |
|
186 | - else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE |
|
218 | + } else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE |
|
187 | 219 | { |
188 | 220 | $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); |
189 | 221 | //var_dump($reg[2]); |
190 | 222 | //var_dump($dbcollation); |
191 | - if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) $qualified=0; |
|
223 | + if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) { |
|
224 | + $qualified=0; |
|
225 | + } |
|
192 | 226 | //var_dump($qualified); |
193 | 227 | } |
194 | 228 | } |
@@ -205,25 +239,31 @@ discard block |
||
205 | 239 | // Add line buf to buffer if not a comment |
206 | 240 | if ($nocommentremoval || ! preg_match('/^\s*--/',$buf)) |
207 | 241 | { |
208 | - if (empty($nocommentremoval)) $buf=preg_replace('/([,;ERLT\)])\s*--.*$/i','\1',$buf); //remove comment from a line that not start with -- before add it to the buffer |
|
242 | + if (empty($nocommentremoval)) { |
|
243 | + $buf=preg_replace('/([,;ERLT\)])\s*--.*$/i','\1',$buf); |
|
244 | + } |
|
245 | + //remove comment from a line that not start with -- before add it to the buffer |
|
209 | 246 | $buffer .= trim($buf); |
210 | 247 | } |
211 | 248 | |
212 | 249 | //print $buf.'<br>';exit; |
213 | 250 | |
214 | - if (preg_match('/;/',$buffer)) // If string contains ';', it's end of a request string, we save it in arraysql. |
|
251 | + if (preg_match('/;/',$buffer)) { |
|
252 | + // If string contains ';', it's end of a request string, we save it in arraysql. |
|
215 | 253 | { |
216 | 254 | // Found new request |
217 | 255 | if ($buffer) $arraysql[$i]=$buffer; |
256 | + } |
|
218 | 257 | $i++; |
219 | 258 | $buffer=''; |
220 | 259 | } |
221 | 260 | } |
222 | 261 | |
223 | - if ($buffer) $arraysql[$i]=$buffer; |
|
262 | + if ($buffer) { |
|
263 | + $arraysql[$i]=$buffer; |
|
264 | + } |
|
224 | 265 | fclose($fp); |
225 | - } |
|
226 | - else |
|
266 | + } else |
|
227 | 267 | { |
228 | 268 | dol_syslog("Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR); |
229 | 269 | } |
@@ -247,13 +287,20 @@ discard block |
||
247 | 287 | { |
248 | 288 | $obj=$db->fetch_object($resql); |
249 | 289 | $listofmaxrowid[$table]=$obj->max; |
250 | - if (empty($listofmaxrowid[$table])) $listofmaxrowid[$table]=0; |
|
251 | - } |
|
252 | - else |
|
290 | + if (empty($listofmaxrowid[$table])) { |
|
291 | + $listofmaxrowid[$table]=0; |
|
292 | + } |
|
293 | + } else |
|
253 | 294 | { |
254 | - if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
255 | - if (! $silent) print '<div class="error">'.$langs->trans("Failed to get max rowid for ".$table)."</div></td>"; |
|
256 | - if (! $silent) print '</tr>'; |
|
295 | + if (! $silent) { |
|
296 | + print '<tr><td valign="top" colspan="2">'; |
|
297 | + } |
|
298 | + if (! $silent) { |
|
299 | + print '<div class="error">'.$langs->trans("Failed to get max rowid for ".$table)."</div></td>"; |
|
300 | + } |
|
301 | + if (! $silent) { |
|
302 | + print '</tr>'; |
|
303 | + } |
|
257 | 304 | $error++; |
258 | 305 | break; |
259 | 306 | } |
@@ -293,12 +340,16 @@ discard block |
||
293 | 340 | $sql=preg_replace('/llx_/i',MAIN_DB_PREFIX,$sql); |
294 | 341 | } |
295 | 342 | |
296 | - if (!empty($handler)) $sql=preg_replace('/__HANDLER__/i',"'".$handler."'",$sql); |
|
343 | + if (!empty($handler)) { |
|
344 | + $sql=preg_replace('/__HANDLER__/i',"'".$handler."'",$sql); |
|
345 | + } |
|
297 | 346 | |
298 | 347 | $newsql=preg_replace('/__ENTITY__/i',(!empty($entity)?$entity:$conf->entity),$sql); |
299 | 348 | |
300 | 349 | // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) |
301 | - if (! $silent) print '<tr><td class="tdtop">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n"; |
|
350 | + if (! $silent) { |
|
351 | + print '<tr><td class="tdtop">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n"; |
|
352 | + } |
|
302 | 353 | dol_syslog('Admin.lib::run_sql Request '.($i+1), LOG_DEBUG); |
303 | 354 | $sqlmodified=0; |
304 | 355 | |
@@ -336,9 +387,15 @@ discard block |
||
336 | 387 | $cursor=$reg[1]; |
337 | 388 | if (empty($listofinsertedrowid[$cursor])) |
338 | 389 | { |
339 | - if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
340 | - if (! $silent) print '<div class="error">'.$langs->trans("FileIsNotCorrect")."</div></td>"; |
|
341 | - if (! $silent) print '</tr>'; |
|
390 | + if (! $silent) { |
|
391 | + print '<tr><td valign="top" colspan="2">'; |
|
392 | + } |
|
393 | + if (! $silent) { |
|
394 | + print '<div class="error">'.$langs->trans("FileIsNotCorrect")."</div></td>"; |
|
395 | + } |
|
396 | + if (! $silent) { |
|
397 | + print '</tr>'; |
|
398 | + } |
|
342 | 399 | $error++; |
343 | 400 | break; |
344 | 401 | } |
@@ -348,12 +405,16 @@ discard block |
||
348 | 405 | $sqlmodified++; |
349 | 406 | } |
350 | 407 | |
351 | - if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1), LOG_DEBUG); |
|
408 | + if ($sqlmodified) { |
|
409 | + dol_syslog('Admin.lib::run_sql New Request '.($i+1), LOG_DEBUG); |
|
410 | + } |
|
352 | 411 | |
353 | 412 | $result=$db->query($newsql,$usesavepoint); |
354 | 413 | if ($result) |
355 | 414 | { |
356 | - if (! $silent) print '<!-- Result = OK -->'."\n"; |
|
415 | + if (! $silent) { |
|
416 | + print '<!-- Result = OK -->'."\n"; |
|
417 | + } |
|
357 | 418 | |
358 | 419 | if (preg_replace('/insert into ([^\s]+)/i',$newsql,$reg)) |
359 | 420 | { |
@@ -366,11 +427,12 @@ discard block |
||
366 | 427 | dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG); |
367 | 428 | } |
368 | 429 | // print '<td align="right">OK</td>'; |
369 | - } |
|
370 | - else |
|
430 | + } else |
|
371 | 431 | { |
372 | 432 | $errno=$db->errno(); |
373 | - if (! $silent) print '<!-- Result = '.$errno.' -->'."\n"; |
|
433 | + if (! $silent) { |
|
434 | + print '<!-- Result = '.$errno.' -->'."\n"; |
|
435 | + } |
|
374 | 436 | |
375 | 437 | // Define list of errors we accept (array $okerrors) |
376 | 438 | $okerrors=array( // By default |
@@ -388,33 +450,50 @@ discard block |
||
388 | 450 | 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS', |
389 | 451 | 'DB_ERROR_22P02' |
390 | 452 | ); |
391 | - if ($okerror == 'none') $okerrors=array(); |
|
453 | + if ($okerror == 'none') { |
|
454 | + $okerrors=array(); |
|
455 | + } |
|
392 | 456 | |
393 | 457 | // Is it an error we accept |
394 | 458 | if (! in_array($errno,$okerrors)) |
395 | 459 | { |
396 | - if (! $silent) print '<tr><td valign="top" colspan="2">'; |
|
397 | - if (! $silent) print '<div class="error">'.$langs->trans("Error")." ".$db->errno().": ".$newsql."<br>".$db->error()."</div></td>"; |
|
398 | - if (! $silent) print '</tr>'."\n"; |
|
460 | + if (! $silent) { |
|
461 | + print '<tr><td valign="top" colspan="2">'; |
|
462 | + } |
|
463 | + if (! $silent) { |
|
464 | + print '<div class="error">'.$langs->trans("Error")." ".$db->errno().": ".$newsql."<br>".$db->error()."</div></td>"; |
|
465 | + } |
|
466 | + if (! $silent) { |
|
467 | + print '</tr>'."\n"; |
|
468 | + } |
|
399 | 469 | dol_syslog('Admin.lib::run_sql Request '.($i+1)." Error ".$db->errno()." ".$newsql."<br>".$db->error(), LOG_ERR); |
400 | 470 | $error++; |
401 | 471 | } |
402 | 472 | } |
403 | 473 | |
404 | - if (! $silent) print '</tr>'."\n"; |
|
474 | + if (! $silent) { |
|
475 | + print '</tr>'."\n"; |
|
476 | + } |
|
405 | 477 | } |
406 | 478 | } |
407 | 479 | |
408 | 480 | if ($error == 0) |
409 | 481 | { |
410 | - if (! $silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
411 | - if (! $silent) print '<td align="right">'.$langs->trans("OK").'</td></tr>'."\n"; |
|
482 | + if (! $silent) { |
|
483 | + print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
484 | + } |
|
485 | + if (! $silent) { |
|
486 | + print '<td align="right">'.$langs->trans("OK").'</td></tr>'."\n"; |
|
487 | + } |
|
412 | 488 | $ok = 1; |
413 | - } |
|
414 | - else |
|
489 | + } else |
|
415 | 490 | { |
416 | - if (! $silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
417 | - if (! $silent) print '<td align="right"><font class="error">'.$langs->trans("KO").'</font></td></tr>'."\n"; |
|
491 | + if (! $silent) { |
|
492 | + print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>'; |
|
493 | + } |
|
494 | + if (! $silent) { |
|
495 | + print '<td align="right"><font class="error">'.$langs->trans("KO").'</font></td></tr>'."\n"; |
|
496 | + } |
|
418 | 497 | $ok = 0; |
419 | 498 | } |
420 | 499 | |
@@ -444,9 +523,13 @@ discard block |
||
444 | 523 | |
445 | 524 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; |
446 | 525 | $sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'"; |
447 | - if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'"; |
|
526 | + if (is_numeric($name)) { |
|
527 | + $sql.= " OR rowid = '".$db->escape($name)."'"; |
|
528 | + } |
|
448 | 529 | $sql.= ")"; |
449 | - if ($entity >= 0) $sql.= " AND entity = ".$entity; |
|
530 | + if ($entity >= 0) { |
|
531 | + $sql.= " AND entity = ".$entity; |
|
532 | + } |
|
450 | 533 | |
451 | 534 | dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG); |
452 | 535 | $resql=$db->query($sql); |
@@ -454,8 +537,7 @@ discard block |
||
454 | 537 | { |
455 | 538 | $conf->global->$name=''; |
456 | 539 | return 1; |
457 | - } |
|
458 | - else |
|
540 | + } else |
|
459 | 541 | { |
460 | 542 | dol_print_error($db); |
461 | 543 | return -1; |
@@ -487,7 +569,9 @@ discard block |
||
487 | 569 | if ($resql) |
488 | 570 | { |
489 | 571 | $obj=$db->fetch_object($resql); |
490 | - if ($obj) $value=$obj->value; |
|
572 | + if ($obj) { |
|
573 | + $value=$obj->value; |
|
574 | + } |
|
491 | 575 | } |
492 | 576 | return $value; |
493 | 577 | } |
@@ -527,14 +611,18 @@ discard block |
||
527 | 611 | |
528 | 612 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; |
529 | 613 | $sql.= " WHERE name = ".$db->encrypt($name,1); |
530 | - if ($entity >= 0) $sql.= " AND entity = ".$entity; |
|
614 | + if ($entity >= 0) { |
|
615 | + $sql.= " AND entity = ".$entity; |
|
616 | + } |
|
531 | 617 | |
532 | 618 | dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); |
533 | 619 | $resql=$db->query($sql); |
534 | 620 | |
535 | - if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0 |
|
621 | + if (strcmp($value,'')) { |
|
622 | + // true if different. Must work for $value='0' or $value=0 |
|
536 | 623 | { |
537 | 624 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity)"; |
625 | + } |
|
538 | 626 | $sql.= " VALUES ("; |
539 | 627 | $sql.= $db->encrypt($name,1); |
540 | 628 | $sql.= ", ".$db->encrypt($value,1); |
@@ -551,8 +639,7 @@ discard block |
||
551 | 639 | $db->commit(); |
552 | 640 | $conf->global->$name=$value; |
553 | 641 | return 1; |
554 | - } |
|
555 | - else |
|
642 | + } else |
|
556 | 643 | { |
557 | 644 | $error=$db->lasterror(); |
558 | 645 | $db->rollback(); |
@@ -649,18 +736,26 @@ discard block |
||
649 | 736 | $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" |
650 | 737 | $sql.= " AND entity = ".$conf->entity; |
651 | 738 | $sql.= " AND bydefault = 1"; |
652 | - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled |
|
739 | + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { |
|
740 | + $sql.= " AND r.perms NOT LIKE '%_advance'"; |
|
741 | + } |
|
742 | + // Hide advanced perms if option is not enabled |
|
653 | 743 | $resql = $db->query($sql); |
654 | 744 | if ($resql) |
655 | 745 | { |
656 | 746 | $obj = $db->fetch_object($resql); |
657 | - if ($obj) $nbPerms = $obj->nb; |
|
747 | + if ($obj) { |
|
748 | + $nbPerms = $obj->nb; |
|
749 | + } |
|
750 | + } else { |
|
751 | + dol_print_error($db); |
|
658 | 752 | } |
659 | - else dol_print_error($db); |
|
660 | 753 | |
661 | 754 | $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; |
662 | 755 | $head[$h][1] = $langs->trans("DefaultRights"); |
663 | - if ($nbPerms > 0) $head[$h][1].= ' <span class="badge">'.$nbPerms.'</span>'; |
|
756 | + if ($nbPerms > 0) { |
|
757 | + $head[$h][1].= ' <span class="badge">'.$nbPerms.'</span>'; |
|
758 | + } |
|
664 | 759 | $head[$h][2] = 'default'; |
665 | 760 | $h++; |
666 | 761 | |
@@ -788,9 +883,11 @@ discard block |
||
788 | 883 | |
789 | 884 | if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session |
790 | 885 | (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity |
791 | - preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name |
|
886 | + preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) { |
|
887 | + // limit to company name |
|
792 | 888 | { |
793 | 889 | $tmp=explode('_', $file); |
890 | + } |
|
794 | 891 | $idsess=$tmp[1]; |
795 | 892 | $login = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i',$sessValues,$regs); |
796 | 893 | $arrayofSessions[$idsess]["login"] = $regs[1]; |
@@ -835,15 +932,19 @@ discard block |
||
835 | 932 | |
836 | 933 | if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session |
837 | 934 | preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity |
838 | - preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name |
|
935 | + preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) { |
|
936 | + // limit to company name |
|
839 | 937 | { |
840 | 938 | $tmp=explode('_', $file); |
939 | + } |
|
841 | 940 | $idsess=$tmp[1]; |
842 | 941 | // We remove session if it's not ourself |
843 | 942 | if ($idsess != $mysessionid) |
844 | 943 | { |
845 | 944 | $res=@unlink($fullpath); |
846 | - if (! $res) $error++; |
|
945 | + if (! $res) { |
|
946 | + $error++; |
|
947 | + } |
|
847 | 948 | } |
848 | 949 | } |
849 | 950 | } |
@@ -851,9 +952,12 @@ discard block |
||
851 | 952 | } |
852 | 953 | @closedir($dh); |
853 | 954 | |
854 | - if (! $error) return 1; |
|
855 | - else return -$error; |
|
856 | -} |
|
955 | + if (! $error) { |
|
956 | + return 1; |
|
957 | + } else { |
|
958 | + return -$error; |
|
959 | + } |
|
960 | + } |
|
857 | 961 | |
858 | 962 | |
859 | 963 | |
@@ -888,7 +992,9 @@ discard block |
||
888 | 992 | if (file_exists($dir.$modFile)) |
889 | 993 | { |
890 | 994 | $found=@include_once $dir.$modFile; |
891 | - if ($found) break; |
|
995 | + if ($found) { |
|
996 | + break; |
|
997 | + } |
|
892 | 998 | } |
893 | 999 | } |
894 | 1000 | |
@@ -927,8 +1033,7 @@ discard block |
||
927 | 1033 | if ($result <= 0) |
928 | 1034 | { |
929 | 1035 | $ret['errors'][]=$objMod->error; |
930 | - } |
|
931 | - else |
|
1036 | + } else |
|
932 | 1037 | { |
933 | 1038 | if ($withdeps) |
934 | 1039 | { |
@@ -952,7 +1057,7 @@ discard block |
||
952 | 1057 | $resarray = activateModule($modulestring); |
953 | 1058 | if (empty($resarray['errors'])){ |
954 | 1059 | $activate = true; |
955 | - }else{ |
|
1060 | + } else{ |
|
956 | 1061 | foreach ($resarray['errors'] as $errorMessage){ |
957 | 1062 | dol_syslog($errorMessage, LOG_ERR); |
958 | 1063 | } |
@@ -965,8 +1070,7 @@ discard block |
||
965 | 1070 | { |
966 | 1071 | $ret['nbmodules']+=$resarray['nbmodules']; |
967 | 1072 | $ret['nbperms']+=$resarray['nbperms']; |
968 | - } |
|
969 | - else |
|
1073 | + } else |
|
970 | 1074 | { |
971 | 1075 | $ret['errors'][] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $modulestring); |
972 | 1076 | } |
@@ -1013,7 +1117,9 @@ discard block |
||
1013 | 1117 | global $db, $modules, $conf; |
1014 | 1118 | |
1015 | 1119 | // Check parameters |
1016 | - if (empty($value)) return 'ErrorBadParameter'; |
|
1120 | + if (empty($value)) { |
|
1121 | + return 'ErrorBadParameter'; |
|
1122 | + } |
|
1017 | 1123 | |
1018 | 1124 | $ret=''; |
1019 | 1125 | $modName = $value; |
@@ -1029,7 +1135,9 @@ discard block |
||
1029 | 1135 | if (file_exists($dir.$modFile)) |
1030 | 1136 | { |
1031 | 1137 | $found=@include_once $dir.$modFile; |
1032 | - if ($found) break; |
|
1138 | + if ($found) { |
|
1139 | + break; |
|
1140 | + } |
|
1033 | 1141 | } |
1034 | 1142 | } |
1035 | 1143 | |
@@ -1037,9 +1145,10 @@ discard block |
||
1037 | 1145 | { |
1038 | 1146 | $objMod = new $modName($db); |
1039 | 1147 | $result=$objMod->remove(); |
1040 | - if ($result <= 0) $ret=$objMod->error; |
|
1041 | - } |
|
1042 | - else |
|
1148 | + if ($result <= 0) { |
|
1149 | + $ret=$objMod->error; |
|
1150 | + } |
|
1151 | + } else |
|
1043 | 1152 | { |
1044 | 1153 | //print $dir.$modFile; |
1045 | 1154 | // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded |
@@ -1117,8 +1226,7 @@ discard block |
||
1117 | 1226 | if ($objMod->numero > 0) |
1118 | 1227 | { |
1119 | 1228 | $j = $objMod->numero; |
1120 | - } |
|
1121 | - else |
|
1229 | + } else |
|
1122 | 1230 | { |
1123 | 1231 | $j = 1000 + $i; |
1124 | 1232 | } |
@@ -1127,10 +1235,16 @@ discard block |
||
1127 | 1235 | |
1128 | 1236 | // We discard modules according to features level (PS: if module is activated we always show it) |
1129 | 1237 | $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
1130 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
1131 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
1238 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) { |
|
1239 | + $modulequalified=0; |
|
1240 | + } |
|
1241 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) { |
|
1242 | + $modulequalified=0; |
|
1243 | + } |
|
1132 | 1244 | //If module is not activated disqualified |
1133 | - if (empty($conf->global->$const_name)) $modulequalified=0; |
|
1245 | + if (empty($conf->global->$const_name)) { |
|
1246 | + $modulequalified=0; |
|
1247 | + } |
|
1134 | 1248 | |
1135 | 1249 | if ($modulequalified) |
1136 | 1250 | { |
@@ -1142,7 +1256,10 @@ discard block |
||
1142 | 1256 | } |
1143 | 1257 | |
1144 | 1258 | // Complete the arrays &$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond |
1145 | - if (empty($objMod->dictionaries) && ! empty($objMod->dictionnaries)) $objMod->dictionaries=$objMod->dictionnaries; // For backward compatibility |
|
1259 | + if (empty($objMod->dictionaries) && ! empty($objMod->dictionnaries)) { |
|
1260 | + $objMod->dictionaries=$objMod->dictionnaries; |
|
1261 | + } |
|
1262 | + // For backward compatibility |
|
1146 | 1263 | |
1147 | 1264 | if (! empty($objMod->dictionaries)) |
1148 | 1265 | { |
@@ -1157,15 +1274,20 @@ discard block |
||
1157 | 1274 | foreach($objMod->dictionaries['tabfieldinsert'] as $val) { $nbtabfieldinsert++; $tabfieldinsert[] = $val; } |
1158 | 1275 | foreach($objMod->dictionaries['tabrowid'] as $val) { $nbtabrowid++; $tabrowid[] = $val; } |
1159 | 1276 | foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; } |
1160 | - if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; } |
|
1161 | - if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; } |
|
1277 | + if (! empty($objMod->dictionaries['tabhelp'])) { |
|
1278 | + foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; |
|
1279 | + } |
|
1280 | + $tabhelp[] = $val; } |
|
1281 | + if (! empty($objMod->dictionaries['tabfieldcheck'])) { |
|
1282 | + foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; |
|
1283 | + } |
|
1284 | + $tabfieldcheck[] = $val; } |
|
1162 | 1285 | |
1163 | 1286 | if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort) |
1164 | 1287 | { |
1165 | 1288 | print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"'; |
1166 | 1289 | //print "$const_name: $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp\n"; |
1167 | - } |
|
1168 | - else |
|
1290 | + } else |
|
1169 | 1291 | { |
1170 | 1292 | $taborder[] = 0; // Add an empty line |
1171 | 1293 | } |
@@ -1173,14 +1295,14 @@ discard block |
||
1173 | 1295 | |
1174 | 1296 | $j++; |
1175 | 1297 | $i++; |
1298 | + } else { |
|
1299 | + dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1176 | 1300 | } |
1177 | - else dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1178 | 1301 | } |
1179 | 1302 | } |
1180 | 1303 | } |
1181 | 1304 | closedir($handle); |
1182 | - } |
|
1183 | - else |
|
1305 | + } else |
|
1184 | 1306 | { |
1185 | 1307 | dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); |
1186 | 1308 | } |
@@ -1224,9 +1346,16 @@ discard block |
||
1224 | 1346 | // We discard modules according to features level (PS: if module is activated we always show it) |
1225 | 1347 | $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
1226 | 1348 | |
1227 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; |
|
1228 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; |
|
1229 | - if(!empty($conf->global->$const_name)) $modulequalified=0; // already activated |
|
1349 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { |
|
1350 | + $modulequalified=0; |
|
1351 | + } |
|
1352 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { |
|
1353 | + $modulequalified=0; |
|
1354 | + } |
|
1355 | + if(!empty($conf->global->$const_name)) { |
|
1356 | + $modulequalified=0; |
|
1357 | + } |
|
1358 | + // already activated |
|
1230 | 1359 | |
1231 | 1360 | if ($modulequalified) |
1232 | 1361 | { |
@@ -1237,14 +1366,14 @@ discard block |
||
1237 | 1366 | |
1238 | 1367 | setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings'); |
1239 | 1368 | } |
1369 | + } else { |
|
1370 | + dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1240 | 1371 | } |
1241 | - else dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1242 | 1372 | } |
1243 | 1373 | } |
1244 | 1374 | } |
1245 | 1375 | closedir($handle); |
1246 | - } |
|
1247 | - else |
|
1376 | + } else |
|
1248 | 1377 | { |
1249 | 1378 | dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); |
1250 | 1379 | } |
@@ -1298,8 +1427,7 @@ discard block |
||
1298 | 1427 | if ($objMod->numero > 0) |
1299 | 1428 | { |
1300 | 1429 | $j = $objMod->numero; |
1301 | - } |
|
1302 | - else |
|
1430 | + } else |
|
1303 | 1431 | { |
1304 | 1432 | $j = 1000 + $i; |
1305 | 1433 | } |
@@ -1308,10 +1436,16 @@ discard block |
||
1308 | 1436 | |
1309 | 1437 | // We discard modules according to features level (PS: if module is activated we always show it) |
1310 | 1438 | $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
1311 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
1312 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
1439 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) { |
|
1440 | + $modulequalified=0; |
|
1441 | + } |
|
1442 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) { |
|
1443 | + $modulequalified=0; |
|
1444 | + } |
|
1313 | 1445 | //If module is not activated disqualified |
1314 | - if (empty($conf->global->$const_name)) $modulequalified=0; |
|
1446 | + if (empty($conf->global->$const_name)) { |
|
1447 | + $modulequalified=0; |
|
1448 | + } |
|
1315 | 1449 | |
1316 | 1450 | if ($modulequalified) |
1317 | 1451 | { |
@@ -1337,14 +1471,14 @@ discard block |
||
1337 | 1471 | |
1338 | 1472 | $j++; |
1339 | 1473 | $i++; |
1474 | + } else { |
|
1475 | + dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1340 | 1476 | } |
1341 | - else dol_syslog("Module ".get_class($objMod)." not qualified"); |
|
1342 | 1477 | } |
1343 | 1478 | } |
1344 | 1479 | } |
1345 | 1480 | closedir($handle); |
1346 | - } |
|
1347 | - else |
|
1481 | + } else |
|
1348 | 1482 | { |
1349 | 1483 | dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); |
1350 | 1484 | } |
@@ -1369,7 +1503,9 @@ discard block |
||
1369 | 1503 | |
1370 | 1504 | $form = new Form($db); |
1371 | 1505 | |
1372 | - if (! empty($strictw3c) && $strictw3c == 1) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
1506 | + if (! empty($strictw3c) && $strictw3c == 1) { |
|
1507 | + print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
1508 | + } |
|
1373 | 1509 | |
1374 | 1510 | print '<table class="noborder" width="100%">'; |
1375 | 1511 | print '<tr class="liste_titre">'; |
@@ -1378,27 +1514,29 @@ discard block |
||
1378 | 1514 | $text = $langs->trans("Value"); |
1379 | 1515 | print $form->textwithpicto($text, $helptext, 1, 'help', '', 0, 2, 'idhelptext'); |
1380 | 1516 | print '</td>'; |
1381 | - if (empty($strictw3c)) print '<td align="center" width="80">'.$langs->trans("Action").'</td>'; |
|
1517 | + if (empty($strictw3c)) { |
|
1518 | + print '<td align="center" width="80">'.$langs->trans("Action").'</td>'; |
|
1519 | + } |
|
1382 | 1520 | print "</tr>\n"; |
1383 | 1521 | |
1384 | 1522 | $label=''; |
1385 | 1523 | $listofparam=array(); |
1386 | - foreach($tableau as $key => $const) // Loop on each param |
|
1524 | + foreach($tableau as $key => $const) { |
|
1525 | + // Loop on each param |
|
1387 | 1526 | { |
1388 | 1527 | $label=''; |
1528 | + } |
|
1389 | 1529 | // $const is a const key like 'MYMODULE_ABC' |
1390 | 1530 | if (is_numeric($key)) { // Very old behaviour |
1391 | 1531 | $type = 'string'; |
1392 | - } |
|
1393 | - else |
|
1532 | + } else |
|
1394 | 1533 | { |
1395 | 1534 | if (is_array($const)) |
1396 | 1535 | { |
1397 | 1536 | $type = $const['type']; |
1398 | 1537 | $label = $const['label']; |
1399 | 1538 | $const = $key; |
1400 | - } |
|
1401 | - else |
|
1539 | + } else |
|
1402 | 1540 | { |
1403 | 1541 | $type = $const; |
1404 | 1542 | $const = $key; |
@@ -1422,10 +1560,12 @@ discard block |
||
1422 | 1560 | { |
1423 | 1561 | $obj = $db->fetch_object($result); // Take first result of select |
1424 | 1562 | |
1425 | - if (empty($obj)) // If not yet into table |
|
1563 | + if (empty($obj)) { |
|
1564 | + // If not yet into table |
|
1426 | 1565 | { |
1427 | 1566 | $obj = (object) array('rowid'=>'','name'=>$const,'value'=>'','type'=>$type,'note'=>''); |
1428 | 1567 | } |
1568 | + } |
|
1429 | 1569 | |
1430 | 1570 | if (empty($strictw3c)) |
1431 | 1571 | { |
@@ -1437,7 +1577,9 @@ discard block |
||
1437 | 1577 | |
1438 | 1578 | // Show constant |
1439 | 1579 | print '<td>'; |
1440 | - if (empty($strictw3c)) print '<input type="hidden" name="action" value="update">'; |
|
1580 | + if (empty($strictw3c)) { |
|
1581 | + print '<input type="hidden" name="action" value="update">'; |
|
1582 | + } |
|
1441 | 1583 | print '<input type="hidden" name="rowid'.(empty($strictw3c)?'':'[]').'" value="'.$obj->rowid.'">'; |
1442 | 1584 | print '<input type="hidden" name="constname'.(empty($strictw3c)?'':'[]').'" value="'.$const.'">'; |
1443 | 1585 | print '<input type="hidden" name="constnote_'.$obj->name.'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">'; |
@@ -1468,7 +1610,9 @@ discard block |
||
1468 | 1610 | print 'mymailmanlist<br>'; |
1469 | 1611 | print 'mymailmanlist1,mymailmanlist2<br>'; |
1470 | 1612 | print 'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>'; |
1471 | - if ($conf->categorie->enabled) print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>'; |
|
1613 | + if ($conf->categorie->enabled) { |
|
1614 | + print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>'; |
|
1615 | + } |
|
1472 | 1616 | print '</div>'; |
1473 | 1617 | //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; |
1474 | 1618 | } |
@@ -1490,8 +1634,7 @@ discard block |
||
1490 | 1634 | print '<input type="hidden" name="consttype" value="yesno">'; |
1491 | 1635 | print '<input type="hidden" name="constnote'.(empty($strictw3c)?'':'[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">'; |
1492 | 1636 | print '</td>'; |
1493 | - } |
|
1494 | - else |
|
1637 | + } else |
|
1495 | 1638 | { |
1496 | 1639 | print '<td>'; |
1497 | 1640 | print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="'.($obj->type?$obj->type:'string').'">'; |
@@ -1501,18 +1644,15 @@ discard block |
||
1501 | 1644 | print '<textarea class="flat" name="constvalue'.(empty($strictw3c)?'':'[]').'" cols="50" rows="5" wrap="soft">'."\n"; |
1502 | 1645 | print $obj->value; |
1503 | 1646 | print "</textarea>\n"; |
1504 | - } |
|
1505 | - elseif ($obj->type == 'html') |
|
1647 | + } elseif ($obj->type == 'html') |
|
1506 | 1648 | { |
1507 | 1649 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
1508 | 1650 | $doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,ROWS_5,'90%'); |
1509 | 1651 | $doleditor->Create(); |
1510 | - } |
|
1511 | - elseif ($obj->type == 'yesno') |
|
1652 | + } elseif ($obj->type == 'yesno') |
|
1512 | 1653 | { |
1513 | 1654 | print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1); |
1514 | - } |
|
1515 | - elseif (preg_match('/emailtemplate/', $obj->type)) |
|
1655 | + } elseif (preg_match('/emailtemplate/', $obj->type)) |
|
1516 | 1656 | { |
1517 | 1657 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
1518 | 1658 | $formmail = new FormMail($db); |
@@ -1528,15 +1668,16 @@ discard block |
||
1528 | 1668 | { |
1529 | 1669 | //var_dump($modelmail); |
1530 | 1670 | $moreonlabel=''; |
1531 | - if (! empty($arrayofmessagename[$modelmail->label])) $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; |
|
1671 | + if (! empty($arrayofmessagename[$modelmail->label])) { |
|
1672 | + $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; |
|
1673 | + } |
|
1532 | 1674 | $arrayofmessagename[$modelmail->label]=$langs->trans(preg_replace('/\(|\)/','',$modelmail->label)).$moreonlabel; |
1533 | 1675 | } |
1534 | 1676 | } |
1535 | 1677 | //var_dump($arraydefaultmessage); |
1536 | 1678 | //var_dump($arrayofmessagename); |
1537 | 1679 | print $form->selectarray('constvalue_'.$obj->name, $arrayofmessagename, $obj->value, 'None', 1, 0, '', 0, 0, 0, '', '', 1); |
1538 | - } |
|
1539 | - else // type = 'string' ou 'chaine' |
|
1680 | + } else // type = 'string' ou 'chaine' |
|
1540 | 1681 | { |
1541 | 1682 | print '<input type="text" class="flat" size="48" name="constvalue'.(empty($strictw3c)?'':'[]').'" value="'.dol_escape_htmltag($obj->value).'">'; |
1542 | 1683 | } |
@@ -1550,7 +1691,9 @@ discard block |
||
1550 | 1691 | print "</td>"; |
1551 | 1692 | } |
1552 | 1693 | print "</tr>\n"; |
1553 | - if (empty($strictw3c)) print "</form>\n"; |
|
1694 | + if (empty($strictw3c)) { |
|
1695 | + print "</form>\n"; |
|
1696 | + } |
|
1554 | 1697 | } |
1555 | 1698 | } |
1556 | 1699 | print '</table>'; |
@@ -1584,11 +1727,16 @@ discard block |
||
1584 | 1727 | //print 'modulename='.$modulename; |
1585 | 1728 | |
1586 | 1729 | //if (empty($conf->global->$moduleconst)) continue; |
1587 | - if (! in_array($modulename,$listofmodules)) continue; |
|
1730 | + if (! in_array($modulename,$listofmodules)) { |
|
1731 | + continue; |
|
1732 | + } |
|
1588 | 1733 | //var_dump($modulename.' - '.$langs->trans('Module'.$module->numero.'Name')); |
1589 | 1734 | |
1590 | - if ($i > 0) $text.=', '; |
|
1591 | - else $text.=' '; |
|
1735 | + if ($i > 0) { |
|
1736 | + $text.=', '; |
|
1737 | + } else { |
|
1738 | + $text.=' '; |
|
1739 | + } |
|
1592 | 1740 | $i++; |
1593 | 1741 | $text .= $langs->trans('Module'.$module->numero.'Name'); |
1594 | 1742 | } |
@@ -1624,8 +1772,7 @@ discard block |
||
1624 | 1772 | { |
1625 | 1773 | $db->commit(); |
1626 | 1774 | return 1; |
1627 | - } |
|
1628 | - else |
|
1775 | + } else |
|
1629 | 1776 | { |
1630 | 1777 | dol_print_error($db); |
1631 | 1778 | $db->rollback(); |
@@ -1657,8 +1804,7 @@ discard block |
||
1657 | 1804 | { |
1658 | 1805 | $db->commit(); |
1659 | 1806 | return 1; |
1660 | - } |
|
1661 | - else |
|
1807 | + } else |
|
1662 | 1808 | { |
1663 | 1809 | dol_print_error($db); |
1664 | 1810 | $db->rollback(); |
@@ -1686,8 +1832,7 @@ discard block |
||
1686 | 1832 | if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
1687 | 1833 | { |
1688 | 1834 | $info_arr[trim($cat)][trim($val[1])] = $val[2]; |
1689 | - } |
|
1690 | - elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1835 | + } elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) |
|
1691 | 1836 | { |
1692 | 1837 | $info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]); |
1693 | 1838 | } |
@@ -49,157 +49,157 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=0) |
51 | 51 | { |
52 | - global $conf, $user, $langs, $db, $hookmanager; |
|
53 | - global $begin_h, $end_h, $begin_d, $end_d; |
|
54 | - |
|
55 | - $langs->load("companies"); |
|
56 | - |
|
57 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
58 | - $formactions=new FormActions($db); |
|
59 | - |
|
60 | - // Filters |
|
61 | - //print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">'; |
|
62 | - print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; |
|
63 | - print '<input type="hidden" name="year" value="' . $year . '">'; |
|
64 | - print '<input type="hidden" name="month" value="' . $month . '">'; |
|
65 | - print '<input type="hidden" name="day" value="' . $day . '">'; |
|
66 | - print '<input type="hidden" name="action" value="' . $action . '">'; |
|
67 | - print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">'; |
|
68 | - |
|
69 | - print '<div class="fichecenter">'; |
|
70 | - |
|
71 | - if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">'; |
|
72 | - else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">'; |
|
73 | - |
|
74 | - print '<table class="nobordernopadding centpercent">'; |
|
75 | - |
|
76 | - if ($canedit) |
|
77 | - { |
|
78 | - print '<tr>'; |
|
79 | - print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
80 | - print $langs->trans("ActionsToDoBy").' '; |
|
81 | - print '</td><td style="padding-bottom: 2px; padding-right: 4px;">'; |
|
82 | - print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); |
|
83 | - if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' '; |
|
84 | - print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); |
|
85 | - print '</td></tr>'; |
|
86 | - |
|
87 | - if ($conf->resource->enabled) |
|
88 | - { |
|
89 | - include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php'; |
|
90 | - $formresource=new FormResource($db); |
|
91 | - |
|
92 | - // Resource |
|
93 | - print '<tr>'; |
|
94 | - print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
95 | - print $langs->trans("Resource"); |
|
96 | - print ' </td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
52 | + global $conf, $user, $langs, $db, $hookmanager; |
|
53 | + global $begin_h, $end_h, $begin_d, $end_d; |
|
54 | + |
|
55 | + $langs->load("companies"); |
|
56 | + |
|
57 | + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
58 | + $formactions=new FormActions($db); |
|
59 | + |
|
60 | + // Filters |
|
61 | + //print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">'; |
|
62 | + print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; |
|
63 | + print '<input type="hidden" name="year" value="' . $year . '">'; |
|
64 | + print '<input type="hidden" name="month" value="' . $month . '">'; |
|
65 | + print '<input type="hidden" name="day" value="' . $day . '">'; |
|
66 | + print '<input type="hidden" name="action" value="' . $action . '">'; |
|
67 | + print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">'; |
|
68 | + |
|
69 | + print '<div class="fichecenter">'; |
|
70 | + |
|
71 | + if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">'; |
|
72 | + else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">'; |
|
73 | + |
|
74 | + print '<table class="nobordernopadding centpercent">'; |
|
75 | + |
|
76 | + if ($canedit) |
|
77 | + { |
|
78 | + print '<tr>'; |
|
79 | + print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
80 | + print $langs->trans("ActionsToDoBy").' '; |
|
81 | + print '</td><td style="padding-bottom: 2px; padding-right: 4px;">'; |
|
82 | + print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); |
|
83 | + if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' '; |
|
84 | + print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); |
|
85 | + print '</td></tr>'; |
|
86 | + |
|
87 | + if ($conf->resource->enabled) |
|
88 | + { |
|
89 | + include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php'; |
|
90 | + $formresource=new FormResource($db); |
|
91 | + |
|
92 | + // Resource |
|
93 | + print '<tr>'; |
|
94 | + print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
95 | + print $langs->trans("Resource"); |
|
96 | + print ' </td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
97 | 97 | print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2); |
98 | - print '</td></tr>'; |
|
99 | - } |
|
100 | - |
|
101 | - // Type |
|
102 | - print '<tr>'; |
|
103 | - print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
104 | - print $langs->trans("Type"); |
|
105 | - print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
106 | - $multiselect=0; |
|
107 | - if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list" |
|
108 | - { |
|
98 | + print '</td></tr>'; |
|
99 | + } |
|
100 | + |
|
101 | + // Type |
|
102 | + print '<tr>'; |
|
103 | + print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
104 | + print $langs->trans("Type"); |
|
105 | + print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
106 | + $multiselect=0; |
|
107 | + if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list" |
|
108 | + { |
|
109 | 109 | $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE)); |
110 | - } |
|
110 | + } |
|
111 | 111 | print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect); |
112 | - print '</td></tr>'; |
|
113 | - } |
|
114 | - |
|
115 | - if (! empty($conf->societe->enabled) && $user->rights->societe->lire) |
|
116 | - { |
|
117 | - print '<tr>'; |
|
118 | - print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
119 | - print $langs->trans("ThirdParty").' '; |
|
120 | - print '</td><td class="nowrap" style="padding-bottom: 2px;">'; |
|
121 | - print $form->select_company($socid, 'search_socid', '', 'SelectThirdParty', 0, 0, null, 0); |
|
122 | - print '</td></tr>'; |
|
123 | - } |
|
124 | - |
|
125 | - if (! empty($conf->projet->enabled) && $user->rights->projet->lire) |
|
126 | - { |
|
127 | - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
128 | - $formproject=new FormProjets($db); |
|
129 | - |
|
130 | - print '<tr>'; |
|
131 | - print '<td class="nowrap" style="padding-bottom: 2px;">'; |
|
132 | - print $langs->trans("Project").' '; |
|
133 | - print '</td><td class="nowrap" style="padding-bottom: 2px;">'; |
|
134 | - print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500'); |
|
135 | - print '</td></tr>'; |
|
136 | - } |
|
137 | - |
|
138 | - if ($canedit && ! preg_match('/list/', $_SERVER["PHP_SELF"])) |
|
139 | - { |
|
140 | - // Status |
|
141 | - print '<tr>'; |
|
142 | - print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
143 | - print $langs->trans("Status"); |
|
144 | - print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
145 | - $formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100'); |
|
146 | - print '</td></tr>'; |
|
147 | - } |
|
148 | - |
|
149 | - if ($canedit && $action == 'show_peruser') |
|
150 | - { |
|
151 | - // Filter on hours |
|
152 | - print '<tr>'; |
|
153 | - print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("VisibleTimeRange").'</td>'; |
|
154 | - print "<td class='nowrap'>"; |
|
155 | - print '<div class="ui-grid-a"><div class="ui-block-a">'; |
|
156 | - print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">'; |
|
157 | - if (empty($conf->dol_use_jmobile)) print ' - '; |
|
158 | - else print '</div><div class="ui-block-b">'; |
|
159 | - print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">'; |
|
160 | - if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H"); |
|
161 | - print '</div></div>'; |
|
162 | - print '</td></tr>'; |
|
163 | - |
|
164 | - // Filter on days |
|
165 | - print '<tr>'; |
|
166 | - print '<td class="nowrap">'.$langs->trans("VisibleDaysRange").'</td>'; |
|
167 | - print "<td class='nowrap'>"; |
|
168 | - print '<div class="ui-grid-a"><div class="ui-block-a">'; |
|
169 | - print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">'; |
|
170 | - if (empty($conf->dol_use_jmobile)) print ' - '; |
|
171 | - else print '</div><div class="ui-block-b">'; |
|
172 | - print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">'; |
|
173 | - print '</div></div>'; |
|
174 | - print '</td></tr>'; |
|
175 | - } |
|
176 | - |
|
177 | - // Hooks |
|
178 | - $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid); |
|
179 | - $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been |
|
180 | - |
|
181 | - print '</table>'; |
|
182 | - |
|
183 | - if ($conf->browser->layout == 'phone') print '</div>'; |
|
184 | - else print '</td>'; |
|
185 | - |
|
186 | - if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">'; |
|
187 | - else print '<td align="center" valign="middle" class="nowrap">'; |
|
188 | - |
|
189 | - print '<table class="centpercent"><tr><td align="center">'; |
|
190 | - print '<div class="formleftzone">'; |
|
191 | - print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">'; |
|
192 | - print '</div>'; |
|
193 | - print '</td></tr>'; |
|
194 | - print '</table>'; |
|
195 | - |
|
196 | - if ($conf->browser->layout == 'phone') print '</div>'; |
|
197 | - else print '</td></tr></table>'; |
|
198 | - |
|
199 | - print '</div>'; // Close fichecenter |
|
200 | - print '<div style="clear:both"></div>'; |
|
201 | - |
|
202 | - //print '</form>'; |
|
112 | + print '</td></tr>'; |
|
113 | + } |
|
114 | + |
|
115 | + if (! empty($conf->societe->enabled) && $user->rights->societe->lire) |
|
116 | + { |
|
117 | + print '<tr>'; |
|
118 | + print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
119 | + print $langs->trans("ThirdParty").' '; |
|
120 | + print '</td><td class="nowrap" style="padding-bottom: 2px;">'; |
|
121 | + print $form->select_company($socid, 'search_socid', '', 'SelectThirdParty', 0, 0, null, 0); |
|
122 | + print '</td></tr>'; |
|
123 | + } |
|
124 | + |
|
125 | + if (! empty($conf->projet->enabled) && $user->rights->projet->lire) |
|
126 | + { |
|
127 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
128 | + $formproject=new FormProjets($db); |
|
129 | + |
|
130 | + print '<tr>'; |
|
131 | + print '<td class="nowrap" style="padding-bottom: 2px;">'; |
|
132 | + print $langs->trans("Project").' '; |
|
133 | + print '</td><td class="nowrap" style="padding-bottom: 2px;">'; |
|
134 | + print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500'); |
|
135 | + print '</td></tr>'; |
|
136 | + } |
|
137 | + |
|
138 | + if ($canedit && ! preg_match('/list/', $_SERVER["PHP_SELF"])) |
|
139 | + { |
|
140 | + // Status |
|
141 | + print '<tr>'; |
|
142 | + print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
143 | + print $langs->trans("Status"); |
|
144 | + print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
|
145 | + $formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100'); |
|
146 | + print '</td></tr>'; |
|
147 | + } |
|
148 | + |
|
149 | + if ($canedit && $action == 'show_peruser') |
|
150 | + { |
|
151 | + // Filter on hours |
|
152 | + print '<tr>'; |
|
153 | + print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("VisibleTimeRange").'</td>'; |
|
154 | + print "<td class='nowrap'>"; |
|
155 | + print '<div class="ui-grid-a"><div class="ui-block-a">'; |
|
156 | + print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">'; |
|
157 | + if (empty($conf->dol_use_jmobile)) print ' - '; |
|
158 | + else print '</div><div class="ui-block-b">'; |
|
159 | + print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">'; |
|
160 | + if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H"); |
|
161 | + print '</div></div>'; |
|
162 | + print '</td></tr>'; |
|
163 | + |
|
164 | + // Filter on days |
|
165 | + print '<tr>'; |
|
166 | + print '<td class="nowrap">'.$langs->trans("VisibleDaysRange").'</td>'; |
|
167 | + print "<td class='nowrap'>"; |
|
168 | + print '<div class="ui-grid-a"><div class="ui-block-a">'; |
|
169 | + print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">'; |
|
170 | + if (empty($conf->dol_use_jmobile)) print ' - '; |
|
171 | + else print '</div><div class="ui-block-b">'; |
|
172 | + print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">'; |
|
173 | + print '</div></div>'; |
|
174 | + print '</td></tr>'; |
|
175 | + } |
|
176 | + |
|
177 | + // Hooks |
|
178 | + $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid); |
|
179 | + $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been |
|
180 | + |
|
181 | + print '</table>'; |
|
182 | + |
|
183 | + if ($conf->browser->layout == 'phone') print '</div>'; |
|
184 | + else print '</td>'; |
|
185 | + |
|
186 | + if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">'; |
|
187 | + else print '<td align="center" valign="middle" class="nowrap">'; |
|
188 | + |
|
189 | + print '<table class="centpercent"><tr><td align="center">'; |
|
190 | + print '<div class="formleftzone">'; |
|
191 | + print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">'; |
|
192 | + print '</div>'; |
|
193 | + print '</td></tr>'; |
|
194 | + print '</table>'; |
|
195 | + |
|
196 | + if ($conf->browser->layout == 'phone') print '</div>'; |
|
197 | + else print '</td></tr></table>'; |
|
198 | + |
|
199 | + print '</div>'; // Close fichecenter |
|
200 | + print '<div style="clear:both"></div>'; |
|
201 | + |
|
202 | + //print '</form>'; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -211,42 +211,42 @@ discard block |
||
211 | 211 | */ |
212 | 212 | function show_array_actions_to_do($max=5) |
213 | 213 | { |
214 | - global $langs, $conf, $user, $db, $bc, $socid; |
|
214 | + global $langs, $conf, $user, $db, $bc, $socid; |
|
215 | 215 | |
216 | - $now=dol_now(); |
|
216 | + $now=dol_now(); |
|
217 | 217 | |
218 | - include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
219 | - include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; |
|
218 | + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
219 | + include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; |
|
220 | 220 | |
221 | - $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; |
|
222 | - $sql.= " c.code, c.libelle as type_label,"; |
|
223 | - $sql.= " s.nom as sname, s.rowid, s.client"; |
|
224 | - $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
225 | - $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; |
|
221 | + $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; |
|
222 | + $sql.= " c.code, c.libelle as type_label,"; |
|
223 | + $sql.= " s.nom as sname, s.rowid, s.client"; |
|
224 | + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
225 | + $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; |
|
226 | 226 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
227 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
228 | - $sql.= " WHERE a.entity = ".$conf->entity; |
|
227 | + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
228 | + $sql.= " WHERE a.entity = ".$conf->entity; |
|
229 | 229 | $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; |
230 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
231 | - if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
232 | - $sql.= " ORDER BY a.datep DESC, a.id DESC"; |
|
233 | - $sql.= $db->plimit($max, 0); |
|
230 | + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
231 | + if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
232 | + $sql.= " ORDER BY a.datep DESC, a.id DESC"; |
|
233 | + $sql.= $db->plimit($max, 0); |
|
234 | 234 | |
235 | - $resql=$db->query($sql); |
|
236 | - if ($resql) |
|
237 | - { |
|
238 | - $num = $db->num_rows($resql); |
|
235 | + $resql=$db->query($sql); |
|
236 | + if ($resql) |
|
237 | + { |
|
238 | + $num = $db->num_rows($resql); |
|
239 | 239 | |
240 | - print '<table class="noborder" width="100%">'; |
|
241 | - print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo",$max).'</th>'; |
|
242 | - print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>'; |
|
243 | - print '</tr>'; |
|
240 | + print '<table class="noborder" width="100%">'; |
|
241 | + print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo",$max).'</th>'; |
|
242 | + print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>'; |
|
243 | + print '</tr>'; |
|
244 | 244 | |
245 | - $var = true; |
|
246 | - $i = 0; |
|
245 | + $var = true; |
|
246 | + $i = 0; |
|
247 | 247 | |
248 | - $staticaction=new ActionComm($db); |
|
249 | - $customerstatic=new Client($db); |
|
248 | + $staticaction=new ActionComm($db); |
|
249 | + $customerstatic=new Client($db); |
|
250 | 250 | |
251 | 251 | while ($i < $num) |
252 | 252 | { |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | $staticaction->id=$obj->id; |
261 | 261 | print '<td>'.$staticaction->getNomUrl(1,34).'</td>'; |
262 | 262 | |
263 | - // print '<td>'.dol_trunc($obj->label,22).'</td>'; |
|
263 | + // print '<td>'.dol_trunc($obj->label,22).'</td>'; |
|
264 | 264 | |
265 | 265 | print '<td>'; |
266 | 266 | if ($obj->rowid > 0) |
267 | 267 | { |
268 | - $customerstatic->id=$obj->rowid; |
|
269 | - $customerstatic->name=$obj->sname; |
|
270 | - $customerstatic->client=$obj->client; |
|
271 | - print $customerstatic->getNomUrl(1,'',16); |
|
268 | + $customerstatic->id=$obj->rowid; |
|
269 | + $customerstatic->name=$obj->sname; |
|
270 | + $customerstatic->client=$obj->client; |
|
271 | + print $customerstatic->getNomUrl(1,'',16); |
|
272 | 272 | } |
273 | 273 | print '</td>'; |
274 | 274 | |
@@ -276,30 +276,30 @@ discard block |
||
276 | 276 | $datep2=$db->jdate($obj->dp2); |
277 | 277 | |
278 | 278 | // Date |
279 | - print '<td width="100" align="right">'.dol_print_date($datep,'day').' '; |
|
280 | - $late=0; |
|
281 | - if ($obj->percent == 0 && $datep && $datep < time()) $late=1; |
|
282 | - if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1; |
|
283 | - if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1; |
|
284 | - if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1; |
|
285 | - if ($late) print img_warning($langs->trans("Late")); |
|
286 | - print "</td>"; |
|
279 | + print '<td width="100" align="right">'.dol_print_date($datep,'day').' '; |
|
280 | + $late=0; |
|
281 | + if ($obj->percent == 0 && $datep && $datep < time()) $late=1; |
|
282 | + if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1; |
|
283 | + if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1; |
|
284 | + if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1; |
|
285 | + if ($late) print img_warning($langs->trans("Late")); |
|
286 | + print "</td>"; |
|
287 | 287 | |
288 | - // Statut |
|
289 | - print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; |
|
288 | + // Statut |
|
289 | + print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; |
|
290 | 290 | |
291 | - print "</tr>\n"; |
|
291 | + print "</tr>\n"; |
|
292 | 292 | |
293 | 293 | $i++; |
294 | 294 | } |
295 | - print "</table><br>"; |
|
296 | - |
|
297 | - $db->free($resql); |
|
298 | - } |
|
299 | - else |
|
300 | - { |
|
301 | - dol_print_error($db); |
|
302 | - } |
|
295 | + print "</table><br>"; |
|
296 | + |
|
297 | + $db->free($resql); |
|
298 | + } |
|
299 | + else |
|
300 | + { |
|
301 | + dol_print_error($db); |
|
302 | + } |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -311,83 +311,83 @@ discard block |
||
311 | 311 | */ |
312 | 312 | function show_array_last_actions_done($max=5) |
313 | 313 | { |
314 | - global $langs, $conf, $user, $db, $bc, $socid; |
|
314 | + global $langs, $conf, $user, $db, $bc, $socid; |
|
315 | 315 | |
316 | - $now=dol_now(); |
|
316 | + $now=dol_now(); |
|
317 | 317 | |
318 | - $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,"; |
|
319 | - $sql.= " c.code, c.libelle,"; |
|
320 | - $sql.= " s.rowid, s.nom as sname, s.client"; |
|
321 | - $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
322 | - $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action "; |
|
318 | + $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,"; |
|
319 | + $sql.= " c.code, c.libelle,"; |
|
320 | + $sql.= " s.rowid, s.nom as sname, s.client"; |
|
321 | + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
322 | + $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action "; |
|
323 | 323 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
324 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
325 | - $sql.= " WHERE a.entity = ".$conf->entity; |
|
324 | + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
325 | + $sql.= " WHERE a.entity = ".$conf->entity; |
|
326 | 326 | $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; |
327 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
327 | + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
328 | 328 | if ($socid) $sql.= " AND s.rowid = ".$socid; |
329 | - $sql .= " ORDER BY a.datep2 DESC"; |
|
330 | - $sql .= $db->plimit($max, 0); |
|
329 | + $sql .= " ORDER BY a.datep2 DESC"; |
|
330 | + $sql .= $db->plimit($max, 0); |
|
331 | 331 | |
332 | - $resql=$db->query($sql); |
|
333 | - if ($resql) |
|
334 | - { |
|
335 | - $num = $db->num_rows($resql); |
|
332 | + $resql=$db->query($sql); |
|
333 | + if ($resql) |
|
334 | + { |
|
335 | + $num = $db->num_rows($resql); |
|
336 | 336 | |
337 | - print '<table class="noborder" width="100%">'; |
|
338 | - print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks",$max).'</th>'; |
|
339 | - print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>'; |
|
340 | - print '</tr>'; |
|
341 | - $var = true; |
|
342 | - $i = 0; |
|
337 | + print '<table class="noborder" width="100%">'; |
|
338 | + print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks",$max).'</th>'; |
|
339 | + print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>'; |
|
340 | + print '</tr>'; |
|
341 | + $var = true; |
|
342 | + $i = 0; |
|
343 | 343 | |
344 | - $staticaction=new ActionComm($db); |
|
345 | - $customerstatic=new Societe($db); |
|
344 | + $staticaction=new ActionComm($db); |
|
345 | + $customerstatic=new Societe($db); |
|
346 | 346 | |
347 | - while ($i < $num) |
|
348 | - { |
|
349 | - $obj = $db->fetch_object($resql); |
|
347 | + while ($i < $num) |
|
348 | + { |
|
349 | + $obj = $db->fetch_object($resql); |
|
350 | 350 | |
351 | 351 | |
352 | - print '<tr class="oddeven">'; |
|
352 | + print '<tr class="oddeven">'; |
|
353 | 353 | |
354 | - $staticaction->type_code=$obj->code; |
|
355 | - $staticaction->libelle=$obj->label; |
|
356 | - $staticaction->id=$obj->id; |
|
357 | - print '<td>'.$staticaction->getNomUrl(1,34).'</td>'; |
|
354 | + $staticaction->type_code=$obj->code; |
|
355 | + $staticaction->libelle=$obj->label; |
|
356 | + $staticaction->id=$obj->id; |
|
357 | + print '<td>'.$staticaction->getNomUrl(1,34).'</td>'; |
|
358 | 358 | |
359 | 359 | //print '<td>'.dol_trunc($obj->label,24).'</td>'; |
360 | 360 | |
361 | - print '<td>'; |
|
362 | - if ($obj->rowid > 0) |
|
363 | - { |
|
361 | + print '<td>'; |
|
362 | + if ($obj->rowid > 0) |
|
363 | + { |
|
364 | 364 | $customerstatic->id=$obj->rowid; |
365 | 365 | $customerstatic->name=$obj->sname; |
366 | 366 | $customerstatic->client=$obj->client; |
367 | - print $customerstatic->getNomUrl(1,'',24); |
|
368 | - } |
|
369 | - print '</td>'; |
|
370 | - |
|
371 | - // Date |
|
372 | - print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2),'day'); |
|
373 | - print "</td>"; |
|
374 | - |
|
375 | - // Statut |
|
376 | - print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; |
|
377 | - |
|
378 | - print "</tr>\n"; |
|
379 | - $i++; |
|
380 | - } |
|
381 | - // TODO Ajouter rappel pour "il y a des contrats a mettre en service" |
|
382 | - // TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration" |
|
383 | - print "</table><br>"; |
|
384 | - |
|
385 | - $db->free($resql); |
|
386 | - } |
|
387 | - else |
|
388 | - { |
|
389 | - dol_print_error($db); |
|
390 | - } |
|
367 | + print $customerstatic->getNomUrl(1,'',24); |
|
368 | + } |
|
369 | + print '</td>'; |
|
370 | + |
|
371 | + // Date |
|
372 | + print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2),'day'); |
|
373 | + print "</td>"; |
|
374 | + |
|
375 | + // Statut |
|
376 | + print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; |
|
377 | + |
|
378 | + print "</tr>\n"; |
|
379 | + $i++; |
|
380 | + } |
|
381 | + // TODO Ajouter rappel pour "il y a des contrats a mettre en service" |
|
382 | + // TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration" |
|
383 | + print "</table><br>"; |
|
384 | + |
|
385 | + $db->free($resql); |
|
386 | + } |
|
387 | + else |
|
388 | + { |
|
389 | + dol_print_error($db); |
|
390 | + } |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | |
@@ -398,49 +398,49 @@ discard block |
||
398 | 398 | */ |
399 | 399 | function agenda_prepare_head() |
400 | 400 | { |
401 | - global $langs, $conf, $user; |
|
402 | - $h = 0; |
|
403 | - $head = array(); |
|
401 | + global $langs, $conf, $user; |
|
402 | + $h = 0; |
|
403 | + $head = array(); |
|
404 | 404 | |
405 | - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; |
|
406 | - $head[$h][1] = $langs->trans("Miscellaneous"); |
|
407 | - $head[$h][2] = 'other'; |
|
408 | - $h++; |
|
405 | + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; |
|
406 | + $head[$h][1] = $langs->trans("Miscellaneous"); |
|
407 | + $head[$h][2] = 'other'; |
|
408 | + $h++; |
|
409 | 409 | |
410 | - $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php"; |
|
411 | - $head[$h][1] = $langs->trans("AutoActions"); |
|
412 | - $head[$h][2] = 'autoactions'; |
|
413 | - $h++; |
|
410 | + $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php"; |
|
411 | + $head[$h][1] = $langs->trans("AutoActions"); |
|
412 | + $head[$h][2] = 'autoactions'; |
|
413 | + $h++; |
|
414 | 414 | |
415 | - if ($conf->global->MAIN_FEATURES_LEVEL > 0) |
|
416 | - { |
|
417 | - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php"; |
|
418 | - $head[$h][1] = $langs->trans("Reminders"); |
|
419 | - $head[$h][2] = 'reminders'; |
|
420 | - $h++; |
|
421 | - } |
|
415 | + if ($conf->global->MAIN_FEATURES_LEVEL > 0) |
|
416 | + { |
|
417 | + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php"; |
|
418 | + $head[$h][1] = $langs->trans("Reminders"); |
|
419 | + $head[$h][2] = 'reminders'; |
|
420 | + $h++; |
|
421 | + } |
|
422 | 422 | |
423 | - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; |
|
424 | - $head[$h][1] = $langs->trans("ExportCal"); |
|
425 | - $head[$h][2] = 'xcal'; |
|
426 | - $h++; |
|
423 | + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; |
|
424 | + $head[$h][1] = $langs->trans("ExportCal"); |
|
425 | + $head[$h][2] = 'xcal'; |
|
426 | + $h++; |
|
427 | 427 | |
428 | - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extsites.php"; |
|
429 | - $head[$h][1] = $langs->trans("ExtSites"); |
|
430 | - $head[$h][2] = 'extsites'; |
|
431 | - $h++; |
|
428 | + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extsites.php"; |
|
429 | + $head[$h][1] = $langs->trans("ExtSites"); |
|
430 | + $head[$h][2] = 'extsites'; |
|
431 | + $h++; |
|
432 | 432 | |
433 | - complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin'); |
|
433 | + complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin'); |
|
434 | 434 | |
435 | - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; |
|
436 | - $head[$h][1] = $langs->trans("ExtraFields"); |
|
437 | - $head[$h][2] = 'attributes'; |
|
438 | - $h++; |
|
435 | + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; |
|
436 | + $head[$h][1] = $langs->trans("ExtraFields"); |
|
437 | + $head[$h][2] = 'attributes'; |
|
438 | + $h++; |
|
439 | 439 | |
440 | - complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove'); |
|
440 | + complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove'); |
|
441 | 441 | |
442 | 442 | |
443 | - return $head; |
|
443 | + return $head; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
@@ -451,30 +451,30 @@ discard block |
||
451 | 451 | */ |
452 | 452 | function actions_prepare_head($object) |
453 | 453 | { |
454 | - global $db, $langs, $conf, $user; |
|
454 | + global $db, $langs, $conf, $user; |
|
455 | 455 | |
456 | - $h = 0; |
|
457 | - $head = array(); |
|
456 | + $h = 0; |
|
457 | + $head = array(); |
|
458 | 458 | |
459 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id; |
|
460 | - $head[$h][1] = $langs->trans("CardAction"); |
|
461 | - $head[$h][2] = 'card'; |
|
462 | - $h++; |
|
459 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id; |
|
460 | + $head[$h][1] = $langs->trans("CardAction"); |
|
461 | + $head[$h][2] = 'card'; |
|
462 | + $h++; |
|
463 | 463 | |
464 | 464 | // Tab to link resources |
465 | - if ($conf->resource->enabled) |
|
466 | - { |
|
467 | - include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; |
|
468 | - $resource=new DolResource($db); |
|
465 | + if ($conf->resource->enabled) |
|
466 | + { |
|
467 | + include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; |
|
468 | + $resource=new DolResource($db); |
|
469 | 469 | |
470 | - $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id; |
|
470 | + $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id; |
|
471 | 471 | $listofresourcelinked = $resource->getElementResources($object->element, $object->id); |
472 | 472 | $nbResources=count($listofresourcelinked); |
473 | - $head[$h][1] = $langs->trans("Resources"); |
|
474 | - if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>'; |
|
475 | - $head[$h][2] = 'resources'; |
|
476 | - $h++; |
|
477 | - } |
|
473 | + $head[$h][1] = $langs->trans("Resources"); |
|
474 | + if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>'; |
|
475 | + $head[$h][2] = 'resources'; |
|
476 | + $h++; |
|
477 | + } |
|
478 | 478 | |
479 | 479 | // Attached files |
480 | 480 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -484,20 +484,20 @@ discard block |
||
484 | 484 | $nbLinks=Link::count($db, $object->element, $object->id); |
485 | 485 | $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id; |
486 | 486 | $head[$h][1] = $langs->trans("Documents"); |
487 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
487 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
488 | 488 | $head[$h][2] = 'documents'; |
489 | 489 | $h++; |
490 | 490 | |
491 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/info.php?id='.$object->id; |
|
492 | - $head[$h][1] = $langs->trans('Info'); |
|
493 | - $head[$h][2] = 'info'; |
|
494 | - $h++; |
|
491 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/info.php?id='.$object->id; |
|
492 | + $head[$h][1] = $langs->trans('Info'); |
|
493 | + $head[$h][2] = 'info'; |
|
494 | + $h++; |
|
495 | 495 | |
496 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'action'); |
|
496 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'action'); |
|
497 | 497 | |
498 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove'); |
|
498 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove'); |
|
499 | 499 | |
500 | - return $head; |
|
500 | + return $head; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $h++; |
550 | 550 | |
551 | 551 | |
552 | - $object=new stdClass(); |
|
552 | + $object=new stdClass(); |
|
553 | 553 | |
554 | 554 | // Show more tabs from modules |
555 | 555 | // Entries must be declared in modules descriptor with line |
@@ -47,24 +47,24 @@ discard block |
||
47 | 47 | * @param int $resourceid Preselected value of resource for filter on resource |
48 | 48 | * @return void |
49 | 49 | */ |
50 | -function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=0) |
|
50 | +function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals = array(), $actioncode = '', $usergroupid = '', $excludetype = '', $resourceid = 0) |
|
51 | 51 | { |
52 | 52 | global $conf, $user, $langs, $db, $hookmanager; |
53 | 53 | global $begin_h, $end_h, $begin_d, $end_d; |
54 | 54 | |
55 | 55 | $langs->load("companies"); |
56 | 56 | |
57 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
58 | - $formactions=new FormActions($db); |
|
57 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
58 | + $formactions = new FormActions($db); |
|
59 | 59 | |
60 | 60 | // Filters |
61 | 61 | //print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">'; |
62 | - print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; |
|
63 | - print '<input type="hidden" name="year" value="' . $year . '">'; |
|
64 | - print '<input type="hidden" name="month" value="' . $month . '">'; |
|
65 | - print '<input type="hidden" name="day" value="' . $day . '">'; |
|
66 | - print '<input type="hidden" name="action" value="' . $action . '">'; |
|
67 | - print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">'; |
|
62 | + print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; |
|
63 | + print '<input type="hidden" name="year" value="'.$year.'">'; |
|
64 | + print '<input type="hidden" name="month" value="'.$month.'">'; |
|
65 | + print '<input type="hidden" name="day" value="'.$day.'">'; |
|
66 | + print '<input type="hidden" name="action" value="'.$action.'">'; |
|
67 | + print '<input type="hidden" name="search_showbirthday" value="'.$showbirthday.'">'; |
|
68 | 68 | |
69 | 69 | print '<div class="fichecenter">'; |
70 | 70 | |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
80 | 80 | print $langs->trans("ActionsToDoBy").' '; |
81 | 81 | print '</td><td style="padding-bottom: 2px; padding-right: 4px;">'; |
82 | - print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); |
|
83 | - if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' '; |
|
84 | - print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); |
|
82 | + print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); |
|
83 | + if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or").' '.$langs->trans("ToUserOfGroup").' '; |
|
84 | + print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit); |
|
85 | 85 | print '</td></tr>'; |
86 | 86 | |
87 | 87 | if ($conf->resource->enabled) |
88 | 88 | { |
89 | - include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php'; |
|
90 | - $formresource=new FormResource($db); |
|
89 | + include_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; |
|
90 | + $formresource = new FormResource($db); |
|
91 | 91 | |
92 | 92 | // Resource |
93 | 93 | print '<tr>'; |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
104 | 104 | print $langs->trans("Type"); |
105 | 105 | print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
106 | - $multiselect=0; |
|
107 | - if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list" |
|
106 | + $multiselect = 0; |
|
107 | + if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list" |
|
108 | 108 | { |
109 | - $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE)); |
|
109 | + $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); |
|
110 | 110 | } |
111 | - print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect); |
|
111 | + print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect); |
|
112 | 112 | print '</td></tr>'; |
113 | 113 | } |
114 | 114 | |
115 | - if (! empty($conf->societe->enabled) && $user->rights->societe->lire) |
|
115 | + if (!empty($conf->societe->enabled) && $user->rights->societe->lire) |
|
116 | 116 | { |
117 | 117 | print '<tr>'; |
118 | 118 | print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | print '</td></tr>'; |
123 | 123 | } |
124 | 124 | |
125 | - if (! empty($conf->projet->enabled) && $user->rights->projet->lire) |
|
125 | + if (!empty($conf->projet->enabled) && $user->rights->projet->lire) |
|
126 | 126 | { |
127 | 127 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
128 | - $formproject=new FormProjets($db); |
|
128 | + $formproject = new FormProjets($db); |
|
129 | 129 | |
130 | 130 | print '<tr>'; |
131 | 131 | print '<td class="nowrap" style="padding-bottom: 2px;">'; |
132 | 132 | print $langs->trans("Project").' '; |
133 | 133 | print '</td><td class="nowrap" style="padding-bottom: 2px;">'; |
134 | - print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500'); |
|
134 | + print $formproject->select_projects($socid ? $socid : -1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500'); |
|
135 | 135 | print '</td></tr>'; |
136 | 136 | } |
137 | 137 | |
138 | - if ($canedit && ! preg_match('/list/', $_SERVER["PHP_SELF"])) |
|
138 | + if ($canedit && !preg_match('/list/', $_SERVER["PHP_SELF"])) |
|
139 | 139 | { |
140 | 140 | // Status |
141 | 141 | print '<tr>'; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | print '<table class="centpercent"><tr><td align="center">'; |
190 | 190 | print '<div class="formleftzone">'; |
191 | - print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">'; |
|
191 | + print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="'.$langs->trans("Refresh").'">'; |
|
192 | 192 | print '</div>'; |
193 | 193 | print '</td></tr>'; |
194 | 194 | print '</table>'; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if ($conf->browser->layout == 'phone') print '</div>'; |
197 | 197 | else print '</td></tr></table>'; |
198 | 198 | |
199 | - print '</div>'; // Close fichecenter |
|
199 | + print '</div>'; // Close fichecenter |
|
200 | 200 | print '<div style="clear:both"></div>'; |
201 | 201 | |
202 | 202 | //print '</form>'; |
@@ -209,44 +209,44 @@ discard block |
||
209 | 209 | * @param int $max Max nb of records |
210 | 210 | * @return void |
211 | 211 | */ |
212 | -function show_array_actions_to_do($max=5) |
|
212 | +function show_array_actions_to_do($max = 5) |
|
213 | 213 | { |
214 | 214 | global $langs, $conf, $user, $db, $bc, $socid; |
215 | 215 | |
216 | - $now=dol_now(); |
|
216 | + $now = dol_now(); |
|
217 | 217 | |
218 | 218 | include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
219 | 219 | include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; |
220 | 220 | |
221 | 221 | $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; |
222 | - $sql.= " c.code, c.libelle as type_label,"; |
|
223 | - $sql.= " s.nom as sname, s.rowid, s.client"; |
|
224 | - $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
225 | - $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; |
|
226 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
227 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
228 | - $sql.= " WHERE a.entity = ".$conf->entity; |
|
229 | - $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; |
|
230 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
231 | - if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
232 | - $sql.= " ORDER BY a.datep DESC, a.id DESC"; |
|
233 | - $sql.= $db->plimit($max, 0); |
|
234 | - |
|
235 | - $resql=$db->query($sql); |
|
222 | + $sql .= " c.code, c.libelle as type_label,"; |
|
223 | + $sql .= " s.nom as sname, s.rowid, s.client"; |
|
224 | + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
225 | + $sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; |
|
226 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
227 | + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
228 | + $sql .= " WHERE a.entity = ".$conf->entity; |
|
229 | + $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; |
|
230 | + if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
231 | + if ($socid) $sql .= " AND s.rowid = ".$socid; |
|
232 | + $sql .= " ORDER BY a.datep DESC, a.id DESC"; |
|
233 | + $sql .= $db->plimit($max, 0); |
|
234 | + |
|
235 | + $resql = $db->query($sql); |
|
236 | 236 | if ($resql) |
237 | 237 | { |
238 | 238 | $num = $db->num_rows($resql); |
239 | 239 | |
240 | 240 | print '<table class="noborder" width="100%">'; |
241 | - print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo",$max).'</th>'; |
|
241 | + print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo", $max).'</th>'; |
|
242 | 242 | print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>'; |
243 | 243 | print '</tr>'; |
244 | 244 | |
245 | 245 | $var = true; |
246 | 246 | $i = 0; |
247 | 247 | |
248 | - $staticaction=new ActionComm($db); |
|
249 | - $customerstatic=new Client($db); |
|
248 | + $staticaction = new ActionComm($db); |
|
249 | + $customerstatic = new Client($db); |
|
250 | 250 | |
251 | 251 | while ($i < $num) |
252 | 252 | { |
@@ -255,38 +255,38 @@ discard block |
||
255 | 255 | |
256 | 256 | print '<tr class="oddeven">'; |
257 | 257 | |
258 | - $staticaction->type_code=$obj->code; |
|
259 | - $staticaction->label=($obj->label?$obj->label:$obj->type_label); |
|
260 | - $staticaction->id=$obj->id; |
|
261 | - print '<td>'.$staticaction->getNomUrl(1,34).'</td>'; |
|
258 | + $staticaction->type_code = $obj->code; |
|
259 | + $staticaction->label = ($obj->label ? $obj->label : $obj->type_label); |
|
260 | + $staticaction->id = $obj->id; |
|
261 | + print '<td>'.$staticaction->getNomUrl(1, 34).'</td>'; |
|
262 | 262 | |
263 | 263 | // print '<td>'.dol_trunc($obj->label,22).'</td>'; |
264 | 264 | |
265 | 265 | print '<td>'; |
266 | 266 | if ($obj->rowid > 0) |
267 | 267 | { |
268 | - $customerstatic->id=$obj->rowid; |
|
269 | - $customerstatic->name=$obj->sname; |
|
270 | - $customerstatic->client=$obj->client; |
|
271 | - print $customerstatic->getNomUrl(1,'',16); |
|
268 | + $customerstatic->id = $obj->rowid; |
|
269 | + $customerstatic->name = $obj->sname; |
|
270 | + $customerstatic->client = $obj->client; |
|
271 | + print $customerstatic->getNomUrl(1, '', 16); |
|
272 | 272 | } |
273 | 273 | print '</td>'; |
274 | 274 | |
275 | - $datep=$db->jdate($obj->dp); |
|
276 | - $datep2=$db->jdate($obj->dp2); |
|
275 | + $datep = $db->jdate($obj->dp); |
|
276 | + $datep2 = $db->jdate($obj->dp2); |
|
277 | 277 | |
278 | 278 | // Date |
279 | - print '<td width="100" align="right">'.dol_print_date($datep,'day').' '; |
|
280 | - $late=0; |
|
281 | - if ($obj->percent == 0 && $datep && $datep < time()) $late=1; |
|
282 | - if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1; |
|
283 | - if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1; |
|
284 | - if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1; |
|
279 | + print '<td width="100" align="right">'.dol_print_date($datep, 'day').' '; |
|
280 | + $late = 0; |
|
281 | + if ($obj->percent == 0 && $datep && $datep < time()) $late = 1; |
|
282 | + if ($obj->percent == 0 && !$datep && $datep2 && $datep2 < time()) $late = 1; |
|
283 | + if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late = 1; |
|
284 | + if ($obj->percent > 0 && $obj->percent < 100 && !$datep2 && $datep && $datep < time()) $late = 1; |
|
285 | 285 | if ($late) print img_warning($langs->trans("Late")); |
286 | 286 | print "</td>"; |
287 | 287 | |
288 | 288 | // Statut |
289 | - print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; |
|
289 | + print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent, 3)."</td>\n"; |
|
290 | 290 | |
291 | 291 | print "</tr>\n"; |
292 | 292 | |
@@ -309,40 +309,40 @@ discard block |
||
309 | 309 | * @param int $max Max nb of records |
310 | 310 | * @return void |
311 | 311 | */ |
312 | -function show_array_last_actions_done($max=5) |
|
312 | +function show_array_last_actions_done($max = 5) |
|
313 | 313 | { |
314 | 314 | global $langs, $conf, $user, $db, $bc, $socid; |
315 | 315 | |
316 | - $now=dol_now(); |
|
316 | + $now = dol_now(); |
|
317 | 317 | |
318 | 318 | $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,"; |
319 | - $sql.= " c.code, c.libelle,"; |
|
320 | - $sql.= " s.rowid, s.nom as sname, s.client"; |
|
321 | - $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
322 | - $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action "; |
|
323 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
324 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
325 | - $sql.= " WHERE a.entity = ".$conf->entity; |
|
326 | - $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; |
|
327 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
328 | - if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
319 | + $sql .= " c.code, c.libelle,"; |
|
320 | + $sql .= " s.rowid, s.nom as sname, s.client"; |
|
321 | + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
|
322 | + $sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action "; |
|
323 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
324 | + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
325 | + $sql .= " WHERE a.entity = ".$conf->entity; |
|
326 | + $sql .= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; |
|
327 | + if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
328 | + if ($socid) $sql .= " AND s.rowid = ".$socid; |
|
329 | 329 | $sql .= " ORDER BY a.datep2 DESC"; |
330 | 330 | $sql .= $db->plimit($max, 0); |
331 | 331 | |
332 | - $resql=$db->query($sql); |
|
332 | + $resql = $db->query($sql); |
|
333 | 333 | if ($resql) |
334 | 334 | { |
335 | 335 | $num = $db->num_rows($resql); |
336 | 336 | |
337 | 337 | print '<table class="noborder" width="100%">'; |
338 | - print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks",$max).'</th>'; |
|
338 | + print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks", $max).'</th>'; |
|
339 | 339 | print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>'; |
340 | 340 | print '</tr>'; |
341 | 341 | $var = true; |
342 | 342 | $i = 0; |
343 | 343 | |
344 | - $staticaction=new ActionComm($db); |
|
345 | - $customerstatic=new Societe($db); |
|
344 | + $staticaction = new ActionComm($db); |
|
345 | + $customerstatic = new Societe($db); |
|
346 | 346 | |
347 | 347 | while ($i < $num) |
348 | 348 | { |
@@ -351,29 +351,29 @@ discard block |
||
351 | 351 | |
352 | 352 | print '<tr class="oddeven">'; |
353 | 353 | |
354 | - $staticaction->type_code=$obj->code; |
|
355 | - $staticaction->libelle=$obj->label; |
|
356 | - $staticaction->id=$obj->id; |
|
357 | - print '<td>'.$staticaction->getNomUrl(1,34).'</td>'; |
|
354 | + $staticaction->type_code = $obj->code; |
|
355 | + $staticaction->libelle = $obj->label; |
|
356 | + $staticaction->id = $obj->id; |
|
357 | + print '<td>'.$staticaction->getNomUrl(1, 34).'</td>'; |
|
358 | 358 | |
359 | 359 | //print '<td>'.dol_trunc($obj->label,24).'</td>'; |
360 | 360 | |
361 | 361 | print '<td>'; |
362 | 362 | if ($obj->rowid > 0) |
363 | 363 | { |
364 | - $customerstatic->id=$obj->rowid; |
|
365 | - $customerstatic->name=$obj->sname; |
|
366 | - $customerstatic->client=$obj->client; |
|
367 | - print $customerstatic->getNomUrl(1,'',24); |
|
364 | + $customerstatic->id = $obj->rowid; |
|
365 | + $customerstatic->name = $obj->sname; |
|
366 | + $customerstatic->client = $obj->client; |
|
367 | + print $customerstatic->getNomUrl(1, '', 24); |
|
368 | 368 | } |
369 | 369 | print '</td>'; |
370 | 370 | |
371 | 371 | // Date |
372 | - print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2),'day'); |
|
372 | + print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2), 'day'); |
|
373 | 373 | print "</td>"; |
374 | 374 | |
375 | 375 | // Statut |
376 | - print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; |
|
376 | + print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent, 3)."</td>\n"; |
|
377 | 377 | |
378 | 378 | print "</tr>\n"; |
379 | 379 | $i++; |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | $head[$h][2] = 'extsites'; |
431 | 431 | $h++; |
432 | 432 | |
433 | - complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin'); |
|
433 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda_admin'); |
|
434 | 434 | |
435 | 435 | $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; |
436 | 436 | $head[$h][1] = $langs->trans("ExtraFields"); |
437 | 437 | $head[$h][2] = 'attributes'; |
438 | 438 | $h++; |
439 | 439 | |
440 | - complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove'); |
|
440 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda_admin', 'remove'); |
|
441 | 441 | |
442 | 442 | |
443 | 443 | return $head; |
@@ -465,13 +465,13 @@ discard block |
||
465 | 465 | if ($conf->resource->enabled) |
466 | 466 | { |
467 | 467 | include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; |
468 | - $resource=new DolResource($db); |
|
468 | + $resource = new DolResource($db); |
|
469 | 469 | |
470 | 470 | $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id; |
471 | 471 | $listofresourcelinked = $resource->getElementResources($object->element, $object->id); |
472 | - $nbResources=count($listofresourcelinked); |
|
472 | + $nbResources = count($listofresourcelinked); |
|
473 | 473 | $head[$h][1] = $langs->trans("Resources"); |
474 | - if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>'; |
|
474 | + if ($nbResources > 0) $head[$h][1] .= ' <span class="badge">'.($nbResources).'</span>'; |
|
475 | 475 | $head[$h][2] = 'resources'; |
476 | 476 | $h++; |
477 | 477 | } |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | // Attached files |
480 | 480 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
481 | 481 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
482 | - $upload_dir = $conf->agenda->dir_output . "/" . $object->id; |
|
483 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
484 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
482 | + $upload_dir = $conf->agenda->dir_output."/".$object->id; |
|
483 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
484 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
485 | 485 | $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id; |
486 | 486 | $head[$h][1] = $langs->trans("Documents"); |
487 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
487 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
488 | 488 | $head[$h][2] = 'documents'; |
489 | 489 | $h++; |
490 | 490 | |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | $head[$h][2] = 'info'; |
494 | 494 | $h++; |
495 | 495 | |
496 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'action'); |
|
496 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'action'); |
|
497 | 497 | |
498 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove'); |
|
498 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'action', 'remove'); |
|
499 | 499 | |
500 | 500 | return $head; |
501 | 501 | } |
@@ -514,50 +514,50 @@ discard block |
||
514 | 514 | $h = 0; |
515 | 515 | $head = array(); |
516 | 516 | |
517 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/list.php'.($param?'?'.$param:''); |
|
517 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/list.php'.($param ? '?'.$param : ''); |
|
518 | 518 | $head[$h][1] = $langs->trans("ViewList"); |
519 | 519 | $head[$h][2] = 'cardlist'; |
520 | 520 | $h++; |
521 | 521 | |
522 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:''); |
|
522 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param ? '&'.$param : ''); |
|
523 | 523 | $head[$h][1] = $langs->trans("ViewCal"); |
524 | 524 | $head[$h][2] = 'cardmonth'; |
525 | 525 | $h++; |
526 | 526 | |
527 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param?'&'.$param:''); |
|
527 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param ? '&'.$param : ''); |
|
528 | 528 | $head[$h][1] = $langs->trans("ViewWeek"); |
529 | 529 | $head[$h][2] = 'cardweek'; |
530 | 530 | $h++; |
531 | 531 | |
532 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:''); |
|
532 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param ? '&'.$param : ''); |
|
533 | 533 | $head[$h][1] = $langs->trans("ViewDay"); |
534 | 534 | $head[$h][2] = 'cardday'; |
535 | 535 | $h++; |
536 | 536 | |
537 | 537 | //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) |
538 | - if (! empty($conf->global->AGENDA_SHOW_PERTYPE)) |
|
538 | + if (!empty($conf->global->AGENDA_SHOW_PERTYPE)) |
|
539 | 539 | { |
540 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param?'?'.$param:''); |
|
540 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param ? '?'.$param : ''); |
|
541 | 541 | $head[$h][1] = $langs->trans("ViewPerType"); |
542 | 542 | $head[$h][2] = 'cardpertype'; |
543 | 543 | $h++; |
544 | 544 | } |
545 | 545 | |
546 | - $head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:''); |
|
546 | + $head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param ? '?'.$param : ''); |
|
547 | 547 | $head[$h][1] = $langs->trans("ViewPerUser"); |
548 | 548 | $head[$h][2] = 'cardperuser'; |
549 | 549 | $h++; |
550 | 550 | |
551 | 551 | |
552 | - $object=new stdClass(); |
|
552 | + $object = new stdClass(); |
|
553 | 553 | |
554 | 554 | // Show more tabs from modules |
555 | 555 | // Entries must be declared in modules descriptor with line |
556 | 556 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
557 | 557 | // $this->tabs = array('entity:-tabname); to remove a tab |
558 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda'); |
|
558 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'agenda'); |
|
559 | 559 | |
560 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda','remove'); |
|
560 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'agenda', 'remove'); |
|
561 | 561 | |
562 | 562 | return $head; |
563 | 563 | } |
@@ -68,8 +68,11 @@ discard block |
||
68 | 68 | |
69 | 69 | print '<div class="fichecenter">'; |
70 | 70 | |
71 | - if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">'; |
|
72 | - else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">'; |
|
71 | + if ($conf->browser->layout == 'phone') { |
|
72 | + print '<div class="fichehalfleft">'; |
|
73 | + } else { |
|
74 | + print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">'; |
|
75 | + } |
|
73 | 76 | |
74 | 77 | print '<table class="nobordernopadding centpercent">'; |
75 | 78 | |
@@ -80,7 +83,9 @@ discard block |
||
80 | 83 | print $langs->trans("ActionsToDoBy").' '; |
81 | 84 | print '</td><td style="padding-bottom: 2px; padding-right: 4px;">'; |
82 | 85 | print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); |
83 | - if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' '; |
|
86 | + if (empty($conf->dol_optimize_smallscreen)) { |
|
87 | + print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' '; |
|
88 | + } |
|
84 | 89 | print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); |
85 | 90 | print '</td></tr>'; |
86 | 91 | |
@@ -104,10 +109,12 @@ discard block |
||
104 | 109 | print $langs->trans("Type"); |
105 | 110 | print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; |
106 | 111 | $multiselect=0; |
107 | - if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list" |
|
112 | + if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { |
|
113 | + // We use an option here because it adds bugs when used on agenda page "peruser" and "list" |
|
108 | 114 | { |
109 | 115 | $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE)); |
110 | 116 | } |
117 | + } |
|
111 | 118 | print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect); |
112 | 119 | print '</td></tr>'; |
113 | 120 | } |
@@ -154,10 +161,15 @@ discard block |
||
154 | 161 | print "<td class='nowrap'>"; |
155 | 162 | print '<div class="ui-grid-a"><div class="ui-block-a">'; |
156 | 163 | print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">'; |
157 | - if (empty($conf->dol_use_jmobile)) print ' - '; |
|
158 | - else print '</div><div class="ui-block-b">'; |
|
164 | + if (empty($conf->dol_use_jmobile)) { |
|
165 | + print ' - '; |
|
166 | + } else { |
|
167 | + print '</div><div class="ui-block-b">'; |
|
168 | + } |
|
159 | 169 | print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">'; |
160 | - if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H"); |
|
170 | + if (empty($conf->dol_use_jmobile)) { |
|
171 | + print ' '.$langs->trans("H"); |
|
172 | + } |
|
161 | 173 | print '</div></div>'; |
162 | 174 | print '</td></tr>'; |
163 | 175 | |
@@ -167,8 +179,11 @@ discard block |
||
167 | 179 | print "<td class='nowrap'>"; |
168 | 180 | print '<div class="ui-grid-a"><div class="ui-block-a">'; |
169 | 181 | print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">'; |
170 | - if (empty($conf->dol_use_jmobile)) print ' - '; |
|
171 | - else print '</div><div class="ui-block-b">'; |
|
182 | + if (empty($conf->dol_use_jmobile)) { |
|
183 | + print ' - '; |
|
184 | + } else { |
|
185 | + print '</div><div class="ui-block-b">'; |
|
186 | + } |
|
172 | 187 | print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">'; |
173 | 188 | print '</div></div>'; |
174 | 189 | print '</td></tr>'; |
@@ -180,11 +195,17 @@ discard block |
||
180 | 195 | |
181 | 196 | print '</table>'; |
182 | 197 | |
183 | - if ($conf->browser->layout == 'phone') print '</div>'; |
|
184 | - else print '</td>'; |
|
198 | + if ($conf->browser->layout == 'phone') { |
|
199 | + print '</div>'; |
|
200 | + } else { |
|
201 | + print '</td>'; |
|
202 | + } |
|
185 | 203 | |
186 | - if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">'; |
|
187 | - else print '<td align="center" valign="middle" class="nowrap">'; |
|
204 | + if ($conf->browser->layout == 'phone') { |
|
205 | + print '<div class="fichehalfright">'; |
|
206 | + } else { |
|
207 | + print '<td align="center" valign="middle" class="nowrap">'; |
|
208 | + } |
|
188 | 209 | |
189 | 210 | print '<table class="centpercent"><tr><td align="center">'; |
190 | 211 | print '<div class="formleftzone">'; |
@@ -193,8 +214,11 @@ discard block |
||
193 | 214 | print '</td></tr>'; |
194 | 215 | print '</table>'; |
195 | 216 | |
196 | - if ($conf->browser->layout == 'phone') print '</div>'; |
|
197 | - else print '</td></tr></table>'; |
|
217 | + if ($conf->browser->layout == 'phone') { |
|
218 | + print '</div>'; |
|
219 | + } else { |
|
220 | + print '</td></tr></table>'; |
|
221 | + } |
|
198 | 222 | |
199 | 223 | print '</div>'; // Close fichecenter |
200 | 224 | print '<div style="clear:both"></div>'; |
@@ -224,11 +248,17 @@ discard block |
||
224 | 248 | $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
225 | 249 | $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; |
226 | 250 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
227 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
251 | + if (!$user->rights->societe->client->voir && !$socid) { |
|
252 | + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
253 | + } |
|
228 | 254 | $sql.= " WHERE a.entity = ".$conf->entity; |
229 | 255 | $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; |
230 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
231 | - if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
256 | + if (!$user->rights->societe->client->voir && !$socid) { |
|
257 | + $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
258 | + } |
|
259 | + if ($socid) { |
|
260 | + $sql.= " AND s.rowid = ".$socid; |
|
261 | + } |
|
232 | 262 | $sql.= " ORDER BY a.datep DESC, a.id DESC"; |
233 | 263 | $sql.= $db->plimit($max, 0); |
234 | 264 | |
@@ -278,11 +308,21 @@ discard block |
||
278 | 308 | // Date |
279 | 309 | print '<td width="100" align="right">'.dol_print_date($datep,'day').' '; |
280 | 310 | $late=0; |
281 | - if ($obj->percent == 0 && $datep && $datep < time()) $late=1; |
|
282 | - if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1; |
|
283 | - if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1; |
|
284 | - if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1; |
|
285 | - if ($late) print img_warning($langs->trans("Late")); |
|
311 | + if ($obj->percent == 0 && $datep && $datep < time()) { |
|
312 | + $late=1; |
|
313 | + } |
|
314 | + if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) { |
|
315 | + $late=1; |
|
316 | + } |
|
317 | + if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) { |
|
318 | + $late=1; |
|
319 | + } |
|
320 | + if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) { |
|
321 | + $late=1; |
|
322 | + } |
|
323 | + if ($late) { |
|
324 | + print img_warning($langs->trans("Late")); |
|
325 | + } |
|
286 | 326 | print "</td>"; |
287 | 327 | |
288 | 328 | // Statut |
@@ -295,8 +335,7 @@ discard block |
||
295 | 335 | print "</table><br>"; |
296 | 336 | |
297 | 337 | $db->free($resql); |
298 | - } |
|
299 | - else |
|
338 | + } else |
|
300 | 339 | { |
301 | 340 | dol_print_error($db); |
302 | 341 | } |
@@ -321,11 +360,17 @@ discard block |
||
321 | 360 | $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN "; |
322 | 361 | $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action "; |
323 | 362 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
324 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
363 | + if (!$user->rights->societe->client->voir && !$socid) { |
|
364 | + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
365 | + } |
|
325 | 366 | $sql.= " WHERE a.entity = ".$conf->entity; |
326 | 367 | $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; |
327 | - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
328 | - if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
368 | + if (!$user->rights->societe->client->voir && !$socid) { |
|
369 | + $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
370 | + } |
|
371 | + if ($socid) { |
|
372 | + $sql.= " AND s.rowid = ".$socid; |
|
373 | + } |
|
329 | 374 | $sql .= " ORDER BY a.datep2 DESC"; |
330 | 375 | $sql .= $db->plimit($max, 0); |
331 | 376 | |
@@ -383,8 +428,7 @@ discard block |
||
383 | 428 | print "</table><br>"; |
384 | 429 | |
385 | 430 | $db->free($resql); |
386 | - } |
|
387 | - else |
|
431 | + } else |
|
388 | 432 | { |
389 | 433 | dol_print_error($db); |
390 | 434 | } |
@@ -471,7 +515,9 @@ discard block |
||
471 | 515 | $listofresourcelinked = $resource->getElementResources($object->element, $object->id); |
472 | 516 | $nbResources=count($listofresourcelinked); |
473 | 517 | $head[$h][1] = $langs->trans("Resources"); |
474 | - if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>'; |
|
518 | + if ($nbResources > 0) { |
|
519 | + $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>'; |
|
520 | + } |
|
475 | 521 | $head[$h][2] = 'resources'; |
476 | 522 | $h++; |
477 | 523 | } |
@@ -484,7 +530,9 @@ discard block |
||
484 | 530 | $nbLinks=Link::count($db, $object->element, $object->id); |
485 | 531 | $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id; |
486 | 532 | $head[$h][1] = $langs->trans("Documents"); |
487 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
533 | + if (($nbFiles+$nbLinks) > 0) { |
|
534 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
535 | + } |
|
488 | 536 | $head[$h][2] = 'documents'; |
489 | 537 | $h++; |
490 | 538 |
@@ -35,33 +35,33 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function facture_prepare_head($object) |
37 | 37 | { |
38 | - global $db, $langs, $conf; |
|
39 | - |
|
40 | - $h = 0; |
|
41 | - $head = array(); |
|
42 | - |
|
43 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id; |
|
44 | - $head[$h][1] = $langs->trans('Card'); |
|
45 | - $head[$h][2] = 'compta'; |
|
46 | - $h++; |
|
47 | - |
|
48 | - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
|
49 | - { |
|
50 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
51 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
|
52 | - $head[$h][1] = $langs->trans('ContactsAddresses'); |
|
53 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | - $head[$h][2] = 'contact'; |
|
55 | - $h++; |
|
56 | - } |
|
57 | - |
|
58 | - //if ($fac->mode_reglement_code == 'PRE') |
|
59 | - if (! empty($conf->prelevement->enabled)) |
|
60 | - { |
|
61 | - $nbStandingOrders=0; |
|
62 | - $sql = "SELECT COUNT(pfd.rowid) as nb"; |
|
63 | - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; |
|
64 | - $sql .= " WHERE pfd.fk_facture = ".$object->id; |
|
38 | + global $db, $langs, $conf; |
|
39 | + |
|
40 | + $h = 0; |
|
41 | + $head = array(); |
|
42 | + |
|
43 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id; |
|
44 | + $head[$h][1] = $langs->trans('Card'); |
|
45 | + $head[$h][2] = 'compta'; |
|
46 | + $h++; |
|
47 | + |
|
48 | + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
|
49 | + { |
|
50 | + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
51 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
|
52 | + $head[$h][1] = $langs->trans('ContactsAddresses'); |
|
53 | + if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | + $head[$h][2] = 'contact'; |
|
55 | + $h++; |
|
56 | + } |
|
57 | + |
|
58 | + //if ($fac->mode_reglement_code == 'PRE') |
|
59 | + if (! empty($conf->prelevement->enabled)) |
|
60 | + { |
|
61 | + $nbStandingOrders=0; |
|
62 | + $sql = "SELECT COUNT(pfd.rowid) as nb"; |
|
63 | + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; |
|
64 | + $sql .= " WHERE pfd.fk_facture = ".$object->id; |
|
65 | 65 | $resql=$db->query($sql); |
66 | 66 | if ($resql) |
67 | 67 | { |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | if ($obj) $nbStandingOrders = $obj->nb; |
70 | 70 | } |
71 | 71 | else dol_print_error($db); |
72 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
|
73 | - $head[$h][1] = $langs->trans('StandingOrders'); |
|
74 | - if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
75 | - $head[$h][2] = 'standingorders'; |
|
76 | - $h++; |
|
77 | - } |
|
72 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
|
73 | + $head[$h][1] = $langs->trans('StandingOrders'); |
|
74 | + if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
75 | + $head[$h][2] = 'standingorders'; |
|
76 | + $h++; |
|
77 | + } |
|
78 | 78 | |
79 | 79 | // Show more tabs from modules |
80 | 80 | // Entries must be declared in modules descriptor with line |
@@ -84,35 +84,35 @@ discard block |
||
84 | 84 | |
85 | 85 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 86 | { |
87 | - $nbNote = 0; |
|
87 | + $nbNote = 0; |
|
88 | 88 | if(!empty($object->note_private)) $nbNote++; |
89 | - if(!empty($object->note_public)) $nbNote++; |
|
90 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
|
91 | - $head[$h][1] = $langs->trans('Notes'); |
|
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
93 | - $head[$h][2] = 'note'; |
|
94 | - $h++; |
|
89 | + if(!empty($object->note_public)) $nbNote++; |
|
90 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
|
91 | + $head[$h][1] = $langs->trans('Notes'); |
|
92 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
93 | + $head[$h][2] = 'note'; |
|
94 | + $h++; |
|
95 | 95 | } |
96 | 96 | |
97 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
97 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
99 | + $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | 101 | $nbLinks=Link::count($db, $object->element, $object->id); |
102 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
|
103 | - $head[$h][1] = $langs->trans('Documents'); |
|
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | - $head[$h][2] = 'documents'; |
|
106 | - $h++; |
|
102 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
|
103 | + $head[$h][1] = $langs->trans('Documents'); |
|
104 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | + $head[$h][2] = 'documents'; |
|
106 | + $h++; |
|
107 | 107 | |
108 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id; |
|
109 | - $head[$h][1] = $langs->trans('Info'); |
|
110 | - $head[$h][2] = 'info'; |
|
111 | - $h++; |
|
108 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id; |
|
109 | + $head[$h][1] = $langs->trans('Info'); |
|
110 | + $head[$h][2] = 'info'; |
|
111 | + $h++; |
|
112 | 112 | |
113 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove'); |
|
113 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove'); |
|
114 | 114 | |
115 | - return $head; |
|
115 | + return $head; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -122,50 +122,50 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function invoice_admin_prepare_head() |
124 | 124 | { |
125 | - global $langs, $conf, $user; |
|
126 | - |
|
127 | - $h = 0; |
|
128 | - $head = array(); |
|
129 | - |
|
130 | - $head[$h][0] = DOL_URL_ROOT.'/admin/facture.php'; |
|
131 | - $head[$h][1] = $langs->trans("Miscellaneous"); |
|
132 | - $head[$h][2] = 'general'; |
|
133 | - $h++; |
|
134 | - |
|
135 | - $head[$h][0] = DOL_URL_ROOT.'/admin/payment.php'; |
|
136 | - $head[$h][1] = $langs->trans("Payments"); |
|
137 | - $head[$h][2] = 'payment'; |
|
138 | - $h++; |
|
139 | - |
|
140 | - // Show more tabs from modules |
|
141 | - // Entries must be declared in modules descriptor with line |
|
142 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
143 | - // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
144 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); |
|
145 | - |
|
146 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; |
|
147 | - $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); |
|
148 | - $head[$h][2] = 'attributes'; |
|
149 | - $h++; |
|
150 | - |
|
151 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; |
|
152 | - $head[$h][1] = $langs->trans("ExtraFieldsLines"); |
|
153 | - $head[$h][2] = 'attributeslines'; |
|
154 | - $h++; |
|
155 | - |
|
156 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php'; |
|
157 | - $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec"); |
|
158 | - $head[$h][2] = 'attributesrec'; |
|
159 | - $h++; |
|
160 | - |
|
161 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php'; |
|
162 | - $head[$h][1] = $langs->trans("ExtraFieldsLinesRec"); |
|
163 | - $head[$h][2] = 'attributeslinesrec'; |
|
164 | - $h++; |
|
165 | - |
|
166 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); |
|
167 | - |
|
168 | - return $head; |
|
125 | + global $langs, $conf, $user; |
|
126 | + |
|
127 | + $h = 0; |
|
128 | + $head = array(); |
|
129 | + |
|
130 | + $head[$h][0] = DOL_URL_ROOT.'/admin/facture.php'; |
|
131 | + $head[$h][1] = $langs->trans("Miscellaneous"); |
|
132 | + $head[$h][2] = 'general'; |
|
133 | + $h++; |
|
134 | + |
|
135 | + $head[$h][0] = DOL_URL_ROOT.'/admin/payment.php'; |
|
136 | + $head[$h][1] = $langs->trans("Payments"); |
|
137 | + $head[$h][2] = 'payment'; |
|
138 | + $h++; |
|
139 | + |
|
140 | + // Show more tabs from modules |
|
141 | + // Entries must be declared in modules descriptor with line |
|
142 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
143 | + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
144 | + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); |
|
145 | + |
|
146 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; |
|
147 | + $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); |
|
148 | + $head[$h][2] = 'attributes'; |
|
149 | + $h++; |
|
150 | + |
|
151 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; |
|
152 | + $head[$h][1] = $langs->trans("ExtraFieldsLines"); |
|
153 | + $head[$h][2] = 'attributeslines'; |
|
154 | + $h++; |
|
155 | + |
|
156 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php'; |
|
157 | + $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec"); |
|
158 | + $head[$h][2] = 'attributesrec'; |
|
159 | + $h++; |
|
160 | + |
|
161 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php'; |
|
162 | + $head[$h][1] = $langs->trans("ExtraFieldsLinesRec"); |
|
163 | + $head[$h][2] = 'attributeslinesrec'; |
|
164 | + $h++; |
|
165 | + |
|
166 | + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); |
|
167 | + |
|
168 | + return $head; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function invoice_rec_prepare_head($object) |
179 | 179 | { |
180 | - global $db, $langs, $conf; |
|
180 | + global $db, $langs, $conf; |
|
181 | 181 | |
182 | - $h = 0; |
|
183 | - $head = array(); |
|
182 | + $h = 0; |
|
183 | + $head = array(); |
|
184 | 184 | |
185 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id; |
|
186 | - $head[$h][1] = $langs->trans("CardBill"); |
|
187 | - $head[$h][2] = 'card'; |
|
188 | - $h++; |
|
185 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id; |
|
186 | + $head[$h][1] = $langs->trans("CardBill"); |
|
187 | + $head[$h][2] = 'card'; |
|
188 | + $h++; |
|
189 | 189 | |
190 | 190 | // Show more tabs from modules |
191 | 191 | // Entries must be declared in modules descriptor with line |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // $this->tabs = array('entity:-tabname); to remove a tab |
194 | 194 | complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec'); |
195 | 195 | |
196 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove'); |
|
196 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove'); |
|
197 | 197 | |
198 | - return $head; |
|
198 | + return $head; |
|
199 | 199 | } |
@@ -47,31 +47,31 @@ discard block |
||
47 | 47 | |
48 | 48 | if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
49 | 49 | { |
50 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
50 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
51 | 51 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
52 | 52 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
53 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
53 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | 54 | $head[$h][2] = 'contact'; |
55 | 55 | $h++; |
56 | 56 | } |
57 | 57 | |
58 | 58 | //if ($fac->mode_reglement_code == 'PRE') |
59 | - if (! empty($conf->prelevement->enabled)) |
|
59 | + if (!empty($conf->prelevement->enabled)) |
|
60 | 60 | { |
61 | - $nbStandingOrders=0; |
|
61 | + $nbStandingOrders = 0; |
|
62 | 62 | $sql = "SELECT COUNT(pfd.rowid) as nb"; |
63 | 63 | $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; |
64 | 64 | $sql .= " WHERE pfd.fk_facture = ".$object->id; |
65 | - $resql=$db->query($sql); |
|
65 | + $resql = $db->query($sql); |
|
66 | 66 | if ($resql) |
67 | 67 | { |
68 | - $obj=$db->fetch_object($resql); |
|
68 | + $obj = $db->fetch_object($resql); |
|
69 | 69 | if ($obj) $nbStandingOrders = $obj->nb; |
70 | 70 | } |
71 | 71 | else dol_print_error($db); |
72 | 72 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
73 | 73 | $head[$h][1] = $langs->trans('StandingOrders'); |
74 | - if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
74 | + if ($nbStandingOrders > 0) $head[$h][1] .= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
75 | 75 | $head[$h][2] = 'standingorders'; |
76 | 76 | $h++; |
77 | 77 | } |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | // Entries must be declared in modules descriptor with line |
81 | 81 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
82 | 82 | // $this->tabs = array('entity:-tabname); to remove a tab |
83 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice'); |
|
83 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice'); |
|
84 | 84 | |
85 | 85 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 86 | { |
87 | 87 | $nbNote = 0; |
88 | - if(!empty($object->note_private)) $nbNote++; |
|
89 | - if(!empty($object->note_public)) $nbNote++; |
|
88 | + if (!empty($object->note_private)) $nbNote++; |
|
89 | + if (!empty($object->note_public)) $nbNote++; |
|
90 | 90 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
91 | 91 | $head[$h][1] = $langs->trans('Notes'); |
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
92 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
93 | 93 | $head[$h][2] = 'note'; |
94 | 94 | $h++; |
95 | 95 | } |
96 | 96 | |
97 | 97 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
99 | + $upload_dir = $conf->facture->dir_output."/".dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
105 | 105 | $head[$h][2] = 'documents'; |
106 | 106 | $h++; |
107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $head[$h][2] = 'info'; |
111 | 111 | $h++; |
112 | 112 | |
113 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove'); |
|
113 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice', 'remove'); |
|
114 | 114 | |
115 | 115 | return $head; |
116 | 116 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | // Entries must be declared in modules descriptor with line |
142 | 142 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
143 | 143 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
144 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); |
|
144 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin'); |
|
145 | 145 | |
146 | 146 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; |
147 | 147 | $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $head[$h][2] = 'attributeslinesrec'; |
164 | 164 | $h++; |
165 | 165 | |
166 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); |
|
166 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin', 'remove'); |
|
167 | 167 | |
168 | 168 | return $head; |
169 | 169 | } |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | // Entries must be declared in modules descriptor with line |
192 | 192 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
193 | 193 | // $this->tabs = array('entity:-tabname); to remove a tab |
194 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec'); |
|
194 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice-rec'); |
|
195 | 195 | |
196 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove'); |
|
196 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice-rec', 'remove'); |
|
197 | 197 | |
198 | 198 | return $head; |
199 | 199 | } |
@@ -50,7 +50,9 @@ discard block |
||
50 | 50 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
51 | 51 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
52 | 52 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
53 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
53 | + if ($nbContact > 0) { |
|
54 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
55 | + } |
|
54 | 56 | $head[$h][2] = 'contact'; |
55 | 57 | $h++; |
56 | 58 | } |
@@ -66,12 +68,17 @@ discard block |
||
66 | 68 | if ($resql) |
67 | 69 | { |
68 | 70 | $obj=$db->fetch_object($resql); |
69 | - if ($obj) $nbStandingOrders = $obj->nb; |
|
71 | + if ($obj) { |
|
72 | + $nbStandingOrders = $obj->nb; |
|
73 | + } |
|
74 | + } else { |
|
75 | + dol_print_error($db); |
|
70 | 76 | } |
71 | - else dol_print_error($db); |
|
72 | 77 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
73 | 78 | $head[$h][1] = $langs->trans('StandingOrders'); |
74 | - if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
79 | + if ($nbStandingOrders > 0) { |
|
80 | + $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
81 | + } |
|
75 | 82 | $head[$h][2] = 'standingorders'; |
76 | 83 | $h++; |
77 | 84 | } |
@@ -85,11 +92,17 @@ discard block |
||
85 | 92 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 93 | { |
87 | 94 | $nbNote = 0; |
88 | - if(!empty($object->note_private)) $nbNote++; |
|
89 | - if(!empty($object->note_public)) $nbNote++; |
|
95 | + if(!empty($object->note_private)) { |
|
96 | + $nbNote++; |
|
97 | + } |
|
98 | + if(!empty($object->note_public)) { |
|
99 | + $nbNote++; |
|
100 | + } |
|
90 | 101 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
91 | 102 | $head[$h][1] = $langs->trans('Notes'); |
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
103 | + if ($nbNote > 0) { |
|
104 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
105 | + } |
|
93 | 106 | $head[$h][2] = 'note'; |
94 | 107 | $h++; |
95 | 108 | } |
@@ -101,7 +114,9 @@ discard block |
||
101 | 114 | $nbLinks=Link::count($db, $object->element, $object->id); |
102 | 115 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
103 | 116 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
117 | + if (($nbFiles+$nbLinks) > 0) { |
|
118 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
119 | + } |
|
105 | 120 | $head[$h][2] = 'documents'; |
106 | 121 | $h++; |
107 | 122 |
@@ -30,30 +30,30 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function establishment_prepare_head($object) |
32 | 32 | { |
33 | - global $langs, $conf; |
|
33 | + global $langs, $conf; |
|
34 | 34 | |
35 | - $h = 0; |
|
36 | - $head = array(); |
|
35 | + $h = 0; |
|
36 | + $head = array(); |
|
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id; |
|
39 | - $head[$h][1] = $langs->trans("Card"); |
|
40 | - $head[$h][2] = 'card'; |
|
41 | - $h++; |
|
38 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id; |
|
39 | + $head[$h][1] = $langs->trans("Card"); |
|
40 | + $head[$h][2] = 'card'; |
|
41 | + $h++; |
|
42 | 42 | |
43 | - // Show more tabs from modules |
|
44 | - // Entries must be declared in modules descriptor with line |
|
43 | + // Show more tabs from modules |
|
44 | + // Entries must be declared in modules descriptor with line |
|
45 | 45 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
46 | 46 | // $this->tabs = array('entity:-tabname); to remove a tab |
47 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment'); |
|
47 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment'); |
|
48 | 48 | |
49 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id; |
|
50 | - $head[$h][1] = $langs->trans("Info"); |
|
51 | - $head[$h][2] = 'info'; |
|
52 | - $h++; |
|
49 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id; |
|
50 | + $head[$h][1] = $langs->trans("Info"); |
|
51 | + $head[$h][2] = 'info'; |
|
52 | + $h++; |
|
53 | 53 | |
54 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove'); |
|
54 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove'); |
|
55 | 55 | |
56 | - return $head; |
|
56 | + return $head; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $h = 0; |
69 | 69 | $head = array(); |
70 | 70 | |
71 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php'; |
|
71 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php'; |
|
72 | 72 | $head[$h][1] = $langs->trans("Parameters"); |
73 | 73 | $head[$h][2] = 'parameters'; |
74 | 74 | $h++; |
75 | 75 | |
76 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php'; |
|
76 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php'; |
|
77 | 77 | $head[$h][1] = $langs->trans("Establishments"); |
78 | 78 | $head[$h][2] = 'establishments'; |
79 | 79 | $h++; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $h = 0; |
36 | 36 | $head = array(); |
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id; |
|
38 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$object->id; |
|
39 | 39 | $head[$h][1] = $langs->trans("Card"); |
40 | 40 | $head[$h][2] = 'card'; |
41 | 41 | $h++; |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | // Entries must be declared in modules descriptor with line |
45 | 45 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
46 | 46 | // $this->tabs = array('entity:-tabname); to remove a tab |
47 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment'); |
|
47 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment'); |
|
48 | 48 | |
49 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id; |
|
49 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id='.$object->id; |
|
50 | 50 | $head[$h][1] = $langs->trans("Info"); |
51 | 51 | $head[$h][2] = 'info'; |
52 | 52 | $h++; |
53 | 53 | |
54 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove'); |
|
54 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment', 'remove'); |
|
55 | 55 | |
56 | 56 | return $head; |
57 | 57 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | // Entries must be declared in modules descriptor with line |
83 | 83 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
84 | 84 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
85 | - complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin'); |
|
85 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'hrm_admin'); |
|
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin','remove'); |
|
87 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'hrm_admin', 'remove'); |
|
88 | 88 | |
89 | 89 | return $head; |
90 | 90 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | function payment_prepare_head(Paiement $object) |
29 | 29 | { |
30 | 30 | |
31 | - global $langs, $conf; |
|
31 | + global $langs, $conf; |
|
32 | 32 | |
33 | - $h = 0; |
|
34 | - $head = array(); |
|
33 | + $h = 0; |
|
34 | + $head = array(); |
|
35 | 35 | |
36 | - $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; |
|
37 | - $head[$h][1] = $langs->trans("Card"); |
|
38 | - $head[$h][2] = 'payment'; |
|
39 | - $h++; |
|
36 | + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; |
|
37 | + $head[$h][1] = $langs->trans("Card"); |
|
38 | + $head[$h][2] = 'payment'; |
|
39 | + $h++; |
|
40 | 40 | |
41 | 41 | // Show more tabs from modules |
42 | 42 | // Entries must be declared in modules descriptor with line |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | // $this->tabs = array('entity:-tabname); to remove a tab |
45 | 45 | complete_head_from_modules($conf,$langs,$object,$head,$h,'payment'); |
46 | 46 | |
47 | - $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; |
|
48 | - $head[$h][1] = $langs->trans("Info"); |
|
49 | - $head[$h][2] = 'info'; |
|
50 | - $h++; |
|
47 | + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; |
|
48 | + $head[$h][1] = $langs->trans("Info"); |
|
49 | + $head[$h][2] = 'info'; |
|
50 | + $h++; |
|
51 | 51 | |
52 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); |
|
52 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); |
|
53 | 53 | |
54 | - return $head; |
|
54 | + return $head; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | */ |
64 | 64 | function payment_supplier_prepare_head(Paiement $object) |
65 | 65 | { |
66 | - global $langs, $conf; |
|
66 | + global $langs, $conf; |
|
67 | 67 | |
68 | - $h = 0; |
|
69 | - $head = array(); |
|
68 | + $h = 0; |
|
69 | + $head = array(); |
|
70 | 70 | |
71 | - $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id; |
|
72 | - $head[$h][1] = $langs->trans("Card"); |
|
73 | - $head[$h][2] = 'payment'; |
|
74 | - $h++; |
|
71 | + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id; |
|
72 | + $head[$h][1] = $langs->trans("Card"); |
|
73 | + $head[$h][2] = 'payment'; |
|
74 | + $h++; |
|
75 | 75 | |
76 | 76 | // Show more tabs from modules |
77 | 77 | // Entries must be declared in modules descriptor with line |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | // $this->tabs = array('entity:-tabname); to remove a tab |
80 | 80 | complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier'); |
81 | 81 | |
82 | - $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; |
|
83 | - $head[$h][1] = $langs->trans('Info'); |
|
84 | - $head[$h][2] = 'info'; |
|
85 | - $h++; |
|
82 | + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; |
|
83 | + $head[$h][1] = $langs->trans('Info'); |
|
84 | + $head[$h][2] = 'info'; |
|
85 | + $h++; |
|
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); |
|
87 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); |
|
88 | 88 | |
89 | - return $head; |
|
89 | + return $head; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | */ |
98 | 98 | function getValidOnlinePaymentMethods($paymentmethod='') |
99 | 99 | { |
100 | - global $conf; |
|
101 | - |
|
102 | - $validpaymentmethod=array(); |
|
103 | - |
|
104 | - if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) |
|
105 | - { |
|
106 | - $validpaymentmethod['paypal']='valid'; |
|
107 | - } |
|
108 | - if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) |
|
109 | - { |
|
110 | - $validpaymentmethod['paybox']='valid'; |
|
111 | - } |
|
112 | - if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) |
|
113 | - { |
|
114 | - $validpaymentmethod['stripe']='valid'; |
|
115 | - } |
|
116 | - return $validpaymentmethod; |
|
100 | + global $conf; |
|
101 | + |
|
102 | + $validpaymentmethod=array(); |
|
103 | + |
|
104 | + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) |
|
105 | + { |
|
106 | + $validpaymentmethod['paypal']='valid'; |
|
107 | + } |
|
108 | + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) |
|
109 | + { |
|
110 | + $validpaymentmethod['paybox']='valid'; |
|
111 | + } |
|
112 | + if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) |
|
113 | + { |
|
114 | + $validpaymentmethod['stripe']='valid'; |
|
115 | + } |
|
116 | + return $validpaymentmethod; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function showOnlinePaymentUrl($type,$ref) |
127 | 127 | { |
128 | - global $conf, $langs; |
|
128 | + global $conf, $langs; |
|
129 | 129 | |
130 | - // Load translation files required by the page |
|
130 | + // Load translation files required by the page |
|
131 | 131 | $langs->loadLangs(array('payment', 'paybox')); |
132 | 132 | |
133 | - $servicename='Online'; |
|
133 | + $servicename='Online'; |
|
134 | 134 | |
135 | - $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>'; |
|
136 | - $url = getOnlinePaymentUrl(0,$type,$ref); |
|
137 | - $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | - $out.= ajax_autoselect("onlinepaymenturl", 0); |
|
139 | - return $out; |
|
135 | + $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>'; |
|
136 | + $url = getOnlinePaymentUrl(0,$type,$ref); |
|
137 | + $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | + $out.= ajax_autoselect("onlinepaymenturl", 0); |
|
139 | + return $out; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -151,115 +151,115 @@ discard block |
||
151 | 151 | */ |
152 | 152 | function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag') |
153 | 153 | { |
154 | - global $conf; |
|
155 | - |
|
156 | - $ref=str_replace(' ','',$ref); |
|
157 | - $out=''; |
|
158 | - |
|
159 | - if ($type == 'free') |
|
160 | - { |
|
161 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
|
162 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
163 | - { |
|
164 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | - else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
166 | - } |
|
167 | - } |
|
168 | - elseif ($type == 'order') |
|
169 | - { |
|
170 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
|
171 | - if ($mode == 1) $out.='order_ref'; |
|
172 | - if ($mode == 0) $out.=urlencode($ref); |
|
173 | - $out.=($mode?'</font>':''); |
|
174 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
175 | - { |
|
176 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | - else |
|
178 | - { |
|
179 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
180 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
182 | - $out.=($mode?'</font>':''); |
|
183 | - } |
|
184 | - } |
|
185 | - } |
|
186 | - elseif ($type == 'invoice') |
|
187 | - { |
|
188 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
|
189 | - if ($mode == 1) $out.='invoice_ref'; |
|
190 | - if ($mode == 0) $out.=urlencode($ref); |
|
191 | - $out.=($mode?'</font>':''); |
|
192 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
193 | - { |
|
194 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | - else |
|
196 | - { |
|
197 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
198 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
200 | - $out.=($mode?'</font>':''); |
|
201 | - } |
|
202 | - } |
|
203 | - } |
|
204 | - elseif ($type == 'contractline') |
|
205 | - { |
|
206 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
|
207 | - if ($mode == 1) $out.='contractline_ref'; |
|
208 | - if ($mode == 0) $out.=urlencode($ref); |
|
209 | - $out.=($mode?'</font>':''); |
|
210 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
211 | - { |
|
212 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | - else |
|
214 | - { |
|
215 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
216 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | - $out.=($mode?'</font>':''); |
|
219 | - } |
|
220 | - } |
|
221 | - } |
|
222 | - elseif ($type == 'member' || $type == 'membersubscription') |
|
223 | - { |
|
224 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
|
225 | - if ($mode == 1) $out.='member_ref'; |
|
226 | - if ($mode == 0) $out.=urlencode($ref); |
|
227 | - $out.=($mode?'</font>':''); |
|
228 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
229 | - { |
|
230 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | - else |
|
232 | - { |
|
233 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
234 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
236 | - $out.=($mode?'</font>':''); |
|
237 | - } |
|
238 | - } |
|
239 | - } |
|
240 | - if ($type == 'donation') |
|
241 | - { |
|
242 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
|
243 | - if ($mode == 1) $out.='donation_ref'; |
|
244 | - if ($mode == 0) $out.=urlencode($ref); |
|
245 | - $out.=($mode?'</font>':''); |
|
246 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
247 | - { |
|
248 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | - else |
|
250 | - { |
|
251 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
252 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
254 | - $out.=($mode?'</font>':''); |
|
255 | - } |
|
256 | - } |
|
257 | - } |
|
258 | - |
|
259 | - // For multicompany |
|
260 | - if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
261 | - |
|
262 | - return $out; |
|
154 | + global $conf; |
|
155 | + |
|
156 | + $ref=str_replace(' ','',$ref); |
|
157 | + $out=''; |
|
158 | + |
|
159 | + if ($type == 'free') |
|
160 | + { |
|
161 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
|
162 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
163 | + { |
|
164 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | + else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
166 | + } |
|
167 | + } |
|
168 | + elseif ($type == 'order') |
|
169 | + { |
|
170 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
|
171 | + if ($mode == 1) $out.='order_ref'; |
|
172 | + if ($mode == 0) $out.=urlencode($ref); |
|
173 | + $out.=($mode?'</font>':''); |
|
174 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
175 | + { |
|
176 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | + else |
|
178 | + { |
|
179 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
180 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
182 | + $out.=($mode?'</font>':''); |
|
183 | + } |
|
184 | + } |
|
185 | + } |
|
186 | + elseif ($type == 'invoice') |
|
187 | + { |
|
188 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
|
189 | + if ($mode == 1) $out.='invoice_ref'; |
|
190 | + if ($mode == 0) $out.=urlencode($ref); |
|
191 | + $out.=($mode?'</font>':''); |
|
192 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
193 | + { |
|
194 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | + else |
|
196 | + { |
|
197 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
198 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
200 | + $out.=($mode?'</font>':''); |
|
201 | + } |
|
202 | + } |
|
203 | + } |
|
204 | + elseif ($type == 'contractline') |
|
205 | + { |
|
206 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
|
207 | + if ($mode == 1) $out.='contractline_ref'; |
|
208 | + if ($mode == 0) $out.=urlencode($ref); |
|
209 | + $out.=($mode?'</font>':''); |
|
210 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
211 | + { |
|
212 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | + else |
|
214 | + { |
|
215 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
216 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | + $out.=($mode?'</font>':''); |
|
219 | + } |
|
220 | + } |
|
221 | + } |
|
222 | + elseif ($type == 'member' || $type == 'membersubscription') |
|
223 | + { |
|
224 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
|
225 | + if ($mode == 1) $out.='member_ref'; |
|
226 | + if ($mode == 0) $out.=urlencode($ref); |
|
227 | + $out.=($mode?'</font>':''); |
|
228 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
229 | + { |
|
230 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | + else |
|
232 | + { |
|
233 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
234 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
236 | + $out.=($mode?'</font>':''); |
|
237 | + } |
|
238 | + } |
|
239 | + } |
|
240 | + if ($type == 'donation') |
|
241 | + { |
|
242 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
|
243 | + if ($mode == 1) $out.='donation_ref'; |
|
244 | + if ($mode == 0) $out.=urlencode($ref); |
|
245 | + $out.=($mode?'</font>':''); |
|
246 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
247 | + { |
|
248 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | + else |
|
250 | + { |
|
251 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
252 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
254 | + $out.=($mode?'</font>':''); |
|
255 | + } |
|
256 | + } |
|
257 | + } |
|
258 | + |
|
259 | + // For multicompany |
|
260 | + if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
261 | + |
|
262 | + return $out; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -331,20 +331,20 @@ discard block |
||
331 | 331 | print '<div class="center">'."\n"; |
332 | 332 | if ($addformmessage) |
333 | 333 | { |
334 | - print '<!-- object = '.$object->element.' -->'; |
|
335 | - print '<br>'; |
|
336 | - |
|
337 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
340 | - |
|
341 | - // Add other message if VAT exists |
|
342 | - if ($object->total_vat != 0 || $object->total_tva != 0) |
|
343 | - { |
|
344 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
347 | - } |
|
334 | + print '<!-- object = '.$object->element.' -->'; |
|
335 | + print '<br>'; |
|
336 | + |
|
337 | + $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | + if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | + elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
340 | + |
|
341 | + // Add other message if VAT exists |
|
342 | + if ($object->total_vat != 0 || $object->total_tva != 0) |
|
343 | + { |
|
344 | + $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | + if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | + elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | print '<font style="font-size: 10px;"><br><hr>'."\n"; |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | // Entries must be declared in modules descriptor with line |
43 | 43 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
44 | 44 | // $this->tabs = array('entity:-tabname); to remove a tab |
45 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment'); |
|
45 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment'); |
|
46 | 46 | |
47 | 47 | $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; |
48 | 48 | $head[$h][1] = $langs->trans("Info"); |
49 | 49 | $head[$h][2] = 'info'; |
50 | 50 | $h++; |
51 | 51 | |
52 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); |
|
52 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove'); |
|
53 | 53 | |
54 | 54 | return $head; |
55 | 55 | } |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | // Entries must be declared in modules descriptor with line |
78 | 78 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
79 | 79 | // $this->tabs = array('entity:-tabname); to remove a tab |
80 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier'); |
|
80 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier'); |
|
81 | 81 | |
82 | 82 | $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; |
83 | 83 | $head[$h][1] = $langs->trans('Info'); |
84 | 84 | $head[$h][2] = 'info'; |
85 | 85 | $h++; |
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); |
|
87 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier', 'remove'); |
|
88 | 88 | |
89 | 89 | return $head; |
90 | 90 | } |
@@ -95,23 +95,23 @@ discard block |
||
95 | 95 | * @param string $paymentmethod Filter on this payment method (''=none, 'paypal', ...) |
96 | 96 | * @return array Array of valid payment method |
97 | 97 | */ |
98 | -function getValidOnlinePaymentMethods($paymentmethod='') |
|
98 | +function getValidOnlinePaymentMethods($paymentmethod = '') |
|
99 | 99 | { |
100 | 100 | global $conf; |
101 | 101 | |
102 | - $validpaymentmethod=array(); |
|
102 | + $validpaymentmethod = array(); |
|
103 | 103 | |
104 | - if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) |
|
104 | + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) |
|
105 | 105 | { |
106 | - $validpaymentmethod['paypal']='valid'; |
|
106 | + $validpaymentmethod['paypal'] = 'valid'; |
|
107 | 107 | } |
108 | - if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) |
|
108 | + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) |
|
109 | 109 | { |
110 | - $validpaymentmethod['paybox']='valid'; |
|
110 | + $validpaymentmethod['paybox'] = 'valid'; |
|
111 | 111 | } |
112 | - if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) |
|
112 | + if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) |
|
113 | 113 | { |
114 | - $validpaymentmethod['stripe']='valid'; |
|
114 | + $validpaymentmethod['stripe'] = 'valid'; |
|
115 | 115 | } |
116 | 116 | return $validpaymentmethod; |
117 | 117 | } |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | * @param string $ref Ref of object |
124 | 124 | * @return string Url string |
125 | 125 | */ |
126 | -function showOnlinePaymentUrl($type,$ref) |
|
126 | +function showOnlinePaymentUrl($type, $ref) |
|
127 | 127 | { |
128 | 128 | global $conf, $langs; |
129 | 129 | |
130 | 130 | // Load translation files required by the page |
131 | 131 | $langs->loadLangs(array('payment', 'paybox')); |
132 | 132 | |
133 | - $servicename='Online'; |
|
133 | + $servicename = 'Online'; |
|
134 | 134 | |
135 | - $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>'; |
|
136 | - $url = getOnlinePaymentUrl(0,$type,$ref); |
|
137 | - $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | - $out.= ajax_autoselect("onlinepaymenturl", 0); |
|
135 | + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>'; |
|
136 | + $url = getOnlinePaymentUrl(0, $type, $ref); |
|
137 | + $out .= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | + $out .= ajax_autoselect("onlinepaymenturl", 0); |
|
139 | 139 | return $out; |
140 | 140 | } |
141 | 141 | |
@@ -149,115 +149,115 @@ discard block |
||
149 | 149 | * @param string $freetag Free tag |
150 | 150 | * @return string Url string |
151 | 151 | */ |
152 | -function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag') |
|
152 | +function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag') |
|
153 | 153 | { |
154 | 154 | global $conf; |
155 | 155 | |
156 | - $ref=str_replace(' ','',$ref); |
|
157 | - $out=''; |
|
156 | + $ref = str_replace(' ', '', $ref); |
|
157 | + $out = ''; |
|
158 | 158 | |
159 | 159 | if ($type == 'free') |
160 | 160 | { |
161 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
|
162 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
161 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : ''); |
|
162 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
163 | 163 | { |
164 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | - else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
164 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | + else $out .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | elseif ($type == 'order') |
169 | 169 | { |
170 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
|
171 | - if ($mode == 1) $out.='order_ref'; |
|
172 | - if ($mode == 0) $out.=urlencode($ref); |
|
173 | - $out.=($mode?'</font>':''); |
|
174 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
170 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : ''); |
|
171 | + if ($mode == 1) $out .= 'order_ref'; |
|
172 | + if ($mode == 0) $out .= urlencode($ref); |
|
173 | + $out .= ($mode ? '</font>' : ''); |
|
174 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
175 | 175 | { |
176 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
176 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | 177 | else |
178 | 178 | { |
179 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
180 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
182 | - $out.=($mode?'</font>':''); |
|
179 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
180 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
182 | + $out .= ($mode ? '</font>' : ''); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | elseif ($type == 'invoice') |
187 | 187 | { |
188 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
|
189 | - if ($mode == 1) $out.='invoice_ref'; |
|
190 | - if ($mode == 0) $out.=urlencode($ref); |
|
191 | - $out.=($mode?'</font>':''); |
|
192 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
188 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : ''); |
|
189 | + if ($mode == 1) $out .= 'invoice_ref'; |
|
190 | + if ($mode == 0) $out .= urlencode($ref); |
|
191 | + $out .= ($mode ? '</font>' : ''); |
|
192 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
193 | 193 | { |
194 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
194 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | 195 | else |
196 | 196 | { |
197 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
198 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
200 | - $out.=($mode?'</font>':''); |
|
197 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
198 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
200 | + $out .= ($mode ? '</font>' : ''); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
204 | 204 | elseif ($type == 'contractline') |
205 | 205 | { |
206 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
|
207 | - if ($mode == 1) $out.='contractline_ref'; |
|
208 | - if ($mode == 0) $out.=urlencode($ref); |
|
209 | - $out.=($mode?'</font>':''); |
|
210 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
206 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : ''); |
|
207 | + if ($mode == 1) $out .= 'contractline_ref'; |
|
208 | + if ($mode == 0) $out .= urlencode($ref); |
|
209 | + $out .= ($mode ? '</font>' : ''); |
|
210 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
211 | 211 | { |
212 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
212 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | 213 | else |
214 | 214 | { |
215 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
216 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | - $out.=($mode?'</font>':''); |
|
215 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
216 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
218 | + $out .= ($mode ? '</font>' : ''); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | } |
222 | 222 | elseif ($type == 'member' || $type == 'membersubscription') |
223 | 223 | { |
224 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
|
225 | - if ($mode == 1) $out.='member_ref'; |
|
226 | - if ($mode == 0) $out.=urlencode($ref); |
|
227 | - $out.=($mode?'</font>':''); |
|
228 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
224 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : ''); |
|
225 | + if ($mode == 1) $out .= 'member_ref'; |
|
226 | + if ($mode == 0) $out .= urlencode($ref); |
|
227 | + $out .= ($mode ? '</font>' : ''); |
|
228 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
229 | 229 | { |
230 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
230 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | 231 | else |
232 | 232 | { |
233 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
234 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
236 | - $out.=($mode?'</font>':''); |
|
233 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
234 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
236 | + $out .= ($mode ? '</font>' : ''); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
240 | 240 | if ($type == 'donation') |
241 | 241 | { |
242 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
|
243 | - if ($mode == 1) $out.='donation_ref'; |
|
244 | - if ($mode == 0) $out.=urlencode($ref); |
|
245 | - $out.=($mode?'</font>':''); |
|
246 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
242 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<font color="#666666">' : ''); |
|
243 | + if ($mode == 1) $out .= 'donation_ref'; |
|
244 | + if ($mode == 0) $out .= urlencode($ref); |
|
245 | + $out .= ($mode ? '</font>' : ''); |
|
246 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
247 | 247 | { |
248 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
248 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | 249 | else |
250 | 250 | { |
251 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
252 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
254 | - $out.=($mode?'</font>':''); |
|
251 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
252 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
254 | + $out .= ($mode ? '</font>' : ''); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | 259 | // For multicompany |
260 | - if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
260 | + if (!empty($out) && !empty($conf->multicompany->enabled)) $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
261 | 261 | |
262 | 262 | return $out; |
263 | 263 | } |
@@ -274,56 +274,56 @@ discard block |
||
274 | 274 | * @param Object $object Object related to payment |
275 | 275 | * @return void |
276 | 276 | */ |
277 | -function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null) |
|
277 | +function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null) |
|
278 | 278 | { |
279 | 279 | global $conf; |
280 | 280 | |
281 | 281 | // Juridical status |
282 | - $line1=""; |
|
282 | + $line1 = ""; |
|
283 | 283 | if ($fromcompany->forme_juridique_code) |
284 | 284 | { |
285 | - $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); |
|
285 | + $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); |
|
286 | 286 | } |
287 | 287 | // Capital |
288 | 288 | if ($fromcompany->capital) |
289 | 289 | { |
290 | - $line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); |
|
290 | + $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); |
|
291 | 291 | } |
292 | 292 | // Prof Id 1 |
293 | - if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) |
|
293 | + if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) |
|
294 | 294 | { |
295 | - $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code); |
|
296 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
297 | - $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1; |
|
295 | + $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code); |
|
296 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
297 | + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1; |
|
298 | 298 | } |
299 | 299 | // Prof Id 2 |
300 | 300 | if ($fromcompany->idprof2) |
301 | 301 | { |
302 | - $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code); |
|
303 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
304 | - $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2; |
|
302 | + $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code); |
|
303 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
304 | + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | // Second line of company infos |
308 | - $line2=""; |
|
308 | + $line2 = ""; |
|
309 | 309 | // Prof Id 3 |
310 | 310 | if ($fromcompany->idprof3) |
311 | 311 | { |
312 | - $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code); |
|
313 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
314 | - $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3; |
|
312 | + $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code); |
|
313 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
314 | + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3; |
|
315 | 315 | } |
316 | 316 | // Prof Id 4 |
317 | 317 | if ($fromcompany->idprof4) |
318 | 318 | { |
319 | - $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code); |
|
320 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
321 | - $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4; |
|
319 | + $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code); |
|
320 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
321 | + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4; |
|
322 | 322 | } |
323 | 323 | // IntraCommunautary VAT |
324 | 324 | if ($fromcompany->tva_intra != '') |
325 | 325 | { |
326 | - $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; |
|
326 | + $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | print '<br>'; |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | print '<!-- object = '.$object->element.' -->'; |
335 | 335 | print '<br>'; |
336 | 336 | |
337 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
337 | + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | + if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | + elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
340 | 340 | |
341 | 341 | // Add other message if VAT exists |
342 | 342 | if ($object->total_vat != 0 || $object->total_tva != 0) |
343 | 343 | { |
344 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
344 | + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | + if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | + elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 |
@@ -161,78 +161,113 @@ discard block |
||
161 | 161 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
162 | 162 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
163 | 163 | { |
164 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | - else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
164 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
165 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
166 | + } else { |
|
167 | + $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
168 | + } |
|
166 | 169 | } |
167 | - } |
|
168 | - elseif ($type == 'order') |
|
170 | + } elseif ($type == 'order') |
|
169 | 171 | { |
170 | 172 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
171 | - if ($mode == 1) $out.='order_ref'; |
|
172 | - if ($mode == 0) $out.=urlencode($ref); |
|
173 | + if ($mode == 1) { |
|
174 | + $out.='order_ref'; |
|
175 | + } |
|
176 | + if ($mode == 0) { |
|
177 | + $out.=urlencode($ref); |
|
178 | + } |
|
173 | 179 | $out.=($mode?'</font>':''); |
174 | 180 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
175 | 181 | { |
176 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | - else |
|
182 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
183 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
184 | + } else |
|
178 | 185 | { |
179 | 186 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
180 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
187 | + if ($mode == 1) { |
|
188 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
189 | + } |
|
190 | + if ($mode == 0) { |
|
191 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
192 | + } |
|
182 | 193 | $out.=($mode?'</font>':''); |
183 | 194 | } |
184 | 195 | } |
185 | - } |
|
186 | - elseif ($type == 'invoice') |
|
196 | + } elseif ($type == 'invoice') |
|
187 | 197 | { |
188 | 198 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
189 | - if ($mode == 1) $out.='invoice_ref'; |
|
190 | - if ($mode == 0) $out.=urlencode($ref); |
|
199 | + if ($mode == 1) { |
|
200 | + $out.='invoice_ref'; |
|
201 | + } |
|
202 | + if ($mode == 0) { |
|
203 | + $out.=urlencode($ref); |
|
204 | + } |
|
191 | 205 | $out.=($mode?'</font>':''); |
192 | 206 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
193 | 207 | { |
194 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | - else |
|
208 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
209 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
210 | + } else |
|
196 | 211 | { |
197 | 212 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
198 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
213 | + if ($mode == 1) { |
|
214 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
215 | + } |
|
216 | + if ($mode == 0) { |
|
217 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | + } |
|
200 | 219 | $out.=($mode?'</font>':''); |
201 | 220 | } |
202 | 221 | } |
203 | - } |
|
204 | - elseif ($type == 'contractline') |
|
222 | + } elseif ($type == 'contractline') |
|
205 | 223 | { |
206 | 224 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
207 | - if ($mode == 1) $out.='contractline_ref'; |
|
208 | - if ($mode == 0) $out.=urlencode($ref); |
|
225 | + if ($mode == 1) { |
|
226 | + $out.='contractline_ref'; |
|
227 | + } |
|
228 | + if ($mode == 0) { |
|
229 | + $out.=urlencode($ref); |
|
230 | + } |
|
209 | 231 | $out.=($mode?'</font>':''); |
210 | 232 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
211 | 233 | { |
212 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | - else |
|
234 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
235 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
236 | + } else |
|
214 | 237 | { |
215 | 238 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
216 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
239 | + if ($mode == 1) { |
|
240 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
241 | + } |
|
242 | + if ($mode == 0) { |
|
243 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
244 | + } |
|
218 | 245 | $out.=($mode?'</font>':''); |
219 | 246 | } |
220 | 247 | } |
221 | - } |
|
222 | - elseif ($type == 'member' || $type == 'membersubscription') |
|
248 | + } elseif ($type == 'member' || $type == 'membersubscription') |
|
223 | 249 | { |
224 | 250 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
225 | - if ($mode == 1) $out.='member_ref'; |
|
226 | - if ($mode == 0) $out.=urlencode($ref); |
|
251 | + if ($mode == 1) { |
|
252 | + $out.='member_ref'; |
|
253 | + } |
|
254 | + if ($mode == 0) { |
|
255 | + $out.=urlencode($ref); |
|
256 | + } |
|
227 | 257 | $out.=($mode?'</font>':''); |
228 | 258 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
229 | 259 | { |
230 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | - else |
|
260 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
261 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
262 | + } else |
|
232 | 263 | { |
233 | 264 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
234 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
265 | + if ($mode == 1) { |
|
266 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
267 | + } |
|
268 | + if ($mode == 0) { |
|
269 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
270 | + } |
|
236 | 271 | $out.=($mode?'</font>':''); |
237 | 272 | } |
238 | 273 | } |
@@ -240,24 +275,36 @@ discard block |
||
240 | 275 | if ($type == 'donation') |
241 | 276 | { |
242 | 277 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
243 | - if ($mode == 1) $out.='donation_ref'; |
|
244 | - if ($mode == 0) $out.=urlencode($ref); |
|
278 | + if ($mode == 1) { |
|
279 | + $out.='donation_ref'; |
|
280 | + } |
|
281 | + if ($mode == 0) { |
|
282 | + $out.=urlencode($ref); |
|
283 | + } |
|
245 | 284 | $out.=($mode?'</font>':''); |
246 | 285 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
247 | 286 | { |
248 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | - else |
|
287 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
288 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
289 | + } else |
|
250 | 290 | { |
251 | 291 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
252 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
292 | + if ($mode == 1) { |
|
293 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
294 | + } |
|
295 | + if ($mode == 0) { |
|
296 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
297 | + } |
|
254 | 298 | $out.=($mode?'</font>':''); |
255 | 299 | } |
256 | 300 | } |
257 | 301 | } |
258 | 302 | |
259 | 303 | // For multicompany |
260 | - if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
304 | + if (! empty($out) && ! empty($conf->multicompany->enabled)) { |
|
305 | + $out.="&entity=".$conf->entity; |
|
306 | + } |
|
307 | + // Check the entity because we may have the same reference in several entities |
|
261 | 308 | |
262 | 309 | return $out; |
263 | 310 | } |
@@ -293,14 +340,18 @@ discard block |
||
293 | 340 | if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) |
294 | 341 | { |
295 | 342 | $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code); |
296 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
343 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
344 | + $field=$reg[1]; |
|
345 | + } |
|
297 | 346 | $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1; |
298 | 347 | } |
299 | 348 | // Prof Id 2 |
300 | 349 | if ($fromcompany->idprof2) |
301 | 350 | { |
302 | 351 | $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code); |
303 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
352 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
353 | + $field=$reg[1]; |
|
354 | + } |
|
304 | 355 | $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2; |
305 | 356 | } |
306 | 357 | |
@@ -310,14 +361,18 @@ discard block |
||
310 | 361 | if ($fromcompany->idprof3) |
311 | 362 | { |
312 | 363 | $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code); |
313 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
364 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
365 | + $field=$reg[1]; |
|
366 | + } |
|
314 | 367 | $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3; |
315 | 368 | } |
316 | 369 | // Prof Id 4 |
317 | 370 | if ($fromcompany->idprof4) |
318 | 371 | { |
319 | 372 | $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code); |
320 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
373 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
374 | + $field=$reg[1]; |
|
375 | + } |
|
321 | 376 | $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4; |
322 | 377 | } |
323 | 378 | // IntraCommunautary VAT |
@@ -335,23 +390,32 @@ discard block |
||
335 | 390 | print '<br>'; |
336 | 391 | |
337 | 392 | $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
338 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
393 | + if (! empty($conf->global->$parammessageform)) { |
|
394 | + print $langs->transnoentities($conf->global->$parammessageform); |
|
395 | + } elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) { |
|
396 | + print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
397 | + } |
|
340 | 398 | |
341 | 399 | // Add other message if VAT exists |
342 | 400 | if ($object->total_vat != 0 || $object->total_tva != 0) |
343 | 401 | { |
344 | 402 | $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
345 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
403 | + if (! empty($conf->global->$parammessageform)) { |
|
404 | + print $langs->transnoentities($conf->global->$parammessageform); |
|
405 | + } elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) { |
|
406 | + print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
407 | + } |
|
347 | 408 | } |
348 | 409 | } |
349 | 410 | |
350 | 411 | print '<font style="font-size: 10px;"><br><hr>'."\n"; |
351 | 412 | print $fromcompany->name.'<br>'; |
352 | 413 | print $line1; |
353 | - if (strlen($line1.$line2) > 50) print '<br>'; |
|
354 | - else print ' - '; |
|
414 | + if (strlen($line1.$line2) > 50) { |
|
415 | + print '<br>'; |
|
416 | + } else { |
|
417 | + print ' - '; |
|
418 | + } |
|
355 | 419 | print $line2; |
356 | 420 | print '</font></div>'."\n"; |
357 | 421 | } |
@@ -28,41 +28,41 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function asset_admin_prepare_head() |
30 | 30 | { |
31 | - global $langs, $conf; |
|
31 | + global $langs, $conf; |
|
32 | 32 | |
33 | - $langs->load("assets"); |
|
33 | + $langs->load("assets"); |
|
34 | 34 | |
35 | - $h = 0; |
|
36 | - $head = array(); |
|
35 | + $h = 0; |
|
36 | + $head = array(); |
|
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php'; |
|
39 | - $head[$h][1] = $langs->trans("Settings"); |
|
40 | - $head[$h][2] = 'settings'; |
|
41 | - $h++; |
|
38 | + $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php'; |
|
39 | + $head[$h][1] = $langs->trans("Settings"); |
|
40 | + $head[$h][2] = 'settings'; |
|
41 | + $h++; |
|
42 | 42 | |
43 | - // Show more tabs from modules |
|
44 | - // Entries must be declared in modules descriptor with line |
|
45 | - //$this->tabs = array( |
|
46 | - // 'entity:+tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
47 | - //); // to add new tab |
|
48 | - //$this->tabs = array( |
|
49 | - // 'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
50 | - //); // to remove a tab |
|
51 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); |
|
43 | + // Show more tabs from modules |
|
44 | + // Entries must be declared in modules descriptor with line |
|
45 | + //$this->tabs = array( |
|
46 | + // 'entity:+tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
47 | + //); // to add new tab |
|
48 | + //$this->tabs = array( |
|
49 | + // 'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
50 | + //); // to remove a tab |
|
51 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); |
|
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; |
|
54 | - $head[$h][1] = $langs->trans("ExtraFields"); |
|
55 | - $head[$h][2] = 'attributes'; |
|
56 | - $h++; |
|
53 | + $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; |
|
54 | + $head[$h][1] = $langs->trans("ExtraFields"); |
|
55 | + $head[$h][2] = 'attributes'; |
|
56 | + $h++; |
|
57 | 57 | |
58 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php'; |
|
59 | - $head[$h][1] = $langs->trans("ExtraFieldsAssetsType"); |
|
60 | - $head[$h][2] = 'attributes_type'; |
|
61 | - $h++; |
|
58 | + $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php'; |
|
59 | + $head[$h][1] = $langs->trans("ExtraFieldsAssetsType"); |
|
60 | + $head[$h][2] = 'attributes_type'; |
|
61 | + $h++; |
|
62 | 62 | |
63 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove'); |
|
63 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove'); |
|
64 | 64 | |
65 | - return $head; |
|
65 | + return $head; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -72,56 +72,56 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function asset_prepare_head() |
74 | 74 | { |
75 | - global $langs, $conf; |
|
76 | - |
|
77 | - $langs->load("assets"); |
|
78 | - |
|
79 | - $h = 0; |
|
80 | - $head = array(); |
|
81 | - |
|
82 | - $head[$h][0] = DOL_URL_ROOT . '/asset/card.php'; |
|
83 | - $head[$h][1] = $langs->trans("Card"); |
|
84 | - $head[$h][2] = 'card'; |
|
85 | - $h++; |
|
86 | - |
|
87 | - // Show more tabs from modules |
|
88 | - // Entries must be declared in modules descriptor with line |
|
89 | - //$this->tabs = array( |
|
90 | - // 'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
91 | - //); // to add new tab |
|
92 | - //$this->tabs = array( |
|
93 | - // 'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
94 | - //); // to remove a tab |
|
95 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets'); |
|
96 | - |
|
97 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
98 | - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
99 | - $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
102 | - $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
|
103 | - $head[$h][1] = $langs->trans('Documents'); |
|
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | - $head[$h][2] = 'documents'; |
|
106 | - $h++; |
|
107 | - |
|
108 | - $nbNote = 0; |
|
109 | - if(!empty($object->note_private)) $nbNote++; |
|
110 | - if(!empty($object->note_public)) $nbNote++; |
|
111 | - $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
|
112 | - $head[$h][1] = $langs->trans("Notes"); |
|
113 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | - $head[$h][2] = 'note'; |
|
115 | - $h++; |
|
116 | - |
|
117 | - $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id; |
|
118 | - $head[$h][1] = $langs->trans("Info"); |
|
119 | - $head[$h][2] = 'info'; |
|
120 | - $h++; |
|
121 | - |
|
122 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'asset', 'remove'); |
|
123 | - |
|
124 | - return $head; |
|
75 | + global $langs, $conf; |
|
76 | + |
|
77 | + $langs->load("assets"); |
|
78 | + |
|
79 | + $h = 0; |
|
80 | + $head = array(); |
|
81 | + |
|
82 | + $head[$h][0] = DOL_URL_ROOT . '/asset/card.php'; |
|
83 | + $head[$h][1] = $langs->trans("Card"); |
|
84 | + $head[$h][2] = 'card'; |
|
85 | + $h++; |
|
86 | + |
|
87 | + // Show more tabs from modules |
|
88 | + // Entries must be declared in modules descriptor with line |
|
89 | + //$this->tabs = array( |
|
90 | + // 'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
91 | + //); // to add new tab |
|
92 | + //$this->tabs = array( |
|
93 | + // 'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
94 | + //); // to remove a tab |
|
95 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets'); |
|
96 | + |
|
97 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
98 | + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
99 | + $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks=Link::count($db, $object->element, $object->id); |
|
102 | + $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
|
103 | + $head[$h][1] = $langs->trans('Documents'); |
|
104 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | + $head[$h][2] = 'documents'; |
|
106 | + $h++; |
|
107 | + |
|
108 | + $nbNote = 0; |
|
109 | + if(!empty($object->note_private)) $nbNote++; |
|
110 | + if(!empty($object->note_public)) $nbNote++; |
|
111 | + $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
|
112 | + $head[$h][1] = $langs->trans("Notes"); |
|
113 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | + $head[$h][2] = 'note'; |
|
115 | + $h++; |
|
116 | + |
|
117 | + $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id; |
|
118 | + $head[$h][1] = $langs->trans("Info"); |
|
119 | + $head[$h][2] = 'info'; |
|
120 | + $h++; |
|
121 | + |
|
122 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'asset', 'remove'); |
|
123 | + |
|
124 | + return $head; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -132,23 +132,23 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function asset_type_prepare_head(AssetType $object) |
134 | 134 | { |
135 | - global $langs, $conf, $user; |
|
135 | + global $langs, $conf, $user; |
|
136 | 136 | |
137 | - $h=0; |
|
138 | - $head = array(); |
|
137 | + $h=0; |
|
138 | + $head = array(); |
|
139 | 139 | |
140 | - $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id; |
|
141 | - $head[$h][1] = $langs->trans("Card"); |
|
142 | - $head[$h][2] = 'card'; |
|
143 | - $h++; |
|
140 | + $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id; |
|
141 | + $head[$h][1] = $langs->trans("Card"); |
|
142 | + $head[$h][2] = 'card'; |
|
143 | + $h++; |
|
144 | 144 | |
145 | - // Show more tabs from modules |
|
146 | - // Entries must be declared in modules descriptor with line |
|
147 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
148 | - // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
149 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype'); |
|
145 | + // Show more tabs from modules |
|
146 | + // Entries must be declared in modules descriptor with line |
|
147 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
148 | + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
149 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype'); |
|
150 | 150 | |
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove'); |
|
151 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove'); |
|
152 | 152 | |
153 | - return $head; |
|
153 | + return $head; |
|
154 | 154 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $h = 0; |
36 | 36 | $head = array(); |
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php'; |
|
38 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/setup.php'; |
|
39 | 39 | $head[$h][1] = $langs->trans("Settings"); |
40 | 40 | $head[$h][2] = 'settings'; |
41 | 41 | $h++; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | //); // to remove a tab |
51 | 51 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); |
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; |
|
53 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_extrafields.php'; |
|
54 | 54 | $head[$h][1] = $langs->trans("ExtraFields"); |
55 | 55 | $head[$h][2] = 'attributes'; |
56 | 56 | $h++; |
57 | 57 | |
58 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php'; |
|
58 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_type_extrafields.php'; |
|
59 | 59 | $head[$h][1] = $langs->trans("ExtraFieldsAssetsType"); |
60 | 60 | $head[$h][2] = 'attributes_type'; |
61 | 61 | $h++; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $h = 0; |
80 | 80 | $head = array(); |
81 | 81 | |
82 | - $head[$h][0] = DOL_URL_ROOT . '/asset/card.php'; |
|
82 | + $head[$h][0] = DOL_URL_ROOT.'/asset/card.php'; |
|
83 | 83 | $head[$h][1] = $langs->trans("Card"); |
84 | 84 | $head[$h][2] = 'card'; |
85 | 85 | $h++; |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | |
97 | 97 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
99 | + $upload_dir = $conf->assets->dir_output.'/'.get_exdir($filename, 2, 0, 1, $object, 'assets').'/'.dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
105 | 105 | $head[$h][2] = 'documents'; |
106 | 106 | $h++; |
107 | 107 | |
108 | 108 | $nbNote = 0; |
109 | - if(!empty($object->note_private)) $nbNote++; |
|
110 | - if(!empty($object->note_public)) $nbNote++; |
|
109 | + if (!empty($object->note_private)) $nbNote++; |
|
110 | + if (!empty($object->note_public)) $nbNote++; |
|
111 | 111 | $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
112 | 112 | $head[$h][1] = $langs->trans("Notes"); |
113 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
113 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | 114 | $head[$h][2] = 'note'; |
115 | 115 | $h++; |
116 | 116 | |
117 | - $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id; |
|
117 | + $head[$h][0] = DOL_URL_ROOT.'/asset/info.php?id='.$object->id; |
|
118 | 118 | $head[$h][1] = $langs->trans("Info"); |
119 | 119 | $head[$h][2] = 'info'; |
120 | 120 | $h++; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | global $langs, $conf, $user; |
136 | 136 | |
137 | - $h=0; |
|
137 | + $h = 0; |
|
138 | 138 | $head = array(); |
139 | 139 | |
140 | 140 | $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | // Entries must be declared in modules descriptor with line |
147 | 147 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
148 | 148 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
149 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype'); |
|
149 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype'); |
|
150 | 150 | |
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove'); |
|
151 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype', 'remove'); |
|
152 | 152 | |
153 | 153 | return $head; |
154 | 154 | } |
@@ -101,16 +101,24 @@ |
||
101 | 101 | $nbLinks=Link::count($db, $object->element, $object->id); |
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles+$nbLinks) > 0) { |
|
105 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
106 | + } |
|
105 | 107 | $head[$h][2] = 'documents'; |
106 | 108 | $h++; |
107 | 109 | |
108 | 110 | $nbNote = 0; |
109 | - if(!empty($object->note_private)) $nbNote++; |
|
110 | - if(!empty($object->note_public)) $nbNote++; |
|
111 | + if(!empty($object->note_private)) { |
|
112 | + $nbNote++; |
|
113 | + } |
|
114 | + if(!empty($object->note_public)) { |
|
115 | + $nbNote++; |
|
116 | + } |
|
111 | 117 | $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
112 | 118 | $head[$h][1] = $langs->trans("Notes"); |
113 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
119 | + if ($nbNote > 0) { |
|
120 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
121 | + } |
|
114 | 122 | $head[$h][2] = 'note'; |
115 | 123 | $h++; |
116 | 124 |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | $tab = 0; |
37 | 37 | $head = array(); |
38 | 38 | |
39 | - $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id; |
|
40 | - $head[$tab][1] = $langs->trans('Card'); |
|
41 | - $head[$tab][2] = 'card'; |
|
42 | - $tab++; |
|
39 | + $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id; |
|
40 | + $head[$tab][1] = $langs->trans('Card'); |
|
41 | + $head[$tab][2] = 'card'; |
|
42 | + $tab++; |
|
43 | 43 | |
44 | 44 | // Show more tabs from modules |
45 | 45 | // Entries must be declared in modules descriptor with line |
@@ -47,16 +47,16 @@ discard block |
||
47 | 47 | // $this->tabs = array('entity:-tabname); to remove a tab |
48 | 48 | complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat'); |
49 | 49 | |
50 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
50 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
51 | 51 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
52 | - $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
53 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
52 | + $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
53 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
54 | 54 | $nbLinks=Link::count($db, $object->element, $object->id); |
55 | - $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
|
56 | - $head[$tab][1] = $langs->trans("Documents"); |
|
57 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
58 | - $head[$tab][2] = 'documents'; |
|
59 | - $tab++; |
|
55 | + $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
|
56 | + $head[$tab][1] = $langs->trans("Documents"); |
|
57 | + if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
58 | + $head[$tab][2] = 'documents'; |
|
59 | + $tab++; |
|
60 | 60 | |
61 | 61 | $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id; |
62 | 62 | $head[$tab][1] = $langs->trans("Info"); |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | // Entries must be declared in modules descriptor with line |
46 | 46 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
47 | 47 | // $this->tabs = array('entity:-tabname); to remove a tab |
48 | - complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat'); |
|
48 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat'); |
|
49 | 49 | |
50 | 50 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
51 | 51 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
52 | - $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
53 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
54 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
52 | + $upload_dir = $conf->tax->dir_output."/".dol_sanitizeFileName($object->ref); |
|
53 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
54 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
55 | 55 | $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
56 | 56 | $head[$tab][1] = $langs->trans("Documents"); |
57 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
57 | + if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
58 | 58 | $head[$tab][2] = 'documents'; |
59 | 59 | $tab++; |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $head[$tab][2] = 'info'; |
64 | 64 | $tab++; |
65 | 65 | |
66 | - complete_head_from_modules($conf,$langs,$object,$head,$tab,'vat','remove'); |
|
66 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat', 'remove'); |
|
67 | 67 | |
68 | 68 | return $head; |
69 | 69 | } |
@@ -54,7 +54,9 @@ |
||
54 | 54 | $nbLinks=Link::count($db, $object->element, $object->id); |
55 | 55 | $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
56 | 56 | $head[$tab][1] = $langs->trans("Documents"); |
57 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
57 | + if (($nbFiles+$nbLinks) > 0) { |
|
58 | + $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
59 | + } |
|
58 | 60 | $head[$tab][2] = 'documents'; |
59 | 61 | $tab++; |
60 | 62 |