@@ -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 | ?> |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | |
154 | 154 | <?php |
155 | 155 | for ($i=1; $i<=4; $i++) { |
156 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
157 | - if ($i==1 || $i==3) echo '<tr>'; |
|
158 | - echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
159 | - echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
160 | - if ($i==2 || $i==4) echo '</tr>'; |
|
161 | - } else { |
|
162 | - if ($i==1 || $i==3) echo '<tr>'; |
|
163 | - echo '<td> </td>'; |
|
164 | - echo '<td> </td>'; |
|
165 | - if ($i==2 || $i==4) echo '</tr>'; |
|
166 | - } |
|
156 | + if ($this->control->tpl['langprofid'.$i]!='-') { |
|
157 | + if ($i==1 || $i==3) echo '<tr>'; |
|
158 | + echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
159 | + echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
160 | + if ($i==2 || $i==4) echo '</tr>'; |
|
161 | + } else { |
|
162 | + if ($i==1 || $i==3) echo '<tr>'; |
|
163 | + echo '<td> </td>'; |
|
164 | + echo '<td> </td>'; |
|
165 | + if ($i==2 || $i==4) echo '</tr>'; |
|
166 | + } |
|
167 | 167 | } |
168 | 168 | ?> |
169 | 169 |
@@ -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; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <tr> |
61 | 61 | <td><span class="fieldrequired"><?php echo $langs->trans('ThirdPartyName'); ?></span></td> |
62 | 62 | <td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td> |
63 | - <?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
63 | + <?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
64 | 64 | <td><?php echo $langs->trans('Prefix'); ?></td> |
65 | 65 | <td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>"></td> |
66 | 66 | <?php } ?> |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | </tr> |
104 | 104 | <?php } }?> |
105 | 105 | |
106 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
106 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
107 | 107 | <tr> |
108 | 108 | <td><?php echo $langs->trans('Gencod'); ?></td> |
109 | 109 | <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td> |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | </tr> |
141 | 141 | |
142 | 142 | <tr> |
143 | - <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td> |
|
143 | + <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td> |
|
144 | 144 | <td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td> |
145 | 145 | <td><?php echo $langs->trans('Web'); ?></td> |
146 | 146 | <td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td> |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | </tr> |
153 | 153 | |
154 | 154 | <?php |
155 | -for ($i=1; $i<=4; $i++) { |
|
156 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
157 | - if ($i==1 || $i==3) echo '<tr>'; |
|
155 | +for ($i = 1; $i <= 4; $i++) { |
|
156 | + if ($this->control->tpl['langprofid'.$i] != '-') { |
|
157 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
158 | 158 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
159 | 159 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
160 | - if ($i==2 || $i==4) echo '</tr>'; |
|
160 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
161 | 161 | } else { |
162 | - if ($i==1 || $i==3) echo '<tr>'; |
|
162 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
163 | 163 | echo '<td> </td>'; |
164 | 164 | echo '<td> </td>'; |
165 | - if ($i==2 || $i==4) echo '</tr>'; |
|
165 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | ?> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | <td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td> |
180 | 180 | </tr> |
181 | 181 | |
182 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
182 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
183 | 183 | <tr> |
184 | 184 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
185 | 185 | <td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | <td class="nowrap"><?php echo $this->control->tpl['tva_intra']; ?></td> |
194 | 194 | </tr> |
195 | 195 | |
196 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
196 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
197 | 197 | |
198 | 198 | <?php if ($user->rights->societe->client->voir) { ?> |
199 | 199 | <tr> |
@@ -43,7 +43,10 @@ discard block |
||
43 | 43 | <?php echo $this->control->tpl['ajax_selectcountry']; ?> |
44 | 44 | <?php } ?> |
45 | 45 | |
46 | -<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> |
|
46 | +<?php if ($this->control->tpl['js_checkVatPopup']) { |
|
47 | + echo $this->control->tpl['js_checkVatPopup']; |
|
48 | +} |
|
49 | +?> |
|
47 | 50 | |
48 | 51 | <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc"> |
49 | 52 | |
@@ -154,15 +157,23 @@ discard block |
||
154 | 157 | <?php |
155 | 158 | for ($i=1; $i<=4; $i++) { |
156 | 159 | if ($this->control->tpl['langprofid'.$i]!='-') { |
157 | - if ($i==1 || $i==3) echo '<tr>'; |
|
160 | + if ($i==1 || $i==3) { |
|
161 | + echo '<tr>'; |
|
162 | + } |
|
158 | 163 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
159 | 164 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
160 | - if ($i==2 || $i==4) echo '</tr>'; |
|
165 | + if ($i==2 || $i==4) { |
|
166 | + echo '</tr>'; |
|
167 | + } |
|
161 | 168 | } else { |
162 | - if ($i==1 || $i==3) echo '<tr>'; |
|
169 | + if ($i==1 || $i==3) { |
|
170 | + echo '<tr>'; |
|
171 | + } |
|
163 | 172 | echo '<td> </td>'; |
164 | 173 | echo '<td> </td>'; |
165 | - if ($i==2 || $i==4) echo '</tr>'; |
|
174 | + if ($i==2 || $i==4) { |
|
175 | + echo '</tr>'; |
|
176 | + } |
|
166 | 177 | } |
167 | 178 | } |
168 | 179 | ?> |
@@ -193,7 +204,10 @@ discard block |
||
193 | 204 | <td class="nowrap"><?php echo $this->control->tpl['tva_intra']; ?></td> |
194 | 205 | </tr> |
195 | 206 | |
196 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
207 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
208 | + echo $this->control->tpl['localtax']; |
|
209 | +} |
|
210 | +?> |
|
197 | 211 | |
198 | 212 | <?php if ($user->rights->societe->client->voir) { ?> |
199 | 213 | <tr> |
@@ -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) |