@@ -30,66 +30,66 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function ldap_prepare_head() |
32 | 32 | { |
33 | - global $langs, $conf, $user; |
|
34 | - |
|
35 | - $langs->load("ldap"); |
|
36 | - |
|
37 | - // Onglets |
|
38 | - $head=array(); |
|
39 | - $h = 0; |
|
40 | - |
|
41 | - $head[$h][0] = DOL_URL_ROOT."/admin/ldap.php"; |
|
42 | - $head[$h][1] = $langs->trans("LDAPGlobalParameters"); |
|
43 | - $head[$h][2] = 'ldap'; |
|
44 | - $h++; |
|
45 | - |
|
46 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
47 | - { |
|
48 | - $head[$h][0] = DOL_URL_ROOT."/admin/ldap_users.php"; |
|
49 | - $head[$h][1] = $langs->trans("LDAPUsersSynchro"); |
|
50 | - $head[$h][2] = 'users'; |
|
51 | - $h++; |
|
52 | - } |
|
53 | - |
|
54 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
55 | - { |
|
56 | - $head[$h][0] = DOL_URL_ROOT."/admin/ldap_groups.php"; |
|
57 | - $head[$h][1] = $langs->trans("LDAPGroupsSynchro"); |
|
58 | - $head[$h][2] = 'groups'; |
|
59 | - $h++; |
|
60 | - } |
|
61 | - |
|
62 | - if (! empty($conf->societe->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
63 | - { |
|
64 | - $head[$h][0] = DOL_URL_ROOT."/admin/ldap_contacts.php"; |
|
65 | - $head[$h][1] = $langs->trans("LDAPContactsSynchro"); |
|
66 | - $head[$h][2] = 'contacts'; |
|
67 | - $h++; |
|
68 | - } |
|
69 | - |
|
70 | - if (! empty($conf->adherent->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE)) |
|
71 | - { |
|
72 | - $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members.php"; |
|
73 | - $head[$h][1] = $langs->trans("LDAPMembersSynchro"); |
|
74 | - $head[$h][2] = 'members'; |
|
75 | - $h++; |
|
76 | - } |
|
77 | - |
|
78 | - if (! empty($conf->adherent->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) |
|
79 | - { |
|
80 | - $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members_types.php"; |
|
81 | - $head[$h][1] = $langs->trans("LDAPMembersTypesSynchro"); |
|
82 | - $head[$h][2] = 'memberstypes'; |
|
83 | - $h++; |
|
84 | - } |
|
85 | - |
|
86 | - // Show more tabs from modules |
|
87 | - // Entries must be declared in modules descriptor with line |
|
88 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
89 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
90 | - complete_head_from_modules($conf,$langs,'',$head,$h,'ldap'); |
|
91 | - |
|
92 | - return $head; |
|
33 | + global $langs, $conf, $user; |
|
34 | + |
|
35 | + $langs->load("ldap"); |
|
36 | + |
|
37 | + // Onglets |
|
38 | + $head=array(); |
|
39 | + $h = 0; |
|
40 | + |
|
41 | + $head[$h][0] = DOL_URL_ROOT."/admin/ldap.php"; |
|
42 | + $head[$h][1] = $langs->trans("LDAPGlobalParameters"); |
|
43 | + $head[$h][2] = 'ldap'; |
|
44 | + $h++; |
|
45 | + |
|
46 | + if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
47 | + { |
|
48 | + $head[$h][0] = DOL_URL_ROOT."/admin/ldap_users.php"; |
|
49 | + $head[$h][1] = $langs->trans("LDAPUsersSynchro"); |
|
50 | + $head[$h][2] = 'users'; |
|
51 | + $h++; |
|
52 | + } |
|
53 | + |
|
54 | + if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) |
|
55 | + { |
|
56 | + $head[$h][0] = DOL_URL_ROOT."/admin/ldap_groups.php"; |
|
57 | + $head[$h][1] = $langs->trans("LDAPGroupsSynchro"); |
|
58 | + $head[$h][2] = 'groups'; |
|
59 | + $h++; |
|
60 | + } |
|
61 | + |
|
62 | + if (! empty($conf->societe->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
63 | + { |
|
64 | + $head[$h][0] = DOL_URL_ROOT."/admin/ldap_contacts.php"; |
|
65 | + $head[$h][1] = $langs->trans("LDAPContactsSynchro"); |
|
66 | + $head[$h][2] = 'contacts'; |
|
67 | + $h++; |
|
68 | + } |
|
69 | + |
|
70 | + if (! empty($conf->adherent->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE)) |
|
71 | + { |
|
72 | + $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members.php"; |
|
73 | + $head[$h][1] = $langs->trans("LDAPMembersSynchro"); |
|
74 | + $head[$h][2] = 'members'; |
|
75 | + $h++; |
|
76 | + } |
|
77 | + |
|
78 | + if (! empty($conf->adherent->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) |
|
79 | + { |
|
80 | + $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members_types.php"; |
|
81 | + $head[$h][1] = $langs->trans("LDAPMembersTypesSynchro"); |
|
82 | + $head[$h][2] = 'memberstypes'; |
|
83 | + $h++; |
|
84 | + } |
|
85 | + |
|
86 | + // Show more tabs from modules |
|
87 | + // Entries must be declared in modules descriptor with line |
|
88 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
89 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
90 | + complete_head_from_modules($conf,$langs,'',$head,$h,'ldap'); |
|
91 | + |
|
92 | + return $head; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -105,28 +105,28 @@ discard block |
||
105 | 105 | */ |
106 | 106 | function show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass) |
107 | 107 | { |
108 | - global $langs, $conf, $user; |
|
109 | - //print 'key='.$key.' dn='.$dn.' objectclass='.$objectclass; |
|
110 | - |
|
111 | - print '<br>'; |
|
112 | - if (! function_exists("ldap_connect")) |
|
113 | - { |
|
114 | - print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans('LDAPFunctionsNotAvailableOnPHP').'">'.$butlabel.'</a>'; |
|
115 | - } |
|
116 | - else if (empty($conf->global->LDAP_SERVER_HOST)) |
|
117 | - { |
|
118 | - print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans('LDAPSetupNotComplete').'">'.$butlabel.'</a>'; |
|
119 | - } |
|
120 | - else if (empty($key) || empty($dn) || empty($objectclass)) |
|
121 | - { |
|
122 | - $langs->load("errors"); |
|
123 | - print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans('ErrorLDAPSetupNotComplete').'">'.$butlabel.'</a>'; |
|
124 | - } |
|
125 | - else |
|
126 | - { |
|
127 | - print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action='.$testlabel.'">'.$butlabel.'</a>'; |
|
128 | - } |
|
129 | - print '<br><br>'; |
|
108 | + global $langs, $conf, $user; |
|
109 | + //print 'key='.$key.' dn='.$dn.' objectclass='.$objectclass; |
|
110 | + |
|
111 | + print '<br>'; |
|
112 | + if (! function_exists("ldap_connect")) |
|
113 | + { |
|
114 | + print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans('LDAPFunctionsNotAvailableOnPHP').'">'.$butlabel.'</a>'; |
|
115 | + } |
|
116 | + else if (empty($conf->global->LDAP_SERVER_HOST)) |
|
117 | + { |
|
118 | + print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans('LDAPSetupNotComplete').'">'.$butlabel.'</a>'; |
|
119 | + } |
|
120 | + else if (empty($key) || empty($dn) || empty($objectclass)) |
|
121 | + { |
|
122 | + $langs->load("errors"); |
|
123 | + print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans('ErrorLDAPSetupNotComplete').'">'.$butlabel.'</a>'; |
|
124 | + } |
|
125 | + else |
|
126 | + { |
|
127 | + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action='.$testlabel.'">'.$butlabel.'</a>'; |
|
128 | + } |
|
129 | + print '<br><br>'; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -143,45 +143,45 @@ discard block |
||
143 | 143 | */ |
144 | 144 | function show_ldap_content($result,$level,$count,$var,$hide=0,$subcount=0) |
145 | 145 | { |
146 | - global $bc, $conf; |
|
147 | - |
|
148 | - $count--; |
|
149 | - if ($count == 0) return -1; // To stop loop |
|
150 | - if (! is_array($result)) return -1; |
|
151 | - |
|
152 | - foreach($result as $key => $val) |
|
153 | - { |
|
154 | - if ("$key" == "objectclass") continue; |
|
155 | - if ("$key" == "count") continue; |
|
156 | - if ("$key" == "dn") continue; |
|
157 | - if ("$val" == "objectclass") continue; |
|
158 | - |
|
159 | - $lastkey[$level]=$key; |
|
160 | - |
|
161 | - if (is_array($val)) |
|
162 | - { |
|
163 | - $hide=0; |
|
164 | - if (! is_numeric($key)) |
|
165 | - { |
|
166 | - |
|
167 | - print '<tr '.$bc[$var].' valign="top">'; |
|
168 | - print '<td>'; |
|
169 | - print $key; |
|
170 | - print '</td><td>'; |
|
171 | - if (strtolower($key) == 'userpassword') $hide=1; |
|
172 | - } |
|
173 | - show_ldap_content($val,$level+1,$count,$var,$hide,$val["count"]); |
|
174 | - } |
|
175 | - else if ($subcount) |
|
176 | - { |
|
177 | - $subcount--; |
|
178 | - $newstring=dol_htmlentitiesbr($val); |
|
179 | - if ($hide) print preg_replace('/./i','*',$newstring); |
|
180 | - else print $newstring; |
|
181 | - print '<br>'; |
|
182 | - } |
|
183 | - if ("$val" != $lastkey[$level] && !$subcount) print '</td></tr>'; |
|
184 | - } |
|
185 | - return 1; |
|
146 | + global $bc, $conf; |
|
147 | + |
|
148 | + $count--; |
|
149 | + if ($count == 0) return -1; // To stop loop |
|
150 | + if (! is_array($result)) return -1; |
|
151 | + |
|
152 | + foreach($result as $key => $val) |
|
153 | + { |
|
154 | + if ("$key" == "objectclass") continue; |
|
155 | + if ("$key" == "count") continue; |
|
156 | + if ("$key" == "dn") continue; |
|
157 | + if ("$val" == "objectclass") continue; |
|
158 | + |
|
159 | + $lastkey[$level]=$key; |
|
160 | + |
|
161 | + if (is_array($val)) |
|
162 | + { |
|
163 | + $hide=0; |
|
164 | + if (! is_numeric($key)) |
|
165 | + { |
|
166 | + |
|
167 | + print '<tr '.$bc[$var].' valign="top">'; |
|
168 | + print '<td>'; |
|
169 | + print $key; |
|
170 | + print '</td><td>'; |
|
171 | + if (strtolower($key) == 'userpassword') $hide=1; |
|
172 | + } |
|
173 | + show_ldap_content($val,$level+1,$count,$var,$hide,$val["count"]); |
|
174 | + } |
|
175 | + else if ($subcount) |
|
176 | + { |
|
177 | + $subcount--; |
|
178 | + $newstring=dol_htmlentitiesbr($val); |
|
179 | + if ($hide) print preg_replace('/./i','*',$newstring); |
|
180 | + else print $newstring; |
|
181 | + print '<br>'; |
|
182 | + } |
|
183 | + if ("$val" != $lastkey[$level] && !$subcount) print '</td></tr>'; |
|
184 | + } |
|
185 | + return 1; |
|
186 | 186 | } |
187 | 187 |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $selected='EUA4'; |
128 | 128 | if (!$outputlangs) { |
129 | - $outputlangs=$langs; |
|
129 | + $outputlangs=$langs; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | if ($outputlangs->defaultlang == 'ca_CA') $selected='CAP4'; // Canada |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | else print ': '; |
231 | 231 | if (is_object($object->user_creation)) |
232 | 232 | { |
233 | - if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0); |
|
234 | - else print $langs->trans("Unknown"); |
|
233 | + if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0); |
|
234 | + else print $langs->trans("Unknown"); |
|
235 | 235 | } |
236 | 236 | else |
237 | 237 | { |
238 | 238 | $userstatic=new User($db); |
239 | 239 | $userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation); |
240 | 240 | if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
241 | - else print $langs->trans("Unknown"); |
|
241 | + else print $langs->trans("Unknown"); |
|
242 | 242 | } |
243 | 243 | if ($usetable) print '</td></tr>'; |
244 | 244 | else print '<br>'; |
@@ -266,15 +266,15 @@ discard block |
||
266 | 266 | else print ': '; |
267 | 267 | if (is_object($object->user_modification)) |
268 | 268 | { |
269 | - if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0); |
|
270 | - else print $langs->trans("Unknown"); |
|
269 | + if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0); |
|
270 | + else print $langs->trans("Unknown"); |
|
271 | 271 | } |
272 | 272 | else |
273 | 273 | { |
274 | 274 | $userstatic=new User($db); |
275 | 275 | $userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification); |
276 | 276 | if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
277 | - else print $langs->trans("Unknown"); |
|
277 | + else print $langs->trans("Unknown"); |
|
278 | 278 | } |
279 | 279 | if ($usetable) print '</td></tr>'; |
280 | 280 | else print '<br>'; |
@@ -303,14 +303,14 @@ discard block |
||
303 | 303 | if (is_object($object->user_validation)) |
304 | 304 | { |
305 | 305 | if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0); |
306 | - else print $langs->trans("Unknown"); |
|
306 | + else print $langs->trans("Unknown"); |
|
307 | 307 | } |
308 | 308 | else |
309 | 309 | { |
310 | 310 | $userstatic=new User($db); |
311 | 311 | $userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation); |
312 | - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
313 | - else print $langs->trans("Unknown"); |
|
312 | + if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
313 | + else print $langs->trans("Unknown"); |
|
314 | 314 | } |
315 | 315 | if ($usetable) print '</td></tr>'; |
316 | 316 | else print '<br>'; |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | if (is_object($object->user_approve)) |
340 | 340 | { |
341 | 341 | if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0); |
342 | - else print $langs->trans("Unknown"); |
|
342 | + else print $langs->trans("Unknown"); |
|
343 | 343 | } |
344 | 344 | else |
345 | 345 | { |
346 | 346 | $userstatic=new User($db); |
347 | 347 | $userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve); |
348 | - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
349 | - else print $langs->trans("Unknown"); |
|
348 | + if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
349 | + else print $langs->trans("Unknown"); |
|
350 | 350 | } |
351 | 351 | if ($usetable) print '</td></tr>'; |
352 | 352 | else print '<br>'; |
@@ -402,15 +402,15 @@ discard block |
||
402 | 402 | else print ': '; |
403 | 403 | if (is_object($object->user_cloture)) |
404 | 404 | { |
405 | - if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1, '', 0, 0, 0); |
|
406 | - else print $langs->trans("Unknown"); |
|
405 | + if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1, '', 0, 0, 0); |
|
406 | + else print $langs->trans("Unknown"); |
|
407 | 407 | } |
408 | 408 | else |
409 | 409 | { |
410 | 410 | $userstatic=new User($db); |
411 | 411 | $userstatic->fetch($object->user_cloture); |
412 | - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
413 | - else print $langs->trans("Unknown"); |
|
412 | + if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
413 | + else print $langs->trans("Unknown"); |
|
414 | 414 | } |
415 | 415 | if ($usetable) print '</td></tr>'; |
416 | 416 | else print '<br>'; |
@@ -438,15 +438,15 @@ discard block |
||
438 | 438 | else print ': '; |
439 | 439 | if (is_object($object->user_rappro)) |
440 | 440 | { |
441 | - if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0); |
|
442 | - else print $langs->trans("Unknown"); |
|
441 | + if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0); |
|
442 | + else print $langs->trans("Unknown"); |
|
443 | 443 | } |
444 | 444 | else |
445 | 445 | { |
446 | 446 | $userstatic=new User($db); |
447 | 447 | $userstatic->fetch($object->user_rappro); |
448 | - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
449 | - else print $langs->trans("Unknown"); |
|
448 | + if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); |
|
449 | + else print $langs->trans("Unknown"); |
|
450 | 450 | } |
451 | 451 | if ($usetable) print '</td></tr>'; |
452 | 452 | else print '<br>'; |
@@ -492,8 +492,8 @@ discard block |
||
492 | 492 | */ |
493 | 493 | function dolAddEmailTrackId($email, $trackingid) |
494 | 494 | { |
495 | - $tmp=explode('@',$email); |
|
496 | - return $tmp[0].'+'.$trackingid.'@'.(isset($tmp[1])?$tmp[1]:''); |
|
495 | + $tmp=explode('@',$email); |
|
496 | + return $tmp[0].'+'.$trackingid.'@'.(isset($tmp[1])?$tmp[1]:''); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
@@ -619,33 +619,33 @@ discard block |
||
619 | 619 | */ |
620 | 620 | function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true) |
621 | 621 | { |
622 | - if(!isValidEmail($mail))return ''; |
|
623 | - $tab = explode('@', $mail); |
|
624 | - $tab2 = explode('.',$tab[1]); |
|
625 | - $string_replace = ''; |
|
626 | - $mail_name = $tab[0]; |
|
627 | - $mail_domaine = $tab2[0]; |
|
628 | - $mail_tld = ''; |
|
629 | - |
|
630 | - $nbofelem = count($tab2); |
|
631 | - for($i=1; $i < $nbofelem && $displaytld; $i++) |
|
632 | - { |
|
633 | - $mail_tld .= '.'.$tab2[$i]; |
|
634 | - } |
|
635 | - |
|
636 | - for($i=0; $i < $nbreplace; $i++){ |
|
637 | - $string_replace .= $replace; |
|
638 | - } |
|
639 | - |
|
640 | - if(strlen($mail_name) > $nbdisplaymail){ |
|
641 | - $mail_name = substr($mail_name, 0, $nbdisplaymail); |
|
642 | - } |
|
643 | - |
|
644 | - if(strlen($mail_domaine) > $nbdisplaydomain){ |
|
645 | - $mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain); |
|
646 | - } |
|
647 | - |
|
648 | - return $mail_name . $string_replace . $mail_domaine . $mail_tld; |
|
622 | + if(!isValidEmail($mail))return ''; |
|
623 | + $tab = explode('@', $mail); |
|
624 | + $tab2 = explode('.',$tab[1]); |
|
625 | + $string_replace = ''; |
|
626 | + $mail_name = $tab[0]; |
|
627 | + $mail_domaine = $tab2[0]; |
|
628 | + $mail_tld = ''; |
|
629 | + |
|
630 | + $nbofelem = count($tab2); |
|
631 | + for($i=1; $i < $nbofelem && $displaytld; $i++) |
|
632 | + { |
|
633 | + $mail_tld .= '.'.$tab2[$i]; |
|
634 | + } |
|
635 | + |
|
636 | + for($i=0; $i < $nbreplace; $i++){ |
|
637 | + $string_replace .= $replace; |
|
638 | + } |
|
639 | + |
|
640 | + if(strlen($mail_name) > $nbdisplaymail){ |
|
641 | + $mail_name = substr($mail_name, 0, $nbdisplaymail); |
|
642 | + } |
|
643 | + |
|
644 | + if(strlen($mail_domaine) > $nbdisplaydomain){ |
|
645 | + $mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain); |
|
646 | + } |
|
647 | + |
|
648 | + return $mail_name . $string_replace . $mail_domaine . $mail_tld; |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | |
@@ -783,24 +783,24 @@ discard block |
||
783 | 783 | } |
784 | 784 | else |
785 | 785 | { |
786 | - $masktype=''; |
|
787 | - $masktype_value=''; |
|
786 | + $masktype=''; |
|
787 | + $masktype_value=''; |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | // Extract value for user |
791 | 791 | if (preg_match('/\{(u+)\}/i',$mask,$regType)) |
792 | 792 | { |
793 | - $lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; |
|
794 | - if (is_object($objuser)) $lastname = $objuser->lastname; |
|
793 | + $lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; |
|
794 | + if (is_object($objuser)) $lastname = $objuser->lastname; |
|
795 | 795 | |
796 | - $maskuser=$regType[1]; |
|
797 | - $maskuser_value=substr($lastname,0,dol_strlen($regType[1]));// get n first characters of user firstname (where n is length in mask) |
|
798 | - $maskuser_value=str_pad($maskuser_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask |
|
796 | + $maskuser=$regType[1]; |
|
797 | + $maskuser_value=substr($lastname,0,dol_strlen($regType[1]));// get n first characters of user firstname (where n is length in mask) |
|
798 | + $maskuser_value=str_pad($maskuser_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask |
|
799 | 799 | } |
800 | 800 | else |
801 | 801 | { |
802 | - $maskuser=''; |
|
803 | - $maskuser_value=''; |
|
802 | + $maskuser=''; |
|
803 | + $maskuser_value=''; |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | // Personalized field {XXX-1} à {XXX-9} |
@@ -816,12 +816,12 @@ discard block |
||
816 | 816 | |
817 | 817 | if (strstr($mask,'user_extra_')) |
818 | 818 | { |
819 | - $start = "{user_extra_"; |
|
820 | - $end = "\}"; |
|
821 | - $extra= get_string_between($mask, "user_extra_", "}"); |
|
822 | - if(!empty($user->array_options['options_'.$extra])){ |
|
823 | - $mask = preg_replace('#('.$start.')(.*?)('.$end.')#si', $user->array_options['options_'.$extra], $mask); |
|
824 | - } |
|
819 | + $start = "{user_extra_"; |
|
820 | + $end = "\}"; |
|
821 | + $extra= get_string_between($mask, "user_extra_", "}"); |
|
822 | + if(!empty($user->array_options['options_'.$extra])){ |
|
823 | + $mask = preg_replace('#('.$start.')(.*?)('.$end.')#si', $user->array_options['options_'.$extra], $mask); |
|
824 | + } |
|
825 | 825 | } |
826 | 826 | $maskwithonlyymcode=$mask; |
827 | 827 | $maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$maskcounter,$maskwithonlyymcode); |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | else // if reset is for a specific month in year, we need year |
883 | 883 | { |
884 | 884 | if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; } |
885 | - else if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } |
|
885 | + else if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; } |
|
886 | 886 | else if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } |
887 | 887 | else return 'ErrorCantUseRazIfNoYearInMask'; |
888 | 888 | } |
@@ -890,11 +890,11 @@ discard block |
||
890 | 890 | $yearlen = $posy?dol_strlen($reg[$posy]):0; |
891 | 891 | $monthlen = $posm?dol_strlen($reg[$posm]):0; |
892 | 892 | // Define pos |
893 | - $yearpos = (dol_strlen($reg[1])+1); |
|
893 | + $yearpos = (dol_strlen($reg[1])+1); |
|
894 | 894 | $monthpos = ($yearpos+$yearlen); |
895 | 895 | if ($posy == 3 && $posm == 2) { // if month is before year |
896 | - $monthpos = (dol_strlen($reg[1])+1); |
|
897 | - $yearpos = ($monthpos+$monthlen); |
|
896 | + $monthpos = (dol_strlen($reg[1])+1); |
|
897 | + $yearpos = ($monthpos+$monthlen); |
|
898 | 898 | } |
899 | 899 | //print "xxx ".$maskwithonlyymcode." maskraz=".$maskraz." posy=".$posy." yearlen=".$yearlen." yearpos=".$yearpos." posm=".$posm." monthlen=".$monthlen." monthpos=".$monthpos." yearoffsettype=".$yearoffsettype." resetEveryMonth=".$resetEveryMonth."\n"; |
900 | 900 | |
@@ -904,20 +904,20 @@ discard block |
||
904 | 904 | |
905 | 905 | if (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $yearoffsettype != '=') // $yearoffsettype is - or + |
906 | 906 | { |
907 | - $currentyear=date("Y", $date); |
|
908 | - $fiscaldate=dol_mktime('0','0','0',$maskraz,'1',$currentyear); |
|
909 | - $newyeardate=dol_mktime('0','0','0','1','1',$currentyear); |
|
910 | - $nextnewyeardate=dol_mktime('0','0','0','1','1',$currentyear+1); |
|
911 | - //echo 'currentyear='.$currentyear.' date='.dol_print_date($date, 'day').' fiscaldate='.dol_print_date($fiscaldate, 'day').'<br>'; |
|
912 | - |
|
913 | - // If after or equal of current fiscal date |
|
914 | - if ($date >= $fiscaldate) |
|
915 | - { |
|
916 | - // If before of next new year date |
|
917 | - if ($date < $nextnewyeardate && $yearoffsettype == '+') $yearoffset=1; |
|
918 | - } |
|
919 | - // If after or equal of current new year date |
|
920 | - else if ($date >= $newyeardate && $yearoffsettype == '-') $yearoffset=-1; |
|
907 | + $currentyear=date("Y", $date); |
|
908 | + $fiscaldate=dol_mktime('0','0','0',$maskraz,'1',$currentyear); |
|
909 | + $newyeardate=dol_mktime('0','0','0','1','1',$currentyear); |
|
910 | + $nextnewyeardate=dol_mktime('0','0','0','1','1',$currentyear+1); |
|
911 | + //echo 'currentyear='.$currentyear.' date='.dol_print_date($date, 'day').' fiscaldate='.dol_print_date($fiscaldate, 'day').'<br>'; |
|
912 | + |
|
913 | + // If after or equal of current fiscal date |
|
914 | + if ($date >= $fiscaldate) |
|
915 | + { |
|
916 | + // If before of next new year date |
|
917 | + if ($date < $nextnewyeardate && $yearoffsettype == '+') $yearoffset=1; |
|
918 | + } |
|
919 | + // If after or equal of current new year date |
|
920 | + else if ($date >= $newyeardate && $yearoffsettype == '-') $yearoffset=-1; |
|
921 | 921 | } |
922 | 922 | // For backward compatibility |
923 | 923 | else if (date("m",$date) < $maskraz && empty($resetEveryMonth)) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year |
@@ -938,11 +938,11 @@ discard block |
||
938 | 938 | $sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') "; |
939 | 939 | $sqlwhere.=')'; |
940 | 940 | } |
941 | - else if ($resetEveryMonth) |
|
942 | - { |
|
943 | - $sqlwhere.="(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp."'"; |
|
941 | + else if ($resetEveryMonth) |
|
942 | + { |
|
943 | + $sqlwhere.="(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp."'"; |
|
944 | 944 | $sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')"; |
945 | - } |
|
945 | + } |
|
946 | 946 | else // reset is done on january |
947 | 947 | { |
948 | 948 | $sqlwhere.='(SUBSTRING('.$field.', '.$yearpos.', '.$yearlen.") = '".$yearcomp."')"; |
@@ -953,13 +953,13 @@ discard block |
||
953 | 953 | |
954 | 954 | // Define $sqlstring |
955 | 955 | if (function_exists('mb_strrpos')) |
956 | - { |
|
957 | - $posnumstart=mb_strrpos($maskwithnocode,$maskcounter, 'UTF-8'); |
|
958 | - } |
|
959 | - else |
|
960 | - { |
|
961 | - $posnumstart=strrpos($maskwithnocode,$maskcounter); |
|
962 | - } // Pos of counter in final string (from 0 to ...) |
|
956 | + { |
|
957 | + $posnumstart=mb_strrpos($maskwithnocode,$maskcounter, 'UTF-8'); |
|
958 | + } |
|
959 | + else |
|
960 | + { |
|
961 | + $posnumstart=strrpos($maskwithnocode,$maskcounter); |
|
962 | + } // Pos of counter in final string (from 0 to ...) |
|
963 | 963 | if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence'; |
964 | 964 | $sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')'; |
965 | 965 | |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | if ($maskuser) $maskLike = str_replace(dol_string_nospecial('{'.$maskuser.'}'),$maskuser_value,$maskLike); |
979 | 979 | foreach($maskperso as $key => $val) |
980 | 980 | { |
981 | - $maskLike = str_replace(dol_string_nospecial($maskperso[$key]),$maskpersonew[$key],$maskLike); |
|
981 | + $maskLike = str_replace(dol_string_nospecial($maskperso[$key]),$maskpersonew[$key],$maskLike); |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | // Get counter in database |
@@ -986,11 +986,11 @@ discard block |
||
986 | 986 | $sql = "SELECT MAX(".$sqlstring.") as val"; |
987 | 987 | $sql.= " FROM ".MAIN_DB_PREFIX.$table; |
988 | 988 | $sql.= " WHERE ".$field." LIKE '".$maskLike."'"; |
989 | - $sql.= " AND ".$field." NOT LIKE '(PROV%)'"; |
|
989 | + $sql.= " AND ".$field." NOT LIKE '(PROV%)'"; |
|
990 | 990 | if ($bentityon) // only if entity enable |
991 | - $sql.= " AND entity IN (".getEntity($sharetable).")"; |
|
991 | + $sql.= " AND entity IN (".getEntity($sharetable).")"; |
|
992 | 992 | else if (! empty($forceentity)) |
993 | - $sql.= " AND entity IN (".$forceentity.")"; |
|
993 | + $sql.= " AND entity IN (".$forceentity.")"; |
|
994 | 994 | if ($where) $sql.=$where; |
995 | 995 | if ($sqlwhere) $sql.=' AND '.$sqlwhere; |
996 | 996 | |
@@ -1008,8 +1008,8 @@ discard block |
||
1008 | 1008 | if (empty($counter)) $counter=$maskoffset; |
1009 | 1009 | else if (preg_match('/[^0-9]/i',$counter)) |
1010 | 1010 | { |
1011 | - $counter=0; |
|
1012 | - dol_syslog("Error, the last counter found is '".$counter."' so is not a numeric value. We will restart to 1.", LOG_ERR); |
|
1011 | + $counter=0; |
|
1012 | + dol_syslog("Error, the last counter found is '".$counter."' so is not a numeric value. We will restart to 1.", LOG_ERR); |
|
1013 | 1013 | } |
1014 | 1014 | else if ($counter < $maskoffset && empty($conf->global->MAIN_NUMBERING_OFFSET_ONLY_FOR_FIRST)) $counter=$maskoffset; |
1015 | 1015 | |
@@ -1035,11 +1035,11 @@ discard block |
||
1035 | 1035 | $sql = "SELECT ".$field." as ref"; |
1036 | 1036 | $sql.= " FROM ".MAIN_DB_PREFIX.$table; |
1037 | 1037 | $sql.= " WHERE ".$field." LIKE '".$maskLike."'"; |
1038 | - $sql.= " AND ".$field." NOT LIKE '%PROV%'"; |
|
1039 | - if ($bentityon) // only if entity enable |
|
1040 | - $sql.= " AND entity IN (".getEntity($sharetable).")"; |
|
1038 | + $sql.= " AND ".$field." NOT LIKE '%PROV%'"; |
|
1039 | + if ($bentityon) // only if entity enable |
|
1040 | + $sql.= " AND entity IN (".getEntity($sharetable).")"; |
|
1041 | 1041 | else if (! empty($forceentity)) |
1042 | - $sql.= " AND entity IN (".$forceentity.")"; |
|
1042 | + $sql.= " AND entity IN (".$forceentity.")"; |
|
1043 | 1043 | if ($where) $sql.=$where; |
1044 | 1044 | if ($sqlwhere) $sql.=' AND '.$sqlwhere; |
1045 | 1045 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | // If value for $counter has a length higher than $maskcounter chars |
1062 | 1062 | if ($counter >= pow(10, dol_strlen($maskcounter))) |
1063 | 1063 | { |
1064 | - $counter='ErrorMaxNumberReachForThisMask'; |
|
1064 | + $counter='ErrorMaxNumberReachForThisMask'; |
|
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | if (! empty($maskrefclient_maskcounter)) |
@@ -1093,9 +1093,9 @@ discard block |
||
1093 | 1093 | //$sql.= " WHERE ".$field." not like '(%'"; |
1094 | 1094 | $maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'"; |
1095 | 1095 | if ($bentityon) // only if entity enable |
1096 | - $maskrefclient_sql.= " AND entity IN (".getEntity($sharetable).")"; |
|
1096 | + $maskrefclient_sql.= " AND entity IN (".getEntity($sharetable).")"; |
|
1097 | 1097 | else if (! empty($forceentity)) |
1098 | - $sql.= " AND entity IN (".$forceentity.")"; |
|
1098 | + $sql.= " AND entity IN (".$forceentity.")"; |
|
1099 | 1099 | if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask |
1100 | 1100 | if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask |
1101 | 1101 | $maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')"; |
@@ -1110,25 +1110,25 @@ discard block |
||
1110 | 1110 | else dol_print_error($db); |
1111 | 1111 | |
1112 | 1112 | if (empty($maskrefclient_counter) || preg_match('/[^0-9]/i',$maskrefclient_counter)) $maskrefclient_counter=$maskrefclient_maskoffset; |
1113 | - $maskrefclient_counter++; |
|
1113 | + $maskrefclient_counter++; |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | // Build numFinal |
1117 | 1117 | $numFinal = $mask; |
1118 | 1118 | |
1119 | 1119 | // We replace special codes except refclient |
1120 | - if (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $yearoffsettype != '=') // yearoffsettype is - or +, so we don't want current year |
|
1121 | - { |
|
1122 | - $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date)+$yearoffset, $numFinal); |
|
1123 | - $numFinal = preg_replace('/\{yy\}/i', date("y",$date)+$yearoffset, $numFinal); |
|
1124 | - $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),1,1)+$yearoffset, $numFinal); |
|
1125 | - } |
|
1126 | - else // we want yyyy to be current year |
|
1127 | - { |
|
1128 | - $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date), $numFinal); |
|
1129 | - $numFinal = preg_replace('/\{yy\}/i', date("y",$date), $numFinal); |
|
1130 | - $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),1,1), $numFinal); |
|
1131 | - } |
|
1120 | + if (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $yearoffsettype != '=') // yearoffsettype is - or +, so we don't want current year |
|
1121 | + { |
|
1122 | + $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date)+$yearoffset, $numFinal); |
|
1123 | + $numFinal = preg_replace('/\{yy\}/i', date("y",$date)+$yearoffset, $numFinal); |
|
1124 | + $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),1,1)+$yearoffset, $numFinal); |
|
1125 | + } |
|
1126 | + else // we want yyyy to be current year |
|
1127 | + { |
|
1128 | + $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date), $numFinal); |
|
1129 | + $numFinal = preg_replace('/\{yy\}/i', date("y",$date), $numFinal); |
|
1130 | + $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),1,1), $numFinal); |
|
1131 | + } |
|
1132 | 1132 | $numFinal = preg_replace('/\{mm\}/i', date("m",$date), $numFinal); |
1133 | 1133 | $numFinal = preg_replace('/\{dd\}/i', date("d",$date), $numFinal); |
1134 | 1134 | |
@@ -1158,9 +1158,9 @@ discard block |
||
1158 | 1158 | // Now we replace the user |
1159 | 1159 | if ($maskuser) |
1160 | 1160 | { |
1161 | - $maskuser_maskbefore='{'.$maskuser.'}'; |
|
1162 | - $maskuser_maskafter=$maskuser_value; |
|
1163 | - $numFinal = str_replace($maskuser_maskbefore,$maskuser_maskafter,$numFinal); |
|
1161 | + $maskuser_maskbefore='{'.$maskuser.'}'; |
|
1162 | + $maskuser_maskafter=$maskuser_value; |
|
1163 | + $numFinal = str_replace($maskuser_maskbefore,$maskuser_maskafter,$numFinal); |
|
1164 | 1164 | } |
1165 | 1165 | } |
1166 | 1166 | |
@@ -1179,11 +1179,11 @@ discard block |
||
1179 | 1179 | function get_string_between($string, $start, $end) |
1180 | 1180 | { |
1181 | 1181 | $string = " ".$string; |
1182 | - $ini = strpos($string,$start); |
|
1183 | - if ($ini == 0) return ""; |
|
1184 | - $ini += strlen($start); |
|
1185 | - $len = strpos($string,$end,$ini) - $ini; |
|
1186 | - return substr($string,$ini,$len); |
|
1182 | + $ini = strpos($string,$start); |
|
1183 | + if ($ini == 0) return ""; |
|
1184 | + $ini += strlen($start); |
|
1185 | + $len = strpos($string,$end,$ini) - $ini; |
|
1186 | + return substr($string,$ini,$len); |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | /** |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | } |
1532 | 1532 | else |
1533 | 1533 | { |
1534 | - $string = vatrate($reduction,true); |
|
1534 | + $string = vatrate($reduction,true); |
|
1535 | 1535 | } |
1536 | 1536 | |
1537 | 1537 | return $string; |
@@ -1624,7 +1624,7 @@ discard block |
||
1624 | 1624 | //irtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const)); |
1625 | 1625 | $dirtoscan= preg_replace('/[\r\n]+/',',',trim($conf->global->$const)); |
1626 | 1626 | |
1627 | - $listoffiles=array(); |
|
1627 | + $listoffiles=array(); |
|
1628 | 1628 | |
1629 | 1629 | // Now we add models found in directories scanned |
1630 | 1630 | $listofdir=explode(',',$dirtoscan); |
@@ -1635,8 +1635,8 @@ discard block |
||
1635 | 1635 | if (! $tmpdir) { unset($listofdir[$key]); continue; } |
1636 | 1636 | if (is_dir($tmpdir)) |
1637 | 1637 | { |
1638 | - // all type of template is allowed |
|
1639 | - $tmpfiles=dol_dir_list($tmpdir, 'files', 0, '', '', 'name', SORT_ASC, 0); |
|
1638 | + // all type of template is allowed |
|
1639 | + $tmpfiles=dol_dir_list($tmpdir, 'files', 0, '', '', 'name', SORT_ASC, 0); |
|
1640 | 1640 | if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); |
1641 | 1641 | } |
1642 | 1642 | } |
@@ -1692,19 +1692,19 @@ discard block |
||
1692 | 1692 | */ |
1693 | 1693 | function is_ip($ip) |
1694 | 1694 | { |
1695 | - // First we test if it is a valid IPv4 |
|
1696 | - if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { |
|
1695 | + // First we test if it is a valid IPv4 |
|
1696 | + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { |
|
1697 | 1697 | |
1698 | - // Then we test if it is a private range |
|
1699 | - if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) return 2; |
|
1698 | + // Then we test if it is a private range |
|
1699 | + if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) return 2; |
|
1700 | 1700 | |
1701 | - // Then we test if it is a reserved range |
|
1702 | - if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)) return 0; |
|
1701 | + // Then we test if it is a reserved range |
|
1702 | + if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)) return 0; |
|
1703 | 1703 | |
1704 | - return 1; |
|
1705 | - } |
|
1704 | + return 1; |
|
1705 | + } |
|
1706 | 1706 | |
1707 | - return 0; |
|
1707 | + return 0; |
|
1708 | 1708 | } |
1709 | 1709 | |
1710 | 1710 | /** |
@@ -1744,25 +1744,25 @@ discard block |
||
1744 | 1744 | if ($proxyuse) |
1745 | 1745 | { |
1746 | 1746 | $params=array('connection_timeout'=>$timeout, |
1747 | - 'response_timeout'=>$response_timeout, |
|
1748 | - 'proxy_use' => 1, |
|
1749 | - 'proxy_host' => $proxyhost, |
|
1750 | - 'proxy_port' => $proxyport, |
|
1751 | - 'proxy_login' => $proxyuser, |
|
1752 | - 'proxy_password' => $proxypass, |
|
1753 | - 'trace' => 1 |
|
1747 | + 'response_timeout'=>$response_timeout, |
|
1748 | + 'proxy_use' => 1, |
|
1749 | + 'proxy_host' => $proxyhost, |
|
1750 | + 'proxy_port' => $proxyport, |
|
1751 | + 'proxy_login' => $proxyuser, |
|
1752 | + 'proxy_password' => $proxypass, |
|
1753 | + 'trace' => 1 |
|
1754 | 1754 | ); |
1755 | 1755 | } |
1756 | 1756 | else |
1757 | 1757 | { |
1758 | 1758 | $params=array('connection_timeout'=>$timeout, |
1759 | - 'response_timeout'=>$response_timeout, |
|
1760 | - 'proxy_use' => 0, |
|
1761 | - 'proxy_host' => false, |
|
1762 | - 'proxy_port' => false, |
|
1763 | - 'proxy_login' => false, |
|
1764 | - 'proxy_password' => false, |
|
1765 | - 'trace' => 1 |
|
1759 | + 'response_timeout'=>$response_timeout, |
|
1760 | + 'proxy_use' => 0, |
|
1761 | + 'proxy_host' => false, |
|
1762 | + 'proxy_port' => false, |
|
1763 | + 'proxy_login' => false, |
|
1764 | + 'proxy_password' => false, |
|
1765 | + 'trace' => 1 |
|
1766 | 1766 | ); |
1767 | 1767 | } |
1768 | 1768 | return $params; |
@@ -1780,118 +1780,118 @@ discard block |
||
1780 | 1780 | */ |
1781 | 1781 | function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='') |
1782 | 1782 | { |
1783 | - global $db, $conf, $langs; |
|
1784 | - |
|
1785 | - $ret=''; |
|
1786 | - |
|
1787 | - // Parse element/subelement (ex: project_task) |
|
1788 | - $module = $element = $subelement = $objecttype; |
|
1789 | - if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) |
|
1790 | - { |
|
1791 | - $module = $element = $regs[1]; |
|
1792 | - $subelement = $regs[2]; |
|
1793 | - } |
|
1794 | - |
|
1795 | - $classpath = $element.'/class'; |
|
1796 | - |
|
1797 | - // To work with non standard path |
|
1798 | - if ($objecttype == 'facture' || $objecttype == 'invoice') { |
|
1799 | - $classpath = 'compta/facture/class'; |
|
1800 | - $module='facture'; |
|
1801 | - $subelement='facture'; |
|
1802 | - } |
|
1803 | - if ($objecttype == 'commande' || $objecttype == 'order') { |
|
1804 | - $classpath = 'commande/class'; |
|
1805 | - $module='commande'; |
|
1806 | - $subelement='commande'; |
|
1807 | - } |
|
1808 | - if ($objecttype == 'propal') { |
|
1809 | - $classpath = 'comm/propal/class'; |
|
1810 | - } |
|
1811 | - if ($objecttype == 'supplier_proposal') { |
|
1812 | - $classpath = 'supplier_proposal/class'; |
|
1813 | - } |
|
1814 | - if ($objecttype == 'shipping') { |
|
1815 | - $classpath = 'expedition/class'; |
|
1816 | - $subelement = 'expedition'; |
|
1817 | - $module = 'expedition_bon'; |
|
1818 | - } |
|
1819 | - if ($objecttype == 'delivery') { |
|
1820 | - $classpath = 'livraison/class'; |
|
1821 | - $subelement = 'livraison'; |
|
1822 | - $module = 'livraison_bon'; |
|
1823 | - } |
|
1824 | - if ($objecttype == 'contract') { |
|
1825 | - $classpath = 'contrat/class'; |
|
1826 | - $module='contrat'; |
|
1827 | - $subelement='contrat'; |
|
1828 | - } |
|
1829 | - if ($objecttype == 'member') { |
|
1830 | - $classpath = 'adherents/class'; |
|
1831 | - $module='adherent'; |
|
1832 | - $subelement='adherent'; |
|
1833 | - } |
|
1834 | - if ($objecttype == 'cabinetmed_cons') { |
|
1835 | - $classpath = 'cabinetmed/class'; |
|
1836 | - $module='cabinetmed'; |
|
1837 | - $subelement='cabinetmedcons'; |
|
1838 | - } |
|
1839 | - if ($objecttype == 'fichinter') { |
|
1840 | - $classpath = 'fichinter/class'; |
|
1841 | - $module='ficheinter'; |
|
1842 | - $subelement='fichinter'; |
|
1843 | - } |
|
1844 | - if ($objecttype == 'task') { |
|
1845 | - $classpath = 'projet/class'; |
|
1846 | - $module='projet'; |
|
1847 | - $subelement='task'; |
|
1848 | - } |
|
1849 | - if ($objecttype == 'stock') { |
|
1850 | - $classpath = 'product/stock/class'; |
|
1851 | - $module='stock'; |
|
1852 | - $subelement='stock'; |
|
1853 | - } |
|
1854 | - |
|
1855 | - //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement; |
|
1856 | - |
|
1857 | - $classfile = strtolower($subelement); $classname = ucfirst($subelement); |
|
1858 | - if ($objecttype == 'invoice_supplier') { |
|
1859 | - $classfile = 'fournisseur.facture'; |
|
1860 | - $classname='FactureFournisseur'; |
|
1861 | - $classpath = 'fourn/class'; |
|
1862 | - $module='fournisseur'; |
|
1863 | - } |
|
1864 | - elseif ($objecttype == 'order_supplier') { |
|
1865 | - $classfile = 'fournisseur.commande'; |
|
1866 | - $classname='CommandeFournisseur'; |
|
1867 | - $classpath = 'fourn/class'; |
|
1868 | - $module='fournisseur'; |
|
1869 | - } |
|
1870 | - elseif ($objecttype == 'stock') { |
|
1871 | - $classpath = 'product/stock/class'; |
|
1872 | - $classfile='entrepot'; |
|
1873 | - $classname='Entrepot'; |
|
1874 | - } |
|
1875 | - if (! empty($conf->$module->enabled)) |
|
1876 | - { |
|
1877 | - $res=dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); |
|
1878 | - if ($res) |
|
1879 | - { |
|
1880 | - if (class_exists($classname)) |
|
1881 | - { |
|
1882 | - $object = new $classname($db); |
|
1883 | - $res=$object->fetch($objectid); |
|
1884 | - if ($res > 0) { |
|
1885 | - $ret=$object->getNomUrl($withpicto,$option); |
|
1886 | - } elseif($res==0) { |
|
1887 | - $ret=$langs->trans('Deleted'); |
|
1888 | - } |
|
1889 | - unset($object); |
|
1890 | - } |
|
1891 | - else dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR); |
|
1892 | - } |
|
1893 | - } |
|
1894 | - return $ret; |
|
1783 | + global $db, $conf, $langs; |
|
1784 | + |
|
1785 | + $ret=''; |
|
1786 | + |
|
1787 | + // Parse element/subelement (ex: project_task) |
|
1788 | + $module = $element = $subelement = $objecttype; |
|
1789 | + if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) |
|
1790 | + { |
|
1791 | + $module = $element = $regs[1]; |
|
1792 | + $subelement = $regs[2]; |
|
1793 | + } |
|
1794 | + |
|
1795 | + $classpath = $element.'/class'; |
|
1796 | + |
|
1797 | + // To work with non standard path |
|
1798 | + if ($objecttype == 'facture' || $objecttype == 'invoice') { |
|
1799 | + $classpath = 'compta/facture/class'; |
|
1800 | + $module='facture'; |
|
1801 | + $subelement='facture'; |
|
1802 | + } |
|
1803 | + if ($objecttype == 'commande' || $objecttype == 'order') { |
|
1804 | + $classpath = 'commande/class'; |
|
1805 | + $module='commande'; |
|
1806 | + $subelement='commande'; |
|
1807 | + } |
|
1808 | + if ($objecttype == 'propal') { |
|
1809 | + $classpath = 'comm/propal/class'; |
|
1810 | + } |
|
1811 | + if ($objecttype == 'supplier_proposal') { |
|
1812 | + $classpath = 'supplier_proposal/class'; |
|
1813 | + } |
|
1814 | + if ($objecttype == 'shipping') { |
|
1815 | + $classpath = 'expedition/class'; |
|
1816 | + $subelement = 'expedition'; |
|
1817 | + $module = 'expedition_bon'; |
|
1818 | + } |
|
1819 | + if ($objecttype == 'delivery') { |
|
1820 | + $classpath = 'livraison/class'; |
|
1821 | + $subelement = 'livraison'; |
|
1822 | + $module = 'livraison_bon'; |
|
1823 | + } |
|
1824 | + if ($objecttype == 'contract') { |
|
1825 | + $classpath = 'contrat/class'; |
|
1826 | + $module='contrat'; |
|
1827 | + $subelement='contrat'; |
|
1828 | + } |
|
1829 | + if ($objecttype == 'member') { |
|
1830 | + $classpath = 'adherents/class'; |
|
1831 | + $module='adherent'; |
|
1832 | + $subelement='adherent'; |
|
1833 | + } |
|
1834 | + if ($objecttype == 'cabinetmed_cons') { |
|
1835 | + $classpath = 'cabinetmed/class'; |
|
1836 | + $module='cabinetmed'; |
|
1837 | + $subelement='cabinetmedcons'; |
|
1838 | + } |
|
1839 | + if ($objecttype == 'fichinter') { |
|
1840 | + $classpath = 'fichinter/class'; |
|
1841 | + $module='ficheinter'; |
|
1842 | + $subelement='fichinter'; |
|
1843 | + } |
|
1844 | + if ($objecttype == 'task') { |
|
1845 | + $classpath = 'projet/class'; |
|
1846 | + $module='projet'; |
|
1847 | + $subelement='task'; |
|
1848 | + } |
|
1849 | + if ($objecttype == 'stock') { |
|
1850 | + $classpath = 'product/stock/class'; |
|
1851 | + $module='stock'; |
|
1852 | + $subelement='stock'; |
|
1853 | + } |
|
1854 | + |
|
1855 | + //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement; |
|
1856 | + |
|
1857 | + $classfile = strtolower($subelement); $classname = ucfirst($subelement); |
|
1858 | + if ($objecttype == 'invoice_supplier') { |
|
1859 | + $classfile = 'fournisseur.facture'; |
|
1860 | + $classname='FactureFournisseur'; |
|
1861 | + $classpath = 'fourn/class'; |
|
1862 | + $module='fournisseur'; |
|
1863 | + } |
|
1864 | + elseif ($objecttype == 'order_supplier') { |
|
1865 | + $classfile = 'fournisseur.commande'; |
|
1866 | + $classname='CommandeFournisseur'; |
|
1867 | + $classpath = 'fourn/class'; |
|
1868 | + $module='fournisseur'; |
|
1869 | + } |
|
1870 | + elseif ($objecttype == 'stock') { |
|
1871 | + $classpath = 'product/stock/class'; |
|
1872 | + $classfile='entrepot'; |
|
1873 | + $classname='Entrepot'; |
|
1874 | + } |
|
1875 | + if (! empty($conf->$module->enabled)) |
|
1876 | + { |
|
1877 | + $res=dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); |
|
1878 | + if ($res) |
|
1879 | + { |
|
1880 | + if (class_exists($classname)) |
|
1881 | + { |
|
1882 | + $object = new $classname($db); |
|
1883 | + $res=$object->fetch($objectid); |
|
1884 | + if ($res > 0) { |
|
1885 | + $ret=$object->getNomUrl($withpicto,$option); |
|
1886 | + } elseif($res==0) { |
|
1887 | + $ret=$langs->trans('Deleted'); |
|
1888 | + } |
|
1889 | + unset($object); |
|
1890 | + } |
|
1891 | + else dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR); |
|
1892 | + } |
|
1893 | + } |
|
1894 | + return $ret; |
|
1895 | 1895 | } |
1896 | 1896 | |
1897 | 1897 | |
@@ -1905,113 +1905,113 @@ discard block |
||
1905 | 1905 | */ |
1906 | 1906 | function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) |
1907 | 1907 | { |
1908 | - $totalnb=0; |
|
1909 | - $listofid=array(); |
|
1910 | - $listofparentid=array(); |
|
1911 | - |
|
1912 | - // Get list of all id in array listofid and all parents in array listofparentid |
|
1913 | - $sql='SELECT rowid, '.$fieldfkparent.' as parent_id FROM '.MAIN_DB_PREFIX.$tabletocleantree; |
|
1914 | - $resql = $db->query($sql); |
|
1915 | - if ($resql) |
|
1916 | - { |
|
1917 | - $num = $db->num_rows($resql); |
|
1918 | - $i = 0; |
|
1919 | - while ($i < $num) |
|
1920 | - { |
|
1921 | - $obj = $db->fetch_object($resql); |
|
1922 | - $listofid[]=$obj->rowid; |
|
1923 | - if ($obj->parent_id > 0) $listofparentid[$obj->rowid]=$obj->parent_id; |
|
1924 | - $i++; |
|
1925 | - } |
|
1926 | - } |
|
1927 | - else |
|
1928 | - { |
|
1929 | - dol_print_error($db); |
|
1930 | - } |
|
1931 | - |
|
1932 | - if (count($listofid)) |
|
1933 | - { |
|
1934 | - print 'Code requested to clean tree (may be to solve data corruption), so we check/clean orphelins and loops.'."<br>\n"; |
|
1935 | - |
|
1936 | - // Check loops on each other |
|
1937 | - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree." SET ".$fieldfkparent." = 0 WHERE ".$fieldfkparent." = rowid"; // So we update only records linked to themself |
|
1938 | - $resql = $db->query($sql); |
|
1939 | - if ($resql) |
|
1940 | - { |
|
1941 | - $nb=$db->affected_rows($sql); |
|
1942 | - if ($nb > 0) |
|
1943 | - { |
|
1944 | - print '<br>Some record that were parent of themself were cleaned.'; |
|
1945 | - } |
|
1946 | - |
|
1947 | - $totalnb+=$nb; |
|
1948 | - } |
|
1949 | - //else dol_print_error($db); |
|
1950 | - |
|
1951 | - // Check other loops |
|
1952 | - $listofidtoclean=array(); |
|
1953 | - foreach($listofparentid as $id => $pid) |
|
1954 | - { |
|
1955 | - // Check depth |
|
1956 | - //print 'Analyse record id='.$id.' with parent '.$pid.'<br>'; |
|
1957 | - |
|
1958 | - $cursor=$id; $arrayidparsed=array(); // We start from child $id |
|
1959 | - while ($cursor > 0) |
|
1960 | - { |
|
1961 | - $arrayidparsed[$cursor]=1; |
|
1962 | - if ($arrayidparsed[$listofparentid[$cursor]]) // We detect a loop. A record with a parent that was already into child |
|
1963 | - { |
|
1964 | - print 'Found a loop between id '.$id.' - '.$cursor.'<br>'; |
|
1965 | - unset($arrayidparsed); |
|
1966 | - $listofidtoclean[$cursor]=$id; |
|
1967 | - break; |
|
1968 | - } |
|
1969 | - $cursor=$listofparentid[$cursor]; |
|
1970 | - } |
|
1971 | - |
|
1972 | - if (count($listofidtoclean)) break; |
|
1973 | - } |
|
1974 | - |
|
1975 | - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; |
|
1976 | - $sql.= " SET ".$fieldfkparent." = 0"; |
|
1977 | - $sql.= " WHERE rowid IN (".join(',',$listofidtoclean).")"; // So we update only records detected wrong |
|
1978 | - $resql = $db->query($sql); |
|
1979 | - if ($resql) |
|
1980 | - { |
|
1981 | - $nb=$db->affected_rows($sql); |
|
1982 | - if ($nb > 0) |
|
1983 | - { |
|
1984 | - // Removed orphelins records |
|
1985 | - print '<br>Some records were detected to have parent that is a child, we set them as root record for id: '; |
|
1986 | - print join(',',$listofidtoclean); |
|
1987 | - } |
|
1988 | - |
|
1989 | - $totalnb+=$nb; |
|
1990 | - } |
|
1991 | - //else dol_print_error($db); |
|
1992 | - |
|
1993 | - // Check and clean orphelins |
|
1994 | - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; |
|
1995 | - $sql.= " SET ".$fieldfkparent." = 0"; |
|
1996 | - $sql.= " WHERE ".$fieldfkparent." NOT IN (".join(',',$listofid).")"; // So we update only records linked to a non existing parent |
|
1997 | - $resql = $db->query($sql); |
|
1998 | - if ($resql) |
|
1999 | - { |
|
2000 | - $nb=$db->affected_rows($sql); |
|
2001 | - if ($nb > 0) |
|
2002 | - { |
|
2003 | - // Removed orphelins records |
|
2004 | - print '<br>Some orphelins were found and modified to be parent so records are visible again for id: '; |
|
2005 | - print join(',',$listofid); |
|
2006 | - } |
|
2007 | - |
|
2008 | - $totalnb+=$nb; |
|
2009 | - } |
|
2010 | - //else dol_print_error($db); |
|
2011 | - |
|
2012 | - print '<br>We fixed '.$totalnb.' record(s). Some records may still be corrupted. New check may be required.'; |
|
2013 | - return $totalnb; |
|
2014 | - } |
|
1908 | + $totalnb=0; |
|
1909 | + $listofid=array(); |
|
1910 | + $listofparentid=array(); |
|
1911 | + |
|
1912 | + // Get list of all id in array listofid and all parents in array listofparentid |
|
1913 | + $sql='SELECT rowid, '.$fieldfkparent.' as parent_id FROM '.MAIN_DB_PREFIX.$tabletocleantree; |
|
1914 | + $resql = $db->query($sql); |
|
1915 | + if ($resql) |
|
1916 | + { |
|
1917 | + $num = $db->num_rows($resql); |
|
1918 | + $i = 0; |
|
1919 | + while ($i < $num) |
|
1920 | + { |
|
1921 | + $obj = $db->fetch_object($resql); |
|
1922 | + $listofid[]=$obj->rowid; |
|
1923 | + if ($obj->parent_id > 0) $listofparentid[$obj->rowid]=$obj->parent_id; |
|
1924 | + $i++; |
|
1925 | + } |
|
1926 | + } |
|
1927 | + else |
|
1928 | + { |
|
1929 | + dol_print_error($db); |
|
1930 | + } |
|
1931 | + |
|
1932 | + if (count($listofid)) |
|
1933 | + { |
|
1934 | + print 'Code requested to clean tree (may be to solve data corruption), so we check/clean orphelins and loops.'."<br>\n"; |
|
1935 | + |
|
1936 | + // Check loops on each other |
|
1937 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree." SET ".$fieldfkparent." = 0 WHERE ".$fieldfkparent." = rowid"; // So we update only records linked to themself |
|
1938 | + $resql = $db->query($sql); |
|
1939 | + if ($resql) |
|
1940 | + { |
|
1941 | + $nb=$db->affected_rows($sql); |
|
1942 | + if ($nb > 0) |
|
1943 | + { |
|
1944 | + print '<br>Some record that were parent of themself were cleaned.'; |
|
1945 | + } |
|
1946 | + |
|
1947 | + $totalnb+=$nb; |
|
1948 | + } |
|
1949 | + //else dol_print_error($db); |
|
1950 | + |
|
1951 | + // Check other loops |
|
1952 | + $listofidtoclean=array(); |
|
1953 | + foreach($listofparentid as $id => $pid) |
|
1954 | + { |
|
1955 | + // Check depth |
|
1956 | + //print 'Analyse record id='.$id.' with parent '.$pid.'<br>'; |
|
1957 | + |
|
1958 | + $cursor=$id; $arrayidparsed=array(); // We start from child $id |
|
1959 | + while ($cursor > 0) |
|
1960 | + { |
|
1961 | + $arrayidparsed[$cursor]=1; |
|
1962 | + if ($arrayidparsed[$listofparentid[$cursor]]) // We detect a loop. A record with a parent that was already into child |
|
1963 | + { |
|
1964 | + print 'Found a loop between id '.$id.' - '.$cursor.'<br>'; |
|
1965 | + unset($arrayidparsed); |
|
1966 | + $listofidtoclean[$cursor]=$id; |
|
1967 | + break; |
|
1968 | + } |
|
1969 | + $cursor=$listofparentid[$cursor]; |
|
1970 | + } |
|
1971 | + |
|
1972 | + if (count($listofidtoclean)) break; |
|
1973 | + } |
|
1974 | + |
|
1975 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; |
|
1976 | + $sql.= " SET ".$fieldfkparent." = 0"; |
|
1977 | + $sql.= " WHERE rowid IN (".join(',',$listofidtoclean).")"; // So we update only records detected wrong |
|
1978 | + $resql = $db->query($sql); |
|
1979 | + if ($resql) |
|
1980 | + { |
|
1981 | + $nb=$db->affected_rows($sql); |
|
1982 | + if ($nb > 0) |
|
1983 | + { |
|
1984 | + // Removed orphelins records |
|
1985 | + print '<br>Some records were detected to have parent that is a child, we set them as root record for id: '; |
|
1986 | + print join(',',$listofidtoclean); |
|
1987 | + } |
|
1988 | + |
|
1989 | + $totalnb+=$nb; |
|
1990 | + } |
|
1991 | + //else dol_print_error($db); |
|
1992 | + |
|
1993 | + // Check and clean orphelins |
|
1994 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; |
|
1995 | + $sql.= " SET ".$fieldfkparent." = 0"; |
|
1996 | + $sql.= " WHERE ".$fieldfkparent." NOT IN (".join(',',$listofid).")"; // So we update only records linked to a non existing parent |
|
1997 | + $resql = $db->query($sql); |
|
1998 | + if ($resql) |
|
1999 | + { |
|
2000 | + $nb=$db->affected_rows($sql); |
|
2001 | + if ($nb > 0) |
|
2002 | + { |
|
2003 | + // Removed orphelins records |
|
2004 | + print '<br>Some orphelins were found and modified to be parent so records are visible again for id: '; |
|
2005 | + print join(',',$listofid); |
|
2006 | + } |
|
2007 | + |
|
2008 | + $totalnb+=$nb; |
|
2009 | + } |
|
2010 | + //else dol_print_error($db); |
|
2011 | + |
|
2012 | + print '<br>We fixed '.$totalnb.' record(s). Some records may still be corrupted. New check may be required.'; |
|
2013 | + return $totalnb; |
|
2014 | + } |
|
2015 | 2015 | } |
2016 | 2016 | |
2017 | 2017 | /** |
@@ -2143,21 +2143,21 @@ discard block |
||
2143 | 2143 | function fetchObjectByElement($element_id, $element_type, $element_ref='') |
2144 | 2144 | { |
2145 | 2145 | global $conf; |
2146 | - global $db,$conf; |
|
2146 | + global $db,$conf; |
|
2147 | 2147 | |
2148 | 2148 | $element_prop = getElementProperties($element_type); |
2149 | 2149 | if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled) |
2150 | 2150 | { |
2151 | 2151 | dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); |
2152 | 2152 | |
2153 | - $objecttmp = new $element_prop['classname']($db); |
|
2154 | - $ret = $objecttmp->fetch($element_id, $element_ref); |
|
2155 | - if ($ret >= 0) |
|
2156 | - { |
|
2157 | - return $objecttmp; |
|
2158 | - } |
|
2159 | - } |
|
2160 | - return 0; |
|
2153 | + $objecttmp = new $element_prop['classname']($db); |
|
2154 | + $ret = $objecttmp->fetch($element_id, $element_ref); |
|
2155 | + if ($ret >= 0) |
|
2156 | + { |
|
2157 | + return $objecttmp; |
|
2158 | + } |
|
2159 | + } |
|
2160 | + return 0; |
|
2161 | 2161 | } |
2162 | 2162 | |
2163 | 2163 | |
@@ -2172,9 +2172,9 @@ discard block |
||
2172 | 2172 | */ |
2173 | 2173 | function colorArrayToHex($arraycolor,$colorifnotfound='888888') |
2174 | 2174 | { |
2175 | - if (! is_array($arraycolor)) return $colorifnotfound; |
|
2176 | - if (empty($arraycolor)) return $colorifnotfound; |
|
2177 | - return sprintf("%02s",dechex($arraycolor[0])).sprintf("%02s",dechex($arraycolor[1])).sprintf("%02s",dechex($arraycolor[2])); |
|
2175 | + if (! is_array($arraycolor)) return $colorifnotfound; |
|
2176 | + if (empty($arraycolor)) return $colorifnotfound; |
|
2177 | + return sprintf("%02s",dechex($arraycolor[0])).sprintf("%02s",dechex($arraycolor[1])).sprintf("%02s",dechex($arraycolor[2])); |
|
2178 | 2178 | } |
2179 | 2179 | |
2180 | 2180 | /** |
@@ -2189,15 +2189,15 @@ discard block |
||
2189 | 2189 | */ |
2190 | 2190 | function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88)) |
2191 | 2191 | { |
2192 | - if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is |
|
2193 | - $tmp=preg_match('/^#?([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg); |
|
2194 | - if (! $tmp) |
|
2195 | - { |
|
2196 | - $tmp=explode(',',$stringcolor); |
|
2197 | - if (count($tmp) < 3) return $colorifnotfound; |
|
2198 | - return $tmp; |
|
2199 | - } |
|
2200 | - return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3])); |
|
2192 | + if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is |
|
2193 | + $tmp=preg_match('/^#?([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg); |
|
2194 | + if (! $tmp) |
|
2195 | + { |
|
2196 | + $tmp=explode(',',$stringcolor); |
|
2197 | + if (count($tmp) < 3) return $colorifnotfound; |
|
2198 | + return $tmp; |
|
2199 | + } |
|
2200 | + return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3])); |
|
2201 | 2201 | } |
2202 | 2202 | |
2203 | 2203 | /** |
@@ -2243,7 +2243,7 @@ discard block |
||
2243 | 2243 | if ($moduledirforclass != 'api') $moduledirforclass = preg_replace('/api$/i','',$moduledirforclass); |
2244 | 2244 | |
2245 | 2245 | if ($module == 'contracts') { |
2246 | - $moduledirforclass = 'contrat'; |
|
2246 | + $moduledirforclass = 'contrat'; |
|
2247 | 2247 | } |
2248 | 2248 | elseif (in_array($module, array('admin', 'login', 'setup', 'access', 'status', 'tools', 'documents'))) { |
2249 | 2249 | $moduledirforclass = 'api'; |
@@ -2270,7 +2270,7 @@ discard block |
||
2270 | 2270 | $moduledirforclass = 'commande'; |
2271 | 2271 | } |
2272 | 2272 | elseif ($module == 'shipments') { |
2273 | - $moduledirforclass = 'expedition'; |
|
2273 | + $moduledirforclass = 'expedition'; |
|
2274 | 2274 | } |
2275 | 2275 | elseif ($module == 'facture' || $module == 'invoice' || $module == 'invoices') { |
2276 | 2276 | $moduledirforclass = 'compta/facture'; |
@@ -2288,7 +2288,7 @@ discard block |
||
2288 | 2288 | $moduledirforclass = 'product/stock'; |
2289 | 2289 | } |
2290 | 2290 | elseif ($module == 'supplierproposals' || $module == 'supplierproposal' || $module == 'supplier_proposal') { |
2291 | - $moduledirforclass = 'supplier_proposal'; |
|
2291 | + $moduledirforclass = 'supplier_proposal'; |
|
2292 | 2292 | } |
2293 | 2293 | elseif ($module == 'fournisseur' || $module == 'supplierinvoices' || $module == 'supplierorders') { |
2294 | 2294 | $moduledirforclass = 'fourn'; |
@@ -2300,10 +2300,10 @@ discard block |
||
2300 | 2300 | $moduledirforclass = 'user'; |
2301 | 2301 | } |
2302 | 2302 | elseif ($module == 'ficheinter' || $module == 'interventions') { |
2303 | - $moduledirforclass = 'fichinter'; |
|
2303 | + $moduledirforclass = 'fichinter'; |
|
2304 | 2304 | } |
2305 | 2305 | elseif ($module == 'tickets') { |
2306 | - $moduledirforclass = 'ticket'; |
|
2306 | + $moduledirforclass = 'ticket'; |
|
2307 | 2307 | } |
2308 | 2308 | |
2309 | 2309 | return $moduledirforclass; |
@@ -29,29 +29,29 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function stock_prepare_head($object) |
31 | 31 | { |
32 | - global $langs, $conf; |
|
32 | + global $langs, $conf; |
|
33 | 33 | |
34 | - $h = 0; |
|
35 | - $head = array(); |
|
34 | + $h = 0; |
|
35 | + $head = array(); |
|
36 | 36 | |
37 | - $head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id; |
|
38 | - $head[$h][1] = $langs->trans("Card"); |
|
39 | - $head[$h][2] = 'card'; |
|
40 | - $h++; |
|
37 | + $head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id; |
|
38 | + $head[$h][1] = $langs->trans("Card"); |
|
39 | + $head[$h][2] = 'card'; |
|
40 | + $h++; |
|
41 | 41 | |
42 | - $head[$h][0] = DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id; |
|
43 | - $head[$h][1] = $langs->trans("StockMovements"); |
|
44 | - $head[$h][2] = 'movements'; |
|
45 | - $h++; |
|
42 | + $head[$h][0] = DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id; |
|
43 | + $head[$h][1] = $langs->trans("StockMovements"); |
|
44 | + $head[$h][2] = 'movements'; |
|
45 | + $h++; |
|
46 | 46 | |
47 | - /* |
|
47 | + /* |
|
48 | 48 | $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$object->id; |
49 | 49 | $head[$h][1] = $langs->trans("EnhancedValue"); |
50 | 50 | $head[$h][2] = 'value'; |
51 | 51 | $h++; |
52 | 52 | */ |
53 | 53 | |
54 | - /* Disabled because will never be implemented. Table always empty. |
|
54 | + /* Disabled because will never be implemented. Table always empty. |
|
55 | 55 | if (! empty($conf->global->STOCK_USE_WAREHOUSE_BY_USER)) |
56 | 56 | { |
57 | 57 | // Should not be enabled by defaut because does not work yet correctly because |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | complete_head_from_modules($conf,$langs,$object,$head,$h,'stock'); |
71 | 71 | |
72 | 72 | $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$object->id; |
73 | - $head[$h][1] = $langs->trans("Info"); |
|
74 | - $head[$h][2] = 'info'; |
|
75 | - $h++; |
|
73 | + $head[$h][1] = $langs->trans("Info"); |
|
74 | + $head[$h][2] = 'info'; |
|
75 | + $h++; |
|
76 | 76 | |
77 | 77 | complete_head_from_modules($conf,$langs,$object,$head,$h,'stock','remove'); |
78 | 78 |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | function salaries_prepare_head($object) |
28 | 28 | { |
29 | 29 | |
30 | - global $db, $langs, $conf; |
|
30 | + global $db, $langs, $conf; |
|
31 | 31 | |
32 | - $h = 0; |
|
33 | - $head = array(); |
|
32 | + $h = 0; |
|
33 | + $head = array(); |
|
34 | 34 | |
35 | - $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id; |
|
36 | - $head[$h][1] = $langs->trans("Card"); |
|
37 | - $head[$h][2] = 'card'; |
|
38 | - $h++; |
|
35 | + $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id; |
|
36 | + $head[$h][1] = $langs->trans("Card"); |
|
37 | + $head[$h][2] = 'card'; |
|
38 | + $h++; |
|
39 | 39 | |
40 | 40 | // Show more tabs from modules |
41 | 41 | // Entries must be declared in modules descriptor with line |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | // $this->tabs = array('entity:-tabname); to remove a tab |
44 | 44 | complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries'); |
45 | 45 | |
46 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
46 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
47 | 47 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
48 | - $upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
49 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
48 | + $upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
49 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
50 | 50 | $nbLinks=Link::count($db, $object->element, $object->id); |
51 | - $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id; |
|
52 | - $head[$h][1] = $langs->trans('Documents'); |
|
53 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
54 | - $head[$h][2] = 'documents'; |
|
55 | - $h++; |
|
51 | + $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id; |
|
52 | + $head[$h][1] = $langs->trans('Documents'); |
|
53 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
54 | + $head[$h][2] = 'documents'; |
|
55 | + $h++; |
|
56 | 56 | |
57 | - $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id; |
|
58 | - $head[$h][1] = $langs->trans("Info"); |
|
59 | - $head[$h][2] = 'info'; |
|
60 | - $h++; |
|
57 | + $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id; |
|
58 | + $head[$h][1] = $langs->trans("Info"); |
|
59 | + $head[$h][2] = 'info'; |
|
60 | + $h++; |
|
61 | 61 | |
62 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove'); |
|
62 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove'); |
|
63 | 63 | |
64 | - return $head; |
|
64 | + return $head; |
|
65 | 65 | } |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function showOnlineSignatureUrl($type,$ref) |
28 | 28 | { |
29 | - global $conf, $langs; |
|
29 | + global $conf, $langs; |
|
30 | 30 | |
31 | - // Load translation files required by the page |
|
31 | + // Load translation files required by the page |
|
32 | 32 | $langs->loadLangs(array("payment","paybox")); |
33 | 33 | |
34 | - $servicename='Online'; |
|
34 | + $servicename='Online'; |
|
35 | 35 | |
36 | - $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlineSignature",$servicename).'<br>'; |
|
37 | - $url = getOnlineSignatureUrl(0, $type, $ref); |
|
38 | - $out.= '<input type="text" id="onlinesignatureurl" class="quatrevingtpercent" value="'.$url.'">'; |
|
39 | - $out.= ajax_autoselect("onlinesignatureurl", 0); |
|
40 | - return $out; |
|
36 | + $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlineSignature",$servicename).'<br>'; |
|
37 | + $url = getOnlineSignatureUrl(0, $type, $ref); |
|
38 | + $out.= '<input type="text" id="onlinesignatureurl" class="quatrevingtpercent" value="'.$url.'">'; |
|
39 | + $out.= ajax_autoselect("onlinesignatureurl", 0); |
|
40 | + return $out; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -51,45 +51,45 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function getOnlineSignatureUrl($mode, $type, $ref='') |
53 | 53 | { |
54 | - global $conf, $db, $langs; |
|
54 | + global $conf, $db, $langs; |
|
55 | 55 | |
56 | - $ref=str_replace(' ','',$ref); |
|
57 | - $out=''; |
|
56 | + $ref=str_replace(' ','',$ref); |
|
57 | + $out=''; |
|
58 | 58 | |
59 | - if ($type == 'proposal') |
|
60 | - { |
|
61 | - $out=DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode?'<font color="#666666">':''); |
|
62 | - if ($mode == 1) $out.='proposal_ref'; |
|
63 | - if ($mode == 0) $out.=urlencode($ref); |
|
64 | - $out.=($mode?'</font>':''); |
|
65 | - if ($mode == 1) $out.='&hashp=<font color="#666666">hash_of_file</font>'; |
|
66 | - else |
|
67 | - { |
|
68 | - include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
69 | - $propaltmp=new Propal($db); |
|
70 | - $res = $propaltmp->fetch(0, $ref); |
|
71 | - if ($res <= 0) return 'FailedToGetProposal'; |
|
59 | + if ($type == 'proposal') |
|
60 | + { |
|
61 | + $out=DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode?'<font color="#666666">':''); |
|
62 | + if ($mode == 1) $out.='proposal_ref'; |
|
63 | + if ($mode == 0) $out.=urlencode($ref); |
|
64 | + $out.=($mode?'</font>':''); |
|
65 | + if ($mode == 1) $out.='&hashp=<font color="#666666">hash_of_file</font>'; |
|
66 | + else |
|
67 | + { |
|
68 | + include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
69 | + $propaltmp=new Propal($db); |
|
70 | + $res = $propaltmp->fetch(0, $ref); |
|
71 | + if ($res <= 0) return 'FailedToGetProposal'; |
|
72 | 72 | |
73 | - include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; |
|
74 | - $ecmfile=new EcmFiles($db); |
|
73 | + include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; |
|
74 | + $ecmfile=new EcmFiles($db); |
|
75 | 75 | |
76 | - $ecmfile->fetch(0, '', $propaltmp->last_main_doc); |
|
76 | + $ecmfile->fetch(0, '', $propaltmp->last_main_doc); |
|
77 | 77 | |
78 | - $hashp=$ecmfile->share; |
|
79 | - if (empty($hashp)) |
|
80 | - { |
|
81 | - $out = $langs->trans("FeatureOnlineSignDisabled"); |
|
82 | - return $out; |
|
83 | - } |
|
84 | - else |
|
85 | - { |
|
86 | - $out.='&hashp='.$hashp; |
|
87 | - } |
|
88 | - } |
|
89 | - } |
|
78 | + $hashp=$ecmfile->share; |
|
79 | + if (empty($hashp)) |
|
80 | + { |
|
81 | + $out = $langs->trans("FeatureOnlineSignDisabled"); |
|
82 | + return $out; |
|
83 | + } |
|
84 | + else |
|
85 | + { |
|
86 | + $out.='&hashp='.$hashp; |
|
87 | + } |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | - // For multicompany |
|
92 | - if (! empty($out)) $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities |
|
91 | + // For multicompany |
|
92 | + if (! empty($out)) $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities |
|
93 | 93 | |
94 | - return $out; |
|
94 | + return $out; |
|
95 | 95 | } |
@@ -67,27 +67,27 @@ discard block |
||
67 | 67 | |
68 | 68 | if ($object->courant != Account::TYPE_CASH) |
69 | 69 | { |
70 | - $nbReceipts=0; |
|
71 | - |
|
72 | - // List of all standing receipts |
|
73 | - $sql = "SELECT COUNT(DISTINCT(b.num_releve)) as nb"; |
|
74 | - $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; |
|
75 | - $sql.= " WHERE b.fk_account = ".$object->id; |
|
76 | - |
|
77 | - $resql = $db->query($sql); |
|
78 | - if ($resql) |
|
79 | - { |
|
80 | - $obj = $db->fetch_object($resql); |
|
81 | - if ($obj) $nbReceipts = $obj->nb; |
|
82 | - $db->free($resql); |
|
83 | - } |
|
84 | - |
|
85 | - $head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id; |
|
86 | - $head[$h][1] = $langs->trans("AccountStatements"); |
|
87 | - if (($nbReceipts) > 0) $head[$h][1].= ' <span class="badge">'.($nbReceipts).'</span>'; |
|
88 | - $head[$h][2] = 'statement'; |
|
89 | - $h++; |
|
90 | - } |
|
70 | + $nbReceipts=0; |
|
71 | + |
|
72 | + // List of all standing receipts |
|
73 | + $sql = "SELECT COUNT(DISTINCT(b.num_releve)) as nb"; |
|
74 | + $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; |
|
75 | + $sql.= " WHERE b.fk_account = ".$object->id; |
|
76 | + |
|
77 | + $resql = $db->query($sql); |
|
78 | + if ($resql) |
|
79 | + { |
|
80 | + $obj = $db->fetch_object($resql); |
|
81 | + if ($obj) $nbReceipts = $obj->nb; |
|
82 | + $db->free($resql); |
|
83 | + } |
|
84 | + |
|
85 | + $head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id; |
|
86 | + $head[$h][1] = $langs->trans("AccountStatements"); |
|
87 | + if (($nbReceipts) > 0) $head[$h][1].= ' <span class="badge">'.($nbReceipts).'</span>'; |
|
88 | + $head[$h][2] = 'statement'; |
|
89 | + $h++; |
|
90 | + } |
|
91 | 91 | |
92 | 92 | // Attached files |
93 | 93 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $head[$h][2] = 'document'; |
102 | 102 | $h++; |
103 | 103 | |
104 | - // Show more tabs from modules |
|
104 | + // Show more tabs from modules |
|
105 | 105 | // Entries must be declared in modules descriptor with line |
106 | 106 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
107 | 107 | // $this->tabs = array('entity:-tabname); to remove a tab |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $head[$h][2] = 'info'; |
113 | 113 | $h++;*/ |
114 | 114 | |
115 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank', 'remove'); |
|
115 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank', 'remove'); |
|
116 | 116 | |
117 | 117 | return $head; |
118 | 118 | } |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | */ |
125 | 125 | function bank_admin_prepare_head($object) |
126 | 126 | { |
127 | - global $langs, $conf, $user; |
|
128 | - $h = 0; |
|
129 | - $head = array(); |
|
127 | + global $langs, $conf, $user; |
|
128 | + $h = 0; |
|
129 | + $head = array(); |
|
130 | 130 | |
131 | - $head[$h][0] = DOL_URL_ROOT . '/admin/bank.php'; |
|
132 | - $head[$h][1] = $langs->trans("Miscellaneous"); |
|
133 | - $head[$h][2] = 'general'; |
|
134 | - $h++; |
|
131 | + $head[$h][0] = DOL_URL_ROOT . '/admin/bank.php'; |
|
132 | + $head[$h][1] = $langs->trans("Miscellaneous"); |
|
133 | + $head[$h][2] = 'general'; |
|
134 | + $h++; |
|
135 | 135 | |
136 | 136 | $head[$h][0] = DOL_URL_ROOT . '/admin/chequereceipts.php'; |
137 | 137 | $head[$h][1] = $langs->trans("CheckReceiptShort"); |
@@ -139,20 +139,20 @@ discard block |
||
139 | 139 | $h++; |
140 | 140 | |
141 | 141 | |
142 | - // Show more tabs from modules |
|
143 | - // Entries must be declared in modules descriptor with line |
|
144 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
145 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
146 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin'); |
|
142 | + // Show more tabs from modules |
|
143 | + // Entries must be declared in modules descriptor with line |
|
144 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
145 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
146 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin'); |
|
147 | 147 | |
148 | - $head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php'; |
|
149 | - $head[$h][1] = $langs->trans("ExtraFields"); |
|
150 | - $head[$h][2] = 'attributes'; |
|
151 | - $h++; |
|
148 | + $head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php'; |
|
149 | + $head[$h][1] = $langs->trans("ExtraFields"); |
|
150 | + $head[$h][2] = 'attributes'; |
|
151 | + $h++; |
|
152 | 152 | |
153 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin', 'remove'); |
|
153 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin', 'remove'); |
|
154 | 154 | |
155 | - return $head; |
|
155 | + return $head; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | function various_payment_prepare_head($object) |
165 | 165 | { |
166 | 166 | |
167 | - global $db, $langs, $conf; |
|
167 | + global $db, $langs, $conf; |
|
168 | 168 | |
169 | - $h = 0; |
|
170 | - $head = array(); |
|
169 | + $h = 0; |
|
170 | + $head = array(); |
|
171 | 171 | |
172 | - $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$object->id; |
|
173 | - $head[$h][1] = $langs->trans("Card"); |
|
174 | - $head[$h][2] = 'card'; |
|
175 | - $h++; |
|
172 | + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$object->id; |
|
173 | + $head[$h][1] = $langs->trans("Card"); |
|
174 | + $head[$h][2] = 'card'; |
|
175 | + $h++; |
|
176 | 176 | |
177 | 177 | // Show more tabs from modules |
178 | 178 | // Entries must be declared in modules descriptor with line |
@@ -180,25 +180,25 @@ discard block |
||
180 | 180 | // $this->tabs = array('entity:-tabname); to remove a tab |
181 | 181 | complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment'); |
182 | 182 | |
183 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
183 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
184 | 184 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
185 | - $upload_dir = $conf->banque->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
186 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
185 | + $upload_dir = $conf->banque->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
186 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
187 | 187 | $nbLinks=Link::count($db, $object->element, $object->id); |
188 | - $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id; |
|
189 | - $head[$h][1] = $langs->trans('Documents'); |
|
190 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
191 | - $head[$h][2] = 'documents'; |
|
192 | - $h++; |
|
188 | + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id; |
|
189 | + $head[$h][1] = $langs->trans('Documents'); |
|
190 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
191 | + $head[$h][2] = 'documents'; |
|
192 | + $h++; |
|
193 | 193 | |
194 | - $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/info.php?id='.$object->id; |
|
195 | - $head[$h][1] = $langs->trans("Info"); |
|
196 | - $head[$h][2] = 'info'; |
|
197 | - $h++; |
|
194 | + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/info.php?id='.$object->id; |
|
195 | + $head[$h][1] = $langs->trans("Info"); |
|
196 | + $head[$h][2] = 'info'; |
|
197 | + $h++; |
|
198 | 198 | |
199 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment', 'remove'); |
|
199 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment', 'remove'); |
|
200 | 200 | |
201 | - return $head; |
|
201 | + return $head; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -29,28 +29,28 @@ |
||
29 | 29 | */ |
30 | 30 | function fiscalyear_prepare_head(Fiscalyear $object) |
31 | 31 | { |
32 | - global $langs, $conf; |
|
32 | + global $langs, $conf; |
|
33 | 33 | |
34 | - $h = 0; |
|
35 | - $head = array(); |
|
34 | + $h = 0; |
|
35 | + $head = array(); |
|
36 | 36 | |
37 | - $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_card.php?id=' . $object->id; |
|
38 | - $head[$h][1] = $langs->trans("Card"); |
|
39 | - $head[$h][2] = 'card'; |
|
40 | - $h++; |
|
37 | + $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_card.php?id=' . $object->id; |
|
38 | + $head[$h][1] = $langs->trans("Card"); |
|
39 | + $head[$h][2] = 'card'; |
|
40 | + $h++; |
|
41 | 41 | |
42 | - // Show more tabs from modules |
|
43 | - // Entries must be declared in modules descriptor with line |
|
42 | + // Show more tabs from modules |
|
43 | + // Entries must be declared in modules descriptor with line |
|
44 | 44 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
45 | 45 | // $this->tabs = array('entity:-tabname); to remove a tab |
46 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear'); |
|
46 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear'); |
|
47 | 47 | |
48 | - $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_info.php?id=' . $object->id; |
|
49 | - $head[$h][1] = $langs->trans("Info"); |
|
50 | - $head[$h][2] = 'info'; |
|
51 | - $h++; |
|
48 | + $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_info.php?id=' . $object->id; |
|
49 | + $head[$h][1] = $langs->trans("Info"); |
|
50 | + $head[$h][2] = 'info'; |
|
51 | + $h++; |
|
52 | 52 | |
53 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear','remove'); |
|
53 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear','remove'); |
|
54 | 54 | |
55 | - return $head; |
|
55 | + return $head; |
|
56 | 56 | } |
57 | 57 | \ No newline at end of file |
@@ -31,140 +31,140 @@ |
||
31 | 31 | */ |
32 | 32 | function dol_ch_controle_bvrb($bvrb) |
33 | 33 | { |
34 | - // Init array for control |
|
35 | - $tableau[0][0]=0; |
|
36 | - $tableau[0][1]=9; |
|
37 | - $tableau[0][2]=4; |
|
38 | - $tableau[0][3]=6; |
|
39 | - $tableau[0][4]=8; |
|
40 | - $tableau[0][5]=2; |
|
41 | - $tableau[0][6]=7; |
|
42 | - $tableau[0][7]=1; |
|
43 | - $tableau[0][8]=3; |
|
44 | - $tableau[0][9]=5; |
|
45 | - $tableau[0][10]=0; |
|
46 | - |
|
47 | - $tableau[1][0]=9; |
|
48 | - $tableau[1][1]=4; |
|
49 | - $tableau[1][2]=6; |
|
50 | - $tableau[1][3]=8; |
|
51 | - $tableau[1][4]=2; |
|
52 | - $tableau[1][5]=7; |
|
53 | - $tableau[1][6]=1; |
|
54 | - $tableau[1][7]=3; |
|
55 | - $tableau[1][8]=5; |
|
56 | - $tableau[1][9]=0; |
|
57 | - $tableau[1][10]=9; |
|
58 | - |
|
59 | - $tableau[2][0]=4; |
|
60 | - $tableau[2][1]=6; |
|
61 | - $tableau[2][2]=8; |
|
62 | - $tableau[2][3]=2; |
|
63 | - $tableau[2][4]=7; |
|
64 | - $tableau[2][5]=1; |
|
65 | - $tableau[2][6]=3; |
|
66 | - $tableau[2][7]=5; |
|
67 | - $tableau[2][8]=0; |
|
68 | - $tableau[2][9]=9; |
|
69 | - $tableau[2][10]=8; |
|
70 | - |
|
71 | - $tableau[3][0]=6; |
|
72 | - $tableau[3][1]=8; |
|
73 | - $tableau[3][2]=2; |
|
74 | - $tableau[3][3]=7; |
|
75 | - $tableau[3][4]=1; |
|
76 | - $tableau[3][5]=3; |
|
77 | - $tableau[3][6]=5; |
|
78 | - $tableau[3][7]=0; |
|
79 | - $tableau[3][8]=9; |
|
80 | - $tableau[3][9]=4; |
|
81 | - $tableau[3][10]=7; |
|
82 | - |
|
83 | - $tableau[4][0]=8; |
|
84 | - $tableau[4][1]=2; |
|
85 | - $tableau[4][2]=7; |
|
86 | - $tableau[4][3]=1; |
|
87 | - $tableau[4][4]=3; |
|
88 | - $tableau[4][5]=5; |
|
89 | - $tableau[4][6]=0; |
|
90 | - $tableau[4][7]=9; |
|
91 | - $tableau[4][8]=4; |
|
92 | - $tableau[4][9]=6; |
|
93 | - $tableau[4][10]=6; |
|
94 | - |
|
95 | - $tableau[5][0]=2; |
|
96 | - $tableau[5][1]=7; |
|
97 | - $tableau[5][2]=1; |
|
98 | - $tableau[5][3]=3; |
|
99 | - $tableau[5][4]=5; |
|
100 | - $tableau[5][5]=0; |
|
101 | - $tableau[5][6]=9; |
|
102 | - $tableau[5][7]=4; |
|
103 | - $tableau[5][8]=6; |
|
104 | - $tableau[5][9]=8; |
|
105 | - $tableau[5][10]=5; |
|
106 | - |
|
107 | - $tableau[6][0]=7; |
|
108 | - $tableau[6][1]=1; |
|
109 | - $tableau[6][2]=3; |
|
110 | - $tableau[6][3]=5; |
|
111 | - $tableau[6][4]=0; |
|
112 | - $tableau[6][5]=9; |
|
113 | - $tableau[6][6]=4; |
|
114 | - $tableau[6][7]=6; |
|
115 | - $tableau[6][8]=8; |
|
116 | - $tableau[6][9]=2; |
|
117 | - $tableau[6][10]=4; |
|
118 | - |
|
119 | - $tableau[7][0]=1; |
|
120 | - $tableau[7][1]=3; |
|
121 | - $tableau[7][2]=5; |
|
122 | - $tableau[7][3]=0; |
|
123 | - $tableau[7][4]=9; |
|
124 | - $tableau[7][5]=4; |
|
125 | - $tableau[7][6]=6; |
|
126 | - $tableau[7][7]=8; |
|
127 | - $tableau[7][8]=2; |
|
128 | - $tableau[7][9]=7; |
|
129 | - $tableau[7][10]=3; |
|
130 | - |
|
131 | - $tableau[8][0]=3; |
|
132 | - $tableau[8][1]=5; |
|
133 | - $tableau[8][2]=0; |
|
134 | - $tableau[8][3]=9; |
|
135 | - $tableau[8][4]=4; |
|
136 | - $tableau[8][5]=6; |
|
137 | - $tableau[8][6]=8; |
|
138 | - $tableau[8][7]=2; |
|
139 | - $tableau[8][8]=7; |
|
140 | - $tableau[8][9]=1; |
|
141 | - $tableau[8][10]=2; |
|
142 | - |
|
143 | - $tableau[9][0]=5; |
|
144 | - $tableau[9][1]=0; |
|
145 | - $tableau[9][2]=9; |
|
146 | - $tableau[9][3]=4; |
|
147 | - $tableau[9][4]=6; |
|
148 | - $tableau[9][5]=8; |
|
149 | - $tableau[9][6]=2; |
|
150 | - $tableau[9][7]=7; |
|
151 | - $tableau[9][8]=1; |
|
152 | - $tableau[9][9]=3; |
|
153 | - $tableau[9][10]=1; |
|
154 | - |
|
155 | - |
|
156 | - // Clean data |
|
157 | - $bv=str_replace(' ','',$bvrb); |
|
158 | - |
|
159 | - // Make control |
|
160 | - $report=0; |
|
161 | - while (dol_strlen($bv)>1) |
|
162 | - { |
|
163 | - $match=substr($bv,0,1); |
|
164 | - $report=$tableau[$report][$match]; |
|
165 | - $bv=substr($bv,1); |
|
166 | - } |
|
167 | - $controle=$tableau[$report][10]; |
|
168 | - |
|
169 | - return ($controle==$bv); |
|
34 | + // Init array for control |
|
35 | + $tableau[0][0]=0; |
|
36 | + $tableau[0][1]=9; |
|
37 | + $tableau[0][2]=4; |
|
38 | + $tableau[0][3]=6; |
|
39 | + $tableau[0][4]=8; |
|
40 | + $tableau[0][5]=2; |
|
41 | + $tableau[0][6]=7; |
|
42 | + $tableau[0][7]=1; |
|
43 | + $tableau[0][8]=3; |
|
44 | + $tableau[0][9]=5; |
|
45 | + $tableau[0][10]=0; |
|
46 | + |
|
47 | + $tableau[1][0]=9; |
|
48 | + $tableau[1][1]=4; |
|
49 | + $tableau[1][2]=6; |
|
50 | + $tableau[1][3]=8; |
|
51 | + $tableau[1][4]=2; |
|
52 | + $tableau[1][5]=7; |
|
53 | + $tableau[1][6]=1; |
|
54 | + $tableau[1][7]=3; |
|
55 | + $tableau[1][8]=5; |
|
56 | + $tableau[1][9]=0; |
|
57 | + $tableau[1][10]=9; |
|
58 | + |
|
59 | + $tableau[2][0]=4; |
|
60 | + $tableau[2][1]=6; |
|
61 | + $tableau[2][2]=8; |
|
62 | + $tableau[2][3]=2; |
|
63 | + $tableau[2][4]=7; |
|
64 | + $tableau[2][5]=1; |
|
65 | + $tableau[2][6]=3; |
|
66 | + $tableau[2][7]=5; |
|
67 | + $tableau[2][8]=0; |
|
68 | + $tableau[2][9]=9; |
|
69 | + $tableau[2][10]=8; |
|
70 | + |
|
71 | + $tableau[3][0]=6; |
|
72 | + $tableau[3][1]=8; |
|
73 | + $tableau[3][2]=2; |
|
74 | + $tableau[3][3]=7; |
|
75 | + $tableau[3][4]=1; |
|
76 | + $tableau[3][5]=3; |
|
77 | + $tableau[3][6]=5; |
|
78 | + $tableau[3][7]=0; |
|
79 | + $tableau[3][8]=9; |
|
80 | + $tableau[3][9]=4; |
|
81 | + $tableau[3][10]=7; |
|
82 | + |
|
83 | + $tableau[4][0]=8; |
|
84 | + $tableau[4][1]=2; |
|
85 | + $tableau[4][2]=7; |
|
86 | + $tableau[4][3]=1; |
|
87 | + $tableau[4][4]=3; |
|
88 | + $tableau[4][5]=5; |
|
89 | + $tableau[4][6]=0; |
|
90 | + $tableau[4][7]=9; |
|
91 | + $tableau[4][8]=4; |
|
92 | + $tableau[4][9]=6; |
|
93 | + $tableau[4][10]=6; |
|
94 | + |
|
95 | + $tableau[5][0]=2; |
|
96 | + $tableau[5][1]=7; |
|
97 | + $tableau[5][2]=1; |
|
98 | + $tableau[5][3]=3; |
|
99 | + $tableau[5][4]=5; |
|
100 | + $tableau[5][5]=0; |
|
101 | + $tableau[5][6]=9; |
|
102 | + $tableau[5][7]=4; |
|
103 | + $tableau[5][8]=6; |
|
104 | + $tableau[5][9]=8; |
|
105 | + $tableau[5][10]=5; |
|
106 | + |
|
107 | + $tableau[6][0]=7; |
|
108 | + $tableau[6][1]=1; |
|
109 | + $tableau[6][2]=3; |
|
110 | + $tableau[6][3]=5; |
|
111 | + $tableau[6][4]=0; |
|
112 | + $tableau[6][5]=9; |
|
113 | + $tableau[6][6]=4; |
|
114 | + $tableau[6][7]=6; |
|
115 | + $tableau[6][8]=8; |
|
116 | + $tableau[6][9]=2; |
|
117 | + $tableau[6][10]=4; |
|
118 | + |
|
119 | + $tableau[7][0]=1; |
|
120 | + $tableau[7][1]=3; |
|
121 | + $tableau[7][2]=5; |
|
122 | + $tableau[7][3]=0; |
|
123 | + $tableau[7][4]=9; |
|
124 | + $tableau[7][5]=4; |
|
125 | + $tableau[7][6]=6; |
|
126 | + $tableau[7][7]=8; |
|
127 | + $tableau[7][8]=2; |
|
128 | + $tableau[7][9]=7; |
|
129 | + $tableau[7][10]=3; |
|
130 | + |
|
131 | + $tableau[8][0]=3; |
|
132 | + $tableau[8][1]=5; |
|
133 | + $tableau[8][2]=0; |
|
134 | + $tableau[8][3]=9; |
|
135 | + $tableau[8][4]=4; |
|
136 | + $tableau[8][5]=6; |
|
137 | + $tableau[8][6]=8; |
|
138 | + $tableau[8][7]=2; |
|
139 | + $tableau[8][8]=7; |
|
140 | + $tableau[8][9]=1; |
|
141 | + $tableau[8][10]=2; |
|
142 | + |
|
143 | + $tableau[9][0]=5; |
|
144 | + $tableau[9][1]=0; |
|
145 | + $tableau[9][2]=9; |
|
146 | + $tableau[9][3]=4; |
|
147 | + $tableau[9][4]=6; |
|
148 | + $tableau[9][5]=8; |
|
149 | + $tableau[9][6]=2; |
|
150 | + $tableau[9][7]=7; |
|
151 | + $tableau[9][8]=1; |
|
152 | + $tableau[9][9]=3; |
|
153 | + $tableau[9][10]=1; |
|
154 | + |
|
155 | + |
|
156 | + // Clean data |
|
157 | + $bv=str_replace(' ','',$bvrb); |
|
158 | + |
|
159 | + // Make control |
|
160 | + $report=0; |
|
161 | + while (dol_strlen($bv)>1) |
|
162 | + { |
|
163 | + $match=substr($bv,0,1); |
|
164 | + $report=$tableau[$report][$match]; |
|
165 | + $bv=substr($bv,1); |
|
166 | + } |
|
167 | + $controle=$tableau[$report][10]; |
|
168 | + |
|
169 | + return ($controle==$bv); |
|
170 | 170 | } |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | ); |
30 | 30 | if ($conf->global->MAIN_FEATURES_LEVEL >= 2) |
31 | 31 | { |
32 | - $supportedoauth2array['OAUTH_STRIPE_TEST_NAME']='stripetest'; |
|
33 | - $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME']='stripelive'; |
|
32 | + $supportedoauth2array['OAUTH_STRIPE_TEST_NAME']='stripetest'; |
|
33 | + $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME']='stripelive'; |
|
34 | 34 | } |
35 | 35 | $supportedoauth2array['OAUTH_GITHUB_NAME']='github'; |
36 | 36 | |
@@ -220,17 +220,17 @@ discard block |
||
220 | 220 | 'OAUTH_STRAVA_ID', |
221 | 221 | 'OAUTH_STRAVA_SECRET', |
222 | 222 | ), |
223 | - array( |
|
224 | - 'OAUTH_STRIPE_TEST_NAME', |
|
225 | - 'OAUTH_STRIPE_TEST_ID', |
|
226 | - 'STRIPE_TEST_SECRET_KEY', |
|
227 | - ), |
|
228 | - array( |
|
229 | - 'OAUTH_STRIPE_LIVE_NAME', |
|
230 | - 'OAUTH_STRIPE_LIVE_ID', |
|
231 | - 'STRIPE_LIVE_SECRET_KEY', |
|
232 | - ), |
|
233 | - array( |
|
223 | + array( |
|
224 | + 'OAUTH_STRIPE_TEST_NAME', |
|
225 | + 'OAUTH_STRIPE_TEST_ID', |
|
226 | + 'STRIPE_TEST_SECRET_KEY', |
|
227 | + ), |
|
228 | + array( |
|
229 | + 'OAUTH_STRIPE_LIVE_NAME', |
|
230 | + 'OAUTH_STRIPE_LIVE_ID', |
|
231 | + 'STRIPE_LIVE_SECRET_KEY', |
|
232 | + ), |
|
233 | + array( |
|
234 | 234 | 'OAUTH_TUMBLR_NAME', |
235 | 235 | 'OAUTH_TUMBLR_ID', |
236 | 236 | 'OAUTH_TUMBLR_SECRET', |