@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | // Protection to avoid direct call of template |
19 | 19 | if (empty($conf) || ! is_object($conf)) |
20 | 20 | { |
21 | - print "Error, template page can't be called as URL"; |
|
22 | - exit; |
|
21 | + print "Error, template page can't be called as URL"; |
|
22 | + exit; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -121,22 +121,22 @@ discard block |
||
121 | 121 | |
122 | 122 | <?php |
123 | 123 | for ($i=1; $i<=4; $i++) { |
124 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
125 | - if ($i==1 || $i==3) echo '<tr>'; |
|
126 | - echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
127 | - echo '<td>'.$this->control->tpl['profid'.$i]; |
|
128 | - if ($this->control->tpl['profid'.$i]) { |
|
129 | - if ($this->control->tpl['checkprofid'.$i] > 0) echo ' '.$this->control->tpl['urlprofid'.$i]; |
|
130 | - else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
|
131 | - } |
|
132 | - echo '</td>'; |
|
133 | - if ($i==2 || $i==4) echo '</tr>'; |
|
134 | - } else { |
|
135 | - if ($i==1 || $i==3) echo '<tr>'; |
|
136 | - echo '<td> </td>'; |
|
137 | - echo '<td> </td>'; |
|
138 | - if ($i==2 || $i==4) echo '</tr>'; |
|
139 | - } |
|
124 | + if ($this->control->tpl['langprofid'.$i]!='-') { |
|
125 | + if ($i==1 || $i==3) echo '<tr>'; |
|
126 | + echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
127 | + echo '<td>'.$this->control->tpl['profid'.$i]; |
|
128 | + if ($this->control->tpl['profid'.$i]) { |
|
129 | + if ($this->control->tpl['checkprofid'.$i] > 0) echo ' '.$this->control->tpl['urlprofid'.$i]; |
|
130 | + else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
|
131 | + } |
|
132 | + echo '</td>'; |
|
133 | + if ($i==2 || $i==4) echo '</tr>'; |
|
134 | + } else { |
|
135 | + if ($i==1 || $i==3) echo '<tr>'; |
|
136 | + echo '<td> </td>'; |
|
137 | + echo '<td> </td>'; |
|
138 | + if ($i==2 || $i==4) echo '</tr>'; |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | ?> |
142 | 142 | |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | <td><?php echo $langs->trans('Capital'); ?></td> |
154 | 154 | <td colspan="3"> |
155 | 155 | <?php |
156 | - if ($this->control->tpl['capital']) echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
157 | - else echo ' '; |
|
158 | - ?> |
|
156 | + if ($this->control->tpl['capital']) echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
157 | + else echo ' '; |
|
158 | + ?> |
|
159 | 159 | </td> |
160 | 160 | </tr> |
161 | 161 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Protection to avoid direct call of template |
19 | -if (empty($conf) || ! is_object($conf)) |
|
19 | +if (empty($conf) || !is_object($conf)) |
|
20 | 20 | { |
21 | 21 | print "Error, template page can't be called as URL"; |
22 | 22 | exit; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $head = societe_prepare_head($soc); |
34 | 34 | |
35 | -dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); |
|
35 | +dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); |
|
36 | 36 | |
37 | 37 | ?> |
38 | 38 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | <td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td> |
48 | 48 | </tr> |
49 | 49 | |
50 | -<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
50 | +<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
51 | 51 | <tr> |
52 | 52 | <td><?php echo $langs->trans('Prefix'); ?></td> |
53 | 53 | <td colspan="3"><?php echo $this->control->tpl['prefix_comm']; ?></td> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | </tr> |
77 | 77 | <?php } ?> |
78 | 78 | |
79 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
79 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
80 | 80 | <tr> |
81 | 81 | <td><?php echo $langs->trans('Gencod'); ?></td> |
82 | 82 | <td colspan="3"><?php echo $this->control->tpl['barcode']; ?></td> |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | </tr> |
121 | 121 | |
122 | 122 | <?php |
123 | -for ($i=1; $i<=4; $i++) { |
|
124 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
125 | - if ($i==1 || $i==3) echo '<tr>'; |
|
123 | +for ($i = 1; $i <= 4; $i++) { |
|
124 | + if ($this->control->tpl['langprofid'.$i] != '-') { |
|
125 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
126 | 126 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
127 | 127 | echo '<td>'.$this->control->tpl['profid'.$i]; |
128 | 128 | if ($this->control->tpl['profid'.$i]) { |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
131 | 131 | } |
132 | 132 | echo '</td>'; |
133 | - if ($i==2 || $i==4) echo '</tr>'; |
|
133 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
134 | 134 | } else { |
135 | - if ($i==1 || $i==3) echo '<tr>'; |
|
135 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
136 | 136 | echo '<td> </td>'; |
137 | 137 | echo '<td> </td>'; |
138 | - if ($i==2 || $i==4) echo '</tr>'; |
|
138 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | ?> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | <td><?php echo $this->control->tpl['tva_intra']; ?></td> |
148 | 148 | </tr> |
149 | 149 | |
150 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
150 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
151 | 151 | |
152 | 152 | <tr> |
153 | 153 | <td><?php echo $langs->trans('Capital'); ?></td> |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | <td><?php echo $this->control->tpl['effectif']; ?></td> |
172 | 172 | </tr> |
173 | 173 | |
174 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
174 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
175 | 175 | <tr> |
176 | 176 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
177 | 177 | <td colspan="3"><?php echo $this->control->tpl['default_lang']; ?></td> |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | </tr> |
226 | 226 | </table> |
227 | 227 | </td> |
228 | - <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
228 | + <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
229 | 229 | </tr> |
230 | 230 | |
231 | -<?php if (! empty($conf->adherent->enabled)) { ?> |
|
231 | +<?php if (!empty($conf->adherent->enabled)) { ?> |
|
232 | 232 | <tr> |
233 | 233 | <td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td> |
234 | 234 | <td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td> |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | <?php if ($user->rights->societe->supprimer) { ?> |
248 | 248 | <?php if ($conf->use_javascript_ajax) { ?> |
249 | 249 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
250 | - <?php } else { ?> |
|
250 | + <?php } else { ?> |
|
251 | 251 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
252 | 252 | <?php } ?> |
253 | 253 | <?php } ?> |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | /* |
263 | 263 | * Documents generes |
264 | 264 | */ |
265 | -$filedir=$conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
266 | -$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid; |
|
267 | -$genallowed=$user->rights->societe->lire; |
|
268 | -$delallowed=$user->rights->societe->creer; |
|
265 | +$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
266 | +$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid; |
|
267 | +$genallowed = $user->rights->societe->lire; |
|
268 | +$delallowed = $user->rights->societe->creer; |
|
269 | 269 | |
270 | -print $formfile->showdocuments('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); |
|
270 | +print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang); |
|
271 | 271 | ?> |
272 | 272 | |
273 | 273 | </td> |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | |
280 | 280 | <?php |
281 | 281 | // Subsidiaries list |
282 | -$result=show_subsidiaries($conf,$langs,$db,$soc); |
|
282 | +$result = show_subsidiaries($conf, $langs, $db, $soc); |
|
283 | 283 | |
284 | 284 | // Contacts list |
285 | -$result=show_contacts($conf,$langs,$db,$soc); |
|
285 | +$result = show_contacts($conf, $langs, $db, $soc); |
|
286 | 286 | |
287 | 287 | // Projects list |
288 | -$result=show_projects($conf,$langs,$db,$soc); |
|
288 | +$result = show_projects($conf, $langs, $db, $soc); |
|
289 | 289 | ?> |
290 | 290 | |
291 | 291 | <!-- END PHP TEMPLATE --> |
292 | 292 | \ No newline at end of file |
@@ -36,9 +36,18 @@ discard block |
||
36 | 36 | |
37 | 37 | ?> |
38 | 38 | |
39 | -<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?> |
|
40 | -<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?> |
|
41 | -<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> |
|
39 | +<?php if ($this->control->tpl['error']) { |
|
40 | + echo $this->control->tpl['error']; |
|
41 | +} |
|
42 | +?> |
|
43 | +<?php if ($this->control->tpl['action_delete']) { |
|
44 | + echo $this->control->tpl['action_delete']; |
|
45 | +} |
|
46 | +?> |
|
47 | +<?php if ($this->control->tpl['js_checkVatPopup']) { |
|
48 | + echo $this->control->tpl['js_checkVatPopup']; |
|
49 | +} |
|
50 | +?> |
|
42 | 51 | |
43 | 52 | <table class="border allwidth"> |
44 | 53 | |
@@ -122,20 +131,31 @@ discard block |
||
122 | 131 | <?php |
123 | 132 | for ($i=1; $i<=4; $i++) { |
124 | 133 | if ($this->control->tpl['langprofid'.$i]!='-') { |
125 | - if ($i==1 || $i==3) echo '<tr>'; |
|
134 | + if ($i==1 || $i==3) { |
|
135 | + echo '<tr>'; |
|
136 | + } |
|
126 | 137 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
127 | 138 | echo '<td>'.$this->control->tpl['profid'.$i]; |
128 | 139 | if ($this->control->tpl['profid'.$i]) { |
129 | - if ($this->control->tpl['checkprofid'.$i] > 0) echo ' '.$this->control->tpl['urlprofid'.$i]; |
|
130 | - else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
|
140 | + if ($this->control->tpl['checkprofid'.$i] > 0) { |
|
141 | + echo ' '.$this->control->tpl['urlprofid'.$i]; |
|
142 | + } else { |
|
143 | + echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
|
144 | + } |
|
131 | 145 | } |
132 | 146 | echo '</td>'; |
133 | - if ($i==2 || $i==4) echo '</tr>'; |
|
147 | + if ($i==2 || $i==4) { |
|
148 | + echo '</tr>'; |
|
149 | + } |
|
134 | 150 | } else { |
135 | - if ($i==1 || $i==3) echo '<tr>'; |
|
151 | + if ($i==1 || $i==3) { |
|
152 | + echo '<tr>'; |
|
153 | + } |
|
136 | 154 | echo '<td> </td>'; |
137 | 155 | echo '<td> </td>'; |
138 | - if ($i==2 || $i==4) echo '</tr>'; |
|
156 | + if ($i==2 || $i==4) { |
|
157 | + echo '</tr>'; |
|
158 | + } |
|
139 | 159 | } |
140 | 160 | } |
141 | 161 | ?> |
@@ -147,14 +167,20 @@ discard block |
||
147 | 167 | <td><?php echo $this->control->tpl['tva_intra']; ?></td> |
148 | 168 | </tr> |
149 | 169 | |
150 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
170 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
171 | + echo $this->control->tpl['localtax']; |
|
172 | +} |
|
173 | +?> |
|
151 | 174 | |
152 | 175 | <tr> |
153 | 176 | <td><?php echo $langs->trans('Capital'); ?></td> |
154 | 177 | <td colspan="3"> |
155 | 178 | <?php |
156 | - if ($this->control->tpl['capital']) echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
157 | - else echo ' '; |
|
179 | + if ($this->control->tpl['capital']) { |
|
180 | + echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
181 | + } else { |
|
182 | + echo ' '; |
|
183 | + } |
|
158 | 184 | ?> |
159 | 185 | </td> |
160 | 186 | </tr> |
@@ -247,7 +273,7 @@ discard block |
||
247 | 273 | <?php if ($user->rights->societe->supprimer) { ?> |
248 | 274 | <?php if ($conf->use_javascript_ajax) { ?> |
249 | 275 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
250 | - <?php } else { ?> |
|
276 | + <?php } else { ?> |
|
251 | 277 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
252 | 278 | <?php } ?> |
253 | 279 | <?php } ?> |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | // Protection to avoid direct call of template |
20 | 20 | if (empty($conf) || ! is_object($conf)) |
21 | 21 | { |
22 | - print "Error, template page can't be called as URL"; |
|
23 | - exit; |
|
22 | + print "Error, template page can't be called as URL"; |
|
23 | + exit; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | <?php |
113 | 113 | if ($this->control->tpl['fournisseur']) { |
114 | - if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
114 | + if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
115 | 115 | <tr> |
116 | 116 | <td><?php echo $langs->trans('SupplierCategory'); ?></td> |
117 | 117 | <td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td> |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | |
164 | 164 | <?php |
165 | 165 | for ($i=1; $i<=4; $i++) { |
166 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
167 | - if ($i==1 || $i==3) echo '<tr>'; |
|
168 | - echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
169 | - echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
170 | - if ($i==2 || $i==4) echo '</tr>'; |
|
171 | - } else { |
|
172 | - if ($i==1 || $i==3) echo '<tr>'; |
|
173 | - echo '<td> </td>'; |
|
174 | - echo '<td> </td>'; |
|
175 | - if ($i==2 || $i==4) echo '</tr>'; |
|
176 | - } |
|
166 | + if ($this->control->tpl['langprofid'.$i]!='-') { |
|
167 | + if ($i==1 || $i==3) echo '<tr>'; |
|
168 | + echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
169 | + echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
170 | + if ($i==2 || $i==4) echo '</tr>'; |
|
171 | + } else { |
|
172 | + if ($i==1 || $i==3) echo '<tr>'; |
|
173 | + echo '<td> </td>'; |
|
174 | + echo '<td> </td>'; |
|
175 | + if ($i==2 || $i==4) echo '</tr>'; |
|
176 | + } |
|
177 | 177 | } |
178 | 178 | ?> |
179 | 179 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | // Protection to avoid direct call of template |
20 | -if (empty($conf) || ! is_object($conf)) |
|
20 | +if (empty($conf) || !is_object($conf)) |
|
21 | 21 | { |
22 | 22 | print "Error, template page can't be called as URL"; |
23 | 23 | exit; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | <td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td> |
54 | 54 | </tr> |
55 | 55 | |
56 | -<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
56 | +<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
57 | 57 | <tr> |
58 | 58 | <td><?php echo $langs->trans("Prefix"); ?></td> |
59 | 59 | <td colspan="3"> |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | </tr> |
119 | 119 | <?php } }?> |
120 | 120 | |
121 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
121 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
122 | 122 | <tr> |
123 | 123 | <td><?php echo $langs->trans('Gencod'); ?></td> |
124 | 124 | <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td> |
@@ -155,24 +155,24 @@ discard block |
||
155 | 155 | </tr> |
156 | 156 | |
157 | 157 | <tr> |
158 | - <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td> |
|
158 | + <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td> |
|
159 | 159 | <td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td> |
160 | 160 | <td><?php echo $langs->trans('Web'); ?></td> |
161 | 161 | <td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td> |
162 | 162 | </tr> |
163 | 163 | |
164 | 164 | <?php |
165 | -for ($i=1; $i<=4; $i++) { |
|
166 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
167 | - if ($i==1 || $i==3) echo '<tr>'; |
|
165 | +for ($i = 1; $i <= 4; $i++) { |
|
166 | + if ($this->control->tpl['langprofid'.$i] != '-') { |
|
167 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
168 | 168 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
169 | 169 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
170 | - if ($i==2 || $i==4) echo '</tr>'; |
|
170 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
171 | 171 | } else { |
172 | - if ($i==1 || $i==3) echo '<tr>'; |
|
172 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
173 | 173 | echo '<td> </td>'; |
174 | 174 | echo '<td> </td>'; |
175 | - if ($i==2 || $i==4) echo '</tr>'; |
|
175 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | ?> |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | <td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td> |
202 | 202 | </tr> |
203 | 203 | |
204 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
204 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
205 | 205 | <tr> |
206 | 206 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
207 | 207 | <td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td> |
208 | 208 | </tr> |
209 | 209 | <?php } ?> |
210 | 210 | |
211 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
211 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
212 | 212 | |
213 | 213 | </table> |
214 | 214 | <br> |
@@ -35,7 +35,10 @@ discard block |
||
35 | 35 | <?php echo $this->control->tpl['error']; ?> |
36 | 36 | |
37 | 37 | <?php echo $this->control->tpl['ajax_selectcountry']; ?> |
38 | -<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> |
|
38 | +<?php if ($this->control->tpl['js_checkVatPopup']) { |
|
39 | + echo $this->control->tpl['js_checkVatPopup']; |
|
40 | +} |
|
41 | +?> |
|
39 | 42 | |
40 | 43 | <form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id']; ?>" method="POST" name="formsoc"> |
41 | 44 | <input type="hidden" name="canvas" value="<?php echo $canvas ?>"> |
@@ -164,15 +167,23 @@ discard block |
||
164 | 167 | <?php |
165 | 168 | for ($i=1; $i<=4; $i++) { |
166 | 169 | if ($this->control->tpl['langprofid'.$i]!='-') { |
167 | - if ($i==1 || $i==3) echo '<tr>'; |
|
170 | + if ($i==1 || $i==3) { |
|
171 | + echo '<tr>'; |
|
172 | + } |
|
168 | 173 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
169 | 174 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
170 | - if ($i==2 || $i==4) echo '</tr>'; |
|
175 | + if ($i==2 || $i==4) { |
|
176 | + echo '</tr>'; |
|
177 | + } |
|
171 | 178 | } else { |
172 | - if ($i==1 || $i==3) echo '<tr>'; |
|
179 | + if ($i==1 || $i==3) { |
|
180 | + echo '<tr>'; |
|
181 | + } |
|
173 | 182 | echo '<td> </td>'; |
174 | 183 | echo '<td> </td>'; |
175 | - if ($i==2 || $i==4) echo '</tr>'; |
|
184 | + if ($i==2 || $i==4) { |
|
185 | + echo '</tr>'; |
|
186 | + } |
|
176 | 187 | } |
177 | 188 | } |
178 | 189 | ?> |
@@ -208,7 +219,10 @@ discard block |
||
208 | 219 | </tr> |
209 | 220 | <?php } ?> |
210 | 221 | |
211 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
222 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
223 | + echo $this->control->tpl['localtax']; |
|
224 | +} |
|
225 | +?> |
|
212 | 226 | |
213 | 227 | </table> |
214 | 228 | <br> |
@@ -29,23 +29,23 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class ActionsCardCompany extends ActionsCardCommon |
31 | 31 | { |
32 | - /** |
|
33 | - * Constructor |
|
34 | - * |
|
32 | + /** |
|
33 | + * Constructor |
|
34 | + * |
|
35 | 35 | * @param DoliDB $db Handler acces base de donnees |
36 | 36 | * @param string $dirmodule Name of directory of module |
37 | 37 | * @param string $targetmodule Name of directory of module where canvas is stored |
38 | 38 | * @param string $canvas Name of canvas |
39 | 39 | * @param string $card Name of tab (sub-canvas) |
40 | - */ |
|
41 | - function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
42 | - { |
|
40 | + */ |
|
41 | + function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
42 | + { |
|
43 | 43 | $this->db = $db; |
44 | 44 | $this->dirmodule = $dirmodule; |
45 | 45 | $this->targetmodule = $targetmodule; |
46 | 46 | $this->canvas = $canvas; |
47 | 47 | $this->card = $card; |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Return the title of card |
@@ -68,155 +68,155 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
71 | - /** |
|
72 | - * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
73 | - * |
|
74 | - * @param string $action Type of action |
|
75 | - * @param integer $id Id of object |
|
76 | - * @param string $ref Ref of object |
|
77 | - * @return void |
|
78 | - */ |
|
79 | - function assign_values(&$action, $id=0, $ref='') |
|
80 | - { |
|
71 | + /** |
|
72 | + * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
73 | + * |
|
74 | + * @param string $action Type of action |
|
75 | + * @param integer $id Id of object |
|
76 | + * @param string $ref Ref of object |
|
77 | + * @return void |
|
78 | + */ |
|
79 | + function assign_values(&$action, $id=0, $ref='') |
|
80 | + { |
|
81 | 81 | // phpcs:enable |
82 | - global $conf, $langs, $user, $mysoc; |
|
83 | - global $form, $formadmin, $formcompany; |
|
82 | + global $conf, $langs, $user, $mysoc; |
|
83 | + global $form, $formadmin, $formcompany; |
|
84 | 84 | |
85 | - $ret = $this->getObject($id,$ref); |
|
85 | + $ret = $this->getObject($id,$ref); |
|
86 | 86 | |
87 | - parent::assign_values($action); |
|
87 | + parent::assign_values($action); |
|
88 | 88 | |
89 | 89 | $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); |
90 | 90 | |
91 | 91 | $this->tpl['profid1'] = $this->object->idprof1; |
92 | - $this->tpl['profid2'] = $this->object->idprof2; |
|
93 | - $this->tpl['profid3'] = $this->object->idprof3; |
|
94 | - $this->tpl['profid4'] = $this->object->idprof4; |
|
95 | - |
|
96 | - if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
97 | - { |
|
98 | - $js = "\n"; |
|
99 | - $js.= '<script language="JavaScript" type="text/javascript">'; |
|
100 | - $js.= "function CheckVAT(a) {\n"; |
|
101 | - $js.= "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n"; |
|
102 | - $js.= "}\n"; |
|
103 | - $js.= '</script>'; |
|
104 | - $js.= "\n"; |
|
105 | - $this->tpl['js_checkVatPopup'] = $js; |
|
106 | - } |
|
107 | - |
|
108 | - if ($action == 'create' || $action == 'edit') |
|
109 | - { |
|
110 | - for ($i=1; $i<=4; $i++) |
|
111 | - { |
|
112 | - $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
113 | - $this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->country_code); |
|
114 | - } |
|
115 | - |
|
116 | - // Type |
|
117 | - $this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id); |
|
118 | - |
|
119 | - // Juridical Status |
|
120 | - $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->country_code); |
|
121 | - |
|
122 | - // Workforce |
|
123 | - $this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id); |
|
124 | - |
|
125 | - // VAT intra |
|
126 | - $s='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
127 | - if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
128 | - { |
|
129 | - $s.=' '; |
|
130 | - |
|
131 | - if ($conf->use_javascript_ajax) |
|
132 | - { |
|
133 | - $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
134 | - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
135 | - } |
|
136 | - else |
|
137 | - { |
|
138 | - $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
139 | - } |
|
140 | - } |
|
141 | - else |
|
142 | - { |
|
143 | - $this->tpl['tva_intra'] = $s; |
|
144 | - } |
|
145 | - } |
|
146 | - else |
|
147 | - { |
|
148 | - // Confirm delete third party |
|
149 | - if ($action == 'delete') |
|
150 | - { |
|
151 | - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"1,action-delete"); |
|
152 | - } |
|
153 | - |
|
154 | - for ($i=1; $i<=4; $i++) |
|
155 | - { |
|
156 | - $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
157 | - $this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object); |
|
158 | - $this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object); |
|
159 | - } |
|
160 | - |
|
161 | - // TVA intra |
|
162 | - if ($this->object->tva_intra) |
|
163 | - { |
|
164 | - $s=$this->object->tva_intra; |
|
165 | - $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
166 | - if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
167 | - { |
|
168 | - $s.=' '; |
|
169 | - |
|
170 | - if ($conf->use_javascript_ajax) |
|
171 | - { |
|
172 | - $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
173 | - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
174 | - } |
|
175 | - else |
|
176 | - { |
|
177 | - $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
178 | - } |
|
179 | - } |
|
180 | - else |
|
181 | - { |
|
182 | - $this->tpl['tva_intra'] = $s; |
|
183 | - } |
|
184 | - } |
|
185 | - else |
|
186 | - { |
|
187 | - $this->tpl['tva_intra'] = ' '; |
|
188 | - } |
|
189 | - |
|
190 | - // Parent company |
|
191 | - if ($this->object->parent) |
|
192 | - { |
|
193 | - $socm = new Societe($this->db); |
|
194 | - $socm->fetch($this->object->parent); |
|
195 | - $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); |
|
196 | - $this->tpl['parent_company'].= ($socm->town ? ' - ' . $socm->town : ''); |
|
197 | - } |
|
198 | - else |
|
199 | - { |
|
200 | - $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); |
|
201 | - } |
|
202 | - } |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * Check permissions of a user to show a page and an object. Check read permission |
|
207 | - * If $_REQUEST['action'] defined, we also check write permission. |
|
208 | - * |
|
209 | - * @param User $user User to check |
|
210 | - * @param string $features Features to check (in most cases, it's module name) |
|
211 | - * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
212 | - * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
213 | - * @param string $feature2 Feature to check (second level of permission) |
|
214 | - * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
215 | - * @param string $dbt_select Field name for select if not rowid. (optional) |
|
216 | - * @return int 1 |
|
217 | - */ |
|
218 | - function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
219 | - { |
|
220 | - return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
221 | - } |
|
92 | + $this->tpl['profid2'] = $this->object->idprof2; |
|
93 | + $this->tpl['profid3'] = $this->object->idprof3; |
|
94 | + $this->tpl['profid4'] = $this->object->idprof4; |
|
95 | + |
|
96 | + if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
97 | + { |
|
98 | + $js = "\n"; |
|
99 | + $js.= '<script language="JavaScript" type="text/javascript">'; |
|
100 | + $js.= "function CheckVAT(a) {\n"; |
|
101 | + $js.= "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n"; |
|
102 | + $js.= "}\n"; |
|
103 | + $js.= '</script>'; |
|
104 | + $js.= "\n"; |
|
105 | + $this->tpl['js_checkVatPopup'] = $js; |
|
106 | + } |
|
107 | + |
|
108 | + if ($action == 'create' || $action == 'edit') |
|
109 | + { |
|
110 | + for ($i=1; $i<=4; $i++) |
|
111 | + { |
|
112 | + $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
113 | + $this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->country_code); |
|
114 | + } |
|
115 | + |
|
116 | + // Type |
|
117 | + $this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id); |
|
118 | + |
|
119 | + // Juridical Status |
|
120 | + $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->country_code); |
|
121 | + |
|
122 | + // Workforce |
|
123 | + $this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id); |
|
124 | + |
|
125 | + // VAT intra |
|
126 | + $s='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
127 | + if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
128 | + { |
|
129 | + $s.=' '; |
|
130 | + |
|
131 | + if ($conf->use_javascript_ajax) |
|
132 | + { |
|
133 | + $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
134 | + $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
135 | + } |
|
136 | + else |
|
137 | + { |
|
138 | + $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
139 | + } |
|
140 | + } |
|
141 | + else |
|
142 | + { |
|
143 | + $this->tpl['tva_intra'] = $s; |
|
144 | + } |
|
145 | + } |
|
146 | + else |
|
147 | + { |
|
148 | + // Confirm delete third party |
|
149 | + if ($action == 'delete') |
|
150 | + { |
|
151 | + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"1,action-delete"); |
|
152 | + } |
|
153 | + |
|
154 | + for ($i=1; $i<=4; $i++) |
|
155 | + { |
|
156 | + $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
157 | + $this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object); |
|
158 | + $this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object); |
|
159 | + } |
|
160 | + |
|
161 | + // TVA intra |
|
162 | + if ($this->object->tva_intra) |
|
163 | + { |
|
164 | + $s=$this->object->tva_intra; |
|
165 | + $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
166 | + if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
167 | + { |
|
168 | + $s.=' '; |
|
169 | + |
|
170 | + if ($conf->use_javascript_ajax) |
|
171 | + { |
|
172 | + $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
173 | + $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
174 | + } |
|
175 | + else |
|
176 | + { |
|
177 | + $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
178 | + } |
|
179 | + } |
|
180 | + else |
|
181 | + { |
|
182 | + $this->tpl['tva_intra'] = $s; |
|
183 | + } |
|
184 | + } |
|
185 | + else |
|
186 | + { |
|
187 | + $this->tpl['tva_intra'] = ' '; |
|
188 | + } |
|
189 | + |
|
190 | + // Parent company |
|
191 | + if ($this->object->parent) |
|
192 | + { |
|
193 | + $socm = new Societe($this->db); |
|
194 | + $socm->fetch($this->object->parent); |
|
195 | + $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); |
|
196 | + $this->tpl['parent_company'].= ($socm->town ? ' - ' . $socm->town : ''); |
|
197 | + } |
|
198 | + else |
|
199 | + { |
|
200 | + $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); |
|
201 | + } |
|
202 | + } |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * Check permissions of a user to show a page and an object. Check read permission |
|
207 | + * If $_REQUEST['action'] defined, we also check write permission. |
|
208 | + * |
|
209 | + * @param User $user User to check |
|
210 | + * @param string $features Features to check (in most cases, it's module name) |
|
211 | + * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
212 | + * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
213 | + * @param string $feature2 Feature to check (second level of permission) |
|
214 | + * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
215 | + * @param string $dbt_select Field name for select if not rowid. (optional) |
|
216 | + * @return int 1 |
|
217 | + */ |
|
218 | + function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
219 | + { |
|
220 | + return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
221 | + } |
|
222 | 222 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
42 | 42 | { |
43 | - $this->db = $db; |
|
44 | - $this->dirmodule = $dirmodule; |
|
45 | - $this->targetmodule = $targetmodule; |
|
46 | - $this->canvas = $canvas; |
|
47 | - $this->card = $card; |
|
43 | + $this->db = $db; |
|
44 | + $this->dirmodule = $dirmodule; |
|
45 | + $this->targetmodule = $targetmodule; |
|
46 | + $this->canvas = $canvas; |
|
47 | + $this->card = $card; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | { |
58 | 58 | global $langs; |
59 | 59 | |
60 | - $out=''; |
|
60 | + $out = ''; |
|
61 | 61 | |
62 | - if ($action == 'view') $out.= $langs->trans("ThirdParty"); |
|
63 | - if ($action == 'edit') $out.= $langs->trans("EditCompany"); |
|
64 | - if ($action == 'create') $out.= $langs->trans("NewCompany"); |
|
62 | + if ($action == 'view') $out .= $langs->trans("ThirdParty"); |
|
63 | + if ($action == 'edit') $out .= $langs->trans("EditCompany"); |
|
64 | + if ($action == 'create') $out .= $langs->trans("NewCompany"); |
|
65 | 65 | |
66 | 66 | return $out; |
67 | 67 | } |
@@ -76,19 +76,19 @@ discard block |
||
76 | 76 | * @param string $ref Ref of object |
77 | 77 | * @return void |
78 | 78 | */ |
79 | - function assign_values(&$action, $id=0, $ref='') |
|
79 | + function assign_values(&$action, $id = 0, $ref = '') |
|
80 | 80 | { |
81 | 81 | // phpcs:enable |
82 | 82 | global $conf, $langs, $user, $mysoc; |
83 | 83 | global $form, $formadmin, $formcompany; |
84 | 84 | |
85 | - $ret = $this->getObject($id,$ref); |
|
85 | + $ret = $this->getObject($id, $ref); |
|
86 | 86 | |
87 | 87 | parent::assign_values($action); |
88 | 88 | |
89 | 89 | $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); |
90 | 90 | |
91 | - $this->tpl['profid1'] = $this->object->idprof1; |
|
91 | + $this->tpl['profid1'] = $this->object->idprof1; |
|
92 | 92 | $this->tpl['profid2'] = $this->object->idprof2; |
93 | 93 | $this->tpl['profid3'] = $this->object->idprof3; |
94 | 94 | $this->tpl['profid4'] = $this->object->idprof4; |
@@ -96,46 +96,46 @@ discard block |
||
96 | 96 | if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) |
97 | 97 | { |
98 | 98 | $js = "\n"; |
99 | - $js.= '<script language="JavaScript" type="text/javascript">'; |
|
100 | - $js.= "function CheckVAT(a) {\n"; |
|
101 | - $js.= "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n"; |
|
102 | - $js.= "}\n"; |
|
103 | - $js.= '</script>'; |
|
104 | - $js.= "\n"; |
|
99 | + $js .= '<script language="JavaScript" type="text/javascript">'; |
|
100 | + $js .= "function CheckVAT(a) {\n"; |
|
101 | + $js .= "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n"; |
|
102 | + $js .= "}\n"; |
|
103 | + $js .= '</script>'; |
|
104 | + $js .= "\n"; |
|
105 | 105 | $this->tpl['js_checkVatPopup'] = $js; |
106 | 106 | } |
107 | 107 | |
108 | 108 | if ($action == 'create' || $action == 'edit') |
109 | 109 | { |
110 | - for ($i=1; $i<=4; $i++) |
|
110 | + for ($i = 1; $i <= 4; $i++) |
|
111 | 111 | { |
112 | - $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
113 | - $this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->country_code); |
|
112 | + $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i, $this->object->country_code); |
|
113 | + $this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i, 'idprof'.$i, $this->tpl['profid'.$i], $this->object->country_code); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // Type |
117 | - $this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id); |
|
117 | + $this->tpl['select_companytype'] = $form->selectarray("typent_id", $formcompany->typent_array(0), $this->object->typent_id); |
|
118 | 118 | |
119 | 119 | // Juridical Status |
120 | - $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->country_code); |
|
120 | + $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code, $this->object->country_code); |
|
121 | 121 | |
122 | 122 | // Workforce |
123 | - $this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id); |
|
123 | + $this->tpl['select_workforce'] = $form->selectarray("effectif_id", $formcompany->effectif_array(0), $this->object->effectif_id); |
|
124 | 124 | |
125 | 125 | // VAT intra |
126 | - $s='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
126 | + $s = '<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
127 | 127 | if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
128 | 128 | { |
129 | - $s.=' '; |
|
129 | + $s .= ' '; |
|
130 | 130 | |
131 | 131 | if ($conf->use_javascript_ajax) |
132 | 132 | { |
133 | - $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
134 | - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
133 | + $s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
134 | + $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); |
|
135 | 135 | } |
136 | 136 | else |
137 | 137 | { |
138 | - $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
138 | + $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL", $this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').'</a>'; |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | else |
@@ -148,33 +148,33 @@ discard block |
||
148 | 148 | // Confirm delete third party |
149 | 149 | if ($action == 'delete') |
150 | 150 | { |
151 | - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"1,action-delete"); |
|
151 | + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "1,action-delete"); |
|
152 | 152 | } |
153 | 153 | |
154 | - for ($i=1; $i<=4; $i++) |
|
154 | + for ($i = 1; $i <= 4; $i++) |
|
155 | 155 | { |
156 | - $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
157 | - $this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object); |
|
158 | - $this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object); |
|
156 | + $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i, $this->object->country_code); |
|
157 | + $this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i, $this->object); |
|
158 | + $this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i, $this->object); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | // TVA intra |
162 | 162 | if ($this->object->tva_intra) |
163 | 163 | { |
164 | - $s=$this->object->tva_intra; |
|
165 | - $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
164 | + $s = $this->object->tva_intra; |
|
165 | + $s .= '<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
166 | 166 | if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
167 | 167 | { |
168 | - $s.=' '; |
|
168 | + $s .= ' '; |
|
169 | 169 | |
170 | 170 | if ($conf->use_javascript_ajax) |
171 | 171 | { |
172 | - $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
173 | - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
172 | + $s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
173 | + $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); |
|
174 | 174 | } |
175 | 175 | else |
176 | 176 | { |
177 | - $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
177 | + $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL", $this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').'</a>'; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | else |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | { |
193 | 193 | $socm = new Societe($this->db); |
194 | 194 | $socm->fetch($this->object->parent); |
195 | - $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); |
|
196 | - $this->tpl['parent_company'].= ($socm->town ? ' - ' . $socm->town : ''); |
|
195 | + $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client ? "(".$socm->code_client.")" : ""); |
|
196 | + $this->tpl['parent_company'] .= ($socm->town ? ' - '.$socm->town : ''); |
|
197 | 197 | } |
198 | 198 | else |
199 | 199 | { |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param string $dbt_select Field name for select if not rowid. (optional) |
216 | 216 | * @return int 1 |
217 | 217 | */ |
218 | - function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
218 | + function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') |
|
219 | 219 | { |
220 | - return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
220 | + return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); |
|
221 | 221 | } |
222 | 222 | } |
@@ -59,9 +59,15 @@ discard block |
||
59 | 59 | |
60 | 60 | $out=''; |
61 | 61 | |
62 | - if ($action == 'view') $out.= $langs->trans("ThirdParty"); |
|
63 | - if ($action == 'edit') $out.= $langs->trans("EditCompany"); |
|
64 | - if ($action == 'create') $out.= $langs->trans("NewCompany"); |
|
62 | + if ($action == 'view') { |
|
63 | + $out.= $langs->trans("ThirdParty"); |
|
64 | + } |
|
65 | + if ($action == 'edit') { |
|
66 | + $out.= $langs->trans("EditCompany"); |
|
67 | + } |
|
68 | + if ($action == 'create') { |
|
69 | + $out.= $langs->trans("NewCompany"); |
|
70 | + } |
|
65 | 71 | |
66 | 72 | return $out; |
67 | 73 | } |
@@ -132,18 +138,15 @@ discard block |
||
132 | 138 | { |
133 | 139 | $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
134 | 140 | $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
135 | - } |
|
136 | - else |
|
141 | + } else |
|
137 | 142 | { |
138 | 143 | $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
139 | 144 | } |
140 | - } |
|
141 | - else |
|
145 | + } else |
|
142 | 146 | { |
143 | 147 | $this->tpl['tva_intra'] = $s; |
144 | 148 | } |
145 | - } |
|
146 | - else |
|
149 | + } else |
|
147 | 150 | { |
148 | 151 | // Confirm delete third party |
149 | 152 | if ($action == 'delete') |
@@ -171,18 +174,15 @@ discard block |
||
171 | 174 | { |
172 | 175 | $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
173 | 176 | $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
174 | - } |
|
175 | - else |
|
177 | + } else |
|
176 | 178 | { |
177 | 179 | $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
178 | 180 | } |
179 | - } |
|
180 | - else |
|
181 | + } else |
|
181 | 182 | { |
182 | 183 | $this->tpl['tva_intra'] = $s; |
183 | 184 | } |
184 | - } |
|
185 | - else |
|
185 | + } else |
|
186 | 186 | { |
187 | 187 | $this->tpl['tva_intra'] = ' '; |
188 | 188 | } |
@@ -194,8 +194,7 @@ discard block |
||
194 | 194 | $socm->fetch($this->object->parent); |
195 | 195 | $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); |
196 | 196 | $this->tpl['parent_company'].= ($socm->town ? ' - ' . $socm->town : ''); |
197 | - } |
|
198 | - else |
|
197 | + } else |
|
199 | 198 | { |
200 | 199 | $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); |
201 | 200 | } |
@@ -37,47 +37,47 @@ discard block |
||
37 | 37 | var $canvas; |
38 | 38 | var $card; |
39 | 39 | |
40 | - //! Template container |
|
41 | - var $tpl = array(); |
|
42 | - //! Object container |
|
43 | - var $object; |
|
40 | + //! Template container |
|
41 | + var $tpl = array(); |
|
42 | + //! Object container |
|
43 | + var $object; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @var string Error code (or message) |
|
47 | - */ |
|
48 | - public $error=''; |
|
45 | + /** |
|
46 | + * @var string Error code (or message) |
|
47 | + */ |
|
48 | + public $error=''; |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * @var string[] Error codes (or messages) |
|
53 | - */ |
|
54 | - public $errors = array(); |
|
51 | + /** |
|
52 | + * @var string[] Error codes (or messages) |
|
53 | + */ |
|
54 | + public $errors = array(); |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
57 | + /** |
|
58 | 58 | * Get object from id or ref and save it into this->object |
59 | - * |
|
59 | + * |
|
60 | 60 | * @param int $id Object id |
61 | 61 | * @param ref $ref Object ref |
62 | 62 | * @return object Object loaded |
63 | 63 | */ |
64 | 64 | protected function getObject($id,$ref='') |
65 | 65 | { |
66 | - //$ret = $this->getInstanceDao(); |
|
66 | + //$ret = $this->getInstanceDao(); |
|
67 | 67 | |
68 | - $object = new Societe($this->db); |
|
69 | - if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
70 | - $this->object = $object; |
|
68 | + $object = new Societe($this->db); |
|
69 | + if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
70 | + $this->object = $object; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
74 | - /** |
|
75 | - * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
76 | - * |
|
77 | - * @param string $action Type of action |
|
78 | - * @param integer $id Id of object |
|
79 | - * @param string $ref Ref of object |
|
80 | - * @return void |
|
74 | + /** |
|
75 | + * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
76 | + * |
|
77 | + * @param string $action Type of action |
|
78 | + * @param integer $id Id of object |
|
79 | + * @param string $ref Ref of object |
|
80 | + * @return void |
|
81 | 81 | */ |
82 | 82 | function assign_values(&$action, $id=0, $ref='') |
83 | 83 | { |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | |
104 | 104 | if ($action == 'create') |
105 | 105 | { |
106 | - if ($conf->use_javascript_ajax) |
|
107 | - { |
|
108 | - $this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript"> |
|
106 | + if ($conf->use_javascript_ajax) |
|
107 | + { |
|
108 | + $this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript"> |
|
109 | 109 | $(document).ready(function () { |
110 | 110 | $("#radiocompany").click(function() { |
111 | 111 | document.formsoc.action.value="create"; |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | }); |
122 | 122 | }); |
123 | 123 | </script>'."\n"; |
124 | - } |
|
124 | + } |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | if ($action == 'create' || $action == 'edit') |
128 | 128 | { |
129 | - if ($conf->use_javascript_ajax) |
|
130 | - { |
|
131 | - $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> |
|
129 | + if ($conf->use_javascript_ajax) |
|
130 | + { |
|
131 | + $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> |
|
132 | 132 | $(document).ready(function () { |
133 | 133 | $("#selectcountry_id").change(function() { |
134 | 134 | document.formsoc.action.value="'.$action.'"; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | }); |
138 | 138 | }) |
139 | 139 | </script>'."\n"; |
140 | - } |
|
140 | + } |
|
141 | 141 | |
142 | 142 | // Load object modCodeClient |
143 | 143 | $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); |
@@ -173,35 +173,35 @@ discard block |
||
173 | 173 | |
174 | 174 | if (! empty($conf->fournisseur->enabled)) |
175 | 175 | { |
176 | - $this->tpl['supplier_enabled'] = 1; |
|
177 | - |
|
178 | - // Load object modCodeFournisseur |
|
179 | - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; |
|
180 | - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
|
181 | - { |
|
182 | - $module = substr($module, 0, dol_strlen($module)-4); |
|
183 | - } |
|
176 | + $this->tpl['supplier_enabled'] = 1; |
|
177 | + |
|
178 | + // Load object modCodeFournisseur |
|
179 | + $module=$conf->global->SOCIETE_CODECLIENT_ADDON; |
|
180 | + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
|
181 | + { |
|
182 | + $module = substr($module, 0, dol_strlen($module)-4); |
|
183 | + } |
|
184 | 184 | $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); |
185 | 185 | foreach ($dirsociete as $dirroot) |
186 | 186 | { |
187 | 187 | $res=dol_include_once($dirroot.$module.'.php'); |
188 | 188 | if ($res) break; |
189 | 189 | } |
190 | - $modCodeFournisseur = new $module; |
|
191 | - $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; |
|
192 | - // We verified if the tag prefix is used |
|
193 | - if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
194 | - |
|
195 | - // Supplier |
|
196 | - $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
|
197 | - $this->tpl['suppliercode'] = $this->object->code_fournisseur; |
|
198 | - if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
199 | - $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); |
|
200 | - $s=$modCodeFournisseur->getToolTip($langs,$this->object,1); |
|
201 | - $this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1); |
|
202 | - |
|
203 | - $this->object->LoadSupplierCateg(); |
|
204 | - $this->tpl['suppliercategory'] = $this->object->SupplierCategories; |
|
190 | + $modCodeFournisseur = new $module; |
|
191 | + $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; |
|
192 | + // We verified if the tag prefix is used |
|
193 | + if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
194 | + |
|
195 | + // Supplier |
|
196 | + $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
|
197 | + $this->tpl['suppliercode'] = $this->object->code_fournisseur; |
|
198 | + if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
199 | + $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); |
|
200 | + $s=$modCodeFournisseur->getToolTip($langs,$this->object,1); |
|
201 | + $this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1); |
|
202 | + |
|
203 | + $this->object->LoadSupplierCateg(); |
|
204 | + $this->tpl['suppliercategory'] = $this->object->SupplierCategories; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | // Zip |
@@ -306,23 +306,23 @@ discard block |
||
306 | 306 | $nbofsalesrepresentative=count($listsalesrepresentatives); |
307 | 307 | if ($nbofsalesrepresentative > 3) // We print only number |
308 | 308 | { |
309 | - $this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
|
310 | - $this->tpl['sales_representatives'].= $nbofsalesrepresentative; |
|
311 | - $this->tpl['sales_representatives'].= '</a>'; |
|
309 | + $this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
|
310 | + $this->tpl['sales_representatives'].= $nbofsalesrepresentative; |
|
311 | + $this->tpl['sales_representatives'].= '</a>'; |
|
312 | 312 | } |
313 | 313 | else if ($nbofsalesrepresentative > 0) |
314 | 314 | { |
315 | - $userstatic=new User($this->db); |
|
316 | - $i=0; |
|
317 | - foreach($listsalesrepresentatives as $val) |
|
318 | - { |
|
319 | - $userstatic->id=$val['id']; |
|
320 | - $userstatic->lastname=$val['name']; |
|
321 | - $userstatic->firstname=$val['firstname']; |
|
322 | - $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
|
323 | - $i++; |
|
324 | - if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
325 | - } |
|
315 | + $userstatic=new User($this->db); |
|
316 | + $i=0; |
|
317 | + foreach($listsalesrepresentatives as $val) |
|
318 | + { |
|
319 | + $userstatic->id=$val['id']; |
|
320 | + $userstatic->lastname=$val['name']; |
|
321 | + $userstatic->firstname=$val['firstname']; |
|
322 | + $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
|
323 | + $i++; |
|
324 | + if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
325 | + } |
|
326 | 326 | } |
327 | 327 | else $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
328 | 328 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @var string Error code (or message) |
47 | 47 | */ |
48 | - public $error=''; |
|
48 | + public $error = ''; |
|
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | * @param ref $ref Object ref |
62 | 62 | * @return object Object loaded |
63 | 63 | */ |
64 | - protected function getObject($id,$ref='') |
|
64 | + protected function getObject($id, $ref = '') |
|
65 | 65 | { |
66 | 66 | //$ret = $this->getInstanceDao(); |
67 | 67 | |
68 | 68 | $object = new Societe($this->db); |
69 | - if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
69 | + if (!empty($id) || !empty($ref)) $object->fetch($id, $ref); |
|
70 | 70 | $this->object = $object; |
71 | 71 | } |
72 | 72 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param string $ref Ref of object |
80 | 80 | * @return void |
81 | 81 | */ |
82 | - function assign_values(&$action, $id=0, $ref='') |
|
82 | + function assign_values(&$action, $id = 0, $ref = '') |
|
83 | 83 | { |
84 | 84 | // phpcs:enable |
85 | 85 | global $conf, $langs, $user, $mysoc, $canvas; |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | |
88 | 88 | if ($action == 'add' || $action == 'update') $this->assign_post($action); |
89 | 89 | |
90 | - if ($_GET["type"]=='f') { $this->object->fournisseur=1; } |
|
91 | - if ($_GET["type"]=='c') { $this->object->client=1; } |
|
92 | - if ($_GET["type"]=='p') { $this->object->client=2; } |
|
93 | - if ($_GET["type"]=='cp') { $this->object->client=3; } |
|
94 | - if ($_REQUEST["private"]==1) { $this->object->particulier=1; } |
|
90 | + if ($_GET["type"] == 'f') { $this->object->fournisseur = 1; } |
|
91 | + if ($_GET["type"] == 'c') { $this->object->client = 1; } |
|
92 | + if ($_GET["type"] == 'p') { $this->object->client = 2; } |
|
93 | + if ($_GET["type"] == 'cp') { $this->object->client = 3; } |
|
94 | + if ($_REQUEST["private"] == 1) { $this->object->particulier = 1; } |
|
95 | 95 | |
96 | - foreach($this->object as $key => $value) |
|
96 | + foreach ($this->object as $key => $value) |
|
97 | 97 | { |
98 | 98 | $this->tpl[$key] = $value; |
99 | 99 | } |
100 | 100 | |
101 | - $this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors); |
|
102 | - if (is_array($GLOBALS['errors'])) $this->tpl['error'] = get_htmloutput_mesg('',$GLOBALS['errors'],'error'); |
|
101 | + $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors); |
|
102 | + if (is_array($GLOBALS['errors'])) $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error'); |
|
103 | 103 | |
104 | 104 | if ($action == 'create') |
105 | 105 | { |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // Load object modCodeClient |
143 | - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); |
|
143 | + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); |
|
144 | 144 | if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
145 | 145 | { |
146 | - $module = substr($module, 0, dol_strlen($module)-4); |
|
146 | + $module = substr($module, 0, dol_strlen($module) - 4); |
|
147 | 147 | } |
148 | - $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); |
|
148 | + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); |
|
149 | 149 | foreach ($dirsociete as $dirroot) |
150 | 150 | { |
151 | - $res=dol_include_once($dirroot.$module.'.php'); |
|
151 | + $res = dol_include_once($dirroot.$module.'.php'); |
|
152 | 152 | if ($res) break; |
153 | 153 | } |
154 | 154 | $modCodeClient = new $module($db); |
@@ -166,25 +166,25 @@ discard block |
||
166 | 166 | |
167 | 167 | // Customer |
168 | 168 | $this->tpl['customercode'] = $this->object->code_client; |
169 | - if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object,0); |
|
169 | + if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0); |
|
170 | 170 | $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable(); |
171 | - $s=$modCodeClient->getToolTip($langs,$this->object,0); |
|
172 | - $this->tpl['help_customercode'] = $form->textwithpicto('',$s,1); |
|
171 | + $s = $modCodeClient->getToolTip($langs, $this->object, 0); |
|
172 | + $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1); |
|
173 | 173 | |
174 | - if (! empty($conf->fournisseur->enabled)) |
|
174 | + if (!empty($conf->fournisseur->enabled)) |
|
175 | 175 | { |
176 | 176 | $this->tpl['supplier_enabled'] = 1; |
177 | 177 | |
178 | 178 | // Load object modCodeFournisseur |
179 | - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; |
|
179 | + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; |
|
180 | 180 | if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
181 | 181 | { |
182 | - $module = substr($module, 0, dol_strlen($module)-4); |
|
182 | + $module = substr($module, 0, dol_strlen($module) - 4); |
|
183 | 183 | } |
184 | - $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); |
|
184 | + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); |
|
185 | 185 | foreach ($dirsociete as $dirroot) |
186 | 186 | { |
187 | - $res=dol_include_once($dirroot.$module.'.php'); |
|
187 | + $res = dol_include_once($dirroot.$module.'.php'); |
|
188 | 188 | if ($res) break; |
189 | 189 | } |
190 | 190 | $modCodeFournisseur = new $module; |
@@ -193,69 +193,69 @@ discard block |
||
193 | 193 | if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
194 | 194 | |
195 | 195 | // Supplier |
196 | - $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
|
196 | + $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1); |
|
197 | 197 | $this->tpl['suppliercode'] = $this->object->code_fournisseur; |
198 | - if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
198 | + if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1); |
|
199 | 199 | $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); |
200 | - $s=$modCodeFournisseur->getToolTip($langs,$this->object,1); |
|
201 | - $this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1); |
|
200 | + $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1); |
|
201 | + $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1); |
|
202 | 202 | |
203 | 203 | $this->object->LoadSupplierCateg(); |
204 | 204 | $this->tpl['suppliercategory'] = $this->object->SupplierCategories; |
205 | 205 | } |
206 | 206 | |
207 | 207 | // Zip |
208 | - $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); |
|
208 | + $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); |
|
209 | 209 | |
210 | 210 | // Town |
211 | - $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','state_id')); |
|
211 | + $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); |
|
212 | 212 | |
213 | 213 | // Country |
214 | 214 | $this->object->country_id = ($this->object->country_id ? $this->object->country_id : $mysoc->country_id); |
215 | 215 | $this->object->country_code = ($this->object->country_code ? $this->object->country_code : $mysoc->country_code); |
216 | - $this->tpl['select_country'] = $form->select_country($this->object->country_id,'country_id'); |
|
216 | + $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id'); |
|
217 | 217 | $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; |
218 | 218 | |
219 | - if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
219 | + if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
220 | 220 | |
221 | 221 | // State |
222 | - if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code); |
|
222 | + if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code); |
|
223 | 223 | else $this->tpl['select_state'] = $countrynotdefined; |
224 | 224 | |
225 | 225 | // Language |
226 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); |
|
226 | + if (!empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT), 'default_lang', 0, 0, 1); |
|
227 | 227 | |
228 | 228 | // VAT |
229 | - $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation |
|
229 | + $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1); // Assujeti par defaut en creation |
|
230 | 230 | |
231 | 231 | // Select users |
232 | 232 | $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); |
233 | 233 | |
234 | 234 | // Local Tax |
235 | 235 | // TODO mettre dans une classe propre au pays |
236 | - if($mysoc->country_code=='ES') |
|
236 | + if ($mysoc->country_code == 'ES') |
|
237 | 237 | { |
238 | 238 | $this->tpl['localtax'] = ''; |
239 | 239 | |
240 | - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") |
|
240 | + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") |
|
241 | 241 | { |
242 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>'; |
|
243 | - $this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); |
|
244 | - $this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>'; |
|
245 | - $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
|
246 | - $this->tpl['localtax'].= '</td></tr>'; |
|
242 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>'; |
|
243 | + $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); |
|
244 | + $this->tpl['localtax'] .= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>'; |
|
245 | + $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); |
|
246 | + $this->tpl['localtax'] .= '</td></tr>'; |
|
247 | 247 | } |
248 | - elseif($mysoc->localtax1_assuj=="1") |
|
248 | + elseif ($mysoc->localtax1_assuj == "1") |
|
249 | 249 | { |
250 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; |
|
251 | - $this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); |
|
252 | - $this->tpl['localtax'].= '</td><tr>'; |
|
250 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; |
|
251 | + $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); |
|
252 | + $this->tpl['localtax'] .= '</td><tr>'; |
|
253 | 253 | } |
254 | - elseif($mysoc->localtax2_assuj=="1") |
|
254 | + elseif ($mysoc->localtax2_assuj == "1") |
|
255 | 255 | { |
256 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; |
|
257 | - $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
|
258 | - $this->tpl['localtax'].= '</td><tr>'; |
|
256 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; |
|
257 | + $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); |
|
258 | + $this->tpl['localtax'] .= '</td><tr>'; |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
@@ -263,78 +263,78 @@ discard block |
||
263 | 263 | { |
264 | 264 | $head = societe_prepare_head($this->object); |
265 | 265 | |
266 | - $this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company'); |
|
267 | - $this->tpl['showend']=dol_get_fiche_end(); |
|
266 | + $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company'); |
|
267 | + $this->tpl['showend'] = dol_get_fiche_end(); |
|
268 | 268 | |
269 | - $this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom'); |
|
269 | + $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); |
|
270 | 270 | |
271 | 271 | $this->tpl['checkcustomercode'] = $this->object->check_codeclient(); |
272 | 272 | $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur(); |
273 | - $this->tpl['address'] = dol_nl2br($this->object->address); |
|
273 | + $this->tpl['address'] = dol_nl2br($this->object->address); |
|
274 | 274 | |
275 | - $img=picto_from_langcode($this->object->country_code); |
|
276 | - if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); |
|
277 | - $this->tpl['country'] = ($img?$img.' ':'').$this->object->country; |
|
275 | + $img = picto_from_langcode($this->object->country_code); |
|
276 | + if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img ? $img.' ' : '').$this->object->country, $langs->trans("CountryIsInEEC"), 1, 0); |
|
277 | + $this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country; |
|
278 | 278 | |
279 | - $this->tpl['phone'] = dol_print_phone($this->object->phone,$this->object->country_code,0,$this->object->id,'AC_TEL'); |
|
280 | - $this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->country_code,0,$this->object->id,'AC_FAX'); |
|
281 | - $this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL'); |
|
279 | + $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); |
|
280 | + $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX'); |
|
281 | + $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL'); |
|
282 | 282 | $this->tpl['url'] = dol_print_url($this->object->url); |
283 | 283 | |
284 | - $this->tpl['tva_assuj'] = yn($this->object->tva_assuj); |
|
284 | + $this->tpl['tva_assuj'] = yn($this->object->tva_assuj); |
|
285 | 285 | |
286 | 286 | // Third party type |
287 | 287 | $arr = $formcompany->typent_array(1); |
288 | 288 | $this->tpl['typent'] = $arr[$this->object->typent_code]; |
289 | 289 | |
290 | - if (! empty($conf->global->MAIN_MULTILANGS)) |
|
290 | + if (!empty($conf->global->MAIN_MULTILANGS)) |
|
291 | 291 | { |
292 | 292 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
293 | 293 | //$s=picto_from_langcode($this->default_lang); |
294 | 294 | //print ($s?$s.' ':''); |
295 | 295 | $langs->load("languages"); |
296 | - $this->tpl['default_lang'] = ($this->default_lang?$langs->trans('Language_'.$this->object->default_lang):''); |
|
296 | + $this->tpl['default_lang'] = ($this->default_lang ? $langs->trans('Language_'.$this->object->default_lang) : ''); |
|
297 | 297 | } |
298 | 298 | |
299 | - $this->tpl['image_edit'] = img_edit(); |
|
299 | + $this->tpl['image_edit'] = img_edit(); |
|
300 | 300 | |
301 | - $this->tpl['display_rib'] = $this->object->display_rib(); |
|
301 | + $this->tpl['display_rib'] = $this->object->display_rib(); |
|
302 | 302 | |
303 | 303 | // Sales representatives |
304 | 304 | $this->tpl['sales_representatives'] = ''; |
305 | - $listsalesrepresentatives=$this->object->getSalesRepresentatives($user); |
|
306 | - $nbofsalesrepresentative=count($listsalesrepresentatives); |
|
305 | + $listsalesrepresentatives = $this->object->getSalesRepresentatives($user); |
|
306 | + $nbofsalesrepresentative = count($listsalesrepresentatives); |
|
307 | 307 | if ($nbofsalesrepresentative > 3) // We print only number |
308 | 308 | { |
309 | - $this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
|
310 | - $this->tpl['sales_representatives'].= $nbofsalesrepresentative; |
|
311 | - $this->tpl['sales_representatives'].= '</a>'; |
|
309 | + $this->tpl['sales_representatives'] .= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
|
310 | + $this->tpl['sales_representatives'] .= $nbofsalesrepresentative; |
|
311 | + $this->tpl['sales_representatives'] .= '</a>'; |
|
312 | 312 | } |
313 | 313 | else if ($nbofsalesrepresentative > 0) |
314 | 314 | { |
315 | - $userstatic=new User($this->db); |
|
316 | - $i=0; |
|
317 | - foreach($listsalesrepresentatives as $val) |
|
315 | + $userstatic = new User($this->db); |
|
316 | + $i = 0; |
|
317 | + foreach ($listsalesrepresentatives as $val) |
|
318 | 318 | { |
319 | - $userstatic->id=$val['id']; |
|
320 | - $userstatic->lastname=$val['name']; |
|
321 | - $userstatic->firstname=$val['firstname']; |
|
322 | - $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
|
319 | + $userstatic->id = $val['id']; |
|
320 | + $userstatic->lastname = $val['name']; |
|
321 | + $userstatic->firstname = $val['firstname']; |
|
322 | + $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1); |
|
323 | 323 | $i++; |
324 | - if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
324 | + if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'] .= ', '; |
|
325 | 325 | } |
326 | 326 | } |
327 | - else $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
|
327 | + else $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected"); |
|
328 | 328 | |
329 | 329 | // Linked member |
330 | - if (! empty($conf->adherent->enabled)) |
|
330 | + if (!empty($conf->adherent->enabled)) |
|
331 | 331 | { |
332 | 332 | $langs->load("members"); |
333 | - $adh=new Adherent($this->db); |
|
334 | - $result=$adh->fetch('','',$this->object->id); |
|
333 | + $adh = new Adherent($this->db); |
|
334 | + $result = $adh->fetch('', '', $this->object->id); |
|
335 | 335 | if ($result > 0) |
336 | 336 | { |
337 | - $adh->ref=$adh->getFullName($langs); |
|
337 | + $adh->ref = $adh->getFullName($langs); |
|
338 | 338 | $this->tpl['linked_member'] = $adh->getNomUrl(1); |
339 | 339 | } |
340 | 340 | else |
@@ -345,26 +345,26 @@ discard block |
||
345 | 345 | |
346 | 346 | // Local Tax |
347 | 347 | // TODO mettre dans une classe propre au pays |
348 | - if($mysoc->country_code=='ES') |
|
348 | + if ($mysoc->country_code == 'ES') |
|
349 | 349 | { |
350 | 350 | $this->tpl['localtax'] = ''; |
351 | 351 | |
352 | - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") |
|
352 | + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") |
|
353 | 353 | { |
354 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
355 | - $this->tpl['localtax'].= '<td>'.yn($this->object->localtax1_assuj).'</td>'; |
|
356 | - $this->tpl['localtax'].= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
357 | - $this->tpl['localtax'].= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
354 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
355 | + $this->tpl['localtax'] .= '<td>'.yn($this->object->localtax1_assuj).'</td>'; |
|
356 | + $this->tpl['localtax'] .= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
357 | + $this->tpl['localtax'] .= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
358 | 358 | } |
359 | - elseif($mysoc->localtax1_assuj=="1") |
|
359 | + elseif ($mysoc->localtax1_assuj == "1") |
|
360 | 360 | { |
361 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
362 | - $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>'; |
|
361 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
362 | + $this->tpl['localtax'] .= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>'; |
|
363 | 363 | } |
364 | - elseif($mysoc->localtax2_assuj=="1") |
|
364 | + elseif ($mysoc->localtax2_assuj == "1") |
|
365 | 365 | { |
366 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
367 | - $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
366 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
367 | + $this->tpl['localtax'] .= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | } |
@@ -382,47 +382,47 @@ discard block |
||
382 | 382 | // phpcs:enable |
383 | 383 | global $langs, $mysoc; |
384 | 384 | |
385 | - $this->object->id = $_POST["socid"]; |
|
386 | - $this->object->name = $_POST["nom"]; |
|
387 | - $this->object->prefix_comm = $_POST["prefix_comm"]; |
|
388 | - $this->object->client = $_POST["client"]; |
|
389 | - $this->object->code_client = $_POST["code_client"]; |
|
390 | - $this->object->fournisseur = $_POST["fournisseur"]; |
|
391 | - $this->object->code_fournisseur = $_POST["code_fournisseur"]; |
|
392 | - $this->object->address = $_POST["adresse"]; |
|
393 | - $this->object->zip = $_POST["zipcode"]; |
|
394 | - $this->object->town = $_POST["town"]; |
|
395 | - $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; |
|
396 | - $this->object->state_id = $_POST["state_id"]; |
|
397 | - $this->object->phone = $_POST["tel"]; |
|
398 | - $this->object->fax = $_POST["fax"]; |
|
399 | - $this->object->email = $_POST["email"]; |
|
400 | - $this->object->url = $_POST["url"]; |
|
401 | - $this->object->capital = $_POST["capital"]; |
|
402 | - $this->object->idprof1 = $_POST["idprof1"]; |
|
403 | - $this->object->idprof2 = $_POST["idprof2"]; |
|
404 | - $this->object->idprof3 = $_POST["idprof3"]; |
|
405 | - $this->object->idprof4 = $_POST["idprof4"]; |
|
406 | - $this->object->typent_id = $_POST["typent_id"]; |
|
407 | - $this->object->effectif_id = $_POST["effectif_id"]; |
|
408 | - $this->object->barcode = $_POST["barcode"]; |
|
409 | - $this->object->forme_juridique_code = $_POST["forme_juridique_code"]; |
|
410 | - $this->object->default_lang = $_POST["default_lang"]; |
|
411 | - $this->object->commercial_id = $_POST["commercial_id"]; |
|
412 | - |
|
413 | - $this->object->tva_assuj = $_POST["assujtva_value"]?$_POST["assujtva_value"]:1; |
|
414 | - $this->object->tva_intra = $_POST["tva_intra"]; |
|
385 | + $this->object->id = $_POST["socid"]; |
|
386 | + $this->object->name = $_POST["nom"]; |
|
387 | + $this->object->prefix_comm = $_POST["prefix_comm"]; |
|
388 | + $this->object->client = $_POST["client"]; |
|
389 | + $this->object->code_client = $_POST["code_client"]; |
|
390 | + $this->object->fournisseur = $_POST["fournisseur"]; |
|
391 | + $this->object->code_fournisseur = $_POST["code_fournisseur"]; |
|
392 | + $this->object->address = $_POST["adresse"]; |
|
393 | + $this->object->zip = $_POST["zipcode"]; |
|
394 | + $this->object->town = $_POST["town"]; |
|
395 | + $this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id; |
|
396 | + $this->object->state_id = $_POST["state_id"]; |
|
397 | + $this->object->phone = $_POST["tel"]; |
|
398 | + $this->object->fax = $_POST["fax"]; |
|
399 | + $this->object->email = $_POST["email"]; |
|
400 | + $this->object->url = $_POST["url"]; |
|
401 | + $this->object->capital = $_POST["capital"]; |
|
402 | + $this->object->idprof1 = $_POST["idprof1"]; |
|
403 | + $this->object->idprof2 = $_POST["idprof2"]; |
|
404 | + $this->object->idprof3 = $_POST["idprof3"]; |
|
405 | + $this->object->idprof4 = $_POST["idprof4"]; |
|
406 | + $this->object->typent_id = $_POST["typent_id"]; |
|
407 | + $this->object->effectif_id = $_POST["effectif_id"]; |
|
408 | + $this->object->barcode = $_POST["barcode"]; |
|
409 | + $this->object->forme_juridique_code = $_POST["forme_juridique_code"]; |
|
410 | + $this->object->default_lang = $_POST["default_lang"]; |
|
411 | + $this->object->commercial_id = $_POST["commercial_id"]; |
|
412 | + |
|
413 | + $this->object->tva_assuj = $_POST["assujtva_value"] ? $_POST["assujtva_value"] : 1; |
|
414 | + $this->object->tva_intra = $_POST["tva_intra"]; |
|
415 | 415 | |
416 | 416 | //Local Taxes |
417 | - $this->object->localtax1_assuj = $_POST["localtax1assuj_value"]; |
|
418 | - $this->object->localtax2_assuj = $_POST["localtax2assuj_value"]; |
|
417 | + $this->object->localtax1_assuj = $_POST["localtax1assuj_value"]; |
|
418 | + $this->object->localtax2_assuj = $_POST["localtax2assuj_value"]; |
|
419 | 419 | |
420 | 420 | // We set country_id, and country_code label of the chosen country |
421 | 421 | if ($this->object->country_id) |
422 | 422 | { |
423 | - $tmparray=getCountry($this->object->country_id,'all',$this->db,$langs,0); |
|
424 | - $this->object->country_code = $tmparray['code']; |
|
425 | - $this->object->country_label= $tmparray['label']; |
|
423 | + $tmparray = getCountry($this->object->country_id, 'all', $this->db, $langs, 0); |
|
424 | + $this->object->country_code = $tmparray['code']; |
|
425 | + $this->object->country_label = $tmparray['label']; |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | } |
@@ -66,7 +66,9 @@ discard block |
||
66 | 66 | //$ret = $this->getInstanceDao(); |
67 | 67 | |
68 | 68 | $object = new Societe($this->db); |
69 | - if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
69 | + if (! empty($id) || ! empty($ref)) { |
|
70 | + $object->fetch($id,$ref); |
|
71 | + } |
|
70 | 72 | $this->object = $object; |
71 | 73 | } |
72 | 74 | |
@@ -85,7 +87,9 @@ discard block |
||
85 | 87 | global $conf, $langs, $user, $mysoc, $canvas; |
86 | 88 | global $form, $formadmin, $formcompany; |
87 | 89 | |
88 | - if ($action == 'add' || $action == 'update') $this->assign_post($action); |
|
90 | + if ($action == 'add' || $action == 'update') { |
|
91 | + $this->assign_post($action); |
|
92 | + } |
|
89 | 93 | |
90 | 94 | if ($_GET["type"]=='f') { $this->object->fournisseur=1; } |
91 | 95 | if ($_GET["type"]=='c') { $this->object->client=1; } |
@@ -99,7 +103,9 @@ discard block |
||
99 | 103 | } |
100 | 104 | |
101 | 105 | $this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors); |
102 | - if (is_array($GLOBALS['errors'])) $this->tpl['error'] = get_htmloutput_mesg('',$GLOBALS['errors'],'error'); |
|
106 | + if (is_array($GLOBALS['errors'])) { |
|
107 | + $this->tpl['error'] = get_htmloutput_mesg('',$GLOBALS['errors'],'error'); |
|
108 | + } |
|
103 | 109 | |
104 | 110 | if ($action == 'create') |
105 | 111 | { |
@@ -149,12 +155,16 @@ discard block |
||
149 | 155 | foreach ($dirsociete as $dirroot) |
150 | 156 | { |
151 | 157 | $res=dol_include_once($dirroot.$module.'.php'); |
152 | - if ($res) break; |
|
158 | + if ($res) { |
|
159 | + break; |
|
160 | + } |
|
153 | 161 | } |
154 | 162 | $modCodeClient = new $module($db); |
155 | 163 | $this->tpl['auto_customercode'] = $modCodeClient->code_auto; |
156 | 164 | // We verified if the tag prefix is used |
157 | - if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); |
|
165 | + if ($modCodeClient->code_auto) { |
|
166 | + $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); |
|
167 | + } |
|
158 | 168 | |
159 | 169 | // TODO create a function |
160 | 170 | $this->tpl['select_customertype'] = Form::selectarray('client', array( |
@@ -166,7 +176,9 @@ discard block |
||
166 | 176 | |
167 | 177 | // Customer |
168 | 178 | $this->tpl['customercode'] = $this->object->code_client; |
169 | - if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object,0); |
|
179 | + if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) { |
|
180 | + $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object,0); |
|
181 | + } |
|
170 | 182 | $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable(); |
171 | 183 | $s=$modCodeClient->getToolTip($langs,$this->object,0); |
172 | 184 | $this->tpl['help_customercode'] = $form->textwithpicto('',$s,1); |
@@ -185,17 +197,23 @@ discard block |
||
185 | 197 | foreach ($dirsociete as $dirroot) |
186 | 198 | { |
187 | 199 | $res=dol_include_once($dirroot.$module.'.php'); |
188 | - if ($res) break; |
|
200 | + if ($res) { |
|
201 | + break; |
|
202 | + } |
|
189 | 203 | } |
190 | 204 | $modCodeFournisseur = new $module; |
191 | 205 | $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; |
192 | 206 | // We verified if the tag prefix is used |
193 | - if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
207 | + if ($modCodeFournisseur->code_auto) { |
|
208 | + $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
209 | + } |
|
194 | 210 | |
195 | 211 | // Supplier |
196 | 212 | $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
197 | 213 | $this->tpl['suppliercode'] = $this->object->code_fournisseur; |
198 | - if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
214 | + if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { |
|
215 | + $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
216 | + } |
|
199 | 217 | $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); |
200 | 218 | $s=$modCodeFournisseur->getToolTip($langs,$this->object,1); |
201 | 219 | $this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1); |
@@ -216,14 +234,21 @@ discard block |
||
216 | 234 | $this->tpl['select_country'] = $form->select_country($this->object->country_id,'country_id'); |
217 | 235 | $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; |
218 | 236 | |
219 | - if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
237 | + if ($user->admin) { |
|
238 | + $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
239 | + } |
|
220 | 240 | |
221 | 241 | // State |
222 | - if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code); |
|
223 | - else $this->tpl['select_state'] = $countrynotdefined; |
|
242 | + if ($this->object->country_id) { |
|
243 | + $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code); |
|
244 | + } else { |
|
245 | + $this->tpl['select_state'] = $countrynotdefined; |
|
246 | + } |
|
224 | 247 | |
225 | 248 | // Language |
226 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); |
|
249 | + if (! empty($conf->global->MAIN_MULTILANGS)) { |
|
250 | + $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); |
|
251 | + } |
|
227 | 252 | |
228 | 253 | // VAT |
229 | 254 | $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation |
@@ -244,22 +269,19 @@ discard block |
||
244 | 269 | $this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>'; |
245 | 270 | $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
246 | 271 | $this->tpl['localtax'].= '</td></tr>'; |
247 | - } |
|
248 | - elseif($mysoc->localtax1_assuj=="1") |
|
272 | + } elseif($mysoc->localtax1_assuj=="1") |
|
249 | 273 | { |
250 | 274 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; |
251 | 275 | $this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); |
252 | 276 | $this->tpl['localtax'].= '</td><tr>'; |
253 | - } |
|
254 | - elseif($mysoc->localtax2_assuj=="1") |
|
277 | + } elseif($mysoc->localtax2_assuj=="1") |
|
255 | 278 | { |
256 | 279 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; |
257 | 280 | $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
258 | 281 | $this->tpl['localtax'].= '</td><tr>'; |
259 | 282 | } |
260 | 283 | } |
261 | - } |
|
262 | - else |
|
284 | + } else |
|
263 | 285 | { |
264 | 286 | $head = societe_prepare_head($this->object); |
265 | 287 | |
@@ -273,7 +295,9 @@ discard block |
||
273 | 295 | $this->tpl['address'] = dol_nl2br($this->object->address); |
274 | 296 | |
275 | 297 | $img=picto_from_langcode($this->object->country_code); |
276 | - if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); |
|
298 | + if ($this->object->isInEEC()) { |
|
299 | + $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); |
|
300 | + } |
|
277 | 301 | $this->tpl['country'] = ($img?$img.' ':'').$this->object->country; |
278 | 302 | |
279 | 303 | $this->tpl['phone'] = dol_print_phone($this->object->phone,$this->object->country_code,0,$this->object->id,'AC_TEL'); |
@@ -304,13 +328,14 @@ discard block |
||
304 | 328 | $this->tpl['sales_representatives'] = ''; |
305 | 329 | $listsalesrepresentatives=$this->object->getSalesRepresentatives($user); |
306 | 330 | $nbofsalesrepresentative=count($listsalesrepresentatives); |
307 | - if ($nbofsalesrepresentative > 3) // We print only number |
|
331 | + if ($nbofsalesrepresentative > 3) { |
|
332 | + // We print only number |
|
308 | 333 | { |
309 | 334 | $this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
335 | + } |
|
310 | 336 | $this->tpl['sales_representatives'].= $nbofsalesrepresentative; |
311 | 337 | $this->tpl['sales_representatives'].= '</a>'; |
312 | - } |
|
313 | - else if ($nbofsalesrepresentative > 0) |
|
338 | + } else if ($nbofsalesrepresentative > 0) |
|
314 | 339 | { |
315 | 340 | $userstatic=new User($this->db); |
316 | 341 | $i=0; |
@@ -321,10 +346,13 @@ discard block |
||
321 | 346 | $userstatic->firstname=$val['firstname']; |
322 | 347 | $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
323 | 348 | $i++; |
324 | - if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
349 | + if ($i < $nbofsalesrepresentative) { |
|
350 | + $this->tpl['sales_representatives'].= ', '; |
|
351 | + } |
|
325 | 352 | } |
353 | + } else { |
|
354 | + $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
|
326 | 355 | } |
327 | - else $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
|
328 | 356 | |
329 | 357 | // Linked member |
330 | 358 | if (! empty($conf->adherent->enabled)) |
@@ -336,8 +364,7 @@ discard block |
||
336 | 364 | { |
337 | 365 | $adh->ref=$adh->getFullName($langs); |
338 | 366 | $this->tpl['linked_member'] = $adh->getNomUrl(1); |
339 | - } |
|
340 | - else |
|
367 | + } else |
|
341 | 368 | { |
342 | 369 | $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember"); |
343 | 370 | } |
@@ -355,13 +382,11 @@ discard block |
||
355 | 382 | $this->tpl['localtax'].= '<td>'.yn($this->object->localtax1_assuj).'</td>'; |
356 | 383 | $this->tpl['localtax'].= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
357 | 384 | $this->tpl['localtax'].= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>'; |
358 | - } |
|
359 | - elseif($mysoc->localtax1_assuj=="1") |
|
385 | + } elseif($mysoc->localtax1_assuj=="1") |
|
360 | 386 | { |
361 | 387 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
362 | 388 | $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>'; |
363 | - } |
|
364 | - elseif($mysoc->localtax2_assuj=="1") |
|
389 | + } elseif($mysoc->localtax2_assuj=="1") |
|
365 | 390 | { |
366 | 391 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
367 | 392 | $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>'; |
@@ -19,8 +19,8 @@ |
||
19 | 19 | // Protection to avoid direct call of template |
20 | 20 | if (empty($conf) || ! is_object($conf)) |
21 | 21 | { |
22 | - print "Error, template page can't be called as URL"; |
|
23 | - exit; |
|
22 | + print "Error, template page can't be called as URL"; |
|
23 | + exit; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | ?> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | // Protection to avoid direct call of template |
20 | -if (empty($conf) || ! is_object($conf)) |
|
20 | +if (empty($conf) || !is_object($conf)) |
|
21 | 21 | { |
22 | 22 | print "Error, template page can't be called as URL"; |
23 | 23 | exit; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <tr> |
59 | 59 | <td><span class="fieldrequired"><?php echo $langs->trans('LastName'); ?></span></td> |
60 | 60 | <td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td> |
61 | - <?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
61 | + <?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
62 | 62 | <td><?php echo $langs->trans('Prefix'); ?></td> |
63 | 63 | <td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>"></td> |
64 | 64 | <?php } ?> |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | </tr> |
114 | 114 | <?php } }?> |
115 | 115 | |
116 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
116 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
117 | 117 | <tr> |
118 | 118 | <td><?php echo $langs->trans('Gencod'); ?></td> |
119 | 119 | <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td> |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | </tr> |
151 | 151 | |
152 | 152 | <tr> |
153 | - <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td> |
|
153 | + <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td> |
|
154 | 154 | <td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td> |
155 | 155 | <td><?php echo $langs->trans('Web'); ?></td> |
156 | 156 | <td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td> |
157 | 157 | </tr> |
158 | 158 | |
159 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
159 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
160 | 160 | <tr> |
161 | 161 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
162 | 162 | <td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | <td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td> |
169 | 169 | </tr> |
170 | 170 | |
171 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
171 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
172 | 172 | |
173 | 173 | <?php if ($user->rights->societe->client->voir) { ?> |
174 | 174 | <tr> |
@@ -168,7 +168,10 @@ |
||
168 | 168 | <td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td> |
169 | 169 | </tr> |
170 | 170 | |
171 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
171 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
172 | + echo $this->control->tpl['localtax']; |
|
173 | +} |
|
174 | +?> |
|
172 | 175 | |
173 | 176 | <?php if ($user->rights->societe->client->voir) { ?> |
174 | 177 | <tr> |
@@ -18,8 +18,8 @@ |
||
18 | 18 | // Protection to avoid direct call of template |
19 | 19 | if (empty($conf) || ! is_object($conf)) |
20 | 20 | { |
21 | - print "Error, template page can't be called as URL"; |
|
22 | - exit; |
|
21 | + print "Error, template page can't be called as URL"; |
|
22 | + exit; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Protection to avoid direct call of template |
19 | -if (empty($conf) || ! is_object($conf)) |
|
19 | +if (empty($conf) || !is_object($conf)) |
|
20 | 20 | { |
21 | 21 | print "Error, template page can't be called as URL"; |
22 | 22 | exit; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $head = societe_prepare_head($object); |
34 | 34 | |
35 | -dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); |
|
35 | +dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); |
|
36 | 36 | |
37 | 37 | ?> |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | <td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td> |
47 | 47 | </tr> |
48 | 48 | |
49 | -<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
49 | +<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
50 | 50 | <tr> |
51 | 51 | <td><?php echo $langs->trans('Prefix'); ?></td> |
52 | 52 | <td colspan="3"><?php echo $this->control->tpl['prefix_comm']; ?></td> |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | </tr> |
76 | 76 | <?php } ?> |
77 | 77 | |
78 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
78 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
79 | 79 | <tr> |
80 | 80 | <td><?php echo $langs->trans('Gencod'); ?></td> |
81 | 81 | <td colspan="3"><?php echo $this->control->tpl['barcode']; ?></td> |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | <td colspan="3"><?php echo $this->control->tpl['tva_assuj']; ?></td> |
124 | 124 | </tr> |
125 | 125 | |
126 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
126 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
127 | 127 | |
128 | 128 | <tr> |
129 | 129 | <td><?php echo $langs->trans("Type"); ?></td> |
130 | 130 | <td colspan="3"><?php echo $this->control->tpl['typent']; ?></td> |
131 | 131 | </tr> |
132 | 132 | |
133 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
133 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
134 | 134 | <tr> |
135 | 135 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
136 | 136 | <td colspan="3"><?php echo $this->control->tpl['default_lang']; ?></td> |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | </tr> |
171 | 171 | </table> |
172 | 172 | </td> |
173 | - <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
173 | + <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
174 | 174 | </tr> |
175 | 175 | |
176 | -<?php if (! empty($conf->adherent->enabled)) { ?> |
|
176 | +<?php if (!empty($conf->adherent->enabled)) { ?> |
|
177 | 177 | <tr> |
178 | 178 | <td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td> |
179 | 179 | <td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td> |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | <?php if ($user->rights->societe->supprimer) { ?> |
193 | 193 | <?php if ($conf->use_javascript_ajax) { ?> |
194 | 194 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
195 | - <?php } else { ?> |
|
195 | + <?php } else { ?> |
|
196 | 196 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
197 | 197 | <?php } ?> |
198 | 198 | <?php } ?> |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | /* |
207 | 207 | * Documents generes |
208 | 208 | */ |
209 | -$filedir=$conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
210 | -$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid; |
|
211 | -$genallowed=$user->rights->societe->lire; |
|
212 | -$delallowed=$user->rights->societe->creer; |
|
209 | +$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
210 | +$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid; |
|
211 | +$genallowed = $user->rights->societe->lire; |
|
212 | +$delallowed = $user->rights->societe->creer; |
|
213 | 213 | |
214 | -print $formfile->showdocuments('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); |
|
214 | +print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang); |
|
215 | 215 | ?> |
216 | 216 | |
217 | 217 | </td> |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | |
224 | 224 | <?php |
225 | 225 | // Subsidiaries list |
226 | -$result=show_subsidiaries($conf,$langs,$db,$object); |
|
226 | +$result = show_subsidiaries($conf, $langs, $db, $object); |
|
227 | 227 | |
228 | 228 | // Contacts list |
229 | -$result=show_contacts($conf,$langs,$db,$object); |
|
229 | +$result = show_contacts($conf, $langs, $db, $object); |
|
230 | 230 | |
231 | 231 | // Projects list |
232 | -$result=show_projects($conf,$langs,$db,$object); |
|
232 | +$result = show_projects($conf, $langs, $db, $object); |
|
233 | 233 | ?> |
234 | 234 | |
235 | 235 | <!-- END PHP TEMPLATE --> |
236 | 236 | \ No newline at end of file |
@@ -36,8 +36,14 @@ discard block |
||
36 | 36 | |
37 | 37 | ?> |
38 | 38 | |
39 | -<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?> |
|
40 | -<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?> |
|
39 | +<?php if ($this->control->tpl['error']) { |
|
40 | + echo $this->control->tpl['error']; |
|
41 | +} |
|
42 | +?> |
|
43 | +<?php if ($this->control->tpl['action_delete']) { |
|
44 | + echo $this->control->tpl['action_delete']; |
|
45 | +} |
|
46 | +?> |
|
41 | 47 | |
42 | 48 | <table class="border allwidth"> |
43 | 49 | |
@@ -123,7 +129,10 @@ discard block |
||
123 | 129 | <td colspan="3"><?php echo $this->control->tpl['tva_assuj']; ?></td> |
124 | 130 | </tr> |
125 | 131 | |
126 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
132 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
133 | + echo $this->control->tpl['localtax']; |
|
134 | +} |
|
135 | +?> |
|
127 | 136 | |
128 | 137 | <tr> |
129 | 138 | <td><?php echo $langs->trans("Type"); ?></td> |
@@ -192,7 +201,7 @@ discard block |
||
192 | 201 | <?php if ($user->rights->societe->supprimer) { ?> |
193 | 202 | <?php if ($conf->use_javascript_ajax) { ?> |
194 | 203 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
195 | - <?php } else { ?> |
|
204 | + <?php } else { ?> |
|
196 | 205 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
197 | 206 | <?php } ?> |
198 | 207 | <?php } ?> |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | // Protection to avoid direct call of template |
20 | 20 | if (empty($conf) || ! is_object($conf)) |
21 | 21 | { |
22 | - print "Error, template page can't be called as URL"; |
|
23 | - exit; |
|
22 | + print "Error, template page can't be called as URL"; |
|
23 | + exit; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | ?> |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | <?php |
110 | 110 | if ($this->control->tpl['fournisseur']) { |
111 | - if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
111 | + if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
112 | 112 | <tr> |
113 | 113 | <td><?php echo $langs->trans('SupplierCategory'); ?></td> |
114 | 114 | <td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | // Protection to avoid direct call of template |
20 | -if (empty($conf) || ! is_object($conf)) |
|
20 | +if (empty($conf) || !is_object($conf)) |
|
21 | 21 | { |
22 | 22 | print "Error, template page can't be called as URL"; |
23 | 23 | exit; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | <td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td> |
51 | 51 | </tr> |
52 | 52 | |
53 | -<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
53 | +<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
54 | 54 | <tr> |
55 | 55 | <td><?php echo $langs->trans("Prefix"); ?></td> |
56 | 56 | <td colspan="3"> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | </tr> |
116 | 116 | <?php } }?> |
117 | 117 | |
118 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
118 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
119 | 119 | <tr> |
120 | 120 | <td><?php echo $langs->trans('Gencod'); ?></td> |
121 | 121 | <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td> |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | </tr> |
153 | 153 | |
154 | 154 | <tr> |
155 | - <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td> |
|
155 | + <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td> |
|
156 | 156 | <td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td> |
157 | 157 | <td><?php echo $langs->trans('Web'); ?></td> |
158 | 158 | <td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td> |
159 | 159 | </tr> |
160 | 160 | |
161 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
161 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
162 | 162 | <tr> |
163 | 163 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
164 | 164 | <td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td> |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | <td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td> |
171 | 171 | </tr> |
172 | 172 | |
173 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
173 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
174 | 174 | |
175 | 175 | </table> |
176 | 176 | <br> |
@@ -170,7 +170,10 @@ |
||
170 | 170 | <td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td> |
171 | 171 | </tr> |
172 | 172 | |
173 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
173 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
174 | + echo $this->control->tpl['localtax']; |
|
175 | +} |
|
176 | +?> |
|
174 | 177 | |
175 | 178 | </table> |
176 | 179 | <br> |
@@ -29,22 +29,22 @@ discard block |
||
29 | 29 | class ActionsCardIndividual extends ActionsCardCommon |
30 | 30 | { |
31 | 31 | /** |
32 | - * Constructor |
|
33 | - * |
|
32 | + * Constructor |
|
33 | + * |
|
34 | 34 | * @param DoliDB $db Handler acces base de donnees |
35 | 35 | * @param string $dirmodule Name of directory of module |
36 | 36 | * @param string $targetmodule Name of directory of module where canvas is stored |
37 | 37 | * @param string $canvas Name of canvas |
38 | 38 | * @param string $card Name of tab (sub-canvas) |
39 | 39 | */ |
40 | - function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
41 | - { |
|
42 | - $this->db = $db; |
|
43 | - $this->dirmodule = $dirmodule; |
|
44 | - $this->targetmodule = $targetmodule; |
|
40 | + function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
41 | + { |
|
42 | + $this->db = $db; |
|
43 | + $this->dirmodule = $dirmodule; |
|
44 | + $this->targetmodule = $targetmodule; |
|
45 | 45 | $this->canvas = $canvas; |
46 | 46 | $this->card = $card; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
@@ -67,73 +67,73 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * Execute actions |
|
70 | + /** |
|
71 | + * Execute actions |
|
72 | 72 | * @deprecated Use the doActions of hooks instead of this. |
73 | - * |
|
74 | - * @param string $action Action |
|
75 | - * @param int $id Id of object (may be empty for creation) |
|
76 | - * @return int <0 if KO, >0 if OK |
|
77 | - */ |
|
78 | - function doActions(&$action, $id) |
|
79 | - { |
|
80 | - $ret = $this->getObject($id); |
|
73 | + * |
|
74 | + * @param string $action Action |
|
75 | + * @param int $id Id of object (may be empty for creation) |
|
76 | + * @return int <0 if KO, >0 if OK |
|
77 | + */ |
|
78 | + function doActions(&$action, $id) |
|
79 | + { |
|
80 | + $ret = $this->getObject($id); |
|
81 | 81 | |
82 | - $return = parent::doActions($action); |
|
82 | + $return = parent::doActions($action); |
|
83 | 83 | |
84 | - return $return; |
|
85 | - } |
|
84 | + return $return; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
88 | - /** |
|
89 | - * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
90 | - * |
|
91 | - * @param string $action Type of action |
|
92 | - * @param integer $id Id of object |
|
93 | - * @param string $ref Ref of object |
|
94 | - * @return void |
|
95 | - */ |
|
96 | - function assign_values(&$action, $id=0, $ref='') |
|
97 | - { |
|
88 | + /** |
|
89 | + * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
90 | + * |
|
91 | + * @param string $action Type of action |
|
92 | + * @param integer $id Id of object |
|
93 | + * @param string $ref Ref of object |
|
94 | + * @return void |
|
95 | + */ |
|
96 | + function assign_values(&$action, $id=0, $ref='') |
|
97 | + { |
|
98 | 98 | // phpcs:enable |
99 | - global $conf, $langs; |
|
100 | - global $form, $formcompany; |
|
99 | + global $conf, $langs; |
|
100 | + global $form, $formcompany; |
|
101 | 101 | |
102 | - $ret = $this->getObject($id,$ref); |
|
102 | + $ret = $this->getObject($id,$ref); |
|
103 | 103 | |
104 | - parent::assign_values($action); |
|
104 | + parent::assign_values($action); |
|
105 | 105 | |
106 | 106 | $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); |
107 | 107 | |
108 | - if ($action == 'create' || $action == 'edit') |
|
109 | - { |
|
110 | - $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id')); |
|
111 | - } |
|
112 | - else |
|
113 | - { |
|
114 | - // Confirm delete third party |
|
115 | - if ($action == 'delete' || $conf->use_javascript_ajax) |
|
116 | - { |
|
117 | - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete"); |
|
118 | - } |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Check permissions of a user to show a page and an object. Check read permission |
|
124 | - * If $_REQUEST['action'] defined, we also check write permission. |
|
125 | - * |
|
126 | - * @param User $user User to check |
|
127 | - * @param string $features Features to check (in most cases, it's module name) |
|
128 | - * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
129 | - * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
130 | - * @param string $feature2 Feature to check (second level of permission) |
|
131 | - * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
132 | - * @param string $dbt_select Field name for select if not rowid. (optional) |
|
133 | - * @return int 1 |
|
134 | - */ |
|
135 | - function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
136 | - { |
|
137 | - return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
138 | - } |
|
108 | + if ($action == 'create' || $action == 'edit') |
|
109 | + { |
|
110 | + $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id')); |
|
111 | + } |
|
112 | + else |
|
113 | + { |
|
114 | + // Confirm delete third party |
|
115 | + if ($action == 'delete' || $conf->use_javascript_ajax) |
|
116 | + { |
|
117 | + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete"); |
|
118 | + } |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Check permissions of a user to show a page and an object. Check read permission |
|
124 | + * If $_REQUEST['action'] defined, we also check write permission. |
|
125 | + * |
|
126 | + * @param User $user User to check |
|
127 | + * @param string $features Features to check (in most cases, it's module name) |
|
128 | + * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
129 | + * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
130 | + * @param string $feature2 Feature to check (second level of permission) |
|
131 | + * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
132 | + * @param string $dbt_select Field name for select if not rowid. (optional) |
|
133 | + * @return int 1 |
|
134 | + */ |
|
135 | + function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
136 | + { |
|
137 | + return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
138 | + } |
|
139 | 139 | } |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
41 | 41 | { |
42 | - $this->db = $db; |
|
43 | - $this->dirmodule = $dirmodule; |
|
42 | + $this->db = $db; |
|
43 | + $this->dirmodule = $dirmodule; |
|
44 | 44 | $this->targetmodule = $targetmodule; |
45 | - $this->canvas = $canvas; |
|
45 | + $this->canvas = $canvas; |
|
46 | 46 | $this->card = $card; |
47 | 47 | } |
48 | 48 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | { |
58 | 58 | global $langs; |
59 | 59 | |
60 | - $out=''; |
|
60 | + $out = ''; |
|
61 | 61 | |
62 | - if ($action == 'view') $out.= $langs->trans("Individual"); |
|
63 | - if ($action == 'edit') $out.= $langs->trans("EditCompany"); |
|
64 | - if ($action == 'create') $out.= $langs->trans("NewCompany"); |
|
62 | + if ($action == 'view') $out .= $langs->trans("Individual"); |
|
63 | + if ($action == 'edit') $out .= $langs->trans("EditCompany"); |
|
64 | + if ($action == 'create') $out .= $langs->trans("NewCompany"); |
|
65 | 65 | |
66 | 66 | return $out; |
67 | 67 | } |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | * @param string $ref Ref of object |
94 | 94 | * @return void |
95 | 95 | */ |
96 | - function assign_values(&$action, $id=0, $ref='') |
|
96 | + function assign_values(&$action, $id = 0, $ref = '') |
|
97 | 97 | { |
98 | 98 | // phpcs:enable |
99 | 99 | global $conf, $langs; |
100 | 100 | global $form, $formcompany; |
101 | 101 | |
102 | - $ret = $this->getObject($id,$ref); |
|
102 | + $ret = $this->getObject($id, $ref); |
|
103 | 103 | |
104 | 104 | parent::assign_values($action); |
105 | 105 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // Confirm delete third party |
115 | 115 | if ($action == 'delete' || $conf->use_javascript_ajax) |
116 | 116 | { |
117 | - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete"); |
|
117 | + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id, $langs->trans("DeleteAnIndividual"), $langs->trans("ConfirmDeleteIndividual"), "confirm_delete", '', 0, "1,action-delete"); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param string $dbt_select Field name for select if not rowid. (optional) |
133 | 133 | * @return int 1 |
134 | 134 | */ |
135 | - function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
135 | + function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') |
|
136 | 136 | { |
137 | - return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
137 | + return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); |
|
138 | 138 | } |
139 | 139 | } |
@@ -59,9 +59,15 @@ discard block |
||
59 | 59 | |
60 | 60 | $out=''; |
61 | 61 | |
62 | - if ($action == 'view') $out.= $langs->trans("Individual"); |
|
63 | - if ($action == 'edit') $out.= $langs->trans("EditCompany"); |
|
64 | - if ($action == 'create') $out.= $langs->trans("NewCompany"); |
|
62 | + if ($action == 'view') { |
|
63 | + $out.= $langs->trans("Individual"); |
|
64 | + } |
|
65 | + if ($action == 'edit') { |
|
66 | + $out.= $langs->trans("EditCompany"); |
|
67 | + } |
|
68 | + if ($action == 'create') { |
|
69 | + $out.= $langs->trans("NewCompany"); |
|
70 | + } |
|
65 | 71 | |
66 | 72 | return $out; |
67 | 73 | } |
@@ -108,8 +114,7 @@ discard block |
||
108 | 114 | if ($action == 'create' || $action == 'edit') |
109 | 115 | { |
110 | 116 | $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id')); |
111 | - } |
|
112 | - else |
|
117 | + } else |
|
113 | 118 | { |
114 | 119 | // Confirm delete third party |
115 | 120 | if ($action == 'delete' || $conf->use_javascript_ajax) |
@@ -72,36 +72,36 @@ discard block |
||
72 | 72 | $search=array(); |
73 | 73 | foreach($objectwebsiteaccount->fields as $key => $val) |
74 | 74 | { |
75 | - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
75 | + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // List of fields to search into when doing a "search in all" |
79 | 79 | $fieldstosearchall = array(); |
80 | 80 | foreach($objectwebsiteaccount->fields as $key => $val) |
81 | 81 | { |
82 | - if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; |
|
82 | + if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Definition of fields for list |
86 | 86 | $arrayfields=array(); |
87 | 87 | foreach($objectwebsiteaccount->fields as $key => $val) |
88 | 88 | { |
89 | - // If $val['visible']==0, then we never show the field |
|
90 | - if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
89 | + // If $val['visible']==0, then we never show the field |
|
90 | + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Extra fields |
94 | 94 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
95 | 95 | { |
96 | - foreach($extrafields->attribute_label as $key => $val) |
|
97 | - { |
|
98 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
99 | - } |
|
96 | + foreach($extrafields->attribute_label as $key => $val) |
|
97 | + { |
|
98 | + if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
99 | + } |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | if ($id > 0) |
103 | 103 | { |
104 | - $result = $object->fetch($id); |
|
104 | + $result = $object->fetch($id); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -128,17 +128,17 @@ discard block |
||
128 | 128 | // Purge search criteria |
129 | 129 | if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
130 | 130 | { |
131 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
132 | - { |
|
133 | - $search[$key]=''; |
|
134 | - } |
|
135 | - $toselect=''; |
|
136 | - $search_array_options=array(); |
|
131 | + foreach($objectwebsiteaccount->fields as $key => $val) |
|
132 | + { |
|
133 | + $search[$key]=''; |
|
134 | + } |
|
135 | + $toselect=''; |
|
136 | + $search_array_options=array(); |
|
137 | 137 | } |
138 | 138 | if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') |
139 | - || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) |
|
139 | + || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) |
|
140 | 140 | { |
141 | - $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
141 | + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Mass actions |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
172 | 172 | foreach($search as $key => $val) |
173 | 173 | { |
174 | - $param.= '&search_'.$key.'='.urlencode($search[$key]); |
|
174 | + $param.= '&search_'.$key.'='.urlencode($search[$key]); |
|
175 | 175 | } |
176 | 176 | if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
177 | 177 | // Add $param from extra fields |
@@ -194,25 +194,25 @@ discard block |
||
194 | 194 | // Prefix |
195 | 195 | if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
196 | 196 | { |
197 | - print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>'; |
|
197 | + print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>'; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | if ($object->client) { |
201 | - print '<tr><td class="titlefield">'; |
|
202 | - print $langs->trans('CustomerCode') . '</td><td colspan="3">'; |
|
203 | - print $object->code_client; |
|
204 | - if ($object->check_codeclient() != 0) |
|
205 | - print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
206 | - print '</td></tr>'; |
|
201 | + print '<tr><td class="titlefield">'; |
|
202 | + print $langs->trans('CustomerCode') . '</td><td colspan="3">'; |
|
203 | + print $object->code_client; |
|
204 | + if ($object->check_codeclient() != 0) |
|
205 | + print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
206 | + print '</td></tr>'; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | if ($object->fournisseur) { |
210 | - print '<tr><td class="titlefield">'; |
|
211 | - print $langs->trans('SupplierCode') . '</td><td colspan="3">'; |
|
212 | - print $object->code_fournisseur; |
|
213 | - if ($object->check_codefournisseur() != 0) |
|
214 | - print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
215 | - print '</td></tr>'; |
|
210 | + print '<tr><td class="titlefield">'; |
|
211 | + print $langs->trans('SupplierCode') . '</td><td colspan="3">'; |
|
212 | + print $object->code_fournisseur; |
|
213 | + if ($object->check_codefournisseur() != 0) |
|
214 | + print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
215 | + print '</td></tr>'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | print '</table>'; |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | |
224 | 224 | $newcardbutton = ''; |
225 | 225 | if (! empty($conf->website->enabled)) { |
226 | - if (! empty($user->rights->societe->lire)) { |
|
227 | - $newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>'; |
|
228 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
229 | - $newcardbutton.= '</a>'; |
|
230 | - } else { |
|
231 | - $newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction"); |
|
232 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
233 | - $newcardbutton.= '</a>'; |
|
234 | - } |
|
226 | + if (! empty($user->rights->societe->lire)) { |
|
227 | + $newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>'; |
|
228 | + $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
229 | + $newcardbutton.= '</a>'; |
|
230 | + } else { |
|
231 | + $newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction"); |
|
232 | + $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
233 | + $newcardbutton.= '</a>'; |
|
234 | + } |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | print '<br>'; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $sql = 'SELECT '; |
244 | 244 | foreach($objectwebsiteaccount->fields as $key => $val) |
245 | 245 | { |
246 | - $sql.='t.'.$key.', '; |
|
246 | + $sql.='t.'.$key.', '; |
|
247 | 247 | } |
248 | 248 | // Add fields from extrafields |
249 | 249 | foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | $sql.=" AND fk_soc = ".$object->id; |
260 | 260 | foreach($search as $key => $val) |
261 | 261 | { |
262 | - $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); |
|
263 | - if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
262 | + $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); |
|
263 | + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
264 | 264 | } |
265 | 265 | if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
266 | 266 | // Add where from extra fields |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | $nbtotalofrecords = ''; |
291 | 291 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
292 | 292 | { |
293 | - $result = $db->query($sql); |
|
294 | - $nbtotalofrecords = $db->num_rows($result); |
|
295 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
296 | - { |
|
297 | - $page = 0; |
|
298 | - $offset = 0; |
|
299 | - } |
|
293 | + $result = $db->query($sql); |
|
294 | + $nbtotalofrecords = $db->num_rows($result); |
|
295 | + if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
296 | + { |
|
297 | + $page = 0; |
|
298 | + $offset = 0; |
|
299 | + } |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | $sql.= $db->plimit($limit+1, $offset); |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | $resql=$db->query($sql); |
305 | 305 | if (! $resql) |
306 | 306 | { |
307 | - dol_print_error($db); |
|
308 | - exit; |
|
307 | + dol_print_error($db); |
|
308 | + exit; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | $num = $db->num_rows($resql); |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | |
343 | 343 | if ($sall) |
344 | 344 | { |
345 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
346 | - print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
|
345 | + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
346 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /*$moreforfilter = ''; |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | |
359 | 359 | if (! empty($moreforfilter)) |
360 | 360 | { |
361 | - print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
362 | - print $moreforfilter; |
|
363 | - print '</div>'; |
|
361 | + print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
362 | + print $moreforfilter; |
|
363 | + print '</div>'; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | print '<tr class="liste_titre">'; |
377 | 377 | foreach($objectwebsiteaccount->fields as $key => $val) |
378 | 378 | { |
379 | - $align=''; |
|
380 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
381 | - if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; |
|
382 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
383 | - if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
379 | + $align=''; |
|
380 | + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
381 | + if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; |
|
382 | + if ($key == 'status') $align.=($align?' ':'').'center'; |
|
383 | + if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
384 | 384 | } |
385 | 385 | // Extra fields |
386 | 386 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | print '<tr class="liste_titre">'; |
402 | 402 | foreach($objectwebsiteaccount->fields as $key => $val) |
403 | 403 | { |
404 | - $align=''; |
|
405 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
406 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
407 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
408 | - if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
404 | + $align=''; |
|
405 | + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
406 | + if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
407 | + if ($key == 'status') $align.=($align?' ':'').'center'; |
|
408 | + if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
409 | 409 | } |
410 | 410 | // Extra fields |
411 | 411 | // Extra fields |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $needToFetchEachLine=0; |
423 | 423 | foreach ($extrafields->attribute_computed as $key => $val) |
424 | 424 | { |
425 | - if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
425 | + if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -432,90 +432,90 @@ discard block |
||
432 | 432 | $totalarray=array(); |
433 | 433 | while ($i < min($num, $limit)) |
434 | 434 | { |
435 | - $obj = $db->fetch_object($resql); |
|
436 | - if (empty($obj)) break; // Should not happen |
|
437 | - |
|
438 | - // Store properties in $object |
|
439 | - $objectwebsiteaccount->id = $obj->rowid; |
|
440 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
441 | - { |
|
442 | - if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; |
|
443 | - } |
|
444 | - |
|
445 | - // Show here line of result |
|
446 | - print '<tr class="oddeven">'; |
|
447 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
448 | - { |
|
449 | - $align=''; |
|
450 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
451 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
452 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
453 | - if (! empty($arrayfields['t.'.$key]['checked'])) |
|
454 | - { |
|
455 | - print '<td'; |
|
456 | - if ($align) print ' class="'.$align.'"'; |
|
457 | - print '>'; |
|
458 | - if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
459 | - else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
460 | - print '</td>'; |
|
461 | - if (! $i) $totalarray['nbfield']++; |
|
462 | - if (! empty($val['isameasure'])) |
|
463 | - { |
|
464 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
465 | - $totalarray['val']['t.'.$key] += $obj->$key; |
|
466 | - } |
|
467 | - } |
|
468 | - } |
|
469 | - // Extra fields |
|
470 | - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
471 | - // Fields from hook |
|
472 | - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
473 | - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
474 | - print $hookmanager->resPrint; |
|
475 | - // Action column |
|
476 | - print '<td class="nowrap" align="center">'; |
|
477 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
478 | - { |
|
479 | - $selected=0; |
|
480 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
481 | - print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
482 | - } |
|
483 | - print '</td>'; |
|
484 | - if (! $i) $totalarray['nbfield']++; |
|
485 | - |
|
486 | - print '</tr>'; |
|
487 | - |
|
488 | - $i++; |
|
435 | + $obj = $db->fetch_object($resql); |
|
436 | + if (empty($obj)) break; // Should not happen |
|
437 | + |
|
438 | + // Store properties in $object |
|
439 | + $objectwebsiteaccount->id = $obj->rowid; |
|
440 | + foreach($objectwebsiteaccount->fields as $key => $val) |
|
441 | + { |
|
442 | + if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; |
|
443 | + } |
|
444 | + |
|
445 | + // Show here line of result |
|
446 | + print '<tr class="oddeven">'; |
|
447 | + foreach($objectwebsiteaccount->fields as $key => $val) |
|
448 | + { |
|
449 | + $align=''; |
|
450 | + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
451 | + if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
452 | + if ($key == 'status') $align.=($align?' ':'').'center'; |
|
453 | + if (! empty($arrayfields['t.'.$key]['checked'])) |
|
454 | + { |
|
455 | + print '<td'; |
|
456 | + if ($align) print ' class="'.$align.'"'; |
|
457 | + print '>'; |
|
458 | + if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
459 | + else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
460 | + print '</td>'; |
|
461 | + if (! $i) $totalarray['nbfield']++; |
|
462 | + if (! empty($val['isameasure'])) |
|
463 | + { |
|
464 | + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
465 | + $totalarray['val']['t.'.$key] += $obj->$key; |
|
466 | + } |
|
467 | + } |
|
468 | + } |
|
469 | + // Extra fields |
|
470 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
471 | + // Fields from hook |
|
472 | + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
473 | + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
474 | + print $hookmanager->resPrint; |
|
475 | + // Action column |
|
476 | + print '<td class="nowrap" align="center">'; |
|
477 | + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
478 | + { |
|
479 | + $selected=0; |
|
480 | + if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
481 | + print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
482 | + } |
|
483 | + print '</td>'; |
|
484 | + if (! $i) $totalarray['nbfield']++; |
|
485 | + |
|
486 | + print '</tr>'; |
|
487 | + |
|
488 | + $i++; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | // Show total line |
492 | 492 | if (isset($totalarray['pos'])) |
493 | 493 | { |
494 | - print '<tr class="liste_total">'; |
|
495 | - $i=0; |
|
496 | - while ($i < $totalarray['nbfield']) |
|
497 | - { |
|
498 | - $i++; |
|
499 | - if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
500 | - else |
|
501 | - { |
|
502 | - if ($i == 1) |
|
503 | - { |
|
504 | - if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
505 | - else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
506 | - } |
|
507 | - else print '<td></td>'; |
|
508 | - } |
|
509 | - } |
|
510 | - print '</tr>'; |
|
494 | + print '<tr class="liste_total">'; |
|
495 | + $i=0; |
|
496 | + while ($i < $totalarray['nbfield']) |
|
497 | + { |
|
498 | + $i++; |
|
499 | + if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
500 | + else |
|
501 | + { |
|
502 | + if ($i == 1) |
|
503 | + { |
|
504 | + if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
505 | + else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
506 | + } |
|
507 | + else print '<td></td>'; |
|
508 | + } |
|
509 | + } |
|
510 | + print '</tr>'; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | // If no record found |
514 | 514 | if ($num == 0) |
515 | 515 | { |
516 | - $colspan=1; |
|
517 | - foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
518 | - print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
|
516 | + $colspan=1; |
|
517 | + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
518 | + print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -532,21 +532,21 @@ discard block |
||
532 | 532 | |
533 | 533 | if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) |
534 | 534 | { |
535 | - $hidegeneratedfilelistifempty=1; |
|
536 | - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; |
|
535 | + $hidegeneratedfilelistifempty=1; |
|
536 | + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; |
|
537 | 537 | |
538 | - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
539 | - $formfile = new FormFile($db); |
|
538 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
539 | + $formfile = new FormFile($db); |
|
540 | 540 | |
541 | - // Show list of available documents |
|
542 | - $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
543 | - $urlsource.=str_replace('&','&',$param); |
|
541 | + // Show list of available documents |
|
542 | + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
543 | + $urlsource.=str_replace('&','&',$param); |
|
544 | 544 | |
545 | - $filedir=$diroutputmassaction; |
|
546 | - $genallowed=$user->rights->mymodule->read; |
|
547 | - $delallowed=$user->rights->mymodule->create; |
|
545 | + $filedir=$diroutputmassaction; |
|
546 | + $genallowed=$user->rights->mymodule->read; |
|
547 | + $delallowed=$user->rights->mymodule->create; |
|
548 | 548 | |
549 | - print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); |
|
549 | + print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | // End of page |
@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | // Security check |
43 | 43 | $id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int'); |
44 | -if ($user->societe_id) $socid=$user->societe_id; |
|
44 | +if ($user->societe_id) { |
|
45 | + $socid=$user->societe_id; |
|
46 | +} |
|
45 | 47 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
46 | 48 | |
47 | 49 | $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
@@ -52,8 +54,12 @@ discard block |
||
52 | 54 | $offset = $limit * $page; |
53 | 55 | $pageprev = $page - 1; |
54 | 56 | $pagenext = $page + 1; |
55 | -if (! $sortfield) $sortfield='t.login'; |
|
56 | -if (! $sortorder) $sortorder='ASC'; |
|
57 | +if (! $sortfield) { |
|
58 | + $sortfield='t.login'; |
|
59 | +} |
|
60 | +if (! $sortorder) { |
|
61 | + $sortorder='ASC'; |
|
62 | +} |
|
57 | 63 | |
58 | 64 | // Initialize technical objects |
59 | 65 | $object=new Societe($db); |
@@ -72,30 +78,38 @@ discard block |
||
72 | 78 | $search=array(); |
73 | 79 | foreach($objectwebsiteaccount->fields as $key => $val) |
74 | 80 | { |
75 | - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
76 | -} |
|
81 | + if (GETPOST('search_'.$key,'alpha')) { |
|
82 | + $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
83 | + } |
|
84 | + } |
|
77 | 85 | |
78 | 86 | // List of fields to search into when doing a "search in all" |
79 | 87 | $fieldstosearchall = array(); |
80 | 88 | foreach($objectwebsiteaccount->fields as $key => $val) |
81 | 89 | { |
82 | - if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; |
|
83 | -} |
|
90 | + if ($val['searchall']) { |
|
91 | + $fieldstosearchall['t.'.$key]=$val['label']; |
|
92 | + } |
|
93 | + } |
|
84 | 94 | |
85 | 95 | // Definition of fields for list |
86 | 96 | $arrayfields=array(); |
87 | 97 | foreach($objectwebsiteaccount->fields as $key => $val) |
88 | 98 | { |
89 | 99 | // If $val['visible']==0, then we never show the field |
90 | - if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
91 | -} |
|
100 | + if (! empty($val['visible'])) { |
|
101 | + $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
102 | + } |
|
103 | + } |
|
92 | 104 | |
93 | 105 | // Extra fields |
94 | 106 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
95 | 107 | { |
96 | 108 | foreach($extrafields->attribute_label as $key => $val) |
97 | 109 | { |
98 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
110 | + if (! empty($extrafields->attribute_list[$key])) { |
|
111 | + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
112 | + } |
|
99 | 113 | } |
100 | 114 | } |
101 | 115 | |
@@ -111,7 +125,9 @@ discard block |
||
111 | 125 | |
112 | 126 | $parameters=array('id'=>$socid); |
113 | 127 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
114 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
128 | +if ($reshook < 0) { |
|
129 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
130 | +} |
|
115 | 131 | |
116 | 132 | if (empty($reshook)) |
117 | 133 | { |
@@ -126,11 +142,13 @@ discard block |
||
126 | 142 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
127 | 143 | |
128 | 144 | // Purge search criteria |
129 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
145 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) { |
|
146 | + // All tests are required to be compatible with all browsers |
|
130 | 147 | { |
131 | 148 | foreach($objectwebsiteaccount->fields as $key => $val) |
132 | 149 | { |
133 | 150 | $search[$key]=''; |
151 | + } |
|
134 | 152 | } |
135 | 153 | $toselect=''; |
136 | 154 | $search_array_options=array(); |
@@ -166,14 +184,22 @@ discard block |
||
166 | 184 | llxHeader('', $title); |
167 | 185 | |
168 | 186 | $param=''; |
169 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
170 | -if ($id > 0) $param.='&id='.urlencode($id); |
|
171 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
187 | +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
188 | + $param.='&contextpage='.urlencode($contextpage); |
|
189 | +} |
|
190 | +if ($id > 0) { |
|
191 | + $param.='&id='.urlencode($id); |
|
192 | +} |
|
193 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
194 | + $param.='&limit='.urlencode($limit); |
|
195 | +} |
|
172 | 196 | foreach($search as $key => $val) |
173 | 197 | { |
174 | 198 | $param.= '&search_'.$key.'='.urlencode($search[$key]); |
175 | 199 | } |
176 | -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
200 | +if ($optioncss != '') { |
|
201 | + $param.='&optioncss='.urlencode($optioncss); |
|
202 | +} |
|
177 | 203 | // Add $param from extra fields |
178 | 204 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
179 | 205 | |
@@ -192,17 +218,20 @@ discard block |
||
192 | 218 | print '<table class="border centpercent">'; |
193 | 219 | |
194 | 220 | // Prefix |
195 | -if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
221 | +if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
222 | + // Old not used prefix field |
|
196 | 223 | { |
197 | 224 | print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>'; |
198 | 225 | } |
226 | +} |
|
199 | 227 | |
200 | 228 | if ($object->client) { |
201 | 229 | print '<tr><td class="titlefield">'; |
202 | 230 | print $langs->trans('CustomerCode') . '</td><td colspan="3">'; |
203 | 231 | print $object->code_client; |
204 | - if ($object->check_codeclient() != 0) |
|
205 | - print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
232 | + if ($object->check_codeclient() != 0) { |
|
233 | + print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
234 | + } |
|
206 | 235 | print '</td></tr>'; |
207 | 236 | } |
208 | 237 | |
@@ -210,8 +239,9 @@ discard block |
||
210 | 239 | print '<tr><td class="titlefield">'; |
211 | 240 | print $langs->trans('SupplierCode') . '</td><td colspan="3">'; |
212 | 241 | print $object->code_fournisseur; |
213 | - if ($object->check_codefournisseur() != 0) |
|
214 | - print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
242 | + if ($object->check_codefournisseur() != 0) { |
|
243 | + print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
244 | + } |
|
215 | 245 | print '</td></tr>'; |
216 | 246 | } |
217 | 247 | |
@@ -246,23 +276,34 @@ discard block |
||
246 | 276 | $sql.='t.'.$key.', '; |
247 | 277 | } |
248 | 278 | // Add fields from extrafields |
249 | -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
279 | +foreach ($extrafields->attribute_label as $key => $val) { |
|
280 | + $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
281 | +} |
|
250 | 282 | // Add fields from hooks |
251 | 283 | $parameters=array(); |
252 | 284 | $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
253 | 285 | $sql.=$hookmanager->resPrint; |
254 | 286 | $sql=preg_replace('/, $/','', $sql); |
255 | 287 | $sql.= " FROM ".MAIN_DB_PREFIX."societe_account as t"; |
256 | -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
257 | -if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
258 | -else $sql.=" WHERE 1 = 1"; |
|
288 | +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
|
289 | + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
290 | +} |
|
291 | +if ($objectwebsiteaccount->ismultientitymanaged == 1) { |
|
292 | + $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
293 | +} else { |
|
294 | + $sql.=" WHERE 1 = 1"; |
|
295 | +} |
|
259 | 296 | $sql.=" AND fk_soc = ".$object->id; |
260 | 297 | foreach($search as $key => $val) |
261 | 298 | { |
262 | 299 | $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); |
263 | - if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
300 | + if ($search[$key] != '') { |
|
301 | + $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
302 | + } |
|
303 | + } |
|
304 | +if ($search_all) { |
|
305 | + $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
264 | 306 | } |
265 | -if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
266 | 307 | // Add where from extra fields |
267 | 308 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
268 | 309 | // Add where from hooks |
@@ -292,9 +333,11 @@ discard block |
||
292 | 333 | { |
293 | 334 | $result = $db->query($sql); |
294 | 335 | $nbtotalofrecords = $db->num_rows($result); |
295 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
336 | + if (($page * $limit) > $nbtotalofrecords) { |
|
337 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
296 | 338 | { |
297 | 339 | $page = 0; |
340 | + } |
|
298 | 341 | $offset = 0; |
299 | 342 | } |
300 | 343 | } |
@@ -317,12 +360,18 @@ discard block |
||
317 | 360 | //'presend'=>$langs->trans("SendByMail"), |
318 | 361 | //'builddoc'=>$langs->trans("PDFMerge"), |
319 | 362 | ); |
320 | -if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
321 | -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
363 | +if ($user->rights->mymodule->delete) { |
|
364 | + $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
365 | +} |
|
366 | +if (in_array($massaction, array('presend','predelete'))) { |
|
367 | + $arrayofmassactions=array(); |
|
368 | +} |
|
322 | 369 | $massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
323 | 370 | |
324 | 371 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
325 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
372 | +if ($optioncss != '') { |
|
373 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
374 | +} |
|
326 | 375 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
327 | 376 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
328 | 377 | print '<input type="hidden" name="action" value="list">'; |
@@ -342,7 +391,9 @@ discard block |
||
342 | 391 | |
343 | 392 | if ($sall) |
344 | 393 | { |
345 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
394 | + foreach($fieldstosearchall as $key => $val) { |
|
395 | + $fieldstosearchall[$key]=$langs->trans($val); |
|
396 | + } |
|
346 | 397 | print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
347 | 398 | } |
348 | 399 | |
@@ -353,8 +404,11 @@ discard block |
||
353 | 404 | |
354 | 405 | $parameters=array(); |
355 | 406 | $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook |
356 | -if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; |
|
357 | -else $moreforfilter = $hookmanager->resPrint; |
|
407 | +if (empty($reshook)) { |
|
408 | + $moreforfilter .= $hookmanager->resPrint; |
|
409 | +} else { |
|
410 | + $moreforfilter = $hookmanager->resPrint; |
|
411 | +} |
|
358 | 412 | |
359 | 413 | if (! empty($moreforfilter)) |
360 | 414 | { |
@@ -377,11 +431,19 @@ discard block |
||
377 | 431 | foreach($objectwebsiteaccount->fields as $key => $val) |
378 | 432 | { |
379 | 433 | $align=''; |
380 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
381 | - if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; |
|
382 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
383 | - if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
384 | -} |
|
434 | + if (in_array($val['type'], array('date','datetime','timestamp'))) { |
|
435 | + $align='center'; |
|
436 | + } |
|
437 | + if (in_array($val['type'], array('timestamp'))) { |
|
438 | + $align.=' nowrap'; |
|
439 | + } |
|
440 | + if ($key == 'status') { |
|
441 | + $align.=($align?' ':'').'center'; |
|
442 | + } |
|
443 | + if (! empty($arrayfields['t.'.$key]['checked'])) { |
|
444 | + print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
445 | + } |
|
446 | + } |
|
385 | 447 | // Extra fields |
386 | 448 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
387 | 449 | // Fields from hook |
@@ -402,11 +464,19 @@ discard block |
||
402 | 464 | foreach($objectwebsiteaccount->fields as $key => $val) |
403 | 465 | { |
404 | 466 | $align=''; |
405 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
406 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
407 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
408 | - if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
409 | -} |
|
467 | + if (in_array($val['type'], array('date','datetime','timestamp'))) { |
|
468 | + $align='center'; |
|
469 | + } |
|
470 | + if (in_array($val['type'], array('timestamp'))) { |
|
471 | + $align.='nowrap'; |
|
472 | + } |
|
473 | + if ($key == 'status') { |
|
474 | + $align.=($align?' ':'').'center'; |
|
475 | + } |
|
476 | + if (! empty($arrayfields['t.'.$key]['checked'])) { |
|
477 | + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
478 | + } |
|
479 | + } |
|
410 | 480 | // Extra fields |
411 | 481 | // Extra fields |
412 | 482 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
@@ -422,7 +492,10 @@ discard block |
||
422 | 492 | $needToFetchEachLine=0; |
423 | 493 | foreach ($extrafields->attribute_computed as $key => $val) |
424 | 494 | { |
425 | - if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
495 | + if (preg_match('/\$object/',$val)) { |
|
496 | + $needToFetchEachLine++; |
|
497 | + } |
|
498 | + // There is at least one compute field that use $object |
|
426 | 499 | } |
427 | 500 | |
428 | 501 | |
@@ -433,13 +506,18 @@ discard block |
||
433 | 506 | while ($i < min($num, $limit)) |
434 | 507 | { |
435 | 508 | $obj = $db->fetch_object($resql); |
436 | - if (empty($obj)) break; // Should not happen |
|
509 | + if (empty($obj)) { |
|
510 | + break; |
|
511 | + } |
|
512 | + // Should not happen |
|
437 | 513 | |
438 | 514 | // Store properties in $object |
439 | 515 | $objectwebsiteaccount->id = $obj->rowid; |
440 | 516 | foreach($objectwebsiteaccount->fields as $key => $val) |
441 | 517 | { |
442 | - if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; |
|
518 | + if (isset($obj->$key)) { |
|
519 | + $objectwebsiteaccount->$key = $obj->$key; |
|
520 | + } |
|
443 | 521 | } |
444 | 522 | |
445 | 523 | // Show here line of result |
@@ -447,21 +525,36 @@ discard block |
||
447 | 525 | foreach($objectwebsiteaccount->fields as $key => $val) |
448 | 526 | { |
449 | 527 | $align=''; |
450 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
451 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
452 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
528 | + if (in_array($val['type'], array('date','datetime','timestamp'))) { |
|
529 | + $align='center'; |
|
530 | + } |
|
531 | + if (in_array($val['type'], array('timestamp'))) { |
|
532 | + $align.='nowrap'; |
|
533 | + } |
|
534 | + if ($key == 'status') { |
|
535 | + $align.=($align?' ':'').'center'; |
|
536 | + } |
|
453 | 537 | if (! empty($arrayfields['t.'.$key]['checked'])) |
454 | 538 | { |
455 | 539 | print '<td'; |
456 | - if ($align) print ' class="'.$align.'"'; |
|
540 | + if ($align) { |
|
541 | + print ' class="'.$align.'"'; |
|
542 | + } |
|
457 | 543 | print '>'; |
458 | - if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
459 | - else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
544 | + if ($key == 'login') { |
|
545 | + print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
546 | + } else { |
|
547 | + print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
548 | + } |
|
460 | 549 | print '</td>'; |
461 | - if (! $i) $totalarray['nbfield']++; |
|
550 | + if (! $i) { |
|
551 | + $totalarray['nbfield']++; |
|
552 | + } |
|
462 | 553 | if (! empty($val['isameasure'])) |
463 | 554 | { |
464 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
555 | + if (! $i) { |
|
556 | + $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
557 | + } |
|
465 | 558 | $totalarray['val']['t.'.$key] += $obj->$key; |
466 | 559 | } |
467 | 560 | } |
@@ -474,14 +567,20 @@ discard block |
||
474 | 567 | print $hookmanager->resPrint; |
475 | 568 | // Action column |
476 | 569 | print '<td class="nowrap" align="center">'; |
477 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
570 | + if ($massactionbutton || $massaction) { |
|
571 | + // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
478 | 572 | { |
479 | 573 | $selected=0; |
480 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
574 | + } |
|
575 | + if (in_array($obj->rowid, $arrayofselected)) { |
|
576 | + $selected=1; |
|
577 | + } |
|
481 | 578 | print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
482 | 579 | } |
483 | 580 | print '</td>'; |
484 | - if (! $i) $totalarray['nbfield']++; |
|
581 | + if (! $i) { |
|
582 | + $totalarray['nbfield']++; |
|
583 | + } |
|
485 | 584 | |
486 | 585 | print '</tr>'; |
487 | 586 | |
@@ -496,15 +595,20 @@ discard block |
||
496 | 595 | while ($i < $totalarray['nbfield']) |
497 | 596 | { |
498 | 597 | $i++; |
499 | - if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
500 | - else |
|
598 | + if (! empty($totalarray['pos'][$i])) { |
|
599 | + print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
600 | + } else |
|
501 | 601 | { |
502 | 602 | if ($i == 1) |
503 | 603 | { |
504 | - if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
505 | - else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
604 | + if ($num < $limit) { |
|
605 | + print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
606 | + } else { |
|
607 | + print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
608 | + } |
|
609 | + } else { |
|
610 | + print '<td></td>'; |
|
506 | 611 | } |
507 | - else print '<td></td>'; |
|
508 | 612 | } |
509 | 613 | } |
510 | 614 | print '</tr>'; |
@@ -514,7 +618,10 @@ discard block |
||
514 | 618 | if ($num == 0) |
515 | 619 | { |
516 | 620 | $colspan=1; |
517 | - foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
621 | + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) { |
|
622 | + $colspan++; |
|
623 | + } |
|
624 | + } |
|
518 | 625 | print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
519 | 626 | } |
520 | 627 | |
@@ -533,7 +640,9 @@ discard block |
||
533 | 640 | if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) |
534 | 641 | { |
535 | 642 | $hidegeneratedfilelistifempty=1; |
536 | - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; |
|
643 | + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { |
|
644 | + $hidegeneratedfilelistifempty=0; |
|
645 | + } |
|
537 | 646 | |
538 | 647 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
539 | 648 | $formfile = new FormFile($db); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
33 | 33 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
34 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
34 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
35 | 35 | |
36 | 36 | require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
37 | 37 | require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
@@ -39,67 +39,67 @@ discard block |
||
39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
40 | 40 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
41 | 41 | |
42 | -$langs->loadLangs(array("companies","website")); |
|
42 | +$langs->loadLangs(array("companies", "website")); |
|
43 | 43 | |
44 | -$search_status=GETPOST('search_status'); |
|
44 | +$search_status = GETPOST('search_status'); |
|
45 | 45 | |
46 | 46 | // Security check |
47 | -$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int'); |
|
48 | -if ($user->societe_id) $socid=$user->societe_id; |
|
47 | +$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); |
|
48 | +if ($user->societe_id) $socid = $user->societe_id; |
|
49 | 49 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
50 | 50 | |
51 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
52 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
53 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
54 | -$page = GETPOST("page",'int'); |
|
51 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
52 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
53 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
54 | +$page = GETPOST("page", 'int'); |
|
55 | 55 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
56 | 56 | $offset = $limit * $page; |
57 | 57 | $pageprev = $page - 1; |
58 | 58 | $pagenext = $page + 1; |
59 | -if (! $sortfield) $sortfield='t.login'; |
|
60 | -if (! $sortorder) $sortorder='ASC'; |
|
59 | +if (!$sortfield) $sortfield = 't.login'; |
|
60 | +if (!$sortorder) $sortorder = 'ASC'; |
|
61 | 61 | |
62 | 62 | // Initialize technical objects |
63 | -$object=new Societe($db); |
|
64 | -$objectwebsiteaccount=new SocieteAccount($db); |
|
63 | +$object = new Societe($db); |
|
64 | +$objectwebsiteaccount = new SocieteAccount($db); |
|
65 | 65 | $extrafields = new ExtraFields($db); |
66 | -$diroutputmassaction=$conf->website->dir_output . '/temp/massgeneration/'.$user->id; |
|
67 | -$hookmanager->initHooks(array('websitethirdpartylist')); // Note that conf->hooks_modules contains array |
|
66 | +$diroutputmassaction = $conf->website->dir_output.'/temp/massgeneration/'.$user->id; |
|
67 | +$hookmanager->initHooks(array('websitethirdpartylist')); // Note that conf->hooks_modules contains array |
|
68 | 68 | // Fetch optionals attributes and labels |
69 | 69 | $extralabels = $extrafields->fetch_name_optionals_label('thirdpartyaccount'); |
70 | -$search_array_options=$extrafields->getOptionalsFromPost('thirdpartyaccount','','search_'); |
|
70 | +$search_array_options = $extrafields->getOptionalsFromPost('thirdpartyaccount', '', 'search_'); |
|
71 | 71 | |
72 | -unset($objectwebsiteaccount->fields['fk_soc']); // Remove this field, we are already on the thirdparty |
|
72 | +unset($objectwebsiteaccount->fields['fk_soc']); // Remove this field, we are already on the thirdparty |
|
73 | 73 | |
74 | 74 | // Initialize array of search criterias |
75 | -$search_all=trim(GETPOST("search_all",'alpha')); |
|
76 | -$search=array(); |
|
77 | -foreach($objectwebsiteaccount->fields as $key => $val) |
|
75 | +$search_all = trim(GETPOST("search_all", 'alpha')); |
|
76 | +$search = array(); |
|
77 | +foreach ($objectwebsiteaccount->fields as $key => $val) |
|
78 | 78 | { |
79 | - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
79 | + if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // List of fields to search into when doing a "search in all" |
83 | 83 | $fieldstosearchall = array(); |
84 | -foreach($objectwebsiteaccount->fields as $key => $val) |
|
84 | +foreach ($objectwebsiteaccount->fields as $key => $val) |
|
85 | 85 | { |
86 | - if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; |
|
86 | + if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // Definition of fields for list |
90 | -$arrayfields=array(); |
|
91 | -foreach($objectwebsiteaccount->fields as $key => $val) |
|
90 | +$arrayfields = array(); |
|
91 | +foreach ($objectwebsiteaccount->fields as $key => $val) |
|
92 | 92 | { |
93 | 93 | // If $val['visible']==0, then we never show the field |
94 | - if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
94 | + if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | // Extra fields |
98 | 98 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
99 | 99 | { |
100 | - foreach($extrafields->attribute_label as $key => $val) |
|
100 | + foreach ($extrafields->attribute_label as $key => $val) |
|
101 | 101 | { |
102 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
102 | + if (!empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key] = array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key] < 0) ? 0 : 1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key]) != 3 && $extrafields->attribute_perms[$key])); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | * Actions |
114 | 114 | */ |
115 | 115 | |
116 | -$parameters=array('id'=>$socid); |
|
117 | -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
116 | +$parameters = array('id'=>$socid); |
|
117 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
118 | 118 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
119 | 119 | |
120 | 120 | if (empty($reshook)) |
121 | 121 | { |
122 | 122 | // Cancel |
123 | - if (GETPOST('cancel','alpha') && ! empty($backtopage)) |
|
123 | + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) |
|
124 | 124 | { |
125 | 125 | header("Location: ".$backtopage); |
126 | 126 | exit; |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
131 | 131 | |
132 | 132 | // Purge search criteria |
133 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
133 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
134 | 134 | { |
135 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
135 | + foreach ($objectwebsiteaccount->fields as $key => $val) |
|
136 | 136 | { |
137 | - $search[$key]=''; |
|
137 | + $search[$key] = ''; |
|
138 | 138 | } |
139 | - $toselect=''; |
|
140 | - $search_array_options=array(); |
|
139 | + $toselect = ''; |
|
140 | + $search_array_options = array(); |
|
141 | 141 | } |
142 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') |
|
143 | - || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) |
|
142 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') |
|
143 | + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) |
|
144 | 144 | { |
145 | - $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
145 | + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Mass actions |
149 | - $objectclass='WebsiteAccount'; |
|
150 | - $objectlabel='WebsiteAccount'; |
|
149 | + $objectclass = 'WebsiteAccount'; |
|
150 | + $objectlabel = 'WebsiteAccount'; |
|
151 | 151 | $permtoread = $user->rights->societe->lire; |
152 | 152 | $permtodelete = $user->rights->societe->supprimer; |
153 | 153 | $uploaddir = $conf->societe->dir_output; |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | $title = $langs->trans("WebsiteAccounts"); |
170 | 170 | llxHeader('', $title); |
171 | 171 | |
172 | -$param=''; |
|
173 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
174 | -if ($id > 0) $param.='&id='.urlencode($id); |
|
175 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
176 | -foreach($search as $key => $val) |
|
172 | +$param = ''; |
|
173 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
174 | +if ($id > 0) $param .= '&id='.urlencode($id); |
|
175 | +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
176 | +foreach ($search as $key => $val) |
|
177 | 177 | { |
178 | - $param.= '&search_'.$key.'='.urlencode($search[$key]); |
|
178 | + $param .= '&search_'.$key.'='.urlencode($search[$key]); |
|
179 | 179 | } |
180 | -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
180 | +if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
181 | 181 | // Add $param from extra fields |
182 | 182 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
183 | 183 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | dol_fiche_head($head, 'website', $langs->trans("ThirdParty"), - 1, 'company'); |
187 | 187 | |
188 | -$linkback = '<a href="' . DOL_URL_ROOT . '/societe/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; |
|
188 | +$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
189 | 189 | |
190 | 190 | dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom'); |
191 | 191 | |
@@ -196,26 +196,26 @@ discard block |
||
196 | 196 | print '<table class="border centpercent">'; |
197 | 197 | |
198 | 198 | // Prefix |
199 | -if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
199 | +if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
200 | 200 | { |
201 | - print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>'; |
|
201 | + print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | if ($object->client) { |
205 | 205 | print '<tr><td class="titlefield">'; |
206 | - print $langs->trans('CustomerCode') . '</td><td colspan="3">'; |
|
206 | + print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
|
207 | 207 | print $object->code_client; |
208 | 208 | if ($object->check_codeclient() != 0) |
209 | - print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
209 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
210 | 210 | print '</td></tr>'; |
211 | 211 | } |
212 | 212 | |
213 | 213 | if ($object->fournisseur) { |
214 | 214 | print '<tr><td class="titlefield">'; |
215 | - print $langs->trans('SupplierCode') . '</td><td colspan="3">'; |
|
215 | + print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
|
216 | 216 | print $object->code_fournisseur; |
217 | 217 | if ($object->check_codefournisseur() != 0) |
218 | - print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
218 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
219 | 219 | print '</td></tr>'; |
220 | 220 | } |
221 | 221 | |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | dol_fiche_end(); |
227 | 227 | |
228 | 228 | $newcardbutton = ''; |
229 | -if (! empty($conf->website->enabled)) { |
|
230 | - if (! empty($user->rights->societe->lire)) { |
|
231 | - $newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>'; |
|
232 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
233 | - $newcardbutton.= '</a>'; |
|
229 | +if (!empty($conf->website->enabled)) { |
|
230 | + if (!empty($user->rights->societe->lire)) { |
|
231 | + $newcardbutton .= '<a class="butActionNew" href="'.DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">'.$langs->trans("AddWebsiteAccount").'</span>'; |
|
232 | + $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
233 | + $newcardbutton .= '</a>'; |
|
234 | 234 | } else { |
235 | - $newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction"); |
|
236 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
237 | - $newcardbutton.= '</a>'; |
|
235 | + $newcardbutton .= '<a class="butActionNewRefused" href="#">'.$langs->trans("AddAction"); |
|
236 | + $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
237 | + $newcardbutton .= '</a>'; |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
@@ -245,34 +245,34 @@ discard block |
||
245 | 245 | // Build and execute select |
246 | 246 | // -------------------------------------------------------------------- |
247 | 247 | $sql = 'SELECT '; |
248 | -foreach($objectwebsiteaccount->fields as $key => $val) |
|
248 | +foreach ($objectwebsiteaccount->fields as $key => $val) |
|
249 | 249 | { |
250 | - $sql.='t.'.$key.', '; |
|
250 | + $sql .= 't.'.$key.', '; |
|
251 | 251 | } |
252 | 252 | // Add fields from extrafields |
253 | -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
253 | +foreach ($extrafields->attribute_label as $key => $val) $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
254 | 254 | // Add fields from hooks |
255 | -$parameters=array(); |
|
256 | -$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
257 | -$sql.=$hookmanager->resPrint; |
|
258 | -$sql=preg_replace('/, $/','', $sql); |
|
259 | -$sql.= " FROM ".MAIN_DB_PREFIX."societe_account as t"; |
|
260 | -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
261 | -if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
262 | -else $sql.=" WHERE 1 = 1"; |
|
263 | -$sql.=" AND fk_soc = ".$object->id; |
|
264 | -foreach($search as $key => $val) |
|
255 | +$parameters = array(); |
|
256 | +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
257 | +$sql .= $hookmanager->resPrint; |
|
258 | +$sql = preg_replace('/, $/', '', $sql); |
|
259 | +$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as t"; |
|
260 | +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
261 | +if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
262 | +else $sql .= " WHERE 1 = 1"; |
|
263 | +$sql .= " AND fk_soc = ".$object->id; |
|
264 | +foreach ($search as $key => $val) |
|
265 | 265 | { |
266 | - $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); |
|
267 | - if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
266 | + $mode_search = (($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key])) ? 1 : 0); |
|
267 | + if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); |
|
268 | 268 | } |
269 | -if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
269 | +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
|
270 | 270 | // Add where from extra fields |
271 | 271 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
272 | 272 | // Add where from hooks |
273 | -$parameters=array(); |
|
274 | -$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook |
|
275 | -$sql.=$hookmanager->resPrint; |
|
273 | +$parameters = array(); |
|
274 | +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook |
|
275 | +$sql .= $hookmanager->resPrint; |
|
276 | 276 | |
277 | 277 | /* If a group by is required |
278 | 278 | $sql.= " GROUP BY " |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $sql.=$hookmanager->resPrint; |
289 | 289 | */ |
290 | 290 | |
291 | -$sql.=$db->order($sortfield,$sortorder); |
|
291 | +$sql .= $db->order($sortfield, $sortorder); |
|
292 | 292 | |
293 | 293 | // Count total nb of records |
294 | 294 | $nbtotalofrecords = ''; |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -$sql.= $db->plimit($limit+1, $offset); |
|
306 | +$sql .= $db->plimit($limit + 1, $offset); |
|
307 | 307 | |
308 | -$resql=$db->query($sql); |
|
309 | -if (! $resql) |
|
308 | +$resql = $db->query($sql); |
|
309 | +if (!$resql) |
|
310 | 310 | { |
311 | 311 | dol_print_error($db); |
312 | 312 | exit; |
@@ -314,16 +314,16 @@ discard block |
||
314 | 314 | |
315 | 315 | $num = $db->num_rows($resql); |
316 | 316 | |
317 | -$arrayofselected=is_array($toselect)?$toselect:array(); |
|
317 | +$arrayofselected = is_array($toselect) ? $toselect : array(); |
|
318 | 318 | |
319 | 319 | // List of mass actions available |
320 | -$arrayofmassactions = array( |
|
320 | +$arrayofmassactions = array( |
|
321 | 321 | //'presend'=>$langs->trans("SendByMail"), |
322 | 322 | //'builddoc'=>$langs->trans("PDFMerge"), |
323 | 323 | ); |
324 | -if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
325 | -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
326 | -$massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
|
324 | +if ($user->rights->mymodule->delete) $arrayofmassactions['predelete'] = $langs->trans("Delete"); |
|
325 | +if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); |
|
326 | +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
|
327 | 327 | |
328 | 328 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
329 | 329 | if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
@@ -338,16 +338,16 @@ discard block |
||
338 | 338 | |
339 | 339 | print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); |
340 | 340 | |
341 | -$topicmail="Information"; |
|
342 | -$modelmail="societeaccount"; |
|
343 | -$objecttmp=new SocieteAccount($db); |
|
344 | -$trackid='thi'.$object->id; |
|
341 | +$topicmail = "Information"; |
|
342 | +$modelmail = "societeaccount"; |
|
343 | +$objecttmp = new SocieteAccount($db); |
|
344 | +$trackid = 'thi'.$object->id; |
|
345 | 345 | include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; |
346 | 346 | |
347 | 347 | if ($sall) |
348 | 348 | { |
349 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
350 | - print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
|
349 | + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); |
|
350 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>'; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /*$moreforfilter = ''; |
@@ -355,46 +355,46 @@ discard block |
||
355 | 355 | $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">'; |
356 | 356 | $moreforfilter.= '</div>';*/ |
357 | 357 | |
358 | -$parameters=array(); |
|
359 | -$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook |
|
358 | +$parameters = array(); |
|
359 | +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook |
|
360 | 360 | if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; |
361 | 361 | else $moreforfilter = $hookmanager->resPrint; |
362 | 362 | |
363 | -if (! empty($moreforfilter)) |
|
363 | +if (!empty($moreforfilter)) |
|
364 | 364 | { |
365 | 365 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
366 | 366 | print $moreforfilter; |
367 | 367 | print '</div>'; |
368 | 368 | } |
369 | 369 | |
370 | -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
|
371 | -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
372 | -$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
|
370 | +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
|
371 | +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
372 | +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
|
373 | 373 | |
374 | -print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table |
|
375 | -print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; |
|
374 | +print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table |
|
375 | +print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; |
|
376 | 376 | |
377 | 377 | |
378 | 378 | // Fields title search |
379 | 379 | // -------------------------------------------------------------------- |
380 | 380 | print '<tr class="liste_titre">'; |
381 | -foreach($objectwebsiteaccount->fields as $key => $val) |
|
381 | +foreach ($objectwebsiteaccount->fields as $key => $val) |
|
382 | 382 | { |
383 | - $align=''; |
|
384 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
385 | - if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; |
|
386 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
387 | - if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
383 | + $align = ''; |
|
384 | + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; |
|
385 | + if (in_array($val['type'], array('timestamp'))) $align .= ' nowrap'; |
|
386 | + if ($key == 'status') $align .= ($align ? ' ' : '').'center'; |
|
387 | + if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
388 | 388 | } |
389 | 389 | // Extra fields |
390 | 390 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
391 | 391 | // Fields from hook |
392 | -$parameters=array('arrayfields'=>$arrayfields); |
|
393 | -$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
392 | +$parameters = array('arrayfields'=>$arrayfields); |
|
393 | +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
394 | 394 | print $hookmanager->resPrint; |
395 | 395 | // Action column |
396 | 396 | print '<td class="liste_titre" align="right">'; |
397 | -$searchpicto=$form->showFilterButtons(); |
|
397 | +$searchpicto = $form->showFilterButtons(); |
|
398 | 398 | print $searchpicto; |
399 | 399 | print '</td>'; |
400 | 400 | print '</tr>'."\n"; |
@@ -403,58 +403,58 @@ discard block |
||
403 | 403 | // Fields title label |
404 | 404 | // -------------------------------------------------------------------- |
405 | 405 | print '<tr class="liste_titre">'; |
406 | -foreach($objectwebsiteaccount->fields as $key => $val) |
|
406 | +foreach ($objectwebsiteaccount->fields as $key => $val) |
|
407 | 407 | { |
408 | - $align=''; |
|
409 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
410 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
411 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
412 | - if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
408 | + $align = ''; |
|
409 | + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; |
|
410 | + if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap'; |
|
411 | + if ($key == 'status') $align .= ($align ? ' ' : '').'center'; |
|
412 | + if (!empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; |
|
413 | 413 | } |
414 | 414 | // Extra fields |
415 | 415 | // Extra fields |
416 | 416 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
417 | 417 | // Hook fields |
418 | -$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); |
|
419 | -$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
418 | +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); |
|
419 | +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
420 | 420 | print $hookmanager->resPrint; |
421 | -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; |
|
421 | +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; |
|
422 | 422 | print '</tr>'."\n"; |
423 | 423 | |
424 | 424 | |
425 | 425 | // Detect if we need a fetch on each output line |
426 | -$needToFetchEachLine=0; |
|
426 | +$needToFetchEachLine = 0; |
|
427 | 427 | foreach ($extrafields->attribute_computed as $key => $val) |
428 | 428 | { |
429 | - if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
429 | + if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
433 | 433 | // Loop on record |
434 | 434 | // -------------------------------------------------------------------- |
435 | -$i=0; |
|
436 | -$totalarray=array(); |
|
435 | +$i = 0; |
|
436 | +$totalarray = array(); |
|
437 | 437 | while ($i < min($num, $limit)) |
438 | 438 | { |
439 | 439 | $obj = $db->fetch_object($resql); |
440 | - if (empty($obj)) break; // Should not happen |
|
440 | + if (empty($obj)) break; // Should not happen |
|
441 | 441 | |
442 | 442 | // Store properties in $object |
443 | 443 | $objectwebsiteaccount->id = $obj->rowid; |
444 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
444 | + foreach ($objectwebsiteaccount->fields as $key => $val) |
|
445 | 445 | { |
446 | 446 | if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; |
447 | 447 | } |
448 | 448 | |
449 | 449 | // Show here line of result |
450 | 450 | print '<tr class="oddeven">'; |
451 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
451 | + foreach ($objectwebsiteaccount->fields as $key => $val) |
|
452 | 452 | { |
453 | - $align=''; |
|
454 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
455 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
456 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
457 | - if (! empty($arrayfields['t.'.$key]['checked'])) |
|
453 | + $align = ''; |
|
454 | + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; |
|
455 | + if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap'; |
|
456 | + if ($key == 'status') $align .= ($align ? ' ' : '').'center'; |
|
457 | + if (!empty($arrayfields['t.'.$key]['checked'])) |
|
458 | 458 | { |
459 | 459 | print '<td'; |
460 | 460 | if ($align) print ' class="'.$align.'"'; |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
463 | 463 | else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
464 | 464 | print '</td>'; |
465 | - if (! $i) $totalarray['nbfield']++; |
|
466 | - if (! empty($val['isameasure'])) |
|
465 | + if (!$i) $totalarray['nbfield']++; |
|
466 | + if (!empty($val['isameasure'])) |
|
467 | 467 | { |
468 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
468 | + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
469 | 469 | $totalarray['val']['t.'.$key] += $obj->$key; |
470 | 470 | } |
471 | 471 | } |
@@ -473,19 +473,19 @@ discard block |
||
473 | 473 | // Extra fields |
474 | 474 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
475 | 475 | // Fields from hook |
476 | - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
477 | - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
476 | + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
477 | + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
478 | 478 | print $hookmanager->resPrint; |
479 | 479 | // Action column |
480 | 480 | print '<td class="nowrap" align="center">'; |
481 | 481 | if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
482 | 482 | { |
483 | - $selected=0; |
|
484 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
485 | - print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
483 | + $selected = 0; |
|
484 | + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; |
|
485 | + print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; |
|
486 | 486 | } |
487 | 487 | print '</td>'; |
488 | - if (! $i) $totalarray['nbfield']++; |
|
488 | + if (!$i) $totalarray['nbfield']++; |
|
489 | 489 | |
490 | 490 | print '</tr>'; |
491 | 491 | |
@@ -496,11 +496,11 @@ discard block |
||
496 | 496 | if (isset($totalarray['pos'])) |
497 | 497 | { |
498 | 498 | print '<tr class="liste_total">'; |
499 | - $i=0; |
|
499 | + $i = 0; |
|
500 | 500 | while ($i < $totalarray['nbfield']) |
501 | 501 | { |
502 | 502 | $i++; |
503 | - if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
503 | + if (!empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
504 | 504 | else |
505 | 505 | { |
506 | 506 | if ($i == 1) |
@@ -517,16 +517,16 @@ discard block |
||
517 | 517 | // If no record found |
518 | 518 | if ($num == 0) |
519 | 519 | { |
520 | - $colspan=1; |
|
521 | - foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
520 | + $colspan = 1; |
|
521 | + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } |
|
522 | 522 | print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
523 | 523 | } |
524 | 524 | |
525 | 525 | |
526 | 526 | $db->free($resql); |
527 | 527 | |
528 | -$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); |
|
529 | -$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
528 | +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); |
|
529 | +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
530 | 530 | print $hookmanager->resPrint; |
531 | 531 | |
532 | 532 | print '</table>'."\n"; |
@@ -534,23 +534,23 @@ discard block |
||
534 | 534 | |
535 | 535 | print '</form>'."\n"; |
536 | 536 | |
537 | -if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) |
|
537 | +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) |
|
538 | 538 | { |
539 | - $hidegeneratedfilelistifempty=1; |
|
540 | - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; |
|
539 | + $hidegeneratedfilelistifempty = 1; |
|
540 | + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; |
|
541 | 541 | |
542 | 542 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
543 | 543 | $formfile = new FormFile($db); |
544 | 544 | |
545 | 545 | // Show list of available documents |
546 | - $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
547 | - $urlsource.=str_replace('&','&',$param); |
|
546 | + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
547 | + $urlsource .= str_replace('&', '&', $param); |
|
548 | 548 | |
549 | - $filedir=$diroutputmassaction; |
|
550 | - $genallowed=$user->rights->mymodule->read; |
|
551 | - $delallowed=$user->rights->mymodule->create; |
|
549 | + $filedir = $diroutputmassaction; |
|
550 | + $genallowed = $user->rights->mymodule->read; |
|
551 | + $delallowed = $user->rights->mymodule->create; |
|
552 | 552 | |
553 | - print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); |
|
553 | + print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | // End of page |