@@ -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 | } |
@@ -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>'; |
@@ -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> |
@@ -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 } ?> |
@@ -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> |
@@ -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) |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Security check |
| 43 | 43 | $id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int'); |
| 44 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 44 | +if ($user->societe_id) { |
|
| 45 | + $socid=$user->societe_id; |
|
| 46 | +} |
|
| 45 | 47 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
| 46 | 48 | |
| 47 | 49 | $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
@@ -52,8 +54,12 @@ discard block |
||
| 52 | 54 | $offset = $limit * $page; |
| 53 | 55 | $pageprev = $page - 1; |
| 54 | 56 | $pagenext = $page + 1; |
| 55 | -if (! $sortfield) $sortfield='t.login'; |
|
| 56 | -if (! $sortorder) $sortorder='ASC'; |
|
| 57 | +if (! $sortfield) { |
|
| 58 | + $sortfield='t.login'; |
|
| 59 | +} |
|
| 60 | +if (! $sortorder) { |
|
| 61 | + $sortorder='ASC'; |
|
| 62 | +} |
|
| 57 | 63 | |
| 58 | 64 | // Initialize technical objects |
| 59 | 65 | $object=new Societe($db); |
@@ -72,30 +78,38 @@ discard block |
||
| 72 | 78 | $search=array(); |
| 73 | 79 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 74 | 80 | { |
| 75 | - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
| 76 | -} |
|
| 81 | + if (GETPOST('search_'.$key,'alpha')) { |
|
| 82 | + $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
| 83 | + } |
|
| 84 | + } |
|
| 77 | 85 | |
| 78 | 86 | // List of fields to search into when doing a "search in all" |
| 79 | 87 | $fieldstosearchall = array(); |
| 80 | 88 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 81 | 89 | { |
| 82 | - if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; |
|
| 83 | -} |
|
| 90 | + if ($val['searchall']) { |
|
| 91 | + $fieldstosearchall['t.'.$key]=$val['label']; |
|
| 92 | + } |
|
| 93 | + } |
|
| 84 | 94 | |
| 85 | 95 | // Definition of fields for list |
| 86 | 96 | $arrayfields=array(); |
| 87 | 97 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 88 | 98 | { |
| 89 | 99 | // If $val['visible']==0, then we never show the field |
| 90 | - if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
| 91 | -} |
|
| 100 | + if (! empty($val['visible'])) { |
|
| 101 | + $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
| 102 | + } |
|
| 103 | + } |
|
| 92 | 104 | |
| 93 | 105 | // Extra fields |
| 94 | 106 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
| 95 | 107 | { |
| 96 | 108 | foreach($extrafields->attribute_label as $key => $val) |
| 97 | 109 | { |
| 98 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
| 110 | + if (! empty($extrafields->attribute_list[$key])) { |
|
| 111 | + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
| 112 | + } |
|
| 99 | 113 | } |
| 100 | 114 | } |
| 101 | 115 | |
@@ -111,7 +125,9 @@ discard block |
||
| 111 | 125 | |
| 112 | 126 | $parameters=array('id'=>$socid); |
| 113 | 127 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
| 114 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 128 | +if ($reshook < 0) { |
|
| 129 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 130 | +} |
|
| 115 | 131 | |
| 116 | 132 | if (empty($reshook)) |
| 117 | 133 | { |
@@ -126,11 +142,13 @@ discard block |
||
| 126 | 142 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
| 127 | 143 | |
| 128 | 144 | // Purge search criteria |
| 129 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 145 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) { |
|
| 146 | + // All tests are required to be compatible with all browsers |
|
| 130 | 147 | { |
| 131 | 148 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 132 | 149 | { |
| 133 | 150 | $search[$key]=''; |
| 151 | + } |
|
| 134 | 152 | } |
| 135 | 153 | $toselect=''; |
| 136 | 154 | $search_array_options=array(); |
@@ -166,14 +184,22 @@ discard block |
||
| 166 | 184 | llxHeader('', $title); |
| 167 | 185 | |
| 168 | 186 | $param=''; |
| 169 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
| 170 | -if ($id > 0) $param.='&id='.urlencode($id); |
|
| 171 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
| 187 | +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 188 | + $param.='&contextpage='.urlencode($contextpage); |
|
| 189 | +} |
|
| 190 | +if ($id > 0) { |
|
| 191 | + $param.='&id='.urlencode($id); |
|
| 192 | +} |
|
| 193 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 194 | + $param.='&limit='.urlencode($limit); |
|
| 195 | +} |
|
| 172 | 196 | foreach($search as $key => $val) |
| 173 | 197 | { |
| 174 | 198 | $param.= '&search_'.$key.'='.urlencode($search[$key]); |
| 175 | 199 | } |
| 176 | -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
| 200 | +if ($optioncss != '') { |
|
| 201 | + $param.='&optioncss='.urlencode($optioncss); |
|
| 202 | +} |
|
| 177 | 203 | // Add $param from extra fields |
| 178 | 204 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 179 | 205 | |
@@ -192,17 +218,20 @@ discard block |
||
| 192 | 218 | print '<table class="border centpercent">'; |
| 193 | 219 | |
| 194 | 220 | // Prefix |
| 195 | -if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 221 | +if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 222 | + // Old not used prefix field |
|
| 196 | 223 | { |
| 197 | 224 | print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>'; |
| 198 | 225 | } |
| 226 | +} |
|
| 199 | 227 | |
| 200 | 228 | if ($object->client) { |
| 201 | 229 | print '<tr><td class="titlefield">'; |
| 202 | 230 | print $langs->trans('CustomerCode') . '</td><td colspan="3">'; |
| 203 | 231 | print $object->code_client; |
| 204 | - if ($object->check_codeclient() != 0) |
|
| 205 | - print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
| 232 | + if ($object->check_codeclient() != 0) { |
|
| 233 | + print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
| 234 | + } |
|
| 206 | 235 | print '</td></tr>'; |
| 207 | 236 | } |
| 208 | 237 | |
@@ -210,8 +239,9 @@ discard block |
||
| 210 | 239 | print '<tr><td class="titlefield">'; |
| 211 | 240 | print $langs->trans('SupplierCode') . '</td><td colspan="3">'; |
| 212 | 241 | print $object->code_fournisseur; |
| 213 | - if ($object->check_codefournisseur() != 0) |
|
| 214 | - print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
| 242 | + if ($object->check_codefournisseur() != 0) { |
|
| 243 | + print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
| 244 | + } |
|
| 215 | 245 | print '</td></tr>'; |
| 216 | 246 | } |
| 217 | 247 | |
@@ -246,23 +276,34 @@ discard block |
||
| 246 | 276 | $sql.='t.'.$key.', '; |
| 247 | 277 | } |
| 248 | 278 | // Add fields from extrafields |
| 249 | -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
| 279 | +foreach ($extrafields->attribute_label as $key => $val) { |
|
| 280 | + $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
| 281 | +} |
|
| 250 | 282 | // Add fields from hooks |
| 251 | 283 | $parameters=array(); |
| 252 | 284 | $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
| 253 | 285 | $sql.=$hookmanager->resPrint; |
| 254 | 286 | $sql=preg_replace('/, $/','', $sql); |
| 255 | 287 | $sql.= " FROM ".MAIN_DB_PREFIX."societe_account as t"; |
| 256 | -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
| 257 | -if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
| 258 | -else $sql.=" WHERE 1 = 1"; |
|
| 288 | +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
|
| 289 | + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
| 290 | +} |
|
| 291 | +if ($objectwebsiteaccount->ismultientitymanaged == 1) { |
|
| 292 | + $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")"; |
|
| 293 | +} else { |
|
| 294 | + $sql.=" WHERE 1 = 1"; |
|
| 295 | +} |
|
| 259 | 296 | $sql.=" AND fk_soc = ".$object->id; |
| 260 | 297 | foreach($search as $key => $val) |
| 261 | 298 | { |
| 262 | 299 | $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); |
| 263 | - if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
| 300 | + if ($search[$key] != '') { |
|
| 301 | + $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | +if ($search_all) { |
|
| 305 | + $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
| 264 | 306 | } |
| 265 | -if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
| 266 | 307 | // Add where from extra fields |
| 267 | 308 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
| 268 | 309 | // Add where from hooks |
@@ -292,9 +333,11 @@ discard block |
||
| 292 | 333 | { |
| 293 | 334 | $result = $db->query($sql); |
| 294 | 335 | $nbtotalofrecords = $db->num_rows($result); |
| 295 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 336 | + if (($page * $limit) > $nbtotalofrecords) { |
|
| 337 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 296 | 338 | { |
| 297 | 339 | $page = 0; |
| 340 | + } |
|
| 298 | 341 | $offset = 0; |
| 299 | 342 | } |
| 300 | 343 | } |
@@ -317,12 +360,18 @@ discard block |
||
| 317 | 360 | //'presend'=>$langs->trans("SendByMail"), |
| 318 | 361 | //'builddoc'=>$langs->trans("PDFMerge"), |
| 319 | 362 | ); |
| 320 | -if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
| 321 | -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
| 363 | +if ($user->rights->mymodule->delete) { |
|
| 364 | + $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
| 365 | +} |
|
| 366 | +if (in_array($massaction, array('presend','predelete'))) { |
|
| 367 | + $arrayofmassactions=array(); |
|
| 368 | +} |
|
| 322 | 369 | $massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
| 323 | 370 | |
| 324 | 371 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
| 325 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 372 | +if ($optioncss != '') { |
|
| 373 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 374 | +} |
|
| 326 | 375 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 327 | 376 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
| 328 | 377 | print '<input type="hidden" name="action" value="list">'; |
@@ -342,7 +391,9 @@ discard block |
||
| 342 | 391 | |
| 343 | 392 | if ($sall) |
| 344 | 393 | { |
| 345 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
| 394 | + foreach($fieldstosearchall as $key => $val) { |
|
| 395 | + $fieldstosearchall[$key]=$langs->trans($val); |
|
| 396 | + } |
|
| 346 | 397 | print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
| 347 | 398 | } |
| 348 | 399 | |
@@ -353,8 +404,11 @@ discard block |
||
| 353 | 404 | |
| 354 | 405 | $parameters=array(); |
| 355 | 406 | $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook |
| 356 | -if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; |
|
| 357 | -else $moreforfilter = $hookmanager->resPrint; |
|
| 407 | +if (empty($reshook)) { |
|
| 408 | + $moreforfilter .= $hookmanager->resPrint; |
|
| 409 | +} else { |
|
| 410 | + $moreforfilter = $hookmanager->resPrint; |
|
| 411 | +} |
|
| 358 | 412 | |
| 359 | 413 | if (! empty($moreforfilter)) |
| 360 | 414 | { |
@@ -377,11 +431,19 @@ discard block |
||
| 377 | 431 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 378 | 432 | { |
| 379 | 433 | $align=''; |
| 380 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 381 | - if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; |
|
| 382 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 383 | - if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
| 384 | -} |
|
| 434 | + if (in_array($val['type'], array('date','datetime','timestamp'))) { |
|
| 435 | + $align='center'; |
|
| 436 | + } |
|
| 437 | + if (in_array($val['type'], array('timestamp'))) { |
|
| 438 | + $align.=' nowrap'; |
|
| 439 | + } |
|
| 440 | + if ($key == 'status') { |
|
| 441 | + $align.=($align?' ':'').'center'; |
|
| 442 | + } |
|
| 443 | + if (! empty($arrayfields['t.'.$key]['checked'])) { |
|
| 444 | + print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
| 445 | + } |
|
| 446 | + } |
|
| 385 | 447 | // Extra fields |
| 386 | 448 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
| 387 | 449 | // Fields from hook |
@@ -402,11 +464,19 @@ discard block |
||
| 402 | 464 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 403 | 465 | { |
| 404 | 466 | $align=''; |
| 405 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 406 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
| 407 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 408 | - if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
| 409 | -} |
|
| 467 | + if (in_array($val['type'], array('date','datetime','timestamp'))) { |
|
| 468 | + $align='center'; |
|
| 469 | + } |
|
| 470 | + if (in_array($val['type'], array('timestamp'))) { |
|
| 471 | + $align.='nowrap'; |
|
| 472 | + } |
|
| 473 | + if ($key == 'status') { |
|
| 474 | + $align.=($align?' ':'').'center'; |
|
| 475 | + } |
|
| 476 | + if (! empty($arrayfields['t.'.$key]['checked'])) { |
|
| 477 | + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
| 478 | + } |
|
| 479 | + } |
|
| 410 | 480 | // Extra fields |
| 411 | 481 | // Extra fields |
| 412 | 482 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
@@ -422,7 +492,10 @@ discard block |
||
| 422 | 492 | $needToFetchEachLine=0; |
| 423 | 493 | foreach ($extrafields->attribute_computed as $key => $val) |
| 424 | 494 | { |
| 425 | - if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
| 495 | + if (preg_match('/\$object/',$val)) { |
|
| 496 | + $needToFetchEachLine++; |
|
| 497 | + } |
|
| 498 | + // There is at least one compute field that use $object |
|
| 426 | 499 | } |
| 427 | 500 | |
| 428 | 501 | |
@@ -433,13 +506,18 @@ discard block |
||
| 433 | 506 | while ($i < min($num, $limit)) |
| 434 | 507 | { |
| 435 | 508 | $obj = $db->fetch_object($resql); |
| 436 | - if (empty($obj)) break; // Should not happen |
|
| 509 | + if (empty($obj)) { |
|
| 510 | + break; |
|
| 511 | + } |
|
| 512 | + // Should not happen |
|
| 437 | 513 | |
| 438 | 514 | // Store properties in $object |
| 439 | 515 | $objectwebsiteaccount->id = $obj->rowid; |
| 440 | 516 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 441 | 517 | { |
| 442 | - if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; |
|
| 518 | + if (isset($obj->$key)) { |
|
| 519 | + $objectwebsiteaccount->$key = $obj->$key; |
|
| 520 | + } |
|
| 443 | 521 | } |
| 444 | 522 | |
| 445 | 523 | // Show here line of result |
@@ -447,21 +525,36 @@ discard block |
||
| 447 | 525 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 448 | 526 | { |
| 449 | 527 | $align=''; |
| 450 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 451 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
| 452 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 528 | + if (in_array($val['type'], array('date','datetime','timestamp'))) { |
|
| 529 | + $align='center'; |
|
| 530 | + } |
|
| 531 | + if (in_array($val['type'], array('timestamp'))) { |
|
| 532 | + $align.='nowrap'; |
|
| 533 | + } |
|
| 534 | + if ($key == 'status') { |
|
| 535 | + $align.=($align?' ':'').'center'; |
|
| 536 | + } |
|
| 453 | 537 | if (! empty($arrayfields['t.'.$key]['checked'])) |
| 454 | 538 | { |
| 455 | 539 | print '<td'; |
| 456 | - if ($align) print ' class="'.$align.'"'; |
|
| 540 | + if ($align) { |
|
| 541 | + print ' class="'.$align.'"'; |
|
| 542 | + } |
|
| 457 | 543 | print '>'; |
| 458 | - if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
| 459 | - else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
| 544 | + if ($key == 'login') { |
|
| 545 | + print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
| 546 | + } else { |
|
| 547 | + print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
| 548 | + } |
|
| 460 | 549 | print '</td>'; |
| 461 | - if (! $i) $totalarray['nbfield']++; |
|
| 550 | + if (! $i) { |
|
| 551 | + $totalarray['nbfield']++; |
|
| 552 | + } |
|
| 462 | 553 | if (! empty($val['isameasure'])) |
| 463 | 554 | { |
| 464 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
| 555 | + if (! $i) { |
|
| 556 | + $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
| 557 | + } |
|
| 465 | 558 | $totalarray['val']['t.'.$key] += $obj->$key; |
| 466 | 559 | } |
| 467 | 560 | } |
@@ -474,14 +567,20 @@ discard block |
||
| 474 | 567 | print $hookmanager->resPrint; |
| 475 | 568 | // Action column |
| 476 | 569 | print '<td class="nowrap" align="center">'; |
| 477 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
| 570 | + if ($massactionbutton || $massaction) { |
|
| 571 | + // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
| 478 | 572 | { |
| 479 | 573 | $selected=0; |
| 480 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
| 574 | + } |
|
| 575 | + if (in_array($obj->rowid, $arrayofselected)) { |
|
| 576 | + $selected=1; |
|
| 577 | + } |
|
| 481 | 578 | print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
| 482 | 579 | } |
| 483 | 580 | print '</td>'; |
| 484 | - if (! $i) $totalarray['nbfield']++; |
|
| 581 | + if (! $i) { |
|
| 582 | + $totalarray['nbfield']++; |
|
| 583 | + } |
|
| 485 | 584 | |
| 486 | 585 | print '</tr>'; |
| 487 | 586 | |
@@ -496,15 +595,20 @@ discard block |
||
| 496 | 595 | while ($i < $totalarray['nbfield']) |
| 497 | 596 | { |
| 498 | 597 | $i++; |
| 499 | - if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
| 500 | - else |
|
| 598 | + if (! empty($totalarray['pos'][$i])) { |
|
| 599 | + print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
| 600 | + } else |
|
| 501 | 601 | { |
| 502 | 602 | if ($i == 1) |
| 503 | 603 | { |
| 504 | - if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
| 505 | - else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
| 604 | + if ($num < $limit) { |
|
| 605 | + print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
| 606 | + } else { |
|
| 607 | + print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
| 608 | + } |
|
| 609 | + } else { |
|
| 610 | + print '<td></td>'; |
|
| 506 | 611 | } |
| 507 | - else print '<td></td>'; |
|
| 508 | 612 | } |
| 509 | 613 | } |
| 510 | 614 | print '</tr>'; |
@@ -514,7 +618,10 @@ discard block |
||
| 514 | 618 | if ($num == 0) |
| 515 | 619 | { |
| 516 | 620 | $colspan=1; |
| 517 | - foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
| 621 | + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) { |
|
| 622 | + $colspan++; |
|
| 623 | + } |
|
| 624 | + } |
|
| 518 | 625 | print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
| 519 | 626 | } |
| 520 | 627 | |
@@ -533,7 +640,9 @@ discard block |
||
| 533 | 640 | if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) |
| 534 | 641 | { |
| 535 | 642 | $hidegeneratedfilelistifempty=1; |
| 536 | - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; |
|
| 643 | + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { |
|
| 644 | + $hidegeneratedfilelistifempty=0; |
|
| 645 | + } |
|
| 537 | 646 | |
| 538 | 647 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
| 539 | 648 | $formfile = new FormFile($db); |
@@ -37,9 +37,10 @@ discard block |
||
| 37 | 37 | if (GETPOST('actioncode','array')) |
| 38 | 38 | { |
| 39 | 39 | $actioncode=GETPOST('actioncode','array',3); |
| 40 | - if (! count($actioncode)) $actioncode='0'; |
|
| 41 | -} |
|
| 42 | -else |
|
| 40 | + if (! count($actioncode)) { |
|
| 41 | + $actioncode='0'; |
|
| 42 | + } |
|
| 43 | + } else |
|
| 43 | 44 | { |
| 44 | 45 | $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); |
| 45 | 46 | } |
@@ -47,7 +48,9 @@ discard block |
||
| 47 | 48 | |
| 48 | 49 | // Security check |
| 49 | 50 | $socid = GETPOST('socid','int'); |
| 50 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 51 | +if ($user->societe_id) { |
|
| 52 | + $socid=$user->societe_id; |
|
| 53 | +} |
|
| 51 | 54 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
| 52 | 55 | |
| 53 | 56 | $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
@@ -58,8 +61,12 @@ discard block |
||
| 58 | 61 | $offset = $limit * $page; |
| 59 | 62 | $pageprev = $page - 1; |
| 60 | 63 | $pagenext = $page + 1; |
| 61 | -if (! $sortfield) $sortfield='a.datep,a.id'; |
|
| 62 | -if (! $sortorder) $sortorder='DESC,DESC'; |
|
| 64 | +if (! $sortfield) { |
|
| 65 | + $sortfield='a.datep,a.id'; |
|
| 66 | +} |
|
| 67 | +if (! $sortorder) { |
|
| 68 | + $sortorder='DESC,DESC'; |
|
| 69 | +} |
|
| 63 | 70 | |
| 64 | 71 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 65 | 72 | $hookmanager->initHooks(array('agendathirdparty')); |
@@ -71,7 +78,9 @@ discard block |
||
| 71 | 78 | |
| 72 | 79 | $parameters=array('id'=>$socid); |
| 73 | 80 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
| 74 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 81 | +if ($reshook < 0) { |
|
| 82 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 83 | +} |
|
| 75 | 84 | |
| 76 | 85 | if (empty($reshook)) |
| 77 | 86 | { |
@@ -83,9 +92,11 @@ discard block |
||
| 83 | 92 | } |
| 84 | 93 | |
| 85 | 94 | // Purge search criteria |
| 86 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 95 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) { |
|
| 96 | + // All tests are required to be compatible with all browsers |
|
| 87 | 97 | { |
| 88 | 98 | $actioncode=''; |
| 99 | + } |
|
| 89 | 100 | $search_agenda_label=''; |
| 90 | 101 | } |
| 91 | 102 | } |
@@ -110,10 +121,14 @@ discard block |
||
| 110 | 121 | $result = $object->fetch($socid); |
| 111 | 122 | |
| 112 | 123 | $title=$langs->trans("Agenda"); |
| 113 | - if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; |
|
| 124 | + if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
| 125 | + $title=$object->name." - ".$title; |
|
| 126 | + } |
|
| 114 | 127 | llxHeader('',$title); |
| 115 | 128 | |
| 116 | - if (! empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 129 | + if (! empty($conf->notification->enabled)) { |
|
| 130 | + $langs->load("mails"); |
|
| 131 | + } |
|
| 117 | 132 | $head = societe_prepare_head($object); |
| 118 | 133 | |
| 119 | 134 | dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company'); |
@@ -145,7 +160,9 @@ discard block |
||
| 145 | 160 | if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) |
| 146 | 161 | { |
| 147 | 162 | //$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'; |
| 148 | - if (get_class($objthirdparty) == 'Societe') $out.='&socid='.$objthirdparty->id; |
|
| 163 | + if (get_class($objthirdparty) == 'Societe') { |
|
| 164 | + $out.='&socid='.$objthirdparty->id; |
|
| 165 | + } |
|
| 149 | 166 | $out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1'; |
| 150 | 167 | //$out.=$langs->trans("AddAnAction").' '; |
| 151 | 168 | //$out.=img_picto($langs->trans("AddAnAction"),'filenew'); |
@@ -173,8 +190,12 @@ discard block |
||
| 173 | 190 | print '<br>'; |
| 174 | 191 | |
| 175 | 192 | $param='&socid='.$socid; |
| 176 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 177 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 193 | + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 194 | + $param.='&contextpage='.$contextpage; |
|
| 195 | + } |
|
| 196 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 197 | + $param.='&limit='.$limit; |
|
| 198 | + } |
|
| 178 | 199 | |
| 179 | 200 | print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, ''); |
| 180 | 201 | //print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1); |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | $action=GETPOST('action','alpha'); |
| 35 | 35 | $value=GETPOST('value','alpha'); |
| 36 | 36 | |
| 37 | -if (!$user->admin) accessforbidden(); |
|
| 37 | +if (!$user->admin) { |
|
| 38 | + accessforbidden(); |
|
| 39 | +} |
|
| 38 | 40 | |
| 39 | 41 | |
| 40 | 42 | |
@@ -50,8 +52,7 @@ discard block |
||
| 50 | 52 | { |
| 51 | 53 | header("Location: ".$_SERVER["PHP_SELF"]); |
| 52 | 54 | exit; |
| 53 | - } |
|
| 54 | - else |
|
| 55 | + } else |
|
| 55 | 56 | { |
| 56 | 57 | dol_print_error($db); |
| 57 | 58 | } |
@@ -63,8 +64,7 @@ discard block |
||
| 63 | 64 | { |
| 64 | 65 | header("Location: ".$_SERVER["PHP_SELF"]); |
| 65 | 66 | exit; |
| 66 | - } |
|
| 67 | - else |
|
| 67 | + } else |
|
| 68 | 68 | { |
| 69 | 69 | dol_print_error($db); |
| 70 | 70 | } |
@@ -76,12 +76,13 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha'); |
| 78 | 78 | $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity); |
| 79 | - if (! $res > 0) $error++; |
|
| 79 | + if (! $res > 0) { |
|
| 80 | + $error++; |
|
| 81 | + } |
|
| 80 | 82 | if (! $error) |
| 81 | 83 | { |
| 82 | 84 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 83 | - } |
|
| 84 | - else |
|
| 85 | + } else |
|
| 85 | 86 | { |
| 86 | 87 | setEventMessages($langs->trans("Error"), null, 'errors'); |
| 87 | 88 | } |
@@ -91,12 +92,13 @@ discard block |
||
| 91 | 92 | { |
| 92 | 93 | $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha'); |
| 93 | 94 | $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity); |
| 94 | - if (! $res > 0) $error++; |
|
| 95 | + if (! $res > 0) { |
|
| 96 | + $error++; |
|
| 97 | + } |
|
| 95 | 98 | if (! $error) |
| 96 | 99 | { |
| 97 | 100 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 98 | - } |
|
| 99 | - else |
|
| 101 | + } else |
|
| 100 | 102 | { |
| 101 | 103 | setEventMessages($langs->trans("Error"), null, 'errors'); |
| 102 | 104 | } |
@@ -117,8 +119,10 @@ discard block |
||
| 117 | 119 | $sql.= ")"; |
| 118 | 120 | |
| 119 | 121 | $resql=$db->query($sql); |
| 120 | - if (! $resql) dol_print_error($db); |
|
| 121 | -} |
|
| 122 | + if (! $resql) { |
|
| 123 | + dol_print_error($db); |
|
| 124 | + } |
|
| 125 | + } |
|
| 122 | 126 | |
| 123 | 127 | // Disable a document generator module |
| 124 | 128 | if ($action== 'del') |
@@ -127,8 +131,10 @@ discard block |
||
| 127 | 131 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; |
| 128 | 132 | $sql.= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity; |
| 129 | 133 | $resql=$db->query($sql); |
| 130 | - if (! $resql) dol_print_error($db); |
|
| 131 | -} |
|
| 134 | + if (! $resql) { |
|
| 135 | + dol_print_error($db); |
|
| 136 | + } |
|
| 137 | + } |
|
| 132 | 138 | |
| 133 | 139 | // Define default generator |
| 134 | 140 | if ($action == 'setdoc') |
@@ -159,8 +165,7 @@ discard block |
||
| 159 | 165 | if ($result1 && $result2) |
| 160 | 166 | { |
| 161 | 167 | $db->commit(); |
| 162 | - } |
|
| 163 | - else |
|
| 168 | + } else |
|
| 164 | 169 | { |
| 165 | 170 | $db->rollback(); |
| 166 | 171 | } |
@@ -170,12 +175,13 @@ discard block |
||
| 170 | 175 | if ($action=="setaddrefinlist") { |
| 171 | 176 | $setaddrefinlist = GETPOST('value','int'); |
| 172 | 177 | $res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist,'yesno',0,'',$conf->entity); |
| 173 | - if (! $res > 0) $error++; |
|
| 178 | + if (! $res > 0) { |
|
| 179 | + $error++; |
|
| 180 | + } |
|
| 174 | 181 | if (! $error) |
| 175 | 182 | { |
| 176 | 183 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 177 | - } |
|
| 178 | - else |
|
| 184 | + } else |
|
| 179 | 185 | { |
| 180 | 186 | setEventMessages($langs->trans("Error"), null, 'errors'); |
| 181 | 187 | } |
@@ -185,12 +191,13 @@ discard block |
||
| 185 | 191 | if ($action=="setaddadressinlist") { |
| 186 | 192 | $val = GETPOST('value','int'); |
| 187 | 193 | $res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val,'yesno',0,'',$conf->entity); |
| 188 | - if (! $res > 0) $error++; |
|
| 194 | + if (! $res > 0) { |
|
| 195 | + $error++; |
|
| 196 | + } |
|
| 189 | 197 | if (! $error) |
| 190 | 198 | { |
| 191 | 199 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 192 | - } |
|
| 193 | - else |
|
| 200 | + } else |
|
| 194 | 201 | { |
| 195 | 202 | setEventMessages($langs->trans("Error"), null, 'errors'); |
| 196 | 203 | } |
@@ -200,12 +207,13 @@ discard block |
||
| 200 | 207 | if ($action=="setaskforshippingmet") { |
| 201 | 208 | $setaskforshippingmet = GETPOST('value','int'); |
| 202 | 209 | $res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet,'yesno',0,'',$conf->entity); |
| 203 | - if (! $res > 0) $error++; |
|
| 210 | + if (! $res > 0) { |
|
| 211 | + $error++; |
|
| 212 | + } |
|
| 204 | 213 | if (! $error) |
| 205 | 214 | { |
| 206 | 215 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 207 | - } |
|
| 208 | - else |
|
| 216 | + } else |
|
| 209 | 217 | { |
| 210 | 218 | setEventMessages($langs->trans("Error"), null, 'errors'); |
| 211 | 219 | } |
@@ -215,12 +223,13 @@ discard block |
||
| 215 | 223 | if ($action=="setdisableprospectcustomer") { |
| 216 | 224 | $setdisableprospectcustomer = GETPOST('value','int'); |
| 217 | 225 | $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer,'yesno',0,'',$conf->entity); |
| 218 | - if (! $res > 0) $error++; |
|
| 226 | + if (! $res > 0) { |
|
| 227 | + $error++; |
|
| 228 | + } |
|
| 219 | 229 | if (! $error) |
| 220 | 230 | { |
| 221 | 231 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 222 | - } |
|
| 223 | - else |
|
| 232 | + } else |
|
| 224 | 233 | { |
| 225 | 234 | setEventMessages($langs->trans("Error"), null, 'errors'); |
| 226 | 235 | } |
@@ -236,8 +245,7 @@ discard block |
||
| 236 | 245 | { |
| 237 | 246 | //header("Location: ".$_SERVER["PHP_SELF"]); |
| 238 | 247 | //exit; |
| 239 | - } |
|
| 240 | - else |
|
| 248 | + } else |
|
| 241 | 249 | { |
| 242 | 250 | dol_print_error($db); |
| 243 | 251 | } |
@@ -253,8 +261,7 @@ discard block |
||
| 253 | 261 | { |
| 254 | 262 | //header("Location: ".$_SERVER["PHP_SELF"]); |
| 255 | 263 | //exit; |
| 256 | - } |
|
| 257 | - else |
|
| 264 | + } else |
|
| 258 | 265 | { |
| 259 | 266 | dol_print_error($db); |
| 260 | 267 | } |
@@ -270,8 +277,7 @@ discard block |
||
| 270 | 277 | { |
| 271 | 278 | //header("Location: ".$_SERVER["PHP_SELF"]); |
| 272 | 279 | //exit; |
| 273 | - } |
|
| 274 | - else |
|
| 280 | + } else |
|
| 275 | 281 | { |
| 276 | 282 | dol_print_error($db); |
| 277 | 283 | } |
@@ -286,8 +292,7 @@ discard block |
||
| 286 | 292 | { |
| 287 | 293 | header("Location: ".$_SERVER["PHP_SELF"]); |
| 288 | 294 | exit; |
| 289 | - } |
|
| 290 | - else |
|
| 295 | + } else |
|
| 291 | 296 | { |
| 292 | 297 | dol_print_error($db); |
| 293 | 298 | } |
@@ -295,12 +300,13 @@ discard block |
||
| 295 | 300 | if($action=='setonsearchandlistgooncustomerorsuppliercard'){ |
| 296 | 301 | $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value','int'); |
| 297 | 302 | $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard,'yesno',0,'',$conf->entity); |
| 298 | - if (! $res > 0) $error++; |
|
| 303 | + if (! $res > 0) { |
|
| 304 | + $error++; |
|
| 305 | + } |
|
| 299 | 306 | if (! $error) |
| 300 | 307 | { |
| 301 | 308 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 302 | - } |
|
| 303 | - else |
|
| 309 | + } else |
|
| 304 | 310 | { |
| 305 | 311 | setEventMessages($langs->trans("Error"), null, 'errors'); |
| 306 | 312 | } |
@@ -357,8 +363,7 @@ discard block |
||
| 357 | 363 | |
| 358 | 364 | try { |
| 359 | 365 | dol_include_once($dirroot.$file.'.php'); |
| 360 | - } |
|
| 361 | - catch(Exception $e) |
|
| 366 | + } catch(Exception $e) |
|
| 362 | 367 | { |
| 363 | 368 | dol_syslog($e->getMessage(), LOG_ERR); |
| 364 | 369 | } |
@@ -366,8 +371,12 @@ discard block |
||
| 366 | 371 | $modCodeTiers = new $file; |
| 367 | 372 | |
| 368 | 373 | // Show modules according to features level |
| 369 | - if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; |
|
| 370 | - if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; |
|
| 374 | + if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { |
|
| 375 | + continue; |
|
| 376 | + } |
|
| 377 | + if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { |
|
| 378 | + continue; |
|
| 379 | + } |
|
| 371 | 380 | |
| 372 | 381 | print '<tr class="oddeven">'."\n"; |
| 373 | 382 | print '<td width="140">'.$modCodeTiers->name.'</td>'."\n"; |
@@ -379,15 +388,18 @@ discard block |
||
| 379 | 388 | print '<td align="center">'."\n"; |
| 380 | 389 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 381 | 390 | print "</td>\n"; |
| 382 | - } |
|
| 383 | - else |
|
| 391 | + } else |
|
| 384 | 392 | { |
| 385 | 393 | $disabled = false; |
| 386 | 394 | if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); |
| 387 | 395 | print '<td align="center">'; |
| 388 | - if (! $disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">'; |
|
| 396 | + if (! $disabled) { |
|
| 397 | + print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">'; |
|
| 398 | + } |
|
| 389 | 399 | print img_picto($langs->trans("Disabled"),'switch_off'); |
| 390 | - if (! $disabled) print '</a>'; |
|
| 400 | + if (! $disabled) { |
|
| 401 | + print '</a>'; |
|
| 402 | + } |
|
| 391 | 403 | print '</td>'; |
| 392 | 404 | } |
| 393 | 405 | |
@@ -436,8 +448,7 @@ discard block |
||
| 436 | 448 | |
| 437 | 449 | try { |
| 438 | 450 | dol_include_once($dirroot.$file.'.php'); |
| 439 | - } |
|
| 440 | - catch(Exception $e) |
|
| 451 | + } catch(Exception $e) |
|
| 441 | 452 | { |
| 442 | 453 | dol_syslog($e->getMessage(), LOG_ERR); |
| 443 | 454 | } |
@@ -455,8 +466,7 @@ discard block |
||
| 455 | 466 | print '<td align="center">'; |
| 456 | 467 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 457 | 468 | print '</td>'; |
| 458 | - } |
|
| 459 | - else |
|
| 469 | + } else |
|
| 460 | 470 | { |
| 461 | 471 | print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&value='.$file.'">'; |
| 462 | 472 | print img_picto($langs->trans("Disabled"),'switch_off'); |
@@ -498,8 +508,7 @@ discard block |
||
| 498 | 508 | array_push($def, $array[0]); |
| 499 | 509 | $i++; |
| 500 | 510 | } |
| 501 | -} |
|
| 502 | -else |
|
| 511 | +} else |
|
| 503 | 512 | { |
| 504 | 513 | dol_print_error($db); |
| 505 | 514 | } |
@@ -529,8 +538,7 @@ discard block |
||
| 529 | 538 | |
| 530 | 539 | try { |
| 531 | 540 | dol_include_once($dirroot.'doc/'.$file); |
| 532 | - } |
|
| 533 | - catch(Exception $e) |
|
| 541 | + } catch(Exception $e) |
|
| 534 | 542 | { |
| 535 | 543 | dol_syslog($e->getMessage(), LOG_ERR); |
| 536 | 544 | } |
@@ -539,8 +547,11 @@ discard block |
||
| 539 | 547 | |
| 540 | 548 | $modulequalified=1; |
| 541 | 549 | if (! empty($module->version)) { |
| 542 | - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; |
|
| 543 | - else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; |
|
| 550 | + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { |
|
| 551 | + $modulequalified=0; |
|
| 552 | + } else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { |
|
| 553 | + $modulequalified=0; |
|
| 554 | + } |
|
| 544 | 555 | } |
| 545 | 556 | |
| 546 | 557 | if ($modulequalified) |
@@ -548,8 +559,11 @@ discard block |
||
| 548 | 559 | print '<tr class="oddeven"><td width="100">'; |
| 549 | 560 | print $module->name; |
| 550 | 561 | print "</td><td>\n"; |
| 551 | - if (method_exists($module,'info')) print $module->info($langs); |
|
| 552 | - else print $module->description; |
|
| 562 | + if (method_exists($module,'info')) { |
|
| 563 | + print $module->info($langs); |
|
| 564 | + } else { |
|
| 565 | + print $module->description; |
|
| 566 | + } |
|
| 553 | 567 | print '</td>'; |
| 554 | 568 | |
| 555 | 569 | // Activate / Disable |
@@ -567,16 +581,14 @@ discard block |
||
| 567 | 581 | // print img_picto($langs->trans("Enabled"),'on'); |
| 568 | 582 | //} |
| 569 | 583 | print "</td>"; |
| 570 | - } |
|
| 571 | - else |
|
| 584 | + } else |
|
| 572 | 585 | { |
| 573 | 586 | if (versioncompare($module->phpmin,versionphparray()) > 0) |
| 574 | 587 | { |
| 575 | 588 | print "<td align=\"center\">\n"; |
| 576 | 589 | print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off'); |
| 577 | 590 | print "</td>"; |
| 578 | - } |
|
| 579 | - else |
|
| 591 | + } else |
|
| 580 | 592 | { |
| 581 | 593 | print "<td align=\"center\">\n"; |
| 582 | 594 | print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; |
@@ -603,8 +615,7 @@ discard block |
||
| 603 | 615 | if ($module->type == 'pdf') |
| 604 | 616 | { |
| 605 | 617 | $linkspec='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>'; |
| 606 | - } |
|
| 607 | - else |
|
| 618 | + } else |
|
| 608 | 619 | { |
| 609 | 620 | $linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic'); |
| 610 | 621 | } |
@@ -672,8 +683,7 @@ discard block |
||
| 672 | 683 | print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=0">'; |
| 673 | 684 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 674 | 685 | print '</a></td>'; |
| 675 | - } |
|
| 676 | - else |
|
| 686 | + } else |
|
| 677 | 687 | { |
| 678 | 688 | print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=1">'; |
| 679 | 689 | print img_picto($langs->trans("Disabled"),'switch_off'); |
@@ -685,8 +695,7 @@ discard block |
||
| 685 | 695 | print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=0">'; |
| 686 | 696 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 687 | 697 | print '</a></td>'; |
| 688 | - } |
|
| 689 | - else |
|
| 698 | + } else |
|
| 690 | 699 | { |
| 691 | 700 | print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=1">'; |
| 692 | 701 | print img_picto($langs->trans("Disabled"),'switch_off'); |
@@ -698,8 +707,7 @@ discard block |
||
| 698 | 707 | print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=0">'; |
| 699 | 708 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 700 | 709 | print '</a></td>'; |
| 701 | - } |
|
| 702 | - else |
|
| 710 | + } else |
|
| 703 | 711 | { |
| 704 | 712 | print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=1">'; |
| 705 | 713 | print img_picto($langs->trans("Disabled"),'switch_off'); |
@@ -738,8 +746,7 @@ discard block |
||
| 738 | 746 | print '<td class="nowrap" align="right" colspan="2">'; |
| 739 | 747 | print $langs->trans("NotAvailableWhenAjaxDisabled"); |
| 740 | 748 | print "</td>"; |
| 741 | -} |
|
| 742 | -else |
|
| 749 | +} else |
|
| 743 | 750 | { |
| 744 | 751 | print '<td width="60" align="right">'; |
| 745 | 752 | $arrval=array('0'=>$langs->trans("No"), |
@@ -762,8 +769,7 @@ discard block |
||
| 762 | 769 | print '<td class="nowrap" align="right" colspan="2">'; |
| 763 | 770 | print $langs->trans("NotAvailableWhenAjaxDisabled"); |
| 764 | 771 | print "</td>"; |
| 765 | -} |
|
| 766 | -else |
|
| 772 | +} else |
|
| 767 | 773 | { |
| 768 | 774 | print '<td width="60" align="right">'; |
| 769 | 775 | $arrval=array('0'=>$langs->trans("No"), |
@@ -788,8 +794,7 @@ discard block |
||
| 788 | 794 | { |
| 789 | 795 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=0">'; |
| 790 | 796 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 791 | -} |
|
| 792 | -else |
|
| 797 | +} else |
|
| 793 | 798 | { |
| 794 | 799 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=1">'; |
| 795 | 800 | print img_picto($langs->trans("Disabled"),'switch_off'); |
@@ -805,8 +810,7 @@ discard block |
||
| 805 | 810 | { |
| 806 | 811 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=0">'; |
| 807 | 812 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 808 | -} |
|
| 809 | -else |
|
| 813 | +} else |
|
| 810 | 814 | { |
| 811 | 815 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=1">'; |
| 812 | 816 | print img_picto($langs->trans("Disabled"),'switch_off'); |
@@ -824,8 +828,7 @@ discard block |
||
| 824 | 828 | { |
| 825 | 829 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=0">'; |
| 826 | 830 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 827 | -} |
|
| 828 | -else |
|
| 831 | +} else |
|
| 829 | 832 | { |
| 830 | 833 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=1">'; |
| 831 | 834 | print img_picto($langs->trans("Disabled"),'switch_off'); |
@@ -842,8 +845,7 @@ discard block |
||
| 842 | 845 | { |
| 843 | 846 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=0">'; |
| 844 | 847 | print img_picto($langs->trans("Activated"),'switch_on'); |
| 845 | -} |
|
| 846 | -else |
|
| 848 | +} else |
|
| 847 | 849 | { |
| 848 | 850 | print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=1">'; |
| 849 | 851 | print img_picto($langs->trans("Disabled"),'switch_off'); |